I've noticed that if the path parameter to the CreateFile
function targets \Windows\System32\
the call is failing with the following error code ERROR_PATH_NOT_FOUND
.
The file path is correct, I'm the owner of the folder, so the question is why is the call failing? Did MS add special policy forbidding the folder from being accessed?
Sample code:
TCHAR szFile[MAX_PATH];
PathCombine(szFile, g_szSystemDirectory, "settings.ini");
HANDLE hFile = CreateFile(szFile,
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
0,
NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
printf("INVALID FILE: %i", GetLastError());
return FALSE;
}