none
Windows CE 7.0:WlanGetProfileList native api returns empty after device restarts RRS feed

  • Question

  • WlanGetProfileList native api is working as expected until the device restarts. Once the device restart the result of the same api is empty. But still I can see the created profiles under registry values of Windows Compact OS.

    For enabling wifi functionality in WINCE7 I used WLANTOOL. Below is the code from wlantool to get list of profiles created.

    BOOL WlanInterfaces::ListProfileList(LPCWSTR strAdapter)
    {
    BOOL bResult = FALSE;
    DWORD dwError = ERROR_SUCCESS;
    PWLAN_PROFILE_INFO_LIST pProfileList = NULL;    
    do
    {
        if(FALSE == Init())
            break;
    
        WLAN_INTERFACE_INFO* pInterface = NULL;
        if(!GetInterface(strAdapter,&pInterface))
            break;
    
        dwError = WlanGetProfileList(*phClientHandle,
                                     &pInterface->InterfaceGuid,
                                     NULL,
                                     &pProfileList);
    
        if(ERROR_SUCCESS != dwError)
        {
            PrintMsg(L"WlanGetProfileList() Failed Error : %d",dwError);
            break;
        }
    
        if(NULL == pProfileList)
        {
            PrintMsg(L"WlanGetProfileList() returned NULL ProfileList");
            break;
        }
    
        for(DWORD i =0;i<pProfileList->dwNumberOfItems;i++)
        {
            PrintMsg(L"");
            PrintMsg(L"Index           : %lu",i);
            PrintMsg(L"Flags           : %lu",pProfileList->ProfileInfo[i].dwFlags);
            PrintMsg(L"ProfileName     : %s",pProfileList->ProfileInfo[i].strProfileName);
            ListProfile(strAdapter,pProfileList->ProfileInfo[i].strProfileName);
        }
    
        bResult = TRUE;
        }while(FALSE);
    
    if(pProfileList)
        WlanFreeMemory(pProfileList);    
    
    return bResult;
    }

    Any help would be appreciated. Thanks in adavance


    • Edited by achandran Friday, May 11, 2018 7:02 AM
    Friday, May 11, 2018 6:51 AM

All replies

  • You need to set the following registry key in the boot hive (so in between ;HIVE BOOT SECTION tags) and make sure the registry is saved to disk (ie have hive-based persistent registry enabled and auto flushing with every change:

    ;HIVE BOOT SECTION
    
    [HKEY_LOCAL_MACHINE\Init\BootVars] 
        "MasterKeysInRegistry"=dword:1
    
    
    [HKEY_LOCAL_MACHINE\System\ObjectStore\RegFlush]
        "SpawnThread"=dword:1
        "FlushPriority256"=dword:FF
        "ActivityThreshold"=dword:1
        "FlushPeriod"=dword:EA60
    
    ;END HIVE BOOT SECTION




    Good luck,

    Michel Verhagen, eMVP
    Check out my blog: https://guruce.com/blog

    GuruCE
    Microsoft Embedded Partner
    NXP Proven Partner
    https://guruce.com
    Consultancy, training and development services.

    Interested in WEC on i.MX6?
    Get the only 100% stable and best performing i.MX6 BSP for WEC7 and WEC2013 here: https://guruce.com/imx6

    Sunday, May 13, 2018 12:18 PM
    Moderator