WinXP SP2 WMI Problem

Discussion in 'Wireless Networking' started by Dmitry Andrianov, Jul 13, 2004.

  1. Hi All

    I'm trying to set SSID for adapter
    (Intel(R) PRO/Wireless 2100 LAN 3B Mini PCI Adapter, drivers v 1.6.0.46)
    using WMI(see code below).

    CoInitializeEx(NULL, COINIT_MULTITHREADED);

    CoInitializeSecurity(NULL, -1, NULL, NULL,
    RPC_C_AUTHN_LEVEL_CONNECT,
    RPC_C_IMP_LEVEL_IMPERSONATE,
    NULL, EOAC_NONE, 0);

    CComPtr<IWbemLocator> pLocator;
    pLocator.CoCreateInstance(__uuidof(WbemLocator));

    CComPtr<IWbemServices> pServices;
    pLocator->ConnectServer(CComBSTR(TEXT("root\\wmi")),
    NULL,
    NULL,
    NULL,
    0,
    NULL,
    NULL,
    &pServices);

    char* szSsid = "Test ssid";
    CComBSTR bstrPath = L"MSNdis_80211_ServiceSetIdentifier='Intel(R)
    PRO/Wireless 2100 LAN 3B Mini PCI Adapter'";

    CComPtr<IWbemClassObject> pSsid;
    pServices->GetObject(bstrPath,
    WBEM_FLAG_RETURN_WBEM_COMPLETE,
    NULL,
    &pSsid,
    NULL);

    SAFEARRAY* psa = SafeArrayCreateVector(VT_UI1, 0, 32 + 1);

    BYTE* pData;
    SafeArrayAccessData(psa, (PVOID*) &pData);

    pData[0] = (BYTE) lstrlenA(szSsid);
    memcpy(pData + 4, szSsid, min(32 - sizeof(ULONG), lstrlenA(szSsid)));

    SafeArrayUnaccessData(psa);

    CComVariant vSsid;
    vSsid.vt = VT_ARRAY | VT_UI1;
    vSsid.parray = psa;

    pSsid->Put(TEXT("Ndis80211SsId"), 0, &vSsid, 0);

    pServices->PutInstance(pSsid, WBEM_FLAG_UPDATE_ONLY, NULL, NULL);

    CoUninitialize();

    On Windows XP with SP1 all is ok,
    but after installation SP2(v 2138) PutInstance always return
    0x8004100C - wbemErrNotSupported.

    Could anyone help me ?
    Dmitry Andrianov, Jul 13, 2004
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. mcode

    WMI / NDIS / WINDOWS 2000 PRO SP4

    mcode, Apr 1, 2005, in forum: Wireless Networking
    Replies:
    1
    Views:
    756
    Pavel A.
    Apr 2, 2005
  2. =?Utf-8?B?cGNnZng4MDU=?=

    WMI corruption

    =?Utf-8?B?cGNnZng4MDU=?=, Apr 30, 2005, in forum: Wireless Networking
    Replies:
    8
    Views:
    5,027
    Malke
    May 2, 2005
  3. =?Utf-8?B?cGNnZng4MDU=?=

    WMI - Still corrupt

    =?Utf-8?B?cGNnZng4MDU=?=, May 18, 2005, in forum: Wireless Networking
    Replies:
    3
    Views:
    3,499
    =?Utf-8?B?cHJlc2lkZW50IHBvbA==?=
    Jul 5, 2005
  4. =?Utf-8?B?QmlsbA==?=

    Wireless WMI connection

    =?Utf-8?B?QmlsbA==?=, Dec 28, 2005, in forum: Wireless Networking
    Replies:
    1
    Views:
    3,321
    Pavel A.
    Dec 30, 2005
  5. Kue2
    Replies:
    10
    Views:
    1,203
    =?Utf-8?B?U3RldmU=?=
    Mar 17, 2007
Loading...

Share This Page