WTypes.Idl
上传用户:dzyhzl
上传日期:2019-04-29
资源大小:56270k
文件大小:40k
源码类别:

模拟服务器

开发平台:

C/C++

  1. //+-------------------------------------------------------------------------
  2. //
  3. //  Microsoft Windows
  4. //  Copyright (c) Microsoft Corporation. All rights reserved.
  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. cpp_quote("//+-------------------------------------------------------------------------")
  17. cpp_quote("//")
  18. cpp_quote("//  Microsoft Windows")
  19. cpp_quote("//  Copyright (c) Microsoft Corporation. All rights reserved.")
  20. cpp_quote("//")
  21. cpp_quote("//--------------------------------------------------------------------------")
  22. cpp_quote("#if ( _MSC_VER >= 1020 )")
  23. cpp_quote("#pragma once")
  24. cpp_quote("#endif")
  25. //
  26. // Import definitions of the base types related to the 64b porting effort.
  27. //
  28. import "basetsd.h";
  29. import "guiddef.h";
  30. [ uuid(D3980A60-910C-1068-9341-00DD010F2F1C),
  31.   version(0.1), pointer_default(unique) ]
  32. interface IWinTypes
  33. {
  34. typedef struct tagRemHGLOBAL
  35. {
  36.         long fNullHGlobal;
  37.         unsigned long cbData;
  38.         [size_is(cbData)] byte data[];
  39. } RemHGLOBAL;
  40. typedef struct tagRemHMETAFILEPICT
  41. {
  42.         long        mm;
  43.         long        xExt;
  44.         long        yExt;
  45.         unsigned long cbData;
  46.         [size_is(cbData)] byte data[];
  47. } RemHMETAFILEPICT;
  48. typedef struct tagRemHENHMETAFILE
  49. {
  50.         unsigned long cbData;
  51.         [size_is(cbData)] byte data[];
  52. } RemHENHMETAFILE;
  53. typedef struct tagRemHBITMAP
  54. {
  55.         unsigned long cbData;
  56.         [size_is(cbData)] byte data[];
  57. } RemHBITMAP;
  58. typedef struct tagRemHPALETTE
  59. {
  60.         unsigned long cbData;
  61.         [size_is(cbData)] byte data[];
  62. } RemHPALETTE;
  63. typedef struct tagRemBRUSH
  64. {
  65.         unsigned long cbData;
  66.         [size_is(cbData)] byte data[];
  67. } RemHBRUSH;
  68. cpp_quote("#if !defined(_WIN32) && !defined(_MPPC_)" )
  69. cpp_quote("// The following code is for Win16 only")
  70. cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")
  71. cpp_quote("#define FAR             _far")
  72. cpp_quote("#define PASCAL          _pascal")
  73. cpp_quote("#define CDECL           _cdecl")
  74. cpp_quote("#define VOID            void")
  75. cpp_quote("#define WINAPI      FAR PASCAL")
  76. cpp_quote("#define CALLBACK    FAR PASCAL")
  77. cpp_quote("#ifndef FALSE")
  78. cpp_quote("#define FALSE 0")
  79. cpp_quote("#define TRUE 1")
  80. cpp_quote("#endif // !FALSE")
  81. cpp_quote("#ifndef _BYTE_DEFINED")
  82. cpp_quote("#define _BYTE_DEFINED")
  83. typedef byte BYTE;
  84. cpp_quote("#endif // !_BYTE_DEFINED")
  85. cpp_quote("#ifndef _WORD_DEFINED")
  86. cpp_quote("#define _WORD_DEFINED")
  87. typedef unsigned short WORD;
  88. cpp_quote("#endif // !_WORD_DEFINED")
  89. typedef unsigned int UINT;
  90. typedef int  INT;
  91. typedef long BOOL;
  92. cpp_quote("#ifndef _LONG_DEFINED")
  93. cpp_quote("#define _LONG_DEFINED")
  94. typedef long LONG;
  95. cpp_quote("#endif // !_LONG_DEFINED")
  96. cpp_quote("#ifndef _WPARAM_DEFINED")
  97. cpp_quote("#define _WPARAM_DEFINED")
  98. typedef UINT_PTR WPARAM;
  99. cpp_quote("#endif // _WPARAM_DEFINED")
  100. cpp_quote("#ifndef _DWORD_DEFINED")
  101. cpp_quote("#define _DWORD_DEFINED")
  102. typedef unsigned long DWORD;
  103. cpp_quote("#endif // !_DWORD_DEFINED")
  104. cpp_quote("#ifndef _LPARAM_DEFINED")
  105. cpp_quote("#define _LPARAM_DEFINED")
  106. typedef LONG_PTR LPARAM;
  107. cpp_quote("#endif // !_LPARAM_DEFINED")
  108. cpp_quote("#ifndef _LRESULT_DEFINED")
  109. cpp_quote("#define _LRESULT_DEFINED")
  110. typedef LONG_PTR LRESULT;
  111. cpp_quote("#endif // !_LRESULT_DEFINED")
  112. typedef void * HANDLE;
  113. #define DECLARE_WIREM_HANDLE(name)  
  114.                              typedef [wire_marshal(wire ## name)] void * name
  115. #define DECLARE_HANDLE(name) typedef void * name
  116. DECLARE_HANDLE(HMODULE);
  117. DECLARE_HANDLE(HINSTANCE);
  118. DECLARE_HANDLE(HRGN);
  119. DECLARE_HANDLE(HTASK);
  120. DECLARE_HANDLE(HKEY);
  121. DECLARE_HANDLE(HDESK);
  122. DECLARE_HANDLE(HMF);
  123. DECLARE_HANDLE(HEMF);
  124. DECLARE_HANDLE(HPEN);
  125. DECLARE_HANDLE(HRSRC);
  126. DECLARE_HANDLE(HSTR);
  127. DECLARE_HANDLE(HWINSTA);
  128. DECLARE_HANDLE(HKL);
  129. DECLARE_HANDLE(HGDIOBJ);
  130. typedef HANDLE HDWP;
  131. cpp_quote("#ifndef _HFILE_DEFINED")
  132. cpp_quote("#define _HFILE_DEFINED")
  133. typedef INT HFILE;      /* Polymorphic with C runtime file handle type */
  134. cpp_quote("#endif // !_HFILE_DEFINED")
  135. cpp_quote("#ifndef _LPWORD_DEFINED")
  136. cpp_quote("#define _LPWORD_DEFINED")
  137. typedef WORD *LPWORD;
  138. cpp_quote("#endif // !_LPWORD_DEFINED")
  139. cpp_quote("#ifndef _LPDWORD_DEFINED")
  140. cpp_quote("#define _LPDWORD_DEFINED")
  141. typedef DWORD *LPDWORD;
  142. cpp_quote("#endif // !_LPDWORD_DEFINED")
  143. typedef char CHAR;
  144. typedef [string] CHAR *LPSTR;
  145. typedef [string] const CHAR *LPCSTR;
  146. cpp_quote("#ifndef _WCHAR_DEFINED")
  147. cpp_quote("#define _WCHAR_DEFINED")
  148. typedef wchar_t WCHAR;
  149. typedef WCHAR   TCHAR;
  150. cpp_quote("#endif // !_WCHAR_DEFINED")
  151. typedef [string] WCHAR *LPWSTR;
  152. typedef [string] TCHAR *LPTSTR;
  153. typedef [string] const WCHAR *LPCWSTR;
  154. typedef [string] const TCHAR *LPCTSTR;
  155. cpp_quote("#ifndef _COLORREF_DEFINED")
  156. cpp_quote("#define _COLORREF_DEFINED")
  157. typedef DWORD COLORREF;
  158. cpp_quote("#endif // !_COLORREF_DEFINED")
  159. cpp_quote("#ifndef _LPCOLORREF_DEFINED")
  160. cpp_quote("#define _LPCOLORREF_DEFINED")
  161. typedef DWORD *LPCOLORREF;
  162. cpp_quote("#endif // !_LPCOLORREF_DEFINED")
  163. typedef HANDLE *LPHANDLE;
  164. //typedefs for remotable types from wingdi.h
  165. typedef struct _RECTL
  166. {
  167.     LONG    left;
  168.     LONG    top;
  169.     LONG    right;
  170.     LONG    bottom;
  171. } RECTL, *PRECTL, *LPRECTL;
  172. typedef struct tagPOINT
  173. {
  174.     LONG  x;
  175.     LONG  y;
  176. } POINT, *PPOINT, *LPPOINT;
  177. typedef struct _POINTL
  178. {
  179.     LONG  x;
  180.     LONG  y;
  181. } POINTL, *PPOINTL;
  182. cpp_quote("#ifndef WIN16")
  183. typedef struct tagSIZE
  184. {
  185.     LONG        cx;
  186.     LONG        cy;
  187. } SIZE, *PSIZE, *LPSIZE;
  188. cpp_quote("#else // WIN16")
  189. cpp_quote("typedef struct tagSIZE")
  190. cpp_quote("{")
  191. cpp_quote("    INT cx;")
  192. cpp_quote("    INT cy;")
  193. cpp_quote("} SIZE, *PSIZE, *LPSIZE;")
  194. cpp_quote("#endif // WIN16")
  195. typedef struct tagSIZEL
  196. {
  197.     LONG cx;
  198.     LONG cy;
  199. } SIZEL, *PSIZEL, *LPSIZEL;
  200. cpp_quote("#endif  //WINAPI")
  201. cpp_quote("#endif  //!WIN32 && !MPPC")
  202. cpp_quote("#ifndef _PALETTEENTRY_DEFINED")
  203. cpp_quote("#define _PALETTEENTRY_DEFINED")
  204. typedef struct tagPALETTEENTRY {
  205.     BYTE        peRed;
  206.     BYTE        peGreen;
  207.     BYTE        peBlue;
  208.     BYTE        peFlags;
  209. } PALETTEENTRY, *PPALETTEENTRY, *LPPALETTEENTRY;
  210. cpp_quote("#endif // !_PALETTEENTRY_DEFINED")
  211. // Logical Palette
  212. cpp_quote("#ifndef _LOGPALETTE_DEFINED")
  213. cpp_quote("#define _LOGPALETTE_DEFINED")
  214. typedef struct tagLOGPALETTE {
  215.     WORD        palVersion;
  216.     WORD        palNumEntries;
  217.     [size_is(palNumEntries)] PALETTEENTRY        palPalEntry[];
  218. } LOGPALETTE, *PLOGPALETTE, *LPLOGPALETTE;
  219. cpp_quote("#endif // !_LOGPALETTE_DEFINED")
  220. cpp_quote("#if defined(_WIN32) && !defined(OLE2ANSI)")
  221. typedef WCHAR                   OLECHAR;
  222. typedef [string] OLECHAR       *LPOLESTR;
  223. typedef [string] const OLECHAR *LPCOLESTR;
  224. cpp_quote("#define OLESTR(str) L##str")
  225. cpp_quote("")
  226. cpp_quote("#else")
  227. cpp_quote("")
  228. cpp_quote("typedef char      OLECHAR;")
  229. cpp_quote("typedef LPSTR     LPOLESTR;")
  230. cpp_quote("typedef LPCSTR    LPCOLESTR;")
  231. cpp_quote("#define OLESTR(str) str")
  232. cpp_quote("#endif")
  233. // This block contains types that are normally defined by the nt sdk in WINDEF.H
  234. // but we need them here for definitions that follow in this file.  If WINDEF.H
  235. // hasn't been included then we need to define them now so that WTYPES.H
  236. // will compile.
  237. cpp_quote("#ifndef _WINDEF_")
  238. typedef const RECTL *LPCRECTL;
  239. typedef void * PVOID, * LPVOID;
  240. typedef float   FLOAT;
  241. typedef struct tagRECT
  242. {
  243.     LONG    left;
  244.     LONG    top;
  245.     LONG    right;
  246.     LONG    bottom;
  247. } RECT, *PRECT, *LPRECT;
  248. typedef const RECT *LPCRECT;
  249. cpp_quote("#endif  //_WINDEF_")
  250. typedef unsigned char   UCHAR;
  251. typedef short           SHORT;
  252. typedef unsigned short  USHORT;
  253. typedef DWORD           ULONG;
  254. typedef double          DOUBLE;
  255. cpp_quote("#ifndef _DWORDLONG_")
  256. typedef unsigned __int64 DWORDLONG;
  257. typedef DWORDLONG *PDWORDLONG;
  258. cpp_quote("#endif // !_DWORDLONG_")
  259. cpp_quote("#ifndef _ULONGLONG_")
  260. typedef __int64 LONGLONG;
  261. typedef unsigned __int64 ULONGLONG;
  262. typedef LONGLONG *PLONGLONG;
  263. typedef ULONGLONG *PULONGLONG;
  264. cpp_quote("#endif // _ULONGLONG_")
  265. // just for local wtypes
  266. cpp_quote("#if 0")
  267. typedef struct _LARGE_INTEGER {
  268.     LONGLONG QuadPart;
  269. } LARGE_INTEGER;
  270. typedef LARGE_INTEGER *PLARGE_INTEGER;
  271. typedef struct _ULARGE_INTEGER {
  272.     ULONGLONG QuadPart;
  273. } ULARGE_INTEGER;
  274. // just for local wtypes
  275. cpp_quote("#endif // 0")
  276. cpp_quote("#ifndef _WINBASE_")
  277. cpp_quote("#ifndef _FILETIME_")
  278. cpp_quote("#define _FILETIME_")
  279. typedef struct _FILETIME
  280. {
  281.     DWORD dwLowDateTime;
  282.     DWORD dwHighDateTime;
  283. } FILETIME, *PFILETIME, *LPFILETIME;
  284. cpp_quote("#endif // !_FILETIME")
  285. cpp_quote("#ifndef _SYSTEMTIME_")
  286. cpp_quote("#define _SYSTEMTIME_")
  287. typedef struct _SYSTEMTIME {
  288.     WORD wYear;
  289.     WORD wMonth;
  290.     WORD wDayOfWeek;
  291.     WORD wDay;
  292.     WORD wHour;
  293.     WORD wMinute;
  294.     WORD wSecond;
  295.     WORD wMilliseconds;
  296. } SYSTEMTIME, *PSYSTEMTIME, *LPSYSTEMTIME;
  297. cpp_quote("#endif // !_SYSTEMTIME")
  298. cpp_quote("#ifndef _SECURITY_ATTRIBUTES_")
  299. cpp_quote("#define _SECURITY_ATTRIBUTES_")
  300. typedef struct _SECURITY_ATTRIBUTES {
  301.     DWORD nLength;
  302.     [size_is(nLength)] LPVOID lpSecurityDescriptor;
  303.     BOOL bInheritHandle;
  304. } SECURITY_ATTRIBUTES, *PSECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
  305. cpp_quote("#endif // !_SECURITY_ATTRIBUTES_")
  306. cpp_quote("#ifndef SECURITY_DESCRIPTOR_REVISION")
  307. typedef USHORT SECURITY_DESCRIPTOR_CONTROL, *PSECURITY_DESCRIPTOR_CONTROL;
  308. typedef PVOID PSID;     // winnt
  309. typedef struct _ACL {
  310.     UCHAR AclRevision;
  311.     UCHAR Sbz1;
  312.     USHORT AclSize;
  313.     USHORT AceCount;
  314.     USHORT Sbz2;
  315. } ACL;
  316. typedef ACL *PACL;
  317. typedef struct _SECURITY_DESCRIPTOR {
  318.     UCHAR Revision;
  319.     UCHAR Sbz1;
  320.     SECURITY_DESCRIPTOR_CONTROL Control;
  321.     PSID Owner;
  322.     PSID Group;
  323.     PACL Sacl;
  324.     PACL Dacl;
  325. } SECURITY_DESCRIPTOR, *PISECURITY_DESCRIPTOR;
  326. cpp_quote("#endif // !SECURITY_DESCRIPTOR_REVISION")
  327. cpp_quote("#endif //_WINBASE_")
  328. typedef struct _COAUTHIDENTITY
  329. {
  330.   [size_is(UserLength+1)] USHORT *      User;
  331.   ULONG                                 UserLength;
  332.   [size_is(DomainLength+1)] USHORT *    Domain;
  333.   ULONG                                 DomainLength;
  334.   [size_is(PasswordLength+1)] USHORT *  Password;
  335.   ULONG                                 PasswordLength;
  336.   ULONG                                 Flags;
  337. } COAUTHIDENTITY;
  338. typedef struct _COAUTHINFO
  339. {
  340.     DWORD               dwAuthnSvc;
  341.     DWORD               dwAuthzSvc;
  342.     LPWSTR              pwszServerPrincName;
  343.     DWORD               dwAuthnLevel;
  344.     DWORD               dwImpersonationLevel;
  345.     COAUTHIDENTITY *    pAuthIdentityData;
  346.     DWORD               dwCapabilities;
  347. } COAUTHINFO;
  348. //
  349. // SCODE, HRESULT
  350. //
  351. //
  352. //  Status values are 32 bit values layed out as follows:
  353. //
  354. //   3 3 2 2 2 2 2 2 2 2 2 2 1 1 1 1 1 1 1 1 1 1
  355. //   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
  356. //  +-+-----------------------------+-------------------------------+
  357. //  |S|       Facility              |               Code            |
  358. //  +-+-----------------------------+-------------------------------+
  359. //
  360. //  where
  361. //
  362. //      S - is the severity code
  363. //
  364. //          0 - Success
  365. //          1 - Error
  366. //
  367. //
  368. //      Facility - is the facility code
  369. //
  370. //      Code - is the facility's status code
  371. //
  372. // SCODE and HRESULT are mktyplib base types.
  373. //
  374. typedef LONG SCODE;
  375. cpp_quote("#ifndef _HRESULT_DEFINED")
  376. cpp_quote("#define _HRESULT_DEFINED")
  377. #if defined(_STRICT_HRESULT)
  378. typedef struct _HRESULT_STRUCT {
  379.         DWORD Data1;
  380. } HRESULT_STRUCT, *PHRESULT_STRUCT;
  381. typedef PHRESULT_STRUCT HRESULT;
  382. #else // defined(_STRICT_HRESULT)
  383. typedef LONG HRESULT;
  384. #endif // defined(_STRICT_HRESULT)
  385. cpp_quote("#endif // !_HRESULT_DEFINED")
  386. typedef SCODE *PSCODE;
  387. cpp_quote("#ifndef __OBJECTID_DEFINED")
  388. cpp_quote("#define __OBJECTID_DEFINED")
  389. cpp_quote("#define _OBJECTID_DEFINED")
  390. typedef struct _OBJECTID     // NOTE!! Order of structure members is important for OFS
  391. {                            // enumeration.
  392.    GUID Lineage;             // Unique for objects copied from same original and copies of.
  393.    unsigned long Uniquifier; // Random, to provide uniqueness within small set with same
  394. } OBJECTID;                  // lineage id.
  395. cpp_quote("#endif // !_OBJECTID_DEFINED")
  396. //The following typedefs are used internally by MIDL.
  397. cpp_quote("#if 0")
  398.     /* MIDL 2.0+ definitions */
  399.     typedef GUID *REFGUID;
  400.     typedef IID *REFIID;
  401.     typedef CLSID *REFCLSID;
  402.     typedef FMTID *REFFMTID;
  403. cpp_quote("#endif // 0")
  404. /************************* Misc types ***********************************/
  405. // Common typdefs used in API paramaters, gleamed from compobj.h
  406. // memory context values; passed to CoGetMalloc
  407. typedef enum tagMEMCTX
  408. {
  409.     MEMCTX_TASK = 1,            // task (private) memory
  410.     MEMCTX_SHARED = 2,          // shared memory (between processes)
  411.     MEMCTX_MACSYSTEM = 3,       // on the mac, the system heap
  412.     // these are mostly for internal use...
  413.     MEMCTX_UNKNOWN = -1,        // unknown context (when asked about it)
  414.     MEMCTX_SAME = -2,           // same context (as some other pointer)
  415. } MEMCTX;
  416. // For IRunningObjectTable::Register
  417. cpp_quote("#ifndef _ROTFLAGS_DEFINED")
  418. cpp_quote("#define _ROTFLAGS_DEFINED")
  419. cpp_quote("#define ROTFLAGS_REGISTRATIONKEEPSALIVE 0x1")
  420. cpp_quote("#define ROTFLAGS_ALLOWANYCLIENT 0x2")
  421. cpp_quote("#endif // !_ROTFLAGS_DEFINED")
  422. // Maximum size of comparison buffer for IROTData::GetComparisonData
  423. cpp_quote("#ifndef _ROT_COMPARE_MAX_DEFINED")
  424. cpp_quote("#define _ROT_COMPARE_MAX_DEFINED")
  425. cpp_quote("#define ROT_COMPARE_MAX 2048")
  426. cpp_quote("#endif // !_ROT_COMPARE_MAX_DEFINED")
  427. // class context: used to determine what scope and kind of class object to use
  428. // NOTE: this is a bitwise enum
  429. typedef enum tagCLSCTX
  430. {
  431.     CLSCTX_INPROC_SERVER = 0x01,     // server dll (runs in same process as caller)
  432.     CLSCTX_INPROC_HANDLER = 0x02,    // handler dll (runs in same process as caller)
  433.     CLSCTX_LOCAL_SERVER = 0x04,      // server exe (runs on same machine; diff proc)
  434.     CLSCTX_INPROC_SERVER16 = 0x08,   // 16-bit server dll (runs in same process as caller)
  435.     CLSCTX_REMOTE_SERVER = 0x10,     // remote server exe (runs on different machine)
  436.     CLSCTX_INPROC_HANDLER16 = 0x20,  // 16-bit handler dll (runs in same process as caller)
  437.     CLSCTX_INPROC_SERVERX86 = 0x40,  // Wx86 server dll (runs in same process as caller)
  438.     CLSCTX_INPROC_HANDLERX86 = 0x80, // Wx86 handler dll (runs in same process as caller)
  439.     CLSCTX_ESERVER_HANDLER = 0x100,  // handler dll (runs in the server process)
  440.     CLSCTX_RESERVED = 0x200,         // reserved
  441.     CLSCTX_NO_CODE_DOWNLOAD = 0x400, // disallow code download from the Directory Service (if any) or the internet   -rahulth
  442.     CLSCTX_NO_WX86_TRANSLATION = 0x800,
  443.     CLSCTX_NO_CUSTOM_MARSHAL = 0x1000,
  444.     CLSCTX_ENABLE_CODE_DOWNLOAD = 0x2000,
  445.                                      // allow code download from the Directory Service (if any) or the internet
  446.     CLSCTX_NO_FAILURE_LOG = 0x4000,  // do not log messages about activation failure (should one occur) to Event Log
  447.     CLSCTX_DISABLE_AAA   = 0x8000,   // Disable EOAC_DISABLE_AAA capability for this activation only
  448.     CLSCTX_ENABLE_AAA   = 0x10000,   // Enable EOAC_DISABLE_AAA capability for this activation only
  449.     CLSCTX_FROM_DEFAULT_CONTEXT = 0x20000    // Begin this activation from the default context of the current apartment
  450.  } CLSCTX;
  451. // marshaling flags; passed to CoMarshalInterface
  452. typedef enum tagMSHLFLAGS
  453. {
  454.     MSHLFLAGS_NORMAL = 0,       // normal marshaling via proxy/stub
  455.     MSHLFLAGS_TABLESTRONG = 1,  // keep object alive; must explicitly release
  456.     MSHLFLAGS_TABLEWEAK = 2,    // doesn't hold object alive; still must release
  457.     MSHLFLAGS_NOPING = 4,       // remote clients dont 'ping' to keep objects alive
  458.     MSHLFLAGS_RESERVED1 = 8,    // reserved
  459.     MSHLFLAGS_RESERVED2 = 16,   // reserved
  460.     MSHLFLAGS_RESERVED3 = 32,   // reserved
  461.     MSHLFLAGS_RESERVED4 = 64    // reserved
  462. } MSHLFLAGS;
  463. // marshal context: determines the destination context of the marshal operation
  464. typedef enum tagMSHCTX
  465. {
  466.     MSHCTX_LOCAL = 0,           // unmarshal context is local (eg.shared memory)
  467.     MSHCTX_NOSHAREDMEM = 1,     // unmarshal context has no shared memory access
  468.     MSHCTX_DIFFERENTMACHINE = 2,// unmarshal context is on a different machine
  469.     MSHCTX_INPROC = 3,          // unmarshal context is on different thread
  470.     MSHCTX_CROSSCTX = 4         // unmarshal context is on different context
  471. } MSHCTX;
  472. //
  473. // Common typedefs for paramaters used in data view API's, gleamed
  474. // from dvobj.h
  475. //
  476. // Data/View aspect; specifies the desired aspect of the object when
  477. // drawing or getting data.
  478. typedef enum tagDVASPECT
  479. {
  480.     DVASPECT_CONTENT = 1,
  481.     DVASPECT_THUMBNAIL = 2,
  482.     DVASPECT_ICON = 4,
  483.     DVASPECT_DOCPRINT = 8
  484. } DVASPECT;
  485. /****** Storage types *************************************************/
  486. /* Storage commit types */
  487. typedef enum tagSTGC
  488. {
  489.     STGC_DEFAULT        = 0,
  490.     STGC_OVERWRITE      = 1,
  491.     STGC_ONLYIFCURRENT  = 2,
  492.     STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE = 4,
  493.     STGC_CONSOLIDATE    = 8
  494. } STGC;
  495. typedef enum tagSTGMOVE
  496. {
  497.     STGMOVE_MOVE    = 0,
  498.     STGMOVE_COPY    = 1,
  499.     STGMOVE_SHALLOWCOPY = 2
  500. } STGMOVE;
  501. typedef enum tagSTATFLAG
  502. {
  503.     STATFLAG_DEFAULT = 0,
  504.     STATFLAG_NONAME = 1,
  505.     STATFLAG_NOOPEN = 2
  506. } STATFLAG;
  507. typedef [context_handle] void *HCONTEXT;
  508. /****** Critical Section Wrappers ***********************************/
  509. /* if not already picked up from olenls.h */
  510. cpp_quote("#ifndef _LCID_DEFINED")
  511. cpp_quote("#define _LCID_DEFINED")
  512. typedef DWORD LCID;
  513. cpp_quote("#endif // !_LCID_DEFINED")
  514. cpp_quote("#ifndef _LANGID_DEFINED")
  515. cpp_quote("#define _LANGID_DEFINED")
  516. typedef USHORT LANGID;
  517. cpp_quote("#endif // !_LANGID_DEFINED")
  518. // #######################################################################
  519. //
  520. //  User marshal support for Windows data types.
  521. //
  522. //  Frequently used helpers: sized blobs
  523. //
  524. //      Never put [user_marshal] or [wire_marshal] on the helpers directly.
  525. //
  526. // Simple blobs.
  527. typedef struct _BYTE_BLOB {
  528.                         unsigned long   clSize;
  529.     [size_is(clSize)]   byte            abData[];
  530. } BYTE_BLOB;
  531. typedef [unique] BYTE_BLOB * UP_BYTE_BLOB;
  532. typedef struct _WORD_BLOB {
  533.                         unsigned long   clSize;
  534.     [size_is(clSize)]   unsigned short  asData[];
  535. } WORD_BLOB;
  536. typedef [unique] WORD_BLOB * UP_WORD_BLOB;
  537. typedef struct _DWORD_BLOB {
  538.                         unsigned long   clSize;
  539.     [size_is(clSize)]   unsigned long   alData[];
  540. } DWORD_BLOB;
  541. typedef [unique] DWORD_BLOB * UP_DWORD_BLOB;
  542. // Flagged blobs.
  543. typedef struct _FLAGGED_BYTE_BLOB {
  544.                         unsigned long   fFlags;
  545.                         unsigned long   clSize;
  546.     [size_is(clSize)]   byte            abData[];
  547. } FLAGGED_BYTE_BLOB;
  548. typedef [unique] FLAGGED_BYTE_BLOB * UP_FLAGGED_BYTE_BLOB;
  549. typedef struct _FLAGGED_WORD_BLOB {
  550.                         unsigned long   fFlags;
  551.                         unsigned long   clSize;
  552.     [size_is(clSize)]   unsigned short  asData[];
  553. } FLAGGED_WORD_BLOB;
  554. typedef [unique] FLAGGED_WORD_BLOB * UP_FLAGGED_WORD_BLOB;
  555. // Frequently used helpers with sized pointers.
  556. typedef struct _BYTE_SIZEDARR {
  557.                         unsigned long   clSize;
  558.     [size_is(clSize)]   byte     *      pData ;
  559. } BYTE_SIZEDARR;
  560. typedef struct _SHORT_SIZEDARR {
  561.                         unsigned long   clSize;
  562.     [size_is(clSize)]   unsigned short* pData ;
  563. } WORD_SIZEDARR;
  564. typedef struct _LONG_SIZEDARR {
  565.                         unsigned long   clSize;
  566.     [size_is(clSize)]   unsigned long * pData ;
  567. } DWORD_SIZEDARR;
  568. typedef struct _HYPER_SIZEDARR {
  569.                         unsigned long   clSize;
  570.     [size_is(clSize)]   hyper         * pData ;
  571. } HYPER_SIZEDARR;
  572. // #########################################################################
  573. //
  574. //   Constants for the call context
  575. //
  576. const unsigned long WDT_INPROC_CALL   = 0x48746457;
  577. const unsigned long WDT_REMOTE_CALL   = 0x52746457;
  578. const unsigned long WDT_INPROC64_CALL = 0x50746457;
  579. // #########################################################################
  580. //
  581. //  CLIPFORMAT
  582. //
  583. typedef union _userCLIPFORMAT switch(long fContext) u
  584. {
  585.     case WDT_INPROC_CALL:            DWORD     dwValue;
  586.     case WDT_REMOTE_CALL:   [string] wchar_t * pwszName;
  587. } userCLIPFORMAT;
  588. typedef [unique] userCLIPFORMAT *  wireCLIPFORMAT;
  589. typedef [wire_marshal(wireCLIPFORMAT)] WORD  CLIPFORMAT;
  590. // #########################################################################
  591. //
  592. //  Good for most of the gdi handles.
  593. typedef union _GDI_NONREMOTE switch( long fContext ) u
  594. {
  595.     case WDT_INPROC_CALL:   long        hInproc;
  596.     case WDT_REMOTE_CALL:   DWORD_BLOB *hRemote;
  597. } GDI_NONREMOTE;
  598. // #########################################################################
  599. //
  600. //  HGLOBAL
  601. //
  602. // A global may be Null or may be non-NULL with 0 length.
  603. typedef union _userHGLOBAL switch( long fContext ) u
  604. {
  605.     case WDT_INPROC_CALL:   long                    hInproc;
  606.     case WDT_REMOTE_CALL:   FLAGGED_BYTE_BLOB *     hRemote;
  607.     case WDT_INPROC64_CALL: __int64                 hInproc64;
  608. } userHGLOBAL;
  609. typedef [unique] userHGLOBAL       * wireHGLOBAL;
  610. // #########################################################################
  611. //
  612. //  HMETAFILE
  613. //
  614. typedef union _userHMETAFILE switch( long fContext ) u
  615. {
  616.     case WDT_INPROC_CALL:   long            hInproc;
  617.     case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
  618.     case WDT_INPROC64_CALL: __int64         hInproc64;
  619. } userHMETAFILE;
  620. // #########################################################################
  621. //
  622. //  HMETAFILEPICT
  623. //
  624. typedef struct _remoteMETAFILEPICT
  625. {
  626.     long            mm;
  627.     long            xExt;
  628.     long            yExt;
  629.     userHMETAFILE * hMF;
  630. } remoteMETAFILEPICT;
  631. typedef union _userHMETAFILEPICT switch( long fContext ) u
  632. {
  633.     case WDT_INPROC_CALL:   long                hInproc;
  634.     case WDT_REMOTE_CALL:   remoteMETAFILEPICT* hRemote;
  635.     case WDT_INPROC64_CALL: __int64             hInproc64;
  636. } userHMETAFILEPICT;
  637. // #########################################################################
  638. //
  639. //  HENHMETAFILE
  640. //
  641. typedef union _userHENHMETAFILE switch( long fContext ) u
  642. {
  643.     case WDT_INPROC_CALL:   long            hInproc;
  644.     case WDT_REMOTE_CALL:   BYTE_BLOB *     hRemote;
  645.     case WDT_INPROC64_CALL: __int64         hInproc64;
  646. } userHENHMETAFILE;
  647. // #########################################################################
  648. //
  649. //  HBITMAP
  650. //
  651. // RemHBITMAP was just a byte blob, but the whole bitmap structure was copied
  652. // at the beginning of the buffer.
  653. // So, we take BITMAP fields from wingdi.x
  654. typedef struct _userBITMAP
  655. {
  656.     LONG            bmType;
  657.     LONG            bmWidth;
  658.     LONG            bmHeight;
  659.     LONG            bmWidthBytes;
  660.     WORD            bmPlanes;
  661.     WORD            bmBitsPixel;
  662.     ULONG                       cbSize;
  663.     [size_is(cbSize)]   byte    pBuffer[];
  664. } userBITMAP;
  665. typedef union _userHBITMAP switch( long fContext ) u
  666. {
  667.     case WDT_INPROC_CALL:   long            hInproc;
  668.     case WDT_REMOTE_CALL:   userBITMAP *    hRemote;
  669.     case WDT_INPROC64_CALL: __int64         hInproc64;
  670. } userHBITMAP;
  671. // #########################################################################
  672. //
  673. //  HPALETTE
  674. //
  675. // PALETTEENTRY is in wingdi.x, it is a struct with 4 bytes.
  676. // LOGPALETTE   is in wingdi.x, it is a conf struct with paletteentries and
  677. //                                    a version field
  678. typedef union _userHPALETTE switch( long fContext ) u
  679. {
  680.     case WDT_INPROC_CALL:   long            hInproc;
  681.     case WDT_REMOTE_CALL:   LOGPALETTE *    hRemote;
  682.     case WDT_INPROC64_CALL: __int64         hInproc64;
  683. } userHPALETTE;
  684. // #########################################################################
  685. //
  686. //  Handles passed locally as longs.
  687. //
  688. typedef union _RemotableHandle switch( long fContext ) u
  689. {
  690.     case WDT_INPROC_CALL:   long   hInproc;
  691.     case WDT_REMOTE_CALL:   long   hRemote;
  692. } RemotableHandle;
  693. typedef [unique] RemotableHandle * wireHWND;
  694. typedef [unique] RemotableHandle * wireHMENU;
  695. typedef [unique] RemotableHandle * wireHACCEL;
  696. typedef [unique] RemotableHandle * wireHBRUSH;
  697. typedef [unique] RemotableHandle * wireHFONT;
  698. typedef [unique] RemotableHandle * wireHDC;
  699. typedef [unique] RemotableHandle * wireHICON;
  700. cpp_quote("#if 0")
  701. #ifndef _MIDL_DECLARE_WIREM_HANDLE
  702. DECLARE_WIREM_HANDLE( HWND );
  703. DECLARE_WIREM_HANDLE( HMENU );
  704. DECLARE_WIREM_HANDLE( HACCEL );
  705. DECLARE_WIREM_HANDLE( HBRUSH );
  706. DECLARE_WIREM_HANDLE( HFONT );
  707. DECLARE_WIREM_HANDLE( HDC );
  708. DECLARE_WIREM_HANDLE( HICON );
  709. #endif
  710. cpp_quote("#ifndef _HCURSOR_DEFINED")
  711. cpp_quote("#define _HCURSOR_DEFINED")
  712. typedef HICON HCURSOR;      /* HICONs & HCURSORs are polymorphic */
  713. cpp_quote("#endif // !_HCURSOR_DEFINED")
  714. cpp_quote("#endif //0")
  715. cpp_quote("#ifndef _TEXTMETRIC_DEFINED")
  716. cpp_quote("#define _TEXTMETRIC_DEFINED")
  717. typedef struct tagTEXTMETRICW {
  718.     LONG  tmHeight;
  719.     LONG  tmAscent;
  720.     LONG  tmDescent;
  721.     LONG  tmInternalLeading;
  722.     LONG  tmExternalLeading;
  723.     LONG  tmAveCharWidth;
  724.     LONG  tmMaxCharWidth;
  725.     LONG  tmWeight;
  726.     LONG  tmOverhang;
  727.     LONG  tmDigitizedAspectX;
  728.     LONG  tmDigitizedAspectY;
  729.     WCHAR tmFirstChar;
  730.     WCHAR tmLastChar;
  731.     WCHAR tmDefaultChar;
  732.     WCHAR tmBreakChar;
  733.     BYTE  tmItalic;
  734.     BYTE  tmUnderlined;
  735.     BYTE  tmStruckOut;
  736.     BYTE  tmPitchAndFamily;
  737.     BYTE  tmCharSet;
  738. } TEXTMETRICW, *PTEXTMETRICW, *LPTEXTMETRICW;
  739. cpp_quote("#endif // !_TEXTMETRIC_DEFINED")
  740. cpp_quote("#ifndef _WIN32           // The following code is for Win16 only")
  741. cpp_quote("#ifndef WINAPI          // If not included with 3.1 headers...")
  742. // Message structure
  743. typedef struct tagMSG {
  744.     HWND        hwnd;
  745.     UINT        message;
  746.     WPARAM      wParam;
  747.     LPARAM      lParam;
  748.     DWORD       time;
  749.     POINT       pt;
  750. } MSG, *PMSG, *NPMSG, *LPMSG;
  751. cpp_quote("#endif // _WIN32")
  752. cpp_quote("#endif // WINAPI")
  753. typedef [unique] userHBITMAP      * wireHBITMAP;
  754. typedef [unique] userHPALETTE     * wireHPALETTE;
  755. typedef [unique] userHENHMETAFILE * wireHENHMETAFILE;
  756. typedef [unique] userHMETAFILE    * wireHMETAFILE;
  757. typedef [unique] userHMETAFILEPICT* wireHMETAFILEPICT;
  758. cpp_quote("#if 0")
  759. DECLARE_WIREM_HANDLE( HGLOBAL );
  760. typedef HGLOBAL HLOCAL;
  761. DECLARE_WIREM_HANDLE( HBITMAP );
  762. DECLARE_WIREM_HANDLE( HPALETTE );
  763. DECLARE_WIREM_HANDLE( HENHMETAFILE );
  764. DECLARE_WIREM_HANDLE( HMETAFILE );
  765. cpp_quote("#endif //0")
  766. DECLARE_WIREM_HANDLE( HMETAFILEPICT );
  767. }
  768. // #########################################################################
  769. //
  770. cpp_quote("#if ( _MSC_VER >= 800 )")
  771. cpp_quote("#if _MSC_VER >= 1200")
  772. cpp_quote("#pragma warning(push)")
  773. cpp_quote("#endif")
  774. cpp_quote("#pragma warning(disable:4201)")
  775. cpp_quote("#endif")
  776. typedef double DATE;
  777. /* This is a helper struct for use in handling currency. */
  778. cpp_quote("#ifndef _tagCY_DEFINED")
  779. cpp_quote("#define _tagCY_DEFINED")
  780. cpp_quote("#define _CY_DEFINED")
  781. cpp_quote("#if 0")
  782. cpp_quote("/* the following isn't the real definition of CY, but it is */")
  783. cpp_quote("/* what RPC knows how to remote */")
  784. typedef struct tagCY {
  785.     LONGLONG    int64;
  786. } CY;
  787. cpp_quote("#else /* 0 */")
  788. cpp_quote("/* real definition that makes the C++ compiler happy */")
  789. cpp_quote("typedef union tagCY {")
  790. cpp_quote("    struct {")
  791. cpp_quote("#ifdef _MAC")
  792. cpp_quote("        long      Hi;")
  793. cpp_quote("        long Lo;")
  794. cpp_quote("#else")
  795. cpp_quote("        unsigned long Lo;")
  796. cpp_quote("        long      Hi;")
  797. cpp_quote("#endif")
  798. cpp_quote("    };")
  799. cpp_quote("    LONGLONG int64;")
  800. cpp_quote("} CY;")
  801. cpp_quote("#endif /* 0 */")
  802. cpp_quote("#endif /* _tagCY_DEFINED */")
  803. typedef CY *LPCY;
  804. cpp_quote("#if 0 /* _tagDEC_DEFINED */")
  805. cpp_quote("/* The following isn't the real definition of Decimal type, */")
  806. cpp_quote("/* but it is what RPC knows how to remote */")
  807. typedef struct tagDEC {
  808.     USHORT wReserved;
  809.     BYTE  scale;
  810.     BYTE  sign;
  811.     ULONG Hi32;
  812.     ULONGLONG Lo64;
  813. } DECIMAL;
  814. cpp_quote("#else /* _tagDEC_DEFINED */")
  815. cpp_quote("/* real definition that makes the C++ compiler happy */")
  816. cpp_quote("typedef struct tagDEC {")
  817. cpp_quote("    USHORT wReserved;")
  818. cpp_quote("    union {")
  819. cpp_quote("        struct {")
  820. cpp_quote("            BYTE scale;")
  821. cpp_quote("            BYTE sign;")
  822. cpp_quote("        };")
  823. cpp_quote("        USHORT signscale;")
  824. cpp_quote("    };")
  825. cpp_quote("    ULONG Hi32;")
  826. cpp_quote("    union {")
  827. cpp_quote("        struct {")
  828. cpp_quote("#ifdef _MAC")
  829. cpp_quote("            ULONG Mid32;")
  830. cpp_quote("            ULONG Lo32;")
  831. cpp_quote("#else")
  832. cpp_quote("            ULONG Lo32;")
  833. cpp_quote("            ULONG Mid32;")
  834. cpp_quote("#endif")
  835. cpp_quote("        };")
  836. cpp_quote("        ULONGLONG Lo64;")
  837. cpp_quote("    };")
  838. cpp_quote("} DECIMAL;")
  839. cpp_quote("#define DECIMAL_NEG ((BYTE)0x80)")
  840. cpp_quote("#define DECIMAL_SETZERO(dec) \")
  841. cpp_quote("        {(dec).Lo64 = 0; (dec).Hi32 = 0; (dec).signscale = 0;}")
  842. cpp_quote("#endif /* _tagDEC_DEFINED */")
  843. typedef DECIMAL *LPDECIMAL;
  844. cpp_quote("#if ( _MSC_VER >= 800 )")
  845. cpp_quote("#if _MSC_VER >= 1200")
  846. cpp_quote("#pragma warning(pop)")
  847. cpp_quote("#else")
  848. cpp_quote("#pragma warning(default:4201)")
  849. cpp_quote("#endif")
  850. cpp_quote("#endif")
  851. /* IDL declarations for BSTR how to transmit them */
  852. //
  853. typedef [unique] FLAGGED_WORD_BLOB * wireBSTR;
  854. typedef [wire_marshal( wireBSTR )] OLECHAR *  BSTR;
  855. typedef BSTR * LPBSTR;
  856. cpp_quote("/* 0 == FALSE, -1 == TRUE */")
  857. typedef short VARIANT_BOOL;
  858. cpp_quote("#if !__STDC__ && (_MSC_VER <= 1000)")
  859. cpp_quote("/* For backward compatibility */")
  860. typedef VARIANT_BOOL _VARIANT_BOOL;
  861. cpp_quote("#else")
  862. cpp_quote("/* ANSI C/C++ reserve bool as keyword */")
  863. cpp_quote("#define _VARIANT_BOOL    /##/")
  864. cpp_quote("#endif")
  865. typedef boolean BOOLEAN;
  866. cpp_quote("/* The BSTRBLOB structure is used by some implementations */")
  867. cpp_quote("/* of the IPropertyStorage interface when marshaling BSTRs */")
  868. cpp_quote("/* on systems which don't support BSTR marshaling. */")
  869. cpp_quote("#ifndef _tagBSTRBLOB_DEFINED")
  870. cpp_quote("#define _tagBSTRBLOB_DEFINED")
  871. typedef struct tagBSTRBLOB
  872. {
  873.                           ULONG   cbSize;
  874.     [size_is(cbSize)]     BYTE    *pData;
  875. } BSTRBLOB, *LPBSTRBLOB;
  876. cpp_quote("#endif")
  877. cpp_quote("#define VARIANT_TRUE ((VARIANT_BOOL)-1)")
  878. cpp_quote("#define VARIANT_FALSE ((VARIANT_BOOL)0)")
  879. cpp_quote("#ifndef _tagBLOB_DEFINED")
  880. cpp_quote("#define _tagBLOB_DEFINED")
  881. cpp_quote("#define _BLOB_DEFINED")
  882. cpp_quote("#define _LPBLOB_DEFINED")
  883. typedef struct tagBLOB {
  884.     ULONG cbSize;
  885.     [size_is(cbSize)]
  886.     BYTE  *pBlobData;
  887. } BLOB, * LPBLOB;
  888. cpp_quote("#endif")
  889. typedef struct tagCLIPDATA {
  890.     ULONG cbSize;       // count that includes sizeof(ulClipFmt)
  891.     long ulClipFmt;     // long to keep alignment
  892.     [size_is(cbSize-4)]
  893.     BYTE * pClipData;   // cbSize-sizeof(ULONG) bytes of data in clipboard format
  894. } CLIPDATA;
  895. cpp_quote("// Macro to calculate the size of the above pClipData")
  896. cpp_quote("#define CBPCLIPDATA(clipdata)    ( (clipdata).cbSize - sizeof((clipdata).ulClipFmt) )")
  897. typedef unsigned short VARTYPE;
  898. // #########################################################################
  899. //
  900. //  VARTYPE
  901. //
  902. // #########################################################################
  903. cpp_quote("/*")
  904. cpp_quote(" * VARENUM usage key,")
  905. cpp_quote(" *")
  906. cpp_quote(" * * [V] - may appear in a VARIANT")
  907. cpp_quote(" * * [T] - may appear in a TYPEDESC")
  908. cpp_quote(" * * [P] - may appear in an OLE property set")
  909. cpp_quote(" * * [S] - may appear in a Safe Array")
  910. cpp_quote(" *")
  911. cpp_quote(" *")
  912. cpp_quote(" *  VT_EMPTY            [V]   [P]     nothing")
  913. cpp_quote(" *  VT_NULL             [V]   [P]     SQL style Null")
  914. cpp_quote(" *  VT_I2               [V][T][P][S]  2 byte signed int")
  915. cpp_quote(" *  VT_I4               [V][T][P][S]  4 byte signed int")
  916. cpp_quote(" *  VT_R4               [V][T][P][S]  4 byte real")
  917. cpp_quote(" *  VT_R8               [V][T][P][S]  8 byte real")
  918. cpp_quote(" *  VT_CY               [V][T][P][S]  currency")
  919. cpp_quote(" *  VT_DATE             [V][T][P][S]  date")
  920. cpp_quote(" *  VT_BSTR             [V][T][P][S]  OLE Automation string")
  921. cpp_quote(" *  VT_DISPATCH         [V][T]   [S]  IDispatch *")
  922. cpp_quote(" *  VT_ERROR            [V][T][P][S]  SCODE")
  923. cpp_quote(" *  VT_BOOL             [V][T][P][S]  True=-1, False=0")
  924. cpp_quote(" *  VT_VARIANT          [V][T][P][S]  VARIANT *")
  925. cpp_quote(" *  VT_UNKNOWN          [V][T]   [S]  IUnknown *")
  926. cpp_quote(" *  VT_DECIMAL          [V][T]   [S]  16 byte fixed point")
  927. cpp_quote(" *  VT_RECORD           [V]   [P][S]  user defined type")
  928. cpp_quote(" *  VT_I1               [V][T][P][s]  signed char")
  929. cpp_quote(" *  VT_UI1              [V][T][P][S]  unsigned char")
  930. cpp_quote(" *  VT_UI2              [V][T][P][S]  unsigned short")
  931. cpp_quote(" *  VT_UI4              [V][T][P][S]  unsigned long")
  932. cpp_quote(" *  VT_I8                  [T][P]     signed 64-bit int")
  933. cpp_quote(" *  VT_UI8                 [T][P]     unsigned 64-bit int")
  934. cpp_quote(" *  VT_INT              [V][T][P][S]  signed machine int")
  935. cpp_quote(" *  VT_UINT             [V][T]   [S]  unsigned machine int")
  936. cpp_quote(" *  VT_INT_PTR             [T]        signed machine register size width")
  937. cpp_quote(" *  VT_UINT_PTR            [T]        unsigned machine register size width")
  938. cpp_quote(" *  VT_VOID                [T]        C style void")
  939. cpp_quote(" *  VT_HRESULT             [T]        Standard return type")
  940. cpp_quote(" *  VT_PTR                 [T]        pointer type")
  941. cpp_quote(" *  VT_SAFEARRAY           [T]        (use VT_ARRAY in VARIANT)")
  942. cpp_quote(" *  VT_CARRAY              [T]        C style array")
  943. cpp_quote(" *  VT_USERDEFINED         [T]        user defined type")
  944. cpp_quote(" *  VT_LPSTR               [T][P]     null terminated string")
  945. cpp_quote(" *  VT_LPWSTR              [T][P]     wide null terminated string")
  946. cpp_quote(" *  VT_FILETIME               [P]     FILETIME")
  947. cpp_quote(" *  VT_BLOB                   [P]     Length prefixed bytes")
  948. cpp_quote(" *  VT_STREAM                 [P]     Name of the stream follows")
  949. cpp_quote(" *  VT_STORAGE                [P]     Name of the storage follows")
  950. cpp_quote(" *  VT_STREAMED_OBJECT        [P]     Stream contains an object")
  951. cpp_quote(" *  VT_STORED_OBJECT          [P]     Storage contains an object")
  952. cpp_quote(" *  VT_VERSIONED_STREAM       [P]     Stream with a GUID version")
  953. cpp_quote(" *  VT_BLOB_OBJECT            [P]     Blob contains an object ")
  954. cpp_quote(" *  VT_CF                     [P]     Clipboard format")
  955. cpp_quote(" *  VT_CLSID                  [P]     A Class ID")
  956. cpp_quote(" *  VT_VECTOR                 [P]     simple counted array")
  957. cpp_quote(" *  VT_ARRAY            [V]           SAFEARRAY*")
  958. cpp_quote(" *  VT_BYREF            [V]           void* for local use")
  959. cpp_quote(" *  VT_BSTR_BLOB                      Reserved for system use")
  960. cpp_quote(" */")
  961. enum VARENUM
  962. {
  963.     VT_EMPTY           = 0,
  964.     VT_NULL            = 1,
  965.     VT_I2              = 2,
  966.     VT_I4              = 3,
  967.     VT_R4              = 4,
  968.     VT_R8              = 5,
  969.     VT_CY              = 6,
  970.     VT_DATE            = 7,
  971.     VT_BSTR            = 8,
  972.     VT_DISPATCH        = 9,
  973.     VT_ERROR           = 10,
  974.     VT_BOOL            = 11,
  975.     VT_VARIANT         = 12,
  976.     VT_UNKNOWN         = 13,
  977.     VT_DECIMAL         = 14,
  978. // VBA reserves 15 for future use
  979.     VT_I1              = 16,
  980.     VT_UI1             = 17,
  981.     VT_UI2             = 18,
  982.     VT_UI4             = 19,
  983.     VT_I8              = 20,
  984.     VT_UI8             = 21,
  985.     VT_INT             = 22,
  986.     VT_UINT            = 23,
  987.     VT_VOID            = 24,
  988.     VT_HRESULT         = 25,
  989.     VT_PTR             = 26,
  990.     VT_SAFEARRAY       = 27,
  991.     VT_CARRAY          = 28,
  992.     VT_USERDEFINED     = 29,
  993.     VT_LPSTR           = 30,
  994.     VT_LPWSTR          = 31,
  995. // VBA reserves 32-35 for future use
  996.     VT_RECORD          = 36,
  997. VT_INT_PTR         = 37,
  998. VT_UINT_PTR        = 38,
  999.     VT_FILETIME        = 64,
  1000.     VT_BLOB            = 65,
  1001.     VT_STREAM          = 66,
  1002.     VT_STORAGE         = 67,
  1003.     VT_STREAMED_OBJECT = 68,
  1004.     VT_STORED_OBJECT   = 69,
  1005.     VT_BLOB_OBJECT     = 70,
  1006.     VT_CF              = 71,
  1007.     VT_CLSID           = 72,
  1008.     VT_VERSIONED_STREAM= 73,
  1009.     VT_BSTR_BLOB       = 0x0fff,
  1010.     VT_VECTOR          = 0x1000,
  1011.     VT_ARRAY           = 0x2000,
  1012.     VT_BYREF           = 0x4000,
  1013.     VT_RESERVED        = 0x8000,
  1014.     VT_ILLEGAL         = 0xffff,
  1015.     VT_ILLEGALMASKED   = 0x0fff,
  1016.     VT_TYPEMASK        = 0x0fff
  1017. };
  1018. // Property stuff
  1019. typedef ULONG PROPID;
  1020. // Access Control - ntseapi.h
  1021. cpp_quote( "#ifndef SID_IDENTIFIER_AUTHORITY_DEFINED" )
  1022. cpp_quote( "#define SID_IDENTIFIER_AUTHORITY_DEFINED" )
  1023. typedef struct _SID_IDENTIFIER_AUTHORITY {
  1024.     UCHAR Value[6];
  1025. } SID_IDENTIFIER_AUTHORITY, *PSID_IDENTIFIER_AUTHORITY;
  1026. cpp_quote( "#endif" )
  1027. cpp_quote( "#ifndef SID_DEFINED" )
  1028. cpp_quote( "#define SID_DEFINED" )
  1029. typedef struct _SID {
  1030.    BYTE Revision;
  1031.    BYTE SubAuthorityCount;
  1032.    SID_IDENTIFIER_AUTHORITY IdentifierAuthority;
  1033.    [size_is(SubAuthorityCount)] ULONG SubAuthority[*];
  1034. } SID, *PISID;
  1035. typedef struct _SID_AND_ATTRIBUTES {
  1036.     SID * Sid;
  1037.     DWORD Attributes;
  1038.     } SID_AND_ATTRIBUTES, * PSID_AND_ATTRIBUTES;
  1039. cpp_quote( "#endif" )
  1040. // Class Store types
  1041. //
  1042. // Platform/Architecture Definition
  1043. //
  1044.     typedef struct tagCSPLATFORM
  1045.     {
  1046.         DWORD dwPlatformId;     // This is the OS Platform
  1047.         DWORD dwVersionHi;      // Major Version of OS
  1048.         DWORD dwVersionLo;      // Minor Version of OS
  1049.         DWORD dwProcessorArch;  // This is the Processor Architecure
  1050.     } CSPLATFORM;
  1051. //
  1052. // Query Context Structure
  1053. // This contains a list of attributes used to look up a class implementation
  1054. //
  1055.     typedef struct tagQUERYCONTEXT {
  1056.           DWORD      dwContext;         // Execution context
  1057.           CSPLATFORM Platform;          // Client Platform/Architecture
  1058.           LCID       Locale;            // Locale ID
  1059.           DWORD      dwVersionHi;       // Low Version number
  1060.           DWORD      dwVersionLo;       // Hi Version number
  1061.     } QUERYCONTEXT;
  1062. //
  1063. // Class Specifier structure
  1064. // All means of mapping to a Class ID
  1065. // (Union of CLSID, File Extension, ProgId, MimeType, File Ext)
  1066. //
  1067.     typedef [v1_enum] enum tagTYSPEC {
  1068.         TYSPEC_CLSID,
  1069.         TYSPEC_FILEEXT,
  1070.         TYSPEC_MIMETYPE,
  1071.         TYSPEC_FILENAME,
  1072.         TYSPEC_PROGID,
  1073.         TYSPEC_PACKAGENAME,
  1074.         TYSPEC_OBJECTID
  1075.     } TYSPEC;
  1076.     typedef union switch(DWORD tyspec)
  1077.         {
  1078.         case TYSPEC_CLSID:
  1079.             CLSID   clsid;
  1080.         case TYSPEC_FILEEXT:
  1081.             LPOLESTR pFileExt;
  1082.         case TYSPEC_MIMETYPE:
  1083.             LPOLESTR pMimeType;
  1084.         case TYSPEC_PROGID:
  1085.             LPOLESTR pProgId;
  1086.         case TYSPEC_FILENAME:
  1087.             LPOLESTR pFileName;
  1088.         case TYSPEC_PACKAGENAME:
  1089.             struct {
  1090.             LPOLESTR pPackageName;
  1091.             GUID     PolicyId;
  1092.             } ByName;
  1093.         case TYSPEC_OBJECTID:
  1094.             struct {
  1095.             GUID     ObjectId;
  1096.             GUID     PolicyId;
  1097.             } ByObjectId;
  1098.     } uCLSSPEC;