|
|
1.1 root 1: /***************************************************************************\
2: *
1.1.1.2 ! root 3: * Module Name: BSEDOS.H
1.1 root 4: *
5: * OS/2 Base Include File
6: *
1.1.1.2 ! root 7: * Copyright (c) 1987,1989 Microsoft Corporation
1.1 root 8: *
9: *****************************************************************************
10: *
11: * Subcomponents marked with "+" are partially included by default
12: *
13: * #define: To include:
14: *
15: * + INCL_DOSPROCESS Process and thread support
16: * INCL_DOSINFOSEG InfoSeg support
17: * + INCL_DOSFILEMGR File Management
18: * + INCL_DOSMEMMGR Memory Management
19: * + INCL_DOSSEMAPHORES Semaphore support
20: * + INCL_DOSDATETIME Date/Time and Timer support
21: * INCL_DOSMODULEMGR Module manager
22: * + INCL_DOSRESOURCES Resource support
23: * INCL_DOSNLS National Language Support
24: * INCL_DOSSIGNALS Signals
25: * INCL_DOSMONITORS Monitors
26: * INCL_DOSQUEUES Queues
27: * INCL_DOSSESMGR Session Manager Support
28: * INCL_DOSDEVICES Device specific, ring 2 support
1.1.1.2 ! root 29: * INCL_DOSNMPIPES Named Pipes Support
1.1 root 30: * INCL_DOSPROFILE DosProfile API
1.1.1.2 ! root 31: * INCL_DOSTRACE Trace support
! 32: * INCL_DOSMISC Miscellanious functions
1.1 root 33: *
34: \***************************************************************************/
35:
36: #define INCL_DOSINCLUDED
37:
38: #ifdef INCL_DOS
39:
40: #define INCL_DOSPROCESS
41: #define INCL_DOSINFOSEG
42: #define INCL_DOSFILEMGR
43: #define INCL_DOSMEMMGR
44: #define INCL_DOSSEMAPHORES
45: #define INCL_DOSDATETIME
46: #define INCL_DOSMODULEMGR
47: #define INCL_DOSRESOURCES
48: #define INCL_DOSNLS
49: #define INCL_DOSSIGNALS
50: #define INCL_DOSMONITORS
51: #define INCL_DOSQUEUES
52: #define INCL_DOSSESMGR
53: #define INCL_DOSDEVICES
1.1.1.2 ! root 54: #define INCL_DOSNMPIPES
1.1 root 55: #define INCL_DOSPROFILE
1.1.1.2 ! root 56: #define INCL_DOSTRACE
! 57: #define INCL_DOSMISC
1.1 root 58:
59: #endif /* INCL_DOS */
60:
61: #ifdef INCL_ERRORS
62: #define INCL_DOSERRORS
63: #endif /* INCL_ERRORS */
64:
1.1.1.2 ! root 65: #if (defined(INCL_DOSPROCESS) || !defined(INCL_NOCOMMON))
1.1 root 66:
67: /*** General services */
68:
69: USHORT APIENTRY DosBeep(USHORT, USHORT);
70:
71: /*** Process and Thread support */
72:
73: VOID APIENTRY DosExit(USHORT, USHORT);
74:
75: /* DosExit codes */
76:
77: #define EXIT_THREAD 0
78: #define EXIT_PROCESS 1
79:
80: #endif /* common INCL_DOSPROCESS stuff */
81:
82: #ifdef INCL_DOSPROCESS
83:
84: typedef struct _PIDINFO { /* pidi */
85: PID pid;
86: TID tid;
87: PID pidParent;
88: } PIDINFO;
89: typedef PIDINFO FAR *PPIDINFO;
90:
1.1.1.2 ! root 91: typedef VOID (FAR *PFNTHREAD)(VOID);
1.1 root 92:
93: USHORT APIENTRY DosCreateThread(PFNTHREAD, PTID, PBYTE);
94: USHORT APIENTRY DosResumeThread(TID);
95: USHORT APIENTRY DosSuspendThread(TID);
96:
1.1.1.2 ! root 97: /* DosCWait fScope code values */
1.1 root 98:
99: #define DCWA_PROCESS 0
100: #define DCWA_PROCESSTREE 1
101:
1.1.1.2 ! root 102: /* DosCWait wait option values */
1.1 root 103:
104: #define DCWW_WAIT 0
105: #define DCWW_NOWAIT 1
106:
107: typedef struct _RESULTCODES { /* resc */
108: USHORT codeTerminate;
109: USHORT codeResult;
110: } RESULTCODES;
111: typedef RESULTCODES FAR *PRESULTCODES;
112:
113: USHORT APIENTRY DosCwait(USHORT, USHORT, PRESULTCODES, PPID, PID);
114: USHORT APIENTRY DosSleep(ULONG);
115:
1.1.1.2 ! root 116: /* DosExitList codeTerminate values (also passed to ExitList routines) */
1.1 root 117:
118: #define TC_EXIT 0
119: #define TC_HARDERROR 1
120: #define TC_TRAP 2
121: #define TC_KILLPROCESS 3
122:
123: typedef VOID (PASCAL FAR *PFNEXITLIST)(USHORT);
124:
1.1.1.2 ! root 125: USHORT APIENTRY DosEnterCritSec(VOID);
! 126: USHORT APIENTRY DosExitCritSec(VOID);
1.1 root 127: USHORT APIENTRY DosExitList(USHORT, PFNEXITLIST);
128:
129: /* DosExitList functions */
130:
131: #define EXLST_ADD 1
132: #define EXLST_REMOVE 2
133: #define EXLST_EXIT 3
134:
135: USHORT APIENTRY DosExecPgm(PCHAR, SHORT, USHORT, PSZ, PSZ, PRESULTCODES, PSZ);
136:
137: /* DosExecPgm functions */
138:
139: #define EXEC_SYNC 0
140: #define EXEC_ASYNC 1
141: #define EXEC_ASYNCRESULT 2
142: #define EXEC_TRACE 3
143: #define EXEC_BACKGROUND 4
144:
1.1.1.2 ! root 145: USHORT APIENTRY DosGetPID(PPIDINFO);
! 146: USHORT APIENTRY DosGetPPID(USHORT, PUSHORT);
1.1 root 147:
148: USHORT APIENTRY DosGetPrty(USHORT, PUSHORT, USHORT);
149: USHORT APIENTRY DosSetPrty(USHORT, USHORT, SHORT, USHORT);
150:
151: /* Priority scopes */
152:
153: #define PRTYS_PROCESS 0
154: #define PRTYS_PROCESSTREE 1
155: #define PRTYS_THREAD 2
156:
157: /* Priority classes */
158:
159: #define PRTYC_NOCHANGE 0
160: #define PRTYC_IDLETIME 1
161: #define PRTYC_REGULAR 2
162: #define PRTYC_TIMECRITICAL 3
163:
1.1.1.2 ! root 164: /* Priority deltas */
! 165:
! 166: #define PRTYD_MINIMUM -31
! 167: #define PRTYD_MAXIMUM 31
! 168:
1.1 root 169: USHORT APIENTRY DosKillProcess(USHORT, PID);
170:
1.1.1.2 ! root 171: #define DKP_PROCESSTREE 0
! 172: #define DKP_PROCESS 1
1.1 root 173:
174: #endif /* INCL_DOSPROCESS */
175:
176:
177: /*** InfoSeg support */
178:
179: #ifdef INCL_DOSINFOSEG
180:
181: /* Global Info Seg */
182:
183: typedef struct _GINFOSEG { /* gis */
184: ULONG time;
185: ULONG msecs;
186: UCHAR hour;
187: UCHAR minutes;
188: UCHAR seconds;
189: UCHAR hundredths;
190: USHORT timezone;
191: USHORT cusecTimerInterval;
192: UCHAR day;
193: UCHAR month;
194: USHORT year;
195: UCHAR weekday;
196: UCHAR uchMajorVersion;
197: UCHAR uchMinorVersion;
198: UCHAR chRevisionLetter;
199: UCHAR sgCurrent;
200: UCHAR sgMax;
201: UCHAR cHugeShift;
202: UCHAR fProtectModeOnly;
203: USHORT pidForeground;
204: UCHAR fDynamicSched;
205: UCHAR csecMaxWait;
206: USHORT cmsecMinSlice;
207: USHORT cmsecMaxSlice;
208: USHORT bootdrive;
209: UCHAR amecRAS[32];
210: UCHAR csgWindowableVioMax;
211: UCHAR csgPMMax;
212: } GINFOSEG;
213: typedef GINFOSEG FAR *PGINFOSEG;
214:
215: /* Local Info Seg */
216:
217: typedef struct _LINFOSEG { /* lis */
218: PID pidCurrent;
219: PID pidParent;
220: USHORT prtyCurrent;
221: TID tidCurrent;
222: USHORT sgCurrent;
223: UCHAR rfProcStatus;
224: UCHAR dummy1;
225: BOOL fForeground;
226: UCHAR typeProcess;
227: UCHAR dummy2;
228: SEL selEnvironment;
229: USHORT offCmdLine;
230: USHORT cbDataSegment;
231: USHORT cbStack;
232: USHORT cbHeap;
233: HMODULE hmod;
234: SEL selDS;
235: } LINFOSEG;
236: typedef LINFOSEG FAR *PLINFOSEG;
237:
238: /* Process Type codes (local info seg typeProcess field) */
239:
240: #define PT_FULLSCREEN 0 /* Full screen app. */
241: #define PT_REALMODE 1 /* Real mode process */
242: #define PT_WINDOWABLEVIO 2 /* VIO windowable app. */
243: #define PT_PM 3 /* Presentation Manager app. */
244: #define PT_DETACHED 4 /* Detached app. */
245:
246: /* Process Status Flag definitions (local info seg rfProcStatus field) */
247:
248: #define PS_EXITLIST 1 /* Thread is in exitlist routine */
249:
250:
251: USHORT APIENTRY DosGetInfoSeg(PSEL, PSEL);
252:
253: /* Helper macros used to convert selector to PINFOSEG or LINFOSEG */
254:
255: #define MAKEPGINFOSEG(sel) ((PGINFOSEG)MAKEP(sel, 0))
256: #define MAKEPLINFOSEG(sel) ((PLINFOSEG)MAKEP(sel, 0))
257:
258: #endif /* INCL_DOSINFOSEG */
259:
1.1.1.2 ! root 260: #if (defined(INCL_DOSFILEMGR) || !defined(INCL_NOCOMMON))
1.1 root 261:
262: /*** File manager */
263:
1.1.1.2 ! root 264: /* DosChgFilePtr() file position codes */
! 265:
! 266: #define FILE_BEGIN 0x0000
! 267: #define FILE_CURRENT 0x0001
! 268: #define FILE_END 0x0002
! 269:
! 270: /* Directory handle types */
! 271:
! 272: #define HDIR_SYSTEM 0x0001
! 273: #define HDIR_CREATE 0xFFFF
! 274:
! 275: /* Dosopen/DosQFHandState file attributes */
! 276:
! 277: #define FILE_NORMAL 0x0000
! 278: #define FILE_READONLY 0x0001
! 279: #define FILE_HIDDEN 0x0002
! 280: #define FILE_SYSTEM 0x0004
! 281: #define FILE_DIRECTORY 0x0010
! 282: #define FILE_ARCHIVED 0x0020
! 283:
! 284: /* DosOpen() actions */
! 285:
! 286: #define FILE_EXISTED 0x0001
! 287: #define FILE_CREATED 0x0002
! 288: #define FILE_TRUNCATED 0x0003
! 289:
! 290: /* DosOpen() open flags */
! 291:
! 292: #define FILE_OPEN 0x0001
! 293: #define FILE_TRUNCATE 0x0002
! 294: #define FILE_CREATE 0x0010
! 295:
! 296: /* DosOpen/DosSetFHandState flags */
! 297:
! 298: #define OPEN_ACCESS_READONLY 0x0000
! 299: #define OPEN_ACCESS_WRITEONLY 0x0001
! 300: #define OPEN_ACCESS_READWRITE 0x0002
! 301: #define OPEN_SHARE_DENYREADWRITE 0x0010
! 302: #define OPEN_SHARE_DENYWRITE 0x0020
! 303: #define OPEN_SHARE_DENYREAD 0x0030
! 304: #define OPEN_SHARE_DENYNONE 0x0040
! 305: #define OPEN_FLAGS_NOINHERIT 0x0080
! 306: #define OPEN_FLAGS_FAIL_ON_ERROR 0x2000
! 307: #define OPEN_FLAGS_WRITE_THROUGH 0x4000
! 308: #define OPEN_FLAGS_DASD 0x8000
! 309:
! 310: /* DosSearchPath() constants */
! 311:
! 312: #define SEARCH_PATH 0x0000
! 313: #define SEARCH_CUR_DIRECTORY 0x0001
! 314: #define SEARCH_ENVIRONMENT 0x0002
! 315:
1.1 root 316: typedef SHANDLE HFILE; /* hf */
317: typedef HFILE FAR *PHFILE;
318:
319: USHORT APIENTRY DosOpen(PSZ, PHFILE, PUSHORT, ULONG, USHORT, USHORT, USHORT, ULONG);
320: USHORT APIENTRY DosClose(HFILE);
321: USHORT APIENTRY DosRead(HFILE, PVOID, USHORT, PUSHORT);
322: USHORT APIENTRY DosWrite(HFILE, PVOID, USHORT, PUSHORT);
323:
324: /* File time and date types */
325:
326: typedef struct _FILESTATUS { /* fsts */
327: FDATE fdateCreation;
328: FTIME ftimeCreation;
329: FDATE fdateLastAccess;
330: FTIME ftimeLastAccess;
331: FDATE fdateLastWrite;
332: FTIME ftimeLastWrite;
333: ULONG cbFile;
334: ULONG cbFileAlloc;
335: USHORT attrFile;
336: } FILESTATUS;
337: typedef FILESTATUS FAR *PFILESTATUS;
338:
339: typedef struct _FSALLOCATE { /* fsalloc */
340: ULONG idFileSystem;
341: ULONG cSectorUnit;
342: ULONG cUnit;
343: ULONG cUnitAvail;
344: USHORT cbSector;
345: } FSALLOCATE;
346: typedef FSALLOCATE FAR *PFSALLOCATE;
347:
1.1.1.2 ! root 348: typedef struct _VOLUMELABEL { /* vol */
! 349: BYTE cch;
! 350: CHAR szVolLabel[12];
! 351: } VOLUMELABEL;
! 352: typedef VOLUMELABEL FAR *PVOLUMELABEL;
! 353:
! 354: typedef struct _FSINFO { /* fsinf */
! 355: FDATE fdateCreation;
! 356: FTIME ftimeCreation;
! 357: VOLUMELABEL vol;
! 358: } FSINFO;
! 359: typedef FSINFO FAR *PFSINFO;
! 360:
! 361: /* HANDTYPE values */
! 362:
! 363: #define HANDTYPE_FILE 0x00
! 364: #define HANDTYPE_DEVICE 0x01
! 365: #define HANDTYPE_PIPE 0x02
! 366: #define HANDTYPE_NETWORK 0x80
! 367:
! 368: typedef struct _FILELOCK { /* flock */
! 369: LONG lOffset;
! 370: LONG lRange;
! 371: } FILELOCK;
! 372: typedef FILELOCK FAR *PFILELOCK;
! 373:
1.1 root 374: typedef SHANDLE HDIR; /* hdir */
375: typedef HDIR FAR *PHDIR;
376:
377: USHORT APIENTRY DosDelete(PSZ, ULONG);
378: USHORT APIENTRY DosDupHandle(HFILE, PHFILE);
379:
380: USHORT APIENTRY DosQFHandState(HFILE, PUSHORT);
381: USHORT APIENTRY DosSetFHandState(HFILE, USHORT);
382: USHORT APIENTRY DosQHandType(HFILE, PUSHORT, PUSHORT);
383:
384: USHORT APIENTRY DosReadAsync (HFILE, PULONG, PUSHORT, PVOID, USHORT, PUSHORT);
385: USHORT APIENTRY DosWriteAsync(HFILE, PULONG, PUSHORT, PVOID, USHORT, PUSHORT);
386:
387: USHORT APIENTRY DosFindFirst(PSZ, PHDIR, USHORT, PFILEFINDBUF, USHORT, PUSHORT, ULONG);
388: USHORT APIENTRY DosFindNext(HDIR, PFILEFINDBUF, USHORT, PUSHORT);
389: USHORT APIENTRY DosFindClose(HDIR);
1.1.1.2 ! root 390: USHORT APIENTRY DosSearchPath(USHORT, PSZ, PSZ, PBYTE, USHORT);
1.1 root 391:
392: USHORT APIENTRY DosNewSize(HFILE, ULONG);
393: USHORT APIENTRY DosBufReset(HFILE);
394:
395: USHORT APIENTRY DosChgFilePtr(HFILE, LONG, USHORT, PULONG);
396:
1.1.1.2 ! root 397: USHORT APIENTRY DosFileLocks(HFILE, PFILELOCK, PFILELOCK);
1.1 root 398:
399: USHORT APIENTRY DosMove(PSZ, PSZ, ULONG);
400: USHORT APIENTRY DosMkDir(PSZ, ULONG);
401: USHORT APIENTRY DosRmDir(PSZ, ULONG);
402: USHORT APIENTRY DosSelectDisk(USHORT);
403: USHORT APIENTRY DosQCurDisk(PUSHORT, PULONG);
404:
405: USHORT APIENTRY DosChDir(PSZ, ULONG);
406: USHORT APIENTRY DosQCurDir(USHORT, PBYTE, PUSHORT);
407:
408: USHORT APIENTRY DosQFSInfo(USHORT, USHORT, PBYTE, USHORT);
409: USHORT APIENTRY DosSetFSInfo(USHORT, USHORT, PBYTE, USHORT);
1.1.1.2 ! root 410: USHORT APIENTRY DosQVerify(PBOOL);
1.1 root 411: USHORT APIENTRY DosSetVerify(USHORT);
412: USHORT APIENTRY DosSetMaxFH(USHORT);
413:
1.1.1.2 ! root 414: USHORT APIENTRY DosQFileInfo(HFILE, USHORT, PFILESTATUS, USHORT);
! 415: USHORT APIENTRY DosSetFileInfo(HFILE, USHORT, PFILESTATUS, USHORT);
1.1 root 416:
417: USHORT APIENTRY DosQFileMode(PSZ, PUSHORT, ULONG);
418: USHORT APIENTRY DosSetFileMode(PSZ, USHORT, ULONG);
419:
420: /*
421: *
422: * Consistent names for file functions
423: *
424: * DosQueryFileState DosQFHandState
425: * DosSetFileState DosSetFHandState
426: * DosQueryHandleType DosQHandType
427: * DosResetBuffer DosBufReset
428: * DosSetFilePtr DosChgFilePtr
429: * DosMoveFile DosMove
430: * DosMakeDirectory DosMkdir
431: * DosRemoveDirectory DosRmdir
432: * DosSetCurrentDisk DosSelectDisk
433: * DosQueryCurrentDisk DosQCurDisk
434: * DosSetCurrentDirectory DosChdir
435: * DosQueryCurrentDirectory DosQCurDir
436: * DosQueryFileSystemInfo DosQFSInfo
437: * DosSetFileSystemInfo DosSetFSInfo
438: * DosQueryWriteVerify DosQVerify
439: * DosQueryFileMode DosQFileMode
440: * DosSetWriteVerify DosSetVerify
441: * DosSetMaxFileHandles DosSetMaxFH
442: * DosQueryFileInfo DosQFileInfo
443: *
444: */
445:
446: #endif /* common INCL_DOSFILEMAN */
447:
1.1.1.2 ! root 448: #if (defined(INCL_DOSMEMMGR) || !defined(INCL_NOCOMMON))
1.1 root 449: /*** Memory management */
450:
451: USHORT APIENTRY DosAllocSeg(USHORT, PSEL, USHORT);
452: USHORT APIENTRY DosReallocSeg(USHORT, SEL);
453: USHORT APIENTRY DosFreeSeg(SEL);
454: USHORT APIENTRY DosGiveSeg(SEL, PID, PSEL);
455: USHORT APIENTRY DosGetSeg(SEL);
456: USHORT APIENTRY DosSizeSeg(SEL, PULONG);
457:
458: /* Segment attribute flags (used with DosAllocSeg) */
459:
1.1.1.2 ! root 460: #define SEG_NONSHARED 0x0000
1.1 root 461: #define SEG_GIVEABLE 0x0001
462: #define SEG_GETTABLE 0x0002
463: #define SEG_DISCARDABLE 0x0004
464:
465: #endif /* common INCL_DOSMEMMGR */
466:
467: #ifdef INCL_DOSMEMMGR
468:
469: USHORT APIENTRY DosAllocHuge(USHORT, USHORT, PSEL, USHORT, USHORT);
470: USHORT APIENTRY DosReallocHuge(USHORT, USHORT, SEL);
471: USHORT APIENTRY DosGetHugeShift(PUSHORT);
472:
473: USHORT APIENTRY DosAllocShrSeg(USHORT, PSZ, PSEL);
474:
475: USHORT APIENTRY DosLockSeg(SEL);
476: USHORT APIENTRY DosUnlockSeg(SEL);
477:
478: USHORT APIENTRY DosGetShrSeg(PSZ, PSEL);
479:
480: USHORT APIENTRY DosMemAvail(PULONG);
481: USHORT APIENTRY DosCreateCSAlias(SEL, PSEL);
482:
483: USHORT APIENTRY DosSubAlloc(SEL, PUSHORT, USHORT);
484: USHORT APIENTRY DosSubFree(SEL, USHORT, USHORT);
485: USHORT APIENTRY DosSubSet(SEL, USHORT, USHORT);
486:
487: #endif /* INCL_DOSMEMMGR */
488:
1.1.1.2 ! root 489: #if (defined(INCL_DOSSEMAPHORES) || !defined(INCL_NOCOMMON))
1.1 root 490:
491: /*** Semaphore support */
492:
1.1.1.2 ! root 493: #define SEM_INDEFINITE_WAIT -1L
! 494: #define SEM_IMMEDIATE_RETURN 0L
! 495:
1.1 root 496: USHORT APIENTRY DosSemClear(HSEM);
497: USHORT APIENTRY DosSemSet(HSEM);
498: USHORT APIENTRY DosSemWait(HSEM, LONG);
499: USHORT APIENTRY DosSemSetWait(HSEM, LONG);
500: USHORT APIENTRY DosSemRequest(HSEM, LONG);
501:
502: #endif /* common INCL_DOSSEMAPHORES */
503:
504: #ifdef INCL_DOSSEMAPHORES
505:
506: typedef LHANDLE HSYSSEM; /* hssm */
507: typedef HSYSSEM FAR *PHSYSSEM;
508:
509: USHORT APIENTRY DosCreateSem(USHORT, PHSYSSEM, PSZ);
510:
511: #define CSEM_PRIVATE 0
512: #define CSEM_PUBLIC 1
513:
514: USHORT APIENTRY DosOpenSem(PHSEM, PSZ);
515: USHORT APIENTRY DosCloseSem(HSEM);
516:
517: typedef struct _MUXSEM { /* mxs */
518: USHORT zero;
519: HSEM hsem;
520: } MUXSEM;
521: typedef MUXSEM FAR *PMUXSEM;
522:
523: typedef struct _MUXSEMLIST { /* mxsl */
524: USHORT cmxs;
525: MUXSEM amxs[16];
526: } MUXSEMLIST;
527: typedef MUXSEMLIST FAR *PMUXSEMLIST;
528:
529: /*
530: * Since a MUXSEMLIST structure is actually a variable length
531: * structure, the following macro may be used to define a MUXSEMLIST
532: * structure having size elements, named "name".
533: */
534: #define DEFINEMUXSEMLIST(name, size) \
535: struct { \
536: USHORT cmxs; \
537: MUXSEM amxs[size]; \
538: } name;
539:
540: /*
541: * This function actually takes a far pointer to a MUXSEMLIST structure
542: * as its second parameter, but in order to allow its use with the
543: * DEFINEMUXSEMLIST macro, it is declared here as PVOID.
544: */
545: USHORT APIENTRY DosMuxSemWait(PUSHORT, PVOID, LONG);
546:
547:
548: /*** Fast safe ram semaphores */
549:
550: typedef struct _DOSFSRSEM { /* dosfsrs */
551: USHORT cb;
552: PID pid;
553: TID tid;
554: USHORT cUsage;
555: USHORT client;
556: ULONG sem;
557: } DOSFSRSEM;
558: typedef DOSFSRSEM FAR *PDOSFSRSEM;
559:
560: USHORT APIENTRY DosFSRamSemRequest(PDOSFSRSEM, LONG);
561: USHORT APIENTRY DosFSRamSemClear(PDOSFSRSEM);
562:
563: #endif /* INCL_DOSSEMAPHORES */
564:
1.1.1.2 ! root 565: #if (defined(INCL_DOSDATETIME) || !defined(INCL_NOCOMMON))
1.1 root 566:
567: /*** Time support */
568:
569: typedef struct _DATETIME { /* date */
570: UCHAR hours;
571: UCHAR minutes;
572: UCHAR seconds;
573: UCHAR hundredths;
574: UCHAR day;
575: UCHAR month;
576: USHORT year;
577: SHORT timezone;
578: UCHAR weekday;
579: } DATETIME;
580: typedef DATETIME FAR *PDATETIME;
581:
582: USHORT APIENTRY DosGetDateTime(PDATETIME);
583: USHORT APIENTRY DosSetDateTime(PDATETIME);
584:
585: #endif /* common INCL_DOSDATETIME */
586:
587: #ifdef INCL_DOSDATETIME
588:
589: typedef SHANDLE HTIMER;
590: typedef HTIMER FAR *PHTIMER;
591:
592: USHORT APIENTRY DosTimerAsync(ULONG, HSEM, PHTIMER);
593: USHORT APIENTRY DosTimerStart(ULONG, HSEM, PHTIMER);
594: USHORT APIENTRY DosTimerStop(HTIMER);
595:
596: #endif /* INCL_DOSDATETIME */
597:
598:
599: /*** Module manager */
600:
601: #ifdef INCL_DOSMODULEMGR
602:
603: USHORT APIENTRY DosLoadModule(PSZ, USHORT, PSZ, PHMODULE);
604: USHORT APIENTRY DosFreeModule(HMODULE);
1.1.1.2 ! root 605: USHORT APIENTRY DosGetProcAddr(HMODULE, PSZ, PPFN);
1.1 root 606: USHORT APIENTRY DosGetModHandle(PSZ, PHMODULE);
607: USHORT APIENTRY DosGetModName(HMODULE, USHORT, PCHAR);
608:
609: #endif /* INCL_DOSMODULEMGR */
610:
1.1.1.2 ! root 611: #if (defined(INCL_DOSRESOURCES) || !defined(INCL_NOCOMMON))
1.1 root 612:
613: /*** Resource support */
614:
615: /* Predefined resource types */
616:
617: #define RT_POINTER 1 /* mouse pointer shape */
618: #define RT_BITMAP 2 /* bitmap */
619: #define RT_MENU 3 /* menu template */
620: #define RT_DIALOG 4 /* dialog template */
621: #define RT_STRING 5 /* string tables */
622: #define RT_FONTDIR 6 /* font directory */
623: #define RT_FONT 7 /* font */
624: #define RT_ACCELTABLE 8 /* accelerator tables */
625: #define RT_RCDATA 9 /* binary data */
626: #define RT_MESSAGE 10 /* error msg tables */
627: #define RT_DLGINCLUDE 11 /* dialog include file name */
628: #define RT_VKEYTBL 12 /* key to vkey tables */
629: #define RT_KEYTBL 13 /* key to UGL tables */
630: #define RT_CHARTBL 14 /* glyph to character tables */
1.1.1.2 ! root 631: #define RT_DISPLAYINFO 15 /* screen display information */
1.1 root 632:
633: #endif /* common INCL_DOSRESOURCES */
634:
635: #ifdef INCL_DOSRESOURCES
636:
637: USHORT APIENTRY DosGetResource(HMODULE, USHORT, USHORT, PSEL);
638:
639: #endif /* INCL_DOSRESOURCES */
640:
641:
642: /*** NLS Support */
643:
644: #ifdef INCL_DOSNLS
645:
646: typedef struct _COUNTRYCODE { /* ctryc */
647: USHORT country;
648: USHORT codepage;
649: } COUNTRYCODE;
650: typedef COUNTRYCODE FAR *PCOUNTRYCODE;
651:
1.1.1.2 ! root 652: /* fsDateFmt */
! 653:
! 654: #define DATEFMT_MM_DD_YY 0x0000
! 655: #define DATEFMT_DD_MM_YY 0x0001
! 656: #define DATEFMT_YY_MM_DD 0x0002
! 657:
! 658: /* fsCurrencyFmt */
! 659:
! 660: #define CURRENCY_FOLLOW 0x0001
! 661: #define CURRENCY_SPACE 0x0002
! 662: #define CURRENCY_DECIMAL 0x0004
! 663:
1.1 root 664: typedef struct _COUNTRYINFO { /* ctryi */
665: USHORT country;
666: USHORT codepage;
667: USHORT fsDateFmt;
668: CHAR szCurrency[5];
669: CHAR szThousandsSeparator[2];
670: CHAR szDecimal[2];
671: CHAR szDateSeparator[2];
672: CHAR szTimeSeparator[2];
673: UCHAR fsCurrencyFmt;
674: UCHAR cDecimalPlace;
675: UCHAR fsTimeFmt;
676: USHORT abReserved1[2];
677: CHAR szDataSeparator[2];
678: USHORT abReserved2[5];
679: } COUNTRYINFO;
680: typedef COUNTRYINFO FAR *PCOUNTRYINFO;
681:
682: USHORT APIENTRY DosGetCtryInfo(USHORT, PCOUNTRYCODE, PCOUNTRYINFO, PUSHORT);
683: USHORT APIENTRY DosGetDBCSEv(USHORT, PCOUNTRYCODE, PCHAR);
684: USHORT APIENTRY DosCaseMap(USHORT, PCOUNTRYCODE, PCHAR);
685: USHORT APIENTRY DosGetCollate(USHORT, PCOUNTRYCODE, PCHAR, PUSHORT);
686: USHORT APIENTRY DosGetCp(USHORT, PUSHORT, PUSHORT);
687: USHORT APIENTRY DosSetCp(USHORT, USHORT);
1.1.1.2 ! root 688: USHORT APIENTRY DosSetProcCp(USHORT, USHORT);
1.1 root 689:
690: #endif /* INCL_DOSNLS */
691:
692:
693: /*** Signal support */
694:
695: #ifdef INCL_DOSSIGNALS
696:
1.1.1.2 ! root 697: /* DosSetSigHandler signal numbers */
1.1 root 698:
699: #define SIG_CTRLC 1 /* Control C */
700: #define SIG_BROKENPIPE 2 /* Broken Pipe */
701: #define SIG_KILLPROCESS 3 /* Program Termination */
702: #define SIG_CTRLBREAK 4 /* Control Break */
703: #define SIG_PFLG_A 5 /* Process Flag A */
704: #define SIG_PFLG_B 6 /* Process Flag B */
705: #define SIG_PFLG_C 7 /* Process Flag C */
706: #define SIG_CSIGNALS 8 /* number of signals plus one */
707:
1.1.1.2 ! root 708: /* DosFlagProcess flag numbers */
1.1 root 709:
1.1.1.2 ! root 710: #define PFLG_A 0 /* Process Flag A */
! 711: #define PFLG_B 1 /* Process Flag B */
! 712: #define PFLG_C 2 /* Process Flag C */
1.1 root 713:
714: /* Signal actions */
715:
716: #define SIGA_KILL 0
717: #define SIGA_IGNORE 1
718: #define SIGA_ACCEPT 2
719: #define SIGA_ERROR 3
720: #define SIGA_ACKNOWLEDGE 4
721:
722: /* DosHoldSignal constants */
723:
724: #define HLDSIG_ENABLE 0
725: #define HLDSIG_DISABLE 1
726:
727: /* DosFlagProcess codes */
728:
729: #define FLGP_SUBTREE 0
730: #define FLGP_PID 1
731:
1.1.1.2 ! root 732: typedef VOID (PASCAL FAR *PFNSIGHANDLER)(USHORT, USHORT);
1.1 root 733:
734: USHORT APIENTRY DosSetSigHandler(PFNSIGHANDLER, PFNSIGHANDLER FAR *, PUSHORT, USHORT, USHORT);
735: USHORT APIENTRY DosFlagProcess(PID, USHORT, USHORT, USHORT);
736: USHORT APIENTRY DosHoldSignal(USHORT);
737: USHORT APIENTRY DosSendSignal(USHORT, USHORT);
738:
739: #endif /* INCL_DOSSIGNALS */
740:
741:
742: /*** Monitor support */
743:
744: #ifdef INCL_DOSMONITORS
745:
1.1.1.2 ! root 746: #define MONITOR_DEFAULT 0x0000
! 747: #define MONITOR_BEGIN 0x0001
! 748: #define MONITOR_END 0x0002
! 749:
1.1 root 750: typedef SHANDLE HMONITOR; /* hmon */
751: typedef HMONITOR FAR *PHMONITOR;
752:
1.1.1.2 ! root 753: typedef struct _MONIN { /* mnin */
! 754: USHORT cb;
! 755: BYTE abReserved[18];
! 756: BYTE abBuffer[108];
! 757: } MONIN;
! 758: typedef MONIN FAR *PMONIN;
! 759:
! 760: typedef struct _MONOUT { /* mnout */
! 761: USHORT cb;
! 762: UCHAR buffer[18];
! 763: BYTE abBuf[108];
! 764: } MONOUT;
! 765: typedef MONOUT FAR *PMONOUT;
! 766:
1.1 root 767: USHORT APIENTRY DosMonOpen(PSZ, PHMONITOR);
768: USHORT APIENTRY DosMonClose(HMONITOR);
769: USHORT APIENTRY DosMonReg(HMONITOR, PBYTE, PBYTE, USHORT, USHORT);
770: USHORT APIENTRY DosMonRead(PBYTE, UCHAR, PBYTE, PUSHORT);
771: USHORT APIENTRY DosMonWrite(PBYTE, PBYTE, USHORT);
772:
773: #endif /* INCL_DOSMONITORS */
774:
775:
776: /*** Pipe and queue support */
777:
778: #ifdef INCL_DOSQUEUES
779:
1.1.1.2 ! root 780: /* DosCreateQueue() priority */
! 781:
! 782: #define QUE_FIFO 0x0000
! 783: #define QUE_LIFO 0x0001
! 784: #define QUE_PRIORITY 0x0002
! 785:
! 786: /* DosMakeNmPipe open modes */
! 787:
! 788: #define PIPE_ACCESS_INBOUND 0x0000
! 789: #define PIPE_ACCESS_OUTBOUND 0x0001
! 790: #define PIPE_ACCESS_DUPLEX 0x0002
! 791: #define PIPE_INHERIT 0x0000
! 792: #define PIPE_NOINHERIT 0x0080
! 793: #define PIPE_WRITEBEHIND 0x0000
! 794: #define PIPE_NOWRITEBEHIND 0x4000
! 795:
! 796: /* DosMakeNmPipe and DosQNmPHandState state */
! 797:
! 798: #define PIPE_READMODE_BYTE 0x0000
! 799: #define PIPE_READMODE_MESSAGE 0x0100
! 800: #define PIPE_TYPE_BYTE 0x0000
! 801: #define PIPE_TYPE_MESSAGE 0x0400
! 802: #define PIPE_END_CLIENT 0x0000
! 803: #define PIPE_END_SERVER 0x4000
! 804: #define PIPE_WAIT 0x0000
! 805: #define PIPE_NOWAIT 0x8000
! 806: #define PIPE_UNLIMITED_INSTANCES 0x00FF
! 807:
! 808:
! 809: typedef struct _QUEUERESULT { /* qresc */
! 810: PID pidProcess;
! 811: USHORT usEventCode;
! 812: } QUEUERESULT;
! 813: typedef QUEUERESULT FAR *PQUEUERESULT;
! 814:
1.1 root 815: typedef SHANDLE HQUEUE; /* hq */
816: typedef HQUEUE FAR *PHQUEUE;
817:
818: USHORT APIENTRY DosMakePipe(PHFILE, PHFILE, USHORT);
819: USHORT APIENTRY DosCloseQueue(HQUEUE);
820: USHORT APIENTRY DosCreateQueue(PHQUEUE, USHORT, PSZ);
821: USHORT APIENTRY DosOpenQueue(PUSHORT, PHQUEUE, PSZ);
1.1.1.2 ! root 822: USHORT APIENTRY DosPeekQueue(HQUEUE, PQUEUERESULT, PUSHORT, PVOID FAR *, PUSHORT, UCHAR, PBYTE, ULONG);
1.1 root 823: USHORT APIENTRY DosPurgeQueue(HQUEUE);
824: USHORT APIENTRY DosQueryQueue(HQUEUE, PUSHORT);
1.1.1.2 ! root 825: USHORT APIENTRY DosReadQueue(HQUEUE, PQUEUERESULT, PUSHORT, PVOID FAR *, USHORT, UCHAR, PBYTE, HSEM);
1.1 root 826: USHORT APIENTRY DosWriteQueue(HQUEUE, USHORT, USHORT, PBYTE, UCHAR);
827:
828: USHORT APIENTRY DosGetMessage(PCHAR FAR *, USHORT, PCHAR, USHORT, USHORT, PSZ, PUSHORT);
829: USHORT APIENTRY DosInsMessage(PCHAR FAR *, USHORT, PSZ, USHORT, PCHAR, USHORT, PUSHORT);
1.1.1.2 ! root 830: USHORT APIENTRY DosPutMessage(HFILE, USHORT, PCHAR);
1.1 root 831:
832: #endif /* INCL_DOSQUEUES */
833:
1.1.1.2 ! root 834: /*** Trace support */
! 835:
! 836: #ifdef INCL_DOSTRACE
! 837:
! 838: typedef struct PTRACEBUF { /* ptrcbf */
! 839: PID pid;
! 840: TID tid;
! 841: USHORT cmd;
! 842: USHORT value;
! 843: USHORT offv;
! 844: USHORT segv;
! 845: USHORT mte;
! 846: USHORT rAX;
! 847: USHORT rBX;
! 848: USHORT rCX;
! 849: USHORT rDX;
! 850: USHORT rSI;
! 851: USHORT rDI;
! 852: USHORT rBP;
! 853: USHORT rDS;
! 854: USHORT rES;
! 855: USHORT rIP;
! 856: USHORT rCS;
! 857: USHORT rF;
! 858: USHORT rSP;
! 859: USHORT rSS;
! 860: } PTRACEBUF;
! 861: typedef PTRACEBUF FAR *PPTRACEBUF;
! 862:
! 863: USHORT APIENTRY DosPTrace(PBYTE);
! 864:
! 865: #endif /* INCL_DOSTRACE */
1.1 root 866:
867: /*** Session manager support */
868:
869: #ifdef INCL_DOSSESMGR
870:
1.1.1.2 ! root 871: /* DosQAppType() application types */
! 872:
! 873: #define NOTSPECIFIED 0x0000
! 874: #define NOTWINDOCOMPAT 0x0001
! 875: #define WINDOWCOMPAT 0x0002
! 876: #define WINDOWAPI 0x0003
! 877: #define BOUND 0x0004
! 878: #define DYNAMICLINK 0x0008
! 879: #define DOSFORMAT 0x0010
! 880:
1.1 root 881: typedef struct _STARTDATA { /* stdata */
1.1.1.2 ! root 882: USHORT Length;
1.1 root 883: USHORT Related;
884: USHORT FgBg;
885: USHORT TraceOpt;
886: PSZ PgmTitle;
887: PSZ PgmName;
888: PBYTE PgmInputs;
889: PBYTE TermQ;
890: PBYTE Environment;
891: USHORT InheritOpt;
892: USHORT SessionType;
893: PSZ IconFile;
894: ULONG PgmHandle;
895: USHORT PgmControl;
896: USHORT InitXPos;
897: USHORT InitYPos;
898: USHORT InitXSize;
899: USHORT InitYSize;
900: } STARTDATA;
901: typedef STARTDATA FAR *PSTARTDATA;
902:
1.1.1.2 ! root 903: /* STATUSDATA.SelectInd constants */
! 904:
! 905: #define TARGET_UNCHANGED 0x0000
! 906: #define TARGET_SELECTABLE 0x0001
! 907: #define TARGET_NOT_SELECTABLE 0x0002
! 908:
! 909: /* STATUSDATA.BindInd constants */
! 910:
! 911: #define BIND_UNCHANGED 0x0000
! 912: #define BIND_CHILD 0x0001
! 913: #define BIND_NONE 0x0002
! 914:
1.1 root 915: typedef struct _STATUSDATA { /* stsdata */
1.1.1.2 ! root 916: USHORT Length;
1.1 root 917: USHORT SelectInd;
1.1.1.2 ! root 918: USHORT BondInd;
1.1 root 919: } STATUSDATA;
920: typedef STATUSDATA FAR *PSTATUSDATA;
921:
922: USHORT APIENTRY DosStartSession(PSTARTDATA, PUSHORT, PUSHORT);
923: USHORT APIENTRY DosSetSession(USHORT, PSTATUSDATA);
924: USHORT APIENTRY DosSelectSession(USHORT, ULONG);
925: USHORT APIENTRY DosStopSession(USHORT, USHORT, ULONG);
926: USHORT APIENTRY DosQAppType(PSZ, PUSHORT);
927:
928: #endif /* INCL_DOSSESMGR */
929:
930:
931: /*** Device support */
932:
933: #ifdef INCL_DOSDEVICES
934:
1.1.1.2 ! root 935: /* DosPhysicalDisk() physical disk information */
! 936:
! 937: #define INFO_COUNT_PARTITIONABLE_DISKS 0x0001
! 938: #define INFO_GETIOCTLHANDLE 0x0002
! 939: #define INFO_FREEIOCTLHANDLE 0x0003
! 940:
! 941: /* DosDevConfig information requests */
! 942:
! 943: #define DEVINFO_PRINTER 0x0000
! 944: #define DEVINFO_RS232 0x0001
! 945: #define DEVINFO_FLOPPY 0x0002
! 946: #define DEVINFO_COPROCESSOR 0x0003
! 947: #define DEVINFO_SUBMODEL 0x0004
! 948: #define DEVINFO_MODEL 0x0005
! 949: #define DEVINFO_ADAPTER 0x0006
! 950:
! 951:
1.1 root 952: USHORT APIENTRY DosDevConfig(PVOID, USHORT, USHORT);
953: USHORT APIENTRY DosDevIOCtl(PVOID, PVOID, USHORT, USHORT, HFILE);
954:
955: USHORT APIENTRY DosCLIAccess(VOID);
956: USHORT APIENTRY DosPortAccess(USHORT, USHORT, USHORT, USHORT);
957: USHORT APIENTRY DosPhysicalDisk(USHORT, PBYTE, USHORT, PBYTE, USHORT);
958:
959: USHORT APIENTRY DosR2StackRealloc(USHORT);
960: VOID APIENTRY DosCallback(PFN);
961:
962: #endif /* INCL_DOSDEVICES */
963:
964:
1.1.1.2 ! root 965: /*** DosNamedPipes API Support */
! 966:
! 967: #ifdef INCL_DOSNMPIPES
! 968:
! 969: /* DosPeekNmPipe() pipe states */
! 970:
! 971: #define PIPE_STATE_DISCONNECTED 0x0001
! 972: #define PIPE_STATE_LISTENING 0x0002
! 973: #define PIPE_STATE_CONNECTED 0x0003
! 974: #define PIPE_STATE_CLOSING 0x0004
! 975:
! 976: /* DosMakeNmPipe constants */
! 977:
! 978: #define PIPE_ACCESS_INBOUND 0x0000
! 979: #define PIPE_ACCESS_OUTBOUND 0x0001
! 980: #define PIPE_ACCESS_DUPLEX 0x0002
! 981: #define PIPE_INHERIT 0x0000
! 982: #define PIPE_NOINHERIT 0x0080
! 983: #define PIPE_WRITEBEHIND 0x0000
! 984: #define PIPE_NOWRITEBEHIND 0x4000
! 985:
! 986: typedef struct _PIPEINFO { /* nmpinf */
! 987: USHORT cbOut;
! 988: USHORT cbIn;
! 989: BYTE cbMaxInst;
! 990: BYTE cbCurInst;
! 991: BYTE cbName;
! 992: CHAR szName[1];
! 993: } PIPEINFO;
! 994: typedef PIPEINFO FAR *PPIPEINFO;
! 995:
! 996: typedef SHANDLE HPIPE; /* hp */
! 997: typedef HPIPE FAR *PHPIPE;
! 998:
! 999: USHORT APIENTRY DosCallNmPipe(PSZ, PBYTE, USHORT, PBYTE, USHORT, PUSHORT, ULONG);
! 1000: USHORT APIENTRY DosConnectNmPipe(HPIPE);
! 1001: USHORT APIENTRY DosDisConnectNmPipe(HPIPE);
! 1002: USHORT APIENTRY DosMakeNmPipe(PSZ, PHPIPE, USHORT, USHORT, USHORT, USHORT, ULONG);
! 1003: USHORT APIENTRY DosPeekNmPipe(HPIPE, PBYTE, USHORT, PUSHORT, PUSHORT, PUSHORT);
! 1004: USHORT APIENTRY DosQNmPHandState(HPIPE, PUSHORT);
! 1005: USHORT APIENTRY DosQNmPipeInfo(HPIPE, USHORT, PBYTE, USHORT);
! 1006: USHORT APIENTRY DosQNmPipeSemState(HSEM, PBYTE, USHORT);
! 1007: USHORT APIENTRY DosSetNmPHandState(HPIPE, USHORT);
! 1008: USHORT APIENTRY DosSetNmPipeSem(HPIPE, HSEM, USHORT);
! 1009: USHORT APIENTRY DosTransactNmPipe(HPIPE, PBYTE, USHORT, PBYTE, USHORT, PUSHORT);
! 1010: USHORT APIENTRY DosWaitNmPipe(PSZ, ULONG);
! 1011:
! 1012: #endif /* INCL_DOSNMPIPES */
! 1013:
1.1 root 1014: /*** DosProfile API support */
1015:
1016: #ifdef INCL_DOSPROFILE
1017:
1018: /* DosProfile ordinal number */
1019:
1020: #define PROF_ORDINAL 133
1021:
1022: /* DosProfile usType */
1023:
1024: #define PROF_SYSTEM 0
1025: #define PROF_USER 1
1026: #define PROF_USEDD 2
1027: #define PROF_KERNEL 4
1028: #define PROF_VERBOSE 8
1029: #define PROF_ENABLE 16
1030:
1031: /* DosProfile usFunc */
1032:
1033: #define PROF_ALLOC 0
1034: #define PROF_CLEAR 1
1035: #define PROF_ON 2
1036: #define PROF_OFF 3
1037: #define PROF_DUMP 4
1038: #define PROF_FREE 5
1039:
1040: /* DosProfile tic count granularity (DWORD) */
1041:
1042: #define PROF_SHIFT 2
1043:
1044: /* DosProfile module name string length */
1045:
1046: #define PROF_MOD_NAME_SIZE 10
1047:
1048: /* DosProfile error code for end of data */
1049:
1050: #define PROF_END_OF_DATA 13
1051:
1052: #endif /* INCL_DOSPROFILE */
1.1.1.2 ! root 1053:
! 1054: #ifdef INCL_DOSMISC
! 1055:
! 1056: /*** Miscelanious functions ***/
! 1057:
! 1058: /* DosError() error-handling types */
! 1059:
! 1060: #define HARDERROR_ENABLE 0x0001
! 1061: #define HARDERROR_DISABLE 0x0000
! 1062: #define EXCEPTION_ENABLE 0x0000
! 1063: #define EXCEPTION_DISABLE 0x0002
! 1064:
! 1065: /* DosGetMachineMode() machine modes */
! 1066:
! 1067: #define MODE_REAL 0x0000
! 1068: #define MODE_PROTECTED 0x0001
! 1069:
! 1070: /* DosSetVec vectors */
! 1071:
! 1072: #define VECTOR_DIVIDE_BY_ZERO 0x0000
! 1073: #define VECTOR_OVERFLOW 0x0004
! 1074: #define VECTOR_OUTOFBOUNDS 0x0005
! 1075: #define VECTOR_INVALIDOPCODE 0x0006
! 1076: #define VECTOR_NO_EXTENSION 0x0007
! 1077: #define VECTOR_EXTENSION_ERROR 0x0010
! 1078:
! 1079:
! 1080: USHORT APIENTRY DosError(USHORT);
! 1081: USHORT APIENTRY DosErrClass(USHORT, PUSHORT, PUSHORT, PUSHORT);
! 1082: USHORT APIENTRY DosSetVec(USHORT, PFN, PPFN);
! 1083: USHORT APIENTRY DosQSysInfo(USHORT, PBYTE, USHORT);
! 1084: USHORT APIENTRY DosGetEnv(PUSHORT, PUSHORT);
! 1085: USHORT APIENTRY DosScanEnv(PSZ, PSZ FAR *);
! 1086: USHORT APIENTRY DosGetVersion(PUSHORT);
! 1087: USHORT APIENTRY DosGetMachineMode(PBYTE);
! 1088:
! 1089: #endif /* INCL_DOSMISC */
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.