Home > other >  WlanSetProfileEapXmlUserData apis in Windows 7 64 - bit error report 1206
WlanSetProfileEapXmlUserData apis in Windows 7 64 - bit error report 1206

Time:09-18

Wlanapi recently in a tool, used to configure the wireless network, I found that this API using WlanSetProfileEapXmlUserData on Windows 7 64 - bit is always an error 1206 errors, but there is no problem on Windows 7 32 bit,

Code: https://github.com/wufeng6174/code/tree/master/SetEapData
A wireless network profile: https://github.com/wufeng6174/code/blob/master/sxf-profile.xml





# # ifndef UNICODE
# define UNICODE
# endif

# include & lt; Windows. H>
# include & lt; Wlanapi. H>
# include & lt; Objbase. H>
# include & lt; Wtypes. H>

# include & lt; stdio.h>
# include & lt; Stdlib. H>

# include & lt; Eaptypes. H>

//Need to link with Wlanapi. Lib and Ole32. Lib
# pragma comment (lib, "wlanapi. Lib")
# pragma comment (lib, "ole32. Lib")

using namespace std;

Int wmain (int arg c, char * * argv)
{

//Declare and initialize variables.

HANDLE hClient=NULL;
DWORD dwMaxClient=2;//
DWORD dwCurVersion=0;
DWORD dwResult=0;
DWORD dwRetVal=0;


/* variables, informs the for WlanEnumInterfaces */

PWLAN_INTERFACE_INFO_LIST pIfList=NULL;

LPCWSTR XML=L "& lt; ? The XML version=\ \ "1.0"?>
\ n"L "& lt; EapHostUserCredentials XMLNS=\ \ "http://www.microsoft.com/provisioning/EapHostUserCredentials" \ n ", "
L "XMLNS: eapCommon=" http://www.microsoft.com/provisioning/EapCommon\ "\ n"
L "XMLNS: baseEap=" http://www.microsoft.com/provisioning/BaseEapMethodUserCredentials\ "& gt;
\ n"L "& lt; EapMethod>
\ n"L "& lt; EapCommon: Type> 25 & lt;/eapCommon: Type>
\ n"L "& lt; EapCommon: AuthorId> 0 & lt;/eapCommon: AuthorId>
\ n"L "& lt;/EapMethod>
\ n"L "& lt; Credentials XMLNS: eapUser=\ \ "http://www.microsoft.com/provisioning/EapUserPropertiesV1" \ n ", "
L "XMLNS: xsi=" http://www.w3.org/2001/XMLSchema-instance\ "\ n"
L "XMLNS: baseEap=" http://www.microsoft.com/provisioning/BaseEapUserPropertiesV1\ "\ n"
L "XMLNS: MsPeap=" http://www.microsoft.com/provisioning/MsPeapUserPropertiesV1\ "\ n"
L "XMLNS: MsChapV2=" http://www.microsoft.com/provisioning/MsChapV2UserPropertiesV1\ "& gt;
\ n"L "& lt; BaseEap: Eap>
\ n"L "& lt; BaseEap: Type> 25 & lt;/baseEap: Type>
\ n"L "& lt; MsPeap: EapType>
\ n"L "& lt; MsPeap: RoutingIdentity> Sxf
\ n"L "& lt; BaseEap: Eap>
\ n"L "& lt; BaseEap: Type> 26 & lt;/baseEap: Type>
\ n"L "& lt; MsChapV2: EapType>
\ n"L "& lt; MsChapV2: Username> 52950 & lt;/MsChapV2: Username>
\ n"L "& lt; MsChapV2: Password> Dlw6666 & lt;/MsChapV2: Password>
\ n"L "& lt; MsChapV2: LogonDomain>
\ n"L "& lt;/MsChapV2: EapType>
\ n"L "& lt;/baseEap: Eap>
\ n"L "& lt;/MsPeap: EapType>
\ n"L "& lt;/baseEap: Eap>
\ n"L "& lt;/Credentials>
\ n"L "& lt;/EapHostUserCredentials> ";



DwResult=WlanOpenHandle (dwMaxClient, NULL, & amp; DwCurVersion, & amp; HClient);
If (dwResult! ERROR_SUCCESS)={
Wprintf (L "WlanOpenHandle failed with error: % u \ n", dwResult);
return 1;
//You can use FormatMessage here to find out according to the function failed
}

DwResult=WlanEnumInterfaces (hClient, NULL, & amp; PIfList);
If (dwResult! ERROR_SUCCESS)={
Wprintf (L "WlanEnumInterfaces failed with error: % u \ n", dwResult);
return 1;
//You can use FormatMessage here to find out according to the function failed
}
The else {
Wprintf (L "Num Entries: % lu \ n", pIfList - & gt; DwNumberOfItems);
Wprintf (L "Current Index: % lu \ n", pIfList - & gt; DwIndex);

DwResult=WlanSetProfileEapXmlUserData (hClient, & amp; PIfList - & gt; InterfaceInfo [0]. InterfaceGuid, L "SXF", 1, XML, NULL);

If (dwResult! ERROR_SUCCESS)={
Wprintf (L "WlanSetProfileEapXmlUserData failed with error: % u \ n",
DwResult);
//You can use FormatMessage to find out according to the function failed
}


Return dwResult;
}

If (pIfList!=NULL) {
WlanFreeMemory (pIfList);
PIfList=NULL;
}

Return dwRetVal;
}

CodePudding user response:

The building Lord, I met the same problem like you, but I also on 32 bit error! Wlansetprofile () returns the correct, but WlanSetProfileEapXmlUserData () error 1206
  • Related