Changeset 8397 for trunk/src/kernel32/hmdisk.cpp
- Timestamp:
- May 9, 2002, 3:55:35 PM (23 years ago)
- File:
-
- 1 edited
-
trunk/src/kernel32/hmdisk.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/kernel32/hmdisk.cpp
r8258 r8397 1 /* $Id: hmdisk.cpp,v 1.4 2 2002-04-13 06:21:39 birdExp $ */1 /* $Id: hmdisk.cpp,v 1.43 2002-05-09 13:55:33 sandervl Exp $ */ 2 2 3 3 /* … … 12 12 #include <os2win.h> 13 13 #include <string.h> 14 #include <versionos2.h> 14 15 15 16 #include <misc.h> 16 17 #include "hmdisk.h" 17 18 #include "mmap.h" 18 #include "oslibdos.h"19 19 #include <win\winioctl.h> 20 20 #include <win\ntddscsi.h> 21 21 #include <win\wnaspi32.h> 22 22 #include <win\aspi.h> 23 #include "oslibdos.h" 24 #include "osliblvm.h" 23 25 24 26 #define DBG_LOCALLOG DBG_hmdisk … … 50 52 { 51 53 HMDeviceRegisterEx("\\\\.\\PHYSICALDRIVE", this, NULL); 54 HMDeviceRegisterEx(VOLUME_NAME_PREFIX, this, NULL); 52 55 } 53 56 … … 83 86 //\\.\PHYSICALDRIVEn -> length 18 84 87 if(namelength != 6 && namelength != 18) { 88 if(VERSION_IS_WIN2000_OR_HIGHER()) { 89 if(!strncmp(lpDeviceName, VOLUME_NAME_PREFIX, sizeof(VOLUME_NAME_PREFIX)-1)) { 90 return TRUE; 91 } 92 } 85 93 return FALSE; 86 94 } … … 124 132 125 133 char szDrive[4]; 126 szDrive[0] = *lpFileName;127 134 szDrive[1] = ':'; 128 135 szDrive[2] = '\0'; 136 137 //if volume name, query 138 if(VERSION_IS_WIN2000_OR_HIGHER() && !strncmp(lpFileName, VOLUME_NAME_PREFIX, sizeof(VOLUME_NAME_PREFIX)-1)) { 139 char *pszVolume; 140 int length; 141 142 //strip volume name prefix (\\\\?\\Volume\\) 143 length = strlen(lpFileName); 144 pszVolume = (char *)alloca(length); 145 146 strcpy(pszVolume, &lpFileName[sizeof(VOLUME_NAME_PREFIX)-1+1]); //-zero term + starting '{' 147 length -= sizeof(VOLUME_NAME_PREFIX)-1+1; 148 if(pszVolume[length-2] == '}') { 149 pszVolume[length-2] = 0; 150 szDrive[0] = OSLibLVMQueryDriveFromVolumeName(pszVolume); 151 } 152 else return ERROR_FILE_NOT_FOUND; 153 154 } 155 else { 156 szDrive[0] = *lpFileName; 157 } 129 158 dwDriveType = GetDriveTypeA(szDrive); 130 159 … … 550 579 msg = "IOCTL_CDROM_FIND_NEW_DEVICES"; 551 580 break; 581 case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: 582 msg = "IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS"; 583 break; 552 584 } 553 585 if(msg) { … … 713 745 714 746 case IOCTL_DISK_GET_PARTITION_INFO: 747 { 748 PPARTITION_INFORMATION pPartition = (PPARTITION_INFORMATION)lpOutBuffer; 749 if(nOutBufferSize < sizeof(PARTITION_INFORMATION) || !pPartition) { 750 SetLastError(ERROR_INSUFFICIENT_BUFFER); 751 return FALSE; 752 } 753 if(lpBytesReturned) { 754 *lpBytesReturned = sizeof(PARTITION_INFORMATION); 755 } 756 if(OSLibLVMGetPartitionInfo(drvInfo->driveLetter, pPartition)) { 757 SetLastError(ERROR_NOT_ENOUGH_MEMORY); //wrong error, but who cares 758 return FALSE; 759 } 760 761 SetLastError(ERROR_SUCCESS); 762 return TRUE; 763 } 764 715 765 case IOCTL_DISK_LOAD_MEDIA: 716 766 case IOCTL_DISK_MEDIA_REMOVAL: … … 723 773 break; 724 774 775 776 case IOCTL_VOLUME_GET_VOLUME_DISK_EXTENTS: 777 { 778 PVOLUME_DISK_EXTENTS pVolExtent = (PVOLUME_DISK_EXTENTS)lpOutBuffer; 779 if(nOutBufferSize < sizeof(VOLUME_DISK_EXTENTS) || !pVolExtent) { 780 SetLastError(ERROR_INSUFFICIENT_BUFFER); 781 return FALSE; 782 } 783 if(OSLibLVMGetVolumeExtents(drvInfo->driveLetter, pVolExtent)) { 784 SetLastError(ERROR_NOT_ENOUGH_MEMORY); //wrong error, but who cares 785 return FALSE; 786 } 787 788 if(lpBytesReturned) { 789 *lpBytesReturned = sizeof(VOLUME_DISK_EXTENTS); 790 } 791 SetLastError(ERROR_SUCCESS); 792 return TRUE; 793 } 725 794 726 795 // -----------
Note:
See TracChangeset
for help on using the changeset viewer.
