dsound: Fix tests for old versions of windows.

This commit is contained in:
Robert Reif 2007-01-15 09:00:39 -05:00 committed by Alexandre Julliard
parent 670cf778aa
commit 2e44a3b2a2
8 changed files with 228 additions and 135 deletions

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ../../..
SRCDIR = @srcdir@
VPATH = @srcdir@
TESTDLL = dsound.dll
IMPORTS = dsound ole32 version user32 kernel32
IMPORTS = ole32 version user32 kernel32
EXTRALIBS = -ldxguid -luuid -ldxerr8
CTESTS = \

View File

@ -710,20 +710,27 @@ START_TEST(capture)
CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n");
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound,"DirectSoundCaptureEnumerateA");
if (!pDirectSoundCaptureCreate || !pDirectSoundCaptureEnumerateA)
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("capture test skipped\n");
return;
}
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
IDirectSoundCapture_tests();
capture_tests();
pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureCreate");
pDirectSoundCaptureEnumerateA=(void*)GetProcAddress(hDsound,
"DirectSoundCaptureEnumerateA");
if (pDirectSoundCaptureCreate && pDirectSoundCaptureEnumerateA)
{
IDirectSoundCapture_tests();
capture_tests();
}
else
skip("capture test skipped\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize();
}

View File

@ -34,6 +34,12 @@
#include "dsound_test.h"
#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)
{
int i;
@ -686,7 +692,7 @@ static HRESULT test_secondary(LPGUID lpGuid, int play,
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -954,7 +960,7 @@ static HRESULT test_for_driver(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -978,7 +984,7 @@ static HRESULT test_primary(LPGUID lpGuid)
int ref, i;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -1065,7 +1071,7 @@ static HRESULT test_primary_3d(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -1139,7 +1145,7 @@ static HRESULT test_primary_3d_with_listener(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER,"DirectSoundCreate() failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -1280,17 +1286,32 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d_tests(void)
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(ds3d)
{
HMODULE hDsound;
CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
ds3d_tests();
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
ds3d_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize();
}

View File

@ -33,6 +33,7 @@
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate8)(LPCGUID,LPDIRECTSOUND8*,LPUNKNOWN)=NULL;
typedef struct {
@ -635,9 +636,18 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
&listener_param);
ok(rc==DS_OK,"IDirectSound3dListener_GetAllParameters() "
"failed: %s\n",DXGetErrorString8(rc));
} else {
ok(listener==NULL, "IDirectSoundBuffer_QueryInterface() "
"failed but returned a listener anyway\n");
ok(rc!=DS_OK, "IDirectSoundBuffer_QueryInterface() succeeded "
"but returned a NULL listener\n");
if (listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has "
"%d references, should have 0\n",ref);
}
goto EXIT2;
}
else
goto EXIT;
}
init_format(&wfx,WAVE_FORMAT_PCM,22050,16,2);
@ -795,18 +805,28 @@ static HRESULT test_secondary8(LPGUID lpGuid, int play,
ref);
}
}
}
EXIT1:
if (has_listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
"references, should have 0\n",ref);
if (has_listener) {
ref=IDirectSound3DListener_Release(listener);
ok(ref==0,"IDirectSound3dListener_Release() listener has %d "
"references, should have 0\n",ref);
} else {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
} else {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
ok(primary==NULL,"IDirectSound8_CreateSoundBuffer(primary) failed "
"but primary created anyway\n");
ok(rc!=DS_OK,"IDirectSound8_CreateSoundBuffer(primary) succeeded "
"but primary not created\n");
if (primary) {
ref=IDirectSoundBuffer_Release(primary);
ok(ref==0,"IDirectSoundBuffer_Release() primary has %d references, "
"should have 0\n",ref);
}
}
EXIT2:
/* Set the CooperativeLevel back to normal */
/* DSOUND: Setting DirectSound cooperative level to DSSCL_NORMAL */
rc=IDirectSound8_SetCooperativeLevel(dso,get_hwnd(),DSSCL_NORMAL);
@ -1152,7 +1172,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void ds3d8_tests(void)
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
@ -1162,17 +1182,24 @@ START_TEST(ds3d8)
CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n");
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
if (!pDirectSoundCreate8) {
trace("ds3d8 test skipped\n");
return;
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
ds3d8_tests();
else
skip("ds3d8 test skipped\n");
FreeLibrary(hDsound);
}
ds3d8_tests();
else
skip("dsound.dll not found!\n");
CoUninitialize();
}

View File

@ -34,6 +34,10 @@
#include "dsound_test.h"
static HRESULT (WINAPI *pDirectSoundEnumerateA)(LPDSENUMCALLBACKA,LPVOID)=NULL;
static HRESULT (WINAPI *pDirectSoundCreate)(LPCGUID,LPDIRECTSOUND*,
LPUNKNOWN)=NULL;
static void IDirectSound_test(LPDIRECTSOUND dso, BOOL initialized,
LPCGUID lpGuid)
{
@ -227,14 +231,14 @@ static void IDirectSound_tests(void)
"should have failed: %s\n",DXGetErrorString8(rc));
/* try with no device specified */
rc=DirectSoundCreate(NULL,&dso,NULL);
rc=pDirectSoundCreate(NULL,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(NULL) failed: %s\n",DXGetErrorString8(rc));
if (rc==S_OK && dso)
IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
rc=pDirectSoundCreate(&DSDEVID_DefaultPlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultPlayback) failed: %s\n",
DXGetErrorString8(rc));
@ -242,7 +246,7 @@ static void IDirectSound_tests(void)
IDirectSound_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
rc=pDirectSoundCreate(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate(DSDEVID_DefaultVoicePlayback) failed: %s\n",
DXGetErrorString8(rc));
@ -250,7 +254,7 @@ static void IDirectSound_tests(void)
IDirectSound_test(dso, TRUE, NULL);
/* try with a bad device specified */
rc=DirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
rc=pDirectSoundCreate(&DSDEVID_DefaultVoiceCapture,&dso,NULL);
ok(rc==DSERR_NODRIVER,"DirectSoundCreate(DSDEVID_DefaultVoiceCapture) "
"should have failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && dso)
@ -264,12 +268,12 @@ static HRESULT test_dsound(LPGUID lpGuid)
int ref;
/* DSOUND: Error: Invalid interface buffer */
rc=DirectSoundCreate(lpGuid,0,NULL);
rc=pDirectSoundCreate(lpGuid,0,NULL);
ok(rc==DSERR_INVALIDPARAM,"DirectSoundCreate() should have returned "
"DSERR_INVALIDPARAM, returned: %s\n",DXGetErrorString8(rc));
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -287,13 +291,13 @@ static HRESULT test_dsound(LPGUID lpGuid)
IDirectSound_test(dso, FALSE, lpGuid);
/* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUND dso1=NULL;
/* Create a second DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso1,NULL);
rc=pDirectSoundCreate(lpGuid,&dso1,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
/* Release the second DirectSound object */
@ -313,7 +317,7 @@ static HRESULT test_dsound(LPGUID lpGuid)
return rc;
/* Create a DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK,"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK) {
LPDIRECTSOUNDBUFFER secondary;
@ -369,7 +373,7 @@ static HRESULT test_primary(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -513,7 +517,7 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
int f,ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -651,7 +655,7 @@ static HRESULT test_secondary(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -763,7 +767,7 @@ static HRESULT test_block_align(LPGUID lpGuid)
int ref;
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -823,7 +827,7 @@ static HRESULT test_frequency(LPGUID lpGuid)
48000, 96000 };
/* Create the DirectSound object */
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK)
@ -939,18 +943,33 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void dsound_tests(void)
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
START_TEST(dsound)
{
HMODULE hDsound;
CoInitialize(NULL);
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
IDirectSound_tests();
dsound_tests();
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate = (void*)GetProcAddress(hDsound,
"DirectSoundCreate");
IDirectSound_tests();
dsound_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize();
}

View File

@ -35,6 +35,7 @@
#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)
@ -808,7 +809,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
static void dsound8_tests(void)
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
@ -852,18 +853,27 @@ START_TEST(dsound8)
CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n");
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
if (!pDirectSoundCreate8) {
trace("dsound8 test skipped\n");
return;
pDirectSoundEnumerateA = (void*)GetProcAddress(hDsound,
"DirectSoundEnumerateA");
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound,
"DirectSoundCreate8");
if (pDirectSoundCreate8)
{
IDirectSound8_tests();
dsound8_tests();
}
else
skip("dsound8 test skipped\n");
FreeLibrary(hDsound);
}
IDirectSound8_tests();
dsound8_tests();
else
skip("dsound.dll not found!\n");
CoUninitialize();
}

View File

@ -237,19 +237,22 @@ START_TEST(duplex)
CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n");
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,"DirectSoundFullDuplexCreate");
if (!pDirectSoundFullDuplexCreate)
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("duplex test skipped\n");
goto done;
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,
"DirectSoundFullDuplexCreate");
if (pDirectSoundFullDuplexCreate)
IDirectSoundFullDuplex_tests();
else
skip("duplex test skipped\n");
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
IDirectSoundFullDuplex_tests();
done:
CoUninitialize();
}

View File

@ -49,8 +49,10 @@ DEFINE_GUID(DSPROPSETID_I3DL2_BufferProperties,
DEFINE_GUID(DSPROPSETID_ZOOMFX_BufferProperties,
0xCD5368E0,0x3450,0x11D3,0x8B,0x6E,0x00,0x10,0x5A,0x9B,0x7B,0xBC);
typedef HRESULT (CALLBACK * MYPROC)(REFCLSID, REFIID, LPVOID *);
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,
@ -180,41 +182,32 @@ static BOOL CALLBACK callbackW(PDSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION_W_DATA
static void propset_private_tests(void)
{
HMODULE hDsound;
HRESULT rc;
IClassFactory * pcf;
IKsPropertySet * pps;
MYPROC fProc;
ULONG support;
hDsound = LoadLibrary("dsound.dll");
ok(hDsound!=0,"LoadLibrary(dsound.dll) failed\n");
if (hDsound==0)
return;
fProc = (MYPROC)GetProcAddress(hDsound, "DllGetClassObject");
/* try direct sound first */
/* DSOUND: Error: Invalid interface buffer */
rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)0);
ok(rc==DSERR_INVALIDPARAM,"DllGetClassObject(CLSID_DirectSound, "
"IID_IClassFactory) should have returned DSERR_INVALIDPARAM, "
"returned: %s\n",DXGetErrorString8(rc));
rc = (fProc)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf));
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IDirectSound, (void **)(&pcf));
ok(rc==E_NOINTERFACE,"DllGetClassObject(CLSID_DirectSound, "
"IID_IDirectSound) should have returned E_NOINTERFACE, "
"returned: %s\n",DXGetErrorString8(rc));
rc = (fProc)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf));
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IUnknown, (void **)(&pcf));
ok(rc==DS_OK,"DllGetClassObject(CLSID_DirectSound, "
"IID_IUnknown) failed: %s\n",DXGetErrorString8(rc));
rc = (fProc)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
rc = (pDllGetClassObject)(&CLSID_DirectSound, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
return;
/* direct sound doesn't have an IKsPropertySet */
/* DSOUND: Error: Invalid interface buffer */
@ -230,11 +223,11 @@ static void propset_private_tests(void)
/* and the direct sound 8 version */
if (pDirectSoundCreate8) {
rc = (fProc)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
rc = (pDllGetClassObject)(&CLSID_DirectSound8, &IID_IClassFactory, (void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSound8, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
return;
/* direct sound 8 doesn't have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
@ -245,12 +238,12 @@ static void propset_private_tests(void)
/* try direct sound capture next */
if (pDirectSoundCaptureCreate) {
rc = (fProc)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture, IID_IClassFactory) "
"failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
return;
/* direct sound capture doesn't have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
@ -261,12 +254,12 @@ static void propset_private_tests(void)
/* and the direct sound capture 8 version */
if (pDirectSoundCaptureCreate8) {
rc = (fProc)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
rc = (pDllGetClassObject)(&CLSID_DirectSoundCapture8, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundCapture8, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
return;
/* direct sound capture 8 doesn't have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
@ -277,12 +270,12 @@ static void propset_private_tests(void)
/* try direct sound full duplex next */
if (pDirectSoundFullDuplexCreate) {
rc = (fProc)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
rc = (pDllGetClassObject)(&CLSID_DirectSoundFullDuplex, &IID_IClassFactory,
(void **)(&pcf));
ok(pcf!=0, "DllGetClassObject(CLSID_DirectSoundFullDuplex, "
"IID_IClassFactory) failed: %s\n",DXGetErrorString8(rc));
if (pcf==0)
goto error;
return;
/* direct sound full duplex doesn't have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
@ -292,12 +285,12 @@ static void propset_private_tests(void)
}
/* try direct sound private last */
rc = (fProc)(&CLSID_DirectSoundPrivate, &IID_IClassFactory,
rc = (pDllGetClassObject)(&CLSID_DirectSoundPrivate, &IID_IClassFactory,
(void **)(&pcf));
/* some early versions of Direct Sound do not have this */
if (pcf==0)
goto error;
return;
/* direct sound private does have an IKsPropertySet */
rc = IClassFactory_CreateInstance(pcf, NULL, &IID_IKsPropertySet,
@ -305,7 +298,7 @@ static void propset_private_tests(void)
ok(rc==DS_OK, "CreateInstance(IID_IKsPropertySet) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
/* test generic DSPROPERTY_DIRECTSOUNDDEVICE_DESCRIPTION */
rc = IKsPropertySet_QuerySupport(pps, &DSPROPSETID_DirectSoundDevice,
@ -318,7 +311,7 @@ static void propset_private_tests(void)
if (rc!=DS_OK) {
if (rc==E_INVALIDARG)
trace(" Not Supported\n");
goto error;
return;
}
ok(support & KSPROPERTY_SUPPORT_GET,
@ -339,7 +332,7 @@ static void propset_private_tests(void)
if (rc!=DS_OK) {
if (rc==E_INVALIDARG)
trace(" Not Supported\n");
goto error;
return;
}
ok(support & KSPROPERTY_SUPPORT_GET,
@ -360,7 +353,7 @@ static void propset_private_tests(void)
if (rc!=DS_OK) {
if (rc==E_INVALIDARG)
trace(" Not Supported\n");
goto error;
return;
}
ok(support & KSPROPERTY_SUPPORT_GET,
@ -381,7 +374,7 @@ static void propset_private_tests(void)
if (rc!=DS_OK) {
if (rc==E_INVALIDARG)
trace(" Not Supported\n");
goto error;
return;
}
ok(support & KSPROPERTY_SUPPORT_GET,
@ -398,7 +391,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING: "
@ -414,7 +407,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_A: "
@ -430,7 +423,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_WAVEDEVICEMAPPING_W: "
@ -448,7 +441,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE: "
@ -467,7 +460,7 @@ static void propset_private_tests(void)
DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE,
NULL, 0, &data, sizeof(data), &bytes);
ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
}
}
/* test DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 */
trace("*** Testing DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1 ***\n");
@ -478,7 +471,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_1: "
@ -508,7 +501,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_A: "
@ -538,7 +531,7 @@ static void propset_private_tests(void)
"DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W) failed: %s\n",
DXGetErrorString8(rc));
if (rc!=DS_OK)
goto error;
return;
ok(support & KSPROPERTY_SUPPORT_GET,
"Couldn't get DSPROPERTY_DIRECTSOUNDDEVICE_ENUMERATE_W: "
@ -558,9 +551,6 @@ static void propset_private_tests(void)
NULL, 0, &data, sizeof(data), &bytes);
ok(rc==DS_OK, "Couldn't enumerate: 0x%x\n",rc);
}
error:
FreeLibrary(hDsound);
}
static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
@ -575,7 +565,7 @@ static BOOL WINAPI dsenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
trace("*** Testing %s - %s ***\n",lpcstrDescription,lpcstrModule);
rc=DirectSoundCreate(lpGuid,&dso,NULL);
rc=pDirectSoundCreate(lpGuid,&dso,NULL);
ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
"DirectSoundCreate() failed: %s\n",DXGetErrorString8(rc));
if (rc!=DS_OK) {
@ -712,7 +702,7 @@ EXIT:
static void propset_buffer_tests(void)
{
HRESULT rc;
rc=DirectSoundEnumerateA(&dsenum_callback,NULL);
rc=pDirectSoundEnumerateA(&dsenum_callback,NULL);
ok(rc==DS_OK,"DirectSoundEnumerateA() failed: %s\n",DXGetErrorString8(rc));
}
@ -722,17 +712,33 @@ START_TEST(propset)
CoInitialize(NULL);
hDsound = GetModuleHandleA("dsound.dll");
ok(hDsound != NULL, "dsound.dll not loaded!\n");
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
hDsound = LoadLibrary("dsound.dll");
if (hDsound)
{
trace("DLL Version: %s\n", get_file_version("dsound.dll"));
pDirectSoundCreate8 = (void*)GetProcAddress(hDsound, "DirectSoundCreate8");
pDirectSoundCaptureCreate=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate");
pDirectSoundCaptureCreate8=(void*)GetProcAddress(hDsound,"DirectSoundCaptureCreate8");
pDirectSoundFullDuplexCreate=(void*)GetProcAddress(hDsound,"DirectSoundFullDuplexCreate");
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();
propset_private_tests();
propset_buffer_tests();
FreeLibrary(hDsound);
}
else
skip("dsound.dll not found!\n");
CoUninitialize();
}