| 165 | |
| 166 | #ifdef _WIN_ALL |
| 167 | HANDLE FindFile::Win32Find(HANDLE hFind,const wchar *Mask,FindData *fd) |
| 168 | { |
| 169 | WIN32_FIND_DATA FindData; |
| 170 | if (hFind==INVALID_HANDLE_VALUE) |
| 171 | { |
| 172 | hFind=FindFirstFile(Mask,&FindData); |
| 173 | if (hFind==INVALID_HANDLE_VALUE) |
| 174 | { |
| 175 | wchar LongMask[NM]; |
| 176 | if (GetWinLongPath(Mask,LongMask,ASIZE(LongMask))) |
| 177 | hFind=FindFirstFile(LongMask,&FindData); |
| 178 | } |
| 179 | if (hFind==INVALID_HANDLE_VALUE) |
| 180 | { |
| 181 | int SysErr=GetLastError(); |
| 182 | // We must not issue an error for "file not found" and "path not found", |
| 183 | // because it is normal to not find anything for wildcard mask when |
| 184 | // archiving. Also searching for non-existent file is normal in some |
| 185 | // other modules, like WinRAR scanning for winrar_theme_description.txt |
| 186 | // to check if any themes are available. |
| 187 | fd->Error=SysErr!=ERROR_FILE_NOT_FOUND && |
| 188 | SysErr!=ERROR_PATH_NOT_FOUND && |
| 189 | SysErr!=ERROR_NO_MORE_FILES; |
| 190 | } |
| 191 | } |
| 192 | else |
| 193 | if (!FindNextFile(hFind,&FindData)) |
| 194 | { |
| 195 | hFind=INVALID_HANDLE_VALUE; |
| 196 | fd->Error=GetLastError()!=ERROR_NO_MORE_FILES; |
| 197 | } |
| 198 | |
| 199 | if (hFind!=INVALID_HANDLE_VALUE) |
| 200 | { |
| 201 | wcsncpyz(fd->Name,Mask,ASIZE(fd->Name)); |
| 202 | SetName(fd->Name,FindData.cFileName,ASIZE(fd->Name)); |
| 203 | fd->Size=INT32TO64(FindData.nFileSizeHigh,FindData.nFileSizeLow); |
| 204 | fd->FileAttr=FindData.dwFileAttributes; |
| 205 | fd->ftCreationTime=FindData.ftCreationTime; |
| 206 | fd->ftLastAccessTime=FindData.ftLastAccessTime; |
| 207 | fd->ftLastWriteTime=FindData.ftLastWriteTime; |
| 208 | fd->mtime.SetWinFT(&FindData.ftLastWriteTime); |
| 209 | fd->ctime.SetWinFT(&FindData.ftCreationTime); |
| 210 | fd->atime.SetWinFT(&FindData.ftLastAccessTime); |
| 211 | |
| 212 | |
| 213 | } |
| 214 | fd->Flags=0; |
| 215 | return hFind; |
| 216 | } |
| 217 | #endif |
| 218 |
nothing calls this directly
no test coverage detected