Commit 3f27d916 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

dsound/tests: Link directly to dsound.

parent 866f6725
TESTDLL = dsound.dll
IMPORTS = ole32 version user32
IMPORTS = dsound ole32 version user32
C_SRCS = \
capture.c \
......
......@@ -32,9 +32,6 @@
#define NOTIFICATIONS 5
static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID,LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL;
static HRESULT (WINAPI *pDirectSoundCaptureEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static const char * get_format_str(WORD format)
{
static char msg[32];
......@@ -232,28 +229,28 @@ static void test_capture(void)
"should have failed: %08x\n",rc);
/* try with no device specified */
rc=pDirectSoundCaptureCreate(NULL,&dsco,NULL);
rc = DirectSoundCaptureCreate(NULL, &dsco, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(NULL) failed: %08x\n",rc);
if (rc==S_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default capture device specified */
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultCapture,&dsco,NULL);
rc = DirectSoundCaptureCreate(&DSDEVID_DefaultCapture, &dsco, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(DSDEVID_DefaultCapture) failed: %08x\n", rc);
if (rc==DS_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with default voice capture device specified */
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture,&dsco,NULL);
rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoiceCapture, &dsco, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCaptureCreate(DSDEVID_DefaultVoiceCapture) failed: %08x\n", rc);
if (rc==DS_OK && dsco)
IDirectSoundCapture_test(dsco, TRUE, NULL);
/* try with a bad device specified */
rc=pDirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback,&dsco,NULL);
rc = DirectSoundCaptureCreate(&DSDEVID_DefaultVoicePlayback, &dsco, NULL);
ok(rc==DSERR_NODRIVER,
"DirectSoundCaptureCreate(DSDEVID_DefaultVoicePlatback) "
"should have failed: %08x\n",rc);
......@@ -442,11 +439,11 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
/* Private dsound.dll: Error: Invalid interface buffer */
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
rc=pDirectSoundCaptureCreate(lpGuid,NULL,NULL);
rc = DirectSoundCaptureCreate(lpGuid, NULL, NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCaptureCreate() should have "
"returned DSERR_INVALIDPARAM, returned: %08x\n",rc);
rc=pDirectSoundCaptureCreate(lpGuid,&dsco,NULL);
rc = DirectSoundCaptureCreate(lpGuid, &dsco, NULL);
ok((rc==DS_OK)||(rc==DSERR_NODRIVER)||(rc==E_FAIL)||(rc==DSERR_ALLOCATED),
"DirectSoundCaptureCreate() failed: %08x\n",rc);
if (rc!=DS_OK) {
......@@ -669,7 +666,7 @@ EXIT:
static void test_enumerate(void)
{
HRESULT rc;
rc=pDirectSoundCaptureEnumerateA(&dscenum_callback,NULL);
rc = DirectSoundCaptureEnumerateA(dscenum_callback, NULL);
ok(rc==DS_OK,"DirectSoundCaptureEnumerateA() failed: %08x\n", rc);
}
......@@ -684,12 +681,12 @@ static void test_COM(void)
HRESULT hr;
ULONG refcount;
hr = pDirectSoundCaptureCreate(NULL, &dsc, (IUnknown*)0xdeadbeef);
hr = DirectSoundCaptureCreate(NULL, &dsc, (IUnknown *)0xdeadbeef);
ok(hr == DSERR_NOAGGREGATION,
"DirectSoundCaptureCreate failed: %08x, expected DSERR_NOAGGREGATION\n", hr);
ok(dsc == (IDirectSoundCapture*)0xdeadbeef, "dsc = %p\n", dsc);
hr = pDirectSoundCaptureCreate(NULL, &dsc, NULL);
hr = DirectSoundCaptureCreate(NULL, &dsc, NULL);
if (hr == DSERR_NODRIVER) {
skip("No driver\n");
return;
......@@ -755,27 +752,11 @@ static void test_COM(void)
START_TEST(capture)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (!hDsound) {
skip("dsound.dll not found - skipping all tests\n");
return;
}
pDirectSoundCaptureCreate = (void*)GetProcAddress(hDsound, "DirectSoundCaptureCreate");
pDirectSoundCaptureEnumerateA = (void*)GetProcAddress(hDsound, "DirectSoundCaptureEnumerateA");
if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA) {
skip("DirectSoundCapture{Create,Enumerate} missing - skipping all tests\n");
return;
}
test_COM();
test_capture();
test_enumerate();
FreeLibrary(hDsound);
CoUninitialize();
}
......@@ -36,11 +36,6 @@
#define PI 3.14159265358979323846
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
LPUNKNOWN)=NULL;
char* wave_generate_la(WAVEFORMATEX* wfx, double duration, DWORD* size, BOOL ieee)
{
int i;
......@@ -712,7 +707,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -974,7 +969,7 @@ static HRESULT test_for_driver(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -998,7 +993,7 @@ static HRESULT test_primary(LPGUID lpGuid)
int ref, i;
/* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -1081,7 +1076,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -1152,7 +1147,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -1306,32 +1301,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d_tests(void)
{
HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
rc = DirectSoundEnumerateA(dsenum_callback, NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
trace("tested %u DirectSound drivers\n", driver_count);
}
START_TEST(ds3d)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (hDsound)
{
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
ds3d_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found - skipping all tests\n");
CoUninitialize();
}
......@@ -34,9 +34,6 @@
#include "ksmedia.h"
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
typedef struct {
char* wave;
DWORD wave_len;
......@@ -544,7 +541,7 @@ static HRESULT test_secondary8(LPGUID lpGuid, BOOL play,
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -822,7 +819,7 @@ static HRESULT test_for_driver8(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -846,7 +843,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
int ref, i;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -928,7 +925,7 @@ static HRESULT test_primary_3d8(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -999,7 +996,7 @@ static HRESULT test_primary_3d_with_listener8(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n", rc);
if (rc!=DS_OK)
return rc;
......@@ -1136,34 +1133,16 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d8_tests(void)
{
HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
rc = DirectSoundEnumerateA(dsenum_callback, NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
trace("tested %u DirectSound drivers\n", driver_count);
}
START_TEST(ds3d8)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (hDsound)
{
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
ds3d8_tests();
else
skip("DirectSoundCreate8 missing - skipping all tests\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found - skipping all tests\n");
CoUninitialize();
}
......@@ -48,9 +48,6 @@
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
int align(int length, int align)
{
return (length / align) * align;
......@@ -250,28 +247,28 @@ static void IDirectSound8_tests(void)
"should have failed: %08x\n",rc);
/* try with no device specified */
rc=pDirectSoundCreate8(NULL,&dso,NULL);
rc = DirectSoundCreate8(NULL, &dso, NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL);
rc = DirectSoundCreate8(&DSDEVID_DefaultPlayback, &dso, NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
rc = DirectSoundCreate8(&DSDEVID_DefaultVoicePlayback, &dso, NULL);
ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with a bad device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
rc = DirectSoundCreate8(&DSDEVID_DefaultVoiceCapture, &dso, NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate8(DSDEVID_DefaultVoiceCapture) "
"should have failed: %08x\n",rc);
}
......@@ -283,12 +280,12 @@ static HRESULT test_dsound8(LPGUID lpGuid)
int ref;
/* DSOUND: Error: Invalid interface buffer */
rc=pDirectSoundCreate8(lpGuid,0,NULL);
rc = DirectSoundCreate8(lpGuid, 0, NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate8() should have returned "
"DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* Create the DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -305,13 +302,13 @@ static HRESULT test_dsound8(LPGUID lpGuid)
IDirectSound8_test(dso, FALSE, lpGuid);
/* Create a DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) {
LPDIRECTSOUND8 dso1=NULL;
/* Create a second DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso1,NULL);
rc = DirectSoundCreate8(lpGuid, &dso1, NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) {
/* Release the second DirectSound8 object */
......@@ -332,7 +329,7 @@ static HRESULT test_dsound8(LPGUID lpGuid)
return rc;
/* Create a DirectSound8 object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary;
......@@ -401,7 +398,7 @@ static HRESULT test_primary8(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -551,7 +548,7 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
unsigned int f, tag;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -692,7 +689,7 @@ static HRESULT test_secondary8(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=pDirectSoundCreate8(lpGuid,&dso,NULL);
rc = DirectSoundCreate8(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -938,7 +935,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void dsound8_tests(void)
{
HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
rc = DirectSoundEnumerateA(dsenum_callback, NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
}
......@@ -954,7 +951,7 @@ static void test_hw_buffers(void)
UINT i;
HRESULT hr;
hr = pDirectSoundCreate8(NULL, &ds, NULL);
hr = DirectSoundCreate8(NULL, &ds, NULL);
ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL,
"DirectSoundCreate8 failed: %08x\n", hr);
if(hr != S_OK)
......@@ -1119,7 +1116,7 @@ static void test_first_device(void)
IMMDevice_Release(defdev);
IMMDeviceEnumerator_Release(devenum);
hr = pDirectSoundEnumerateA(&default_device_cb, NULL);
hr = DirectSoundEnumerateA(default_device_cb, NULL);
ok(hr == S_OK, "DirectSoundEnumerateA failed: %08x\n", hr);
}
......@@ -1183,7 +1180,7 @@ static void test_primary_flags(void)
DSCAPS dscaps;
/* Create a DirectSound8 object */
rc = pDirectSoundCreate8(NULL, &dso, NULL);
rc = DirectSoundCreate8(NULL, &dso, NULL);
ok(rc == DS_OK || rc==DSERR_NODRIVER, "Failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -1234,7 +1231,7 @@ static void test_effects(void)
DWORD resultcodes[2];
/* Create a DirectSound8 object */
rc=pDirectSoundCreate8(NULL,&dso,NULL);
rc = DirectSoundCreate8(NULL, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate8() failed: %08x\n",rc);
if (rc!=DS_OK)
......@@ -1696,7 +1693,7 @@ static void test_effects_parameters(void)
DWORD resultcodes[8];
/* Create a DirectSound8 object */
rc = pDirectSoundCreate8(NULL, &dso, NULL);
rc = DirectSoundCreate8(NULL, &dso, NULL);
ok(rc == DS_OK || rc == DSERR_NODRIVER, "DirectSoundCreate8() failed: %08x\n", rc);
if (rc != DS_OK)
return;
......@@ -1789,20 +1786,8 @@ cleanup:
START_TEST(dsound8)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (hDsound)
{
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
{
test_COM();
IDirectSound8_tests();
dsound8_tests();
......@@ -1811,14 +1796,6 @@ START_TEST(dsound8)
test_primary_flags();
test_effects();
test_effects_parameters();
}
else
skip("DirectSoundCreate8 missing - skipping all tests\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found - skipping all tests\n");
CoUninitialize();
}
......@@ -29,10 +29,6 @@
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID, LPCGUID,
LPCDSCBUFFERDESC, LPCDSBUFFERDESC, HWND, DWORD, LPDIRECTSOUNDFULLDUPLEX *,
LPDIRECTSOUNDCAPTUREBUFFER8*, LPDIRECTSOUNDBUFFER8*, LPUNKNOWN)=NULL;
static void IDirectSoundFullDuplex_test(LPDIRECTSOUNDFULLDUPLEX dsfdo,
BOOL initialized, LPCGUID lpGuidCapture,
LPCGUID lpGuidRender)
......@@ -181,19 +177,17 @@ static void IDirectSoundFullDuplex_tests(void)
DSBufferDesc.lpwfxFormat = &wfex;
/* try with no device specified */
rc=pDirectSoundFullDuplexCreate(NULL,NULL,&DSCBufferDesc,&DSBufferDesc,
get_hwnd(),DSSCL_EXCLUSIVE ,&dsfdo,&pDSCBuffer8,
&pDSBuffer8,NULL);
rc = DirectSoundFullDuplexCreate(NULL, NULL, &DSCBufferDesc, &DSBufferDesc,
get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(NULL,NULL) failed: %08x\n",rc);
if (rc==S_OK && dsfdo)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with default devices specified */
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture,
&DSDEVID_DefaultPlayback,&DSCBufferDesc,
&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,&dsfdo,
&pDSCBuffer8,&pDSBuffer8,NULL);
rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultCapture,
&DSDEVID_DefaultPlayback, &DSCBufferDesc, &DSBufferDesc, get_hwnd(),
DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8,&pDSBuffer8, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultCapture,"
"DSDEVID_DefaultPlayback) failed: %08x\n", rc);
......@@ -201,10 +195,9 @@ static void IDirectSoundFullDuplex_tests(void)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with default voice devices specified */
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture,
&DSDEVID_DefaultVoicePlayback,
&DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoiceCapture,
&DSDEVID_DefaultVoicePlayback, &DSCBufferDesc, &DSBufferDesc,
get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoiceCapture,"
"DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc);
......@@ -212,10 +205,9 @@ static void IDirectSoundFullDuplex_tests(void)
IDirectSoundFullDuplex_test(dsfdo, TRUE, NULL, NULL);
/* try with bad devices specified */
rc=pDirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback,
&DSDEVID_DefaultVoiceCapture,
&DSCBufferDesc,&DSBufferDesc,get_hwnd(),DSSCL_EXCLUSIVE,
&dsfdo,&pDSCBuffer8,&pDSBuffer8,NULL);
rc = DirectSoundFullDuplexCreate(&DSDEVID_DefaultVoicePlayback,
&DSDEVID_DefaultVoiceCapture, &DSCBufferDesc, &DSBufferDesc,
get_hwnd(), DSSCL_EXCLUSIVE, &dsfdo, &pDSCBuffer8, &pDSBuffer8, NULL);
ok(rc==DSERR_NODRIVER||rc==DSERR_INVALIDCALL,
"DirectSoundFullDuplexCreate(DSDEVID_DefaultVoicePlayback,"
"DSDEVID_DefaultVoiceCapture) should have failed: %08x\n", rc);
......@@ -336,26 +328,10 @@ static void test_COM(void)
START_TEST(duplex)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (hDsound)
{
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,
"DirectSoundFullDuplexCreate");
if (pDirectSoundFullDuplexCreate) {
test_COM();
IDirectSoundFullDuplex_tests();
} else
skip("DirectSoundFullDuplexCreate missing - skipping all tests\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found - skipping all tests\n");
CoUninitialize();
}
......@@ -49,19 +49,7 @@ DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties,
DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties,
0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDllGetClassObject)(REFCLSID,REFIID,LPVOID*)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
LPUNKNOWN)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,
LPUNKNOWN)=NULL;
static HRESULT (WINAPI *pDirectSoundCaptureCreate)(LPCGUID,
LPDIRECTSOUNDCAPTURE*,LPUNKNOWN)=NULL;
static HRESULT (WINAPI *pDirectSoundCaptureCreate8)(LPCGUID,
LPDIRECTSOUNDCAPTURE8*,LPUNKNOWN)=NULL;
static HRESULT (WINAPI *pDirectSoundFullDuplexCreate)(LPCGUID,LPCGUID,
LPCDSCBUFFERDESC,LPCDSBUFFERDESC,HWND,DWORD,LPDIRECTSOUNDFULLDUPLEX*,
LPDIRECTSOUNDCAPTUREBUFFER8*,LPDIRECTSOUNDBUFFER8*,LPUNKNOWN)=NULL;
static BOOL CALLBACK callback(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_DATA data,
LPVOID context)
......@@ -202,8 +190,7 @@ static void propset_private_tests(void)
"returned E_NOINTERFACE, returned: %08x\n",rc);
/* and the direct sound 8 version */
if (pDirectSoundCreate8) {
rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
rc = pDllGetClassObject(&CLSID_DirectSound8, &IID_IClassFactory, (void **)&pcf);
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
"failed: %08x\n",rc);
if (pcf==0)
......@@ -214,12 +201,9 @@ static void propset_private_tests(void)
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %08x\n",rc);
}
/* try direct sound capture next */
if (pDirectSoundCaptureCreate) {
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
(void **)(&pcf));
rc = pDllGetClassObject(&CLSID_DirectSoundCapture, &IID_IClassFactory, (void **)&pcf);
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
"failed: %08x\n",rc);
if (pcf==0)
......@@ -230,12 +214,9 @@ static void propset_private_tests(void)
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE,returned: %08x\n",rc);
}
/* and the direct sound capture 8 version */
if (pDirectSoundCaptureCreate8) {
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
(void **)(&pcf));
rc = pDllGetClassObject(&CLSID_DirectSoundCapture8, &IID_IClassFactory, (void **)&pcf);
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
"IID_IClassFactory) failed: %08x\n",rc);
if (pcf==0)
......@@ -246,10 +227,8 @@ static void propset_private_tests(void)
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned E_NOINTERFACE, returned: %08x\n",rc);
}
/* try direct sound full duplex next */
if (pDirectSoundFullDuplexCreate) {
rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
......@@ -262,7 +241,6 @@ static void propset_private_tests(void)
(void **)(&pps));
ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have "
"returned NOINTERFACE, returned: %08x\n",rc);
}
/* try direct sound private last */
rc = (pDllGetClassObject)(&CLSID_DirectSoundPrivate, &IID_IClassFactory,
......@@ -549,7 +527,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
driver_count++;
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
rc = DirectSoundCreate(lpGuid, &dso, NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %08x\n",rc);
if (rc!=DS_OK) {
......@@ -692,43 +670,19 @@ EXIT:
static void propset_buffer_tests(void)
{
HRESULT rc;
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
rc = DirectSoundEnumerateA(dsenum_callback, NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc);
trace("tested %u DirectSound drivers\n", driver_count);
}
START_TEST(propset)
{
HMODULE hDsound;
CoInitialize(NULL);
hDsound = LoadLibraryA("dsound.dll");
if (hDsound)
{
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDllGetClassObject = (void *)GetProcAddress(hDsound,
"DllGetClassObject");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureCreate");
pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureCreate8");
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,
"DirectSoundFullDuplexCreate");
pDllGetClassObject = (void *)GetProcAddress(GetModuleHandleA("dsound"), "DllGetClassObject");
propset_private_tests();
propset_buffer_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found - skipping all tests\n");
CoUninitialize();
}
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