| 222 | |
| 223 | typedef void(*Visit_Proc_W)(wchar_t *short_name, wchar_t *full_name, Version_Data *data); |
| 224 | bool visit_files_w(wchar_t *dir_name, Version_Data *data, Visit_Proc_W proc) { |
| 225 | // Visit everything in one folder (non-recursively). If it's a directory |
| 226 | // that doesn't start with ".", call the visit proc on it. The visit proc |
| 227 | // will see if the filename conforms to the expected versioning pattern. |
| 228 | |
| 229 | auto wildcard_name = concat(dir_name, L"\\*"); |
| 230 | defer{ free(wildcard_name); }; |
| 231 | |
| 232 | WIN32_FIND_DATAW find_data; |
| 233 | auto handle = FindFirstFileW(wildcard_name, &find_data); |
| 234 | if (handle == INVALID_HANDLE_VALUE) return false; |
| 235 | |
| 236 | while (true) { |
| 237 | if ((find_data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && (find_data.cFileName[0] != '.')) { |
| 238 | auto full_name = concat(dir_name, L"\\", find_data.cFileName); |
| 239 | defer{ free(full_name); }; |
| 240 | |
| 241 | proc(find_data.cFileName, full_name, data); |
| 242 | } |
| 243 | |
| 244 | auto success = FindNextFileW(handle, &find_data); |
| 245 | if (!success) break; |
| 246 | } |
| 247 | |
| 248 | FindClose(handle); |
| 249 | |
| 250 | return true; |
| 251 | } |
| 252 | |
| 253 | wchar_t *find_windows_kit_root(HKEY key, wchar_t *version) { |
| 254 | // Given a key to an already opened registry entry, |
no test coverage detected