此代码适用于家庭中的Windows XP,但在64位Windows 7上无法正常工作.尽管提供的文件夹中有超过50个文件,但循环仍未输入一次.它不仅没有进入,这也返回ERROR_NO_MORE_FILES了GetLastError.为什么?
string dir = "d:\\validfolder";
WIN32_FIND_DATA ffd;
HANDLE h = FindFirstFile(dir.c_str(), &ffd);
while(FindNextFile(h, &ffd))
{
// some operation
}
DWORD dw = GetLastError();// returns ERROR_NO_MORE_FILES
Run Code Online (Sandbox Code Playgroud)
我尝试Wow64DisableWow64FsRedirection但是没有效果.