1 ##########################################################################
3 # Copyright 2008-2009 VMware, Inc.
6 # Permission is hereby granted, free of charge, to any person obtaining a copy
7 # of this software and associated documentation files (the "Software"), to deal
8 # in the Software without restriction, including without limitation the rights
9 # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10 # copies of the Software, and to permit persons to whom the Software is
11 # furnished to do so, subject to the following conditions:
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
24 ##########################################################################/
26 """Win32 API type description."""
30 SHORT = Alias("SHORT", Short)
31 USHORT = Alias("USHORT", UShort)
32 INT = Alias("INT", Int)
33 UINT = Alias("UINT", UInt)
34 LONG = Alias("LONG", Long)
35 ULONG = Alias("ULONG", ULong)
36 LONGLONG = Alias("LONGLONG", LongLong)
37 FLOAT = Alias("FLOAT", Float)
39 INT8 = Alias("INT8", Int8)
40 UINT8 = Alias("UINT8", UInt8)
41 INT16 = Alias("INT16", Int16)
42 UINT16 = Alias("UINT16", UInt16)
43 INT32 = Alias("INT32", Int32)
44 UINT32 = Alias("UINT32", UInt32)
45 INT64 = Alias("INT64", Int64)
46 UINT64 = Alias("UINT64", UInt64)
48 BYTE = Alias("BYTE", UInt8)
49 WORD = Alias("WORD", UInt16)
50 DWORD = Alias("DWORD", UInt32)
52 WCHAR = Alias("WCHAR", Short)
54 BOOL = Alias("BOOL", Bool)
56 LPLONG = Pointer(LONG)
57 LPWORD = Pointer(WORD)
58 LPDWORD = Pointer(DWORD)
59 LPBOOL = Pointer(BOOL)
62 LPCSTR = Const(CString)
64 LPCWSTR = Const(WString)
66 LARGE_INTEGER = Struct("LARGE_INTEGER", [
67 (LONGLONG, 'QuadPart'),
70 SIZE_T = Alias("SIZE_T", SizeT)
72 HRESULT = Alias("HRESULT", Int)
75 PVOID = Opaque("PVOID")
78 def DECLARE_HANDLE(expr):
79 return Handle(expr, IntPointer(expr))
81 HANDLE = DECLARE_HANDLE("HANDLE")
82 HWND = DECLARE_HANDLE("HWND")
83 HDC = DECLARE_HANDLE("HDC")
84 HMONITOR = DECLARE_HANDLE("HMONITOR")
86 GUID = Struct("GUID", [
90 (Array(BYTE, 8), "Data4"),
92 LPGUID = Pointer(GUID)
94 REFGUID = Alias("REFGUID", Reference(GUID))
96 IID = Alias("IID", GUID)
97 REFIID = Alias("REFIID", Reference(IID))
99 CLSID = Alias("CLSID", GUID)
100 REFCLSID = Alias("REFCLSID", Reference(CLSID))
102 LUID = Struct("LUID", [
107 POINT = Struct("POINT", (
111 LPPOINT = Pointer(POINT)
113 SIZE = Struct("SIZE", (
117 LPSIZE = Pointer(SIZE)
119 RECT = Struct("RECT", (
125 LPRECT = Pointer(RECT)
127 PALETTEENTRY = Struct("PALETTEENTRY", (
133 LPPALETTEENTRY = Pointer(PALETTEENTRY)
136 RGNDATAHEADER = Struct("RGNDATAHEADER", [
144 RGNDATA = Struct("RGNDATA", [
145 (RGNDATAHEADER, "rdh"),
146 #(Char, "Buffer[1]"),
148 LPRGNDATA = Pointer(RGNDATA)
150 HMODULE = DECLARE_HANDLE("HMODULE")
152 IUnknown = Interface("IUnknown")
154 FILETIME = Struct("FILETIME", [
155 (DWORD, "dwLowDateTime"),
156 (DWORD, "dwHighDateTime"),
159 COLORREF = Alias("COLORREF", DWORD)
161 LOGFONTW = Struct("LOGFONTW", [
164 (LONG, "lfEscapement"),
165 (LONG, "lfOrientation"),
168 (BYTE, "lfUnderline"),
169 (BYTE, "lfStrikeOut"),
171 (BYTE, "lfOutPrecision"),
172 (BYTE, "lfClipPrecision"),
174 (BYTE, "lfPitchAndFamily"),
175 (WString, "lfFaceName"),
178 HRESULT_com = FakeEnum(HRESULT, [
185 Method(HRESULT_com, "QueryInterface", ((REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppvObj"))),
186 Method(ULONG, "AddRef", ()),
187 Method(ULONG, "Release", ()),