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,18 +118,26 @@ 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;
{ {
// Initialize Windows XP visual styles // Note: When a debugger is attached to this process, the WlanUIEditProfile() will raise an exception and fail.
INITCOMMONCONTROLSEX icc; // It was accidentially discovered, that COM initialization resolves this issue.
icc.dwSize = sizeof(INITCOMMONCONTROLSEX); com_initializer com_init(NULL);
icc.dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_LINK_CLASS;
InitCommonControlsEx(&icc); {
// Initialize Windows XP visual styles
INITCOMMONCONTROLSEX icc;
icc.dwSize = sizeof(INITCOMMONCONTROLSEX);
icc.dwICC = ICC_WIN95_CLASSES | ICC_STANDARD_CLASSES | ICC_LINK_CLASS;
InitCommonControlsEx(&icc);
}
pfnWlanReasonCodeToString = WlanReasonCodeToString;
res = WLANManager();
} }
pfnWlanReasonCodeToString = WlanReasonCodeToString;
int res = WLANManager();
assert(!_CrtDumpMemoryLeaks()); assert(!_CrtDumpMemoryLeaks());
return res; return res;
} }