Changeset 70 for trunk/dll/valid.c
- Timestamp:
- Nov 5, 2003, 2:18:25 AM (22 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/dll/valid.c
r48 r70 10 10 11 11 Revisions 23 Nov 02 SHL - RootName: rework for sanity 12 13 12 27 Nov 02 SHL - MakeFullName: correct typo 13 11 Jun 03 SHL - Add JFS and FAT32 support 14 14 15 15 ***********************************************************************/ … … 168 168 169 169 170 INT CheckDrive (CHAR Drive, CHAR *FileSystem, ULONG *type) {171 170 INT CheckDrive (CHAR chDrive, CHAR *pszFileSystem, ULONG *pulType) 171 { 172 172 CHAR Path[3],*Buffer = NULL,*pfsn = NULL,*pfsd = NULL; 173 173 ULONG Size,Status,action,LengthIn,LengthOut; … … 176 176 PFSQBUFFER2 pfsq; 177 177 178 if (FileSystem)179 * FileSystem = 0;180 if (type)181 * type = 0;178 if (pszFileSystem) 179 *pszFileSystem = 0; 180 if (pulType) 181 *pulType = 0; 182 182 183 183 if(DosAllocMem((PVOID)&Buffer,4096, 184 184 PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE)) { 185 185 DosBeep(50,50); 186 return -1; 187 } 188 189 Path[0] = Drive;186 return -1; // Say failed 187 } 188 189 Path[0] = chDrive; 190 190 Path[1] = ':'; 191 191 Path[2] = 0; … … 194 194 Status = DosQueryFSAttach(Path, 0, FSAIL_QUERYNAME, 195 195 (PFSQBUFFER2)Buffer, &Size); 196 if(Status) { /* can't get any info at all */ 196 if (Status) 197 { 198 /* can't get any info at all */ 197 199 DosFreeMem(Buffer); 198 200 DosError(FERR_DISABLEHARDERR); 199 return -1; 201 return -1; // Say failed 200 202 } 201 203 … … 204 206 pfsd = pfsn + pfsq->cbFSDName + 1; 205 207 206 if(FileSystem) { 207 strncpy(FileSystem, pfsn, CCHMAXPATH); 208 FileSystem[CCHMAXPATH - 1] = 0; 209 } 210 211 if(type && !strcmp(pfsn,CDFS)) 212 (*type) |= (DRIVE_NOTWRITEABLE | DRIVE_CDROM | DRIVE_REMOVABLE); 213 214 if(((PFSQBUFFER2)Buffer)->iType == FSAT_REMOTEDRV) { 215 if(type) 216 (*type) |= DRIVE_REMOTE; 217 if(type && !strcmp(pfsn,CBSIFS)) { 218 (*type) |= DRIVE_ZIPSTREAM; 219 (*type) &= (~DRIVE_REMOTE); 220 (*type) |= DRIVE_NOLONGNAMES; 221 if(pfsq->cbFSAData) { 222 208 if (pszFileSystem) 209 { 210 strncpy(pszFileSystem, pfsn, CCHMAXPATH); 211 pszFileSystem[CCHMAXPATH - 1] = 0; 212 } 213 214 if (pulType && !strcmp(pfsn,CDFS)) 215 *pulType |= DRIVE_NOTWRITEABLE | DRIVE_CDROM | DRIVE_REMOVABLE; 216 217 if (((PFSQBUFFER2)Buffer)->iType == FSAT_REMOTEDRV) 218 { 219 if (pulType) 220 *pulType |= DRIVE_REMOTE; 221 if (pulType && !strcmp(pfsn,CBSIFS)) 222 { 223 *pulType |= DRIVE_ZIPSTREAM; 224 *pulType &= ~DRIVE_REMOTE; 225 *pulType |= DRIVE_NOLONGNAMES; 226 if (pfsq->cbFSAData) 227 { 223 228 ULONG FType; 224 229 225 if(CheckDrive(*pfsd,NULL,&FType) != -1) { 226 if(FType & DRIVE_REMOVABLE) 227 (*type) |= DRIVE_REMOVABLE; 228 if(!(FType & DRIVE_NOLONGNAMES)) 229 (*type) &= (~DRIVE_NOLONGNAMES); 230 if (CheckDrive(*pfsd,NULL,&FType) != -1) 231 { 232 if (FType & DRIVE_REMOVABLE) 233 *pulType |= DRIVE_REMOVABLE; 234 if (~FType & DRIVE_NOLONGNAMES) 235 *pulType &= ~DRIVE_NOLONGNAMES; 230 236 } 231 237 } 232 238 } 233 if(type && (!strcmp(pfsn,HPFS) || !strcmp(pfsn,HPFS386))) 234 (*type) &= (~DRIVE_NOLONGNAMES); 239 if (pulType && 240 (!strcmp(pfsn,HPFS) || 241 !strcmp(pfsn,JFS) || 242 !strcmp(pfsn,FAT32) || 243 !strcmp(pfsn,HPFS386))) 244 { 245 *pulType &= ~DRIVE_NOLONGNAMES; 246 } 235 247 DosFreeMem(Buffer); 236 return 0; /* assume remotes are non-removable */ 237 } 238 239 if(strcmp(pfsn,HPFS) && strcmp(pfsn,CDFS) && strcmp(pfsn,HPFS386)) { 240 if(type) 241 (*type) |= DRIVE_NOLONGNAMES; 248 return 0; // Say non-removable 249 } 250 251 // Local drive 252 if (strcmp(pfsn,HPFS) && 253 strcmp(pfsn,JFS) && 254 strcmp(pfsn,CDFS) && 255 strcmp(pfsn,FAT32) && 256 strcmp(pfsn,HPFS386)) 257 { 258 if(pulType) 259 (*pulType) |= DRIVE_NOLONGNAMES; 242 260 } 243 261 … … 246 264 OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | 247 265 OPEN_FLAGS_DASD | OPEN_FLAGS_FAIL_ON_ERROR, 0); 248 if(Status) { 249 DosError(FERR_DISABLEHARDERR); 250 if(type) 251 (*type) |= DRIVE_REMOVABLE; 266 if(Status) 267 { 268 DosError(FERR_DISABLEHARDERR); 269 if (pulType) 270 *pulType |= DRIVE_REMOVABLE; // Assume removable if can not access 252 271 DosFreeMem(Buffer); 253 return (1); /* assume inaccessible local drives are removable */272 return 1; // Say removable 254 273 } 255 274 LengthIn = sizeof(Command); … … 260 279 &NonRemovable, sizeof(NonRemovable), &LengthOut); 261 280 DosClose(Handle); 262 if (!NonRemovable && type)263 (*type)|= DRIVE_REMOVABLE;281 if (!NonRemovable && pulType) 282 *pulType |= DRIVE_REMOVABLE; 264 283 DosFreeMem(Buffer); 265 return (NonRemovable)? 0 : 1;284 return NonRemovable ? 0 : 1; 266 285 } 267 286 … … 532 551 533 552 534 VOID DriveFlagsOne (INT x) {535 553 VOID DriveFlagsOne (INT x) 554 { 536 555 INT removable; 537 556 CHAR szDrive[] = " :\\",FileSystem[CCHMAXPATH]; … … 546 565 DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | 547 566 DRIVE_INCLUDEFILES | DRIVE_SLOW); 548 if(removable != -1) { 549 550 struct { 567 if(removable != -1) 568 { 569 struct 570 { 551 571 ULONG serial; 552 572 CHAR volumelength; … … 566 586 if(drvtype & DRIVE_REMOTE) 567 587 driveflags[x] |= DRIVE_REMOTE; 568 if(strcmp(FileSystem,HPFS) && 569 strcmp(FileSystem,HPFS386) && 570 strcmp(FileSystem,CDFS)) 588 if (strcmp(FileSystem,HPFS) && 589 strcmp(FileSystem,JFS) && 590 strcmp(FileSystem,CDFS) && 591 strcmp(FileSystem,FAT32) && 592 strcmp(FileSystem,HPFS386)) 593 { 571 594 driveflags[x] |= DRIVE_NOLONGNAMES; 595 } 572 596 if(!strcmp(FileSystem,CDFS)) { 573 597 removable = 1;
Note:
See TracChangeset
for help on using the changeset viewer.