resubmission: Correct error return when COM aggregation attempted
Mike O'Regan
moregan at stresscafe.com
Sun Sep 11 23:34:21 CDT 2005
Changelog:
dsound: Correct error return when COM aggregation attempted
Index: dlls/dsound/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/dsound.c,v
retrieving revision 1.36
diff -u -r1.36 dsound.c
--- dlls/dsound/dsound.c 9 Sep 2005 10:19:45 -0000 1.36
+++ dlls/dsound/dsound.c 12 Sep 2005 04:31:53 -0000
@@ -1677,6 +1677,9 @@
HRESULT hr;
TRACE("(%p,%p)\n",ppDS,pUnkOuter);
+ if (pUnkOuter != NULL)
+ return DSERR_NOAGGREGATION;
+
/* Get dsound configuration */
setup_dsound_options();
@@ -1730,7 +1733,7 @@
if (pUnkOuter != NULL) {
WARN("invalid parameter: pUnkOuter != NULL\n");
*ppDS = 0;
- return DSERR_INVALIDPARAM;
+ return DSERR_NOAGGREGATION;
}
hr = DSOUND_Create(&pDS, pUnkOuter);
@@ -1758,6 +1761,9 @@
HRESULT hr;
TRACE("(%p,%p)\n",ppDS,pUnkOuter);
+ if (pUnkOuter != NULL)
+ return DSERR_NOAGGREGATION;
+
/* Get dsound configuration */
setup_dsound_options();
@@ -1811,7 +1817,7 @@
if (pUnkOuter != NULL) {
WARN("invalid parameter: pUnkOuter != NULL\n");
*ppDS = 0;
- return DSERR_INVALIDPARAM;
+ return DSERR_NOAGGREGATION;
}
hr = DSOUND_Create8(&pDS, pUnkOuter);
Index: dlls/dsound/tests/dsound.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound.c,v
retrieving revision 1.55
diff -u -r1.55 dsound.c
--- dlls/dsound/tests/dsound.c 20 Jun 2005 14:18:04 -0000 1.55
+++ dlls/dsound/tests/dsound.c 12 Sep 2005 04:31:53 -0000
@@ -175,6 +175,15 @@
trace("Testing IDirectSound\n");
+ /* try the COM class factory method w/ aggregation, which isn't allowed */
+ dso=NULL;
+ rc=CoCreateInstance(&CLSID_DirectSound, (LPUNKNOWN)1,
CLSCTX_INPROC_SERVER,
+ &IID_IDirectSound, (void**)&dso);
+ ok(rc==DSERR_NOAGGREGATION,"CoCreateInstance(CLSID_DirectSound)
didn't reject aggregation: %s\n",
+ DXGetErrorString8(rc));
+ if (dso)
+ IDirectSound_test(dso, FALSE, NULL);
+
/* try the COM class factory method of creation with no device
specified */
rc=CoCreateInstance(&CLSID_DirectSound, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound, (void**)&dso);
@@ -217,11 +226,19 @@
"CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound) "
"should have failed: %s\n",DXGetErrorString8(rc));
+ /* try with aggregation, which is not allowed*/
+ rc=DirectSoundCreate(NULL,&dso,(LPUNKNOWN)1);
+ ok(rc==DSERR_NOAGGREGATION,
+ "DirectSoundCreate() didn't reject aggregation: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
+ IDirectSound_test(dso, TRUE, NULL);
+
/* try with no device specified */
rc=DirectSoundCreate(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)
+ if (rc==DS_OK && dso)
IDirectSound_test(dso, TRUE, NULL);
/* try with default playback device specified */
@@ -322,7 +339,7 @@
rc=IDirectSound_CreateSoundBuffer(dso,&bufdesc,&secondary,NULL);
ok(rc==DS_OK && secondary!=NULL,
"IDirectSound_CreateSoundBuffer() failed to create a secondary "
- "buffer %s\n",DXGetErrorString8(rc));
+ "buffer: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && secondary!=NULL) {
LPDIRECTSOUND3DBUFFER buffer3d;
rc=IDirectSound_QueryInterface(secondary,
&IID_IDirectSound3DBuffer,
Index: dlls/dsound/tests/dsound8.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/tests/dsound8.c,v
retrieving revision 1.25
diff -u -r1.25 dsound8.c
--- dlls/dsound/tests/dsound8.c 15 Jul 2005 16:34:04 -0000 1.25
+++ dlls/dsound/tests/dsound8.c 12 Sep 2005 04:31:53 -0000
@@ -194,15 +194,25 @@
trace("Testing IDirectSound8\n");
+ /* try the COM class factory method w/ aggregation, which isn't allowed */
+ dso=NULL;
+ rc=CoCreateInstance(&CLSID_DirectSound8, (LPUNKNOWN)1,
CLSCTX_INPROC_SERVER,
+ &IID_IDirectSound8, (void**)&dso);
+ ok(rc==DSERR_NOAGGREGATION,"CoCreateInstance(CLSID_DirectSound8)
didn't reject aggregation: %s\n",
+ DXGetErrorString8(rc));
+ if (dso)
+ IDirectSound8_test(dso, FALSE, NULL);
+
/* try the COM class factory method of creation with no device
specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso);
- ok(rc==S_OK,"CoCreateInstance() failed: %s\n",DXGetErrorString8(rc));
+ ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %s\n",
+ DXGetErrorString8(rc));
if (dso)
IDirectSound8_test(dso, FALSE, NULL);
/* try the COM class factory method of creation with default playback
- * device specified */
+ * device specified */
rc=CoCreateInstance(&CLSID_DirectSound8, NULL, CLSCTX_INPROC_SERVER,
&IID_IDirectSound8, (void**)&dso);
ok(rc==S_OK,"CoCreateInstance(CLSID_DirectSound8) failed: %s\n",
@@ -235,24 +245,34 @@
"CoCreateInstance(CLSID_DirectSoundPrivate,IID_IDirectSound8) "
"should have failed: %s\n",DXGetErrorString8(rc));
+ /* try with aggregation, which is not allowed*/
+ rc=pDirectSoundCreate8(NULL,&dso,(LPUNKNOWN)1);
+ ok(rc==DSERR_NOAGGREGATION,
+ "DirectSoundCreate8() didn't reject aggregation: %s\n",
+ DXGetErrorString8(rc));
+ if (rc==DS_OK && dso)
+ IDirectSound8_test(dso, TRUE, NULL);
+
/* try with no device specified */
rc=pDirectSoundCreate8(NULL,&dso,NULL);
- ok(rc==S_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: %s\n",DXGetErrorString8(rc));
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultPlayback,&dso,NULL);
- ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
- "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
+ ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
+ "DirectSoundCreate8(DSDEVID_DefaultPlayback) failed: %s\n",
+ DXGetErrorString8(rc));
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
/* try with default voice playback device specified */
rc=pDirectSoundCreate8(&DSDEVID_DefaultVoicePlayback,&dso,NULL);
- ok(rc==S_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
- "DirectSoundCreate8() failed: %s\n",DXGetErrorString8(rc));
+ ok(rc==DS_OK||rc==DSERR_NODRIVER||rc==DSERR_ALLOCATED||rc==E_FAIL,
+ "DirectSoundCreate8(DSDEVID_DefaultVoicePlayback) failed: %s\n",
+ DXGetErrorString8(rc));
if (rc==DS_OK && dso)
IDirectSound8_test(dso, TRUE, NULL);
@@ -485,7 +505,8 @@
DXGetErrorString8(rc));
if (winetest_interactive) {
- trace("Playing a 5 seconds reference tone at the current
volume.\n");
+ trace("Playing a 5 seconds reference tone at the current "
+ "volume.\n");
if (rc==DS_OK)
trace("(the current volume is %ld according to
DirectSound)\n",
vol);
More information about the wine-patches
mailing list