source: trunk/include/helpers/dosh.h@ 133

Last change on this file since 133 was 133, checked in by umoeller, 24 years ago

program plus other fixes

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