Changeset 8409 for trunk/src/kernel32/disk.cpp
- Timestamp:
- May 14, 2002, 11:28:19 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/disk.cpp
r8401 r8409 1 /* $Id: disk.cpp,v 1.3 6 2002-05-10 14:55:10sandervl Exp $ */1 /* $Id: disk.cpp,v 1.37 2002-05-14 09:28:19 sandervl Exp $ */ 2 2 3 3 /* 4 4 * Win32 Disk API functions for OS/2 5 5 * 6 * Copyright 1998 Sander van Leeuwen6 * Copyright 1998-2002 Sander van Leeuwen 7 7 * 8 8 * … … 46 46 BOOL WIN32API SetVolumeLabelW(LPCWSTR lpRootPathName, LPCWSTR lpVolumeName) 47 47 { 48 char *asciiroot, *asciivolname;49 BOOL rc;48 char *asciiroot, *asciivolname; 49 BOOL rc; 50 50 51 51 dprintf(("KERNEL32: OS2SetVolumeLabelW\n")); … … 64 64 PDWORD lpClusters) 65 65 { 66 BOOL rc;67 DWORD dwSectorsPerCluster; // address of sectors per cluster ter68 DWORD dwBytesPerSector; // address of bytes per sector69 DWORD dwNumberOfFreeClusters; // address of number of free clusters70 DWORD dwTotalNumberOfClusters; // address of total number of clusters71 72 rc = OSLibGetDiskFreeSpace((LPSTR)lpszRootPathName, &dwSectorsPerCluster, &dwBytesPerSector,73 &dwNumberOfFreeClusters, &dwTotalNumberOfClusters);74 if(rc)75 {76 if (lpSectorsPerCluster!=NULL)77 *lpSectorsPerCluster = dwSectorsPerCluster;78 if (lpBytesPerSector!=NULL)79 *lpBytesPerSector = dwBytesPerSector;80 if (lpFreeClusters!=NULL)81 *lpFreeClusters = dwNumberOfFreeClusters;82 if (lpClusters!=NULL)83 *lpClusters = dwTotalNumberOfClusters;66 BOOL rc; 67 DWORD dwSectorsPerCluster; // address of sectors per cluster ter 68 DWORD dwBytesPerSector; // address of bytes per sector 69 DWORD dwNumberOfFreeClusters; // address of number of free clusters 70 DWORD dwTotalNumberOfClusters; // address of total number of clusters 71 72 rc = OSLibGetDiskFreeSpace((LPSTR)lpszRootPathName, &dwSectorsPerCluster, &dwBytesPerSector, 73 &dwNumberOfFreeClusters, &dwTotalNumberOfClusters); 74 if(rc) 75 { 76 if (lpSectorsPerCluster!=NULL) 77 *lpSectorsPerCluster = dwSectorsPerCluster; 78 if (lpBytesPerSector!=NULL) 79 *lpBytesPerSector = dwBytesPerSector; 80 if (lpFreeClusters!=NULL) 81 *lpFreeClusters = dwNumberOfFreeClusters; 82 if (lpClusters!=NULL) 83 *lpClusters = dwTotalNumberOfClusters; 84 84 85 85 /* CW: Windows Media Player setup complains about wrong clustersize when odin is installed on … … 90 90 TVFSTOHPFS = 1 91 91 */ 92 if(lpSectorsPerCluster!=NULL)93 {94 if(*lpSectorsPerCluster==1024 && PROFILE_GetOdinIniBool("DRIVESPACE","CLUSTERTO32",0))95 {/* TVFS returns 1024 sectors per cluster */96 dprintf(("KERNEL32: GetDiskFreeSpaceA, TVFS-Drive detected. Faking clustersize to 32.\n"));97 *lpSectorsPerCluster=32;98 if (lpFreeClusters!=NULL)99 *lpFreeClusters = dwNumberOfFreeClusters<<0x5;100 if (lpClusters!=NULL)101 *lpClusters = dwTotalNumberOfClusters<<0x5;102 }103 }104 }105 return rc;92 if(lpSectorsPerCluster!=NULL) 93 { 94 if(*lpSectorsPerCluster==1024 && PROFILE_GetOdinIniBool("DRIVESPACE","CLUSTERTO32",0)) 95 {/* TVFS returns 1024 sectors per cluster */ 96 dprintf(("KERNEL32: GetDiskFreeSpaceA, TVFS-Drive detected. Faking clustersize to 32.\n")); 97 *lpSectorsPerCluster=32; 98 if (lpFreeClusters!=NULL) 99 *lpFreeClusters = dwNumberOfFreeClusters<<0x5; 100 if (lpClusters!=NULL) 101 *lpClusters = dwTotalNumberOfClusters<<0x5; 102 } 103 } 104 } 105 return rc; 106 106 } 107 107 //****************************************************************************** … … 113 113 PDWORD lpClusters) 114 114 { 115 BOOL rc;116 char *astring;117 118 astring = UnicodeToAsciiString((LPWSTR)lpszRootPathName);119 rc = GetDiskFreeSpaceA(astring, lpSectorsPerCluster, lpBytesPerSector, lpFreeClusters, lpClusters);120 FreeAsciiString(astring);121 return(rc);115 BOOL rc; 116 char *astring; 117 118 astring = UnicodeToAsciiString((LPWSTR)lpszRootPathName); 119 rc = GetDiskFreeSpaceA(astring, lpSectorsPerCluster, lpBytesPerSector, lpFreeClusters, lpClusters); 120 FreeAsciiString(astring); 121 return(rc); 122 122 } 123 123 … … 202 202 PULARGE_INTEGER lpTotalNumberOfFreeBytes ) 203 203 { 204 BOOL rc;205 char *astring;204 BOOL rc; 205 char *astring; 206 206 207 207 dprintf(("KERNEL32: OS2GetDiskFreeSpaceExW\n")); … … 216 216 UINT WIN32API GetDriveTypeA(LPCSTR lpszDrive) 217 217 { 218 UINT rc;219 ULONG driveIndex;218 UINT rc; 219 ULONG driveIndex; 220 220 221 221 if(lpszDrive == 0) { … … 259 259 UINT WIN32API GetDriveTypeW(LPCWSTR lpszDrive) 260 260 { 261 UINT rc;262 char *astring;261 UINT rc; 262 char *astring; 263 263 264 264 if(lpszDrive == (LPCWSTR)-1) { … … 270 270 FreeAsciiString(astring); 271 271 return(rc); 272 } 273 //****************************************************************************** 274 static int fForce2GBFileSize = FALSE; 275 //****************************************************************************** 276 void WIN32API CustForce2GBFileSize() 277 { 278 fForce2GBFileSize = TRUE; 272 279 } 273 280 //****************************************************************************** … … 369 376 strcpy(lpFileSystemNameBuffer, "FAT16"); 370 377 } 378 if(fForce2GBFileSize) { 379 if(strcmp(lpFileSystemNameBuffer, "CDFS") && 380 strcmp(lpFileSystemNameBuffer, "UDF")) 381 {//everything is FAT -> 2 GB file size limit 382 strcpy(lpFileSystemNameBuffer, "FAT16"); 383 } 384 } 371 385 dprintf2(("Final file system name: %s", lpFileSystemNameBuffer)); 372 386 } … … 414 428 DWORD nFileSystemNameSize) 415 429 { 416 char *asciiroot, 417 *asciivol, 418 *asciifs; 419 BOOL rc; 420 421 // transform into ascii 422 asciivol = (char *)malloc(nVolumeNameSize+1); 423 asciifs = (char *)malloc(nFileSystemNameSize+1); 424 425 // clear ascii buffers 426 memset (asciivol, 0, (nVolumeNameSize + 1)); 427 memset (asciifs, 0, (nFileSystemNameSize + 1)); 428 429 if (lpRootPathName != NULL) // NULL is valid! 430 asciiroot = UnicodeToAsciiString((LPWSTR)lpRootPathName); 431 else 432 asciiroot = NULL; 433 434 rc = GetVolumeInformationA(asciiroot, 435 asciivol, 436 nVolumeNameSize, 437 lpVolumeSerialNumber, 438 lpMaximumComponentLength, 439 lpFileSystemFlags, 440 asciifs, 441 nFileSystemNameSize); 430 char *asciiroot, 431 *asciivol, 432 *asciifs; 433 BOOL rc; 434 435 // transform into ascii 436 asciivol = (char *)malloc(nVolumeNameSize+1); 437 asciifs = (char *)malloc(nFileSystemNameSize+1); 438 439 // clear ascii buffers 440 memset (asciivol, 0, (nVolumeNameSize + 1)); 441 memset (asciifs, 0, (nFileSystemNameSize + 1)); 442 443 if (lpRootPathName != NULL) // NULL is valid! 444 asciiroot = UnicodeToAsciiString((LPWSTR)lpRootPathName); 445 else 446 asciiroot = NULL; 447 448 rc = GetVolumeInformationA(asciiroot, asciivol, nVolumeNameSize, lpVolumeSerialNumber, 449 lpMaximumComponentLength, lpFileSystemFlags, asciifs, nFileSystemNameSize); 442 450 443 451 if (lpVolumeNameBuffer != NULL) /* @@@PH 98/06/07 */ 444 AsciiToUnicodeN(asciivol, lpVolumeNameBuffer, nVolumeNameSize);452 AsciiToUnicodeN(asciivol, lpVolumeNameBuffer, nVolumeNameSize); 445 453 446 454 if (lpFileSystemNameBuffer != NULL) /* @@@PH 98/06/07 */ 447 AsciiToUnicodeN(asciifs, lpFileSystemNameBuffer, nFileSystemNameSize); 448 449 450 if (asciiroot != NULL) 451 FreeAsciiString(asciiroot); 452 453 free(asciifs); 454 free(asciivol); 455 return(rc); 455 AsciiToUnicodeN(asciifs, lpFileSystemNameBuffer, nFileSystemNameSize); 456 457 if (asciiroot != NULL) 458 FreeAsciiString(asciiroot); 459 460 free(asciifs); 461 free(asciivol); 462 return(rc); 456 463 } 457 464 //****************************************************************************** … … 473 480 UINT WIN32API GetLogicalDriveStringsW(UINT nBufferLength, LPWSTR lpBuffer) 474 481 { 475 char *asciibuffer = (char *)malloc(nBufferLength+1);476 DWORD rc;482 char *asciibuffer = (char *)malloc(nBufferLength+1); 483 DWORD rc; 477 484 478 485 dprintf(("KERNEL32: OS2GetLogicalDriveStringsW\n")); … … 562 569 DWORD DeviceType; 563 570 char szVolume[256]; 571 572 //tetsetsetetsetsetset 573 SetLastError(ERROR_NO_MORE_FILES); 574 return FALSE; 575 //tetsetsetetsetsetset 564 576 565 577 if(!VERSION_IS_WIN2000_OR_HIGHER()) {
Note:
See TracChangeset
for help on using the changeset viewer.