From: Fabian Maurer Subject: [v2 2/3] dx8vb: Add stubs for IDirectX8 interface Message-Id: <20171104204214.3257-2-dark.shadow4@web.de> Date: Sat, 4 Nov 2017 21:42:13 +0100 In-Reply-To: <20171104204214.3257-1-dark.shadow4@web.de> References: <20171104204214.3257-1-dark.shadow4@web.de> v2: -Improved QueryInterface -don't typedef struct -use lowercase variable names -use better parameter names Signed-off-by: Fabian Maurer --- dlls/dx8vb/Makefile.in | 1 + dlls/dx8vb/directx8.c | 297 +++++++++++++++++++++++++++++++++++++++++++++ dlls/dx8vb/dx8vb_private.h | 1 + dlls/dx8vb/main.c | 1 + 4 files changed, 300 insertions(+) create mode 100644 dlls/dx8vb/directx8.c diff --git a/dlls/dx8vb/Makefile.in b/dlls/dx8vb/Makefile.in index acf672f586..8438d022f4 100644 --- a/dlls/dx8vb/Makefile.in +++ b/dlls/dx8vb/Makefile.in @@ -3,6 +3,7 @@ IMPORTS = uuid ole32 C_SRCS = \ d3dx8.c \ + directx8.c \ main.c IDL_SRCS = dx8vb.idl diff --git a/dlls/dx8vb/directx8.c b/dlls/dx8vb/directx8.c new file mode 100644 index 0000000000..9294d5b3e6 --- /dev/null +++ b/dlls/dx8vb/directx8.c @@ -0,0 +1,297 @@ +/* + * Copyright 2017 Fabian Maurer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS + +#include "config.h" + +#include "dx8vb_private.h" +#include "ocidl.h" + +#include "wine/debug.h" + +WINE_DEFAULT_DEBUG_CHANNEL(dx8vb); + +struct directx8 +{ + IDirectX8 IDirectX8_iface; + LONG ref; +}; + +static inline struct directx8 *impl_from_IDirectX8(IDirectX8 *iface) +{ + return CONTAINING_RECORD(iface, struct directx8, IDirectX8_iface); +} + +/*** directx8 - IUnknown methods ***/ + +static HRESULT WINAPI directx8_QueryInterface(IDirectX8 *iface, REFIID riid, void **ppv) +{ + struct directx8 *this = impl_from_IDirectX8(iface); + + TRACE("(%p/%p)->(%s,%p)\n", iface, this, debugstr_guid(riid), ppv); + + if (IsEqualGUID(riid, &IID_IDirectX8) + || IsEqualGUID(riid, &IID_IUnknown)) + { + IUnknown_AddRef(iface); + *ppv = iface; + return S_OK; + } + + WARN("%s not implemented, returning E_NOINTERFACE.\n", debugstr_guid(riid)); + *ppv = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI directx8_AddRef(IDirectX8 *iface) +{ + struct directx8 *this = impl_from_IDirectX8(iface); + ULONG ref = InterlockedIncrement(&this->ref); + + TRACE("(%p/%p)->(): new ref %d\n", iface, this, ref); + + return ref; +} + +static ULONG WINAPI directx8_Release(IDirectX8 *iface) +{ + struct directx8 *this = impl_from_IDirectX8(iface); + ULONG ref = InterlockedDecrement(&this->ref); + + TRACE("(%p/%p)->(): new ref %d\n", iface, this, ref); + + if (!ref) + HeapFree(GetProcessHeap(), 0, this); + + return ref; +} + +/*** directx8 - IDirectX8 methods ***/ + +static HRESULT WINAPI directx8_DirectSoundCreate(IDirectX8 *iface, BSTR guid, DirectSound8 **ret) +{ + FIXME("(%p, %p): stub!\n", guid, ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectSoundCaptureCreate(IDirectX8 *iface, BSTR guid, DirectSoundCapture8 **ret) +{ + FIXME("(%p, %p): stub!\n", guid, ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_GetDSEnum(IDirectX8 *iface, DirectSoundEnum8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_GetDSCaptureEnum(IDirectX8 *iface, DirectSoundEnum8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectInputCreate(IDirectX8 *iface, DirectInput8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectMusicLoaderCreate(IDirectX8 *iface, DirectMusicLoader8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectMusicComposerCreate(IDirectX8 *iface, DirectMusicComposer8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectMusicPerformanceCreate(IDirectX8 *iface, DirectMusicPerformance8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_CreateEvent(IDirectX8 *iface, DirectXEvent8 *event, LONG *h) +{ + FIXME("(%p, %p): stub!\n", event, h); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_SetEvent(IDirectX8 *iface, LONG eventid) +{ + FIXME("(%d): stub!\n", eventid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DestroyEvent(IDirectX8 *iface, LONG eventid) +{ + FIXME("(%d): stub!\n", eventid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_CreateNewGuid(IDirectX8 *iface, BSTR *guid) +{ + FIXME("(%p): stub!\n", guid); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayVoiceClientCreate(IDirectX8 *iface, DirectPlayVoiceClient8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayVoiceServerCreate(IDirectX8 *iface, DirectPlayVoiceServer8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayVoiceTestCreate(IDirectX8 *iface, DirectPlayVoiceTest8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectXFileCreate(IDirectX8 *iface, DirectXFile **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayPeerCreate(IDirectX8 *iface, DirectPlay8Peer **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayServerCreate(IDirectX8 *iface, DirectPlay8Server **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayClientCreate(IDirectX8 *iface, DirectPlay8Client **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayAddressCreate(IDirectX8 *iface, DirectPlay8Address **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_Direct3DCreate(IDirectX8 *iface, Direct3D8 **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayLobbyClientCreate(IDirectX8 *iface, DirectPlay8LobbyClient **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static HRESULT WINAPI directx8_DirectPlayLobbiedApplicationCreate(IDirectX8 *iface, DirectPlay8LobbiedApplication **ret) +{ + FIXME("(%p): stub!\n", ret); + + return E_NOTIMPL; +} + +static const IDirectX8Vtbl directx8_vtbl = +{ + /*** IUnknown methods ***/ + directx8_QueryInterface, + directx8_AddRef, + directx8_Release, + /*** IDirectX8 methods ***/ + directx8_DirectSoundCreate, + directx8_DirectSoundCaptureCreate, + directx8_GetDSEnum, + directx8_GetDSCaptureEnum, + directx8_DirectInputCreate, + directx8_DirectMusicLoaderCreate, + directx8_DirectMusicComposerCreate, + directx8_DirectMusicPerformanceCreate, + directx8_CreateEvent, + directx8_SetEvent, + directx8_DestroyEvent, + directx8_CreateNewGuid, + directx8_DirectPlayVoiceClientCreate, + directx8_DirectPlayVoiceServerCreate, + directx8_DirectPlayVoiceTestCreate, + directx8_DirectXFileCreate, + directx8_DirectPlayPeerCreate, + directx8_DirectPlayServerCreate, + directx8_DirectPlayClientCreate, + directx8_DirectPlayAddressCreate, + directx8_Direct3DCreate, + directx8_DirectPlayLobbyClientCreate, + directx8_DirectPlayLobbiedApplicationCreate +}; + +HRESULT directx8_create(IUnknown *outer_unk, void **ppv) +{ + struct directx8 *object; + + TRACE("(%p,%p)\n", outer_unk, ppv); + + object = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*object)); + if (!object) + return E_OUTOFMEMORY; + + object->IDirectX8_iface.lpVtbl = &directx8_vtbl; + object->ref = 1; + + *ppv = &object->IDirectX8_iface; + + return S_OK; +} + diff --git a/dlls/dx8vb/dx8vb_private.h b/dlls/dx8vb/dx8vb_private.h index 2d4c6c501a..009977fce7 100644 --- a/dlls/dx8vb/dx8vb_private.h +++ b/dlls/dx8vb/dx8vb_private.h @@ -35,6 +35,7 @@ #include "dx8vb.h" HRESULT d3dx8_create(IUnknown *outer_unk, void **ppv) DECLSPEC_HIDDEN; +HRESULT directx8_create(IUnknown *outer_unk, void **ppv) DECLSPEC_HIDDEN; #endif /* __DX8VB_PRIVATE_INCLUDED__ */ diff --git a/dlls/dx8vb/main.c b/dlls/dx8vb/main.c index c5a6131928..cb58329eb6 100644 --- a/dlls/dx8vb/main.c +++ b/dlls/dx8vb/main.c @@ -70,6 +70,7 @@ struct object_creation_info static const struct object_creation_info object_creation[] = { { &CLSID_D3DX8, d3dx8_create }, + { &CLSID_DirectX8, directx8_create }, }; static HRESULT WINAPI classfactory_QueryInterface(IClassFactory *iface, REFIID riid, void **ppobj) -- 2.15.0