]> git.cworth.org Git - apitrace/blob - specs/winapi.py
Describe C++ references accurately.
[apitrace] / specs / winapi.py
1 ##########################################################################
2 #
3 # Copyright 2008-2009 VMware, Inc.
4 # All Rights Reserved.
5 #
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:
12 #
13 # The above copyright notice and this permission notice shall be included in
14 # all copies or substantial portions of the Software.
15 #
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
22 # THE SOFTWARE.
23 #
24 ##########################################################################/
25
26 """Win32 API type description."""
27
28 from stdapi import *
29
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)
38
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)
47
48 BYTE = Alias("BYTE", UInt8)
49 WORD = Alias("WORD", UInt16)
50 DWORD = Alias("DWORD", UInt32)
51
52 WCHAR = Alias("WCHAR", Short)
53
54 BOOL = Alias("BOOL", Bool)
55
56 LPLONG = Pointer(LONG)
57 LPWORD = Pointer(WORD)
58 LPDWORD = Pointer(DWORD)
59 LPBOOL = Pointer(BOOL)
60
61 LPSTR = CString
62 LPCSTR = Const(CString)
63 LPWSTR = WString
64 LPCWSTR = Const(WString)
65
66 LARGE_INTEGER = Struct("LARGE_INTEGER", [
67     (LONGLONG, 'QuadPart'),
68 ])
69
70 SIZE_T = Alias("SIZE_T", SizeT)
71
72 HRESULT = Alias("HRESULT", Int)
73
74 VOID = Void
75 PVOID = Opaque("PVOID")
76 LPVOID = PVOID
77 HANDLE = Opaque("HANDLE")
78 HWND = Opaque("HWND")
79 HDC = Opaque("HDC")
80 HMONITOR = Opaque("HMONITOR")
81
82 GUID = Struct("GUID", [
83     (DWORD, "Data1"),
84     (WORD, "Data2"),
85     (WORD, "Data3"),
86     (Array(BYTE, 8), "Data4"),
87 ])
88 LPGUID = Pointer(GUID)
89
90 REFGUID = Alias("REFGUID", Reference(GUID))
91
92 IID = Alias("IID", GUID)
93 REFIID = Alias("REFIID", Reference(IID))
94
95 CLSID = Alias("CLSID", GUID)
96 REFCLSID = Alias("REFCLSID", Reference(CLSID))
97
98 LUID = Struct("LUID", [
99     (DWORD, "LowPart"),
100     (LONG, "HighPart"),
101 ])
102
103 POINT = Struct("POINT", (
104   (LONG, "x"),
105   (LONG, "y"),
106 )) 
107 LPPOINT = Pointer(POINT)
108
109 SIZE = Struct("SIZE", (
110   (LONG, "cx"),
111   (LONG, "cy"),
112 )) 
113 LPSIZE = Pointer(SIZE)
114
115 RECT = Struct("RECT", (
116   (LONG, "left"),
117   (LONG, "top"),
118   (LONG, "right"), 
119   (LONG, "bottom"), 
120 )) 
121 LPRECT = Pointer(RECT)
122
123 PALETTEENTRY = Struct("PALETTEENTRY", (
124   (BYTE, "peRed"),
125   (BYTE, "peGreen"),
126   (BYTE, "peBlue"), 
127   (BYTE, "peFlags"), 
128 )) 
129 LPPALETTEENTRY = Pointer(PALETTEENTRY)
130
131
132 RGNDATAHEADER = Struct("RGNDATAHEADER", [
133     (DWORD, "dwSize"),
134     (DWORD, "iType"),
135     (DWORD, "nCount"),
136     (DWORD, "nRgnSize"),
137     (RECT, "rcBound"),
138 ])
139
140 RGNDATA = Struct("RGNDATA", [
141     (RGNDATAHEADER, "rdh"),
142     #(Char, "Buffer[1]"),
143 ])
144 LPRGNDATA = Pointer(RGNDATA)
145
146 HMODULE = Opaque("HMODULE")
147
148 IUnknown = Interface("IUnknown")
149
150 FILETIME = Struct("FILETIME", [
151     (DWORD, "dwLowDateTime"),
152     (DWORD, "dwHighDateTime"),
153 ])
154
155 COLORREF = Alias("COLORREF", DWORD)
156
157 LOGFONTW = Struct("LOGFONTW", [
158     (LONG, "lfHeight"),
159     (LONG, "lfWidth"),
160     (LONG, "lfEscapement"),
161     (LONG, "lfOrientation"),
162     (LONG, "lfWeight"),
163     (BYTE, "lfItalic"),
164     (BYTE, "lfUnderline"),
165     (BYTE, "lfStrikeOut"),
166     (BYTE, "lfCharSet"),
167     (BYTE, "lfOutPrecision"),
168     (BYTE, "lfClipPrecision"),
169     (BYTE, "lfQuality"),
170     (BYTE, "lfPitchAndFamily"),
171     (WString, "lfFaceName"),
172 ])
173
174 HRESULT_com = FakeEnum(HRESULT, [
175     "S_OK",
176     "E_NOINTERFACE",
177     "E_POINTER",
178 ])
179
180 IUnknown.methods = (
181         Method(HRESULT_com, "QueryInterface", ((REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppvObj"))),
182         Method(ULONG, "AddRef", ()),
183         Method(ULONG, "Release", ()),
184 )
185
186