Changeset 8261
- Timestamp:
- Apr 13, 2002, 9:41:31 AM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/kernel32/oslibdos.cpp ¶
r8259 r8261 1 /* $Id: oslibdos.cpp,v 1.9 7 2002-04-13 06:31:53bird Exp $ */1 /* $Id: oslibdos.cpp,v 1.98 2002-04-13 07:41:31 bird Exp $ */ 2 2 /* 3 3 * Wrappers for OS/2 Dos* API … … 12 12 * 13 13 */ 14 15 16 17 /******************************************************************************* 18 * Header Files * 19 *******************************************************************************/ 14 20 #define INCL_BASE 15 21 #define INCL_DOSEXCEPTIONS … … 38 44 #include "dbglocal.h" 39 45 46 47 /******************************************************************************* 48 * Structures and Typedefs * 49 *******************************************************************************/ 50 #ifndef DEVTYPE_OPTICAL 51 #define DEVTYPE_OPTICAL 0x0008 52 #endif 53 54 #define IOC_CDROM_2 0x82 /* from cdioctl.h (ddk, os2cdrom.dmd sample) */ 55 #define IOCD_RETURN_DRIVE_LETTER 0x60 56 57 58 // used for input to logical disk Get device parms Ioctl 59 #pragma pack(1) 60 typedef struct 61 { 62 UCHAR Infotype; 63 UCHAR DriveUnit; 64 } DSKREQ; 65 66 /*------------------------------------------------* 67 * Cat 0x82, Func 0x60: Return Drive Letter Info * 68 *------------------------------------------------*/ 69 typedef struct DriveLetter_Data 70 { 71 USHORT drive_count; 72 USHORT first_drive_number; 73 } CDDRVLTR; 74 #pragma pack() 75 76 77 /******************************************************************************* 78 * Global Variables * 79 *******************************************************************************/ 40 80 static PROC_DosSetFileSizeL DosSetFileSizeLProc = 0; 41 81 static PROC_DosSetFilePtrL DosSetFilePtrLProc = 0; … … 44 84 static BOOL f64BitIO = FALSE; 45 85 86 /* first user queries the data */ 87 static CDDRVLTR cdDrvLtr = {0xffff, 0xffff}; 88 89 90 /******************************************************************************* 91 * Functions Prototypes. * 92 *******************************************************************************/ 46 93 BOOL WINAPI CharToOemA( LPCSTR s, LPSTR d ); 47 94 BOOL WINAPI OemToCharA( LPCSTR s, LPSTR d ); 95 96 97 48 98 49 99 //****************************************************************************** … … 2631 2681 #define DisketteCylinders 80 2632 2682 2633 #ifndef DEVTYPE_OPTICAL2634 #define DEVTYPE_OPTICAL 0x00082635 #endif2636 2637 // used for input to logical disk Get device parms Ioctl2638 #pragma pack(1)2639 typedef struct2640 {2641 UCHAR Infotype;2642 UCHAR DriveUnit;2643 } DSKREQ;2644 2645 /*------------------------------------------------*2646 * Cat 0x82, Func 0x60: Return Drive Letter Info *2647 *------------------------------------------------*/2648 typedef struct DriveLetter_Data2649 {2650 USHORT drive_count;2651 USHORT first_drive_number;2652 } CDDRVLTR;2653 #pragma pack()2654 2683 2655 2684 … … 2706 2735 * exactly very dynamic when it comes to this info. 2707 2736 */ 2708 static CDDRVLTR cdDrvLtr = {0xffff, 0xffff};2709 2737 if (cdDrvLtr.drive_count == 0xffff) 2710 2738 { … … 2717 2745 == NO_ERROR) 2718 2746 { 2719 #define IOC_CDROM_2 0x82 /* from cdioctl.h (ddk, os2cdrom.dmd sample) */2720 #define IOCD_RETURN_DRIVE_LETTER 0x602721 2747 cbData = sizeof(cdDrvLtr); 2722 2748 rc = DosDevIOCtl(hCDRom2, … … 2727 2753 DosClose(hCDRom2); 2728 2754 } 2755 else 2756 cdDrvLtr.drive_count = 0; 2729 2757 } 2730 2758 … … 2973 3001 memcpy(pTiledData, pData, *pdwDataLen); 2974 3002 3003 #if 1 3004 /* 3005 * Quick and Dirty Fix! 3006 * TO BE REMOVED! 3007 * 3008 * On some VPC installation without CDROM we seem to 3009 * use a concidrable amount of time during Win2k shutdown. 3010 * No idea why, but it has to do with CDROM we think. 3011 * 3012 * So, let's just fail all IOCtls to CD01 if there aren't any 3013 * CDROMs in the system. 3014 * 3015 */ 3016 3017 /* 3018 * Check for CD drives 3019 * We don't have to this everytime. I mean, the os2cdrom.dmd is 3020 * exactly very dynamic when it comes to this info. 3021 */ 3022 if (cdDrvLtr.drive_count == 0xffff) 3023 { 3024 HFILE hCDRom2; 3025 ULONG ulAction = 0; 3026 3027 if (DosOpen("\\DEV\\CD-ROM2$", &hCDRom2, &ulAction, 0, 3028 FILE_NORMAL, OPEN_ACTION_OPEN_IF_EXISTS, 3029 OPEN_SHARE_DENYNONE | OPEN_ACCESS_READONLY, NULL) 3030 == NO_ERROR) 3031 { 3032 ULONG cbData = sizeof(cdDrvLtr); 3033 rc = DosDevIOCtl(hCDRom2, 3034 IOC_CDROM_2, 3035 IOCD_RETURN_DRIVE_LETTER, 3036 NULL, 0, NULL, 3037 (PVOID)&cdDrvLtr, sizeof(cdDrvLtr), &cbData); 3038 DosClose(hCDRom2); 3039 } 3040 else 3041 cdDrvLtr.drive_count = 0; 3042 } 3043 3044 if ( cdDrvLtr.drive_count == 0 3045 && (dwCat == IOCTL_CDROMDISK 3046 || (dwCat == IOCTL_CDROMAUDIO 3047 && dwParmMaxLen >= 4 && strncmp((char*)pParm, "CD01", 4)) 3048 ) 3049 ) 3050 { 3051 /* just return some error code */ 3052 return ERROR_BAD_COMMAND; 3053 } 3054 3055 #endif 2975 3056 2976 3057 rc = DosDevIOCtl( (HFILE)hFile, dwCat, dwFunc,
Note:
See TracChangeset
for help on using the changeset viewer.