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

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