Changeset 220 for trunk/src/helpers/_test_dosh.c
- Timestamp:
- Sep 2, 2002, 4:00:04 PM (23 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/helpers/_test_dosh.c
r209 r220 34 34 int main (int argc, char *argv[]) 35 35 { 36 ULONG ul; 36 APIRET arc; 37 38 BYTE cCDs, 39 bFirstCD; 40 41 ULONG ul; 37 42 38 43 printf("Drive checker ("__DATE__")\n"); … … 44 49 { 45 50 XDISKINFO xdi; 46 APIRETarc = doshGetDriveInfo(ul,47 48 51 arc = doshGetDriveInfo(ul, 52 0, // DRVFL_TOUCHFLOPPIES, 53 &xdi); 49 54 50 55 printf(" %c: ", xdi.cDriveLetter, ul); … … 86 91 case DRVTYPE_CDROM: pcsz = "CDROM "; break; 87 92 case DRVTYPE_LAN: pcsz = "LAN "; break; 88 case DRVTYPE_P ARTITIONABLEREMOVEABLE:93 case DRVTYPE_PRT: 89 94 pcsz = "PRTREM"; break; 90 95 default: … … 122 127 } 123 128 } 129 130 if (!(arc = doshQueryCDDrives(&cCDs, 131 &bFirstCD))) 132 { 133 printf("First CD-ROM drive is %c:\n", bFirstCD); 134 printf("%d CD-ROM drive(s) present\n", cCDs); 135 } 136 else 137 printf("doshQueryCDDrives returned %d\n", arc); 138 139 { 140 #pragma pack(1) 141 struct 142 { 143 BYTE ci; 144 USHORT usDrive; 145 } parms; 146 #pragma pack() 147 148 USHORT fs = 123; 149 150 parms.ci = 0; 151 parms.usDrive = bFirstCD - 'A'; 152 153 if (!(arc = doshDevIOCtl((HFILE)-1, 154 IOCTL_DISK, 155 DSK_GETLOCKSTATUS, 156 &parms, sizeof(parms), 157 &fs, sizeof(fs)))) 158 { 159 printf("IOCTL_DISK DSK_GETLOCKSTATUS returned 0x%lX\n", fs); 160 switch (fs & 0x03) 161 { 162 case 0: 163 printf(" Lock/Unlock/Eject/Status functions not supported\n"); 164 break; 165 166 case 1: 167 printf(" Drive locked; Lock/Unlock/Eject functions supported\n"); 168 break; 169 170 case 2: 171 printf(" Drive unlocked; Lock/Unlock/Eject functions supported\n"); 172 break; 173 174 case 3: 175 printf(" Lock Status not supported; Lock/Unlock/Eject functions supported\n"); 176 break; 177 } 178 179 if (fs & 0x04) 180 printf(" Media in drive\n"); 181 else 182 printf(" No media in drive\n"); 183 184 } 185 else 186 printf("ioctl DSK_GETLOCKSTATUS returned %d\n", arc); 187 } 188 189 { 190 HFILE hf; 191 ULONG dummy; 192 CHAR szDrive[] = "C:"; 193 szDrive[0] = bFirstCD; 194 if (arc = DosOpen(szDrive, // "C:", "D:", ... 195 &hf, 196 &dummy, 197 0, 198 FILE_NORMAL, 199 // OPEN_ACTION_FAIL_IF_NEW 200 OPEN_ACTION_OPEN_IF_EXISTS, 201 OPEN_FLAGS_DASD 202 | OPEN_FLAGS_FAIL_ON_ERROR 203 // ^^^ if this flag is not set, we get the white 204 // hard-error box 205 | OPEN_FLAGS_NOINHERIT // V0.9.6 (2000-11-25) [pr] 206 // | OPEN_ACCESS_READONLY // V0.9.13 (2001-06-14) [umoeller] 207 | OPEN_SHARE_DENYNONE, 208 NULL)) 209 printf("DosOpen(\"%s\") returned %d\n", 210 szDrive, 211 arc); 212 else 213 { 214 ULONG fl; 215 if (!(arc = doshQueryCDStatus(hf, &fl))) 216 { 217 #define FLAG(f) f, # f 218 struct 219 { 220 ULONG fl; 221 PCSZ pcszFl; 222 } aFlags[] = 223 { 224 FLAG(CDFL_DOOROPEN), 225 FLAG(CDFL_DOORLOCKED), 226 FLAG(CDFL_COOKEDANDRAW), 227 FLAG(CDFL_READWRITE), 228 FLAG(CDFL_DATAANDAUDIO), 229 FLAG(CDFL_ISO9660INTERLEAVE ), 230 FLAG(CDFL_PREFETCHSUPPORT), 231 FLAG(CDFL_AUDIOCHANNELMANIP), 232 FLAG(CDFL_MINUTESECONDADDR), 233 FLAG(CDFL_MODE2SUPPORT), 234 FLAG(CDFL_DISKPRESENT), 235 FLAG(CDFL_PLAYINGAUDIO), 236 FLAG(CDFL_CDDA), 237 }; 238 ULONG ul; 239 240 printf("IOCTL_CDROMDISK CDROMDISK_DEVICESTATUS returned 0x%lX\n", fl); 241 242 for (ul = 0; 243 ul < ARRAYITEMCOUNT(aFlags); 244 ++ul) 245 { 246 if (fl & aFlags[ul].fl) 247 printf(" + "); 248 else 249 printf(" - "); 250 printf("%s\n", aFlags[ul].pcszFl); 251 } 252 } 253 else 254 printf("IOCTL_CDROMDISK CDROMDISK_DEVICESTATUS returned error 0x%lX (%d)\n", 255 arc, arc); 256 257 DosClose(hf); 258 } 259 } 124 260 }
Note:
See TracChangeset
for help on using the changeset viewer.