5

I am trying to delete all configured WiFi networks on a WM5 mobile device. I have the following code but it returns "failure" every time:

LPWSTR ReturnedMessage2 = NULL;

WCHAR deleteAllNetsXml[] = L""\
L"<wap-provisioningdoc>"\
    L"<nocharacteristic type=\"Wi-Fi\"/>"\
L"</wap-provisioningdoc>";
ProcessWinCEConfig(deleteAllNetsXml, &ReturnedMessage2);

BOOL ProcessWinCEConfig(const WCHAR* ConfigString, LPWSTR *message)
{
    HRESULT hr = DMProcessConfigXML(ConfigString, CFGFLAG_PROCESS, message);
    if (hr == S_OK)
    {
        MessageBox(0, *message, L"SUCCESS", MB_OK|MB_SETFOREGROUND);
    return TRUE;
    }

    MessageBox(0, *message, L"FAILURE", MB_OK|MB_SETFOREGROUND);
    return FALSE;
}

I have tried different approaches with the XML such as adding a tag and just deleting WiFi of type access-point, but nothing seems to work :(

I call the ProcessWinCEConfig for assigning a new network using the XML:

L"<wap-provisioningdoc>"\
    L"<characteristic type=\"Wi-Fi\">"\
        L"<characteristic type=\"access-point\">"\
        L"<characteristic type=\"My-Network\">"\
            L"<parm name=\"Authentication\" value=\"4\"/>"\
            L"<parm name=\"Encryption\" value=\"4\"/>"\
            L"<parm name=\"NetworkKey\" value=\"network-key\"/>"\
            L"</characteristic>"\
        L"</characteristic>"\
    L"</characteristic>"\
L"</wap-provisioningdoc>";

and it works fine. What am I overlooking?

jellier
  • 155
  • 3
  • I assume that you cannot delete all WiFi 'childs' in one call and have to iterate thru all WiFi elements. - Another hint would be the additional use of nocharacteristic-error to get a more speific error msg reported. – josef Nov 01 '12 at 05:36

0 Answers0