I have a rather simple program that computes the CRC32 of files. It works for almost any file, but certain files in the System32 folder are inaccessible.
- The program is written in C++.
- The files that I have issues with are found using fHandle = ::FindFirstFileEx(m_szPathname, FindExInfoStandard, &fData, FindExSearchNameMatch, NULL, FIND_FIRST_EX_CASE_SENSITIVE);
- When FindFirstFile was used those files are not found.
- For only those files, CreateFile returns an error, and GetLastError indicates that the file does not exist. HANDLE fHandle = CreateFile(szPathname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL);
- When I perform a ShellExecute to use cmd.exe to DIR or COPY such files I get different results than if I do the exact same thing from a shell launched from the Start Menu. Specifically once again those files are not found.
There has got to be some sort of magic involved, but I haven't found anything online that speaks to what that magic might be.