Changeset 4763 for trunk/src/kernel32/disk.cpp
- Timestamp:
- Dec 7, 2000, 1:00:24 PM (25 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/disk.cpp
r4753 r4763 1 /* $Id: disk.cpp,v 1.2 2 2000-12-04 12:42:22 birdExp $ */1 /* $Id: disk.cpp,v 1.23 2000-12-07 12:00:23 sandervl Exp $ */ 2 2 3 3 /* … … 185 185 { 186 186 if(lpFreeBytesAvailableToCaller!=NULL) { 187 Mul32x32to64(lpFreeBytesAvailableToCaller, dwNumberOfFreeClusters, (dwSectorsPerCluster*dwBytesPerSector));188 dprintf(("lpFreeBytesAvailableToCaller %x%x", lpFreeBytesAvailableToCaller->LowPart, lpFreeBytesAvailableToCaller->HighPart));189 }187 Mul32x32to64(lpFreeBytesAvailableToCaller, dwNumberOfFreeClusters, (dwSectorsPerCluster*dwBytesPerSector)); 188 dprintf(("lpFreeBytesAvailableToCaller %x%x", lpFreeBytesAvailableToCaller->LowPart, lpFreeBytesAvailableToCaller->HighPart)); 189 } 190 190 if(lpTotalNumberOfBytes!=NULL) { 191 Mul32x32to64(lpTotalNumberOfBytes, dwTotalNumberOfClusters, (dwSectorsPerCluster*dwBytesPerSector));192 dprintf(("lpTotalNumberOfBytes %x%x", lpTotalNumberOfBytes->LowPart, lpTotalNumberOfBytes->HighPart));193 }191 Mul32x32to64(lpTotalNumberOfBytes, dwTotalNumberOfClusters, (dwSectorsPerCluster*dwBytesPerSector)); 192 dprintf(("lpTotalNumberOfBytes %x%x", lpTotalNumberOfBytes->LowPart, lpTotalNumberOfBytes->HighPart)); 193 } 194 194 if(lpTotalNumberOfFreeBytes!=NULL) { 195 memcpy(lpTotalNumberOfFreeBytes, lpFreeBytesAvailableToCaller, sizeof(*lpFreeBytesAvailableToCaller));196 dprintf(("lpTotalNumberOfFreeBytes %x%x", lpTotalNumberOfFreeBytes->LowPart, lpTotalNumberOfFreeBytes->HighPart));197 }195 memcpy(lpTotalNumberOfFreeBytes, lpFreeBytesAvailableToCaller, sizeof(*lpFreeBytesAvailableToCaller)); 196 dprintf(("lpTotalNumberOfFreeBytes %x%x", lpTotalNumberOfFreeBytes->LowPart, lpTotalNumberOfFreeBytes->HighPart)); 197 } 198 198 } 199 199 return rc; 200 200 } 201 202 201 //****************************************************************************** 202 //****************************************************************************** 203 203 ODINFUNCTION4(BOOL,GetDiskFreeSpaceExW, 204 204 LPCWSTR, lpDirectoryName, … … 216 216 return(rc); 217 217 } 218 219 220 //****************************************************************************** 218 //****************************************************************************** 219 //Note: NT4, SP6 does not change the last error, regardless of the junk it receives! 221 220 //****************************************************************************** 222 221 UINT WIN32API GetDriveTypeA(LPCSTR lpszDrive) 223 222 { 224 UINT rc; 223 UINT rc; 224 ULONG driveIndex; 225 226 if(lpszDrive == 0) { 227 driveIndex = OSLibDosQueryCurrentDisk() - 1; 228 } 229 else 230 if(*lpszDrive >= 'A' && *lpszDrive <= 'Z') 231 driveIndex = (DWORD)(*lpszDrive - 'A'); 232 else 233 if(*lpszDrive >= 'a' && *lpszDrive <= 'z') { 234 driveIndex = (DWORD)(*lpszDrive - 'a'); 235 } 236 else { 237 return DRIVE_NO_ROOT_DIR; //return value checked in NT4, SP6 (GetDriveType(""), GetDriveType("4"); 238 } 239 225 240 //NOTE: Although GetDriveTypeW handles -1, GetDriveTypeA crashes in NT 4, SP6 241 // rc = OSLibGetDriveType(driveIndex); 226 242 rc = O32_GetDriveType(lpszDrive); 227 243 dprintf(("KERNEL32: GetDriveType %s = %d", lpszDrive, rc)); … … 236 252 237 253 if(lpszDrive == (LPCWSTR)-1) { 238 return DRIVE_CANNOTDETERMINE; //NT 4, SP6 returns this (VERIFIED)254 return DRIVE_CANNOTDETERMINE; //NT 4, SP6 returns this (VERIFIED) 239 255 } 240 256 astring = UnicodeToAsciiString((LPWSTR)lpszDrive); … … 260 276 BOOL rc; 261 277 262 dprintf(("GetVolumeInformationA %s", lpRootPathName));263 264 if(lpRootPathName == NULL) {265 GetCurrentDirectoryA(sizeof(tmpstring), tmpstring);266 lpRootPathName = tmpstring;267 }268 269 if('A' <= *lpRootPathName && *lpRootPathName <= 'Z') {278 dprintf(("GetVolumeInformationA %s", lpRootPathName)); 279 280 if(lpRootPathName == NULL) { 281 GetCurrentDirectoryA(sizeof(tmpstring), tmpstring); 282 lpRootPathName = tmpstring; 283 } 284 285 if('A' <= *lpRootPathName && *lpRootPathName <= 'Z') { 270 286 drive = *lpRootPathName - 'A' + 1; 271 }272 else273 if('a' <= *lpRootPathName && *lpRootPathName <= 'z') {287 } 288 else 289 if('a' <= *lpRootPathName && *lpRootPathName <= 'z') { 274 290 drive = *lpRootPathName - 'a' + 1; 275 }276 else {277 SetLastError(ERROR_INVALID_PARAMETER);278 return FALSE;279 }280 281 if(lpVolumeSerialNumber || lpVolumeNameBuffer) {282 rc = OSLibDosQueryVolumeSerialAndName(drive, lpVolumeSerialNumber, lpVolumeNameBuffer, nVolumeNameSize);291 } 292 else { 293 SetLastError(ERROR_INVALID_PARAMETER); 294 return FALSE; 295 } 296 297 if(lpVolumeSerialNumber || lpVolumeNameBuffer) { 298 rc = OSLibDosQueryVolumeSerialAndName(drive, lpVolumeSerialNumber, lpVolumeNameBuffer, nVolumeNameSize); 283 299 if(lpVolumeSerialNumber) { 284 dprintf2(("Volume serial number: %x", *lpVolumeSerialNumber));285 }300 dprintf2(("Volume serial number: %x", *lpVolumeSerialNumber)); 301 } 286 302 if(lpVolumeNameBuffer) { 287 dprintf2(("Volume name: %s", lpVolumeNameBuffer));288 }289 }290 if(lpFileSystemNameBuffer || lpMaximumComponentLength) {291 if(!lpFileSystemNameBuffer) {292 lpFileSystemNameBuffer = tmpstring;293 nFileSystemNameSize = sizeof(tmpstring);294 }295 rc = OSLibDosQueryVolumeFS(drive, lpFileSystemNameBuffer, nFileSystemNameSize);303 dprintf2(("Volume name: %s", lpVolumeNameBuffer)); 304 } 305 } 306 if(lpFileSystemNameBuffer || lpMaximumComponentLength) { 307 if(!lpFileSystemNameBuffer) { 308 lpFileSystemNameBuffer = tmpstring; 309 nFileSystemNameSize = sizeof(tmpstring); 310 } 311 rc = OSLibDosQueryVolumeFS(drive, lpFileSystemNameBuffer, nFileSystemNameSize); 296 312 if(lpFileSystemNameBuffer) { 297 dprintf2(("File system name: %s", lpFileSystemNameBuffer)); 298 } 299 } 300 if(lpMaximumComponentLength) { 301 if(!strcmp(lpFileSystemNameBuffer, "FAT")) { 302 *lpMaximumComponentLength = 12; 303 } 304 else *lpMaximumComponentLength = 255; //TODO: Always correct? (CDFS?) 305 } 306 if(lpFileSystemFlags) { 307 if(strcmp(lpFileSystemNameBuffer, "FAT")) { 308 *lpFileSystemFlags = FS_CASE_IS_PRESERVED; 309 } 310 else 311 if(!strcmp(lpFileSystemNameBuffer, "CDFS")) { 312 *lpFileSystemFlags = FS_CASE_SENSITIVE; //NT4 returns this 313 } 314 else 315 if(!strcmp(lpFileSystemNameBuffer, "UDF")) {//TODO: correct? 316 *lpFileSystemFlags = FS_CASE_SENSITIVE | FS_UNICODE_STORED_ON_DISK; 317 } 318 else *lpFileSystemFlags = 0; 319 320 dprintf2(("File system flags: %x", lpFileSystemFlags)); 321 } 322 323 if(rc) { 324 SetLastError(rc); 325 return FALSE; 326 } 327 SetLastError(ERROR_SUCCESS); 328 return TRUE; 313 dprintf2(("File system name: %s", lpFileSystemNameBuffer)); 314 } 315 } 316 if(lpMaximumComponentLength) { 317 if(!strcmp(lpFileSystemNameBuffer, "FAT")) { 318 *lpMaximumComponentLength = 12; 319 } 320 else *lpMaximumComponentLength = 255; //TODO: Always correct? (CDFS?) 321 } 322 if(lpFileSystemFlags) 323 { 324 if(strcmp(lpFileSystemNameBuffer, "FAT")) { 325 *lpFileSystemFlags = FS_CASE_IS_PRESERVED; 326 } 327 else 328 if(!strcmp(lpFileSystemNameBuffer, "CDFS")) { 329 *lpFileSystemFlags = FS_CASE_SENSITIVE; //NT4 returns this 330 } 331 else 332 if(!strcmp(lpFileSystemNameBuffer, "UDF")) {//TODO: correct? 333 *lpFileSystemFlags = FS_CASE_SENSITIVE | FS_UNICODE_STORED_ON_DISK; 334 } 335 else *lpFileSystemFlags = 0; 336 337 dprintf2(("File system flags: %x", lpFileSystemFlags)); 338 } 339 340 if(rc) { 341 SetLastError(rc); 342 return FALSE; 343 } 344 SetLastError(ERROR_SUCCESS); 345 return TRUE; 329 346 } 330 347 //****************************************************************************** … … 386 403 { 387 404 dprintf(("KERNEL32: GetLogicalDrives\n")); 388 return O 32_GetLogicalDrives();405 return OSLibGetLogicalDrives(); 389 406 } 390 407 //****************************************************************************** … … 409 426 return(rc); 410 427 } 428 //****************************************************************************** 429 //****************************************************************************** 430
Note:
See TracChangeset
for help on using the changeset viewer.