1 /***********************************************************************\
2 *                               wtypes.d                                *
3 *                                                                       *
4 *                       Windows API header module                       *
5 *                                                                       *
6 *                 Translated from MinGW Windows headers                 *
7 *                                                                       *
8 *                       Placed into public domain                       *
9 \***********************************************************************/
10 module windows.wtypes;
11 nothrow:
12 import windows.rpc, windows.rpcndr;
13 private import windows.windef;
14 private import windows.uuid; // for GUID_NULL
15 
16 alias GUID_NULL IID_NULL, CLSID_NULL;
17 
18 const ROTFLAGS_REGISTRATIONKEEPSALIVE = 0x01;
19 const ROTFLAGS_ALLOWANYCLIENT         = 0x02;
20 
21 // also in winsock2.h
22 struct BLOB {
23 	ULONG cbSize;
24 	BYTE* pBlobData;
25 }
26 alias BLOB* PBLOB, LPBLOB;
27 
28 enum DVASPECT {
29 	DVASPECT_CONTENT   = 1,
30 	DVASPECT_THUMBNAIL = 2,
31 	DVASPECT_ICON      = 4,
32 	DVASPECT_DOCPRINT  = 8
33 }
34 
35 enum DVASPECT2 {
36 	DVASPECT_OPAQUE      = 16,
37 	DVASPECT_TRANSPARENT = 32
38 }
39 
40 enum STATFLAG {
41 	STATFLAG_DEFAULT = 0,
42 	STATFLAG_NONAME  = 1
43 }
44 
45 enum MEMCTX {
46 	MEMCTX_LOCAL = 0,
47 	MEMCTX_TASK,
48 	MEMCTX_SHARED,
49 	MEMCTX_MACSYSTEM,
50 	MEMCTX_UNKNOWN = -1,
51 	MEMCTX_SAME = -2
52 }
53 
54 enum MSHCTX {
55 	MSHCTX_LOCAL = 0,
56 	MSHCTX_NOSHAREDMEM,
57 	MSHCTX_DIFFERENTMACHINE,
58 	MSHCTX_INPROC,
59 	MSHCTX_CROSSCTX
60 }
61 
62 enum CLSCTX {
63 	CLSCTX_INPROC_SERVER   = 1,
64 	CLSCTX_INPROC_HANDLER  = 2,
65 	CLSCTX_LOCAL_SERVER    = 4,
66 	CLSCTX_INPROC_SERVER16 = 8,
67 	CLSCTX_REMOTE_SERVER   = 16
68 }
69 
70 enum MSHLFLAGS {
71 	MSHLFLAGS_NORMAL,
72 	MSHLFLAGS_TABLESTRONG,
73 	MSHLFLAGS_TABLEWEAK
74 }
75 
76 struct FLAGGED_WORD_BLOB {
77 	uint fFlags;
78 	uint clSize;
79 	ushort[1] asData;
80 }
81 
82 alias WCHAR OLECHAR;
83 alias LPWSTR LPOLESTR;
84 alias LPCWSTR LPCOLESTR;
85 
86 alias ushort VARTYPE;
87 alias short VARIANT_BOOL;
88 alias VARIANT_BOOL _VARIANT_BOOL;
89 const VARIANT_BOOL VARIANT_TRUE = -1; // 0xffff;
90 const VARIANT_BOOL VARIANT_FALSE = 0;
91 
92 alias OLECHAR* BSTR;
93 alias FLAGGED_WORD_BLOB* wireBSTR;
94 alias BSTR* LPBSTR;
95 //alias LONG SCODE; // also in winerror
96 mixin DECLARE_HANDLE!("HCONTEXT");
97 mixin DECLARE_HANDLE!("HMETAFILEPICT");
98 
99 union CY {
100 	struct {
101 		uint Lo;
102 		int Hi;
103 	}
104 	LONGLONG int64;
105 }
106 
107 alias double DATE;
108 struct  BSTRBLOB {
109 	ULONG cbSize;
110 	PBYTE pData;
111 }
112 alias BSTRBLOB* LPBSTRBLOB;
113 
114 // Used only in the PROPVARIANT structure
115 // According to the 2003 SDK, this should be in propidl.h, not here.
116 struct CLIPDATA {
117 	ULONG cbSize;
118 	int ulClipFmt;
119 	PBYTE pClipData;
120 }
121 
122 enum STGC {
123 	STGC_DEFAULT,
124 	STGC_OVERWRITE,
125 	STGC_ONLYIFCURRENT,
126 	STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE
127 }
128 
129 enum STGMOVE {
130 	STGMOVE_MOVE,
131 	STGMOVE_COPY,
132 	STGMOVE_SHALLOWCOPY
133 }
134 
135 enum VARENUM {
136 	VT_EMPTY,
137 	VT_NULL,
138 	VT_I2,
139 	VT_I4,
140 	VT_R4,
141 	VT_R8,
142 	VT_CY,
143 	VT_DATE,
144 	VT_BSTR,
145 	VT_DISPATCH,
146 	VT_ERROR,
147 	VT_BOOL,
148 	VT_VARIANT,
149 	VT_UNKNOWN,
150 	VT_DECIMAL,
151 	VT_I1 = 16,
152 	VT_UI1,
153 	VT_UI2,
154 	VT_UI4,
155 	VT_I8,
156 	VT_UI8,
157 	VT_INT,
158 	VT_UINT,
159 	VT_VOID,
160 	VT_HRESULT,
161 	VT_PTR,
162 	VT_SAFEARRAY,
163 	VT_CARRAY,
164 	VT_USERDEFINED,
165 	VT_LPSTR,
166 	VT_LPWSTR,
167 	VT_RECORD   = 36,
168 	VT_INT_PTR  = 37,
169 	VT_UINT_PTR = 38,
170 	VT_FILETIME = 64,
171 	VT_BLOB,
172 	VT_STREAM,
173 	VT_STORAGE,
174 	VT_STREAMED_OBJECT,
175 	VT_STORED_OBJECT,
176 	VT_BLOB_OBJECT,
177 	VT_CF,
178 	VT_CLSID,
179 	VT_BSTR_BLOB     = 0xfff,
180 	VT_VECTOR        = 0x1000,
181 	VT_ARRAY         = 0x2000,
182 	VT_BYREF         = 0x4000,
183 	VT_RESERVED      = 0x8000,
184 	VT_ILLEGAL       = 0xffff,
185 	VT_ILLEGALMASKED = 0xfff,
186 	VT_TYPEMASK      = 0xfff
187 };
188 
189 struct BYTE_SIZEDARR {
190 	uint clSize;
191 	byte* pData;
192 }
193 
194 struct WORD_SIZEDARR {
195 	uint clSize;
196 	ushort* pData;
197 }
198 
199 struct DWORD_SIZEDARR {
200 uint clSize;
201 uint* pData;
202 }
203 
204 struct HYPER_SIZEDARR {
205 	uint clSize;
206 	hyper* pData;
207 }
208 
209 alias double DOUBLE;
210 
211 
212 struct DECIMAL {
213 	USHORT wReserved;
214 	union {
215 		struct {
216 			ubyte scale; // valid values are 0 to 28
217 			ubyte sign; // 0 for positive, DECIMAL_NEG for negatives.
218 			enum ubyte DECIMAL_NEG = 0x80;
219 		}
220 		USHORT signscale;
221 	}
222 	ULONG Hi32;
223 	union {
224 		struct {
225 			ULONG Lo32;
226 			ULONG Mid32;
227 		}
228 		ULONGLONG Lo64;
229 	}
230 	// #define DECIMAL_SETZERO(d) {(d).Lo64=(d).Hi32=(d).signscale=0;}
231 	void setZero() { Lo64 = 0; Hi32 = 0; signscale = 0; }
232 }