Debugging-related exception in WlanUIEditProfile() resolved

This commit is contained in:
Simon Rozman 2017-02-22 11:11:57 +01:00
parent 8fbcf27f6a
commit 4598528765

View File

@ -90,7 +90,6 @@ static int WLANManager()
} }
// Launch WLAN profile config dialog. // Launch WLAN profile config dialog.
// Note: When a debugger is attached to this process the WlanUIEditProfile() will raise an exception and fail.
WLAN_REASON_CODE wlrc; WLAN_REASON_CODE wlrc;
DWORD dwResult = WlanUIEditProfile(WLAN_UI_API_VERSION, pwcArglist[2], &(interfaces->InterfaceInfo[i].InterfaceGuid), NULL, WLSecurityPage, NULL, &wlrc); DWORD dwResult = WlanUIEditProfile(WLAN_UI_API_VERSION, pwcArglist[2], &(interfaces->InterfaceInfo[i].InterfaceGuid), NULL, WLSecurityPage, NULL, &wlrc);
if (dwResult != ERROR_SUCCESS) { if (dwResult != ERROR_SUCCESS) {
@ -119,6 +118,13 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
UNREFERENCED_PARAMETER(lpCmdLine); UNREFERENCED_PARAMETER(lpCmdLine);
UNREFERENCED_PARAMETER(nCmdShow); UNREFERENCED_PARAMETER(nCmdShow);
int res = 0;
{
// Note: When a debugger is attached to this process, the WlanUIEditProfile() will raise an exception and fail.
// It was accidentially discovered, that COM initialization resolves this issue.
com_initializer com_init(NULL);
{ {
// Initialize Windows XP visual styles // Initialize Windows XP visual styles
INITCOMMONCONTROLSEX icc; INITCOMMONCONTROLSEX icc;
@ -129,7 +135,8 @@ int CALLBACK WinMain(_In_ HINSTANCE hInstance, _In_ HINSTANCE hPrevInstance, _In
pfnWlanReasonCodeToString = WlanReasonCodeToString; pfnWlanReasonCodeToString = WlanReasonCodeToString;
int res = WLANManager(); res = WLANManager();
}
assert(!_CrtDumpMemoryLeaks()); assert(!_CrtDumpMemoryLeaks());
return res; return res;