From: José Fonseca Date: Mon, 16 Apr 2012 11:54:05 +0000 (+0100) Subject: Improve HRESULT handling. X-Git-Url: https://git.cworth.org/git?a=commitdiff_plain;h=9a3468aaaab098377a39b8f2ab4649be4b028971;p=apitrace Improve HRESULT handling. --- diff --git a/specs/d3d.py b/specs/d3d.py index c390501..2a02afd 100644 --- a/specs/d3d.py +++ b/specs/d3d.py @@ -48,7 +48,7 @@ d3ddpFlags = Flags(DWORD, [ "D3DDP_DONOTLIGHT", ]) -HRESULT = Enum("HRESULT", [ +HRESULT = FakeEnum(HRESULT, [ "D3D_OK", "D3DERR_BADMAJORVERSION", "D3DERR_BADMINORVERSION", diff --git a/specs/d3d10.py b/specs/d3d10.py index a72d321..88e8cc5 100644 --- a/specs/d3d10.py +++ b/specs/d3d10.py @@ -33,11 +33,6 @@ HRESULT = FakeEnum(HRESULT, [ "D3D10_ERROR_TOO_MANY_UNIQUE_STATE_OBJECTS", "D3DERR_INVALIDCALL", "D3DERR_WASSTILLDRAWING", - "E_FAIL", - "E_INVALIDARG", - "E_OUTOFMEMORY", - "S_FALSE", - "S_OK", ]) D3D10_BLEND = Enum("D3D10_BLEND", [ diff --git a/specs/d3d11.py b/specs/d3d11.py index 014c6d0..0f5c202 100644 --- a/specs/d3d11.py +++ b/specs/d3d11.py @@ -36,11 +36,6 @@ HRESULT = FakeEnum(HRESULT, [ "D3D11_ERROR_DEFERRED_CONTEXT_MAP_WITHOUT_INITIAL_DISCARD", "D3DERR_INVALIDCALL", "D3DERR_WASSTILLDRAWING", - "E_FAIL", - "E_INVALIDARG", - "E_OUTOFMEMORY", - "S_FALSE", - "S_OK", ]) diff --git a/specs/d3d8.py b/specs/d3d8.py index d324601..79177cf 100644 --- a/specs/d3d8.py +++ b/specs/d3d8.py @@ -29,7 +29,7 @@ from winapi import * from d3d8types import * from d3d8caps import * -HRESULT = Enum("HRESULT", [ +HRESULT = FakeEnum(HRESULT, [ "D3D_OK", "D3DERR_WRONGTEXTUREFORMAT", "D3DERR_UNSUPPORTEDCOLOROPERATION", diff --git a/specs/d3d9.py b/specs/d3d9.py index 74da462..475508c 100644 --- a/specs/d3d9.py +++ b/specs/d3d9.py @@ -78,7 +78,7 @@ D3DPRESENT = Flags(DWORD, [ "D3DPRESENT_VIDEO_RESTRICT_TO_MONITOR", ]) -HRESULT = Enum("HRESULT", [ +HRESULT = FakeEnum(HRESULT, [ "D3D_OK", "D3DERR_WRONGTEXTUREFORMAT", "D3DERR_UNSUPPORTEDCOLOROPERATION", diff --git a/specs/dxgiformat.py b/specs/dxgiformat.py index 9b1326e..b2d2a75 100644 --- a/specs/dxgiformat.py +++ b/specs/dxgiformat.py @@ -23,8 +23,10 @@ # ##########################################################################/ + from winapi import * + DXGI_FORMAT = Enum("DXGI_FORMAT", [ "DXGI_FORMAT_UNKNOWN", "DXGI_FORMAT_R32G32B32A32_TYPELESS", diff --git a/specs/dxgitype.py b/specs/dxgitype.py index f5237c9..c7c610c 100644 --- a/specs/dxgitype.py +++ b/specs/dxgitype.py @@ -23,8 +23,48 @@ # ##########################################################################/ + from dxgiformat import * + +HRESULT = FakeEnum(HRESULT, [ + "DXGI_STATUS_OCCLUDED", + "DXGI_STATUS_CLIPPED", + "DXGI_STATUS_NO_REDIRECTION", + "DXGI_STATUS_NO_DESKTOP_ACCESS", + "DXGI_STATUS_GRAPHICS_VIDPN_SOURCE_IN_USE", + "DXGI_STATUS_MODE_CHANGED", + "DXGI_STATUS_MODE_CHANGE_IN_PROGRESS", + "DXGI_ERROR_INVALID_CALL", + "DXGI_ERROR_NOT_FOUND", + "DXGI_ERROR_MORE_DATA", + "DXGI_ERROR_UNSUPPORTED", + "DXGI_ERROR_DEVICE_REMOVED", + "DXGI_ERROR_DEVICE_HUNG", + "DXGI_ERROR_DEVICE_RESET", + "DXGI_ERROR_WAS_STILL_DRAWING", + "DXGI_ERROR_FRAME_STATISTICS_DISJOINT", + "DXGI_ERROR_GRAPHICS_VIDPN_SOURCE_IN_USE", + "DXGI_ERROR_DRIVER_INTERNAL_ERROR", + "DXGI_ERROR_NONEXCLUSIVE", + "DXGI_ERROR_NOT_CURRENTLY_AVAILABLE", + "DXGI_ERROR_REMOTE_CLIENT_DISCONNECTED", + "DXGI_ERROR_REMOTE_OUTOFMEMORY", + "DXGI_CPU_ACCESS_NONE", + "DXGI_CPU_ACCESS_DYNAMIC", + "DXGI_CPU_ACCESS_READ_WRITE", + "DXGI_CPU_ACCESS_SCRATCH", + "DXGI_CPU_ACCESS_FIELD", + "DXGI_USAGE_SHADER_INPUT", + "DXGI_USAGE_RENDER_TARGET_OUTPUT", + "DXGI_USAGE_BACK_BUFFER", + "DXGI_USAGE_SHARED", + "DXGI_USAGE_READ_ONLY", + "DXGI_USAGE_DISCARD_ON_PRESENT", + "DXGI_USAGE_UNORDERED_ACCESS", +]) + + DXGI_RGB = Struct("DXGI_RGB", [ (Float, "Red"), (Float, "Green"), diff --git a/specs/winapi.py b/specs/winapi.py index a7556e7..ea9252f 100644 --- a/specs/winapi.py +++ b/specs/winapi.py @@ -25,8 +25,10 @@ """Win32 API type description.""" + from stdapi import * + SHORT = Alias("SHORT", Short) USHORT = Alias("USHORT", UShort) INT = Alias("INT", Int) @@ -69,8 +71,6 @@ LARGE_INTEGER = Struct("LARGE_INTEGER", [ SIZE_T = Alias("SIZE_T", SizeT) -HRESULT = Alias("HRESULT", Int) - VOID = Void PVOID = Opaque("PVOID") LPVOID = PVOID @@ -149,8 +149,6 @@ LPRGNDATA = Pointer(RGNDATA) HMODULE = DECLARE_HANDLE("HMODULE") -IUnknown = Interface("IUnknown") - FILETIME = Struct("FILETIME", [ (DWORD, "dwLowDateTime"), (DWORD, "dwHighDateTime"), @@ -175,14 +173,30 @@ LOGFONTW = Struct("LOGFONTW", [ (WString, "lfFaceName"), ]) -HRESULT_com = FakeEnum(HRESULT, [ - "S_OK", - "E_NOINTERFACE", - "E_POINTER", + +# http://msdn.microsoft.com/en-us/library/ff485842.aspx +# http://msdn.microsoft.com/en-us/library/windows/desktop/ms681381.aspx +HRESULT = Enum("HRESULT", [ + "S_OK", # 0x0 + "S_FALSE", # 0x1 + "E_PENDING", # 0x8000000A + "E_NOTIMPL", # 0x80004001 + "E_NOINTERFACE", # 0x80004002 + "E_POINTER", # 0x80004003 + "E_ABORT", # 0x80004004 + "E_FAIL", # 0x80004005 + "E_UNEXPECTED", # 0x8000FFFF + "E_ACCESSDENIED", # 0x80070005 + "E_HANDLE", # 0x80070006 + "E_OUTOFMEMORY", # 0x8007000E + "E_INVALIDARG", # 0x80070057 ]) + +IUnknown = Interface("IUnknown") + IUnknown.methods = ( - Method(HRESULT_com, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))), + Method(HRESULT, "QueryInterface", ((REFIID, "riid"), Out(Pointer(ObjPointer(Void)), "ppvObj"))), Method(ULONG, "AddRef", ()), Method(ULONG, "Release", ()), )