|
|
1.1 root 1: /***************************************************************************\
2: *
3: * Module Name: OS2DEF.H
4: *
5: * OS/2 Common Definitions file
6: *
7: * This file is compatible with OS/2 version 1.0.
8: *
9: * Copyright (c) 1988 IBM Corporation
10: * Copyright (c) 1988 Microsoft Corporation
11: *
12: \***************************************************************************/
13:
14: #define PASCAL pascal
15: #define FAR far
16: #define NEAR near
17: #define VOID void
18:
19: typedef unsigned short SHANDLE;
20: typedef void far *LHANDLE;
21:
22: #define EXPENTRY pascal far
23: #define APIENTRY pascal far
24:
25: #define CHAR char /* ch */
26: #define SHORT int /* s */
27: #define LONG long /* l */
28: #define INT int /* i */
29:
30: typedef unsigned char UCHAR; /* uch */
31: typedef unsigned int USHORT; /* us */
32: typedef unsigned long ULONG; /* ul */
33: typedef unsigned int UINT; /* ui */
34:
35: typedef unsigned char BYTE; /* b */
36:
37: typedef char far *PSZ;
38: typedef char *NPSZ;
39:
40: typedef char far *PCH;
41: typedef char *NPCH;
42:
43: typedef int (pascal far *PFN)();
44: typedef int (pascal near *NPFN)();
45: typedef int (pascal far * far *PPFN)();
46:
47: typedef BYTE FAR *PBYTE;
48: typedef BYTE *NPBYTE;
49:
50: typedef CHAR FAR *PCHAR;
51: typedef SHORT FAR *PSHORT;
52: typedef LONG FAR *PLONG;
53: typedef INT FAR *PINT;
54:
55: typedef UCHAR FAR *PUCHAR;
56: typedef USHORT FAR *PUSHORT;
57: typedef ULONG FAR *PULONG;
58: typedef UINT FAR *PUINT;
59:
60: typedef VOID FAR *PVOID;
61:
62: typedef unsigned short BOOL; /* f */
63: typedef BOOL FAR *PBOOL;
64:
65: #define FALSE 0
66: #define TRUE 1
67:
68: typedef unsigned short SEL; /* sel */
69: typedef SEL FAR *PSEL;
70:
71: typedef SHANDLE HFILE; /* hf */
72: typedef HFILE FAR *PHFILE;
73:
74: /*
75: * The HSEM type is used in structures and functions that take both
76: * a system semaphore handle, or a far pointer to a RAM semaphore.
77: * It is declared as VOID FAR * so that the use of both types of
78: * semaphores will not result in a compiler warning.
79: */
80: typedef VOID FAR *HSEM; /* hsem */
81: typedef HSEM FAR *PHSEM;
82:
83: /*** Useful Helper Macros */
84:
85: /* Create untyped far pointer from selector and offset */
86: #define MAKEP(sel, off) ((PVOID)MAKEULONG(off, sel))
87:
88: /* Extract selector or offset from far pointer */
89: #define SELECTOROF(p) (((PUSHORT)&(p))[1])
90: #define OFFSETOF(p) (((PUSHORT)&(p))[0])
91:
92: /* Cast any variable to an instance of the specified type. */
93: #define MAKETYPE(v, type) (*((type far *)&v))
94:
95: /* Calculate the byte offset of a field in a structure of type type. */
96: #define FIELDOFFSET(type, field) ((SHORT)&(((type *)0)->field))
97:
98: /* Combine l & h to form a 32 bit quantity. */
99: #define MAKEULONG(l, h) ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
100: #define MAKELONG(l, h) ((LONG)MAKEULONG(l, h))
101:
102: /* Combine l & h to form a 16 bit quantity. */
103: #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
104: #define MAKESHORT(l, h) ((SHORT)MAKEUSHORT(l, h))
105:
106: /* Extract high and low order parts of 16 and 32 bit quantity */
107: #define LOBYTE(w) LOUCHAR(w)
108: #define HIBYTE(w) HIUCHAR(w)
109: #define LOUCHAR(w) ((UCHAR)(w))
110: #define HIUCHAR(w) (((USHORT)(w) >> 8) & 0xff)
111: #define LOUSHORT(l) ((USHORT)(l))
112: #define HIUSHORT(l) ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
113:
114: /*** Common Error definitions ****/
115:
116: typedef ULONG ERRORID; /* errid */
117: typedef ERRORID FAR *PERRORID;
118:
119: /* Combine severity and error code to produce ERRORID */
120: #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
121:
122: /* Severity codes */
123: #define SEVERITY_NOERROR 0x0000
124: #define SEVERITY_WARNING 0x0004
125: #define SEVERITY_ERROR 0x0008
126: #define SEVERITY_SEVERE 0x000C
127: #define SEVERITY_UNRECOVERABLE 0x0010
128:
129: /* Base component error values */
130:
131: #define WINERR_BASE 0x1000 /* Window Manager */
132: #define GPIERR_BASE 0x2000 /* Graphics Presentation Interface */
133: #define DEVERR_BASE 0x3000 /* Device Manager */
134: #define SPLERR_BASE 0x4000 /* Spooler */
135:
136: /*** Common types used across components */
137:
138: /*** Common DOS types */
139:
140: typedef USHORT HMODULE; /* hmod */
141: typedef HMODULE FAR *PHMODULE;
142:
143: typedef USHORT PID; /* pid */
144: typedef PID FAR *PPID;
145:
146: typedef USHORT TID; /* tid */
147: typedef TID FAR *PTID;
148:
149: /*** Common SUP types */
150:
151: typedef LHANDLE HAB; /* hab */
152: typedef HAB FAR *PHAB;
153:
154: /*** Common GPI/DEV types */
155:
156: typedef LHANDLE HPS; /* hps */
157: typedef HPS FAR *PHPS;
158:
159: typedef LHANDLE HDC; /* hdc */
160: typedef HDC FAR *PHDC;
161:
162: typedef LHANDLE HRGN; /* hrgn */
163: typedef HRGN FAR *PHRGN;
164:
165: typedef LHANDLE HBITMAP; /* hbm */
166: typedef HBITMAP FAR *PHBITMAP;
167:
168: typedef LHANDLE HMF; /* hmf */
169: typedef HMF FAR *PHMF;
170:
171: typedef ULONG COLOR; /* clr */
172: typedef COLOR FAR *PCOLOR;
173:
174: /* common DOS/SHL types */
175:
176: /* File time and date types */
177:
178: typedef struct _FTIME { /* ftime */
179: unsigned twosecs : 5;
180: unsigned minutes : 6;
181: unsigned hours : 5;
182: } FTIME;
183: typedef FTIME FAR *PFTIME;
184:
185: typedef struct _FDATE { /* fdate */
186: unsigned day : 5;
187: unsigned month : 4;
188: unsigned year : 7;
189: } FDATE;
190: typedef FDATE FAR *PFDATE;
191:
192: typedef struct _FILEFINDBUF { /* findbuf */
193: FDATE fdateCreation;
194: FTIME ftimeCreation;
195: FDATE fdateLastAccess;
196: FTIME ftimeLastAccess;
197: FDATE fdateLastWrite;
198: FTIME ftimeLastWrite;
199: ULONG cbFile;
200: ULONG cbFileAlloc;
201: USHORT attrFile;
202: UCHAR cchName;
203: CHAR achName[13];
204: } FILEFINDBUF;
205: typedef FILEFINDBUF FAR *PFILEFINDBUF;
206:
207: /*** Common WIN types */
208:
209: typedef LHANDLE HWND; /* hwnd */
210: typedef HWND FAR *PHWND;
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.