Changeset 21619 in vbox
- Timestamp:
- Jul 15, 2009 3:45:15 PM (16 years ago)
- svn:sync-xref-src-repo-rev:
- 50141
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/win/path-win.cpp
r21608 r21619 211 211 * Query file info. 212 212 */ 213 WIN32_FILE_ATTRIBUTE_DATA Data; 213 214 #ifndef RT_DONT_CONVERT_FILENAMES 214 215 PRTUTF16 pwszPath; … … 216 217 if (RT_FAILURE(rc)) 217 218 return rc; 218 WIN32_FIND_DATAW Data; 219 HANDLE hDir = FindFirstFileW(pwszPath, &Data); 220 if (hDir == INVALID_HANDLE_VALUE) 221 { 222 rc = RTErrConvertFromWin32(GetLastError()); 223 RTUtf16Free(pwszPath); 224 return rc; 225 } 226 FindClose(hDir); 219 if (!GetFileAttributesExW(pwszPath, GetFileExInfoStandard, &Data)) 220 { 221 /* Fallback to FindFileFirst in case of sharing violation. */ 222 if (GetLastError() == ERROR_SHARING_VIOLATION) 223 { 224 WIN32_FIND_DATAW FindData; 225 HANDLE hDir = FindFirstFileW(pwszPath, &FindData); 226 if (hDir == INVALID_HANDLE_VALUE) 227 { 228 rc = RTErrConvertFromWin32(GetLastError()); 229 RTUtf16Free(pwszPath); 230 return rc; 231 } 232 FindClose(hDir); 233 Data.dwFileAttributes = FindData.dwFileAttributes; 234 Data.ftCreationTime = FindData.ftCreationTime; 235 Data.ftLastAccessTime = FindData.ftLastAccessTime; 236 Data.ftLastWriteTime = FindData.ftLastWriteTime; 237 Data.nFileSizeHigh = FindData.nFileSizeHigh; 238 Data.nFileSizeLow = FindData.nFileSizeLow; 239 } 240 else 241 { 242 rc = RTErrConvertFromWin32(GetLastError()); 243 RTUtf16Free(pwszPath); 244 return rc; 245 } 246 } 227 247 RTUtf16Free(pwszPath); 228 248 #else 229 WIN32_FIND_DATAA Data; 230 HANDLE hDir = FindFirstFileA(pszPath, &Data); 231 if (hDir == INVALID_HANDLE_VALUE) 232 return RTErrConvertFromWin32(GetLastError()); 233 FindClose(hDir); 249 if (!GetFileAttributesExA(pszPath, GetFileExInfoStandard, &Data)) 250 { 251 /* Fallback to FindFileFirst in case of sharing violation. */ 252 if (GetLastError() == ERROR_SHARING_VIOLATION) 253 { 254 WIN32_FIND_DATAA FindData; 255 HANDLE hDir = FindFirstFileA(pszPath, &FindData); 256 if (hDir == INVALID_HANDLE_VALUE) 257 return RTErrConvertFromWin32(GetLastError()); 258 FindClose(hDir); 259 Data.dwFileAttributes = FindData.dwFileAttributes; 260 Data.ftCreationTime = FindData.ftCreationTime; 261 Data.ftLastAccessTime = FindData.ftLastAccessTime; 262 Data.ftLastWriteTime = FindData.ftLastWriteTime; 263 Data.nFileSizeHigh = FindData.nFileSizeHigh; 264 Data.nFileSizeLow = FindData.nFileSizeLow; 265 } 266 else 267 return RTErrConvertFromWin32(GetLastError()); 268 } 234 269 #endif 235 270
Note:
See TracChangeset
for help on using the changeset viewer.