home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c034 / 7.ddi / INC11 / OS2DEF.H$ / OS2DEF.bin
Encoding:
Text File  |  1990-01-09  |  10.8 KB  |  416 lines

  1. /**************************************************************************\
  2. *
  3. * Module Name: OS2DEF.H
  4. *
  5. * OS/2 Common Definitions file
  6. *
  7. * Copyright (c) 1987-1990, Microsoft Corporation. All rights reserved.
  8. *
  9. \**************************************************************************/
  10.  
  11. #define PASCAL  pascal
  12. #define FAR     far
  13. #define NEAR    near
  14. #define VOID    void
  15.  
  16. typedef unsigned short SHANDLE;
  17. typedef void far      *LHANDLE;
  18.  
  19. #define EXPENTRY pascal far
  20. #define APIENTRY pascal far
  21. #define CALLBACK pascal far _loadds _export
  22.  
  23. #define CHAR    char            /* ch  */
  24. #define SHORT   short           /* s   */
  25. #define LONG    long            /* l   */
  26. #ifndef INCL_SAADEFS
  27. #define INT     int             /* i   */
  28. #endif /* !INCL_SAADEFS */
  29.  
  30. typedef unsigned char UCHAR;    /* uch */
  31. typedef unsigned short USHORT;  /* us  */
  32. typedef unsigned long ULONG;    /* ul  */
  33. #ifndef INCL_SAADEFS
  34. typedef unsigned int  UINT;     /* ui  */
  35. #endif /* !INCL_SAADEFS */
  36.  
  37. typedef unsigned char BYTE;     /* b   */
  38.  
  39. /* define NULL pointer value (must match stdlib.h definition) */
  40.  
  41. #ifndef NULL
  42. #if (_MSC_VER >= 600)
  43. #define NULL    ((void *)0)
  44. #elif (defined(M_I86SM) || defined(M_I86MM))
  45. #define NULL    0
  46. #else
  47. #define NULL    0L
  48. #endif
  49. #endif
  50.  
  51. typedef SHANDLE HFILE;          /* hf */
  52. typedef HFILE FAR *PHFILE;
  53.  
  54. typedef char far  *PSZ;
  55. typedef char near *NPSZ;
  56.  
  57. typedef char far  *PCH;
  58. typedef char near *NPCH;
  59.  
  60. typedef int   (pascal far  *PFN)();
  61. typedef int   (pascal near *NPFN)();
  62. typedef PFN FAR *PPFN;
  63.  
  64. typedef BYTE   FAR  *PBYTE;
  65. typedef BYTE   near *NPBYTE;
  66.  
  67. typedef CHAR   FAR *PCHAR;
  68. typedef SHORT  FAR *PSHORT;
  69. typedef LONG   FAR *PLONG;
  70. #ifndef INCL_SAADEFS
  71. typedef INT    FAR *PINT;
  72. #endif /* !INCL_SAADEFS */
  73.  
  74. typedef UCHAR  FAR *PUCHAR;
  75. typedef USHORT FAR *PUSHORT;
  76. typedef ULONG  FAR *PULONG;
  77. #ifndef INCL_SAADEFS
  78. typedef UINT   FAR *PUINT;
  79. #endif /* !INCL_SAADEFS */
  80.  
  81. typedef VOID   FAR *PVOID;
  82.  
  83. typedef unsigned short BOOL;    /* f   */
  84. typedef BOOL FAR *PBOOL;
  85.  
  86. #ifndef FALSE
  87. #define FALSE    0
  88. #endif
  89. #ifndef TRUE
  90. #define TRUE    1
  91. #endif
  92.  
  93. #ifndef INCL_SAADEFS
  94. typedef unsigned short SEL;     /* sel */
  95. typedef SEL FAR *PSEL;
  96.  
  97. /*** Useful Helper Macros */
  98.  
  99. /* Create untyped far pointer from selector and offset */
  100. #define MAKEP(sel, off)     ((PVOID)MAKEULONG(off, sel))
  101.  
  102. /* Extract selector or offset from far pointer */
  103. #define SELECTOROF(p)       (((PUSHORT)&(p))[1])
  104. #define OFFSETOF(p)         (((PUSHORT)&(p))[0])
  105. #endif  /* !INCL_SAADEFS */
  106.  
  107. /* Cast any variable to an instance of the specified type. */
  108. #define MAKETYPE(v, type)   (*((type far *)&v))
  109.  
  110. /* Calculate the byte offset of a field in a structure of type type. */
  111. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  112.  
  113. /* Combine l & h to form a 32 bit quantity. */
  114. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  115. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  116.  
  117. /* Combine l & h to form a 16 bit quantity. */
  118. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  119. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  120.  
  121. /* Extract high and low order parts of 16 and 32 bit quantity */
  122. #define LOBYTE(w)       LOUCHAR(w)
  123. #define HIBYTE(w)       HIUCHAR(w)
  124. #define LOUCHAR(w)      ((UCHAR)(w))
  125. #define HIUCHAR(w)      ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  126. #define LOUSHORT(l)     ((USHORT)(l))
  127. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  128.  
  129. /*** Common Error definitions ****/
  130.  
  131. typedef ULONG ERRORID;  /* errid */
  132. typedef ERRORID FAR *PERRORID;
  133.  
  134. /* Combine severity and error code to produce ERRORID */
  135. #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
  136. /* Extract error number from an errorid */
  137. #define ERRORIDERROR(errid)            (LOUSHORT(errid))
  138. /* Extract severity from an errorid */
  139. #define ERRORIDSEV(errid)              (HIUSHORT(errid))
  140.  
  141. /* Severity codes */
  142. #define SEVERITY_NOERROR                    0x0000
  143. #define SEVERITY_WARNING                    0x0004
  144. #define SEVERITY_ERROR                      0x0008
  145. #define SEVERITY_SEVERE                     0x000C
  146. #define SEVERITY_UNRECOVERABLE              0x0010
  147.  
  148. /* Base component error values */
  149.  
  150. #define WINERR_BASE     0x1000  /* Window Manager                  */
  151. #define GPIERR_BASE     0x2000  /* Graphics Presentation Interface */
  152. #define DEVERR_BASE     0x3000  /* Device Manager                  */
  153. #define SPLERR_BASE     0x4000  /* Spooler                         */
  154.  
  155. /*** Common types used across components */
  156.  
  157. /*** Common DOS types */
  158.  
  159. typedef USHORT    HMODULE;  /* hmod */
  160. typedef HMODULE FAR *PHMODULE;
  161.  
  162. typedef USHORT    PID;      /* pid  */
  163. typedef PID FAR *PPID;
  164.  
  165. typedef USHORT    TID;      /* tid  */
  166. typedef TID FAR *PTID;
  167.  
  168. #ifndef INCL_SAADEFS
  169. typedef VOID FAR *HSEM;     /* hsem */
  170. typedef HSEM FAR *PHSEM;
  171. #endif  /* !INCL_SAADEFS */
  172.  
  173. /*** Common SUP types */
  174.  
  175. typedef LHANDLE   HAB;      /* hab  */
  176. typedef HAB FAR *PHAB;
  177.  
  178. /*** Common GPI/DEV types */
  179.  
  180. typedef LHANDLE   HPS;      /* hps  */
  181. typedef HPS FAR *PHPS;
  182.  
  183. typedef LHANDLE   HDC;      /* hdc  */
  184. typedef HDC FAR *PHDC;
  185.  
  186. typedef LHANDLE   HRGN;     /* hrgn */
  187. typedef HRGN FAR *PHRGN;
  188.  
  189. typedef LHANDLE   HBITMAP;  /* hbm  */
  190. typedef HBITMAP FAR *PHBITMAP;
  191.  
  192. typedef LHANDLE   HMF;      /* hmf  */
  193. typedef HMF FAR *PHMF;
  194.  
  195. typedef LONG     COLOR;    /* clr  */
  196. typedef COLOR FAR *PCOLOR;
  197.  
  198. typedef struct _POINTL  {    /* ptl  */
  199.     LONG  x;
  200.     LONG  y;
  201. } POINTL;
  202. typedef POINTL  FAR  *PPOINTL;
  203. typedef POINTL  near *NPPOINTL;
  204.  
  205. typedef struct _POINTS { /* pts */
  206.     SHORT x;
  207.     SHORT y;
  208. } POINTS;
  209. typedef POINTS FAR *PPOINTS;
  210.  
  211. typedef struct _RECTL {      /* rcl */
  212.     LONG  xLeft;
  213.     LONG  yBottom;
  214.     LONG  xRight;
  215.     LONG  yTop;
  216. } RECTL;
  217. typedef RECTL FAR  *PRECTL;
  218. typedef RECTL near *NPRECTL;
  219.  
  220. typedef CHAR STR8[8];       /* str8 */
  221. typedef STR8 FAR *PSTR8;
  222.  
  223. #ifndef INCL_SAADEFS
  224. /* common DOS/SHL types */
  225.  
  226. /* File time and date types */
  227.  
  228. typedef struct _FTIME {         /* ftime */
  229.     unsigned twosecs : 5;
  230.     unsigned minutes : 6;
  231.     unsigned hours   : 5;
  232. } FTIME;
  233. typedef FTIME FAR *PFTIME;
  234.  
  235. typedef struct _FDATE {         /* fdate */
  236.     unsigned day     : 5;
  237.     unsigned month   : 4;
  238.     unsigned year    : 7;
  239. } FDATE;
  240. typedef FDATE FAR *PFDATE;
  241.  
  242. typedef struct _FILEFINDBUF {   /* findbuf */
  243.     FDATE  fdateCreation;
  244.     FTIME  ftimeCreation;
  245.     FDATE  fdateLastAccess;
  246.     FTIME  ftimeLastAccess;
  247.     FDATE  fdateLastWrite;
  248.     FTIME  ftimeLastWrite;
  249.     ULONG  cbFile;
  250.     ULONG  cbFileAlloc;
  251.     USHORT attrFile;
  252.     UCHAR  cchName;
  253.     CHAR   achName[13];
  254. } FILEFINDBUF;
  255. typedef FILEFINDBUF FAR *PFILEFINDBUF;
  256. #endif  /* !INCL_SAADEFS */
  257.  
  258. /*** common DEV/SPL types */
  259.  
  260. /* structure for Device Driver data */
  261.  
  262. typedef struct _DRIVDATA {      /* driv */
  263.     LONG    cb;
  264.     LONG    lVersion;
  265.     CHAR    szDeviceName[32];
  266.     CHAR    abGeneralData[1];
  267. } DRIVDATA;
  268. typedef DRIVDATA far *PDRIVDATA;
  269.  
  270. /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
  271.  
  272. #define ADDRESS          0
  273. #ifndef INCL_SAADEFS
  274. #define DRIVER_NAME      1
  275. #define DRIVER_DATA      2
  276. #define DATA_TYPE        3
  277. #define COMMENT          4
  278. #define PROC_NAME        5
  279. #define PROC_PARAMS      6
  280. #define SPL_PARAMS       7
  281. #define NETWORK_PARAMS   8
  282.  
  283. /* structure definition as an alternative of the array parameter */
  284.  
  285. typedef struct _DEVOPENSTRUC {    /* dop */
  286.     PSZ        pszLogAddress;
  287.     PSZ        pszDriverName;
  288.     PDRIVDATA  pdriv;
  289.     PSZ        pszDataType;
  290.     PSZ        pszComment;
  291.     PSZ        pszQueueProcName;
  292.     PSZ        pszQueueProcParams;
  293.     PSZ        pszSpoolerParams;
  294.     PSZ        pszNetworkParams;
  295. } DEVOPENSTRUC;
  296. typedef DEVOPENSTRUC FAR *PDEVOPENSTRUC;
  297. #endif  /* !INCL_SAADEFS */
  298.  
  299. /*** common AVIO/GPI types */
  300.  
  301. /* values of fsSelection field of FATTRS structure */
  302. #define FATTR_SEL_ITALIC        0x0001
  303. #define FATTR_SEL_UNDERSCORE    0x0002
  304. #define FATTR_SEL_STRIKEOUT     0x0010
  305. #define FATTR_SEL_BOLD          0x0020
  306.  
  307. /* values of fsType field of FATTRS structure */
  308. #define FATTR_TYPE_FIXED        0x0002
  309. #define FATTR_TYPE_KERNING      0x0004
  310.  
  311. /* values of fsFontUse field of FATTRS structure */
  312. #define FATTR_FONTUSE_NOMIX         0x0002
  313. #define FATTR_FONTUSE_OUTLINE       0x0004
  314. #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
  315. /* size for fields in the font structures */
  316.  
  317. #define FACESIZE 32
  318.  
  319. /* font struct for Vio/GpiCreateLogFont */
  320.  
  321. typedef struct _FATTRS {          /* fat */
  322.     USHORT  usRecordLength;
  323.     USHORT  fsSelection;
  324.     LONG    lMatch;
  325.     CHAR    szFacename[FACESIZE];
  326.     USHORT  idRegistry;
  327.     USHORT  usCodePage;
  328.     LONG    lMaxBaselineExt;
  329.     LONG    lAveCharWidth;
  330.     USHORT  fsType;
  331.     USHORT  fsFontUse;
  332. } FATTRS;
  333. typedef FATTRS far *PFATTRS;
  334.  
  335. /* font metrics returned by GpiQueryFonts and others */
  336.  
  337. typedef struct _FONTMETRICS {   /* fm */
  338.     CHAR    szFamilyname[FACESIZE];
  339.     CHAR    szFacename[FACESIZE];
  340.     USHORT  idRegistry;
  341.     USHORT  usCodePage;
  342.     LONG    lEmHeight;
  343.     LONG    lXHeight;
  344.     LONG    lMaxAscender;
  345.     LONG    lMaxDescender;
  346.     LONG    lLowerCaseAscent;
  347.     LONG    lLowerCaseDescent;
  348.     LONG    lInternalLeading;
  349.     LONG    lExternalLeading;
  350.     LONG    lAveCharWidth;
  351.     LONG    lMaxCharInc;
  352.     LONG    lEmInc;
  353.     LONG    lMaxBaselineExt;
  354.     SHORT   sCharSlope;
  355.     SHORT   sInlineDir;
  356.     SHORT   sCharRot;
  357.     USHORT  usWeightClass;
  358.     USHORT  usWidthClass;
  359.     SHORT   sXDeviceRes;
  360.     SHORT   sYDeviceRes;
  361.     SHORT   sFirstChar;
  362.     SHORT   sLastChar;
  363.     SHORT   sDefaultChar;
  364.     SHORT   sBreakChar;
  365.     SHORT   sNominalPointSize;
  366.     SHORT   sMinimumPointSize;
  367.     SHORT   sMaximumPointSize;
  368.     USHORT  fsType;
  369.     USHORT  fsDefn;
  370.     USHORT  fsSelection;
  371.     USHORT  fsCapabilities;
  372.     LONG    lSubscriptXSize;
  373.     LONG    lSubscriptYSize;
  374.     LONG    lSubscriptXOffset;
  375.     LONG    lSubscriptYOffset;
  376.     LONG    lSuperscriptXSize;
  377.     LONG    lSuperscriptYSize;
  378.     LONG    lSuperscriptXOffset;
  379.     LONG    lSuperscriptYOffset;
  380.     LONG    lUnderscoreSize;
  381.     LONG    lUnderscorePosition;
  382.     LONG    lStrikeoutSize;
  383.     LONG    lStrikeoutPosition;
  384.     SHORT   sKerningPairs;
  385.     SHORT   sReserved;
  386.     LONG    lMatch;
  387. } FONTMETRICS;
  388. typedef FONTMETRICS far *PFONTMETRICS;
  389.  
  390. /*** Common WIN types */
  391.  
  392. typedef LHANDLE HWND;      /* hwnd */
  393. typedef HWND FAR *PHWND;
  394.  
  395. typedef struct _WRECT {    /* wrc */
  396.     SHORT xLeft;
  397.     SHORT dummy1;
  398.     SHORT yBottom;
  399.     SHORT dummy2;
  400.     SHORT xRight;
  401.     SHORT dummy3;
  402.     SHORT yTop;
  403.     SHORT dummy4;
  404. } WRECT;
  405. typedef WRECT FAR *PWRECT;
  406. typedef WRECT near *NPWRECT;
  407.  
  408. typedef struct _WPOINT {   /* wpt */
  409.     SHORT x;
  410.     SHORT dummy1;
  411.     SHORT y;
  412.     SHORT dummy2;
  413. } WPOINT;
  414. typedef WPOINT FAR *PWPOINT;
  415. typedef WPOINT near *NPWPOINT;
  416.