Author: gbrunmar
Date: Wed Dec 19 22:49:10 2007
New Revision: 31332
URL:
http://svn.reactos.org/svn/reactos?rev=31332&view=rev
Log:
Implemented IDirect3D9->QueryInterface()
Modified:
trunk/reactos/dll/directx/d3d9/d3d9.c
trunk/reactos/dll/directx/d3d9/d3d9.rbuild
trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
trunk/reactos/dll/directx/d3d9/d3d9_impl.c
trunk/reactos/dll/directx/d3d9/d3d9_private.h
Modified: trunk/reactos/dll/directx/d3d9/d3d9.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.c?re…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.c Wed Dec 19 22:49:10 2007
@@ -61,6 +61,7 @@
LPDIRECT3D9 D3D9Obj = 0;
LPDIRECT3DCREATE9 DebugDirect3DCreate9 = 0;
CHAR DebugMessageBuffer[DEBUG_MESSAGE_BUFFER_SIZE];
+ UINT NoDebugSDKVersion = SDKVersion & 0x7FFFFFFF;
UNIMPLEMENTED
@@ -80,11 +81,11 @@
}
}
- 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 @@
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;
Modified: trunk/reactos/dll/directx/d3d9/d3d9.rbuild
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9.rbui…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9.rbuild (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9.rbuild Wed Dec 19 22:49:10 2007
@@ -5,6 +5,8 @@
<library>advapi32</library>
<library>kernel32</library>
+ <library>uuid</library>
+ <library>dxguid</library>
<file>d3d9.c</file>
<file>d3d9_helpers.c</file>
Modified: trunk/reactos/dll/directx/d3d9/d3d9_helpers.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.c Wed Dec 19 22:49:10 2007
@@ -56,7 +56,7 @@
return 0;
}
-HRESULT CreateD3D9(IDirect3D9** ppDirect3D9)
+HRESULT CreateD3D9(OUT LPDIRECT3D9 *ppDirect3D9)
{
LPDIRECTD3D9_INT pDirect3D9;
@@ -71,9 +71,9 @@
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;
Modified: trunk/reactos/dll/directx/d3d9/d3d9_helpers.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_help…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_helpers.h (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_helpers.h Wed Dec 19 22:49:10 2007
@@ -16,4 +16,4 @@
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);
Modified: trunk/reactos/dll/directx/d3d9/d3d9_impl.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_impl…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_impl.c (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_impl.c Wed Dec 19 22:49:10 2007
@@ -9,10 +9,17 @@
#include <debug.h>
+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 HRESULT WINAPI IDirect3D9Impl_CreateDevice(LPDIRECT3D9 iface, UINT Adapter,
D3DDEVTYPE DeviceType,
HWND hFocusWindow, DWORD
BehaviourFlags,
D3DPRESENT_PARAMETERS*
pPresentationParameters,
- IDirect3DDevice9**
ppReturnedDeviceInterface)
+ struct IDirect3DDevice9**
ppReturnedDeviceInterface)
{
UNIMPLEMENTED
Modified: trunk/reactos/dll/directx/d3d9/d3d9_private.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/directx/d3d9/d3d9_priv…
==============================================================================
--- trunk/reactos/dll/directx/d3d9/d3d9_private.h (original)
+++ trunk/reactos/dll/directx/d3d9/d3d9_private.h Wed Dec 19 22:49:10 2007
@@ -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];