USB 메모리에 WinPE 입히기
/* * Tux Droid - Wifi channel retrieving for windows. * Copyright (C) 2008 C2ME Sa * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2, or (at your option) * any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA * 02111-1307, USA. */ #include <stdio.h> #include <stdlib.h> #include <stdbool.h> #include <winsock2.h> #define NUMBEROFSSIDS 10 /** * \name NDIS structures and defines. * @{ */ /** Device type physical netcard */ #define FILE_DEVICE_PHYSICAL_NETCARD 23 /** File access type any */ #define FILE_ANY_ACCESS 0 /** File access method out direct */ #define METHOD_OUT_DIRECT 2 /** * This macro is used to create a unique system I/O control code (IOCTL). */ #define CTL_CODE(DeviceType, Function, Method, Access)( \ ((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method)) /** NDIS IOCTL */ #define _NDIS_CONTROL_CODE(request, method) \ CTL_CODE(FILE_DEVICE_PHYSICAL_NETCARD, request, method, FILE_ANY_ACCESS) /** NDIS IOCTL Query global stats */ #define IOCTL_NDIS_QUERY_GLOBAL_STATS _NDIS_CONTROL_CODE(0, METHOD_OUT_DIRECT) /** NDIS OID code for SSID */ #define OID_802_11_SSID 0x0D010102 /** NDIS OID code for BSSID list */ #define OID_802_11_BSSID_LIST 0x0D010217 /** NDIS OID code for BSSID list scan */ #define OID_802_11_BSSID_LIST_SCAN 0x0D01011A /** * \brief This enumerated type holds the network subtype values for the * physical layer of used with a specific driver. */ typedef enum _NDIS_802_11_NETWORK_TYPE { Ndis802_11FH, /**< Indicates the physical layer of the frequency hopping spread-spectrum radio. */ Ndis802_11DS, /**< Indicates the physical layer of the direct sequencing spread-spectrum radio. */ Ndis802_11NetworkTypeMax /**< Specifies the upper bound. */ } NDIS_802_11_NETWORK_TYPE, *PNDIS_802_11_NETWORK_TYPE; /** * \brief This data type is used to provide a received signal strength * indication (RSSI). */ typedef LONG NDIS_802_11_RSSI; /** * \brief specifies the frequency-hopping configuration for an * NDIS_802_11_CONFIGURATION structure. * \param Length Specifies the length of the NDIS_802_11_CONFIGURATION_FH * structure in bytes. * \param HopPattern Specifies the hop pattern used to determine the hop * sequence. As defined by the 802.11 standard, the layer * management entity (LME) of the physical layer uses a hop * pattern to determine the hop sequence. * \param HopSet Specifies a set of patterns. The LME of the physical layer * uses these patterns to determine the hop sequence. * \param DwellTime Specifies the maximum period of time during which the * transmitter should remain fixed on a channel. This interval * is described in K탎ec (1024 탎ec). */ typedef struct _NDIS_802_11_CONFIGURATION_FH { ULONG Length; ULONG HopPattern; ULONG HopSet; ULONG DwellTime; } NDIS_802_11_CONFIGURATION_FH, *PNDIS_802_11_CONFIGURATION_FH; /** * \brief Structure to describe the configuration of a radio. * \param Length Specifies the length of the NDIS_802_11_CONFIGURATION * structure in bytes. * \param BeaconPeriod Specifies the interval between beacon message * transmissions. This value is specified in K탎ec * (1024 탎ec). * \param ATIMWindow Specifies the announcement traffic information message * (ATIM) window in K탎ec (1024 탎ec). The ATIM window is * a short time period immediately after the transmission * of each beacon in an IBSS configuration. During the ATIM * window, any station can indicate the need to transfer data * to another station during the following data-transmission * window. * \param DSConfig Specifies the frequency of the selected channel in kHz. * \param FHConfig Specifies the frequency-hopping configuration in an * NDIS_802_11_CONFIGURATION_FH structure. */ typedef struct _NDIS_802_11_CONFIGURATION { ULONG Length; ULONG BeaconPeriod; ULONG ATIMWindow; ULONG DSConfig; NDIS_802_11_CONFIGURATION_FH FHConfig; } NDIS_802_11_CONFIGURATION, *PNDIS_802_11_CONFIGURATION; /** * \brief This enumerated type holds specific infrastructure values for the * miniport driver to set in an 802.11 NIC. */ typedef enum _NDIS_802_11_NETWORK_INFRASTRUCTURE { Ndis802_11IBSS, /**< Specifies the independent basic service set (IBSS) mode. This mode is also known as ad hoc mode. */ Ndis802_11Infrastructure, /**< Specifies the infrastructure mode. */ Ndis802_11AutoUnknown, /**< Specifies an automatic mode. In this mode, the 802.11 NIC can switch between ad hoc and infrastructure modes as required. */ Ndis802_11InfrastructureMax /**< Specifies the upper bound. */ } NDIS_802_11_NETWORK_INFRASTRUCTURE, *PNDIS_802_11_NETWORK_INFRASTRUCTURE; /** * \brief This enumerated type holds the 802.11 authentication mode value to * invoke Open system or Shared Key authentication services. */ typedef enum _NDIS_802_11_AUTHENTICATION_MODE { Ndis802_11AuthModeOpen, /**< Specifies 802.11 open authentication mode. There are no checks when accepting clients in this mode. */ Ndis802_11AuthModeShared, /**< Specifies 802.11 shared authentication that uses a pre-shared wired equivalent privacy (WEP) key. */ Ndis802_11AuthModeAutoSwitch, /**< Specifies auto-switch mode. When using auto-switch mode, the NIC tries 802.11 shared authentication mode first. If shared mode fails, the NIC attempts to use 802.11 open authentication mode. */ Ndis802_11AuthModeMax /**< Defines the upper bound. */ } NDIS_802_11_AUTHENTICATION_MODE, *PNDIS_802_11_AUTHENTICATION_MODE; /** * \brief This data type provides a way to handle the data rates associated * with 802.11 delivery. */ typedef UCHAR NDIS_802_11_RATES[8]; /** * \brief This data type holds the MAC address of the associated access point. * The setting is useful when doing a site survey. */ typedef UCHAR NDIS_802_11_MAC_ADDRESS[6]; /** * \brief OID_802_11_SSID uses this structure when it requests a miniport * driver to set or return the NIC service set identifier (SSID) value. * \param SsidLength Specifies the length of the Ssid member in octets. * \param Ssid Specifies the SSID. An empty string (that is, a string with the * first byte set to zero) requests the 802.11 NIC to associate * with any available SSID. */ typedef struct _NDIS_802_11_SSID { ULONG SsidLength; UCHAR Ssid[32]; } NDIS_802_11_SSID, *PNDIS_802_11_SSID; /** * \brief This structure contains an array of Basic Service Set (BSS) data used * by NDIS_802_11_BSSID_LIST. * \param Length Specifies the length of the NDIS_WLAN_BSSID structure. * \param MacAddress Specifies a media access control (MAC) address. Each * access point has a unique MAC address that is the same * as the BSSID. * \param Reserved Do not use. This member maintains the DWORD alignment of the * structure. * \param Ssid Specifies an SSID as defined in the NDIS_802_11_SSID structure. * \param Privacy Specifies a WEP encryption requirement. * \param Rssi Specifies the Received Signal Strength Indication (RSSI) in dBm. * \param NetworkTypeInUse Specifies the network type as defined in the * NDIS_802_11_NETWORK_TYPE enumeration. * \param Configuration Specifies the radio parameter configuration as defined * in the NDIS_802_11_CONFIGURATION structure. * \param InfrastructureMode Specifies the infrastructure mode as defined in * the NDIS_802_11_NETWORK_INFRASTRUCTURE * enumeration. * \param SupportedRates Specifies a set of supported rates defined in an * NDIS_802_11_RATES array. */ typedef struct _NDIS_WLAN_BSSID { ULONG Length; NDIS_802_11_MAC_ADDRESS MacAddress; UCHAR Reserved[2]; NDIS_802_11_SSID Ssid; ULONG Privacy; NDIS_802_11_RSSI Rssi; NDIS_802_11_NETWORK_TYPE NetworkTypeInUse; NDIS_802_11_CONFIGURATION Configuration; NDIS_802_11_NETWORK_INFRASTRUCTURE InfrastructureMode; NDIS_802_11_RATES SupportedRates; } NDIS_WLAN_BSSID, *PNDIS_WLAN_BSSID; /** * \brief Structure used by OID_802_11_BSSID_LIST to request that a miniport * driver return a list containing all basic service set identifiers * (BSSIDs) and their attributes, as listed in the 802.11 NIC database. * \param NumberOfItems Specifies the number of items contained in the Bssid * array. This array must contain at least one item. * \param Bssid Specifies an array of NDIS_WLAN_BSSID structures. */ typedef struct _NDIS_802_11_BSSID_LIST { ULONG NumberOfItems; NDIS_WLAN_BSSID Bssid[1]; } NDIS_802_11_BSSID_LIST, *PNDIS_802_11_BSSID_LIST; /** @} */ /** Static adaptors list for XP mode */ static int _adaptators_list[20]; /** Static adaptors list size for XP mode */ static int _adaptators_count = 0; /** * \brief Retrieve a key value from the registry. * \param hKey HKEY. * \param szPath Entry path. * \param szKey Key name. * \param szBuffer Buffer which will contains the key value. * \param dwSize Buffer value size. * \return The success of the key reading. */ static bool registry_get_keyvalue(HKEY hKey, char *szPath, char *szKey, char *szBuffer, DWORD dwSize) { HKEY rk = NULL; if (RegOpenKeyEx(hKey, szPath, 0, KEY_READ, &rk) != ERROR_SUCCESS) { return false; } if (RegQueryValueEx(rk, szKey, NULL, NULL, (unsigned char *)szBuffer, &dwSize) != ERROR_SUCCESS) { return false; } RegCloseKey(rk); return true; } /** * \brief Retrieve the adaptators index in an internal list. */ static void retrieve_network_adaptators(void) { char szKey[128]; DWORD dwSize = 256; HKEY rk = NULL; int i = 0; _adaptators_count = 0; if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards", 0, KEY_READ, &rk) == ERROR_SUCCESS) { while (RegEnumKeyEx(rk, i, szKey, &dwSize, NULL, NULL, NULL, NULL) == ERROR_SUCCESS) { _adaptators_list[_adaptators_count] = atoi(szKey); _adaptators_count++; dwSize = 256; i++; } RegCloseKey(rk); } } /** * \brief Open a network adaptator. * \param szAdapterName Adaptator service name. * \return The adaptator handle. */ static HANDLE open_adaptator(char *szAdapterName) { HANDLE hAdapter; char szAdapter[MAX_PATH]; _snprintf(szAdapter, sizeof(szAdapter) - 1, "\\\\.\\%s", szAdapterName); hAdapter = CreateFile(szAdapter, GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, 0, NULL); return hAdapter; } /** * \brief Get the used channel in an adaptator. * \param hAdapter Adaptator handle. * \param requested_SSID SSID that you want in priority. * \return The channel number or -1 if fail. */ static int get_channel_from_adaptator(HANDLE hAdapter, char *requested_SSID) { ULONG dwBytes, dwOIDCode; int i; NDIS_802_11_BSSID_LIST *pList; NDIS_802_11_SSID pBSsid; int _channel = -1; int _bestRssi = -200; /* If no SSID specified then attempt to retrieve the current * used SSID */ if (strcmp("", requested_SSID) == 0) { /* Zerofill the SSID structure */ memset(&pBSsid, 0, sizeof(NDIS_802_11_SSID)); /* Set OID code to SSID request */ dwOIDCode = OID_802_11_SSID; /* Used SSID request */ DeviceIoControl(hAdapter, IOCTL_NDIS_QUERY_GLOBAL_STATS, &dwOIDCode, sizeof(dwOIDCode), &pBSsid, sizeof(pBSsid), &dwBytes, NULL); /* Set the prior SSID with the one used by the adaptator. * If no SSID found the value is "" */ requested_SSID = pBSsid.Ssid; } /* Memory allocation for the network list */ pList = (NDIS_802_11_BSSID_LIST *)VirtualAlloc(NULL, sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROFSSIDS, MEM_RESERVE | MEM_COMMIT, PAGE_READWRITE); if (!pList) { /* Memory allocation failed then return -1 */ return _channel; } else { /* Set OID code to BSSID_LIST_SCAN request */ dwOIDCode = OID_802_11_BSSID_LIST_SCAN; /* Wifi network scanning */ DeviceIoControl(hAdapter, IOCTL_NDIS_QUERY_GLOBAL_STATS, &dwOIDCode, sizeof(dwOIDCode), ( ULONG *)NULL, 0, &dwBytes, NULL); /* Leave to breath the device ;) */ Sleep(100); /* Zerofill the BSSID list */ memset(pList, 0, sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROFSSIDS); /* Set OID code to BSSID_LIST request */ dwOIDCode = OID_802_11_BSSID_LIST; /* Retrieve the wifi networks from the previous scanning */ if (!DeviceIoControl(hAdapter, IOCTL_NDIS_QUERY_GLOBAL_STATS, &dwOIDCode, sizeof(dwOIDCode), ( ULONG *)pList, sizeof(NDIS_802_11_BSSID_LIST) * NUMBEROFSSIDS, &dwBytes, NULL)) { /* Scanning failed then return -1 */ return _channel; } } /* Browse the BSSID list */ for (i = 0; i < (int)pList->NumberOfItems; i++) { NDIS_WLAN_BSSID *cpSsid = &pList->Bssid[0]; int temp = i; /* Get the next BSSID structure pointer. * ( This operation is need because the BSSID structure length * is not constant )*/ while(temp != 0) { cpSsid=(NDIS_WLAN_BSSID *)((char*)cpSsid + cpSsid->Length); temp--; } /* If the SSID of the current BSSID structure is the prior SSID * then get its channel */ if (strcmp(requested_SSID, cpSsid->Ssid.Ssid) == 0) { /* Determine the channel from the radio frequency. * Channel = (frequency - 2407000) / 5000 */ _channel = (cpSsid->Configuration.DSConfig - 2407000) / 5000; break; } /* Determine the stronger network power to return its channel if * no prior SSID is defined */ if (cpSsid->Rssi > _bestRssi) { _channel = (cpSsid->Configuration.DSConfig - 2407000) / 5000; _bestRssi = cpSsid->Rssi; } } /* Return the used channel */ return _channel; } /** * \brief Get the currently used wifi channel. * You can define a prior SSID name in the first argument. * Return the current used channel or -1. */ int get_wifi_channel(char *requested_SSID) { int channel = -1; DWORD dwVersion = 0; DWORD dwMajorVersion = 0; /* Get the Windows version. */ dwVersion = GetVersion(); dwMajorVersion = (DWORD)(LOBYTE(LOWORD(dwVersion))); /* If the version is older than vista */ if (dwMajorVersion < 6) { char szAdapter[128], szServiceName[128]; HANDLE hAdapter; int i; retrieve_network_adaptators(); for (i = 0; i < _adaptators_count; i++) { _snprintf(szAdapter, sizeof(szAdapter) - 1, "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\NetworkCards\\%d", _adaptators_list[i]); registry_get_keyvalue(HKEY_LOCAL_MACHINE, szAdapter, "ServiceName", szServiceName, sizeof(szServiceName) - 1); hAdapter = open_adaptator(szServiceName); if (hAdapter != INVALID_HANDLE_VALUE) { channel = get_channel_from_adaptator(hAdapter, requested_SSID); if (channel != -1) { break; } } } } /* Version is vista or more recently */ else { /* * This way to retrieve the Wifi channel currently used is a bit tricky. * Previously, an easiest code was written, but was parsing directly the * strings. * The major problem is that netsh return translated strings. So it's * it's almost impossible to do it working for all languages ! * * This maner search for string untralsted, like SSID or BSSID, and count * the lines to retrieve the channel. */ FILE *pcmd; char buff[80]; char connected_SSID[32]; char current_SSID[32]; /* If no SSID specified then attempt to retrieve the current * used SSID */ if (strcmp("", requested_SSID) == 0) { pcmd = popen("netsh wlan show interface", "r"); if (pcmd != NULL) { while(fgets(buff, 80, pcmd)) { /* Parse the string : Be sure to considere the SSID line, * and not BSSID */ if ((strstr(buff, "SSID") != NULL) && (strstr(buff, "BSSID") == NULL)) { sscanf(strrchr(buff, ':'), ": %s", &connected_SSID[0]); /* Assign the active SSID */ requested_SSID = connected_SSID; break; } } fclose(pcmd); } } /* Search the channel */ pcmd = popen("netsh wlan show network mode=BSSID", "r"); if (pcmd != NULL) { while(fgets(buff, 80, pcmd)) { /* Search for the correct SSID */ if ((strstr(buff, "SSID") != NULL) && (strstr(buff, "BSSID") == NULL)) { sscanf(strrchr(buff, ':'), ": %s", ¤t_SSID[0]); /* If the current scanned SSID is the requested one, * continue */ if (strcmp(current_SSID,requested_SSID) == 0) { break; } } } while (fgets(buff, 80, pcmd)) { /* Search for BSSID */ if (strstr(buff, "BSSID") != NULL) { /* Dummy reads : - Signal - RF type */ fgets(buff, 80, pcmd); fgets(buff, 80, pcmd); /* Retrive the channel */ fgets(buff, 80, pcmd); sscanf(strrchr(buff, ':'), ": %d", &channel); break; } } fclose(pcmd); } } return channel; } /** * \brief Program entry point. * You can define a prior SSID name in the first argument. * Return the current used channel or -1. */ int main(int argc, char *argv[]) { char *requested_SSID = ""; /* Set SSID name to search */ if (argc > 1) { requested_SSID = argv[1]; } printf("Wifi channel is : %d\n", get_wifi_channel(requested_SSID)); return get_wifi_channel(requested_SSID); }
eBay 경매에서 입찰한 후 (낙찰전 12시간) 상품 대금 지불 전이라면 이제 취소가 가능합니다. 고의성 없는 입찰 취소는 eBay에서 허용하는 혜택입니다. 다만, 즉시 구매로 이루어진 경매는 취소가 원칙적으로 불가 합니다. 판매자에 따라 지불전에 페널티를 내면 취소해주는 판매자가 있기도 합니다.
eBay 취소 링크 바로가기 (eBay Bid Retraction)
(http://offer.ebay.com/ws/eBayISAPI.dll?RetractBidShow)
조건: 낙찰전 12시간 전에 eBay에서 직접 개인 신청, 낙찰전 12시간안에 입찰 하였다면, 입찰액을 잘못 입력하였을 시에 입찰후 1시간안에 직접 개인 신청할시에 입찰 취소가 가능합니다. 낙찰 받은후에는 보통 취소가 가능하지 않으니, 입찰 하실때에는 심사 숙고 하셔야 합니다.
이상 출처 : http://www.most7.com/static/guide_cancel.php
오늘 입찰 하나를 했는데... 완전 허걱 했습니다.
22시간 전이기 때문에 가격이 아직 안올라서 그런갑다~ 하고 10달러를 써줬는데...
소프트웨어 였는데.. 헉.... 제품설명에 보니깐 시리얼키가 없어서 90일만 쓸수 있다... ㅡㅜ
젠장... 어쩐지 이상하드라.. 아무리 my ebay를 뒤져도 입찰 취소를 찾을 수가 없는겁니다.
떨리는 가슴... 구글로 검색 해 봤더니... 취소 따라가는 메뉴는 없고.. 직 링크..
바로 취소해주구 맘 놓고 있습니다. 이제 조심해야지... ^^