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