Hi, I am trying to call Win32 API from Windows Store App. Since Win32 APIs can not be accessed from WinRT, I have written a Win32 Dll and exposed a function. I am trying to call this function from WinRT App. But I am getting 'Access Denied' Error. Dll Code:
extern "C" __declspec( dllexport )INT32 ScanWlan()
{
// Declare and initialize variables.
HANDLE hClient = NULL;
DWORD dwError = ERROR_SUCCESS;
DWORD dwMaxClient = 2;
DWORD dwCurVersion = 0;
DWORD dwResult = 0;
dwResult = WlanOpenHandle(dwMaxClient, NULL, &dwCurVersion, &hClient);
if (dwResult != ERROR_SUCCESS)
{
WlanCloseHandle(hClient, NULL);
wprintf(L"WlanOpenHandle failed with error: %u\n", dwResult);
return 1;
}
I am able to call this funtion from WinRT App. But 'WlanOpenHandle' function failed with error 5 (ERROR_ACCESS_DENIED). I have done this using administrator login also. But still I am getting the same error. Am I doing the right thing? Can We access Win32 APIs from WinRT Apps through Dlls (at least). Any help? Thank you, Sai