4 * header file for dosh.c. See remarks there.
6 * Note: Version numbering in this file relates to XWorkplace version
9 *@@include #define INCL_DOSPROCESS
10 *@@include #define INCL_DOSDEVIOCTL // for doshQueryDiskParams only
11 *@@include #include <os2.h>
12 *@@include #include "helpers\dosh.h"
15 /* This file Copyright (C) 1997-2001 Ulrich M”ller,
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.
32 #ifndef DOSH_HEADER_INCLUDED
33 #define DOSH_HEADER_INCLUDED
35 /* ******************************************************************
39 ********************************************************************/
41 // if DOSH_STANDARDWRAPPERS is #define'd before including dosh.h,
42 // all the following Dos* API calls are redirected to the dosh*
45 #ifdef DOSH_STANDARDWRAPPERS
47 #ifdef INCL_DOSPROCESS
49 APIRET XWPENTRY
doshSleep(ULONG msec
);
50 #define DosSleep(a) doshSleep((a))
54 #ifdef INCL_DOSSEMAPHORES
56 APIRET XWPENTRY
doshCreateMutexSem(PSZ pszName
,
60 #define DosCreateMutexSem(a, b, c, d) doshCreateMutexSem((a), (b), (c), (d))
62 APIRET XWPENTRY
doshRequestMutexSem(HMTX hmtx
, ULONG ulTimeout
);
63 #define DosRequestMutexSem(h, t) doshRequestMutexSem((h), (t))
65 APIRET XWPENTRY
doshReleaseMutexSem(HMTX hmtx
);
66 #define DosReleaseMutexSem(h) doshReleaseMutexSem((h))
70 #ifdef INCL_DOSEXCEPTIONS
72 APIRET XWPENTRY
doshSetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec
);
73 #define DosSetExceptionHandler(a) doshSetExceptionHandler((a))
75 APIRET XWPENTRY
doshUnsetExceptionHandler(PEXCEPTIONREGISTRATIONRECORD pERegRec
);
76 #define DosUnsetExceptionHandler(a) doshUnsetExceptionHandler((a))
82 /* ******************************************************************
86 ********************************************************************/
88 CHAR
doshGetChar(VOID
);
90 BOOL
doshQueryShiftState(VOID
);
92 ULONG
doshIsWarp4(VOID
);
94 PSZ
doshQuerySysErrorMsg(APIRET arc
);
96 ULONG
doshQuerySysUptime(VOID
);
98 /* ******************************************************************
102 ********************************************************************/
104 PVOID
doshMalloc(ULONG cb
,
107 APIRET
doshAllocArray(ULONG c
,
110 PULONG pcbAllocated
);
112 PVOID
doshAllocSharedMem(ULONG ulSize
,
113 const char* pcszName
);
115 PVOID
doshRequestSharedMem(PCSZ pcszName
);
117 /* ******************************************************************
121 ********************************************************************/
123 APIRET
doshIsFixedDisk(ULONG ulLogicalDrive
,
126 #ifdef INCL_DOSDEVIOCTL
132 * structure used for doshQueryDiskParams.
133 * removed this, we can directly use BIOSPARAMETERBLOCK
134 * V0.9.13 (2001-06-14) [umoeller]
137 /* typedef struct _DRIVEPARAMS
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:
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.
153 6 USHORT cRootEntries;
154 // Number of root directory entries.
156 // Number of sectors.
159 11 USHORT usSectorsPerFAT;
160 // Number of secctors per FAT.
161 13 USHORT usSectorsPerTrack;
162 // Number of sectors per track.
165 17 ULONG cHiddenSectors;
166 // Number of hidden sectors.
167 21 ULONG cLargeSectors;
168 // Number of large sectors.
169 25 BYTE abReserved[6];
171 31 USHORT cCylinders;
172 // Number of cylinders defined for the physical
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;
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.
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
199 // -- 7: Other (includes 1.44MB 3.5-inch diskette drive
201 // -- 8: R/W optical disk
202 // -- 9: 3.5-inch 4.0MB diskette drive (2.88MB formatted)
203 USHORT usDeviceAttrs;
205 } DRIVEPARAMS, *PDRIVEPARAMS;
208 APIRET
doshQueryDiskParams(ULONG ulLogicalDrive
,
209 PBIOSPARAMETERBLOCK pdp
);
211 BYTE
doshQueryDriveType(ULONG ulLogicalDrive
,
212 PBIOSPARAMETERBLOCK pdp
,
215 APIRET XWPENTRY
doshHasAudioCD(ULONG ulLogicalDrive
,
222 VOID XWPENTRY
doshEnumDrives(PSZ pszBuffer
,
224 BOOL fSkipRemoveables
);
225 typedef VOID XWPENTRY
DOSHENUMDRIVES(PSZ pszBuffer
,
227 BOOL fSkipRemoveables
);
228 typedef DOSHENUMDRIVES
*PDOSHENUMDRIVES
;
230 CHAR
doshQueryBootDrive(VOID
);
232 #define ERROR_AUDIO_CD_ROM 10000
234 #define DRVFL_MIXEDMODECD 0x0001
235 #define DRVFL_TOUCHFLOPPIES 0x0002
236 #define DRVFL_CHECKEAS 0x0004
237 #define DRVFL_CHECKLONGNAMES 0x0008
239 APIRET
doshAssertDrive(ULONG ulLogicalDrive
,
242 #ifdef INCL_DOSDEVIOCTL
247 *@@added V0.9.16 (2002-01-13) [umoeller]
250 typedef struct _XDISKINFO
252 CHAR cDriveLetter
; // drive letter
253 CHAR cLogicalDrive
; // logical drive no.
255 BOOL fPresent
; // if FALSE, drive does not exist
257 // the following are only valid if fPresent == TRUE
259 BIOSPARAMETERBLOCK bpb
;
260 // 0x00 USHORT usBytesPerSector;
261 // 0x02 BYTE bSectorsPerCluster;
262 // 0x03 USHORT usReservedSectors;
264 // 0x06 USHORT cRootEntries;
265 // 0x08 USHORT cSectors;
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
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
297 #define DEVATTR_PARTITIONALREMOVEABLE 0x0008
298 // undocumented flag; set for ZIP drives
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
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
327 #define DFL_MEDIA_PRESENT 0x1000
328 // media is present in drive;
329 // -- always set for harddisks,
330 // unless the file system is not
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
350 // the following are only valid if DFL_MEDIA_PRESENT is set;
351 // they are always set for drives A: and B:
353 CHAR szFileSystem
[30];
354 // e.g. "FAT" or "HPFS" or "JFS" or "CDFS"
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
362 #define FSYS_HPFS_JFS 2
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
373 // error codes for various operations
374 APIRET arcIsFixedDisk
,
379 } XDISKINFO
, *PXDISKINFO
;
381 APIRET
doshGetDriveInfo(ULONG ulLogicalDrive
,
387 APIRET
doshSetLogicalMap(ULONG ulLogicalDrive
);
389 APIRET XWPENTRY
doshQueryDiskSize(ULONG ulLogicalDrive
, double *pdSize
);
390 typedef APIRET XWPENTRY
DOSHQUERYDISKSIZE(ULONG ulLogicalDrive
, double *pdSize
);
391 typedef DOSHQUERYDISKSIZE
*PDOSHQUERYDISKSIZE
;
393 APIRET XWPENTRY
doshQueryDiskFree(ULONG ulLogicalDrive
, double *pdFree
);
394 typedef APIRET XWPENTRY
DOSHQUERYDISKFREE(ULONG ulLogicalDrive
, double *pdFree
);
395 typedef DOSHQUERYDISKFREE
*PDOSHQUERYDISKFREE
;
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
;
401 APIRET
doshQueryDiskLabel(ULONG ulLogicalDrive
,
404 APIRET
doshSetDiskLabel(ULONG ulLogicalDrive
,
407 /* ******************************************************************
409 * Module handling helpers
411 ********************************************************************/
413 APIRET
doshQueryProcAddr(PCSZ pcszModuleName
,
419 * one of these structures each define
420 * a single function import to doshResolveImports.
422 *@@added V0.9.3 (2000-04-25) [umoeller]
425 typedef struct _RESOLVEFUNCTION
427 const char *pcszFunctionName
;
429 } RESOLVEFUNCTION
, *PRESOLVEFUNCTION
;
431 typedef const struct _RESOLVEFUNCTION
*PCRESOLVEFUNCTION
;
433 APIRET
doshResolveImports(PCSZ pcszModuleName
,
435 PCRESOLVEFUNCTION paResolves
,
438 /* ******************************************************************
440 * Performance Counters (CPU Load)
442 ********************************************************************/
444 #define CMD_PERF_INFO 0x41
445 #define CMD_KI_ENABLE 0x60
446 #define CMD_KI_DISABLE 0x61
448 #define CMD_KI_RDCNT 0x63
449 typedef APIRET APIENTRY
FNDOSPERFSYSCALL(ULONG ulCommand
,
453 typedef FNDOSPERFSYSCALL
*PFNDOSPERFSYSCALL
;
456 typedef struct _CPUUTIL
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
;
468 // macro to convert 8-byte (low, high) time value to double
469 #define LL2F(high, low) (4294967296.0*(high)+(low))
473 * structure used with doshPerfOpen.
475 *@@added V0.9.7 (2000-12-02) [umoeller]
476 *@@changed V0.9.9 (2001-03-14) [umoeller]: added interrupt load
479 typedef struct _DOSHPERFSYS
481 // output: no. of processors on the system
483 // output: one CPU load for each CPU
486 // output: one CPU interrupt load for each CPU
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
498 PFNDOSPERFSYSCALL pDosPerfSysCall
;
499 } DOSHPERFSYS
, *PDOSHPERFSYS
;
501 APIRET
doshPerfOpen(PDOSHPERFSYS
*ppPerfSys
);
503 APIRET
doshPerfGet(PDOSHPERFSYS pPerfSys
);
505 APIRET
doshPerfClose(PDOSHPERFSYS
*ppPerfSys
);
507 /* ******************************************************************
511 ********************************************************************/
513 APIRET
doshGetDriveSpec(PCSZ pcszFullFile
,
518 PSZ
doshGetExtension(PCSZ pcszFilename
);
520 /* ******************************************************************
524 ********************************************************************/
526 BOOL
doshIsFileOnFAT(const char* pcszFileName
);
528 APIRET
doshIsValidFileName(const char* pcszFile
,
529 BOOL fFullyQualified
);
531 BOOL
doshMakeRealName(PSZ pszTarget
, PSZ pszSource
, CHAR cReplace
, BOOL fIsFAT
);
533 APIRET
doshQueryFileSize(HFILE hFile
,
536 APIRET
doshQueryPathSize(PCSZ pcszFile
,
539 APIRET
doshQueryPathAttr(const char* pcszFile
,
542 APIRET
doshSetPathAttr(const char* pcszFile
,
545 /* ******************************************************************
549 ********************************************************************/
554 *@@added V0.9.16 (2001-10-19) [umoeller]
557 typedef struct _XFILE
561 PSZ pszFilename
; // as given to doshOpen
562 ULONG flOpenMode
; // as given to doshOpen
564 ULONG cbInitial
, // intial file size on open (can be 0 if new)
565 cbCurrent
; // current file size (raised with each write)
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
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
578 #define XOPEN_BINARY 0x10000000
580 APIRET
doshOpen(PCSZ pcszFilename
,
585 #define DRFL_NOCACHE 0x0001
586 #define DRFL_FAILIFLESS 0x0002
588 APIRET
doshReadAt(PXFILE pFile
,
594 APIRET
doshWrite(PXFILE pFile
,
598 APIRET
doshWriteAt(PXFILE pFile
,
603 APIRET
doshWriteLogEntry(PXFILE pFile
,
604 const char* pcszFormat
,
607 APIRET
doshClose(PXFILE
*ppFile
);
609 APIRET
doshReadText(PXFILE pFile
,
613 APIRET
doshLoadTextFile(PCSZ pcszFile
,
617 PSZ
doshCreateBackupFileName(const char* pszExisting
);
619 APIRET
doshCreateTempFileName(PSZ pszTempFileName
,
624 APIRET
doshWriteTextFile(const char* pszFile
,
625 const char* pszContent
,
630 /* ******************************************************************
634 ********************************************************************/
636 BOOL
doshQueryDirExist(PCSZ pcszDir
);
638 APIRET
doshCreatePath(PCSZ pcszPath
,
641 APIRET
doshQueryCurrentDir(PSZ pszBuf
);
643 APIRET
doshSetCurrentDir(PCSZ pcszDir
);
645 #define DOSHDELDIR_RECURSE 0x0001
646 #define DOSHDELDIR_DELETEFILES 0x0002
648 APIRET
doshDeleteDir(PCSZ pcszDir
,
653 APIRET
doshCanonicalize(PCSZ pcszFileIn
,
657 /* ******************************************************************
661 ********************************************************************/
663 ULONG XWPENTRY
doshMyPID(VOID
);
664 typedef ULONG XWPENTRY
DOSHMYPID(VOID
);
665 typedef DOSHMYPID
*PDOSHMYPID
;
667 ULONG XWPENTRY
doshMyTID(VOID
);
668 typedef ULONG XWPENTRY
DOSHMYTID(VOID
);
669 typedef DOSHMYTID
*PDOSHMYTID
;
671 APIRET
doshExecVIO(PCSZ pcszExecWithArgs
,
674 APIRET
doshQuickStartSession(PCSZ pcszPath
,
683 APIRET
doshSearchPath(PCSZ pcszPath
,
688 APIRET
doshFindExecutable(PCSZ pcszCommand
,
691 PCSZ
*papcszExtensions
,
694 /********************************************************************
696 * Partition functions
698 ********************************************************************/
702 * informational structure created by
705 *@@added V0.9.9 (2001-04-07) [umoeller]
708 typedef struct _LVMINFO
712 } LVMINFO
, *PLVMINFO
;
714 /* #define DOSH_PARTITIONS_LIMIT 10
716 #define PAR_UNUSED 0x00 // Unused
717 #define PAR_FAT12SMALL 0x01 // DOS FAT 12-bit < 10 Mb
718 #define PAR_XENIXROOT 0x02 // XENIX root
719 #define PAR_XENIXUSER 0x03 // XENIX user
720 #define PAR_FAT16SMALL 0x04 // DOS FAT 16-bit < 32 Mb
721 #define PAR_EXTENDED 0x05 // Extended partition
722 #define PAR_FAT16BIG 0x06 // DOS FAT 16-bit > 32 Mb
723 #define PAR_HPFS 0x07 // OS/2 HPFS
724 #define PAR_AIXBOOT 0x08 // AIX bootable partition
725 #define PAR_AIXDATA 0x09 // AIX bootable partition
726 #define PAR_BOOTMANAGER 0x0A // OS/2 Boot Manager
727 #define PAR_WINDOWS95 0x0B // Windows 95 32-bit FAT
728 #define PAR_WINDOWS95LB 0x0C // Windows 95 32-bit FAT with LBA
729 #define PAR_VFAT16BIG 0x0E // LBA VFAT (same as 06h but using LBA-mode)
730 #define PAR_VFAT16EXT 0x0F // LBA VFAT (same as 05h but using LBA-mode)
731 #define PAR_OPUS 0x10 // OPUS
732 #define PAR_HID12SMALL 0x11 // OS/2 hidden DOS FAT 12-bit
733 #define PAR_COMPAQDIAG 0x12 // Compaq diagnostic
734 #define PAR_HID16SMALL 0x14 // OS/2 hidden DOS FAT 16-bit
735 #define PAR_HID16BIG 0x16 // OS/2 hidden DOS FAT 16-bit
736 #define PAR_HIDHPFS 0x17 // OS/2 hidden HPFS
737 #define PAR_WINDOWSSWP 0x18 // AST Windows Swap File
738 #define PAR_NECDOS 0x24 // NEC MS-DOS 3.x
739 #define PAR_THEOS 0x38 // THEOS
740 #define PAR_VENIX 0x40 // VENIX
741 #define PAR_RISCBOOT 0x41 // Personal RISC boot
742 #define PAR_SFS 0x42 // SFS
743 #define PAR_ONTRACK 0x50 // Ontrack
744 #define PAR_ONTRACKEXT 0x51 // Ontrack extended partition
745 #define PAR_CPM 0x52 // CP/M
746 #define PAR_UNIXSYSV 0x63 // UNIX SysV/386
747 #define PAR_NOVELL_64 0x64 // Novell
748 #define PAR_NOVELL_65 0x65 // Novell
749 #define PAR_NOVELL_67 0x67 // Novell
750 #define PAR_NOVELL_68 0x68 // Novell
751 #define PAR_NOVELL_69 0x69 // Novell
752 #define PAR_PCIX 0x75 // PCIX
753 #define PAR_MINIX 0x80 // MINIX
754 #define PAR_LINUX 0x81 // Linux
755 #define PAR_LINUXSWAP 0x82 // Linux Swap Partition
756 #define PAR_LINUXFILE 0x83 // Linux File System
757 #define PAR_FREEBSD 0xA5 // FreeBSD
758 #define PAR_BBT 0xFF // BBT
761 // one-byte alignment
769 typedef struct _PAR_INFO
771 BYTE bBootFlag
; // 0=not active, 80H = active (boot this partition
772 BYTE bBeginHead
; // partition begins at this head...
773 USHORT rBeginSecCyl
; // ...and this sector and cylinder (see below)
774 BYTE bFileSysCode
; // file system type
775 BYTE bEndHead
; // partition ends at this head...
776 USHORT bEndSecCyl
; // ...and this sector and cylinder (see below)
777 ULONG lBeginAbsSec
; // partition begins at this absolute sector #
778 ULONG lTotalSects
; // total sectors in this partition
779 } PAR_INFO
, *PPAR_INFO
;
783 * master boot record table.
784 * This has the four primary partitions.
787 typedef struct _MBR_INFO
// MBR
789 BYTE aBootCode
[0x1BE]; // abBootCode master boot executable code
790 PAR_INFO sPrtnInfo
[4]; // primary partition entries
791 USHORT wPrtnTblSig
; // partition table signature (aa55H)
792 } MBR_INFO
, *PMBR_INFO
;
799 typedef struct _SYS_INFO
806 } SYS_INFO
, *PSYS_INFO
;
813 typedef struct _SYE_INFO
817 } SYE_INFO
, *PSYE_INFO
;
824 typedef struct _EXT_INFO
826 BYTE aBootCode
[0x18A]; // abBootCode master boot executable code
827 SYE_INFO sBmNames
[4]; // System Names
828 BYTE bReserved
[16]; // reserved
829 PAR_INFO sPrtnInfo
[4]; // partitioms entrys
830 USHORT wPrtnTblSig
; // partition table signature (aa55H)
831 } EXT_INFO
, *PEXT_INFO
;
833 typedef struct _PARTITIONINFO
*PPARTITIONINFO
;
837 * informational structure returned
838 * by doshGetPartitionsList. One of
839 * these items is created for each
840 * bootable partition.
843 typedef struct _PARTITIONINFO
845 BYTE bDisk
; // drive number
846 CHAR cLetter
; // probable drive letter or ' ' if none
847 BYTE bFSType
; // file system type
848 PCSZ pcszFSType
; // file system name (as returned by
849 // doshType2FSName, can be NULL!)
850 BOOL fPrimary
; // primary partition?
851 BOOL fBootable
; // bootable by Boot Manager?
852 CHAR szBootName
[21]; // Boot Manager name, if (fBootable)
853 // extended for LVM names V0.9.20 (2002-08-10) [umoeller]
854 ULONG ulSize
; // size MBytes
855 PPARTITIONINFO pNext
; // next info or NULL if last
858 UINT
doshQueryDiskCount(VOID
);
860 APIRET
doshReadSector(USHORT disk
,
866 // restore original alignment
869 const char* doshType2FSName(unsigned char bFSType
);
871 APIRET
doshGetBootManager(USHORT
*pusDisk
,
875 typedef struct _PARTITIONSLIST
877 PLVMINFO pLVMInfo
; // != NULL if LVM is installed
880 PPARTITIONINFO pPartitionInfo
;
882 } PARTITIONSLIST
, *PPARTITIONSLIST
;
884 APIRET
doshGetPartitionsList(PPARTITIONSLIST
*ppList
,
887 APIRET
doshFreePartitionsList(PPARTITIONSLIST ppList
);
889 APIRET
doshQueryLVMInfo(PLVMINFO
*ppLVMInfo
);
891 APIRET
doshReadLVMPartitions(PLVMINFO pInfo
,
892 PPARTITIONINFO
*ppPartitionInfo
,
893 PUSHORT pcPartitions
);
895 VOID
doshFreeLVMInfo(PLVMINFO pInfo
);
897 /* ******************************************************************
901 ********************************************************************/
903 BOOL
doshMatchCase(PCSZ pcszMask
,
906 BOOL
doshMatchCaseNoPath(const char *pcszMask
,
907 const char *pcszName
);
909 BOOL
doshMatch(PCSZ pcszMask
,