home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / wtypes.idl < prev    next >
Text File  |  1998-04-25  |  46KB  |  1,512 lines

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright 1992 - 1998 Microsoft Corporation.
  5. //
  6. //  File: wtypes.idl
  7. //
  8. //  Contents: This interface definition contains typedefs for remotable
  9. //            data types.
  10. //
  11. //  History:  09-May-96  MikeHill  Updated VARENUM comments.
  12. //            22-May-96  MikeHill  Added FMTID defintions/macros.
  13. //            06-Jun-96  MikeHill  Added CBPCLIPDATA macro.
  14. //
  15. //--------------------------------------------------------------------------
  16.  
  17. cpp_quote("//+-------------------------------------------------------------------------")
  18. cpp_quote("//")
  19. cpp_quote("//  Microsoft Windows")
  20. cpp_quote("//  Copyright 1992 - 1998 Microsoft Corporation.")
  21. cpp_quote("//")
  22. cpp_quote("//--------------------------------------------------------------------------")
  23.  
  24. [ uuid(D3980A60-910C-1068-9341-00DD010F2F1C),
  25.   version(0.1), pointer_default(unique) ]
  26.  
  27. interface IWinTypes
  28. {
  29.  
  30. typedef struct tagRemHGLOBAL
  31. {
  32.         long fNullHGlobal;
  33.         unsigned long cbData;
  34.         [size_is(cbData)] byte data[];
  35. } RemHGLOBAL;
  36.  
  37. typedef struct tagRemHMETAFILEPICT
  38. {
  39.         long        mm;
  40.         long        xExt;
  41.         long        yExt;
  42.         unsigned long cbData;
  43.         [size_is(cbData)] byte data[];
  44. } RemHMETAFILEPICT;
  45.  
  46.  
  47. typedef struct tagRemHENHMETAFILE
  48. {
  49.         unsigned long cbData;
  50.         [size_is(cbData)] byte data[];
  51. } RemHENHMETAFILE;
  52.  
  53. typedef struct tagRemHBITMAP
  54. {
  55.         unsigned long cbData;
  56.         [size_is(cbData)] byte data[];
  57. } RemHBITMAP;
  58.  
  59. typedef struct tagRemHPALETTE
  60. {
  61.         unsigned long cbData;
  62.         [size_is(cbData)] byte data[];
  63. } RemHPALETTE;
  64.  
  65. typedef struct tagRemBRUSH
  66. {
  67.         unsigned long cbData;
  68.         [size_is(cbData)] byte data[];
  69. } RemHBRUSH;
  70.  
  71. cpp_quote("#if !defined(_WIN32) && !defined(_MPPC_)" )
  72. cpp_quote("// The following code is for Win16 only")
  73.  
  74. cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")
  75.  
  76. cpp_quote("#define FAR             _far")
  77. cpp_quote("#define PASCAL          _pascal")
  78. cpp_quote("#define CDECL           _cdecl")
  79.  
  80. cpp_quote("#define VOID            void")
  81. cpp_quote("#define WINAPI      FAR PASCAL")
  82. cpp_quote("#define CALLBACK    FAR PASCAL")
  83.  
  84.  
  85. cpp_quote("#ifndef FALSE")
  86. cpp_quote("#define FALSE 0")
  87. cpp_quote("#define TRUE 1")
  88. cpp_quote("#endif // !FALSE")
  89.  
  90. cpp_quote("#ifndef _BYTE_DEFINED")
  91. cpp_quote("#define _BYTE_DEFINED")
  92. typedef unsigned char BYTE;
  93. cpp_quote("#endif // !_BYTE_DEFINED")
  94.  
  95. cpp_quote("#ifndef _WORD_DEFINED")
  96. cpp_quote("#define _WORD_DEFINED")
  97. typedef unsigned short WORD;
  98. cpp_quote("#endif // !_WORD_DEFINED")
  99.  
  100. typedef unsigned int UINT;
  101. typedef int  INT;
  102. typedef long BOOL;
  103.  
  104. cpp_quote("#ifndef _LONG_DEFINED")
  105. cpp_quote("#define _LONG_DEFINED")
  106. typedef long LONG;
  107. cpp_quote("#endif // !_LONG_DEFINED")
  108.  
  109. cpp_quote("#ifndef _WPARAM_DEFINED")
  110. cpp_quote("#define _WPARAM_DEFINED")
  111. typedef UINT WPARAM;
  112. cpp_quote("#endif // _WPARAM_DEFINED")
  113.  
  114. cpp_quote("#ifndef _DWORD_DEFINED")
  115. cpp_quote("#define _DWORD_DEFINED")
  116. typedef unsigned long DWORD;
  117. cpp_quote("#endif // !_DWORD_DEFINED")
  118.  
  119. cpp_quote("#ifndef _LPARAM_DEFINED")
  120. cpp_quote("#define _LPARAM_DEFINED")
  121. typedef LONG LPARAM;// this should be a discriminated union.
  122. cpp_quote("#endif // !_LPARAM_DEFINED")
  123.  
  124. cpp_quote("#ifndef _LRESULT_DEFINED")
  125. cpp_quote("#define _LRESULT_DEFINED")
  126. typedef LONG LRESULT;
  127. cpp_quote("#endif // !_LRESULT_DEFINED")
  128.  
  129. typedef void * HANDLE;
  130. #define DECLARE_WIREM_HANDLE(name)  \
  131.                              typedef [wire_marshal(wire ## name)] void * name
  132. #define DECLARE_HANDLE(name) typedef void * name
  133.  
  134. DECLARE_HANDLE(HMODULE);
  135. DECLARE_HANDLE(HINSTANCE);
  136. DECLARE_HANDLE(HRGN);
  137. DECLARE_HANDLE(HTASK);
  138. DECLARE_HANDLE(HKEY);
  139.  
  140. DECLARE_HANDLE(HDESK);
  141.  
  142. DECLARE_HANDLE(HMF);
  143. DECLARE_HANDLE(HEMF);
  144.  
  145. DECLARE_HANDLE(HPEN);
  146. DECLARE_HANDLE(HRSRC);
  147. DECLARE_HANDLE(HSTR);
  148. DECLARE_HANDLE(HWINSTA);
  149. DECLARE_HANDLE(HKL);
  150. DECLARE_HANDLE(HGDIOBJ);
  151.  
  152. typedef HANDLE HDWP;
  153.  
  154. cpp_quote("#ifndef _HFILE_DEFINED")
  155. cpp_quote("#define _HFILE_DEFINED")
  156. typedef INT HFILE;      /* Polymorphic with C runtime file handle type */
  157. cpp_quote("#endif // !_HFILE_DEFINED")
  158.  
  159.  
  160. cpp_quote("#ifndef _LPWORD_DEFINED")
  161. cpp_quote("#define _LPWORD_DEFINED")
  162. typedef WORD *LPWORD;
  163. cpp_quote("#endif // !_LPWORD_DEFINED")
  164.  
  165.  
  166. cpp_quote("#ifndef _LPDWORD_DEFINED")
  167. cpp_quote("#define _LPDWORD_DEFINED")
  168. typedef DWORD *LPDWORD;
  169. cpp_quote("#endif // !_LPDWORD_DEFINED")
  170.  
  171.  
  172. typedef char CHAR;
  173. typedef [string] CHAR *LPSTR;
  174. typedef [string] const CHAR *LPCSTR;
  175.  
  176.  
  177. cpp_quote("#ifndef _WCHAR_DEFINED")
  178. cpp_quote("#define _WCHAR_DEFINED")
  179. typedef wchar_t WCHAR;
  180. typedef WCHAR   TCHAR;
  181. cpp_quote("#endif // !_WCHAR_DEFINED")
  182.  
  183. typedef [string] WCHAR *LPWSTR;
  184.  
  185.  
  186. typedef [string] TCHAR *LPTSTR;
  187.  
  188. typedef [string] const WCHAR *LPCWSTR;
  189. typedef [string] const TCHAR *LPCTSTR;
  190.  
  191.  
  192. typedef struct tagPALETTEENTRY {
  193.     BYTE        peRed;
  194.     BYTE        peGreen;
  195.     BYTE        peBlue;
  196.     BYTE        peFlags;
  197. } PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;
  198.  
  199. // Logical Palette
  200. cpp_quote("#if 0")
  201.  
  202.     typedef struct tagLOGPALETTE {
  203.         WORD        palVersion;
  204.         WORD        palNumEntries;
  205.         [size_is(palNumEntries)] PALETTEENTRY        palPalEntry[];
  206.     } LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;
  207.  
  208. cpp_quote("#else")
  209. cpp_quote("typedef struct tagLOGPALETTE {")
  210. cpp_quote("    WORD        palVersion;")
  211. cpp_quote("    WORD        palNumEntries;")
  212. cpp_quote("    PALETTEENTRY        palPalEntry[1];")
  213. cpp_quote("} LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;")
  214. cpp_quote("#endif")
  215.  
  216.  
  217. cpp_quote("#ifndef _COLORREF_DEFINED")
  218. cpp_quote("#define _COLORREF_DEFINED")
  219. typedef DWORD COLORREF;
  220. cpp_quote("#endif // !_COLORREF_DEFINED")
  221.  
  222. cpp_quote("#ifndef _LPCOLORREF_DEFINED")
  223. cpp_quote("#define _LPCOLORREF_DEFINED")
  224. typedef DWORD *LPCOLORREF;
  225. cpp_quote("#endif // !_LPCOLORREF_DEFINED")
  226.  
  227.  
  228. typedef HANDLE *LPHANDLE;
  229.  
  230. //typedefs for remotable types from wingdi.h
  231.  
  232. typedef struct _RECTL
  233. {
  234.     LONG    left;
  235.     LONG    top;
  236.     LONG    right;
  237.     LONG    bottom;
  238. } RECTL, *PRECTL, *LPRECTL;
  239.  
  240.  
  241. typedef struct tagPOINT
  242. {
  243.     LONG  x;
  244.     LONG  y;
  245. } POINT, *PPOINT, *LPPOINT;
  246.  
  247. typedef struct _POINTL
  248. {
  249.     LONG  x;
  250.     LONG  y;
  251. } POINTL, *PPOINTL;
  252.  
  253.  
  254. cpp_quote("#ifndef WIN16")
  255. typedef struct tagSIZE
  256. {
  257.     LONG        cx;
  258.     LONG        cy;
  259. } SIZE, *PSIZE, *LPSIZE;
  260. cpp_quote("#else // WIN16")
  261. cpp_quote("typedef struct tagSIZE")
  262. cpp_quote("{")
  263. cpp_quote("    INT cx;")
  264. cpp_quote("    INT cy;")
  265. cpp_quote("} SIZE, *PSIZE, *LPSIZE;")
  266. cpp_quote("#endif // WIN16")
  267.  
  268.  
  269. typedef struct tagSIZEL
  270. {
  271.     LONG cx;
  272.     LONG cy;
  273. } SIZEL, *PSIZEL, *LPSIZEL;
  274.  
  275.  
  276. cpp_quote("#endif  //WINAPI")
  277. cpp_quote("#endif  //!WIN32 && !MPPC")
  278.  
  279. cpp_quote("#if defined(_WIN32) && !defined(OLE2ANSI)")
  280.  
  281. typedef WCHAR                   OLECHAR;
  282. typedef [string] OLECHAR       *LPOLESTR;
  283. typedef [string] const OLECHAR *LPCOLESTR;
  284. cpp_quote("#define OLESTR(str) L##str")
  285.  
  286. cpp_quote("")
  287. cpp_quote("#else")
  288. cpp_quote("")
  289.  
  290. cpp_quote("typedef char      OLECHAR;")
  291. cpp_quote("typedef LPSTR     LPOLESTR;")
  292. cpp_quote("typedef LPCSTR    LPCOLESTR;")
  293. cpp_quote("#define OLESTR(str) str")
  294.  
  295. cpp_quote("#endif")
  296.  
  297.  
  298. // This block contains types that are normally defined by the nt sdk in WINDEF.H
  299. // but we need them here for definitions that follow in this file.  If WINDEF.H
  300. // hasn't been included then we need to define them now so that WTYPES.H
  301. // will compile.
  302. cpp_quote("#ifndef _WINDEF_")
  303. typedef const RECTL *LPCRECTL;
  304.  
  305. typedef void * PVOID, * LPVOID;
  306. typedef float   FLOAT;
  307.  
  308. typedef struct tagRECT
  309. {
  310.     LONG    left;
  311.     LONG    top;
  312.     LONG    right;
  313.     LONG    bottom;
  314. } RECT, *PRECT, *LPRECT;
  315. typedef const RECT *LPCRECT;
  316.  
  317. cpp_quote("#endif  //_WINDEF_")
  318.  
  319.  
  320. typedef unsigned char   UCHAR;
  321. typedef short           SHORT;
  322. typedef unsigned short  USHORT;
  323. typedef DWORD           ULONG;
  324. typedef double          DOUBLE;
  325.  
  326. cpp_quote("#ifndef _DWORDLONG_")
  327. typedef unsigned __int64 DWORDLONG;
  328. typedef DWORDLONG *PDWORDLONG;
  329. cpp_quote("#endif // !_DWORDLONG_")
  330.  
  331. //
  332. // __int64 is only supported by 2.0 and later midl.
  333. // __midl is set by the 2.0 midl and not by 1.0 midl.
  334. //
  335.  
  336. cpp_quote("#ifndef _ULONGLONG_")
  337.  
  338. #if (defined(__midl))
  339. typedef __int64 LONGLONG;
  340. typedef unsigned __int64 ULONGLONG;
  341. #else
  342. typedef double LONGLONG;
  343. typedef double ULONGLONG;
  344. #endif
  345.  
  346. typedef LONGLONG *PLONGLONG;
  347. typedef ULONGLONG *PULONGLONG;
  348. cpp_quote("#endif // _ULONGLONG_")
  349.  
  350. // just for local wtypes
  351. cpp_quote("#if 0")
  352.  
  353. typedef struct _LARGE_INTEGER {
  354.     LONGLONG QuadPart;
  355. } LARGE_INTEGER;
  356.  
  357. typedef LARGE_INTEGER *PLARGE_INTEGER;
  358.  
  359. typedef struct _ULARGE_INTEGER {
  360.     ULONGLONG QuadPart;
  361. } ULARGE_INTEGER;
  362.  
  363. // just for local wtypes
  364. cpp_quote("#endif // 0")
  365.  
  366.  
  367. cpp_quote("#ifndef _WINBASE_")
  368.  
  369. cpp_quote("#ifndef _FILETIME_")
  370. cpp_quote("#define _FILETIME_")
  371. typedef struct _FILETIME
  372. {
  373.     DWORD dwLowDateTime;
  374.     DWORD dwHighDateTime;
  375. } FILETIME, *PFILETIME, *LPFILETIME;
  376. cpp_quote("#endif // !_FILETIME")
  377.  
  378. cpp_quote("#ifndef _SYSTEMTIME_")
  379. cpp_quote("#define _SYSTEMTIME_")
  380. typedef struct _SYSTEMTIME {
  381.     WORD wYear;
  382.     WORD wMonth;
  383.     WORD wDayOfWeek;
  384.     WORD wDay;
  385.     WORD wHour;
  386.     WORD wMinute;
  387.     WORD wSecond;
  388.     WORD wMilliseconds;
  389. } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
  390.  
  391. cpp_quote("#endif // !_SYSTEMTIME")
  392.  
  393. cpp_quote("#ifndef _SECURITY_ATTRIBUTES_")
  394. cpp_quote("#define _SECURITY_ATTRIBUTES_")
  395. typedef struct _SECURITY_ATTRIBUTES {
  396.     DWORD nLength;
  397.     [size_is(nLength)] LPVOID lpSecurityDescriptor;
  398.     BOOL bInheritHandle;
  399. } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
  400. cpp_quote("#endif // !_SECURITY_ATTRIBUTES_")
  401.  
  402. cpp_quote("#ifndef SECURITY_DESCRIPTOR_REVISION")
  403.  
  404. typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
  405.  
  406. typedef PVOID PSID;     // winnt
  407.  
  408. typedef struct _ACL {
  409.     UCHAR AclRevision;
  410.     UCHAR Sbz1;
  411.     USHORT AclSize;
  412.     USHORT AceCount;
  413.     USHORT Sbz2;
  414. } ACL;
  415. typedef ACL *PACL;
  416.  
  417. typedef struct _SECURITY_DESCRIPTOR {
  418.     UCHAR Revision;
  419.     UCHAR Sbz1;
  420.     SECURITY_DESCRIPTOR_CONTROL Control;
  421.     PSID Owner;
  422.     PSID Group;
  423.     PACL Sacl;
  424.     PACL Dacl;
  425. } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
  426.  
  427. cpp_quote("#endif // !SECURITY_DESCRIPTOR_REVISION")
  428.  
  429. cpp_quote("#endif //_WINBASE_")
  430.  
  431. typedef struct _COAUTHIDENTITY
  432. {
  433.   [size_is(UserLength+1)] USHORT *      User;
  434.   ULONG                                 UserLength;
  435.   [size_is(DomainLength+1)] USHORT *    Domain;
  436.   ULONG                                 DomainLength;
  437.   [size_is(PasswordLength+1)] USHORT *  Password;
  438.   ULONG                                 PasswordLength;
  439.   ULONG                                 Flags;
  440. } COAUTHIDENTITY;
  441.  
  442. typedef struct _COAUTHINFO
  443. {
  444.     DWORD               dwAuthnSvc;
  445.     DWORD               dwAuthzSvc;
  446.     LPWSTR              pwszServerPrincName;
  447.     DWORD               dwAuthnLevel;
  448.     DWORD               dwImpersonationLevel;
  449.     COAUTHIDENTITY *    pAuthIdentityData;
  450.     DWORD               dwCapabilities;
  451. } COAUTHINFO;
  452.  
  453. //
  454. // SCODE, HRESULT
  455. //
  456. //
  457. //  Status values are 32 bit values layed out as follows:
  458. //
  459. //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  460. //   1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0 9 8 7 6 5 4 3 2 1 0
  461. //  +-+-----------------------------+-------------------------------+
  462. //  |S|       Facility              |               Code            |
  463. //  +-+-----------------------------+-------------------------------+
  464. //
  465. //  where
  466. //
  467. //      S - is the severity code
  468. //
  469. //          0 - Success
  470. //          1 - Error
  471. //
  472. //
  473. //      Facility - is the facility code
  474. //
  475. //      Code - is the facility's status code
  476. //
  477. // SCODE and HRESULT are mktyplib base types.
  478. //
  479. typedef LONG SCODE;
  480. cpp_quote("#ifndef _HRESULT_DEFINED")
  481. cpp_quote("#define _HRESULT_DEFINED")
  482. #if defined(_STRICT_HRESULT)
  483. typedef struct _HRESULT_STRUCT {
  484.         DWORD Data1;
  485. } HRESULT_STRUCT, *PHRESULT_STRUCT;
  486. typedef PHRESULT_STRUCT HRESULT;
  487. #else // defined(_STRICT_HRESULT)
  488. typedef LONG HRESULT;
  489. #endif // defined(_STRICT_HRESULT)
  490. cpp_quote("#endif // !_HRESULT_DEFINED")
  491.  
  492. typedef SCODE *PSCODE;
  493.  
  494.  
  495. cpp_quote("#ifndef GUID_DEFINED")
  496. cpp_quote("#define GUID_DEFINED")
  497. typedef struct _GUID
  498. {
  499.     DWORD Data1;
  500.     WORD  Data2;
  501.     WORD  Data3;
  502.     BYTE  Data4[8];
  503. } GUID;
  504. cpp_quote("#endif // !GUID_DEFINED")
  505.  
  506. cpp_quote("#if !defined( __LPGUID_DEFINED__ )")
  507. cpp_quote("#define __LPGUID_DEFINED__")
  508. typedef GUID *LPGUID;
  509. cpp_quote("#endif // !__LPGUID_DEFINED__")
  510.  
  511. cpp_quote("#ifndef __OBJECTID_DEFINED")
  512. cpp_quote("#define __OBJECTID_DEFINED")
  513. cpp_quote("#define _OBJECTID_DEFINED")
  514. typedef struct _OBJECTID     // NOTE!! Order of structure members is important for OFS
  515. {                            // enumeration.
  516.    GUID Lineage;             // Unique for objects copied from same original and copies of.
  517.    unsigned long Uniquifier; // Random, to provide uniqueness within small set with same
  518. } OBJECTID;                  // lineage id.
  519. cpp_quote("#endif // !_OBJECTID_DEFINED")
  520.  
  521.  
  522.  
  523.  
  524. cpp_quote("#if !defined( __IID_DEFINED__ )")
  525. cpp_quote("#define __IID_DEFINED__")
  526.  
  527. // Interface ID are just a kind of GUID
  528. typedef GUID IID;
  529. typedef IID *LPIID;
  530. cpp_quote("#define IID_NULL            GUID_NULL")
  531. cpp_quote("#define IsEqualIID(riid1, riid2) IsEqualGUID(riid1, riid2)")
  532.  
  533. // Class ID are just a kind of GUID
  534. typedef GUID CLSID;
  535. typedef              CLSID *LPCLSID;
  536. cpp_quote("#define CLSID_NULL          GUID_NULL")
  537. cpp_quote("#define IsEqualCLSID(rclsid1, rclsid2) IsEqualGUID(rclsid1, rclsid2)")
  538.  
  539. // Format ID are just a kind of GUID
  540. typedef GUID FMTID;
  541. typedef              FMTID *LPFMTID;
  542. cpp_quote("#define FMTID_NULL          GUID_NULL")
  543. cpp_quote("#define IsEqualFMTID(rfmtid1, rfmtid2) IsEqualGUID(rfmtid1, rfmtid2)")
  544.  
  545. //The following typedefs are used internally by MIDL.
  546. cpp_quote("#if 0")
  547. #if defined(__midl)
  548.     /* MIDL 2.0 definitions */
  549.     typedef GUID *REFGUID;
  550.     typedef IID *REFIID;
  551.     typedef CLSID *REFCLSID;
  552.     typedef FMTID *REFFMTID;
  553. #else
  554.     /* MIDL 1.1 definitions */
  555.     typedef GUID REFGUID;
  556.     typedef IID REFIID;
  557.     typedef CLSID REFCLSID;
  558.     typedef FMTID REFFMTID;
  559. #endif
  560. cpp_quote("#endif // 0")
  561.  
  562. cpp_quote("#if defined(__cplusplus)")
  563.  
  564. cpp_quote("#ifndef _REFGUID_DEFINED")
  565. cpp_quote("#define _REFGUID_DEFINED")
  566. cpp_quote("#define REFGUID             const GUID &")
  567. cpp_quote("#endif // !_REFGUID_DEFINED")
  568.  
  569. cpp_quote("#ifndef _REFIID_DEFINED")
  570. cpp_quote("#define _REFIID_DEFINED")
  571. cpp_quote("#define REFIID              const IID &")
  572. cpp_quote("#endif // !_REFIID_DEFINED")
  573.  
  574. cpp_quote("#ifndef _REFCLSID_DEFINED")
  575. cpp_quote("#define _REFCLSID_DEFINED")
  576. cpp_quote("#define REFCLSID            const CLSID &")
  577. cpp_quote("#endif // !_REFCLSID_DEFINED")
  578.  
  579. cpp_quote("#ifndef _REFFMTID_DEFINED")
  580. cpp_quote("#define _REFFMTID_DEFINED")
  581. cpp_quote("#define REFFMTID            const FMTID &")
  582. cpp_quote("#endif // !_REFFMTID_DEFINED")
  583.  
  584.  
  585. cpp_quote("#else // !__cplusplus")
  586.  
  587. cpp_quote("#ifndef _REFGUID_DEFINED")
  588. cpp_quote("#define _REFGUID_DEFINED")
  589. cpp_quote("#define REFGUID             const GUID * const")
  590. cpp_quote("#endif // !_REFGUID_DEFINED")
  591.  
  592. cpp_quote("#ifndef _REFIID_DEFINED")
  593. cpp_quote("#define _REFIID_DEFINED")
  594. cpp_quote("#define REFIID              const IID * const")
  595. cpp_quote("#endif // !_REFIID_DEFINED")
  596.  
  597.  
  598. cpp_quote("#ifndef _REFCLSID_DEFINED")
  599. cpp_quote("#define _REFCLSID_DEFINED")
  600. cpp_quote("#define REFCLSID            const CLSID * const")
  601. cpp_quote("#endif // !_REFCLSID_DEFINED")
  602.  
  603. cpp_quote("#ifndef _REFFMTID_DEFINED")
  604. cpp_quote("#define _REFFMTID_DEFINED")
  605. cpp_quote("#define REFFMTID            const FMTID * const")
  606. cpp_quote("#endif // !_REFFMTID_DEFINED")
  607.  
  608. cpp_quote("#endif // !__cplusplus")
  609.  
  610. cpp_quote("#endif // !__IID_DEFINED__")
  611.  
  612. /************************* Misc types ***********************************/
  613.  
  614. // Common typdefs used in API paramaters, gleamed from compobj.h
  615.  
  616. // memory context values; passed to CoGetMalloc
  617. typedef enum tagMEMCTX
  618. {
  619.     MEMCTX_TASK = 1,            // task (private) memory
  620.     MEMCTX_SHARED = 2,          // shared memory (between processes)
  621.     MEMCTX_MACSYSTEM = 3,       // on the mac, the system heap
  622.     // these are mostly for internal use...
  623.     MEMCTX_UNKNOWN = -1,        // unknown context (when asked about it)
  624.     MEMCTX_SAME = -2,           // same context (as some other pointer)
  625. } MEMCTX;
  626.  
  627.  
  628. // For IRunningObjectTable::Register
  629. cpp_quote("#ifndef _ROTFLAGS_DEFINED")
  630. cpp_quote("#define _ROTFLAGS_DEFINED")
  631. cpp_quote("#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x1")
  632. cpp_quote("#define ROTFLAGS_ALLOWANYCLIENT 0x2")
  633. cpp_quote("#endif // !_ROTFLAGS_DEFINED")
  634.  
  635. // Maximum size of comparison buffer for IROTData::GetComparisonData
  636. cpp_quote("#ifndef _ROT_COMPARE_MAX_DEFINED")
  637. cpp_quote("#define _ROT_COMPARE_MAX_DEFINED")
  638. cpp_quote("#define ROT_COMPARE_MAX 2048")
  639. cpp_quote("#endif // !_ROT_COMPARE_MAX_DEFINED")
  640.  
  641.  
  642. // class context: used to determine what scope and kind of class object to use
  643. // NOTE: this is a bitwise enum
  644. typedef enum tagCLSCTX
  645. {
  646.     CLSCTX_INPROC_SERVER = 0x01,   // server dll (runs in same process as caller)
  647.     CLSCTX_INPROC_HANDLER = 0x02,  // handler dll (runs in same process as caller)
  648.     CLSCTX_LOCAL_SERVER = 0x04,    // server exe (runs on same machine; diff proc)
  649.     CLSCTX_INPROC_SERVER16 = 0x08, // 16-bit server dll (runs in same process as caller)
  650.     CLSCTX_REMOTE_SERVER = 0x10,    // remote server exe (runs on different machine)
  651.     CLSCTX_INPROC_HANDLER16 = 0x20, // 16-bit handler dll (runs in same process as caller)
  652.     CLSCTX_INPROC_SERVERX86 = 0x40, // Wx86 server dll (runs in same process as caller)
  653.     CLSCTX_INPROC_HANDLERX86 = 0x80, // Wx86 handler dll (runs in same process as caller)
  654.     CLSCTX_ESERVER_HANDLER = 0x100, // handler dll (runs in the server process)
  655. } CLSCTX;
  656.  
  657.  
  658.     // marshaling flags; passed to CoMarshalInterface
  659.     typedef enum tagMSHLFLAGS
  660.     {
  661.         MSHLFLAGS_NORMAL = 0,       // normal marshaling via proxy/stub
  662.         MSHLFLAGS_TABLESTRONG = 1,  // keep object alive; must explicitly release
  663.         MSHLFLAGS_TABLEWEAK = 2,    // doesn't hold object alive; still must release
  664.         MSHLFLAGS_NOPING = 4        // remote clients dont 'ping' to keep objects alive
  665.     } MSHLFLAGS;
  666.  
  667.  
  668. // marshal context: determines the destination context of the marshal operation
  669. typedef enum tagMSHCTX
  670. {
  671.     MSHCTX_LOCAL = 0,           // unmarshal context is local (eg.shared memory)
  672.     MSHCTX_NOSHAREDMEM = 1,     // unmarshal context has no shared memory access
  673.     MSHCTX_DIFFERENTMACHINE = 2,// unmarshal context is on a different machine
  674.     MSHCTX_INPROC = 3,          // unmarshal context is on different thread
  675. } MSHCTX;
  676.  
  677.  
  678. //
  679. // Common typedefs for paramaters used in data view API's, gleamed
  680. // from dvobj.h
  681. //
  682.  
  683. // Data/View aspect; specifies the desired aspect of the object when
  684. // drawing or getting data.
  685. typedef enum tagDVASPECT
  686. {
  687.     DVASPECT_CONTENT = 1,
  688.     DVASPECT_THUMBNAIL = 2,
  689.     DVASPECT_ICON = 4,
  690.     DVASPECT_DOCPRINT = 8
  691. } DVASPECT;
  692.  
  693. /****** Storage types *************************************************/
  694.  
  695.  
  696. /* Storage commit types */
  697. typedef enum tagSTGC
  698. {
  699.     STGC_DEFAULT        = 0,
  700.     STGC_OVERWRITE      = 1,
  701.     STGC_ONLYIFCURRENT  = 2,
  702.     STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4,
  703.     STGC_CONSOLIDATE    = 8
  704. } STGC;
  705.  
  706.  
  707. typedef enum tagSTGMOVE
  708. {
  709.     STGMOVE_MOVE    = 0,
  710.     STGMOVE_COPY    = 1,
  711.     STGMOVE_SHALLOWCOPY = 2
  712. } STGMOVE;
  713.  
  714. typedef enum tagSTATFLAG
  715. {
  716.     STATFLAG_DEFAULT = 0,
  717.     STATFLAG_NONAME = 1,
  718.     STATFLAG_NOOPEN = 2
  719. } STATFLAG;
  720.  
  721.  
  722. typedef [context_handle] void *HCONTEXT;
  723.  
  724. /****** Critical Section Wrappers ***********************************/
  725.  
  726.  
  727. /* if not already picked up from olenls.h */
  728. cpp_quote("#ifndef _LCID_DEFINED")
  729. cpp_quote("#define _LCID_DEFINED")
  730. typedef DWORD LCID;
  731. cpp_quote("#endif // !_LCID_DEFINED")
  732.  
  733. // #######################################################################
  734. //
  735. //  User marshal support for Windows data types.
  736.  
  737. //
  738. //  Frequently used helpers: sized blobs
  739. //
  740. //      Never put [user_marshal] or [wire_marshal] on the helpers directly.
  741. //
  742.  
  743. // Simple blobs.
  744.  
  745. typedef struct _BYTE_BLOB {
  746.                         unsigned long   clSize;
  747.     [size_is(clSize)]   byte            abData[];
  748. } BYTE_BLOB;
  749.  
  750. typedef [unique] BYTE_BLOB * UP_BYTE_BLOB;
  751.  
  752. typedef struct _WORD_BLOB {
  753.                         unsigned long   clSize;
  754.     [size_is(clSize)]   unsigned short  asData[];
  755. } WORD_BLOB;
  756.  
  757. typedef [unique] WORD_BLOB * UP_WORD_BLOB;
  758.  
  759. typedef struct _DWORD_BLOB {
  760.                         unsigned long   clSize;
  761.     [size_is(clSize)]   unsigned long   alData[];
  762. } DWORD_BLOB;
  763.  
  764. typedef [unique] DWORD_BLOB * UP_DWORD_BLOB;
  765.  
  766. // Flagged blobs.
  767.  
  768. typedef struct _FLAGGED_BYTE_BLOB {
  769.                         unsigned long   fFlags;
  770.                         unsigned long   clSize;
  771.     [size_is(clSize)]   byte            abData[];
  772. } FLAGGED_BYTE_BLOB;
  773.  
  774. typedef [unique] FLAGGED_BYTE_BLOB * UP_FLAGGED_BYTE_BLOB;
  775.  
  776. typedef struct _FLAGGED_WORD_BLOB {
  777.                         unsigned long   fFlags;
  778.                         unsigned long   clSize;
  779.     [size_is(clSize)]   unsigned short  asData[];
  780. } FLAGGED_WORD_BLOB;
  781.  
  782. typedef [unique] FLAGGED_WORD_BLOB * UP_FLAGGED_WORD_BLOB;
  783.  
  784. // Frequently used helpers with sized pointers.
  785.  
  786. typedef struct _BYTE_SIZEDARR {
  787.                         unsigned long   clSize;
  788.     [size_is(clSize)]   byte     *      pData ;
  789. } BYTE_SIZEDARR;
  790.  
  791. typedef struct _SHORT_SIZEDARR {
  792.                         unsigned long   clSize;
  793.     [size_is(clSize)]   unsigned short* pData ;
  794. } WORD_SIZEDARR;
  795.  
  796. typedef struct _LONG_SIZEDARR {
  797.                         unsigned long   clSize;
  798.     [size_is(clSize)]   unsigned long * pData ;
  799. } DWORD_SIZEDARR;
  800.  
  801. typedef struct _HYPER_SIZEDARR {
  802.                         unsigned long   clSize;
  803.     [size_is(clSize)]   hyper         * pData ;
  804. } HYPER_SIZEDARR;
  805.  
  806.  
  807. // #########################################################################
  808. //
  809. //   Constants for the call context
  810. //
  811.  
  812. const unsigned long WDT_INPROC_CALL = 0x48746457;
  813. const unsigned long WDT_REMOTE_CALL = 0x52746457;
  814.  
  815.  
  816. // #########################################################################
  817. //
  818. //  CLIPFORMAT
  819. //
  820.  
  821. typedef union _userCLIPFORMAT switch(long fContext) u
  822. {
  823.     case WDT_INPROC_CALL:            DWORD     dwValue;
  824.     case WDT_REMOTE_CALL:   [string] wchar_t * pwszName;
  825. } userCLIPFORMAT;
  826.  
  827. typedef [unique] userCLIPFORMAT *  wireCLIPFORMAT;
  828.  
  829. typedef [wire_marshal(wireCLIPFORMAT)] WORD  CLIPFORMAT;
  830.  
  831.  
  832. // #########################################################################
  833. //
  834. //  Good for most of the gdi handles.
  835.  
  836. typedef union _GDI_NONREMOTE switch( long fContext ) u
  837. {
  838.     case WDT_INPROC_CALL:   long        hInproc;
  839.     case WDT_REMOTE_CALL:   DWORD_BLOB *hRemote;
  840. } GDI_NONREMOTE;
  841.  
  842. // #########################################################################
  843. //
  844. //  HGLOBAL
  845. //
  846. // A global may be Null or may be non-NULL with 0 length.
  847.  
  848. typedef union _userHGLOBAL switch( long fContext ) u
  849. {
  850.     case WDT_INPROC_CALL:   long            hInproc;
  851.     case WDT_REMOTE_CALL:   FLAGGED_BYTE_BLOB *     hRemote;
  852.     default:                long            hGlobal;
  853. } userHGLOBAL;
  854.  
  855. typedef [unique] userHGLOBAL       * wireHGLOBAL;
  856.  
  857. // #########################################################################
  858. //
  859. //  HMETAFILE
  860. //
  861.  
  862. typedef union _userHMETAFILE switch( long fContext ) u
  863. {
  864.     case WDT_INPROC_CALL:   long            hInproc;
  865.     case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
  866.     default:                long            hGlobal;
  867. } userHMETAFILE;
  868.  
  869. // #########################################################################
  870. //
  871. //  HMETAFILEPICT
  872. //
  873. typedef struct _remoteMETAFILEPICT
  874. {
  875.     long            mm;
  876.     long            xExt;
  877.     long            yExt;
  878.     userHMETAFILE * hMF;
  879. } remoteMETAFILEPICT;
  880.  
  881. typedef union _userHMETAFILEPICT switch( long fContext ) u
  882. {
  883.     case WDT_INPROC_CALL:   long                hInproc;
  884.     case WDT_REMOTE_CALL:   remoteMETAFILEPICT* hRemote;
  885.     default:                long                hGlobal;
  886. } userHMETAFILEPICT;
  887.  
  888. // #########################################################################
  889. //
  890. //  HENHMETAFILE
  891. //
  892.  
  893. typedef union _userHENHMETAFILE switch( long fContext ) u
  894. {
  895.     case WDT_INPROC_CALL:   long            hInproc;
  896.     case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
  897.     default:                long            hGlobal;
  898. } userHENHMETAFILE;
  899.  
  900. // #########################################################################
  901. //
  902. //  HBITMAP
  903. //
  904.  
  905. // RemHBITMAP was just a byte blob, but the whole bitmap structure was copied
  906. // at the beginning of the buffer.
  907.  
  908. // So, we take BITMAP fields from wingdi.x
  909.  
  910. typedef struct _userBITMAP
  911. {
  912.     LONG            bmType;
  913.     LONG            bmWidth;
  914.     LONG            bmHeight;
  915.     LONG            bmWidthBytes;
  916.     WORD            bmPlanes;
  917.     WORD            bmBitsPixel;
  918.     ULONG                       cbSize;
  919.     [size_is(cbSize)]   byte    pBuffer[];
  920. } userBITMAP;
  921.  
  922.  
  923. typedef union _userHBITMAP switch( long fContext ) u
  924. {
  925.     case WDT_INPROC_CALL:   long            hInproc;
  926.     case WDT_REMOTE_CALL:   userBITMAP *    hRemote;
  927.     default:                long            hGlobal;
  928. } userHBITMAP;
  929.  
  930. // #########################################################################
  931. //
  932. //  HPALETTE
  933. //
  934.  
  935. // PALETTEENTRY is in wingdi.x, it is a struct with 4 bytes.
  936. // LOGPALETTE   is in wingdi.x, it is a conf struct with paletteentries and
  937. //                                    a version field
  938.  
  939. typedef struct tagrpcLOGPALETTE {
  940.     WORD                        palVersion;
  941.     WORD                        palNumEntries;
  942.     [size_is( palNumEntries )]  PALETTEENTRY        palPalEntry[];
  943. } rpcLOGPALETTE;
  944.  
  945. typedef union _userHPALETTE switch( long fContext ) u
  946. {
  947.     case WDT_INPROC_CALL:   long            hInproc;
  948.     case WDT_REMOTE_CALL:   rpcLOGPALETTE * hRemote;
  949.     default:                long            hGlobal;
  950. } userHPALETTE;
  951.  
  952.  
  953. // #########################################################################
  954. //
  955. //  Handles passed locally as longs.
  956. //
  957.  
  958. typedef union _RemotableHandle switch( long fContext ) u
  959. {
  960.     case WDT_INPROC_CALL:   long   hInproc;
  961.     case WDT_REMOTE_CALL:   long   hRemote;
  962. } RemotableHandle;
  963.  
  964. typedef [unique] RemotableHandle * wireHWND;
  965. typedef [unique] RemotableHandle * wireHMENU;
  966. typedef [unique] RemotableHandle * wireHACCEL;
  967. typedef [unique] RemotableHandle * wireHBRUSH;
  968. typedef [unique] RemotableHandle * wireHFONT;
  969. typedef [unique] RemotableHandle * wireHDC;
  970. typedef [unique] RemotableHandle * wireHICON;
  971.  
  972.  
  973. cpp_quote("#if 0")
  974. #ifndef _MIDL_DECLARE_WIREM_HANDLE
  975. DECLARE_WIREM_HANDLE( HWND );
  976. DECLARE_WIREM_HANDLE( HMENU );
  977. DECLARE_WIREM_HANDLE( HACCEL );
  978. DECLARE_WIREM_HANDLE( HBRUSH );
  979. DECLARE_WIREM_HANDLE( HFONT );
  980. DECLARE_WIREM_HANDLE( HDC );
  981. DECLARE_WIREM_HANDLE( HICON );
  982. #endif
  983.  
  984. cpp_quote("#ifndef _HCURSOR_DEFINED")
  985. cpp_quote("#define _HCURSOR_DEFINED")
  986. typedef HICON HCURSOR;      /* HICONs & HCURSORs are polymorphic */
  987. cpp_quote("#endif // !_HCURSOR_DEFINED")
  988.  
  989. cpp_quote("/* tagTEXTMETRICW was copied from wingdi.h for MIDL */")
  990. typedef struct tagTEXTMETRICW {
  991.     LONG  tmHeight;
  992.     LONG  tmAscent;
  993.     LONG  tmDescent;
  994.     LONG  tmInternalLeading;
  995.     LONG  tmExternalLeading;
  996.     LONG  tmAveCharWidth;
  997.     LONG  tmMaxCharWidth;
  998.     LONG  tmWeight;
  999.     LONG  tmOverhang;
  1000.     LONG  tmDigitizedAspectX;
  1001.     LONG  tmDigitizedAspectY;
  1002.     WCHAR tmFirstChar;
  1003.     WCHAR tmLastChar;
  1004.     WCHAR tmDefaultChar;
  1005.     WCHAR tmBreakChar;
  1006.     BYTE  tmItalic;
  1007.     BYTE  tmUnderlined;
  1008.     BYTE  tmStruckOut;
  1009.     BYTE  tmPitchAndFamily;
  1010.     BYTE  tmCharSet;
  1011. } TEXTMETRICW;
  1012.  
  1013. cpp_quote("#endif //0")
  1014.  
  1015. cpp_quote("#ifndef _WIN32           // The following code is for Win16 only")
  1016. cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")
  1017.  
  1018. // Message structure
  1019.  
  1020. typedef struct tagMSG {
  1021.     HWND        hwnd;
  1022.     UINT        message;
  1023.     WPARAM      wParam;
  1024.     LPARAM      lParam;
  1025.     DWORD       time;
  1026.     POINT       pt;
  1027. } MSG, *PMSG, *NPMSG, *LPMSG;
  1028. cpp_quote("#endif // _WIN32")
  1029. cpp_quote("#endif // WINAPI")
  1030.  
  1031.  
  1032. typedef [unique] userHBITMAP      * wireHBITMAP;
  1033. typedef [unique] userHPALETTE     * wireHPALETTE;
  1034. typedef [unique] userHENHMETAFILE * wireHENHMETAFILE;
  1035. typedef [unique] userHMETAFILE    * wireHMETAFILE;
  1036. typedef [unique] userHMETAFILEPICT* wireHMETAFILEPICT;
  1037.  
  1038. cpp_quote("#if 0")
  1039.  
  1040. DECLARE_WIREM_HANDLE( HGLOBAL );
  1041. typedef HGLOBAL HLOCAL;
  1042.  
  1043. DECLARE_WIREM_HANDLE( HBITMAP );
  1044. DECLARE_WIREM_HANDLE( HPALETTE );
  1045. DECLARE_WIREM_HANDLE( HENHMETAFILE );
  1046. DECLARE_WIREM_HANDLE( HMETAFILE );
  1047. cpp_quote("#endif //0")
  1048.  
  1049. DECLARE_WIREM_HANDLE( HMETAFILEPICT );
  1050.  
  1051. }
  1052.  
  1053. // #########################################################################
  1054. //
  1055.  
  1056. cpp_quote("#if ( _MSC_VER >= 800 )")
  1057. cpp_quote("#pragma warning(disable:4201)")
  1058. cpp_quote("#endif")
  1059.  
  1060. typedef double DATE;
  1061.  
  1062. /* This is a helper struct for use in handling currency. */
  1063. cpp_quote("#ifndef _tagCY_DEFINED")
  1064. cpp_quote("#define _tagCY_DEFINED")
  1065. cpp_quote("#define _CY_DEFINED")
  1066.  
  1067. cpp_quote("#if 0")
  1068.  
  1069. cpp_quote("/* the following isn't the real definition of CY, but it is */")
  1070. cpp_quote("/* what RPC knows how to remote */")
  1071. typedef struct tagCY {
  1072.     LONGLONG    int64;
  1073. } CY;
  1074.  
  1075. cpp_quote("#else /* 0 */")
  1076.  
  1077. cpp_quote("/* real definition that makes the C++ compiler happy */")
  1078. cpp_quote("typedef union tagCY {")
  1079. cpp_quote("    struct {")
  1080. cpp_quote("#ifdef _MAC")
  1081. cpp_quote("        long      Hi;")
  1082. cpp_quote("        long Lo;")
  1083. cpp_quote("#else")
  1084. cpp_quote("        unsigned long Lo;")
  1085. cpp_quote("        long      Hi;")
  1086. cpp_quote("#endif")
  1087. cpp_quote("    };")
  1088. cpp_quote("    LONGLONG int64;")
  1089. cpp_quote("} CY;")
  1090.  
  1091. cpp_quote("#endif /* 0 */")
  1092.  
  1093. cpp_quote("#endif /* _tagCY_DEFINED */")
  1094.  
  1095. typedef CY *LPCY;
  1096.  
  1097. cpp_quote("#if 0 /* _tagDEC_DEFINED */")
  1098. cpp_quote("/* The following isn't the real definition of Decimal type, */")
  1099. cpp_quote("/* but it is what RPC knows how to remote */")
  1100.  
  1101. typedef struct tagDEC {
  1102.     USHORT wReserved;
  1103.     BYTE  scale;
  1104.     BYTE  sign;
  1105.     ULONG Hi32;
  1106.     ULONGLONG Lo64;
  1107. } DECIMAL;
  1108.  
  1109. cpp_quote("#else /* _tagDEC_DEFINED */")
  1110.  
  1111. cpp_quote("/* real definition that makes the C++ compiler happy */")
  1112. cpp_quote("typedef struct tagDEC {")
  1113. cpp_quote("    USHORT wReserved;")
  1114. cpp_quote("    union {")
  1115. cpp_quote("        struct {")
  1116. cpp_quote("            BYTE scale;")
  1117. cpp_quote("            BYTE sign;")
  1118. cpp_quote("        };")
  1119. cpp_quote("        USHORT signscale;")
  1120. cpp_quote("    };")
  1121. cpp_quote("    ULONG Hi32;")
  1122. cpp_quote("    union {")
  1123. cpp_quote("        struct {")
  1124. cpp_quote("#ifdef _MAC")
  1125. cpp_quote("            ULONG Mid32;")
  1126. cpp_quote("            ULONG Lo32;")
  1127. cpp_quote("#else")
  1128. cpp_quote("            ULONG Lo32;")
  1129. cpp_quote("            ULONG Mid32;")
  1130. cpp_quote("#endif")
  1131. cpp_quote("        };")
  1132. cpp_quote("        ULONGLONG Lo64;")
  1133. cpp_quote("    };")
  1134. cpp_quote("} DECIMAL;")
  1135.  
  1136. cpp_quote("#define DECIMAL_NEG ((BYTE)0x80)")
  1137. cpp_quote("#define DECIMAL_SETZERO(dec) \\")
  1138. cpp_quote("        {(dec).Lo64 = 0; (dec).Hi32 = 0; (dec).signscale = 0;}")
  1139.  
  1140. cpp_quote("#endif /* _tagDEC_DEFINED */")
  1141.  
  1142. typedef DECIMAL *LPDECIMAL;
  1143.  
  1144. cpp_quote("#if ( _MSC_VER >= 800 )")
  1145. cpp_quote("#pragma warning(default:4201)")
  1146. cpp_quote("#endif")
  1147.  
  1148. /* IDL declarations for BSTR how to transmit them */
  1149. //
  1150. typedef [unique] FLAGGED_WORD_BLOB * wireBSTR;
  1151. typedef [wire_marshal( wireBSTR )] OLECHAR *  BSTR;
  1152. typedef BSTR * LPBSTR;
  1153.  
  1154. cpp_quote("/* 0 == FALSE, -1 == TRUE */")
  1155. typedef short VARIANT_BOOL;
  1156. cpp_quote("#if !__STDC__ && (_MSC_VER <= 1000)")
  1157. cpp_quote("/* For backward compatibility */")
  1158. typedef VARIANT_BOOL _VARIANT_BOOL;
  1159. cpp_quote("#else")
  1160. cpp_quote("/* ANSI C/C++ reserve bool as keyword */")
  1161. cpp_quote("#define _VARIANT_BOOL    /##/")
  1162. cpp_quote("#endif")
  1163. typedef boolean BOOLEAN;
  1164.  
  1165. cpp_quote("/* The BSTRBLOB structure is used by some implementations */")
  1166. cpp_quote("/* of the IPropertyStorage interface when marshaling BSTRs */")
  1167. cpp_quote("/* on systems which don't support BSTR marshaling. */")
  1168.  
  1169. cpp_quote("#ifndef _tagBSTRBLOB_DEFINED")
  1170. cpp_quote("#define _tagBSTRBLOB_DEFINED")
  1171. typedef struct tagBSTRBLOB
  1172. {
  1173.                           ULONG   cbSize;
  1174.     [size_is(cbSize)]     BYTE    *pData;
  1175. } BSTRBLOB, *LPBSTRBLOB;
  1176. cpp_quote("#endif")
  1177.  
  1178. cpp_quote("#define VARIANT_TRUE ((VARIANT_BOOL)0xffff)")
  1179. cpp_quote("#define VARIANT_FALSE ((VARIANT_BOOL)0)")
  1180.  
  1181. cpp_quote("#ifndef _tagBLOB_DEFINED")
  1182. cpp_quote("#define _tagBLOB_DEFINED")
  1183. cpp_quote("#define _BLOB_DEFINED")
  1184. cpp_quote("#define _LPBLOB_DEFINED")
  1185. typedef struct tagBLOB {
  1186.     ULONG cbSize;
  1187.     [size_is(cbSize)]
  1188.     BYTE  *pBlobData;
  1189. } BLOB, * LPBLOB;
  1190. cpp_quote("#endif")
  1191.  
  1192. typedef struct tagCLIPDATA {
  1193.     ULONG cbSize;       // count that includes sizeof(ulClipFmt)
  1194.     long ulClipFmt;     // long to keep alignment
  1195.     [size_is(cbSize-4)]
  1196.     BYTE * pClipData;   // cbSize-sizeof(ULONG) bytes of data in clipboard format
  1197. } CLIPDATA;
  1198.  
  1199. cpp_quote("// Macro to calculate the size of the above pClipData")
  1200. cpp_quote("#define CBPCLIPDATA(clipdata)    ( (clipdata).cbSize - sizeof((clipdata).ulClipFmt) )")
  1201.  
  1202.  
  1203. typedef unsigned short VARTYPE;
  1204.  
  1205. // #########################################################################
  1206. //
  1207. //  VARTYPE
  1208. //
  1209. // #########################################################################
  1210.  
  1211.  
  1212. cpp_quote("/*")
  1213. cpp_quote(" * VARENUM usage key,")
  1214. cpp_quote(" *")
  1215. cpp_quote(" * * [V] - may appear in a VARIANT")
  1216. cpp_quote(" * * [T] - may appear in a TYPEDESC")
  1217. cpp_quote(" * * [P] - may appear in an OLE property set")
  1218. cpp_quote(" * * [S] - may appear in a Safe Array")
  1219. cpp_quote(" *")
  1220. cpp_quote(" *")
  1221. cpp_quote(" *  VT_EMPTY            [V]   [P]     nothing")
  1222. cpp_quote(" *  VT_NULL             [V]   [P]     SQL style Null")
  1223. cpp_quote(" *  VT_I2               [V][T][P][S]  2 byte signed int")
  1224. cpp_quote(" *  VT_I4               [V][T][P][S]  4 byte signed int")
  1225. cpp_quote(" *  VT_R4               [V][T][P][S]  4 byte real")
  1226. cpp_quote(" *  VT_R8               [V][T][P][S]  8 byte real")
  1227. cpp_quote(" *  VT_CY               [V][T][P][S]  currency")
  1228. cpp_quote(" *  VT_DATE             [V][T][P][S]  date")
  1229. cpp_quote(" *  VT_BSTR             [V][T][P][S]  OLE Automation string")
  1230. cpp_quote(" *  VT_DISPATCH         [V][T][P][S]  IDispatch *")
  1231. cpp_quote(" *  VT_ERROR            [V][T][P][S]  SCODE")
  1232. cpp_quote(" *  VT_BOOL             [V][T][P][S]  True=-1, False=0")
  1233. cpp_quote(" *  VT_VARIANT          [V][T][P][S]  VARIANT *")
  1234. cpp_quote(" *  VT_UNKNOWN          [V][T]   [S]  IUnknown *")
  1235. cpp_quote(" *  VT_DECIMAL          [V][T]   [S]  16 byte fixed point")
  1236. cpp_quote(" *  VT_RECORD           [V]   [P][S]  user defined type")
  1237. cpp_quote(" *  VT_I1               [V][T][P][s]  signed char")
  1238. cpp_quote(" *  VT_UI1              [V][T][P][S]  unsigned char")
  1239. cpp_quote(" *  VT_UI2              [V][T][P][S]  unsigned short")
  1240. cpp_quote(" *  VT_UI4              [V][T][P][S]  unsigned short")
  1241. cpp_quote(" *  VT_I8                  [T][P]     signed 64-bit int")
  1242. cpp_quote(" *  VT_UI8                 [T][P]     unsigned 64-bit int")
  1243. cpp_quote(" *  VT_INT              [V][T][P][S]  signed machine int")
  1244. cpp_quote(" *  VT_UINT             [V][T]   [S]  unsigned machine int")
  1245. cpp_quote(" *  VT_VOID                [T]        C style void")
  1246. cpp_quote(" *  VT_HRESULT             [T]        Standard return type")
  1247. cpp_quote(" *  VT_PTR                 [T]        pointer type")
  1248. cpp_quote(" *  VT_SAFEARRAY           [T]        (use VT_ARRAY in VARIANT)")
  1249. cpp_quote(" *  VT_CARRAY              [T]        C style array")
  1250. cpp_quote(" *  VT_USERDEFINED         [T]        user defined type")
  1251. cpp_quote(" *  VT_LPSTR               [T][P]     null terminated string")
  1252. cpp_quote(" *  VT_LPWSTR              [T][P]     wide null terminated string")
  1253. cpp_quote(" *  VT_FILETIME               [P]     FILETIME")
  1254. cpp_quote(" *  VT_BLOB                   [P]     Length prefixed bytes")
  1255. cpp_quote(" *  VT_STREAM                 [P]     Name of the stream follows")
  1256. cpp_quote(" *  VT_STORAGE                [P]     Name of the storage follows")
  1257. cpp_quote(" *  VT_STREAMED_OBJECT        [P]     Stream contains an object")
  1258. cpp_quote(" *  VT_STORED_OBJECT          [P]     Storage contains an object")
  1259. cpp_quote(" *  VT_BLOB_OBJECT            [P]     Blob contains an object ")
  1260. cpp_quote(" *  VT_CF                     [P]     Clipboard format")
  1261. cpp_quote(" *  VT_CLSID                  [P]     A Class ID")
  1262. cpp_quote(" *  VT_VECTOR                 [P]     simple counted array")
  1263. cpp_quote(" *  VT_ARRAY            [V]           SAFEARRAY*")
  1264. cpp_quote(" *  VT_BYREF            [V]           void* for local use")
  1265. cpp_quote(" *  VT_BSTR_BLOB                      Reserved for system use")
  1266. cpp_quote(" */")
  1267.  
  1268. enum VARENUM
  1269. {
  1270.     VT_EMPTY           = 0,
  1271.     VT_NULL            = 1,
  1272.     VT_I2              = 2,
  1273.     VT_I4              = 3,
  1274.     VT_R4              = 4,
  1275.     VT_R8              = 5,
  1276.     VT_CY              = 6,
  1277.     VT_DATE            = 7,
  1278.     VT_BSTR            = 8,
  1279.     VT_DISPATCH        = 9,
  1280.     VT_ERROR           = 10,
  1281.     VT_BOOL            = 11,
  1282.     VT_VARIANT         = 12,
  1283.     VT_UNKNOWN         = 13,
  1284.     VT_DECIMAL         = 14,
  1285. // VBA reserves 15 for future use
  1286.     VT_I1              = 16,
  1287.     VT_UI1             = 17,
  1288.     VT_UI2             = 18,
  1289.     VT_UI4             = 19,
  1290.     VT_I8              = 20,
  1291.     VT_UI8             = 21,
  1292.     VT_INT             = 22,
  1293.     VT_UINT            = 23,
  1294.     VT_VOID            = 24,
  1295.     VT_HRESULT         = 25,
  1296.     VT_PTR             = 26,
  1297.     VT_SAFEARRAY       = 27,
  1298.     VT_CARRAY          = 28,
  1299.     VT_USERDEFINED     = 29,
  1300.     VT_LPSTR           = 30,
  1301.     VT_LPWSTR          = 31,
  1302. // VBA reserves 32-35 for future use
  1303.     VT_RECORD          = 36,
  1304.  
  1305.     VT_FILETIME        = 64,
  1306.     VT_BLOB            = 65,
  1307.     VT_STREAM          = 66,
  1308.     VT_STORAGE         = 67,
  1309.     VT_STREAMED_OBJECT = 68,
  1310.     VT_STORED_OBJECT   = 69,
  1311.     VT_BLOB_OBJECT     = 70,
  1312.     VT_CF              = 71,
  1313.     VT_CLSID           = 72,
  1314.  
  1315.     VT_BSTR_BLOB       = 0x0fff,
  1316.  
  1317.     VT_VECTOR          = 0x1000,
  1318.     VT_ARRAY           = 0x2000,
  1319.     VT_BYREF           = 0x4000,
  1320.     VT_RESERVED        = 0x8000,
  1321.  
  1322.     VT_ILLEGAL         = 0xffff,
  1323.     VT_ILLEGALMASKED   = 0x0fff,
  1324.     VT_TYPEMASK        = 0x0fff
  1325. };
  1326.  
  1327. // Property stuff
  1328. typedef ULONG PROPID;
  1329.  
  1330. // Access Control - ntseapi.h
  1331. cpp_quote( "#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED" )
  1332. cpp_quote( "#define SID_IDENTIFIER_AUTHORITY_DEFINED" )
  1333. typedef struct _SID_IDENTIFIER_AUTHORITY {
  1334.     UCHAR Value[6];
  1335. } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
  1336. cpp_quote( "#endif" )
  1337.  
  1338. cpp_quote( "#ifndef SID_DEFINED" )
  1339. cpp_quote( "#define SID_DEFINED" )
  1340. typedef struct _SID {
  1341.    UCHAR Revision;
  1342.    UCHAR SubAuthorityCount;
  1343.    SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
  1344.    [size_is(SubAuthorityCount)] ULONG SubAuthority[*];
  1345. } SID, *PISID;
  1346. cpp_quote( "#endif" )
  1347.  
  1348.  
  1349. // Class Store Stuff
  1350.  
  1351.     typedef GUID    APPID;
  1352.  
  1353. //
  1354. // Platform/Architecture Definition
  1355. //
  1356.     typedef struct tagCSPLATFORM
  1357.     {
  1358.         DWORD dwPlatformId;     // This is the OS Platform
  1359.         DWORD dwVersionHi;      // Major Version of OS
  1360.         DWORD dwVersionLo;      // Minor Version of OS
  1361.         DWORD dwProcessorArch;  // This is the Processor Architecure
  1362.     } CSPLATFORM;
  1363.  
  1364. //
  1365. // Query Context Structure
  1366. // This contains a list of attributes used to look up a class implementation
  1367. //
  1368.     typedef struct tagQUERYCONTEXT {
  1369.           DWORD      dwContext;         // Execution context
  1370.           CSPLATFORM Platform;          // Client Platform/Architecture
  1371.           LCID       Locale;            // Locale ID
  1372.           DWORD      dwVersionHi;       // Low Version number
  1373.           DWORD      dwVersionLo;       // Hi Version number
  1374.     } QUERYCONTEXT;
  1375.  
  1376.  
  1377. //
  1378. // Class Specifier structure
  1379. // All means of mapping to a Class ID
  1380. // (Union of CLSID, File Extension, ProgId, MimeType, File Ext)
  1381. //
  1382.  
  1383.     typedef [v1_enum] enum tagTYSPEC {
  1384.         TYSPEC_CLSID,
  1385.         TYSPEC_FILEEXT,
  1386.         TYSPEC_MIMETYPE,
  1387.         TYSPEC_PROGID,
  1388.         TYSPEC_IID,
  1389.         TYSPEC_TYPELIB,
  1390.         TYSPEC_FILENAME,
  1391.         TYSPEC_JAVACLASS,
  1392.         TYSPEC_PACKAGENAME
  1393.     } TYSPEC;
  1394.  
  1395.     typedef union switch(DWORD tyspec)
  1396.         {
  1397.         case TYSPEC_CLSID:
  1398.             CLSID   clsid;
  1399.         case TYSPEC_IID:
  1400.             IID     iid;
  1401.         case TYSPEC_TYPELIB:
  1402.             GUID    typelibID;
  1403.         case TYSPEC_FILEEXT:
  1404.             LPOLESTR pFileExt;
  1405.         case TYSPEC_MIMETYPE:
  1406.             LPOLESTR pMimeType;
  1407.         case TYSPEC_PROGID:
  1408.             LPOLESTR pProgId;
  1409.         case TYSPEC_FILENAME:
  1410.             LPOLESTR pFileName;
  1411.         case TYSPEC_JAVACLASS:
  1412.             LPOLESTR pJavaClassName;
  1413.         case TYSPEC_PACKAGENAME:
  1414.             LPOLESTR pPackageName;
  1415.     } uCLSSPEC;
  1416.  
  1417. typedef struct _PUBLISHEDAPPINFO
  1418. {
  1419.     LPOLESTR    pwszFileExtension;
  1420.     LPOLESTR    pwszDisplayName;
  1421.     LPOLESTR    pwszPackagePath;
  1422. } PUBLISHEDAPPINFO;
  1423.  
  1424. typedef [v1_enum] enum tagAPPINFOTYPE
  1425. {
  1426.     APPINFO_PUBLISHED = 1,
  1427.     APPINFO_SHELLNEW,
  1428.     APPINFO_INSERTABLE
  1429. } APPINFOTYPE;
  1430.  
  1431. //
  1432. // Package Information consists of one or more
  1433. //    PACKAGEDETAIL - Info about an implemetation code package 
  1434. //
  1435.  
  1436. //
  1437. // Package Flag Values returned in PACKAGEDETAIL
  1438.  
  1439. // special activation flags
  1440.     const DWORD ACTFLG_RunLocally    = 1;    // install the application locally
  1441.     const DWORD ACTFLG_RunOnce       = 2;    // this class is meant to be de-installed
  1442.     const DWORD ACTFLG_SystemWide    = 4;    // installed this class system-wide
  1443.     const DWORD ACTFLG_Published     = 8;    // this is an assigned package for this user
  1444.     const DWORD ACTFLG_Assigned      = 16;   // this is a published package for this user
  1445.     const DWORD ACTFLG_UserInstall   = 32;   // this package may be installed via Add/Remove programs
  1446.  
  1447.  
  1448. // types of package formats
  1449.  
  1450.     typedef [v1_enum] enum _CLASSPATHTYPE {
  1451.         ExeNamePath,
  1452.         DllNamePath,
  1453.         TlbNamePath,
  1454.         CabFilePath,
  1455.         InfFilePath,
  1456.         DrwFilePath,
  1457.         SetupNamePath
  1458.     } CLASSPATHTYPE;
  1459.  
  1460. //
  1461. // APPDETAIL structure
  1462. //
  1463.  
  1464.     typedef struct tagAPPDETAIL {
  1465.                             GUID            AppID;
  1466.                             DWORD           cClasses;        // Number of classes in this
  1467.         [size_is(cClasses)] CLSID           *prgClsIdList;   // List of CLSIDs
  1468.                             DWORD           cTypeLibIds;       // Number of TypeLibIDs in this
  1469.         [size_is(cTypeLibIds)] CLSID        *prgTypeLibIdList; // List of TypeLibIDs
  1470.                             DWORD           cServers;        // Number of Remote Server Names in this
  1471.         [size_is(cServers)] LPOLESTR        *prgServerNames; // List of Server names
  1472.     } APPDETAIL;
  1473.  
  1474. //
  1475. // PACKAGEDETAIL structure
  1476. //    Also contains one or more APPDETAIL 
  1477. //
  1478.  
  1479.  
  1480.     typedef struct tagPACKAGEDETAIL {
  1481.                             CLASSPATHTYPE    PathType;
  1482.                             LPOLESTR         pszPath;
  1483.                             LPOLESTR         pszIconPath;
  1484.                             LPOLESTR         pszSetupCommand;
  1485.                             DWORD            dwActFlags;     // flags indicating special instructions
  1486.                             LPOLESTR         pszVendor;      // Package Vendor
  1487.                             LPOLESTR         pszPackageName; // Package Identity
  1488.                             LPOLESTR         pszProductName; // Product Identity
  1489.                             DWORD            dwContext;      // Execution context
  1490.                             CSPLATFORM       Platform;       // Client Platform
  1491.                             LCID             Locale;         // Locale Id
  1492.                             DWORD            dwVersionHi;    // Hi Version number
  1493.                             DWORD            dwVersionLo;    // Low Version number
  1494.                             ULONGLONG        Usn;            // Update Sequence Number 
  1495.                             DWORD            cApps;
  1496.                             [size_is(cApps)] APPDETAIL *pAppDetail;
  1497.     } PACKAGEDETAIL;
  1498.  
  1499. // Package Info Structure
  1500. // This contains all relevant attributes of a package that may be of interest
  1501. // to COM activation.
  1502. //
  1503.  
  1504.  
  1505.     typedef struct tagPACKAGEINFO {
  1506.                             LPOLESTR        pszClassIconPath;
  1507.                             CLSID           *pTreatAsClsid;
  1508.                             DWORD           cPackages;
  1509.         [size_is(cPackages)]
  1510.                             PACKAGEDETAIL   *pPackageDetail;
  1511.     } PACKAGEINFO;
  1512.