Baffling Error!
-
In Windows File Explorer I'm able to navigate to the folder "C:\Windows\System32\WDI". However, when I try to open a handle to that directory, it inexplicably says that the path is not found! The code I'm using is below. Does anyone know what I could be doing wrong? (I'm running Visual Studio as Admin, so that when I debug the program it should also be running as Admin.)
int main()
{
std::wstring Directory = L"C:\\Windows\\System32\\WDI\\*.*";
WIN32_FIND_DATA FindData;HANDLE FINDHANDLE = FindFirstFile(Directory.c\_str(), &FindData); if (FINDHANDLE != INVALID\_HANDLE\_VALUE) { std::cout << "IT WORKED!\\r\\n"; } else { std::cout << "DID NOT WORK!\\r\\n"; DWORD Error = GetLastError(); std::cout << "ERROR: " << Error << "\\r\\n"; }
}
It prints "Error: 3" which is "The system cannot find the path specified." Note that it does not say "Access is denied".
The difficult we do right away... ...the impossible takes slightly longer.
-
In Windows File Explorer I'm able to navigate to the folder "C:\Windows\System32\WDI". However, when I try to open a handle to that directory, it inexplicably says that the path is not found! The code I'm using is below. Does anyone know what I could be doing wrong? (I'm running Visual Studio as Admin, so that when I debug the program it should also be running as Admin.)
int main()
{
std::wstring Directory = L"C:\\Windows\\System32\\WDI\\*.*";
WIN32_FIND_DATA FindData;HANDLE FINDHANDLE = FindFirstFile(Directory.c\_str(), &FindData); if (FINDHANDLE != INVALID\_HANDLE\_VALUE) { std::cout << "IT WORKED!\\r\\n"; } else { std::cout << "DID NOT WORK!\\r\\n"; DWORD Error = GetLastError(); std::cout << "ERROR: " << Error << "\\r\\n"; }
}
It prints "Error: 3" which is "The system cannot find the path specified." Note that it does not say "Access is denied".
The difficult we do right away... ...the impossible takes slightly longer.
Nope you program doesn't get admin rights just because visual studio has them. It launches the created EXE
In vino veritas
-
In Windows File Explorer I'm able to navigate to the folder "C:\Windows\System32\WDI". However, when I try to open a handle to that directory, it inexplicably says that the path is not found! The code I'm using is below. Does anyone know what I could be doing wrong? (I'm running Visual Studio as Admin, so that when I debug the program it should also be running as Admin.)
int main()
{
std::wstring Directory = L"C:\\Windows\\System32\\WDI\\*.*";
WIN32_FIND_DATA FindData;HANDLE FINDHANDLE = FindFirstFile(Directory.c\_str(), &FindData); if (FINDHANDLE != INVALID\_HANDLE\_VALUE) { std::cout << "IT WORKED!\\r\\n"; } else { std::cout << "DID NOT WORK!\\r\\n"; DWORD Error = GetLastError(); std::cout << "ERROR: " << Error << "\\r\\n"; }
}
It prints "Error: 3" which is "The system cannot find the path specified." Note that it does not say "Access is denied".
The difficult we do right away... ...the impossible takes slightly longer.
-
Hi, There is a file system redirection associated with that folder. You need to add a call to the Wow64DisableWow64FsRedirection function[^] from a 32 bit process. Don't forget to revert[^]. Best Wishes, -David Delaune
Thank you David. I was tearing my hair out. :)
The difficult we do right away... ...the impossible takes slightly longer.