]> git.cworth.org Git - apitrace/blobdiff - winapi.py
Avoid pointless data structure copying.
[apitrace] / winapi.py
index 3777dcbf3c8baab08f5a3818a1b64da977e91f0d..ee9c91f94b0ecbcc96d925eecd3d44eee6f3e9f0 100644 (file)
--- a/winapi.py
+++ b/winapi.py
@@ -36,20 +36,20 @@ ULONG = Alias("ULONG", ULong)
 LONGLONG = Alias("LONGLONG", LongLong)
 FLOAT = Alias("FLOAT", Float)
 
-INT32 = Literal("INT32", "UInt")
+INT32 = Literal("INT32", "SInt")
 UINT32 = Literal("UINT32", "UInt")
 
 BYTE = Literal("BYTE", "UInt", base=16)
 WORD = Literal("WORD", "UInt", base=16)
 DWORD = Literal("DWORD", "UInt", base=16)
 
+
 BOOL = Alias("BOOL", Bool)
 
 LPLONG = Pointer(LONG)
 LPWORD = Pointer(WORD)
 LPDWORD = Pointer(DWORD)
 LPBOOL = Pointer(BOOL)
-LPSIZE = LPDWORD
 
 LPSTR = CString
 LPCSTR = Const(CString)
@@ -76,14 +76,7 @@ GUID = Struct("GUID", [
     (DWORD, "Data1"),
     (WORD, "Data2"),
     (WORD, "Data3"),
-    (BYTE, "Data4[0]"),
-    (BYTE, "Data4[1]"),
-    (BYTE, "Data4[2]"),
-    (BYTE, "Data4[3]"),
-    (BYTE, "Data4[4]"),
-    (BYTE, "Data4[5]"),
-    (BYTE, "Data4[6]"),
-    (BYTE, "Data4[7]"),
+    (Array(BYTE, "8"), "Data4"),
 ])
 LPGUID = Pointer(GUID)
 
@@ -109,6 +102,12 @@ POINT = Struct("POINT", (
 )) 
 LPPOINT = Pointer(POINT)
 
+SIZE = Struct("SIZE", (
+  (LONG, "cx"),
+  (LONG, "cy"),
+)) 
+LPSIZE = Pointer(SIZE)
+
 RECT = Struct("RECT", (
   (LONG, "left"),
   (LONG, "top"),
@@ -144,8 +143,14 @@ HMODULE = Opaque("HMODULE")
 
 IUnknown = Interface("IUnknown")
 
+HRESULT_com = FakeEnum(HRESULT, [
+    "S_OK",
+    "E_NOINTERFACE",
+    "E_POINTER",
+])
+
 IUnknown.methods = (
-       Method(HRESULT, "QueryInterface", ((REFIID, "riid"), (Pointer(OpaquePointer(Void)), "ppvObj"))),
+       Method(HRESULT_com, "QueryInterface", ((REFIID, "riid"), Out(Pointer(OpaquePointer(Void)), "ppvObj"))),
        Method(ULONG, "AddRef", ()),
        Method(ULONG, "Release", ()),
 )