Changeset 77231 in vbox for trunk/src/VBox/Runtime/r3/nt/fs-nt.cpp
- Timestamp:
- Feb 8, 2019 11:18:13 PM (6 years ago)
- svn:sync-xref-src-repo-rev:
- 128738
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Runtime/r3/nt/fs-nt.cpp
r76553 r77231 196 196 197 197 198 int rtNtQueryFsType(HANDLE hHandle, PRTFSTYPE penmType) 199 { 200 /* 201 * Get the file system name. 202 */ 203 union 204 { 205 FILE_FS_ATTRIBUTE_INFORMATION FsAttrInfo; 206 uint8_t abBuf[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 4096]; 207 } u; 208 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 209 NTSTATUS rcNt = NtQueryVolumeInformationFile(hHandle, &Ios, &u, sizeof(u), FileFsAttributeInformation); 210 if (NT_SUCCESS(rcNt)) 211 { 212 #define IS_FS(a_szName) rtNtCompWideStrAndAscii(u.FsAttrInfo.FileSystemName, u.FsAttrInfo.FileSystemNameLength, RT_STR_TUPLE(a_szName)) 213 if (IS_FS("NTFS")) 214 *penmType = RTFSTYPE_NTFS; 215 else if (IS_FS("FAT")) 216 *penmType = RTFSTYPE_FAT; 217 else if (IS_FS("FAT32")) 218 *penmType = RTFSTYPE_FAT; 219 else if (IS_FS("exFAT")) 220 *penmType = RTFSTYPE_EXFAT; 221 else if (IS_FS("UDF")) 222 *penmType = RTFSTYPE_UDF; 223 else if (IS_FS("CDFS")) 224 *penmType = RTFSTYPE_ISO9660; 225 else if (IS_FS("HPFS")) 226 *penmType = RTFSTYPE_HPFS; 227 else if (IS_FS("VBoxSharedFolderFS")) 228 *penmType = RTFSTYPE_VBOXSHF; 229 #undef IS_FS 230 return VINF_SUCCESS; 231 } 232 233 *penmType = RTFSTYPE_UNKNOWN; 234 return RTErrConvertFromNtStatus(rcNt); 235 } 236 237 198 238 RTR3DECL(int) RTFsQueryType(const char *pszFsPath, PRTFSTYPE penmType) 199 239 { … … 220 260 if (RT_SUCCESS(rc)) 221 261 { 222 /* 223 * Get the file system name. 224 */ 225 union 226 { 227 FILE_FS_ATTRIBUTE_INFORMATION FsAttrInfo; 228 uint8_t abBuf[sizeof(FILE_FS_ATTRIBUTE_INFORMATION) + 4096]; 229 } u; 230 IO_STATUS_BLOCK Ios = RTNT_IO_STATUS_BLOCK_INITIALIZER; 231 NTSTATUS rcNt = NtQueryVolumeInformationFile(hFile, &Ios, &u, sizeof(u), FileFsAttributeInformation); 232 if (NT_SUCCESS(rcNt)) 233 { 234 #define IS_FS(a_szName) \ 235 rtNtCompWideStrAndAscii(u.FsAttrInfo.FileSystemName, u.FsAttrInfo.FileSystemNameLength, RT_STR_TUPLE(a_szName)) 236 if (IS_FS("NTFS")) 237 *penmType = RTFSTYPE_NTFS; 238 else if (IS_FS("FAT")) 239 *penmType = RTFSTYPE_FAT; 240 else if (IS_FS("FAT32")) 241 *penmType = RTFSTYPE_FAT; 242 else if (IS_FS("VBoxSharedFolderFS")) 243 *penmType = RTFSTYPE_VBOXSHF; 244 #undef IS_FS 245 } 246 else 247 rc = RTErrConvertFromNtStatus(rcNt); 248 249 RTNtPathClose(hFile); 250 } 251 return rc; 252 } 253 262 rc = rtNtQueryFsType(hFile, penmType); 263 RTNtPathClose(hFile); 264 } 265 return rc; 266 } 267
Note:
See TracChangeset
for help on using the changeset viewer.