Commit a192e7f1 authored by Alistair Leslie-Hughes's avatar Alistair Leslie-Hughes Committed by Alexandre Julliard

dpvoice: Add IDirectPlayVoiceTest stub interface.

parent 92bcb747
......@@ -41,11 +41,22 @@ typedef struct IDirectPlayVoiceClientImpl
LONG ref;
} IDirectPlayVoiceClientImpl;
typedef struct IDirectPlayVoiceTestImpl
{
IDirectPlayVoiceTest IDirectPlayVoiceTest_iface;
LONG ref;
} IDirectPlayVoiceTestImpl;
static inline IDirectPlayVoiceClientImpl *impl_from_IDirectPlayVoiceClient(IDirectPlayVoiceClient *iface)
{
return CONTAINING_RECORD(iface, IDirectPlayVoiceClientImpl, IDirectPlayVoiceClient_iface);
}
static inline IDirectPlayVoiceTestImpl *impl_from_IDirectPlayVoiceTest(IDirectPlayVoiceTest *iface)
{
return CONTAINING_RECORD(iface, IDirectPlayVoiceTestImpl, IDirectPlayVoiceTest_iface);
}
static HRESULT WINAPI dpvclient_QueryInterface(IDirectPlayVoiceClient *iface, REFIID riid, void **ppv)
{
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceClient))
......@@ -232,3 +243,78 @@ HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnk
return ret;
}
static HRESULT WINAPI dpvtest_QueryInterface(IDirectPlayVoiceTest *iface, REFIID riid, void **ppv)
{
if (IsEqualGUID(riid, &IID_IUnknown) || IsEqualGUID(riid, &IID_IDirectPlayVoiceTest))
{
IUnknown_AddRef(iface);
*ppv = iface;
return S_OK;
}
WARN("(%p)->(%s,%p),not found\n", iface, debugstr_guid(riid), ppv);
return E_NOINTERFACE;
}
static ULONG WINAPI dpvtest_AddRef(IDirectPlayVoiceTest *iface)
{
IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
return ref;
}
static ULONG WINAPI dpvtest_Release(IDirectPlayVoiceTest *iface)
{
IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
ULONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%u\n", This, ref);
if (!ref)
{
HeapFree(GetProcessHeap(), 0, This);
}
return ref;
}
static HRESULT WINAPI dpvtest_CheckAudioSetup(IDirectPlayVoiceTest *iface, const GUID *pguidPlaybackDevice, const GUID *pguidCaptureDevice,
HWND hwndParent, DWORD dwFlags)
{
IDirectPlayVoiceTestImpl *This = impl_from_IDirectPlayVoiceTest(iface);
FIXME("%p %p %p %p %d\n", This, pguidPlaybackDevice, pguidCaptureDevice, hwndParent, dwFlags);
return E_NOTIMPL;
}
static const IDirectPlayVoiceTestVtbl DirectPlayVoiceTest_Vtbl =
{
dpvtest_QueryInterface,
dpvtest_AddRef,
dpvtest_Release,
dpvtest_CheckAudioSetup
};
HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj)
{
IDirectPlayVoiceTestImpl* test;
HRESULT ret;
TRACE("(%p, %s, %p)\n", pUnkOuter, debugstr_guid(riid), ppobj);
*ppobj = NULL;
test = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IDirectPlayVoiceTestImpl));
if (!test)
return E_OUTOFMEMORY;
test->IDirectPlayVoiceTest_iface.lpVtbl = &DirectPlayVoiceTest_Vtbl;
test->ref = 1;
ret = IDirectPlayVoiceTest_QueryInterface(&test->IDirectPlayVoiceTest_iface, riid, ppobj);
IDirectPlayVoiceTest_Release(&test->IDirectPlayVoiceTest_iface);
return ret;
}
......@@ -22,5 +22,6 @@
extern HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
#endif
......@@ -96,6 +96,7 @@ static IClassFactoryImpl DPVOICE_CFS[] =
{
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceClient, DPVOICE_CreateDirectPlayVoiceClient },
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceServer, DPVOICE_CreateDirectPlayVoiceServer },
{ { &DICF_Vtbl }, 1, &CLSID_DirectPlayVoiceTest, DPVOICE_CreateDirectPlayVoiceTest },
{ { NULL }, 0, NULL, NULL }
};
......
......@@ -239,7 +239,7 @@ static BOOL test_init_dpvoice_client(void)
/* See if we can get the default values from the registry and try again. */
hr = CoCreateInstance(&CLSID_DirectPlayVoiceTest, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceTest, (void **)&voicetest);
todo_wine ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
if(hr == S_OK)
{
hr = IDirectPlayVoiceTest_CheckAudioSetup(voicetest, &DSDEVID_DefaultVoicePlayback, &DSDEVID_DefaultVoiceCapture,
......@@ -322,6 +322,27 @@ static void test_cleanup_dpvoice(void)
}
}
static void create_voicetest(void)
{
HRESULT hr;
IDirectPlayVoiceTest *voicetest;
hr = CoCreateInstance(&CLSID_DirectPlayVoiceTest, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceTest, (void **)&voicetest);
if(hr == S_OK)
{
hr = IDirectPlayVoiceTest_CheckAudioSetup(voicetest, &DSDEVID_DefaultVoicePlayback, &DSDEVID_DefaultVoiceCapture,
NULL, DVFLAGS_QUERYONLY);
todo_wine ok(hr == S_OK || hr == DVERR_RUNSETUP, "CheckAudioSetup failed with 0x%08x\n", hr);
IDirectPlayVoiceTest_Release(voicetest);
}
else
{
/* Everything after Windows XP doesnt have dpvoice installed. */
win_skip("IDirectPlayVoiceClient not supported on thie platform\n");
}
}
START_TEST(voice)
{
HRESULT hr;
......@@ -331,6 +352,8 @@ START_TEST(voice)
if(hr != S_OK)
return;
create_voicetest();
if(test_init_dpvoice_server() && test_init_dpvoice_client())
{
/* TODO */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment