| 1 |
|
|---|
| 2 | /*
|
|---|
| 3 | *@@sourcefile dosh.h:
|
|---|
| 4 | * header file for dosh.c. See remarks there.
|
|---|
| 5 | *
|
|---|
| 6 | * Note: Version numbering in this file relates to XWorkplace version
|
|---|
| 7 | * numbering.
|
|---|
| 8 | *
|
|---|
| 9 | *@@include #define INCL_DOSPROCESS
|
|---|
| 10 | *@@include #define INCL_DOSDEVIOCTL // for doshQueryDiskParams only
|
|---|
| 11 | *@@include #include <os2.h>
|
|---|
| 12 | *@@include #include "helpers\dosh.h"
|
|---|
| 13 | */
|
|---|
| 14 |
|
|---|
| 15 | /* This file Copyright (C) 1997-2001 Ulrich Mller,
|
|---|
| 16 | * Dmitry A. Steklenev.
|
|---|
| 17 | * This file is part of the "XWorkplace helpers" source package.
|
|---|
| 18 | * This is free software; you can redistribute it and/or modify
|
|---|
| 19 | * it under the terms of the GNU General Public License as published
|
|---|
| 20 | * by the Free Software Foundation, in version 2 as it comes in the
|
|---|
| 21 | * "COPYING" file of the XWorkplace main distribution.
|
|---|
| 22 | * This program is distributed in the hope that it will be useful,
|
|---|
| 23 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|---|
| 24 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|---|
| 25 | * GNU General Public License for more details.
|
|---|
| 26 | */
|
|---|
| 27 |
|
|---|
| 28 | #if __cplusplus
|
|---|
| 29 | extern "C" {
|
|---|
| 30 | #endif
|
|---|
| 31 |
|
|---|
| 32 | #ifndef DOSH_HEADER_INCLUDED
|
|---|
| 33 | #define DOSH_HEADER_INCLUDED
|
|---|
| 34 |
|
|---|
| 35 | /* ******************************************************************
|
|---|
| 36 | *
|
|---|
| 37 | * Wrappers
|
|---|
| 38 | *
|
|---|
| 39 | ********************************************************************/
|
|---|
| 40 |
|
|---|
| 41 | // if DOSH_STANDARDWRAPPERS is #define'd before including dosh.h,
|
|---|
| 42 | // all the following Dos* API calls are redirected to the dosh*
|
|---|
| 43 | // counterparts
|
|---|
| 44 |
|
|---|
| 45 | #ifdef DOSH_STANDARDWRAPPERS
|
|---|
| 46 |
|
|---|
| 47 | #ifdef INCL_DOSPROCESS
|
|---|
| 48 |
|
|---|
| 49 | APIRET XWPENTRY doshSleep(ULONG msec);
|
|---|
| 50 | #define DosSleep(a) doshSleep((a))
|
|---|
| 51 |
|
|---|
| 52 | #endif
|
|---|
| 53 |
|
|---|
| 54 | #ifdef INCL_DOSSEMAPHORES
|
|---|
| 55 |
|
|---|
| 56 | APIRET XWPENTRY doshCreateMutexSem(PSZ pszName,
|
|---|
| 57 | PHMTX phmtx,
|
|---|
| 58 | ULONG flAttr,
|
|---|
| 59 | BOOL32 fState);
|
|---|
| 60 | #define DosCreateMutexSem(a, b, c, d) doshCreateMutexSem((a), (b), (c), (d))
|
|---|
| 61 |
|
|---|
| 62 | APIRET XWPENTRY doshRequestMutexSem(HMTX hmtx, ULONG ulTimeout);
|
|---|
| 63 | #define DosRequestMutexSem(h, t) doshRequestMutexSem((h), (t))
|
|---|
| 64 |
|
|---|
| 65 | APIRET XWPENTRY doshReleaseMutexSem(HMTX hmtx);
|
|---|
| 66 | #define DosReleaseMutexSem(h) doshReleaseMutexSem((h))
|
|---|
| 67 |
|
|---|
| 68 | #endif
|
|---|
| 69 |
|
|---|
| 70 | #ifdef INCL_DOSEXCEPTIONS
|
|---|
| 71 |
|
|---|
| 72 | APIRET XWPENTRY doshSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
|
|---|
| 73 | #define DosSetExceptionHandler(a) doshSetExceptionHandler((a))
|
|---|
| 74 |
|
|---|
| 75 | APIRET XWPENTRY doshUnsetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec);
|
|---|
| 76 | #define DosUnsetExceptionHandler(a) doshUnsetExceptionHandler((a))
|
|---|
| 77 |
|
|---|
| 78 | #endif
|
|---|
| 79 |
|
|---|
| 80 | #endif
|
|---|
| 81 |
|
|---|
| 82 | /* ******************************************************************
|
|---|
| 83 | *
|
|---|
| 84 | * Miscellaneous
|
|---|
| 85 | *
|
|---|
| 86 | ********************************************************************/
|
|---|
| 87 |
|
|---|
| 88 | CHAR doshGetChar(VOID);
|
|---|
| 89 |
|
|---|
| 90 | BOOL doshQueryShiftState(VOID);
|
|---|
| 91 |
|
|---|
| 92 | ULONG doshIsWarp4(VOID);
|
|---|
| 93 |
|
|---|
| 94 | PSZ doshQuerySysErrorMsg(APIRET arc);
|
|---|
| 95 |
|
|---|
| 96 | ULONG doshQuerySysUptime(VOID);
|
|---|
| 97 |
|
|---|
| 98 | /* ******************************************************************
|
|---|
| 99 | *
|
|---|
| 100 | * Memory helpers
|
|---|
| 101 | *
|
|---|
| 102 | ********************************************************************/
|
|---|
| 103 |
|
|---|
| 104 | PVOID doshMalloc(ULONG cb,
|
|---|
| 105 | APIRET *parc);
|
|---|
| 106 |
|
|---|
| 107 | APIRET doshAllocArray(ULONG c,
|
|---|
| 108 | ULONG cbArrayItem,
|
|---|
| 109 | PBYTE *ppv,
|
|---|
| 110 | PULONG pcbAllocated);
|
|---|
| 111 |
|
|---|
| 112 | PVOID doshAllocSharedMem(ULONG ulSize,
|
|---|
| 113 | const char* pcszName);
|
|---|
| 114 |
|
|---|
| 115 | PVOID doshRequestSharedMem(PCSZ pcszName);
|
|---|
| 116 |
|
|---|
| 117 | /* ******************************************************************
|
|---|
| 118 | *
|
|---|
| 119 | * Drive helpers
|
|---|
| 120 | *
|
|---|
| 121 | ********************************************************************/
|
|---|
| 122 |
|
|---|
| 123 | APIRET doshIsFixedDisk(ULONG ulLogicalDrive,
|
|---|
| 124 | PBOOL pfFixed);
|
|---|
| 125 |
|
|---|
| 126 | #ifdef INCL_DOSDEVIOCTL
|
|---|
| 127 |
|
|---|
| 128 | // #pragma pack(1)
|
|---|
| 129 |
|
|---|
| 130 | /*
|
|---|
| 131 | * DRIVEPARAMS:
|
|---|
| 132 | * structure used for doshQueryDiskParams.
|
|---|
| 133 | * removed this, we can directly use BIOSPARAMETERBLOCK
|
|---|
| 134 | * V0.9.13 (2001-06-14) [umoeller]
|
|---|
| 135 | */
|
|---|
| 136 |
|
|---|
| 137 | /* typedef struct _DRIVEPARAMS
|
|---|
| 138 | {
|
|---|
| 139 | BIOSPARAMETERBLOCK bpb;
|
|---|
| 140 | // BIOS parameter block. This is the first sector
|
|---|
| 141 | // (at byte 0) in each partition. This is defined
|
|---|
| 142 | // in the OS2 headers as follows:
|
|---|
| 143 |
|
|---|
| 144 | typedef struct _BIOSPARAMETERBLOCK {
|
|---|
| 145 | 0 USHORT usBytesPerSector;
|
|---|
| 146 | // Number of bytes per sector.
|
|---|
| 147 | 2 BYTE bSectorsPerCluster;
|
|---|
| 148 | // Number of sectors per cluster.
|
|---|
| 149 | 3 USHORT usReservedSectors;
|
|---|
| 150 | // Number of reserved sectors.
|
|---|
| 151 | 5 BYTE cFATs;
|
|---|
| 152 | // Number of FATs.
|
|---|
| 153 | 6 USHORT cRootEntries;
|
|---|
| 154 | // Number of root directory entries.
|
|---|
| 155 | 8 USHORT cSectors;
|
|---|
| 156 | // Number of sectors.
|
|---|
| 157 | 10 BYTE bMedia;
|
|---|
| 158 | // Media descriptor.
|
|---|
| 159 | 11 USHORT usSectorsPerFAT;
|
|---|
| 160 | // Number of secctors per FAT.
|
|---|
| 161 | 13 USHORT usSectorsPerTrack;
|
|---|
| 162 | // Number of sectors per track.
|
|---|
| 163 | 15 USHORT cHeads;
|
|---|
| 164 | // Number of heads.
|
|---|
| 165 | 17 ULONG cHiddenSectors;
|
|---|
| 166 | // Number of hidden sectors.
|
|---|
| 167 | 21 ULONG cLargeSectors;
|
|---|
| 168 | // Number of large sectors.
|
|---|
| 169 | 25 BYTE abReserved[6];
|
|---|
| 170 | // Reserved.
|
|---|
| 171 | 31 USHORT cCylinders;
|
|---|
| 172 | // Number of cylinders defined for the physical
|
|---|
| 173 | // device.
|
|---|
| 174 | 33 BYTE bDeviceType;
|
|---|
| 175 | // Physical layout of the specified device.
|
|---|
| 176 | 34 USHORT fsDeviceAttr;
|
|---|
| 177 | // A bit field that returns flag information
|
|---|
| 178 | // about the specified drive.
|
|---|
| 179 | } BIOSPARAMETERBLOCK;
|
|---|
| 180 |
|
|---|
| 181 | // removed the following fields... these are already
|
|---|
| 182 | // in the extended BPB structure, as defined in the
|
|---|
| 183 | // Toolkit's BIOSPARAMETERBLOCK struct. Checked this,
|
|---|
| 184 | // the definition is the same for the Toolkit 3 and 4.5.
|
|---|
| 185 |
|
|---|
| 186 | USHORT usCylinders;
|
|---|
| 187 | // no. of cylinders
|
|---|
| 188 | UCHAR ucDeviceType;
|
|---|
| 189 | // device type; according to the IBM Control
|
|---|
| 190 | // Program Reference (see DSK_GETDEVICEPARAMS),
|
|---|
| 191 | // this value can be:
|
|---|
| 192 | // -- 0: 48 TPI low-density diskette drive
|
|---|
| 193 | // -- 1: 96 TPI high-density diskette drive
|
|---|
| 194 | // -- 2: 3.5-inch 720KB diskette drive
|
|---|
| 195 | // -- 3: 8-Inch single-density diskette drive
|
|---|
| 196 | // -- 4: 8-Inch double-density diskette drive
|
|---|
| 197 | // -- 5: Fixed disk
|
|---|
| 198 | // -- 6: Tape drive
|
|---|
| 199 | // -- 7: Other (includes 1.44MB 3.5-inch diskette drive
|
|---|
| 200 | // and CD-ROMs)
|
|---|
| 201 | // -- 8: R/W optical disk
|
|---|
| 202 | // -- 9: 3.5-inch 4.0MB diskette drive (2.88MB formatted)
|
|---|
| 203 | USHORT usDeviceAttrs;
|
|---|
| 204 | // DEVATTR_* flags
|
|---|
| 205 | } DRIVEPARAMS, *PDRIVEPARAMS;
|
|---|
| 206 | #pragma pack() */
|
|---|
| 207 |
|
|---|
| 208 | APIRET doshQueryDiskParams(ULONG ulLogicalDrive,
|
|---|
| 209 | PBIOSPARAMETERBLOCK pdp);
|
|---|
| 210 |
|
|---|
| 211 | BYTE doshQueryDriveType(ULONG ulLogicalDrive,
|
|---|
| 212 | PBIOSPARAMETERBLOCK pdp,
|
|---|
| 213 | BOOL fFixed);
|
|---|
| 214 |
|
|---|
| 215 | APIRET XWPENTRY doshHasAudioCD(ULONG ulLogicalDrive,
|
|---|
| 216 | HFILE hfDrive,
|
|---|
| 217 | BOOL fMixedModeCD,
|
|---|
| 218 | PBOOL pfAudio);
|
|---|
| 219 |
|
|---|
| 220 | #endif
|
|---|
| 221 |
|
|---|
| 222 | VOID XWPENTRY doshEnumDrives(PSZ pszBuffer,
|
|---|
| 223 | PCSZ pcszFileSystem,
|
|---|
| 224 | BOOL fSkipRemoveables);
|
|---|
| 225 | typedef VOID XWPENTRY DOSHENUMDRIVES(PSZ pszBuffer,
|
|---|
| 226 | PCSZ pcszFileSystem,
|
|---|
| 227 | BOOL fSkipRemoveables);
|
|---|
| 228 | typedef DOSHENUMDRIVES *PDOSHENUMDRIVES;
|
|---|
| 229 |
|
|---|
| 230 | CHAR doshQueryBootDrive(VOID);
|
|---|
| 231 |
|
|---|
| 232 | #define ERROR_AUDIO_CD_ROM 10000
|
|---|
| 233 |
|
|---|
| 234 | #define DRVFL_MIXEDMODECD 0x0001
|
|---|
| 235 | #define DRVFL_TOUCHFLOPPIES 0x0002
|
|---|
| 236 | #define DRVFL_CHECKEAS 0x0004
|
|---|
| 237 | #define DRVFL_CHECKLONGNAMES 0x0008
|
|---|
| 238 |
|
|---|
| 239 | APIRET doshAssertDrive(ULONG ulLogicalDrive,
|
|---|
| 240 | ULONG fl);
|
|---|
| 241 |
|
|---|
| 242 | #ifdef INCL_DOSDEVIOCTL
|
|---|
| 243 |
|
|---|
| 244 | /*
|
|---|
| 245 | *@@ XDISKINFO:
|
|---|
| 246 | *
|
|---|
| 247 | *@@added V0.9.16 (2002-01-13) [umoeller]
|
|---|
| 248 | */
|
|---|
| 249 |
|
|---|
| 250 | typedef struct _XDISKINFO
|
|---|
| 251 | {
|
|---|
| 252 | CHAR cDriveLetter; // drive letter
|
|---|
| 253 | CHAR cLogicalDrive; // logical drive no.
|
|---|
| 254 |
|
|---|
| 255 | BOOL fPresent; // if FALSE, drive does not exist
|
|---|
| 256 |
|
|---|
| 257 | // the following are only valid if fPresent == TRUE
|
|---|
| 258 |
|
|---|
| 259 | BIOSPARAMETERBLOCK bpb;
|
|---|
| 260 | // 0x00 USHORT usBytesPerSector;
|
|---|
| 261 | // 0x02 BYTE bSectorsPerCluster;
|
|---|
| 262 | // 0x03 USHORT usReservedSectors;
|
|---|
| 263 | // 0x05 BYTE cFATs;
|
|---|
| 264 | // 0x06 USHORT cRootEntries;
|
|---|
| 265 | // 0x08 USHORT cSectors;
|
|---|
| 266 | // 0x0a BYTE bMedia;
|
|---|
| 267 | // 0x0b USHORT usSectorsPerFAT;
|
|---|
| 268 | // 0x0d USHORT usSectorsPerTrack;
|
|---|
| 269 | // 0x0f USHORT cHeads;
|
|---|
| 270 | // 0x11 ULONG cHiddenSectors;
|
|---|
| 271 | // 0x15 ULONG cLargeSectors;
|
|---|
| 272 | // 0x19 BYTE abReserved[6];
|
|---|
| 273 | // 0x1a USHORT cCylinders;
|
|---|
| 274 | // 0x1c BYTE bDeviceType;
|
|---|
| 275 | #ifndef DEVTYPE_48TPI
|
|---|
| 276 | #define DEVTYPE_48TPI 0x0000
|
|---|
| 277 | #define DEVTYPE_96TPI 0x0001
|
|---|
| 278 | #define DEVTYPE_35 0x0002
|
|---|
| 279 | #define DEVTYPE_8SD 0x0003
|
|---|
| 280 | #define DEVTYPE_8DD 0x0004
|
|---|
| 281 | #define DEVTYPE_FIXED 0x0005
|
|---|
| 282 | #define DEVTYPE_TAPE 0x0006
|
|---|
| 283 | #endif
|
|---|
| 284 | #define DEVTYPE_OTHER 0x0007
|
|---|
| 285 | // includes 1.44 3.5" floppy
|
|---|
| 286 | #define DEVTYPE_RWOPTICAL 0x0008
|
|---|
| 287 | #define DEVTYPE_35_288MB 0x0009
|
|---|
| 288 | // 0x1d USHORT fsDeviceAttr;
|
|---|
| 289 | #define DEVATTR_REMOVEABLE 0x0001
|
|---|
| 290 | // drive is removeable
|
|---|
| 291 | #define DEVATTR_CHANGELINE 0x0002
|
|---|
| 292 | // device can determine whether media has
|
|---|
| 293 | // been removed since last I/O operation
|
|---|
| 294 | #define DEVATTR_GREATER16MB 0x0004
|
|---|
| 295 | // physical device driver supports physical
|
|---|
| 296 | // addresses > 16 MB
|
|---|
| 297 | #define DEVATTR_PARTITIONALREMOVEABLE 0x0008
|
|---|
| 298 | // undocumented flag; set for ZIP drives
|
|---|
| 299 |
|
|---|
| 300 | BYTE bType;
|
|---|
| 301 | // do not change these codes, XWorkplace relies
|
|---|
| 302 | // on them too to parse WPDisk data
|
|---|
| 303 | #define DRVTYPE_HARDDISK 0
|
|---|
| 304 | #define DRVTYPE_FLOPPY 1
|
|---|
| 305 | #define DRVTYPE_TAPE 2
|
|---|
| 306 | #define DRVTYPE_VDISK 3
|
|---|
| 307 | #define DRVTYPE_CDROM 4
|
|---|
| 308 | #define DRVTYPE_LAN 5
|
|---|
| 309 | #define DRVTYPE_PARTITIONABLEREMOVEABLE 6
|
|---|
| 310 | #define DRVTYPE_UNKNOWN 255
|
|---|
| 311 |
|
|---|
| 312 | ULONG flDevice;
|
|---|
| 313 | // any combination of the following:
|
|---|
| 314 | #define DFL_REMOTE 0x0001
|
|---|
| 315 | // drive is remote (not local)
|
|---|
| 316 | #define DFL_FIXED 0x0002
|
|---|
| 317 | // drive is fixed; otherwise it is removeable!
|
|---|
| 318 | // always set for harddisks and zip drives
|
|---|
| 319 | #define DFL_PARTITIONABLEREMOVEABLE 0x0004
|
|---|
| 320 | // set for zip drives;
|
|---|
| 321 | // in that case, DFL_FIXED is set also
|
|---|
| 322 | #define DFL_BOOTDRIVE 0x0008
|
|---|
| 323 | // drive was booted from
|
|---|
| 324 |
|
|---|
| 325 | // media flags:
|
|---|
| 326 |
|
|---|
| 327 | #define DFL_MEDIA_PRESENT 0x1000
|
|---|
| 328 | // media is present in drive;
|
|---|
| 329 | // -- always set for harddisks,
|
|---|
| 330 | // unless the file system is not
|
|---|
| 331 | // understood
|
|---|
| 332 | // -- always set for remove drives
|
|---|
| 333 | // -- always set for A: and B:
|
|---|
| 334 | // -- set for CD-ROMS only if data
|
|---|
| 335 | // CD-ROM is inserted
|
|---|
| 336 | #define DFL_AUDIO_CD 0x2000
|
|---|
| 337 | // set for CD-ROMs only, if an audio CD
|
|---|
| 338 | // is currently inserted; in that case,
|
|---|
| 339 | // DFL_MEDIA_PRESENT is _not_ set
|
|---|
| 340 | #define DFL_SUPPORTS_EAS 0x4000
|
|---|
| 341 | // drive supports extended attributes
|
|---|
| 342 | // (assumption based on DosFSCtl,
|
|---|
| 343 | // might not be correct for remote drives;
|
|---|
| 344 | // reports correctly for FAT32 though)
|
|---|
| 345 | #define DFL_SUPPORTS_LONGNAMES 0x8000
|
|---|
| 346 | // drive supports long names; this does not
|
|---|
| 347 | // necessarily mean that we support all IFS
|
|---|
| 348 | // characters also
|
|---|
| 349 |
|
|---|
| 350 | // the following are only valid if DFL_MEDIA_PRESENT is set;
|
|---|
| 351 | // they are always set for drives A: and B:
|
|---|
| 352 |
|
|---|
| 353 | CHAR szFileSystem[30];
|
|---|
| 354 | // e.g. "FAT" or "HPFS" or "JFS" or "CDFS"
|
|---|
| 355 |
|
|---|
| 356 | LONG lFileSystem;
|
|---|
| 357 | // do not change these codes, XWorkplace relies
|
|---|
| 358 | // on them too to parse WPDisk data
|
|---|
| 359 | #define FSYS_UNKNOWN 0
|
|---|
| 360 | // drive not formatted, or unknown file system
|
|---|
| 361 | #define FSYS_FAT 1
|
|---|
| 362 | #define FSYS_HPFS_JFS 2
|
|---|
| 363 | #define FSYS_CDFS 3
|
|---|
| 364 | #define FSYS_CDWFS 6 // not used by WPS!
|
|---|
| 365 | // added V0.9.19 (2002-04-25) [umoeller]
|
|---|
| 366 | #define FSYS_TVFS 7 // not used by WPS!
|
|---|
| 367 | #define FSYS_FAT32_EXT2 8 // not used by WPS!
|
|---|
| 368 | #define FSYS_RAMFS 9 // not used by WPS!
|
|---|
| 369 | #define FSYS_REMOTE 10
|
|---|
| 370 | // NOTE: if this has a negative value, this is
|
|---|
| 371 | // the APIRET code from DosQueryFSAttach
|
|---|
| 372 |
|
|---|
| 373 | // error codes for various operations
|
|---|
| 374 | APIRET arcIsFixedDisk,
|
|---|
| 375 | arcQueryDiskParams,
|
|---|
| 376 | arcQueryMedia,
|
|---|
| 377 | arcOpenLongnames;
|
|---|
| 378 |
|
|---|
| 379 | } XDISKINFO, *PXDISKINFO;
|
|---|
| 380 |
|
|---|
| 381 | APIRET doshGetDriveInfo(ULONG ulLogicalDrive,
|
|---|
| 382 | ULONG fl,
|
|---|
| 383 | PXDISKINFO pdi);
|
|---|
| 384 |
|
|---|
| 385 | #endif
|
|---|
| 386 |
|
|---|
| 387 | APIRET doshSetLogicalMap(ULONG ulLogicalDrive);
|
|---|
| 388 |
|
|---|
| 389 | APIRET XWPENTRY doshQueryDiskSize(ULONG ulLogicalDrive, double *pdSize);
|
|---|
| 390 | typedef APIRET XWPENTRY DOSHQUERYDISKSIZE(ULONG ulLogicalDrive, double *pdSize);
|
|---|
| 391 | typedef DOSHQUERYDISKSIZE *PDOSHQUERYDISKSIZE;
|
|---|
| 392 |
|
|---|
| 393 | APIRET XWPENTRY doshQueryDiskFree(ULONG ulLogicalDrive, double *pdFree);
|
|---|
| 394 | typedef APIRET XWPENTRY DOSHQUERYDISKFREE(ULONG ulLogicalDrive, double *pdFree);
|
|---|
| 395 | typedef DOSHQUERYDISKFREE *PDOSHQUERYDISKFREE;
|
|---|
| 396 |
|
|---|
| 397 | APIRET XWPENTRY doshQueryDiskFSType(ULONG ulLogicalDrive, PSZ pszBuf, ULONG cbBuf);
|
|---|
| 398 | typedef APIRET XWPENTRY DOSHQUERYDISKFSTYPE(ULONG ulLogicalDrive, PSZ pszBuf, ULONG cbBuf);
|
|---|
| 399 | typedef DOSHQUERYDISKFSTYPE *PDOSHQUERYDISKFSTYPE;
|
|---|
| 400 |
|
|---|
| 401 | APIRET doshQueryDiskLabel(ULONG ulLogicalDrive,
|
|---|
| 402 | PSZ pszVolumeLabel);
|
|---|
| 403 |
|
|---|
| 404 | APIRET doshSetDiskLabel(ULONG ulLogicalDrive,
|
|---|
| 405 | PSZ pszNewLabel);
|
|---|
| 406 |
|
|---|
| 407 | /* ******************************************************************
|
|---|
| 408 | *
|
|---|
| 409 | * Module handling helpers
|
|---|
| 410 | *
|
|---|
| 411 | ********************************************************************/
|
|---|
| 412 |
|
|---|
| 413 | APIRET doshQueryProcAddr(PCSZ pcszModuleName,
|
|---|
| 414 | ULONG ulOrdinal,
|
|---|
| 415 | PFN *ppfn);
|
|---|
| 416 |
|
|---|
| 417 | /*
|
|---|
| 418 | *@@ RESOLVEFUNCTION:
|
|---|
| 419 | * one of these structures each define
|
|---|
| 420 | * a single function import to doshResolveImports.
|
|---|
| 421 | *
|
|---|
| 422 | *@@added V0.9.3 (2000-04-25) [umoeller]
|
|---|
| 423 | */
|
|---|
| 424 |
|
|---|
| 425 | typedef struct _RESOLVEFUNCTION
|
|---|
| 426 | {
|
|---|
| 427 | const char *pcszFunctionName;
|
|---|
| 428 | PFN *ppFuncAddress;
|
|---|
| 429 | } RESOLVEFUNCTION, *PRESOLVEFUNCTION;
|
|---|
| 430 |
|
|---|
| 431 | typedef const struct _RESOLVEFUNCTION *PCRESOLVEFUNCTION;
|
|---|
| 432 |
|
|---|
| 433 | APIRET doshResolveImports(PCSZ pcszModuleName,
|
|---|
| 434 | HMODULE *phmod,
|
|---|
| 435 | PCRESOLVEFUNCTION paResolves,
|
|---|
| 436 | ULONG cResolves);
|
|---|
| 437 |
|
|---|
| 438 | /* ******************************************************************
|
|---|
| 439 | *
|
|---|
| 440 | * Performance Counters (CPU Load)
|
|---|
| 441 | *
|
|---|
| 442 | ********************************************************************/
|
|---|
| 443 |
|
|---|
| 444 | #define CMD_PERF_INFO 0x41
|
|---|
| 445 | #define CMD_KI_ENABLE 0x60
|
|---|
| 446 | #define CMD_KI_DISABLE 0x61
|
|---|
| 447 | #ifndef CMD_KI_RDCNT
|
|---|
| 448 | #define CMD_KI_RDCNT 0x63
|
|---|
| 449 | typedef APIRET APIENTRY FNDOSPERFSYSCALL(ULONG ulCommand,
|
|---|
| 450 | ULONG ulParm1,
|
|---|
| 451 | ULONG ulParm2,
|
|---|
| 452 | ULONG ulParm3);
|
|---|
| 453 | typedef FNDOSPERFSYSCALL *PFNDOSPERFSYSCALL;
|
|---|
| 454 | #endif
|
|---|
| 455 |
|
|---|
| 456 | typedef struct _CPUUTIL
|
|---|
| 457 | {
|
|---|
| 458 | ULONG ulTimeLow; // low 32 bits of time stamp
|
|---|
| 459 | ULONG ulTimeHigh; // high 32 bits of time stamp
|
|---|
| 460 | ULONG ulIdleLow; // low 32 bits of idle time
|
|---|
| 461 | ULONG ulIdleHigh; // high 32 bits of idle time
|
|---|
| 462 | ULONG ulBusyLow; // low 32 bits of busy time
|
|---|
| 463 | ULONG ulBusyHigh; // high 32 bits of busy time
|
|---|
| 464 | ULONG ulIntrLow; // low 32 bits of interrupt time
|
|---|
| 465 | ULONG ulIntrHigh; // high 32 bits of interrupt time
|
|---|
| 466 | } CPUUTIL, *PCPUUTIL;
|
|---|
| 467 |
|
|---|
| 468 | // macro to convert 8-byte (low, high) time value to double
|
|---|
| 469 | #define LL2F(high, low) (4294967296.0*(high)+(low))
|
|---|
| 470 |
|
|---|
| 471 | /*
|
|---|
| 472 | *@@ DOSHPERFSYS:
|
|---|
| 473 | * structure used with doshPerfOpen.
|
|---|
| 474 | *
|
|---|
| 475 | *@@added V0.9.7 (2000-12-02) [umoeller]
|
|---|
| 476 | *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt load
|
|---|
| 477 | */
|
|---|
| 478 |
|
|---|
| 479 | typedef struct _DOSHPERFSYS
|
|---|
| 480 | {
|
|---|
| 481 | // output: no. of processors on the system
|
|---|
| 482 | ULONG cProcessors;
|
|---|
| 483 | // output: one CPU load for each CPU
|
|---|
| 484 | PLONG palLoads;
|
|---|
| 485 |
|
|---|
| 486 | // output: one CPU interrupt load for each CPU
|
|---|
| 487 | PLONG palIntrs;
|
|---|
| 488 |
|
|---|
| 489 | // each of the following ptrs points to an array of cProcessors items
|
|---|
| 490 | PCPUUTIL paCPUUtils; // CPUUTIL structures
|
|---|
| 491 | double *padBusyPrev; // previous "busy" calculations
|
|---|
| 492 | double *padTimePrev; // previous "time" calculations
|
|---|
| 493 | double *padIntrPrev; // previous "intr" calculations
|
|---|
| 494 |
|
|---|
| 495 | // private stuff
|
|---|
| 496 | HMODULE hmod;
|
|---|
| 497 | BOOL fInitialized;
|
|---|
| 498 | PFNDOSPERFSYSCALL pDosPerfSysCall;
|
|---|
| 499 | } DOSHPERFSYS, *PDOSHPERFSYS;
|
|---|
| 500 |
|
|---|
| 501 | APIRET doshPerfOpen(PDOSHPERFSYS *ppPerfSys);
|
|---|
| 502 |
|
|---|
| 503 | APIRET doshPerfGet(PDOSHPERFSYS pPerfSys);
|
|---|
| 504 |
|
|---|
| 505 | APIRET doshPerfClose(PDOSHPERFSYS *ppPerfSys);
|
|---|
| 506 |
|
|---|
| 507 | /* ******************************************************************
|
|---|
| 508 | *
|
|---|
| 509 | * File name parsing
|
|---|
| 510 | *
|
|---|
| 511 | ********************************************************************/
|
|---|
| 512 |
|
|---|
| 513 | APIRET doshGetDriveSpec(PCSZ pcszFullFile,
|
|---|
| 514 | PSZ pszDrive,
|
|---|
| 515 | PULONG pulDriveLen,
|
|---|
| 516 | PBOOL pfIsUNC);
|
|---|
| 517 |
|
|---|
| 518 | PSZ doshGetExtension(PCSZ pcszFilename);
|
|---|
| 519 |
|
|---|
| 520 | /* ******************************************************************
|
|---|
| 521 | *
|
|---|
| 522 | * File helpers
|
|---|
| 523 | *
|
|---|
| 524 | ********************************************************************/
|
|---|
| 525 |
|
|---|
| 526 | BOOL doshIsFileOnFAT(const char* pcszFileName);
|
|---|
| 527 |
|
|---|
| 528 | APIRET doshIsValidFileName(const char* pcszFile,
|
|---|
| 529 | BOOL fFullyQualified);
|
|---|
| 530 |
|
|---|
| 531 | BOOL doshMakeRealName(PSZ pszTarget, PSZ pszSource, CHAR cReplace, BOOL fIsFAT);
|
|---|
| 532 |
|
|---|
| 533 | APIRET doshQueryFileSize(HFILE hFile,
|
|---|
| 534 | PULONG pulSize);
|
|---|
| 535 |
|
|---|
| 536 | APIRET doshQueryPathSize(PCSZ pcszFile,
|
|---|
| 537 | PULONG pulSize);
|
|---|
| 538 |
|
|---|
| 539 | APIRET doshQueryPathAttr(const char* pcszFile,
|
|---|
| 540 | PULONG pulAttr);
|
|---|
| 541 |
|
|---|
| 542 | APIRET doshSetPathAttr(const char* pcszFile,
|
|---|
| 543 | ULONG ulAttr);
|
|---|
| 544 |
|
|---|
| 545 | /* ******************************************************************
|
|---|
| 546 | *
|
|---|
| 547 | * XFILEs
|
|---|
| 548 | *
|
|---|
| 549 | ********************************************************************/
|
|---|
| 550 |
|
|---|
| 551 | /*
|
|---|
| 552 | *@@ XFILE:
|
|---|
| 553 | *
|
|---|
| 554 | *@@added V0.9.16 (2001-10-19) [umoeller]
|
|---|
| 555 | */
|
|---|
| 556 |
|
|---|
| 557 | typedef struct _XFILE
|
|---|
| 558 | {
|
|---|
| 559 | HFILE hf;
|
|---|
| 560 |
|
|---|
| 561 | PSZ pszFilename; // as given to doshOpen
|
|---|
| 562 | ULONG flOpenMode; // as given to doshOpen
|
|---|
| 563 |
|
|---|
| 564 | ULONG cbInitial, // intial file size on open (can be 0 if new)
|
|---|
| 565 | cbCurrent; // current file size (raised with each write)
|
|---|
| 566 |
|
|---|
| 567 | PBYTE pbCache; // if != NULL, cached data from doshReadAt
|
|---|
| 568 | ULONG cbCache, // size of data in cbCache
|
|---|
| 569 | ulReadFrom; // file offset where pbCache was read from
|
|---|
| 570 | } XFILE, *PXFILE;
|
|---|
| 571 |
|
|---|
| 572 | #define XOPEN_READ_EXISTING 0x0001
|
|---|
| 573 | #define XOPEN_READWRITE_EXISTING 0x0002
|
|---|
| 574 | #define XOPEN_READWRITE_APPEND 0x0003
|
|---|
| 575 | #define XOPEN_READWRITE_NEW 0x0004
|
|---|
| 576 | #define XOPEN_ACCESS_MASK 0xffff
|
|---|
| 577 |
|
|---|
| 578 | #define XOPEN_BINARY 0x10000000
|
|---|
| 579 |
|
|---|
| 580 | APIRET doshOpen(PCSZ pcszFilename,
|
|---|
| 581 | ULONG flOpenMode,
|
|---|
| 582 | PULONG pcbFile,
|
|---|
| 583 | PXFILE *ppFile);
|
|---|
| 584 |
|
|---|
| 585 | #define DRFL_NOCACHE 0x0001
|
|---|
| 586 | #define DRFL_FAILIFLESS 0x0002
|
|---|
| 587 |
|
|---|
| 588 | APIRET doshReadAt(PXFILE pFile,
|
|---|
| 589 | ULONG ulOffset,
|
|---|
| 590 | PULONG pcb,
|
|---|
| 591 | PBYTE pbData,
|
|---|
| 592 | ULONG fl);
|
|---|
| 593 |
|
|---|
| 594 | APIRET doshWrite(PXFILE pFile,
|
|---|
| 595 | ULONG cb,
|
|---|
| 596 | PCSZ pbData);
|
|---|
| 597 |
|
|---|
| 598 | APIRET doshWriteAt(PXFILE pFile,
|
|---|
| 599 | ULONG ulOffset,
|
|---|
| 600 | ULONG cb,
|
|---|
| 601 | PCSZ pbData);
|
|---|
| 602 |
|
|---|
| 603 | APIRET doshWriteLogEntry(PXFILE pFile,
|
|---|
| 604 | const char* pcszFormat,
|
|---|
| 605 | ...);
|
|---|
| 606 |
|
|---|
| 607 | APIRET doshClose(PXFILE *ppFile);
|
|---|
| 608 |
|
|---|
| 609 | APIRET doshLoadTextFile(PCSZ pcszFile,
|
|---|
| 610 | PSZ* ppszContent,
|
|---|
| 611 | PULONG pcbRead);
|
|---|
| 612 |
|
|---|
| 613 | PSZ doshCreateBackupFileName(const char* pszExisting);
|
|---|
| 614 |
|
|---|
| 615 | APIRET doshCreateTempFileName(PSZ pszTempFileName,
|
|---|
| 616 | PCSZ pcszDir,
|
|---|
| 617 | PCSZ pcszPrefix,
|
|---|
| 618 | PCSZ pcszExt);
|
|---|
| 619 |
|
|---|
| 620 | APIRET doshWriteTextFile(const char* pszFile,
|
|---|
| 621 | const char* pszContent,
|
|---|
| 622 | PULONG pulWritten,
|
|---|
| 623 | PSZ pszBackup);
|
|---|
| 624 |
|
|---|
| 625 |
|
|---|
| 626 | /* ******************************************************************
|
|---|
| 627 | *
|
|---|
| 628 | * Directory helpers
|
|---|
| 629 | *
|
|---|
| 630 | ********************************************************************/
|
|---|
| 631 |
|
|---|
| 632 | BOOL doshQueryDirExist(PCSZ pcszDir);
|
|---|
| 633 |
|
|---|
| 634 | APIRET doshCreatePath(PCSZ pcszPath,
|
|---|
| 635 | BOOL fHidden);
|
|---|
| 636 |
|
|---|
| 637 | APIRET doshQueryCurrentDir(PSZ pszBuf);
|
|---|
| 638 |
|
|---|
| 639 | APIRET doshSetCurrentDir(PCSZ pcszDir);
|
|---|
| 640 |
|
|---|
| 641 | #define DOSHDELDIR_RECURSE 0x0001
|
|---|
| 642 | #define DOSHDELDIR_DELETEFILES 0x0002
|
|---|
| 643 |
|
|---|
| 644 | APIRET doshDeleteDir(PCSZ pcszDir,
|
|---|
| 645 | ULONG flFlags,
|
|---|
| 646 | PULONG pulDirs,
|
|---|
| 647 | PULONG pulFiles);
|
|---|
| 648 |
|
|---|
| 649 | APIRET doshCanonicalize(PCSZ pcszFileIn,
|
|---|
| 650 | PSZ pszFileOut,
|
|---|
| 651 | ULONG cbFileOut);
|
|---|
| 652 |
|
|---|
| 653 | /* ******************************************************************
|
|---|
| 654 | *
|
|---|
| 655 | * Process helpers
|
|---|
| 656 | *
|
|---|
| 657 | ********************************************************************/
|
|---|
| 658 |
|
|---|
| 659 | ULONG XWPENTRY doshMyPID(VOID);
|
|---|
| 660 | typedef ULONG XWPENTRY DOSHMYPID(VOID);
|
|---|
| 661 | typedef DOSHMYPID *PDOSHMYPID;
|
|---|
| 662 |
|
|---|
| 663 | ULONG XWPENTRY doshMyTID(VOID);
|
|---|
| 664 | typedef ULONG XWPENTRY DOSHMYTID(VOID);
|
|---|
| 665 | typedef DOSHMYTID *PDOSHMYTID;
|
|---|
| 666 |
|
|---|
| 667 | APIRET doshExecVIO(PCSZ pcszExecWithArgs,
|
|---|
| 668 | PLONG plExitCode);
|
|---|
| 669 |
|
|---|
| 670 | APIRET doshQuickStartSession(PCSZ pcszPath,
|
|---|
| 671 | PCSZ pcszParams,
|
|---|
| 672 | BOOL fForeground,
|
|---|
| 673 | USHORT usPgmCtl,
|
|---|
| 674 | BOOL fWait,
|
|---|
| 675 | PULONG pulSID,
|
|---|
| 676 | PPID ppid,
|
|---|
| 677 | PUSHORT pusReturn);
|
|---|
| 678 |
|
|---|
| 679 | APIRET doshSearchPath(PCSZ pcszPath,
|
|---|
| 680 | PCSZ pcszFile,
|
|---|
| 681 | PSZ pszExecutable,
|
|---|
| 682 | ULONG cbExecutable);
|
|---|
| 683 |
|
|---|
| 684 | APIRET doshFindExecutable(PCSZ pcszCommand,
|
|---|
| 685 | PSZ pszExecutable,
|
|---|
| 686 | ULONG cbExecutable,
|
|---|
| 687 | PCSZ *papcszExtensions,
|
|---|
| 688 | ULONG cExtensions);
|
|---|
| 689 |
|
|---|
| 690 | /********************************************************************
|
|---|
| 691 | *
|
|---|
| 692 | * Partition functions
|
|---|
| 693 | *
|
|---|
| 694 | ********************************************************************/
|
|---|
| 695 |
|
|---|
| 696 | /*
|
|---|
| 697 | *@@ LVMINFO:
|
|---|
| 698 | * informational structure created by
|
|---|
| 699 | * doshQueryLVMInfo.
|
|---|
| 700 | *
|
|---|
| 701 | *@@added V0.9.9 (2001-04-07) [umoeller]
|
|---|
| 702 | */
|
|---|
| 703 |
|
|---|
| 704 | typedef struct _LVMINFO
|
|---|
| 705 | {
|
|---|
| 706 | HMODULE hmodLVM;
|
|---|
| 707 |
|
|---|
| 708 | } LVMINFO, *PLVMINFO;
|
|---|
| 709 |
|
|---|
| 710 | /* #define DOSH_PARTITIONS_LIMIT 10
|
|---|
| 711 |
|
|---|
| 712 | #define PAR_UNUSED 0x00 // Unused
|
|---|
| 713 | #define PAR_FAT12SMALL 0x01 // DOS FAT 12-bit < 10 Mb
|
|---|
| 714 | #define PAR_XENIXROOT 0x02 // XENIX root
|
|---|
| 715 | #define PAR_XENIXUSER 0x03 // XENIX user
|
|---|
| 716 | #define PAR_FAT16SMALL 0x04 // DOS FAT 16-bit < 32 Mb
|
|---|
| 717 | #define PAR_EXTENDED 0x05 // Extended partition
|
|---|
| 718 | #define PAR_FAT16BIG 0x06 // DOS FAT 16-bit > 32 Mb
|
|---|
| 719 | #define PAR_HPFS 0x07 // OS/2 HPFS
|
|---|
| 720 | #define PAR_AIXBOOT 0x08 // AIX bootable partition
|
|---|
| 721 | #define PAR_AIXDATA 0x09 // AIX bootable partition
|
|---|
| 722 | #define PAR_BOOTMANAGER 0x0A // OS/2 Boot Manager
|
|---|
| 723 | #define PAR_WINDOWS95 0x0B // Windows 95 32-bit FAT
|
|---|
| 724 | #define PAR_WINDOWS95LB 0x0C // Windows 95 32-bit FAT with LBA
|
|---|
| 725 | #define PAR_VFAT16BIG 0x0E // LBA VFAT (same as 06h but using LBA-mode)
|
|---|
| 726 | #define PAR_VFAT16EXT 0x0F // LBA VFAT (same as 05h but using LBA-mode)
|
|---|
| 727 | #define PAR_OPUS 0x10 // OPUS
|
|---|
| 728 | #define PAR_HID12SMALL 0x11 // OS/2 hidden DOS FAT 12-bit
|
|---|
| 729 | #define PAR_COMPAQDIAG 0x12 // Compaq diagnostic
|
|---|
| 730 | #define PAR_HID16SMALL 0x14 // OS/2 hidden DOS FAT 16-bit
|
|---|
| 731 | #define PAR_HID16BIG 0x16 // OS/2 hidden DOS FAT 16-bit
|
|---|
| 732 | #define PAR_HIDHPFS 0x17 // OS/2 hidden HPFS
|
|---|
| 733 | #define PAR_WINDOWSSWP 0x18 // AST Windows Swap File
|
|---|
| 734 | #define PAR_NECDOS 0x24 // NEC MS-DOS 3.x
|
|---|
| 735 | #define PAR_THEOS 0x38 // THEOS
|
|---|
| 736 | #define PAR_VENIX 0x40 // VENIX
|
|---|
| 737 | #define PAR_RISCBOOT 0x41 // Personal RISC boot
|
|---|
| 738 | #define PAR_SFS 0x42 // SFS
|
|---|
| 739 | #define PAR_ONTRACK 0x50 // Ontrack
|
|---|
| 740 | #define PAR_ONTRACKEXT 0x51 // Ontrack extended partition
|
|---|
| 741 | #define PAR_CPM 0x52 // CP/M
|
|---|
| 742 | #define PAR_UNIXSYSV 0x63 // UNIX SysV/386
|
|---|
| 743 | #define PAR_NOVELL_64 0x64 // Novell
|
|---|
| 744 | #define PAR_NOVELL_65 0x65 // Novell
|
|---|
| 745 | #define PAR_NOVELL_67 0x67 // Novell
|
|---|
| 746 | #define PAR_NOVELL_68 0x68 // Novell
|
|---|
| 747 | #define PAR_NOVELL_69 0x69 // Novell
|
|---|
| 748 | #define PAR_PCIX 0x75 // PCIX
|
|---|
| 749 | #define PAR_MINIX 0x80 // MINIX
|
|---|
| 750 | #define PAR_LINUX 0x81 // Linux
|
|---|
| 751 | #define PAR_LINUXSWAP 0x82 // Linux Swap Partition
|
|---|
| 752 | #define PAR_LINUXFILE 0x83 // Linux File System
|
|---|
| 753 | #define PAR_FREEBSD 0xA5 // FreeBSD
|
|---|
| 754 | #define PAR_BBT 0xFF // BBT
|
|---|
| 755 | */
|
|---|
| 756 |
|
|---|
| 757 | // one-byte alignment
|
|---|
| 758 | #pragma pack(1)
|
|---|
| 759 |
|
|---|
| 760 | /*
|
|---|
| 761 | *@@ PAR_INFO:
|
|---|
| 762 | * partition table
|
|---|
| 763 | */
|
|---|
| 764 |
|
|---|
| 765 | typedef struct _PAR_INFO
|
|---|
| 766 | {
|
|---|
| 767 | BYTE bBootFlag; // 0=not active, 80H = active (boot this partition
|
|---|
| 768 | BYTE bBeginHead; // partition begins at this head...
|
|---|
| 769 | USHORT rBeginSecCyl; // ...and this sector and cylinder (see below)
|
|---|
| 770 | BYTE bFileSysCode; // file system type
|
|---|
| 771 | BYTE bEndHead; // partition ends at this head...
|
|---|
| 772 | USHORT bEndSecCyl; // ...and this sector and cylinder (see below)
|
|---|
| 773 | ULONG lBeginAbsSec; // partition begins at this absolute sector #
|
|---|
| 774 | ULONG lTotalSects; // total sectors in this partition
|
|---|
| 775 | } PAR_INFO, *PPAR_INFO;
|
|---|
| 776 |
|
|---|
| 777 | /*
|
|---|
| 778 | *@@ MBR_INFO:
|
|---|
| 779 | * master boot record table.
|
|---|
| 780 | * This has the four primary partitions.
|
|---|
| 781 | */
|
|---|
| 782 |
|
|---|
| 783 | typedef struct _MBR_INFO // MBR
|
|---|
| 784 | {
|
|---|
| 785 | BYTE aBootCode[0x1BE]; // abBootCode master boot executable code
|
|---|
| 786 | PAR_INFO sPrtnInfo[4]; // primary partition entries
|
|---|
| 787 | USHORT wPrtnTblSig; // partition table signature (aa55H)
|
|---|
| 788 | } MBR_INFO, *PMBR_INFO;
|
|---|
| 789 |
|
|---|
| 790 | /*
|
|---|
| 791 | *@@ SYS_INFO:
|
|---|
| 792 | *
|
|---|
| 793 | */
|
|---|
| 794 |
|
|---|
| 795 | typedef struct _SYS_INFO
|
|---|
| 796 | {
|
|---|
| 797 | BYTE startable;
|
|---|
| 798 | BYTE unknown[3];
|
|---|
| 799 | BYTE bootable;
|
|---|
| 800 | BYTE name[8];
|
|---|
| 801 | BYTE reservd[3];
|
|---|
| 802 | } SYS_INFO, *PSYS_INFO;
|
|---|
| 803 |
|
|---|
| 804 | /*
|
|---|
| 805 | *@@ SYE_INFO:
|
|---|
| 806 | *
|
|---|
| 807 | */
|
|---|
| 808 |
|
|---|
| 809 | typedef struct _SYE_INFO
|
|---|
| 810 | {
|
|---|
| 811 | BYTE bootable;
|
|---|
| 812 | BYTE name[8];
|
|---|
| 813 | } SYE_INFO, *PSYE_INFO;
|
|---|
| 814 |
|
|---|
| 815 | /*
|
|---|
| 816 | *@@ EXT_INFO:
|
|---|
| 817 | *
|
|---|
| 818 | */
|
|---|
| 819 |
|
|---|
| 820 | typedef struct _EXT_INFO
|
|---|
| 821 | {
|
|---|
| 822 | BYTE aBootCode[0x18A]; // abBootCode master boot executable code
|
|---|
| 823 | SYE_INFO sBmNames[4]; // System Names
|
|---|
| 824 | BYTE bReserved[16]; // reserved
|
|---|
| 825 | PAR_INFO sPrtnInfo[4]; // partitioms entrys
|
|---|
| 826 | USHORT wPrtnTblSig; // partition table signature (aa55H)
|
|---|
| 827 | } EXT_INFO, *PEXT_INFO;
|
|---|
| 828 |
|
|---|
| 829 | typedef struct _PARTITIONINFO *PPARTITIONINFO;
|
|---|
| 830 |
|
|---|
| 831 | /*
|
|---|
| 832 | *@@ PARTITIONINFO:
|
|---|
| 833 | * informational structure returned
|
|---|
| 834 | * by doshGetPartitionsList. One of
|
|---|
| 835 | * these items is created for each
|
|---|
| 836 | * bootable partition.
|
|---|
| 837 | */
|
|---|
| 838 |
|
|---|
| 839 | typedef struct _PARTITIONINFO
|
|---|
| 840 | {
|
|---|
| 841 | BYTE bDisk; // drive number
|
|---|
| 842 | CHAR cLetter; // probable drive letter or ' ' if none
|
|---|
| 843 | BYTE bFSType; // file system type
|
|---|
| 844 | PCSZ pcszFSType; // file system name (as returned by
|
|---|
| 845 | // doshType2FSName, can be NULL!)
|
|---|
| 846 | BOOL fPrimary; // primary partition?
|
|---|
| 847 | BOOL fBootable; // bootable by Boot Manager?
|
|---|
| 848 | CHAR szBootName[9]; // Boot Manager name, if (fBootable)
|
|---|
| 849 | ULONG ulSize; // size MBytes
|
|---|
| 850 | PPARTITIONINFO pNext; // next info or NULL if last
|
|---|
| 851 | } PARTITIONINFO;
|
|---|
| 852 |
|
|---|
| 853 | UINT doshQueryDiskCount(VOID);
|
|---|
| 854 |
|
|---|
| 855 | APIRET doshReadSector(USHORT disk,
|
|---|
| 856 | void *buff,
|
|---|
| 857 | USHORT head,
|
|---|
| 858 | USHORT cylinder,
|
|---|
| 859 | USHORT sector);
|
|---|
| 860 |
|
|---|
| 861 | // restore original alignment
|
|---|
| 862 | #pragma pack()
|
|---|
| 863 |
|
|---|
| 864 | const char* doshType2FSName(unsigned char bFSType);
|
|---|
| 865 |
|
|---|
| 866 | APIRET doshGetBootManager(USHORT *pusDisk,
|
|---|
| 867 | USHORT *pusPart,
|
|---|
| 868 | PAR_INFO *BmInfo);
|
|---|
| 869 |
|
|---|
| 870 | typedef struct _PARTITIONSLIST
|
|---|
| 871 | {
|
|---|
| 872 | PLVMINFO pLVMInfo; // != NULL if LVM is installed
|
|---|
| 873 |
|
|---|
| 874 | // partitions array
|
|---|
| 875 | PPARTITIONINFO pPartitionInfo;
|
|---|
| 876 | USHORT cPartitions;
|
|---|
| 877 | } PARTITIONSLIST, *PPARTITIONSLIST;
|
|---|
| 878 |
|
|---|
| 879 | APIRET doshGetPartitionsList(PPARTITIONSLIST *ppList,
|
|---|
| 880 | PUSHORT pusContext);
|
|---|
| 881 |
|
|---|
| 882 | APIRET doshFreePartitionsList(PPARTITIONSLIST ppList);
|
|---|
| 883 |
|
|---|
| 884 | APIRET doshQueryLVMInfo(PLVMINFO *ppLVMInfo);
|
|---|
| 885 |
|
|---|
| 886 | APIRET doshReadLVMPartitions(PLVMINFO pInfo,
|
|---|
| 887 | PPARTITIONINFO *ppPartitionInfo,
|
|---|
| 888 | PUSHORT pcPartitions);
|
|---|
| 889 |
|
|---|
| 890 | VOID doshFreeLVMInfo(PLVMINFO pInfo);
|
|---|
| 891 |
|
|---|
| 892 | /* ******************************************************************
|
|---|
| 893 | *
|
|---|
| 894 | * Wildcard matching
|
|---|
| 895 | *
|
|---|
| 896 | ********************************************************************/
|
|---|
| 897 |
|
|---|
| 898 | BOOL doshMatchCase(PCSZ pcszMask,
|
|---|
| 899 | PCSZ pcszName);
|
|---|
| 900 |
|
|---|
| 901 | BOOL doshMatch(PCSZ pcszMask,
|
|---|
| 902 | PCSZ pcszName);
|
|---|
| 903 |
|
|---|
| 904 | #endif
|
|---|
| 905 |
|
|---|
| 906 | #if __cplusplus
|
|---|
| 907 | }
|
|---|
| 908 | #endif
|
|---|
| 909 |
|
|---|