Changeset 8392 for trunk/src/kernel32/disk.cpp
- Timestamp:
- May 8, 2002, 5:02:59 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/disk.cpp
r8257 r8392 1 /* $Id: disk.cpp,v 1.3 3 2002-04-13 06:20:36 birdExp $ */1 /* $Id: disk.cpp,v 1.34 2002-05-08 15:02:58 sandervl Exp $ */ 2 2 3 3 /* … … 85 85 TVFSTOHPFS = 1 86 86 */ 87 if(lpSectorsPerCluster!=NULL) 87 if(lpSectorsPerCluster!=NULL) 88 88 { 89 if(*lpSectorsPerCluster==1024 && PROFILE_GetOdinIniBool("DRIVESPACE","CLUSTERTO32",0)) 89 if(*lpSectorsPerCluster==1024 && PROFILE_GetOdinIniBool("DRIVESPACE","CLUSTERTO32",0)) 90 90 {/* TVFS returns 1024 sectors per cluster */ 91 91 dprintf(("KERNEL32: GetDiskFreeSpaceA, TVFS-Drive detected. Faking clustersize to 32.\n")); … … 206 206 return(rc); 207 207 } 208 209 210 /** 211 * Determin the type of a specific drive or the current drive. 212 * 213 * @returns DRIVE_UNKNOWN 214 * DRIVE_NO_ROOT_DIR 215 * DRIVE_CANNOTDETERMINE 216 * DRIVE_DOESNOTEXIST 217 * DRIVE_REMOVABLE 218 * DRIVE_FIXED 219 * DRIVE_REMOTE 220 * DRIVE_CDROM 221 * DRIVE_RAMDISK 222 * 223 * @param lpszDrive Root path of the drive in question. 224 * NULL means the current drive. 225 * @sketch 226 * If no drive Then 227 * Get Current Drive Index. 228 * ElseIf valid drive letter Then 229 * Convert to Drive Index. 230 * Else 231 * Return Error: Invalid root dir. 232 * Endif 233 * Call the OSLib worker function with the index. 234 * return it's result. 235 * 236 * @status completely implemented and tested 237 * @author Sander 238 * @remark NT4, SP6 does not change the last error, regardless of the junk it receives! 239 */ 208 //****************************************************************************** 209 //Note: NT4, SP6 does not change the last error, regardless of the junk it receives! 210 //****************************************************************************** 240 211 UINT WIN32API GetDriveTypeA(LPCSTR lpszDrive) 241 212 { 242 UINT rc; 243 ULONG ulDrive = ~0; 244 245 /* validate and convert input */ 246 if (!lpszDrive) 247 ulDrive = OSLibDosQueryCurrentDisk() - 1; 248 else if (*lpszDrive != '\0' && lpszDrive[1] == ':') 249 { 250 if (*lpszDrive >= 'A' && *lpszDrive <= 'Z') 251 ulDrive = *lpszDrive - 'A'; 252 else if (*lpszDrive >= 'a' && *lpszDrive <= 'z') 253 ulDrive = *lpszDrive - 'a'; 254 255 /* 256 * Validate the rest of the path. 257 * Note: This validate is kind of weird. 258 * "c:\\\\\\\\\\\\" is ok 259 * "c:\\\\\\\\\\\\." is ok 260 * "c:\\\\\\\\\\\\........" is ok 261 * "c:\\\\\\\\\\\.\" is not ok 262 * "c:..............." is ok 263 * "c:\\ \ \ \ \ \\\\\" is not ok 264 * "c:\\ \ \ \ \ \\\\\" is not ok 265 * "c:\ . . . . . ." is ok 266 * "c:\/\/\/ . . . . ." is ok 267 * "c:\\\.\\\/\." is ok 268 * I hope I got it right. 269 */ 270 if (ulDrive != ~0) 271 { 272 LPCSTR lpsz = lpszDrive + 2; 273 274 /* skip slashes and dots */ 275 while (*lpsz == '.' || *lpsz == '\\' || *lpsz == '/') 276 lpsz++; 277 /* skip dot's and spaces. */ 278 while (*lpsz == ' ' || *lpsz == '.') 279 lpsz++; 280 if (*lpsz) 281 ulDrive = ~0; 282 } 283 } 284 285 /* check if validation failed */ 286 if (ulDrive == ~0) 287 { 288 dprintf(("KERNEL32: GetDriveType(""%s"") -> DRIVE_NO_ROOT_DIR (%d)", lpszDrive, DRIVE_NO_ROOT_DIR)); 213 UINT rc; 214 ULONG driveIndex; 215 216 if(lpszDrive == 0) { 217 driveIndex = OSLibDosQueryCurrentDisk() - 1; 218 } 219 else 220 if(*lpszDrive >= 'A' && *lpszDrive <= 'Z') 221 driveIndex = (DWORD)(*lpszDrive - 'A'); 222 else 223 if(*lpszDrive >= 'a' && *lpszDrive <= 'z') { 224 driveIndex = (DWORD)(*lpszDrive - 'a'); 225 } 226 else { 289 227 return DRIVE_NO_ROOT_DIR; //return value checked in NT4, SP6 (GetDriveType(""), GetDriveType("4"); 290 228 } 291 229 292 230 //NOTE: Although GetDriveTypeW handles -1, GetDriveTypeA crashes in NT 4, SP6 293 rc = OSLibGetDriveType( ulDrive);231 rc = OSLibGetDriveType(driveIndex); 294 232 dprintf(("KERNEL32: GetDriveType %s = %d", lpszDrive, rc)); 295 233 return rc; 296 234 } 297 298 299 /** 300 * Determin the type of a specific drive or the current drive. 301 * 302 * @returns DRIVE_UNKNOWN 303 * DRIVE_NO_ROOT_DIR 304 * DRIVE_CANNOTDETERMINE 305 * DRIVE_DOESNOTEXIST 306 * DRIVE_REMOVABLE 307 * DRIVE_FIXED 308 * DRIVE_REMOTE 309 * DRIVE_CDROM 310 * DRIVE_RAMDISK 311 * 312 * @param lpszDrive Root path of the drive in question. 313 * NULL means the current drive. 314 * @sketch 315 * If no drive Then 316 * Get Current Drive Index. 317 * ElseIf valid drive letter Then 318 * Convert to Drive Index. 319 * Else 320 * Return Error: Invalid root dir. 321 * Endif 322 * Call the OSLib worker function with the index. 323 * return it's result. 324 * 325 * @status completely implemented and tested 326 * @author Sander 327 * @remark NT4, SP6 does not change the last error, regardless of the junk it receives! 328 */ 235 //****************************************************************************** 236 //****************************************************************************** 329 237 UINT WIN32API GetDriveTypeW(LPCWSTR lpszDrive) 330 238 { … … 385 293 } 386 294 } 387 if(lpFileSystemNameBuffer || lpMaximumComponentLength || lpFileSystemFlags) 295 if(lpFileSystemNameBuffer || lpMaximumComponentLength || lpFileSystemFlags) 388 296 { 389 297 if(!lpFileSystemNameBuffer) { … … 395 303 if(rc == ERROR_SUCCESS) strcpy(szOrgFileSystemName, lpFileSystemNameBuffer); 396 304 397 if(lpFileSystemNameBuffer) 305 if(lpFileSystemNameBuffer) 398 306 { 399 307 dprintf2(("File system name: %s", lpFileSystemNameBuffer)); 400 if(!strcmp(lpFileSystemNameBuffer, "JFS")) 308 if(!strcmp(lpFileSystemNameBuffer, "JFS")) 401 309 { 402 310 strcpy(lpFileSystemNameBuffer, "NTFS"); … … 408 316 //do nothing 409 317 } 410 else 318 else 411 319 {//pretend everything else is FAT16 (HPFS and FAT have the same file size limit) 412 320 strcpy(lpFileSystemNameBuffer, "FAT16"); … … 528 436 //****************************************************************************** 529 437 //****************************************************************************** 530 438 HANDLE WIN32API FindFirstVolumeA(LPTSTR lpszVolumeName, DWORD cchBufferLength) 439 { 440 return 0; 441 } 442 //****************************************************************************** 443 //****************************************************************************** 444 HANDLE WIN32API FindFirstVolumeW(LPWSTR lpszVolumeName, DWORD cchBufferLength) 445 { 446 return 0; 447 } 448 //****************************************************************************** 449 //****************************************************************************** 450 BOOL WIN32API FindNextVolumeA(HANDLE hFindVolume, LPTSTR lpszVolumeName, 451 DWORD cchBufferLength) 452 { 453 return FALSE; 454 } 455 //****************************************************************************** 456 //****************************************************************************** 457 BOOL WIN32API FindNextVolumeW(HANDLE hFindVolume, LPWSTR lpszVolumeName, 458 DWORD cchBufferLength) 459 { 460 return FALSE; 461 } 462 //****************************************************************************** 463 //****************************************************************************** 464 BOOL WIN32API FindVolumeClose(HANDLE hFindVolume) 465 { 466 return TRUE; 467 } 468 //****************************************************************************** 469 //****************************************************************************** 470 HANDLE WIN32API FindFirstVolumeMountPointA(LPTSTR lpszRootPathName, 471 LPTSTR lpszVolumeMountPoint, 472 DWORD cchBufferLength) 473 { 474 return 0; 475 } 476 //****************************************************************************** 477 //****************************************************************************** 478 HANDLE WIN32API FindFirstVolumeMountPointW(LPWSTR lpszRootPathName, 479 LPWSTR lpszVolumeMountPoint, 480 DWORD cchBufferLength) 481 { 482 return 0; 483 } 484 //****************************************************************************** 485 //****************************************************************************** 486 BOOL WIN32API FindNextVolumeMountPointA(HANDLE hFindVolumeMountPoint, 487 LPTSTR lpszVolumeMountPoint, 488 DWORD cchBufferLength) 489 { 490 return FALSE; 491 } 492 //****************************************************************************** 493 //****************************************************************************** 494 BOOL WIN32API FindNextVolumeMountPointW(HANDLE hFindVolumeMountPoint, 495 LPWSTR lpszVolumeMountPoint, 496 DWORD cchBufferLength) 497 { 498 return FALSE; 499 } 500 //****************************************************************************** 501 //****************************************************************************** 502 BOOL WIN32API FindVolumeMountPointClose(HANDLE hFindVolumeMountPoint) 503 { 504 return TRUE; 505 } 506 //****************************************************************************** 507 //****************************************************************************** 508 BOOL WIN32API GetVolumeNameForVolumeMountPointA(LPCSTR lpszVolumeMountPoint, 509 LPSTR lpszVolumeName, 510 DWORD cchBufferLength) 511 { 512 return FALSE; 513 } 514 //****************************************************************************** 515 //****************************************************************************** 516 BOOL WIN32API GetVolumeNameForVolumeMountPointW(LPCWSTR lpszVolumeMountPoint, 517 LPWSTR lpszVolumeName, 518 DWORD cchBufferLength) 519 { 520 return FALSE; 521 } 522 //****************************************************************************** 523 //******************************************************************************
Note:
See TracChangeset
for help on using the changeset viewer.