From: Gregor Brunmar Date: Wed, 19 Dec 2007 19:49:10 +0000 (+0000) Subject: Implemented IDirect3D9->QueryInterface() X-Git-Tag: backups/curicon_rewrite@32816~350 X-Git-Url: https://git.reactos.org/?p=reactos.git;a=commitdiff_plain;h=162365cf347f981755a19ea611486ff588b92d27 Implemented IDirect3D9->QueryInterface() svn path=/trunk/; revision=31332 --- diff --git a/reactos/dll/directx/d3d9/d3d9.c b/reactos/dll/directx/d3d9/d3d9.c index 58e93e59d39..64e3f2754dc 100644 --- a/reactos/dll/directx/d3d9/d3d9.c +++ b/reactos/dll/directx/d3d9/d3d9.c @@ -61,6 +61,7 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) LPDIRECT3D9 D3D9Obj = 0; LPDIRECT3DCREATE9 DebugDirect3DCreate9 = 0; CHAR DebugMessageBuffer[DEBUG_MESSAGE_BUFFER_SIZE]; + UINT NoDebugSDKVersion = SDKVersion & 0x7FFFFFFF; UNIMPLEMENTED @@ -80,11 +81,11 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) } } - if ((SDKVersion & 0x7FFFFFFF) != D3D_SDK_VERSION || (SDKVersion & 0x7FFFFFFF) != D3D9b_SDK_VERSION) + if (NoDebugSDKVersion != D3D_SDK_VERSION && NoDebugSDKVersion != D3D9b_SDK_VERSION) { if (SDKVersion & 0x80000000) { - FormatDebugString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE, D3dError_WrongSdkVersion, SDKVersion, D3D_SDK_VERSION); + FormatDebugString(DebugMessageBuffer, DEBUG_MESSAGE_BUFFER_SIZE, D3dError_WrongSdkVersion, NoDebugSDKVersion, D3D_SDK_VERSION); OutputDebugStringA(DebugMessageBuffer); } @@ -98,13 +99,13 @@ IDirect3D9* WINAPI Direct3DCreate9(UINT SDKVersion) BOOL APIENTRY DllMain(HANDLE hModule, DWORD ul_reason_for_call, LPVOID lpReserved) { - switch (ul_reason_for_call) - { - case DLL_PROCESS_ATTACH: - case DLL_THREAD_ATTACH: - case DLL_THREAD_DETACH: - case DLL_PROCESS_DETACH: - break; + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; } return TRUE; diff --git a/reactos/dll/directx/d3d9/d3d9.rbuild b/reactos/dll/directx/d3d9/d3d9.rbuild index a456871525b..90b374d46be 100644 --- a/reactos/dll/directx/d3d9/d3d9.rbuild +++ b/reactos/dll/directx/d3d9/d3d9.rbuild @@ -5,6 +5,8 @@ advapi32 kernel32 + uuid + dxguid d3d9.c d3d9_helpers.c diff --git a/reactos/dll/directx/d3d9/d3d9_helpers.c b/reactos/dll/directx/d3d9/d3d9_helpers.c index 146eb197f69..b80ccc90bd7 100644 --- a/reactos/dll/directx/d3d9/d3d9_helpers.c +++ b/reactos/dll/directx/d3d9/d3d9_helpers.c @@ -56,7 +56,7 @@ HRESULT FormatDebugString(IN OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR For return 0; } -HRESULT CreateD3D9(IDirect3D9** ppDirect3D9) +HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9) { LPDIRECTD3D9_INT pDirect3D9; @@ -71,9 +71,9 @@ HRESULT CreateD3D9(IDirect3D9** ppDirect3D9) pDirect3D9->unknown000007 = 0; pDirect3D9->lpInt = 0; - //pDirect3D9->lpVtbl = &IDirect3D3_Vtbl; + pDirect3D9->lpVtbl = &Direct3D9_Vtbl; pDirect3D9->dwProcessId = GetCurrentThreadId(); - pDirect3D9->dwIntRefCnt = 1; + pDirect3D9->dwRefCnt = 1; *ppDirect3D9 = (IDirect3D9*)pDirect3D9; diff --git a/reactos/dll/directx/d3d9/d3d9_helpers.h b/reactos/dll/directx/d3d9/d3d9_helpers.h index c2a038dded2..90ae46408bc 100644 --- a/reactos/dll/directx/d3d9/d3d9_helpers.h +++ b/reactos/dll/directx/d3d9/d3d9_helpers.h @@ -16,4 +16,4 @@ BOOL ReadRegistryValue(IN DWORD ValueType, IN LPCSTR ValueName, OUT LPBYTE DataB HRESULT FormatDebugString(IN OUT LPSTR Buffer, IN LONG BufferSize, IN LPCSTR FormatString, ... ); /* Creates a Direct3D9 object */ -HRESULT CreateD3D9(IDirect3D9** ppDirect3D9); +HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9); diff --git a/reactos/dll/directx/d3d9/d3d9_impl.c b/reactos/dll/directx/d3d9/d3d9_impl.c index b15d1966c29..629e4b657f8 100644 --- a/reactos/dll/directx/d3d9/d3d9_impl.c +++ b/reactos/dll/directx/d3d9/d3d9_impl.c @@ -9,10 +9,17 @@ #include +static ULONG WINAPI IDirect3D9Impl_AddRef(LPDIRECT3D9 iface); + /* IDirect3D9: IUnknown implementation */ -static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppobj) +static HRESULT WINAPI IDirect3D9Impl_QueryInterface(LPDIRECT3D9 iface, REFIID riid, LPVOID* ppvObject) { - UNIMPLEMENTED + if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirect3D9)) + { + IDirect3D9Impl_AddRef(iface); + *ppvObject = iface; + return S_OK; + } return E_NOINTERFACE; } @@ -146,7 +153,7 @@ static HMONITOR WINAPI IDirect3D9Impl_GetAdapterMonitor(LPDIRECT3D9 iface, UINT static HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter, D3DDEVTYPE DeviceType, HWND hFocusWindow, DWORD BehaviourFlags, D3DPRESENT_PARAMETERS* pPresentationParameters, - IDirect3DDevice9** ppReturnedDeviceInterface) + struct IDirect3DDevice9** ppReturnedDeviceInterface) { UNIMPLEMENTED diff --git a/reactos/dll/directx/d3d9/d3d9_private.h b/reactos/dll/directx/d3d9/d3d9_private.h index 24789de70ad..316bef768b0 100644 --- a/reactos/dll/directx/d3d9/d3d9_private.h +++ b/reactos/dll/directx/d3d9/d3d9_private.h @@ -13,14 +13,16 @@ typedef IDirect3D9* (WINAPI *LPDIRECT3DCREATE9)(UINT); +extern const IDirect3D9Vtbl Direct3D9_Vtbl; + typedef struct _tagDIRECTD3D9_INT_ { -/* 0x0000 */ LPVOID lpVtbl; /* LPDIRECTD3D9 functoions table */ +/* 0x0000 */ const IDirect3D9Vtbl *lpVtbl; /* LPDIRECTD3D9 functoions table */ /* 0x0004 */ CRITICAL_SECTION d3d9_cs; -/* 0x001c */ DWORD unknown000007; /* 0x00000001 */ +/* 0x001c */ DWORD unknown000007; /* 0x00000001 */ /* 0x0020 */ DWORD dwProcessId; /* 0x0024 */ struct _tagDIRECTD3D9_INT_ * lpInt; -/* 0x0028 */ volatile LONG dwRefCnt; /* Increases and decreases by AddRef() and Release() */ +/* 0x0028 */ LONG dwRefCnt; /* Increases and decreases by AddRef() and Release() */ /* 0x002c */ DWORD unknown000011; /* 0x00000001 - Probably AdapterIndex */ /* 0x0030 */ GUID DisplayGuid; /*? Always {67685559-3106-11D0-B971-00AA00342F9F} ? */ /* 0x0040 */ CHAR DeviceName[16];