home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / ddkx86v1.zip / DDKX86 / H / OS2DEF16.H < prev    next >
C/C++ Source or Header  |  1995-04-14  |  16KB  |  543 lines

  1. /*DDK*************************************************************************/
  2. /*                                                                           */
  3. /* COPYRIGHT (C) Microsoft Corporation, 1989                                 */
  4. /* COPYRIGHT    Copyright (C) 1995 IBM Corporation                           */
  5. /*                                                                           */
  6. /*    The following IBM OS/2 WARP source code is provided to you solely for  */
  7. /*    the purpose of assisting you in your development of OS/2 WARP device   */
  8. /*    drivers. You may use this code in accordance with the IBM License      */
  9. /*    Agreement provided in the IBM Device Driver Source Kit for OS/2. This  */
  10. /*    Copyright statement may not be removed.                                */
  11. /*                                                                           */
  12. /*****************************************************************************/
  13. /*static char *SCCSID = "@(#)os2def16.h 6.6 92/02/29";*/
  14. /*static char *SCCSID = "@(#)os2def16.h 6.6 92/02/29";*/
  15. /***************************************************************************\
  16. *
  17. * Module Name: OS2DEF16.H
  18. *
  19. * OS/2 Common Definitions file for 16-bit compilations
  20. *
  21. *
  22. \***************************************************************************/
  23.  
  24. #ifndef OS2_INCLUDED
  25. #if !(defined(INCL_32) || defined(INCL_16))
  26. #ifdef M_I386
  27.     #define INCL_32
  28. #else /* not M_I386 */
  29.     #define INCL_16
  30. #endif /* M_I386 */
  31. #endif /* INCL_32 || INCL_16 */
  32. #endif /* OS2_INCLUDED */
  33.  
  34. /* XLATOFF */
  35. #ifdef INCL_32
  36. #error message ("Using 16 bit definitions when compiling 32 bit code")
  37. #endif /* INCL_16 */
  38.  
  39. #ifdef M_I386
  40.  
  41. #define PASCAL          _pascal
  42. #define FAR             _far16
  43. #define NEAR            _near
  44. #define EXPENTRY        PASCAL FAR _loadds
  45. #define APIENTRY        PASCAL FAR
  46. #define APIRET          USHORT
  47.  
  48. #else /* not M_I386 */
  49.  
  50. #define PASCAL          _pascal
  51. #define FAR             _far
  52. #define NEAR            _near
  53. #define EXPENTRY        PASCAL FAR _loadds
  54. #define APIENTRY        PASCAL FAR
  55. #define APIRET          USHORT
  56.  
  57. #endif /* M_I386 */
  58.  
  59. #define VOID    void
  60. /* XLATON */
  61.  
  62. /* XLATOFF */
  63. #ifndef NULL
  64. #if (defined(M_I86SM) || defined(M_I86MM))
  65. /* XLATON */
  66. #define  NULL    0
  67. /* XLATOFF */
  68. #else
  69. #if (defined(M_I86L) || defined(M_I86CM) || defined(M_I86LM) || defined(M_I86HM))
  70. #define  NULL    0L
  71. #else
  72. #define  NULL    0
  73. #endif
  74. #endif
  75. #endif /* ifndef NULL */
  76. /* XLATON */
  77.  
  78. #ifndef FALSE
  79. #define FALSE   0
  80. #endif /* ifndef FALSE */
  81.  
  82. #ifndef TRUE
  83. #define TRUE    1
  84. #endif /* ifndef TRUE */
  85.  
  86. typedef unsigned short  SHANDLE;
  87.  
  88. typedef VOID FAR        *LHANDLE;
  89.  
  90. /* XLATOFF */
  91. #define CHAR    char            /* ch  */
  92. #define SHORT   short           /* s   */
  93. #define LONG    long            /* l   */
  94. #ifndef INCL_SAADEFS
  95. #define INT     int             /* i   */
  96. #endif /* !INCL_SAADEFS */
  97. /* XLATON */
  98.  
  99. typedef unsigned char UCHAR;    /* uch */
  100. typedef unsigned short USHORT;  /* us  */
  101. typedef unsigned long ULONG;    /* ul  */
  102. #ifndef INCL_SAADEFS
  103. typedef unsigned int  UINT;     /* ui  */
  104. #endif /* !INCL_SAADEFS */
  105.  
  106. typedef unsigned char BYTE;     /* b   */
  107.  
  108. typedef unsigned char FAR  *PSZ;
  109. typedef unsigned char NEAR *NPSZ;
  110.  
  111. typedef unsigned char FAR  *PCH;
  112. typedef unsigned char NEAR *NPCH;
  113.  
  114. typedef int   (PASCAL FAR  *PFN)();
  115. typedef int   (PASCAL NEAR *NPFN)();
  116.  
  117. typedef BYTE   FAR  *PBYTE;
  118. typedef BYTE   NEAR *NPBYTE;
  119.  
  120. typedef CHAR   FAR *PCHAR;
  121. typedef SHORT  FAR *PSHORT;
  122. typedef LONG   FAR *PLONG;
  123. #ifndef INCL_SAADEFS
  124. typedef INT    FAR *PINT;
  125. #endif /* !INCL_SAADEFS */
  126.  
  127. typedef UCHAR  FAR *PUCHAR;
  128. typedef USHORT FAR *PUSHORT;
  129. typedef ULONG  FAR *PULONG;
  130. #ifndef INCL_SAADEFS
  131. typedef UINT   FAR *PUINT;
  132. #endif /* !INCL_SAADEFS */
  133.  
  134. typedef VOID   FAR *PVOID;
  135. typedef PVOID  FAR *PPVOID;
  136.  
  137. typedef unsigned short BOOL;    /* f   */
  138. typedef BOOL FAR *PBOOL;
  139.  
  140. /* Quad-word */
  141.  
  142. /* XLATOFF */
  143. typedef struct _QWORD {        /* qword */
  144.         ULONG   ulLo;
  145.         ULONG   ulHi;
  146. } QWORD;
  147.  
  148. typedef QWORD FAR *PQWORD;
  149. /* XLATON */
  150.  
  151.  
  152. #ifndef INCL_SAADEFS
  153.  
  154. typedef unsigned short SEL;     /* sel */
  155. typedef SEL FAR *PSEL;
  156.  
  157. /*** Useful Helper Macros */
  158.  
  159. /* Create untyped far pointer from selector and offset */
  160. #define MAKEP(sel, off)     ((PVOID)MAKEULONG(off, sel))
  161.  
  162. /* Extract selector or offset from far pointer */
  163. #define SELECTOROF(p)       (((PUSHORT)&(p))[1])
  164. #define OFFSETOF(p)         (((PUSHORT)&(p))[0])
  165. #endif  /* !INCL_SAADEFS */
  166.  
  167.  
  168. /* Cast any variable to an instance of the specified type. */
  169. #define MAKETYPE(v, type)   (*((type FAR *)&v))
  170.  
  171. /* Calculate the byte offset of a field in a structure of type type. */
  172. #define FIELDOFFSET(type, field)    ((SHORT)&(((type *)0)->field))
  173.  
  174. /* Combine l & h to form a 32 bit quantity. */
  175. #define MAKEULONG(l, h)  ((ULONG)(((USHORT)(l)) | ((ULONG)((USHORT)(h))) << 16))
  176. #define MAKELONG(l, h)   ((LONG)MAKEULONG(l, h))
  177.  
  178. /* Combine l & h to form a 16 bit quantity. */
  179. #define MAKEUSHORT(l, h) (((USHORT)(l)) | ((USHORT)(h)) << 8)
  180. #define MAKESHORT(l, h)  ((SHORT)MAKEUSHORT(l, h))
  181.  
  182. /* Extract high and low order parts of 16 and 32 bit quantity */
  183. #define LOBYTE(w)       LOUCHAR(w)
  184. #define HIBYTE(w)       HIUCHAR(w)
  185. #define LOUCHAR(w)      ((UCHAR)(w))
  186. #define HIUCHAR(w)      ((UCHAR)(((USHORT)(w) >> 8) & 0xff))
  187. #define LOUSHORT(l)     ((USHORT)(l))
  188. #define HIUSHORT(l)     ((USHORT)(((ULONG)(l) >> 16) & 0xffff))
  189.  
  190. /*** Common Error definitions ****/
  191.  
  192. typedef ULONG ERRORID;  /* errid */
  193. typedef ERRORID FAR *PERRORID;
  194.  
  195. /* Combine severity and error code to produce ERRORID */
  196. #define MAKEERRORID(sev, error) (ERRORID)(MAKEULONG((error), (sev)))
  197. /* Extract error number from an errorid */
  198. #define ERRORIDERROR(errid)            (LOUSHORT(errid))
  199. /* Extract severity from an errorid */
  200. #define ERRORIDSEV(errid)              (HIUSHORT(errid))
  201.  
  202. /* Severity codes */
  203. #define SEVERITY_NOERROR                    0x0000
  204. #define SEVERITY_WARNING                    0x0004
  205. #define SEVERITY_ERROR                      0x0008
  206. #define SEVERITY_SEVERE                     0x000C
  207. #define SEVERITY_UNRECOVERABLE              0x0010
  208.  
  209. /* Base component error values */
  210.  
  211. #define WINERR_BASE     0x1000  /* Window Manager                  */
  212. #define GPIERR_BASE     0x2000  /* Graphics Presentation Interface */
  213. #define DEVERR_BASE     0x3000  /* Device Manager                  */
  214. #define SPLERR_BASE     0x4000  /* Spooler                         */
  215.  
  216. /*** Common types used across components */
  217.  
  218. /*** Common DOS types */
  219.  
  220. typedef SHANDLE HMODULE;        /* hmod */
  221. typedef SHANDLE PID;            /* pid  */
  222. typedef SHANDLE TID;            /* tid  */
  223. #ifndef INCL_SAADEFS
  224. typedef USHORT  SGID;           /* sgid */
  225. #endif  /* !INCL_SAADEFS */
  226.  
  227. typedef HMODULE FAR *PHMODULE;
  228. typedef PID FAR *PPID;
  229. typedef TID FAR *PTID;
  230.  
  231. #ifndef INCL_SAADEFS
  232. typedef VOID FAR *HSEM;     /* hsem */
  233. typedef HSEM FAR *PHSEM;
  234. #endif  /* !INCL_SAADEFS */
  235.  
  236. /*** Common SUP types */
  237.  
  238. typedef LHANDLE   HAB;      /* hab  */
  239. typedef HAB FAR *PHAB;
  240.  
  241. /*** Common GPI/DEV types */
  242.  
  243. typedef LHANDLE   HPS;      /* hps  */
  244. typedef HPS FAR *PHPS;
  245.  
  246. typedef LHANDLE   HDC;      /* hdc  */
  247. typedef HDC FAR *PHDC;
  248.  
  249. typedef LHANDLE   HRGN;     /* hrgn */
  250. typedef HRGN FAR *PHRGN;
  251.  
  252. typedef LHANDLE   HBITMAP;  /* hbm  */
  253. typedef HBITMAP FAR *PHBITMAP;
  254.  
  255. typedef LHANDLE   HMF;      /* hmf  */
  256. typedef HMF FAR *PHMF;
  257.  
  258. typedef LHANDLE   HPAL;     /* hpal */
  259. typedef HPAL FAR *PHPAL;
  260.  
  261. typedef LONG     COLOR;    /* clr  */
  262. typedef COLOR FAR *PCOLOR;
  263.  
  264. typedef struct _POINTL  {    /* ptl  */
  265.     LONG  x;
  266.     LONG  y;
  267. } POINTL;
  268. typedef POINTL  FAR  *PPOINTL;
  269. typedef POINTL  NEAR *NPPOINTL;
  270.  
  271. typedef struct _POINTS { /* pts */
  272.     SHORT x;
  273.     SHORT y;
  274. } POINTS;
  275. typedef POINTS FAR *PPOINTS;
  276.  
  277. typedef struct _RECTL {      /* rcl */
  278.     LONG  xLeft;
  279.     LONG  yBottom;
  280.     LONG  xRight;
  281.     LONG  yTop;
  282. } RECTL;
  283. typedef RECTL FAR  *PRECTL;
  284. typedef RECTL NEAR *NPRECTL;
  285.  
  286. typedef CHAR STR8[8];       /* str8 */
  287. typedef STR8 FAR *PSTR8;
  288.  
  289. /*** common DEV/SPL types */
  290.  
  291. /* structure for Device Driver data */
  292.  
  293. typedef struct _DRIVDATA {      /* driv */
  294.     LONG    cb;
  295.     LONG    lVersion;
  296.     CHAR    szDeviceName[32];
  297.     CHAR    abGeneralData[1];
  298. } DRIVDATA;
  299. typedef DRIVDATA FAR *PDRIVDATA;
  300.  
  301. /* pointer data for DevOpenDC */
  302.  
  303. typedef PSZ FAR *PDEVOPENDATA;
  304.  
  305. /* array indices for array parameter for DevOpenDC, SplQmOpen or SplQpOpen */
  306.  
  307. #define ADDRESS          0
  308. #ifndef INCL_SAADEFS
  309. #define DRIVER_NAME      1
  310. #define DRIVER_DATA      2
  311. #define DATA_TYPE        3
  312. #define COMMENT          4
  313. #define PROC_NAME        5
  314. #define PROC_PARAMS      6
  315. #define SPL_PARAMS       7
  316. #define NETWORK_PARAMS   8
  317.  
  318. /* structure definition as an alternative of the array parameter */
  319.  
  320. typedef struct _DEVOPENSTRUC {    /* dop */
  321.     PSZ        pszLogAddress;
  322.     PSZ        pszDriverName;
  323.     PDRIVDATA  pdriv;
  324.     PSZ        pszDataType;
  325.     PSZ        pszComment;
  326.     PSZ        pszQueueProcName;
  327.     PSZ        pszQueueProcParams;
  328.     PSZ        pszSpoolerParams;
  329.     PSZ        pszNetworkParams;
  330. } DEVOPENSTRUC;
  331. typedef DEVOPENSTRUC FAR *PDEVOPENSTRUC;
  332. #endif  /* !INCL_SAADEFS */
  333.  
  334. /* common PMWP object and PMSTDDLG drag data */
  335.  
  336. typedef struct _PRINTDEST {   /* prntdst */
  337.    ULONG        cb;
  338.    LONG         lType;
  339.    PSZ          pszToken;
  340.    LONG         lCount;
  341.    PDEVOPENDATA pdopData;
  342.    ULONG        fl;
  343.    PSZ          pszPrinter;
  344. } PRINTDEST;
  345. typedef PRINTDEST FAR *PPRINTDEST;
  346.  
  347. #define PD_JOB_PROPERTY   0x0001      /* Flags for .fl field           */
  348.  
  349. /*** common AVIO/GPI types */
  350.  
  351. /* values of fsSelection field of FATTRS structure */
  352. #define FATTR_SEL_ITALIC        0x0001
  353. #define FATTR_SEL_UNDERSCORE    0x0002
  354. #define FATTR_SEL_OUTLINE       0x0008
  355. #define FATTR_SEL_STRIKEOUT     0x0010
  356. #define FATTR_SEL_BOLD          0x0020
  357.  
  358. /* values of fsType field of FATTRS structure */
  359. #define FATTR_TYPE_KERNING      0x0004
  360. #define FATTR_TYPE_MBCS         0x0008
  361. #define FATTR_TYPE_DBCS         0x0010
  362. #define FATTR_TYPE_ANTIALIASED  0x0020
  363.  
  364. /* values of fsFontUse field of FATTRS structure */
  365. #define FATTR_FONTUSE_NOMIX         0x0002
  366. #define FATTR_FONTUSE_OUTLINE       0x0004
  367. #define FATTR_FONTUSE_TRANSFORMABLE 0x0008
  368. /* size for fields in the font structures */
  369.  
  370. #define FACESIZE 32
  371.  
  372. /* font struct for Vio/GpiCreateLogFont */
  373.  
  374. typedef struct _FATTRS {          /* fat */
  375.     USHORT  usRecordLength;
  376.     USHORT  fsSelection;
  377.     LONG    lMatch;
  378.     CHAR    szFacename[FACESIZE];
  379.     USHORT  idRegistry;
  380.     USHORT  usCodePage;
  381.     LONG    lMaxBaselineExt;
  382.     LONG    lAveCharWidth;
  383.     USHORT  fsType;
  384.     USHORT  fsFontUse;
  385. } FATTRS;
  386. typedef FATTRS FAR *PFATTRS;
  387.  
  388. /* values of fsType field of FONTMETRICS structure */
  389. #define FM_TYPE_FIXED           0x0001
  390. #define FM_TYPE_LICENSED        0x0002
  391. #define FM_TYPE_KERNING         0x0004
  392. #define FM_TYPE_DBCS            0x0010
  393. #define FM_TYPE_MBCS            0x0018
  394. #define FM_TYPE_64K             0x8000
  395. #define FM_TYPE_ATOMS           0x4000
  396. #define FM_TYPE_FAMTRUNC        0x2000
  397. #define FM_TYPE_FACETRUNC       0x1000
  398.  
  399.  
  400. /* values of fsDefn field of FONTMETRICS structure */
  401. #define FM_DEFN_OUTLINE         0x0001
  402. #define FM_DEFN_IFI         0x0002
  403. #define FM_DEFN_WIN         0x0004
  404. #define FM_DEFN_GENERIC         0x8000
  405.  
  406. /* values of fsSelection field of FONTMETRICS structure */
  407. #define FM_SEL_ITALIC           0x0001
  408. #define FM_SEL_UNDERSCORE       0x0002
  409. #define FM_SEL_NEGATIVE         0x0004
  410. #define FM_SEL_OUTLINE          0x0008          /* Hollow Outline Font */
  411. #define FM_SEL_STRIKEOUT        0x0010
  412. #define FM_SEL_BOLD             0x0020
  413. #define FM_SEL_ISO9241_TESTED   0x0040
  414.  
  415. /* ISO 9241 is an international standard covering health and safety      */
  416. /* in the work place for users of visual display terminals. Part 3 of    */
  417. /* this standard covers clarity and legibility of text displayed on      */
  418. /* computer screens, it places requirements on minimum sizes and         */
  419. /* luminance contrast. The presence of FM_SEL_ISO9241_TESTED flag in the */
  420. /* font metrics indicates that the font has been tested for compliance   */
  421. /* to the standard. The FM_ISO_XXX flags indicate the results of the     */
  422. /* test on the IBM 9515, 9517 and 9518 color displays at the supported   */
  423. /* dimensions of 640x480 and 1024x768. To ensure compliance the          */
  424. /* sXDeviceRes and sYDeviceRes must also match the target display        */
  425. /* resolution.                                                           */
  426.  
  427. /* values of fbPassed/FailedISO field in the PANOSE structure */
  428. #define FM_ISO_9518_640        0x01
  429. #define FM_ISO_9515_640        0x02
  430. #define FM_ISO_9515_1024       0x04
  431. #define FM_ISO_9517_640        0x08
  432. #define FM_ISO_9517_1024       0x10
  433.  
  434. /* values of fsCapabilities field of FONTMETRICS structure */
  435. #define FM_CAP_NOMIX            0x0001
  436.  
  437. /* font metrics returned by GpiQueryFonts and others */
  438.  
  439. typedef struct _PANOSE { /* panose */
  440.     BYTE    bFamilyType;
  441.     BYTE    bSerifStyle;
  442.     BYTE    bWeight;
  443.     BYTE    bProportion;
  444.     BYTE    bContrast;
  445.     BYTE    bStrokeVariation;
  446.     BYTE    bArmStyle;
  447.     BYTE    bLetterform;
  448.     BYTE    bMidline;
  449.     BYTE    bXHeight;
  450.     BYTE    fbPassedISO;
  451.     BYTE    fbFailedISO;
  452. } PANOSE;
  453.  
  454. typedef struct _FONTMETRICS {   /* fm */
  455.     CHAR    szFamilyname[FACESIZE];
  456.     CHAR    szFacename[FACESIZE];
  457.     USHORT  idRegistry;
  458.     USHORT  usCodePage;
  459.     LONG    lEmHeight;
  460.     LONG    lXHeight;
  461.     LONG    lMaxAscender;
  462.     LONG    lMaxDescender;
  463.     LONG    lLowerCaseAscent;
  464.     LONG    lLowerCaseDescent;
  465.     LONG    lInternalLeading;
  466.     LONG    lExternalLeading;
  467.     LONG    lAveCharWidth;
  468.     LONG    lMaxCharInc;
  469.     LONG    lEmInc;
  470.     LONG    lMaxBaselineExt;
  471.     SHORT   sCharSlope;
  472.     SHORT   sInlineDir;
  473.     SHORT   sCharRot;
  474.     USHORT  usWeightClass;
  475.     USHORT  usWidthClass;
  476.     SHORT   sXDeviceRes;
  477.     SHORT   sYDeviceRes;
  478.     SHORT   sFirstChar;
  479.     SHORT   sLastChar;
  480.     SHORT   sDefaultChar;
  481.     SHORT   sBreakChar;
  482.     SHORT   sNominalPointSize;
  483.     SHORT   sMinimumPointSize;
  484.     SHORT   sMaximumPointSize;
  485.     USHORT  fsType;
  486.     USHORT  fsDefn;
  487.     USHORT  fsSelection;
  488.     USHORT  fsCapabilities;
  489.     LONG    lSubscriptXSize;
  490.     LONG    lSubscriptYSize;
  491.     LONG    lSubscriptXOffset;
  492.     LONG    lSubscriptYOffset;
  493.     LONG    lSuperscriptXSize;
  494.     LONG    lSuperscriptYSize;
  495.     LONG    lSuperscriptXOffset;
  496.     LONG    lSuperscriptYOffset;
  497.     LONG    lUnderscoreSize;
  498.     LONG    lUnderscorePosition;
  499.     LONG    lStrikeoutSize;
  500.     LONG    lStrikeoutPosition;
  501.     SHORT   sKerningPairs;
  502.     SHORT   sFamilyClass;
  503.     LONG    lMatch;
  504. #ifndef PM12
  505. #ifndef PM20
  506.     LONG    FamilyNameAtom;
  507.     LONG    FaceNameAtom;
  508.     PANOSE  panose;
  509. #endif
  510. #endif
  511. } FONTMETRICS;
  512. typedef FONTMETRICS FAR *PFONTMETRICS;
  513.  
  514. /*** Common WIN types */
  515.  
  516. typedef LHANDLE HWND;      /* hwnd */
  517. typedef HWND FAR *PHWND;
  518.  
  519. typedef LHANDLE HMQ;       /* hmq */
  520. typedef LHANDLE FAR *PHMQ;
  521.  
  522. typedef struct _WRECT {    /* wrc */
  523.     SHORT xLeft;
  524.     SHORT dummy1;
  525.     SHORT yBottom;
  526.     SHORT dummy2;
  527.     SHORT xRight;
  528.     SHORT dummy3;
  529.     SHORT yTop;
  530.     SHORT dummy4;
  531. } WRECT;
  532. typedef WRECT FAR *PWRECT;
  533. typedef WRECT NEAR *NPWRECT;
  534.  
  535. typedef struct _WPOINT {   /* wpt */
  536.     SHORT x;
  537.     SHORT dummy1;
  538.     SHORT y;
  539.     SHORT dummy2;
  540. } WPOINT;
  541. typedef WPOINT FAR *PWPOINT;
  542. typedef WPOINT NEAR *NPWPOINT;
  543.