Signed-off-by: Zebediah Figura z.figura12@gmail.com --- dlls/dsound/tests/Makefile.in | 2 +- dlls/dsound/tests/capture.c | 37 +++------ dlls/dsound/tests/ds3d.c | 35 ++------ dlls/dsound/tests/ds3d8.c | 35 ++------ dlls/dsound/tests/dsound.c | 115 +++++++------------------- dlls/dsound/tests/dsound8.c | 75 ++++++----------- dlls/dsound/tests/duplex.c | 50 +++--------- dlls/dsound/tests/propset.c | 148 ++++++++++++---------------------- 8 files changed, 145 insertions(+), 352 deletions(-)
diff --git a/dlls/dsound/tests/Makefile.in b/dlls/dsound/tests/Makefile.in index a3e7c37c93..49bc4d9b55 100644 --- a/dlls/dsound/tests/Makefile.in +++ b/dlls/dsound/tests/Makefile.in @@ -1,5 +1,5 @@ TESTDLL = dsound.dll -IMPORTS = ole32 version user32 +IMPORTS = dsound ole32 version user32
C_SRCS = \ capture.c \ diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c index dada067956..e326fe8d83 100644 --- a/dlls/dsound/tests/capture.c +++ b/dlls/dsound/tests/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(); } diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c index 1b44afff8d..a6b31641d4 100644 --- a/dlls/dsound/tests/ds3d.c +++ b/dlls/dsound/tests/ds3d.c @@ -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"); + ds3d_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/ds3d8.c b/dlls/dsound/tests/ds3d8.c index 00340af94b..465ba040a3 100644 --- a/dlls/dsound/tests/ds3d8.c +++ b/dlls/dsound/tests/ds3d8.c @@ -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"); + ds3d8_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c index 2bf87eb857..a4f59efaad 100644 --- a/dlls/dsound/tests/dsound.c +++ b/dlls/dsound/tests/dsound.c @@ -41,12 +41,6 @@
DEFINE_GUID(GUID_NULL,0,0,0,0,0,0,0,0,0,0,0);
-static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL; -static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*, - LPUNKNOWN)=NULL; - -static BOOL gotdx8; - static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized, LPCGUID lpGuid) { @@ -235,28 +229,28 @@ static void IDirectSound_tests(void) "should have failed: %08x\n",rc);
/* try with no device specified */ - rc=pDirectSoundCreate(NULL,&dso,NULL); + rc = DirectSoundCreate(NULL, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(NULL) failed: %08x\n",rc); if (rc==S_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultPlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoicePlayback, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL, "DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %08x\n", rc); if (rc==DS_OK && dso) IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */ - rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL); + rc = DirectSoundCreate(&DSDEVID_DefaultVoiceCapture, &dso, NULL); ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) " "should have failed: %08x\n",rc); if (rc==DS_OK && dso) @@ -270,12 +264,12 @@ static HRESULT test_dsound(LPGUID lpGuid) int ref;
/* DSOUND: Error: Invalid interface buffer */ - rc=pDirectSoundCreate(lpGuid,0,NULL); + rc = DirectSoundCreate(lpGuid, 0, NULL); ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned " "DSERR_INVALIDPARAM, returned: %08x\n",rc);
/* 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) @@ -292,13 +286,13 @@ static HRESULT test_dsound(LPGUID lpGuid) IDirectSound_test(dso, FALSE, lpGuid);
/* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso1,NULL); + rc = DirectSoundCreate(lpGuid, &dso1, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { /* Release the second DirectSound object */ @@ -318,7 +312,7 @@ static HRESULT test_dsound(LPGUID lpGuid) return rc;
/* Create a DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK,"DirectSoundCreate() failed: %08x\n",rc); if (rc==DS_OK) { LPDIRECTSOUNDBUFFER secondary; @@ -374,7 +368,7 @@ static HRESULT test_primary(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, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -545,7 +539,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid) int f,ref,tag;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -687,7 +681,7 @@ static HRESULT test_secondary(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, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -751,30 +745,16 @@ static HRESULT test_secondary(LPGUID lpGuid) wfx.nBlockAlign); bufdesc.lpwfxFormat=&wfx; rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL); - if (gotdx8 || wfx.wBitsPerSample <= 16 || wfx.wFormatTag == WAVE_FORMAT_IEEE_FLOAT) - { - if (wfx.wBitsPerSample > 16) - ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) - || rc == DS_OK, /* driver dependent? */ - "IDirectSound_CreateSoundBuffer() " - "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " - "and NULL, returned: %08x %p\n", rc, secondary); - else - ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ - "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc); - } - else - ok(rc==E_INVALIDARG, "Creating %d bpp buffer on dx < 8 returned: %p %08x\n", - wfx.wBitsPerSample, secondary, rc);
- if (!gotdx8) - { - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - /* Apparently they succeed with bogus values, - * which means that older dsound doesn't look at them - */ - goto no_wfe; - } + if (wfx.wBitsPerSample > 16) + ok(broken((rc == DSERR_CONTROLUNAVAIL || rc == DSERR_INVALIDCALL || rc == DSERR_INVALIDPARAM /* 2003 */) && !secondary) + || rc == DS_OK, /* driver dependent? */ + "IDirectSound_CreateSoundBuffer() " + "should have returned (DSERR_CONTROLUNAVAIL or DSERR_INVALIDCALL) " + "and NULL, returned: %08x %p\n", rc, secondary); + else + ok((rc==DS_OK && secondary!=NULL) || broken(rc == DSERR_CONTROLUNAVAIL), /* vmware drivers on w2k */ + "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
if (secondary) IDirectSoundBuffer_Release(secondary); @@ -853,7 +833,6 @@ static HRESULT test_secondary(LPGUID lpGuid) ok(rc==DS_OK && secondary!=NULL, "IDirectSound_CreateSoundBuffer() failed to create a secondary buffer %08x\n",rc);
-no_wfe: if (rc==DS_OK && secondary!=NULL) { if (winetest_interactive) { trace(" Testing a secondary buffer at %dx%dx%d (fmt=%d) " @@ -902,7 +881,7 @@ static HRESULT test_block_align(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, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -973,7 +952,7 @@ static HRESULT test_frequency(LPGUID lpGuid) 48000, 96000 };
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1104,7 +1083,7 @@ static HRESULT test_duplicate(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, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1431,11 +1410,6 @@ static void perform_invalid_fmt_tests(const char *testname, IDirectSound *dso, I } }
- if(!gotdx8){ - win_skip("Not doing the WAVE_FORMAT_EXTENSIBLE tests\n"); - return; - } - fmtex.Format.cbSize = sizeof(WAVEFORMATEXTENSIBLE) - sizeof(WAVEFORMATEX); fmtex.Format.wFormatTag = WAVE_FORMAT_EXTENSIBLE; fmtex.Format.nChannels = 2; @@ -1510,7 +1484,7 @@ static HRESULT test_invalid_fmts(LPGUID lpGuid) DSBUFFERDESC bufdesc;
/* Create the DirectSound object */ - rc=pDirectSoundCreate(lpGuid,&dso,NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n",rc); if (rc!=DS_OK) @@ -1556,7 +1530,7 @@ static void test_notifications(LPGUID lpGuid) DWORD expect, status; int cycles;
- rc = pDirectSoundCreate(lpGuid, &dso, NULL); + rc = DirectSoundCreate(lpGuid, &dso, NULL); ok(rc == DS_OK || rc == DSERR_NODRIVER || rc == DSERR_ALLOCATED, "DirectSoundCreate() failed: %08x\n", rc); if(rc != DS_OK) @@ -1683,7 +1657,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription, static void dsound_tests(void) { HRESULT rc; - rc=pDirectSoundEnumerateA(&dsenum_callback,NULL); + rc = DirectSoundEnumerateA(&dsenum_callback, NULL); ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %08x\n",rc); }
@@ -1699,7 +1673,7 @@ static void test_hw_buffers(void) UINT i; HRESULT hr;
- hr = pDirectSoundCreate(NULL, &ds, NULL); + hr = DirectSoundCreate(NULL, &ds, NULL); ok(hr == S_OK || hr == DSERR_NODRIVER || hr == DSERR_ALLOCATED || hr == E_FAIL, "DirectSoundCreate failed: %08x\n", hr); if(hr != S_OK) @@ -1801,38 +1775,11 @@ static void test_hw_buffers(void)
START_TEST(dsound) { - HMODULE hDsound; - CoInitialize(NULL);
- hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - BOOL ret; - - ret = FreeLibrary(hDsound); - ok( ret, "FreeLibrary(1) returned %d\n", GetLastError()); - } - - hDsound = LoadLibraryA("dsound.dll"); - if (hDsound) - { - - pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound, - "DirectSoundEnumerateA"); - pDirectSoundCreate = (void*)GetProcAddress(hDsound, - "DirectSoundCreate"); - - gotdx8 = !!GetProcAddress(hDsound, "DirectSoundCreate8"); - - IDirectSound_tests(); - dsound_tests(); - test_hw_buffers(); - - FreeLibrary(hDsound); - } - else - win_skip("dsound.dll not found - skipping all tests\n"); + IDirectSound_tests(); + dsound_tests(); + test_hw_buffers();
CoUninitialize(); } diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c index 8190a61736..6fe13c66fd 100644 --- a/dlls/dsound/tests/dsound8.c +++ b/dlls/dsound/tests/dsound8.c @@ -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,36 +1786,16 @@ 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(); - test_hw_buffers(); - test_first_device(); - 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"); + test_COM(); + IDirectSound8_tests(); + dsound8_tests(); + test_hw_buffers(); + test_first_device(); + test_primary_flags(); + test_effects(); + test_effects_parameters();
CoUninitialize(); } diff --git a/dlls/dsound/tests/duplex.c b/dlls/dsound/tests/duplex.c index b770515785..59507c566c 100644 --- a/dlls/dsound/tests/duplex.c +++ b/dlls/dsound/tests/duplex.c @@ -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"); + test_COM(); + IDirectSoundFullDuplex_tests();
CoUninitialize(); } diff --git a/dlls/dsound/tests/propset.c b/dlls/dsound/tests/propset.c index 49e6f518ae..94f0d36345 100644 --- a/dlls/dsound/tests/propset.c +++ b/dlls/dsound/tests/propset.c @@ -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,67 +190,57 @@ 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)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSound8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (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)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " - "failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE,returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) " + "failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (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)); - ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound capture 8 doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned E_NOINTERFACE, returned: %08x\n",rc); - } + rc = pDllGetClassObject(&CLSID_DirectSoundCapture8, &IID_IClassFactory, (void **)&pcf); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound capture 8 doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (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, " - "IID_IClassFactory) failed: %08x\n",rc); - if (pcf==0) - return; - - /* direct sound full duplex doesn't have an IKsPropertySet */ - rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, - (void **)(&pps)); - ok(rc==E_NOINTERFACE, "CreateInstance(IID_IKsPropertySet) should have " - "returned NOINTERFACE, returned: %08x\n",rc); - } + rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory, + (void **)(&pcf)); + ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, " + "IID_IClassFactory) failed: %08x\n",rc); + if (pcf==0) + return; + + /* direct sound full duplex doesn't have an IKsPropertySet */ + rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet, + (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"); - - propset_private_tests(); - propset_buffer_tests(); - - FreeLibrary(hDsound); - } - else - skip("dsound.dll not found - skipping all tests\n"); + pDllGetClassObject = (void *)GetProcAddress(GetModuleHandleA("dsound"), "DllGetClassObject"); + + propset_private_tests(); + propset_buffer_tests();
CoUninitialize(); }