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 win32.wtypes;
11 
12 import win32.rpc, win32.rpcndr;
13 private import win32.windef;
14 private import win32.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 asData[1];
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 alias HANDLE HCONTEXT, HMETAFILEPICT;
97 
98 union CY {
99 	struct {
100 		uint Lo;
101 		int Hi;
102 	}
103 	LONGLONG int64;
104 }
105 
106 alias double DATE;
107 struct  BSTRBLOB {
108 	ULONG cbSize;
109 	PBYTE pData;
110 }
111 alias BSTRBLOB* LPBSTRBLOB;
112 
113 // Used only in the PROPVARIANT structure
114 // According to the 2003 SDK, this should be in propidl.h, not here.
115 struct CLIPDATA {
116 	ULONG cbSize;
117 	int ulClipFmt;
118 	PBYTE pClipData;
119 }
120 
121 enum STGC {
122 	STGC_DEFAULT,
123 	STGC_OVERWRITE,
124 	STGC_ONLYIFCURRENT,
125 	STGC_DANGEROUSLYCOMMITMERELYTODISKCACHE
126 }
127 
128 enum STGMOVE {
129 	STGMOVE_MOVE,
130 	STGMOVE_COPY,
131 	STGMOVE_SHALLOWCOPY
132 }
133 
134 enum VARENUM {
135 	VT_EMPTY,
136 	VT_NULL,
137 	VT_I2,
138 	VT_I4,
139 	VT_R4,
140 	VT_R8,
141 	VT_CY,
142 	VT_DATE,
143 	VT_BSTR,
144 	VT_DISPATCH,
145 	VT_ERROR,
146 	VT_BOOL,
147 	VT_VARIANT,
148 	VT_UNKNOWN,
149 	VT_DECIMAL,
150 	VT_I1 = 16,
151 	VT_UI1,
152 	VT_UI2,
153 	VT_UI4,
154 	VT_I8,
155 	VT_UI8,
156 	VT_INT,
157 	VT_UINT,
158 	VT_VOID,
159 	VT_HRESULT,
160 	VT_PTR,
161 	VT_SAFEARRAY,
162 	VT_CARRAY,
163 	VT_USERDEFINED,
164 	VT_LPSTR,
165 	VT_LPWSTR,
166 	VT_RECORD   = 36,
167 	VT_INT_PTR  = 37,
168 	VT_UINT_PTR = 38,
169 	VT_FILETIME = 64,
170 	VT_BLOB,
171 	VT_STREAM,
172 	VT_STORAGE,
173 	VT_STREAMED_OBJECT,
174 	VT_STORED_OBJECT,
175 	VT_BLOB_OBJECT,
176 	VT_CF,
177 	VT_CLSID,
178 	VT_BSTR_BLOB     = 0xfff,
179 	VT_VECTOR        = 0x1000,
180 	VT_ARRAY         = 0x2000,
181 	VT_BYREF         = 0x4000,
182 	VT_RESERVED      = 0x8000,
183 	VT_ILLEGAL       = 0xffff,
184 	VT_ILLEGALMASKED = 0xfff,
185 	VT_TYPEMASK      = 0xfff
186 };
187 
188 struct BYTE_SIZEDARR {
189 	uint clSize;
190 	byte* pData;
191 }
192 
193 struct WORD_SIZEDARR {
194 	uint clSize;
195 	ushort* pData;
196 }
197 
198 struct DWORD_SIZEDARR {
199 uint clSize;
200 uint* pData;
201 }
202 
203 struct HYPER_SIZEDARR {
204 	uint clSize;
205 	hyper* pData;
206 }
207 
208 alias double DOUBLE;
209 
210 
211 struct DECIMAL {
212 	USHORT wReserved;
213 	union {
214 		struct {
215 			ubyte scale; // valid values are 0 to 28
216 			ubyte sign; // 0 for positive, DECIMAL_NEG for negatives.
217 			ubyte DECIMAL_NEG = 0x80;
218 		}
219 		USHORT signscale;
220 	}
221 	ULONG Hi32;
222 	union {
223 		struct {
224 			ULONG Lo32;
225 			ULONG Mid32;
226 		}
227 		ULONGLONG Lo64;
228 	}
229 	// #define DECIMAL_SETZERO(d) {(d).Lo64=(d).Hi32=(d).signscale=0;}
230 	void setZero() { Lo64 = 0; Hi32 = 0; signscale = 0; }
231 }