| [2] | 1 | #define INCL_DOS | 
|---|
|  | 2 | #define INCL_WIN | 
|---|
|  | 3 |  | 
|---|
|  | 4 | #include <os2.h> | 
|---|
|  | 5 | #include <stdlib.h> | 
|---|
|  | 6 | #include <stdio.h> | 
|---|
|  | 7 | #include <string.h> | 
|---|
|  | 8 | #include <ctype.h> | 
|---|
|  | 9 | #include "fm3dll.h" | 
|---|
|  | 10 |  | 
|---|
|  | 11 | #pragma alloc_text(VALID,CheckDrive,IsRoot,IsFile,IsFullName,needsquoting) | 
|---|
|  | 12 | #pragma alloc_text(VALID,IsValidDir,IsValidDrive,MakeValidDir,IsVowel) | 
|---|
|  | 13 | #pragma alloc_text(VALID,IsFileSame,IsNewer,TestDates,RootName,MakeFullName) | 
|---|
|  | 14 | #pragma alloc_text(VALID,IsExecutable,IsBinary,IsDesktop,ParentIsDesktop) | 
|---|
|  | 15 | #pragma alloc_text(FILLFLAGS,FillInDriveFlags,assign_ignores) | 
|---|
|  | 16 | #pragma alloc_text(FILLFLAGS,ArgDriveFlags,DriveFlagsOne) | 
|---|
|  | 17 | #pragma alloc_text(FINDDESK,GetDesktopName) | 
|---|
|  | 18 |  | 
|---|
|  | 19 |  | 
|---|
|  | 20 | APIRET MakeFullName (char *filename) { | 
|---|
|  | 21 |  | 
|---|
|  | 22 | /* filename must be CCHMAXPATH long minimum! */ | 
|---|
|  | 23 |  | 
|---|
|  | 24 | char   fullname[CCHMAXPATH]; | 
|---|
|  | 25 | APIRET rc; | 
|---|
|  | 26 |  | 
|---|
|  | 27 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 28 | rc = DosQueryPathInfo(filename, | 
|---|
|  | 29 | FIL_QUERYFULLNAME, | 
|---|
|  | 30 | fullname, | 
|---|
|  | 31 | sizeof(fullname)); | 
|---|
|  | 32 | if(rc) | 
|---|
|  | 33 | strcpy(filename, | 
|---|
|  | 34 | fullname); | 
|---|
|  | 35 | return rc; | 
|---|
|  | 36 | } | 
|---|
|  | 37 |  | 
|---|
|  | 38 |  | 
|---|
|  | 39 | char *RootName (char *filename) { | 
|---|
|  | 40 |  | 
|---|
|  | 41 | char *p = NULL,*pp; | 
|---|
|  | 42 |  | 
|---|
|  | 43 | if(filename) { | 
|---|
|  | 44 | p = strrchr(filename,'\\'); | 
|---|
|  | 45 | pp = strrchr(filename,'/'); | 
|---|
|  | 46 | p = (p) ? | 
|---|
|  | 47 | (pp) ? | 
|---|
|  | 48 | (p > pp) ? | 
|---|
|  | 49 | p : | 
|---|
|  | 50 | pp : | 
|---|
|  | 51 | p : | 
|---|
|  | 52 | pp; | 
|---|
|  | 53 | } | 
|---|
|  | 54 | if(!p)                  /* name is itself a root */ | 
|---|
|  | 55 | p = filename; | 
|---|
|  | 56 | else                    /* skip past backslash */ | 
|---|
|  | 57 | p++; | 
|---|
|  | 58 | if(p && | 
|---|
|  | 59 | !*p && | 
|---|
|  | 60 | p == filename + 3)   /* is root */ | 
|---|
|  | 61 | p--; | 
|---|
|  | 62 | return p; | 
|---|
|  | 63 | } | 
|---|
|  | 64 |  | 
|---|
|  | 65 |  | 
|---|
|  | 66 | int TestDates (char *file1,char *file2) { | 
|---|
|  | 67 |  | 
|---|
|  | 68 | /* | 
|---|
|  | 69 | * return 1 (file2 newer than file1), | 
|---|
|  | 70 | * 0 (files same) | 
|---|
|  | 71 | * or -1 (file1 newer than file2) | 
|---|
|  | 72 | */ | 
|---|
|  | 73 |  | 
|---|
|  | 74 | int         comp = 0; | 
|---|
|  | 75 | FILESTATUS3 fs3o,fs3n; | 
|---|
|  | 76 |  | 
|---|
|  | 77 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 78 | if(!DosQueryPathInfo(file1, | 
|---|
|  | 79 | FIL_STANDARD, | 
|---|
|  | 80 | &fs3o, | 
|---|
|  | 81 | sizeof(fs3o))) { | 
|---|
|  | 82 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 83 | if(!DosQueryPathInfo(file2, | 
|---|
|  | 84 | FIL_STANDARD, | 
|---|
|  | 85 | &fs3n, | 
|---|
|  | 86 | sizeof(fs3n))) { | 
|---|
|  | 87 | comp = (fs3n.fdateLastWrite.year > | 
|---|
|  | 88 | fs3o.fdateLastWrite.year) ? 1 : | 
|---|
|  | 89 | (fs3n.fdateLastWrite.year < | 
|---|
|  | 90 | fs3o.fdateLastWrite.year) ? -1 : | 
|---|
|  | 91 | (fs3n.fdateLastWrite.month > | 
|---|
|  | 92 | fs3o.fdateLastWrite.month) ? 1 : | 
|---|
|  | 93 | (fs3n.fdateLastWrite.month < | 
|---|
|  | 94 | fs3o.fdateLastWrite.month) ? -1 : | 
|---|
|  | 95 | (fs3n.fdateLastWrite.day > | 
|---|
|  | 96 | fs3o.fdateLastWrite.day) ? 1 : | 
|---|
|  | 97 | (fs3n.fdateLastWrite.day < | 
|---|
|  | 98 | fs3o.fdateLastWrite.day) ? -1 : | 
|---|
|  | 99 | (fs3n.ftimeLastWrite.hours > | 
|---|
|  | 100 | fs3o.ftimeLastWrite.hours) ? 1 : | 
|---|
|  | 101 | (fs3n.ftimeLastWrite.hours < | 
|---|
|  | 102 | fs3o.ftimeLastWrite.hours) ? -1 : | 
|---|
|  | 103 | (fs3n.ftimeLastWrite.minutes > | 
|---|
|  | 104 | fs3o.ftimeLastWrite.minutes) ? 1 : | 
|---|
|  | 105 | (fs3n.ftimeLastWrite.minutes < | 
|---|
|  | 106 | fs3o.ftimeLastWrite.minutes) ? -1 : | 
|---|
|  | 107 | (fs3n.ftimeLastWrite.twosecs > | 
|---|
|  | 108 | fs3o.ftimeLastWrite.twosecs) ? 1 : | 
|---|
|  | 109 | (fs3n.ftimeLastWrite.twosecs < | 
|---|
|  | 110 | fs3o.ftimeLastWrite.twosecs) ? -1 : | 
|---|
|  | 111 | 0; | 
|---|
|  | 112 | } | 
|---|
|  | 113 | } | 
|---|
|  | 114 | return comp; | 
|---|
|  | 115 | } | 
|---|
|  | 116 |  | 
|---|
|  | 117 |  | 
|---|
|  | 118 | BOOL IsNewer (char *file1,char *file2) { | 
|---|
|  | 119 |  | 
|---|
|  | 120 | /* return TRUE if file2 is newer than file1 */ | 
|---|
|  | 121 |  | 
|---|
|  | 122 | return (TestDates(file1,file2) > 0); | 
|---|
|  | 123 | } | 
|---|
|  | 124 |  | 
|---|
|  | 125 |  | 
|---|
|  | 126 | BOOL IsDesktop (HAB hab,HWND hwnd) { | 
|---|
|  | 127 |  | 
|---|
|  | 128 | HWND hwndDesktop; | 
|---|
|  | 129 |  | 
|---|
|  | 130 | if(hwnd == HWND_DESKTOP) | 
|---|
|  | 131 | return TRUE; | 
|---|
|  | 132 | hwndDesktop = WinQueryDesktopWindow(hab,NULLHANDLE); | 
|---|
|  | 133 | if(hwnd == hwndDesktop) | 
|---|
|  | 134 | return TRUE; | 
|---|
|  | 135 | return FALSE; | 
|---|
|  | 136 | } | 
|---|
|  | 137 |  | 
|---|
|  | 138 | BOOL ParentIsDesktop (HWND hwnd,HWND hwndParent) { | 
|---|
|  | 139 |  | 
|---|
|  | 140 | HWND hwndDesktop; | 
|---|
|  | 141 | BOOL ret = FALSE; | 
|---|
|  | 142 |  | 
|---|
|  | 143 | if(!hwndParent) | 
|---|
|  | 144 | hwndParent = WinQueryWindow(hwnd,QW_PARENT); | 
|---|
|  | 145 | if(hwndParent == HWND_DESKTOP) | 
|---|
|  | 146 | ret = TRUE; | 
|---|
|  | 147 | else { | 
|---|
|  | 148 | hwndDesktop = WinQueryDesktopWindow(WinQueryAnchorBlock(hwnd),(HWND)0); | 
|---|
|  | 149 | if(hwndDesktop == hwndParent) | 
|---|
|  | 150 | ret = TRUE; | 
|---|
|  | 151 | } | 
|---|
|  | 152 | return ret; | 
|---|
|  | 153 | } | 
|---|
|  | 154 |  | 
|---|
|  | 155 |  | 
|---|
|  | 156 | INT CheckDrive (CHAR Drive, CHAR *FileSystem, ULONG *type) { | 
|---|
|  | 157 |  | 
|---|
|  | 158 | CHAR        Path[3],*Buffer = NULL,*pfsn = NULL,*pfsd = NULL; | 
|---|
|  | 159 | ULONG       Size,Status,action,LengthIn,LengthOut; | 
|---|
|  | 160 | HFILE       Handle; | 
|---|
|  | 161 | BYTE        Command = 0,NonRemovable; | 
|---|
|  | 162 | PFSQBUFFER2 pfsq; | 
|---|
|  | 163 |  | 
|---|
|  | 164 | if(FileSystem) | 
|---|
|  | 165 | *FileSystem = 0; | 
|---|
|  | 166 | if(type) | 
|---|
|  | 167 | *type = 0; | 
|---|
|  | 168 |  | 
|---|
|  | 169 | if(DosAllocMem((PVOID)&Buffer,4096, | 
|---|
|  | 170 | PAG_COMMIT | OBJ_TILE | PAG_READ | PAG_WRITE)) { | 
|---|
|  | 171 | DosBeep(50,50); | 
|---|
|  | 172 | return -1; | 
|---|
|  | 173 | } | 
|---|
|  | 174 |  | 
|---|
|  | 175 | Path[0] = Drive; | 
|---|
|  | 176 | Path[1] = ':'; | 
|---|
|  | 177 | Path[2] = 0; | 
|---|
|  | 178 | Size = 4096; | 
|---|
|  | 179 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 180 | Status = DosQueryFSAttach(Path, 0, FSAIL_QUERYNAME, | 
|---|
|  | 181 | (PFSQBUFFER2)Buffer, &Size); | 
|---|
|  | 182 | if(Status) {   /* can't get any info at all */ | 
|---|
|  | 183 | DosFreeMem(Buffer); | 
|---|
|  | 184 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 185 | return -1; | 
|---|
|  | 186 | } | 
|---|
|  | 187 |  | 
|---|
|  | 188 | pfsq = (PFSQBUFFER2)Buffer; | 
|---|
|  | 189 | pfsn = pfsq->szName + pfsq->cbName + 1; | 
|---|
|  | 190 | pfsd = pfsn + pfsq->cbFSDName + 1; | 
|---|
|  | 191 |  | 
|---|
|  | 192 | if(FileSystem) { | 
|---|
|  | 193 | strncpy(FileSystem, pfsn, CCHMAXPATH); | 
|---|
|  | 194 | FileSystem[CCHMAXPATH - 1] = 0; | 
|---|
|  | 195 | } | 
|---|
|  | 196 |  | 
|---|
|  | 197 | if(type && !strcmp(pfsn,CDFS)) | 
|---|
|  | 198 | (*type) |= (DRIVE_NOTWRITEABLE | DRIVE_CDROM | DRIVE_REMOVABLE); | 
|---|
|  | 199 |  | 
|---|
|  | 200 | if(((PFSQBUFFER2)Buffer)->iType == FSAT_REMOTEDRV) { | 
|---|
|  | 201 | if(type) | 
|---|
|  | 202 | (*type) |= DRIVE_REMOTE; | 
|---|
|  | 203 | if(type && !strcmp(pfsn,CBSIFS)) { | 
|---|
|  | 204 | (*type) |= DRIVE_ZIPSTREAM; | 
|---|
|  | 205 | (*type) &= (~DRIVE_REMOTE); | 
|---|
|  | 206 | (*type) |= DRIVE_NOLONGNAMES; | 
|---|
|  | 207 | if(pfsq->cbFSAData) { | 
|---|
|  | 208 |  | 
|---|
|  | 209 | ULONG FType; | 
|---|
|  | 210 |  | 
|---|
|  | 211 | if(CheckDrive(*pfsd,NULL,&FType) != -1) { | 
|---|
|  | 212 | if(FType & DRIVE_REMOVABLE) | 
|---|
|  | 213 | (*type) |= DRIVE_REMOVABLE; | 
|---|
|  | 214 | if(!(FType & DRIVE_NOLONGNAMES)) | 
|---|
|  | 215 | (*type) &= (~DRIVE_NOLONGNAMES); | 
|---|
|  | 216 | } | 
|---|
|  | 217 | } | 
|---|
|  | 218 | } | 
|---|
|  | 219 | if(type && (!strcmp(pfsn,HPFS) || !strcmp(pfsn,HPFS386))) | 
|---|
|  | 220 | (*type) &= (~DRIVE_NOLONGNAMES); | 
|---|
|  | 221 | DosFreeMem(Buffer); | 
|---|
|  | 222 | return 0;  /* assume remotes are non-removable */ | 
|---|
|  | 223 | } | 
|---|
|  | 224 |  | 
|---|
|  | 225 | if(strcmp(pfsn,HPFS) && strcmp(pfsn,CDFS) && strcmp(pfsn,HPFS386)) { | 
|---|
|  | 226 | if(type) | 
|---|
|  | 227 | (*type) |= DRIVE_NOLONGNAMES; | 
|---|
|  | 228 | } | 
|---|
|  | 229 |  | 
|---|
|  | 230 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 231 | Status = DosOpen(Path, &Handle, &action, 0, 0, FILE_OPEN, | 
|---|
|  | 232 | OPEN_ACCESS_READONLY | OPEN_SHARE_DENYNONE | | 
|---|
|  | 233 | OPEN_FLAGS_DASD | OPEN_FLAGS_FAIL_ON_ERROR, 0); | 
|---|
|  | 234 | if(Status) { | 
|---|
|  | 235 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 236 | if(type) | 
|---|
|  | 237 | (*type) |= DRIVE_REMOVABLE; | 
|---|
|  | 238 | DosFreeMem(Buffer); | 
|---|
|  | 239 | return(1);  /* assume inaccessible local drives are removable */ | 
|---|
|  | 240 | } | 
|---|
|  | 241 | LengthIn = sizeof(Command); | 
|---|
|  | 242 | LengthOut = sizeof(NonRemovable); | 
|---|
|  | 243 | NonRemovable = 1; | 
|---|
|  | 244 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 245 | DosDevIOCtl(Handle, 8, 0x20,&Command, sizeof(Command), &LengthIn, | 
|---|
|  | 246 | &NonRemovable, sizeof(NonRemovable), &LengthOut); | 
|---|
|  | 247 | DosClose(Handle); | 
|---|
|  | 248 | if(!NonRemovable && type) | 
|---|
|  | 249 | (*type) |= DRIVE_REMOVABLE; | 
|---|
|  | 250 | DosFreeMem(Buffer); | 
|---|
|  | 251 | return (NonRemovable) ? 0 : 1; | 
|---|
|  | 252 | } | 
|---|
|  | 253 |  | 
|---|
|  | 254 |  | 
|---|
|  | 255 | BOOL IsFileSame (CHAR *filename1,CHAR *filename2) { | 
|---|
|  | 256 |  | 
|---|
|  | 257 | /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */ | 
|---|
|  | 258 |  | 
|---|
|  | 259 | FILESTATUS3 fsa1,fsa2; | 
|---|
|  | 260 | APIRET      ret; | 
|---|
|  | 261 |  | 
|---|
|  | 262 | if(filename1 && filename2) { | 
|---|
|  | 263 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 264 | ret = DosQueryPathInfo(filename1,FIL_STANDARD,&fsa1, | 
|---|
|  | 265 | (ULONG)sizeof(fsa1)); | 
|---|
|  | 266 | if(!ret) { | 
|---|
|  | 267 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 268 | ret = DosQueryPathInfo(filename2,FIL_STANDARD,&fsa2, | 
|---|
|  | 269 | (ULONG)sizeof(fsa2)); | 
|---|
|  | 270 | if(!ret) { | 
|---|
|  | 271 | if(fsa1.cbFile == fsa2.cbFile && | 
|---|
|  | 272 | (fsa1.attrFile & (~FILE_ARCHIVED)) == | 
|---|
|  | 273 | (fsa2.attrFile & (~FILE_ARCHIVED))) | 
|---|
|  | 274 | return TRUE; | 
|---|
|  | 275 | } | 
|---|
|  | 276 | } | 
|---|
|  | 277 | } | 
|---|
|  | 278 | return FALSE; | 
|---|
|  | 279 | } | 
|---|
|  | 280 |  | 
|---|
|  | 281 |  | 
|---|
|  | 282 | INT IsFile (CHAR *filename) { | 
|---|
|  | 283 |  | 
|---|
|  | 284 | /* returns:  -1 (error), 0 (is a directory), or 1 (is a file) */ | 
|---|
|  | 285 |  | 
|---|
|  | 286 | FILESTATUS3 fsa; | 
|---|
|  | 287 | APIRET      ret; | 
|---|
|  | 288 |  | 
|---|
|  | 289 | if(filename && *filename) { | 
|---|
|  | 290 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 291 | ret = DosQueryPathInfo(filename, | 
|---|
|  | 292 | FIL_STANDARD, | 
|---|
|  | 293 | &fsa, | 
|---|
|  | 294 | (ULONG)sizeof(fsa)); | 
|---|
|  | 295 | if(!ret) | 
|---|
|  | 296 | return ((fsa.attrFile & FILE_DIRECTORY) == 0); | 
|---|
|  | 297 | else if(IsValidDrive(*filename) && IsRoot(filename)) | 
|---|
|  | 298 | return 0; | 
|---|
|  | 299 | } | 
|---|
|  | 300 | return -1;  /* error; doesn't exist or can't read or null filename */ | 
|---|
|  | 301 | } | 
|---|
|  | 302 |  | 
|---|
|  | 303 |  | 
|---|
|  | 304 | BOOL IsFullName (CHAR *filename) { | 
|---|
|  | 305 |  | 
|---|
|  | 306 | return (filename) ? | 
|---|
|  | 307 | (isalpha(*filename) && filename[1] == ':' && filename[2] == '\\') : | 
|---|
|  | 308 | 0; | 
|---|
|  | 309 | } | 
|---|
|  | 310 |  | 
|---|
|  | 311 |  | 
|---|
|  | 312 | BOOL IsRoot (CHAR *filename) { | 
|---|
|  | 313 |  | 
|---|
|  | 314 | return (filename && isalpha(*filename) && filename[1] == ':' && | 
|---|
|  | 315 | filename[2] == '\\' && !filename[3]); | 
|---|
|  | 316 | } | 
|---|
|  | 317 |  | 
|---|
|  | 318 |  | 
|---|
|  | 319 | BOOL IsValidDir (CHAR *path) { | 
|---|
|  | 320 |  | 
|---|
|  | 321 | CHAR        fullname[CCHMAXPATH]; | 
|---|
|  | 322 | FILESTATUS3 fs; | 
|---|
|  | 323 |  | 
|---|
|  | 324 | if(path) { | 
|---|
|  | 325 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 326 | if(!DosQueryPathInfo(path, | 
|---|
|  | 327 | FIL_QUERYFULLNAME, | 
|---|
|  | 328 | fullname, | 
|---|
|  | 329 | sizeof(fullname))) { | 
|---|
|  | 330 | if(IsValidDrive(*fullname)) { | 
|---|
|  | 331 | if(!IsRoot(fullname)) { | 
|---|
|  | 332 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 333 | if(!DosQueryPathInfo(fullname, | 
|---|
|  | 334 | FIL_STANDARD, | 
|---|
|  | 335 | &fs, | 
|---|
|  | 336 | sizeof(fs)) && | 
|---|
|  | 337 | (fs.attrFile & FILE_DIRECTORY)) | 
|---|
|  | 338 | return TRUE; | 
|---|
|  | 339 | } | 
|---|
|  | 340 | else | 
|---|
|  | 341 | return TRUE; | 
|---|
|  | 342 | } | 
|---|
|  | 343 | } | 
|---|
|  | 344 | } | 
|---|
|  | 345 | return FALSE; | 
|---|
|  | 346 | } | 
|---|
|  | 347 |  | 
|---|
|  | 348 |  | 
|---|
|  | 349 | BOOL IsValidDrive (CHAR drive) { | 
|---|
|  | 350 |  | 
|---|
|  | 351 | CHAR   Path[] = " :",Buffer[256]; | 
|---|
|  | 352 | APIRET Status; | 
|---|
|  | 353 | ULONG  Size; | 
|---|
|  | 354 | ULONG  ulDriveNum,ulDriveMap; | 
|---|
|  | 355 |  | 
|---|
|  | 356 | if(!isalpha(drive) || | 
|---|
|  | 357 | (driveflags[toupper(drive) - 'A'] & (DRIVE_IGNORE | DRIVE_INVALID))) | 
|---|
|  | 358 | return FALSE; | 
|---|
|  | 359 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 360 | Status = DosQCurDisk(&ulDriveNum,&ulDriveMap); | 
|---|
|  | 361 | if(!Status) { | 
|---|
|  | 362 | if(!(ulDriveMap & (1L << (ULONG)(toupper(drive) - 'A')))) | 
|---|
|  | 363 | return FALSE; | 
|---|
|  | 364 | Path[0] = toupper(drive); | 
|---|
|  | 365 | Size = sizeof(Buffer); | 
|---|
|  | 366 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 367 | Status = DosQueryFSAttach(Path, | 
|---|
|  | 368 | 0, | 
|---|
|  | 369 | FSAIL_QUERYNAME, | 
|---|
|  | 370 | (PFSQBUFFER2)Buffer, | 
|---|
|  | 371 | &Size); | 
|---|
|  | 372 | } | 
|---|
|  | 373 | return (Status == 0); | 
|---|
|  | 374 | } | 
|---|
|  | 375 |  | 
|---|
|  | 376 |  | 
|---|
|  | 377 | CHAR * MakeValidDir (CHAR *path) { | 
|---|
|  | 378 |  | 
|---|
|  | 379 | CHAR           fullname[CCHMAXPATH],drive; | 
|---|
|  | 380 | register CHAR *p; | 
|---|
|  | 381 | FILESTATUS3    fs; | 
|---|
|  | 382 | APIRET         status; | 
|---|
|  | 383 |  | 
|---|
|  | 384 | if(!MakeFullName(path)) { | 
|---|
|  | 385 | if(IsValidDrive(*path)) { | 
|---|
|  | 386 | for(;;) { | 
|---|
|  | 387 | if(IsRoot(path)) | 
|---|
|  | 388 | return path; | 
|---|
|  | 389 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 390 | status = DosQueryPathInfo(path, | 
|---|
|  | 391 | FIL_STANDARD, | 
|---|
|  | 392 | &fs, | 
|---|
|  | 393 | sizeof(fs)); | 
|---|
|  | 394 | if(!status && | 
|---|
|  | 395 | (fs.attrFile & FILE_DIRECTORY) != 0) | 
|---|
|  | 396 | return path; | 
|---|
|  | 397 | p = strrchr(path,'\\'); | 
|---|
|  | 398 | if(p) { | 
|---|
|  | 399 | if(p < path + 3) | 
|---|
|  | 400 | p++; | 
|---|
|  | 401 | *p = 0; | 
|---|
|  | 402 | } | 
|---|
|  | 403 | else | 
|---|
|  | 404 | break; | 
|---|
|  | 405 | } | 
|---|
|  | 406 | } | 
|---|
|  | 407 | } | 
|---|
|  | 408 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 409 | if(!DosQuerySysInfo(QSV_BOOT_DRIVE, | 
|---|
|  | 410 | QSV_BOOT_DRIVE, | 
|---|
|  | 411 | &drive, | 
|---|
|  | 412 | 1L)) { | 
|---|
|  | 413 | drive += '@'; | 
|---|
|  | 414 | if(drive < 'C') | 
|---|
|  | 415 | drive = 'C'; | 
|---|
|  | 416 | strcpy(path," :\\"); | 
|---|
|  | 417 | *path = drive; | 
|---|
|  | 418 | } | 
|---|
|  | 419 | else | 
|---|
|  | 420 | save_dir2(path); | 
|---|
|  | 421 | return path; | 
|---|
|  | 422 | } | 
|---|
|  | 423 |  | 
|---|
|  | 424 |  | 
|---|
|  | 425 | BOOL IsExecutable (CHAR *filename) { | 
|---|
|  | 426 |  | 
|---|
|  | 427 | register CHAR *p; | 
|---|
|  | 428 | APIRET         ret; | 
|---|
|  | 429 | ULONG          apptype; | 
|---|
|  | 430 |  | 
|---|
|  | 431 | if(filename) { | 
|---|
|  | 432 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 433 | p = strrchr(filename,'.'); | 
|---|
|  | 434 | if(p) | 
|---|
|  | 435 | ret = DosQAppType(filename, | 
|---|
|  | 436 | &apptype); | 
|---|
|  | 437 | else { | 
|---|
|  | 438 |  | 
|---|
|  | 439 | char fname[CCHMAXPATH + 2]; | 
|---|
|  | 440 |  | 
|---|
|  | 441 | strcpy(fname,filename); | 
|---|
|  | 442 | strcat(fname,"."); | 
|---|
|  | 443 | ret = DosQAppType(fname, | 
|---|
|  | 444 | &apptype); | 
|---|
|  | 445 | } | 
|---|
|  | 446 | if((!ret && (!apptype || | 
|---|
|  | 447 | (apptype & | 
|---|
|  | 448 | (FAPPTYP_NOTWINDOWCOMPAT | | 
|---|
|  | 449 | FAPPTYP_WINDOWCOMPAT | | 
|---|
|  | 450 | FAPPTYP_WINDOWAPI | | 
|---|
|  | 451 | FAPPTYP_BOUND | | 
|---|
|  | 452 | FAPPTYP_DOS | | 
|---|
|  | 453 | FAPPTYP_WINDOWSREAL | | 
|---|
|  | 454 | FAPPTYP_WINDOWSPROT | | 
|---|
|  | 455 | FAPPTYP_32BIT | | 
|---|
|  | 456 | 0x1000)))) || | 
|---|
|  | 457 | (p && | 
|---|
|  | 458 | (!stricmp(p,".CMD") || | 
|---|
|  | 459 | !stricmp(p,".BAT")))) | 
|---|
|  | 460 | return TRUE; | 
|---|
|  | 461 | } | 
|---|
|  | 462 | return FALSE; | 
|---|
|  | 463 | } | 
|---|
|  | 464 |  | 
|---|
|  | 465 |  | 
|---|
|  | 466 | VOID ArgDriveFlags (INT argc,CHAR **argv) { | 
|---|
|  | 467 |  | 
|---|
|  | 468 | INT x; | 
|---|
|  | 469 |  | 
|---|
|  | 470 | for(x = 1;x < argc;x++) { | 
|---|
|  | 471 | if(*argv[x] == '/' && isalpha(argv[x][1])) { | 
|---|
|  | 472 |  | 
|---|
|  | 473 | CHAR *p = &argv[x][1]; | 
|---|
|  | 474 |  | 
|---|
|  | 475 | while(isalpha(*p)) { | 
|---|
|  | 476 | driveflags[toupper(*p) - 'A'] |= DRIVE_IGNORE; | 
|---|
|  | 477 | p++; | 
|---|
|  | 478 | } | 
|---|
|  | 479 | } | 
|---|
|  | 480 | else if(*argv[x] == ';' && isalpha(argv[x][1])) { | 
|---|
|  | 481 |  | 
|---|
|  | 482 | CHAR *p = &argv[x][1]; | 
|---|
|  | 483 |  | 
|---|
|  | 484 | while(isalpha(*p)) { | 
|---|
|  | 485 | driveflags[toupper(*p) - 'A'] |= DRIVE_NOPRESCAN; | 
|---|
|  | 486 | p++; | 
|---|
|  | 487 | } | 
|---|
|  | 488 | } | 
|---|
|  | 489 | else if(*argv[x] == ',' && isalpha(argv[x][1])) { | 
|---|
|  | 490 |  | 
|---|
|  | 491 | CHAR *p = &argv[x][1]; | 
|---|
|  | 492 |  | 
|---|
|  | 493 | while(isalpha(*p)) { | 
|---|
|  | 494 | driveflags[toupper(*p) - 'A'] |= DRIVE_NOLOADICONS; | 
|---|
|  | 495 | p++; | 
|---|
|  | 496 | } | 
|---|
|  | 497 | } | 
|---|
|  | 498 | else if(*argv[x] == '`' && isalpha(argv[x][1])) { | 
|---|
|  | 499 |  | 
|---|
|  | 500 | CHAR *p = &argv[x][1]; | 
|---|
|  | 501 |  | 
|---|
|  | 502 | while(isalpha(*p)) { | 
|---|
|  | 503 | driveflags[toupper(*p) - 'A'] |= DRIVE_NOLOADSUBJS; | 
|---|
|  | 504 | p++; | 
|---|
|  | 505 | } | 
|---|
|  | 506 | } | 
|---|
|  | 507 | else if(*argv[x] == '\'' && isalpha(argv[x][1])) { | 
|---|
|  | 508 |  | 
|---|
|  | 509 | CHAR *p = &argv[x][1]; | 
|---|
|  | 510 |  | 
|---|
|  | 511 | while(isalpha(*p)) { | 
|---|
|  | 512 | driveflags[toupper(*p) - 'A'] |= DRIVE_NOLOADLONGS; | 
|---|
|  | 513 | p++; | 
|---|
|  | 514 | } | 
|---|
|  | 515 | } | 
|---|
|  | 516 | } | 
|---|
|  | 517 | } | 
|---|
|  | 518 |  | 
|---|
|  | 519 |  | 
|---|
|  | 520 | VOID DriveFlagsOne (INT x) { | 
|---|
|  | 521 |  | 
|---|
|  | 522 | INT         removable; | 
|---|
|  | 523 | CHAR        szDrive[] = " :\\",FileSystem[CCHMAXPATH]; | 
|---|
|  | 524 | ULONG       drvtype; | 
|---|
|  | 525 |  | 
|---|
|  | 526 | *szDrive = (CHAR)(x + 'A'); | 
|---|
|  | 527 | *FileSystem = 0; | 
|---|
|  | 528 | drvtype = 0; | 
|---|
|  | 529 | removable = CheckDrive(*szDrive,FileSystem,&drvtype); | 
|---|
|  | 530 | driveserial[x] = -1; | 
|---|
|  | 531 | driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS | | 
|---|
|  | 532 | DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | | 
|---|
|  | 533 | DRIVE_INCLUDEFILES | DRIVE_SLOW); | 
|---|
|  | 534 | if(removable != -1) { | 
|---|
|  | 535 |  | 
|---|
|  | 536 | struct { | 
|---|
|  | 537 | ULONG serial; | 
|---|
|  | 538 | CHAR  volumelength; | 
|---|
|  | 539 | CHAR  volumelabel[CCHMAXPATH]; | 
|---|
|  | 540 | }      volser; | 
|---|
|  | 541 |  | 
|---|
|  | 542 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 543 | if(!DosQueryFSInfo((ULONG)x + 1,FSIL_VOLSER,&volser,sizeof(volser))) | 
|---|
|  | 544 | driveserial[x] = volser.serial; | 
|---|
|  | 545 | else | 
|---|
|  | 546 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 547 | } | 
|---|
|  | 548 | else | 
|---|
|  | 549 | driveflags[x] |= DRIVE_INVALID; | 
|---|
|  | 550 | driveflags[x] |= ((removable == -1 || removable == 1) ? | 
|---|
|  | 551 | DRIVE_REMOVABLE : 0); | 
|---|
|  | 552 | if(drvtype & DRIVE_REMOTE) | 
|---|
|  | 553 | driveflags[x] |= DRIVE_REMOTE; | 
|---|
|  | 554 | if(strcmp(FileSystem,HPFS) && | 
|---|
|  | 555 | strcmp(FileSystem,HPFS386) && | 
|---|
|  | 556 | strcmp(FileSystem,CDFS)) | 
|---|
|  | 557 | driveflags[x] |= DRIVE_NOLONGNAMES; | 
|---|
|  | 558 | if(!strcmp(FileSystem,CDFS)) { | 
|---|
|  | 559 | removable = 1; | 
|---|
|  | 560 | driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOTWRITEABLE | | 
|---|
|  | 561 | DRIVE_CDROM); | 
|---|
|  | 562 | } | 
|---|
|  | 563 | else if(!stricmp(FileSystem,CBSIFS)) { | 
|---|
|  | 564 | driveflags[x] |= DRIVE_ZIPSTREAM; | 
|---|
|  | 565 | driveflags[x] &= (~DRIVE_REMOTE); | 
|---|
|  | 566 | if(drvtype & DRIVE_REMOVABLE) | 
|---|
|  | 567 | driveflags[x] |= DRIVE_REMOVABLE; | 
|---|
|  | 568 | if(!(drvtype & DRIVE_NOLONGNAMES)) | 
|---|
|  | 569 | driveflags[x] &= (~DRIVE_NOLONGNAMES); | 
|---|
|  | 570 | } | 
|---|
|  | 571 | } | 
|---|
|  | 572 |  | 
|---|
|  | 573 |  | 
|---|
|  | 574 | VOID FillInDriveFlags (VOID *dummy) { | 
|---|
|  | 575 |  | 
|---|
|  | 576 | ULONG        ulDriveNum,ulDriveMap; | 
|---|
|  | 577 | register INT x; | 
|---|
|  | 578 |  | 
|---|
|  | 579 | for(x = 0;x < 26;x++) | 
|---|
|  | 580 | driveflags[x] &= (DRIVE_IGNORE | DRIVE_NOPRESCAN | DRIVE_NOLOADICONS | | 
|---|
|  | 581 | DRIVE_NOLOADSUBJS | DRIVE_NOLOADLONGS | | 
|---|
|  | 582 | DRIVE_INCLUDEFILES | DRIVE_SLOW); | 
|---|
|  | 583 | memset(driveserial,-1,sizeof(driveserial)); | 
|---|
|  | 584 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 585 | DosQCurDisk(&ulDriveNum,&ulDriveMap); | 
|---|
|  | 586 | for(x = 0;x < 26;x++) { | 
|---|
|  | 587 | if(ulDriveMap & (1L << x) && !(driveflags[x] & DRIVE_IGNORE)) { | 
|---|
|  | 588 | { | 
|---|
|  | 589 | CHAR  s[80]; | 
|---|
|  | 590 | ULONG flags = 0,size = sizeof(ULONG); | 
|---|
|  | 591 |  | 
|---|
|  | 592 | sprintf(s,"%c.DriveFlags",(CHAR)(x + 'A')); | 
|---|
|  | 593 | if(PrfQueryProfileData(fmprof,appname,s,&flags,&size) && | 
|---|
|  | 594 | size == sizeof(ULONG)) | 
|---|
|  | 595 | driveflags[x] |= flags; | 
|---|
|  | 596 | } | 
|---|
|  | 597 |  | 
|---|
|  | 598 | if(x > 1) { | 
|---|
|  | 599 | if(!(driveflags[x] & DRIVE_NOPRESCAN)) | 
|---|
|  | 600 | DriveFlagsOne(x); | 
|---|
|  | 601 | else | 
|---|
|  | 602 | driveserial[x] = -1; | 
|---|
|  | 603 | } | 
|---|
|  | 604 | else { | 
|---|
|  | 605 | driveflags[x] |= (DRIVE_REMOVABLE | DRIVE_NOLONGNAMES); | 
|---|
|  | 606 | driveserial[x] = -1; | 
|---|
|  | 607 | } | 
|---|
|  | 608 | } | 
|---|
|  | 609 | else if(!(ulDriveMap & (1L << x))) | 
|---|
|  | 610 | driveflags[x] |= DRIVE_INVALID; | 
|---|
|  | 611 | } | 
|---|
|  | 612 | { | 
|---|
|  | 613 | ULONG  startdrive = 3L; | 
|---|
|  | 614 |  | 
|---|
|  | 615 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 616 | DosQuerySysInfo(QSV_BOOT_DRIVE,QSV_BOOT_DRIVE, | 
|---|
|  | 617 | (PVOID)&startdrive,(ULONG)sizeof(ULONG)); | 
|---|
|  | 618 | if(startdrive) | 
|---|
|  | 619 | driveflags[startdrive - 1] |= DRIVE_BOOT; | 
|---|
|  | 620 | } | 
|---|
|  | 621 | } | 
|---|
|  | 622 |  | 
|---|
|  | 623 |  | 
|---|
|  | 624 | CHAR * assign_ignores (CHAR *s) { | 
|---|
|  | 625 |  | 
|---|
|  | 626 | register INT   x; | 
|---|
|  | 627 | register CHAR *p,*pp; | 
|---|
|  | 628 |  | 
|---|
|  | 629 | *s = '/'; | 
|---|
|  | 630 | s[1] = 0; | 
|---|
|  | 631 | p = s + 1; | 
|---|
|  | 632 | if(s) { | 
|---|
|  | 633 | for(x = 0;x < 26;x++) { | 
|---|
|  | 634 | if((driveflags[x] & DRIVE_IGNORE) != 0) { | 
|---|
|  | 635 | *p = (CHAR)x + 'A'; | 
|---|
|  | 636 | p++; | 
|---|
|  | 637 | *p = 0; | 
|---|
|  | 638 | } | 
|---|
|  | 639 | } | 
|---|
|  | 640 | } | 
|---|
|  | 641 | if(!s[1]) { | 
|---|
|  | 642 | *s = 0; | 
|---|
|  | 643 | pp = s; | 
|---|
|  | 644 | } | 
|---|
|  | 645 | else { | 
|---|
|  | 646 | pp = &s[strlen(s)]; | 
|---|
|  | 647 | *pp = ' '; | 
|---|
|  | 648 | pp++; | 
|---|
|  | 649 | } | 
|---|
|  | 650 | *pp = ';'; | 
|---|
|  | 651 | pp[1] = 0; | 
|---|
|  | 652 | p = pp + 1; | 
|---|
|  | 653 | if(pp) { | 
|---|
|  | 654 | for(x = 0;x < 26;x++) { | 
|---|
|  | 655 | if((driveflags[x] & DRIVE_NOPRESCAN) != 0) { | 
|---|
|  | 656 | *p = (CHAR)x + 'A'; | 
|---|
|  | 657 | p++; | 
|---|
|  | 658 | *p = 0; | 
|---|
|  | 659 | } | 
|---|
|  | 660 | } | 
|---|
|  | 661 | } | 
|---|
|  | 662 | if(!pp[1]) | 
|---|
|  | 663 | *pp = 0; | 
|---|
|  | 664 | pp = &s[strlen(s)]; | 
|---|
|  | 665 | *pp = ' '; | 
|---|
|  | 666 | pp++; | 
|---|
|  | 667 | *pp = ','; | 
|---|
|  | 668 | pp[1] = 0; | 
|---|
|  | 669 | p = pp + 1; | 
|---|
|  | 670 | if(pp) { | 
|---|
|  | 671 | for(x = 0;x < 26;x++) { | 
|---|
|  | 672 | if((driveflags[x] & DRIVE_NOLOADICONS) != 0) { | 
|---|
|  | 673 | *p = (CHAR)x + 'A'; | 
|---|
|  | 674 | p++; | 
|---|
|  | 675 | *p = 0; | 
|---|
|  | 676 | } | 
|---|
|  | 677 | } | 
|---|
|  | 678 | } | 
|---|
|  | 679 | if(!pp[1]) | 
|---|
|  | 680 | *pp = 0; | 
|---|
|  | 681 | pp = &s[strlen(s)]; | 
|---|
|  | 682 | *pp = ' '; | 
|---|
|  | 683 | pp++; | 
|---|
|  | 684 | *pp = '`'; | 
|---|
|  | 685 | pp[1] = 0; | 
|---|
|  | 686 | p = pp + 1; | 
|---|
|  | 687 | if(pp) { | 
|---|
|  | 688 | for(x = 0;x < 26;x++) { | 
|---|
|  | 689 | if((driveflags[x] & DRIVE_NOLOADSUBJS) != 0) { | 
|---|
|  | 690 | *p = (CHAR)x + 'A'; | 
|---|
|  | 691 | p++; | 
|---|
|  | 692 | *p = 0; | 
|---|
|  | 693 | } | 
|---|
|  | 694 | } | 
|---|
|  | 695 | } | 
|---|
|  | 696 | if(!pp[1]) | 
|---|
|  | 697 | *pp = 0; | 
|---|
|  | 698 | pp = &s[strlen(s)]; | 
|---|
|  | 699 | *pp = ' '; | 
|---|
|  | 700 | pp++; | 
|---|
|  | 701 | *pp = '\''; | 
|---|
|  | 702 | pp[1] = 0; | 
|---|
|  | 703 | p = pp + 1; | 
|---|
|  | 704 | if(pp) { | 
|---|
|  | 705 | for(x = 0;x < 26;x++) { | 
|---|
|  | 706 | if((driveflags[x] & DRIVE_NOLOADLONGS) != 0) { | 
|---|
|  | 707 | *p = (CHAR)x + 'A'; | 
|---|
|  | 708 | p++; | 
|---|
|  | 709 | *p = 0; | 
|---|
|  | 710 | } | 
|---|
|  | 711 | } | 
|---|
|  | 712 | } | 
|---|
|  | 713 | if(!pp[1]) | 
|---|
|  | 714 | *pp = 0; | 
|---|
|  | 715 | lstrip(rstrip(s)); | 
|---|
|  | 716 | return s; | 
|---|
|  | 717 | } | 
|---|
|  | 718 |  | 
|---|
|  | 719 |  | 
|---|
|  | 720 | BOOL needs_quoting (register CHAR *f) { | 
|---|
|  | 721 |  | 
|---|
|  | 722 | register CHAR *p = " &|<>"; | 
|---|
|  | 723 |  | 
|---|
|  | 724 | while(*p) { | 
|---|
|  | 725 | if(strchr(f,*p)) | 
|---|
|  | 726 | return TRUE; | 
|---|
|  | 727 | p++; | 
|---|
|  | 728 | } | 
|---|
|  | 729 | return FALSE; | 
|---|
|  | 730 | } | 
|---|
|  | 731 |  | 
|---|
|  | 732 |  | 
|---|
|  | 733 | BOOL IsBinary (register CHAR *str,ULONG len) { | 
|---|
|  | 734 |  | 
|---|
|  | 735 | register ULONG x = 0L; | 
|---|
|  | 736 |  | 
|---|
|  | 737 | if(str) { | 
|---|
|  | 738 | while(x < len) { | 
|---|
|  | 739 | if(str[x] < ' ' && str[x] != '\r' && str[x] != '\n' && str[x] != '\t' && | 
|---|
|  | 740 | str[x] != '\x1b' && str[x] != '\x1a' && str[x] != '\07' && | 
|---|
|  | 741 | str[x] != '\x0c') | 
|---|
|  | 742 | return TRUE; | 
|---|
|  | 743 | x++; | 
|---|
|  | 744 | } | 
|---|
|  | 745 | } | 
|---|
|  | 746 | return FALSE; | 
|---|
|  | 747 | } | 
|---|
|  | 748 |  | 
|---|
|  | 749 |  | 
|---|
|  | 750 | BOOL TestBinary (CHAR *filename) { | 
|---|
|  | 751 |  | 
|---|
|  | 752 | HFILE   handle; | 
|---|
|  | 753 | ULONG   action,len; | 
|---|
|  | 754 | APIRET  rc; | 
|---|
|  | 755 | CHAR    buff[512]; | 
|---|
|  | 756 |  | 
|---|
|  | 757 | if(filename) { | 
|---|
|  | 758 | if(!DosOpen(filename,&handle,&action,0L,0L, | 
|---|
|  | 759 | OPEN_ACTION_FAIL_IF_NEW | OPEN_ACTION_OPEN_IF_EXISTS, | 
|---|
|  | 760 | OPEN_FLAGS_FAIL_ON_ERROR | OPEN_FLAGS_NOINHERIT | | 
|---|
|  | 761 | OPEN_FLAGS_SEQUENTIAL | OPEN_SHARE_DENYNONE | | 
|---|
|  | 762 | OPEN_ACCESS_READONLY,0L)) { | 
|---|
|  | 763 | len = 512; | 
|---|
|  | 764 | rc = DosRead(handle,buff,len,&len); | 
|---|
|  | 765 | DosClose(handle); | 
|---|
|  | 766 | if(!rc && len) | 
|---|
|  | 767 | return IsBinary(buff,len); | 
|---|
|  | 768 | } | 
|---|
|  | 769 | } | 
|---|
|  | 770 | return FALSE; | 
|---|
|  | 771 | } | 
|---|
|  | 772 |  | 
|---|
|  | 773 |  | 
|---|
|  | 774 | char *IsVowel (char a) { | 
|---|
|  | 775 |  | 
|---|
|  | 776 | return (strchr("aeiouAEIOU",a) != NULL) ? "n" : NullStr; | 
|---|
|  | 777 | } | 
|---|
|  | 778 |  | 
|---|
|  | 779 |  | 
|---|
|  | 780 | VOID GetDesktopName (CHAR *objectpath,ULONG size) { | 
|---|
|  | 781 |  | 
|---|
|  | 782 | PFN     WQDPath; | 
|---|
|  | 783 | HMODULE hmod = 0; | 
|---|
|  | 784 | APIRET  rc; | 
|---|
|  | 785 | ULONG   startdrive = 3L; | 
|---|
|  | 786 | CHAR    objerr[CCHMAXPATH]; | 
|---|
|  | 787 |  | 
|---|
|  | 788 | if(!objectpath) | 
|---|
|  | 789 | return; | 
|---|
|  | 790 | *objectpath = 0; | 
|---|
|  | 791 | if(OS2ver[0] > 20 || (OS2ver[0] == 20 && OS2ver[1] >= 30)) { | 
|---|
|  | 792 | /* | 
|---|
|  | 793 | * if running under warp, we can get the desktop name | 
|---|
|  | 794 | * this way... | 
|---|
|  | 795 | */ | 
|---|
|  | 796 | rc = DosLoadModule(objerr, | 
|---|
|  | 797 | sizeof(objerr), | 
|---|
|  | 798 | "PMWP", | 
|---|
|  | 799 | &hmod); | 
|---|
|  | 800 | if(!rc) { | 
|---|
|  | 801 | rc = DosQueryProcAddr(hmod, | 
|---|
|  | 802 | 262, | 
|---|
|  | 803 | NULL, | 
|---|
|  | 804 | &WQDPath); | 
|---|
|  | 805 | if(!rc) | 
|---|
|  | 806 | WQDPath(objectpath,size); | 
|---|
|  | 807 | DosFreeModule(hmod); | 
|---|
|  | 808 | } | 
|---|
|  | 809 | } | 
|---|
|  | 810 | if(!*objectpath) { | 
|---|
|  | 811 | if(!PrfQueryProfileString(HINI_SYSTEMPROFILE, | 
|---|
|  | 812 | "FolderWorkareaRunningObjects", | 
|---|
|  | 813 | NULL, | 
|---|
|  | 814 | "\0", | 
|---|
|  | 815 | (PVOID)objectpath, | 
|---|
|  | 816 | sizeof(objectpath))) | 
|---|
|  | 817 | *objectpath = 0; | 
|---|
|  | 818 | if(!*objectpath || IsFile(objectpath)) { | 
|---|
|  | 819 | DosBeep(250,10); | 
|---|
|  | 820 | DosError(FERR_DISABLEHARDERR); | 
|---|
|  | 821 | DosQuerySysInfo(QSV_BOOT_DRIVE,QSV_BOOT_DRIVE, | 
|---|
|  | 822 | (PVOID)&startdrive,(ULONG)sizeof(ULONG)); | 
|---|
|  | 823 | sprintf(objectpath, | 
|---|
|  | 824 | "%c:\\DESKTOP", | 
|---|
|  | 825 | ((CHAR)startdrive) + '@'); | 
|---|
|  | 826 | } | 
|---|
|  | 827 | } | 
|---|
|  | 828 | } | 
|---|