请问wince6.0wifi连接- 如何删除wifi首选网络?
//////////////////////////////////////////////////////////////////////////// adding to the [Preferred Networks]// [Preferred Networks] is a list of SSIDs in preference order.// WZC continuously scans available SSIDs and attempt to connect to the most preferable SSID.void AddToPreferredNetworkList(LPTSTR pszWiFiCard, PWZC_WLAN_CONFIG pwzcConfig, LPTSTR pszSSID){ DWORD dwOutFlags = 0; INTF_ENTRY_EX Intf; DWORD dwStatus; WZC_802_11_CONFIG_LIST *pConfigList; WZC_802_11_CONFIG_LIST *pNewConfigList; DWORD dwDataLen; ULONG uiNumberOfItems; UINT i; memset(&Intf, 0x00, sizeof(INTF_ENTRY_EX)); Intf.wszGuid = pszWiFiCard; dwStatus = WZCQueryInterfaceEx( NULL, INTF_ALL, &Intf, &dwOutFlags); if(dwStatus) { //DEBUGMSG(ZONE_ERROR, (TEXT("Ethman: AddToPreferredNetworkList: WZCQueryInterfaceEx() error dwStatus=0x%0X, dwOutFlags=0x%0X\r\n"), dwStatus, dwOutFlags)); WZCDeleteIntfObjEx(&Intf); return; } pConfigList = (PWZC_802_11_CONFIG_LIST)Intf.rdStSSIDList.pData; if(!pConfigList) // empty [Preferred Networks] list case { dwDataLen = sizeof(WZC_802_11_CONFIG_LIST); pNewConfigList = (WZC_802_11_CONFIG_LIST *)LocalAlloc(LPTR, dwDataLen); pNewConfigList->NumberOfItems = 1; pNewConfigList->Index = 0; memcpy(pNewConfigList->Config, pwzcConfig, sizeof(WZC_WLAN_CONFIG)); Intf.rdStSSIDList.pData = (BYTE*)pNewConfigList; Intf.rdStSSIDList.dwDataLen = dwDataLen; } else { uiNumberOfItems = pConfigList->NumberOfItems; for(i=0; i<uiNumberOfItems; i++) { if(memcmp(&(pwzcConfig->Ssid), &pConfigList->Config[i].Ssid, sizeof(NDIS_802_11_SSID)) == 0) { //DEBUGMSG(ZONE_VERBOSE, (TEXT("Ethman: AddToPreferredNetworkList: The SSID [%s] in registry is already in the [Preferred Networks] list.\r\n"), pszSSID)); WZCDeleteIntfObjEx(&Intf); return; } } //DEBUGMSG(ZONE_VERBOSE, (TEXT("Ethman: AddToPreferredNetworkList: SSID List has [%d] entries.\r\n"), uiNumberOfItems)); //DEBUGMSG(ZONE_VERBOSE, (TEXT("Ethman: AddToPreferredNetworkList: Adding %s to the top of [Preferred Networks]\r\n"), pszSSID)); // this will be the most preferable SSID dwDataLen = sizeof(WZC_802_11_CONFIG_LIST) + (uiNumberOfItems+1)*sizeof(WZC_WLAN_CONFIG); pNewConfigList = (WZC_802_11_CONFIG_LIST *)LocalAlloc(LPTR, dwDataLen); pNewConfigList->NumberOfItems = uiNumberOfItems + 1; pNewConfigList->Index = 0; memcpy(pNewConfigList->Config, pwzcConfig, sizeof(WZC_WLAN_CONFIG)); if(pConfigList->NumberOfItems) { pNewConfigList->Index = pConfigList->Index; memcpy(pNewConfigList->Config+1, pConfigList->Config, (uiNumberOfItems)*sizeof(WZC_WLAN_CONFIG)); LocalFree(pConfigList); pConfigList = NULL; } Intf.rdStSSIDList.pData = (BYTE*)pNewConfigList; Intf.rdStSSIDList.dwDataLen = dwDataLen; } dwStatus = WZCSetInterfaceEx(NULL, INTF_PREFLIST, &Intf, &dwOutFlags); //if(dwStatus) // DEBUGMSG(ZONE_VERBOSE, (TEXT("Ethman: AddToPreferredNetworkList: WZCSetInterfaceEx() error dwStatus=0x%0X, dwOutFlags=0x%0X\r\n"), dwStatus, dwOutFlags)); WZCDeleteIntfObjEx(&Intf);}