Index: trunk/src/kernel32/hmdisk.cpp
===================================================================
--- trunk/src/kernel32/hmdisk.cpp	(revision 8257)
+++ trunk/src/kernel32/hmdisk.cpp	(revision 8258)
@@ -1,3 +1,3 @@
-/* $Id: hmdisk.cpp,v 1.41 2002-04-06 14:58:35 sandervl Exp $ */
+/* $Id: hmdisk.cpp,v 1.42 2002-04-13 06:21:39 bird Exp $ */
 
 /*
@@ -30,5 +30,5 @@
 #define BIT_11    (1<<11)
 
-typedef struct 
+typedef struct
 {
     HINSTANCE hInstAspi;
@@ -79,5 +79,5 @@
     return TRUE;
   }
-  
+
     //\\.\x:                -> length 6
     //\\.\PHYSICALDRIVEn    -> length 18
@@ -123,5 +123,9 @@
     }
 
-    dwDriveType = GetDriveTypeA(lpFileName);
+    char szDrive[4];
+    szDrive[0] = *lpFileName;
+    szDrive[1] = ':';
+    szDrive[2] = '\0';
+    dwDriveType = GetDriveTypeA(szDrive);
 
     //Disable error popus. NT allows an app to open a cdrom/dvd drive without a disk inside
@@ -136,10 +140,10 @@
                                hTemplate);
 
-    //It is not allowed to open a readonly device with GENERIC_WRITE in OS/2; 
+    //It is not allowed to open a readonly device with GENERIC_WRITE in OS/2;
     //try with readonly again if that happened
     //NOTE: Some applications open it with GENERIC_WRITE as Windows 2000 requires
     //      this for some aspi functions
-    if(hFile == INVALID_HANDLE_ERROR && dwDriveType == DRIVE_CDROM && 
-       (pHMHandleData->dwAccess & GENERIC_WRITE)) 
+    if(hFile == INVALID_HANDLE_ERROR && dwDriveType == DRIVE_CDROM &&
+       (pHMHandleData->dwAccess & GENERIC_WRITE))
     {
         pHMHandleData->dwAccess &= ~GENERIC_WRITE;
@@ -185,5 +189,5 @@
 
         drvInfo->driveType = dwDriveType;
-        if(drvInfo->driveType == DRIVE_CDROM) 
+        if(drvInfo->driveType == DRIVE_CDROM)
         {
             drvInfo->hInstAspi = LoadLibraryA("WNASPI32.DLL");
@@ -200,5 +204,5 @@
                 drvInfo->hInstAspi = 0;
             }
-   
+
             //get cdrom signature
             DWORD parsize = 4;
@@ -248,5 +252,5 @@
         if(hFile == INVALID_HANDLE_ERROR) {
              dprintf(("Drive not ready"));
-             return 0; 
+             return 0;
         }
         OSLibDosQueryVolumeSerialAndName(1 + drvInfo->driveLetter - 'A', &drvInfo->dwVolumelabel, NULL, 0);
@@ -319,12 +323,12 @@
   } ParameterBlock;
 #pragma pack()
-  
+
   DWORD dwParameterSize = sizeof( ParameterBlock );
   DWORD dwDataSize      = 0;
   DWORD ret;
-  
+
   ParameterBlock.ucCommand = dwCommand;
   ParameterBlock.ucHandle  = dwDiskHandle;
-  
+
   if(lpBytesReturned)
     *lpBytesReturned = 0;
@@ -588,5 +592,5 @@
         UCHAR  uchFileData[1] = {'0'};    /* Data to write to file */
 
-        if(!pHMHandleData->hHMHandle) 
+        if(!pHMHandleData->hHMHandle)
         {
             pHMHandleData->hHMHandle = OpenDisk(drvInfo);
@@ -604,5 +608,5 @@
 
         OSLibDosDevIOCtl(pHMHandleData->hHMHandle,IOCTL_DISK,DSK_LOCKDRIVE,0,0,0,0,0,0);
-          
+
         ULONG oldmode = SetErrorMode(SEM_FAILCRITICALERRORS);
 
@@ -629,5 +633,5 @@
             goto writecheckfail;
         }
-  
+
         rc =  OSLibDosWrite(pHMHandleData->hHMHandle,   /* File handle */
                             (PVOID) uchFileData,        /* String to be written */
@@ -678,5 +682,5 @@
             }
         }
-        
+
         //Applications can use this IOCTL to check if the floppy has been changed
         //OSLibDosGetDiskGeometry won't fail when that happens so we read the
@@ -718,6 +722,6 @@
     case IOCTL_SERIAL_LSRMST_INSERT:
         break;
-      
-      
+
+
     // -----------
     // CDROM class
@@ -737,5 +741,5 @@
             BYTE  ucTrackControl;
         } AudioTrackInfo;
-        typedef struct 
+        typedef struct
         {
             BYTE  signature[4];
@@ -778,5 +782,5 @@
 
         //numtracks+1, because we have to add a track at the end
-        int length = 4 + (numtracks+1)*sizeof(TRACK_DATA); 
+        int length = 4 + (numtracks+1)*sizeof(TRACK_DATA);
         //big endian format
         pTOC->Length[0] = HIBYTE((length-2));  //minus length itself;
@@ -787,6 +791,6 @@
             return FALSE;
         }
-        
-        for(int i=0;i<numtracks;i++) 
+
+        for(int i=0;i<numtracks;i++)
         {
             parsize = sizeof(parm);
@@ -839,9 +843,9 @@
     case IOCTL_CDROM_GET_CONTROL:
         break;
-    
+
     case IOCTL_CDROM_PLAY_AUDIO_MSF:
     {
       dprintf(("Play CDROM audio playback"));
-      
+
 #pragma pack(1)
       struct
@@ -853,12 +857,12 @@
       } ParameterBlock;
 #pragma pack()
-      
+
       PCDROM_PLAY_AUDIO_MSF pPlay = (PCDROM_PLAY_AUDIO_MSF)lpInBuffer;
-      
+
       // setup the parameter block
-      
+
       memcpy(&ParameterBlock.ucSignature, drvInfo->signature, 4);
       ParameterBlock.ucAddressingMode = 1;     // MSF format
-      
+
       // @@@PH unknown if this kind of MSF conversion is correct!
       ParameterBlock.ulStartingMSF    = pPlay->StartingM << 16 |
@@ -868,12 +872,12 @@
                                         pPlay->EndingS << 8  |
                                         pPlay->EndingF;
-        
+
       DWORD dwParameterSize = sizeof( ParameterBlock );
       DWORD dwDataSize      = 0;
       DWORD ret;
-    
+
       if(lpBytesReturned)
         *lpBytesReturned = 0;
-    
+
       ret = OSLibDosDevIOCtl(pHMHandleData->hHMHandle,
                              0x81,  // IOCTL_CDROMAUDIO
@@ -887,5 +891,5 @@
       return (ret == ERROR_SUCCESS);
     }
-      
+
     case IOCTL_CDROM_SEEK_AUDIO_MSF:
         break;
@@ -894,18 +898,18 @@
       // NO BREAK CASE
       // Note: for OS/2, pause and stop seems to be the same!
-      
+
     case IOCTL_CDROM_STOP_AUDIO:
     {
       dprintf(("Stop / pause CDROM audio playback"));
-      return ioctlCDROMSimple(pHMHandleData, 
+      return ioctlCDROMSimple(pHMHandleData,
                               0x81,   // IOCTL_CDROMAUDIO
                               0x51,   // CDROMAUDIO_STOPAUDIO
                               lpBytesReturned, drvInfo);
     }
-      
+
     case IOCTL_CDROM_RESUME_AUDIO:
     {
       dprintf(("Resume CDROM audio playback"));
-      return ioctlCDROMSimple(pHMHandleData, 
+      return ioctlCDROMSimple(pHMHandleData,
                               0x81,   // IOCTL_CDROMAUDIO
                               0x52,   // CDROMAUDIO_RESUMEAUDIO
@@ -985,33 +989,33 @@
     case IOCTL_CDROM_MEDIA_REMOVAL:
         break;
-      
+
     case IOCTL_CDROM_EJECT_MEDIA:
     {
       dprintf(("Eject CDROM media"));
-      return ioctlCDROMSimple(pHMHandleData, 
+      return ioctlCDROMSimple(pHMHandleData,
                               0x80,   // IOCTL_CDROM
                               0x44,   // CDROMDISK_EJECTDISK
                               lpBytesReturned, drvInfo);
     }
-      
+
     case IOCTL_CDROM_LOAD_MEDIA:
     {
       dprintf(("Loading CDROM media"));
-      return ioctlCDROMSimple(pHMHandleData, 
+      return ioctlCDROMSimple(pHMHandleData,
                               0x80,   // IOCTL_CDROM
                               0x45,   // CDROMDISK_CLOSETRAY
                               lpBytesReturned, drvInfo);
     }
-      
+
     case IOCTL_CDROM_RESERVE:
     case IOCTL_CDROM_RELEASE:
     case IOCTL_CDROM_FIND_NEW_DEVICES:
         break;
-      
-      
+
+
     // -------------
     // STORAGE class
     // -------------
-      
+
     case IOCTL_CDROM_CHECK_VERIFY:
         if(drvInfo->driveType != DRIVE_CDROM) {
@@ -1080,5 +1084,5 @@
                                   lpBytesReturned);
     }
-           
+
     case IOCTL_STORAGE_LOAD_MEDIA:
     // case IOCTL_STORAGE_LOAD_MEDIA2:
@@ -1090,14 +1094,14 @@
                                   lpBytesReturned);
     }
-      
+
     // case IOCTL_STORAGE_EJECTION_CONTROL:
     case IOCTL_STORAGE_MEDIA_REMOVAL:
          break;
-      
-      
+
+
     // -------------------
     // SCSI passthru class
     // -------------------
-      
+
     case IOCTL_SCSI_PASS_THROUGH:
     case IOCTL_SCSI_MINIPORT:
@@ -1111,5 +1115,5 @@
         SRB_ExecSCSICmd *psrb;
 
-        if(drvInfo->hInstAspi == NULL) 
+        if(drvInfo->hInstAspi == NULL)
         {
             SetLastError(ERROR_ACCESS_DENIED);
