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