18DIR::DIR(
const WCHAR* path)
19 : findHandle(INVALID_HANDLE_VALUE)
21 memset(name, 0,
sizeof(name));
22 wcsncpy(name, path,
sizeof(name)/
sizeof(name[0]));
23 wcsncat(name, L
"\\*",
sizeof(name)/
sizeof(name[0]) - wcslen(name) - 1);
28 if (findHandle != INVALID_HANDLE_VALUE)
30 FindClose(findHandle);
40opendir(
const WCHAR* path)
52dirent* readdir(DIR* dir)
54 WIN32_FIND_DATAW data;
55 if (dir->findHandle != INVALID_HANDLE_VALUE)
57 BOOL result = FindNextFileW(dir->findHandle, &data);
60 if (GetLastError() != ERROR_FILE_NOT_FOUND)
70 dir->findHandle = FindFirstFileW(dir->name, &data);
71 if (dir->findHandle == INVALID_HANDLE_VALUE)
73 if (GetLastError() == ERROR_FILE_NOT_FOUND)
84 memset(gDirEnt.d_name, 0,
sizeof(gDirEnt.d_name));
85 wcsncpy(gDirEnt.d_name, data.cFileName,
86 sizeof(gDirEnt.d_name)/
sizeof(gDirEnt.d_name[0]));
const wchar_t *typedef BOOL