dpvoice: Turn GetCompressionTypes into a semi-stub.
[wine.git] / dlls / dpvoice / tests / voice.c
blob7f0faa3454c451fd888b2c6b5ff971f49b67bee0
1 /*
2 * DirectPlay Voice Client Interface
4 * Copyright (C) 2014 Alistair Leslie-Hughes
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #define WIN32_LEAN_AND_MEAN
22 #include <windows.h>
23 #include <stdio.h>
24 #include <assert.h>
26 #include <initguid.h>
27 #include <dplay8.h>
28 #include <dvoice.h>
29 #include "wine/test.h"
31 static IDirectPlayVoiceClient *vclient = NULL;
32 static IDirectPlayVoiceServer *vserver = NULL;
33 static IDirectPlay8Server *dpserver = NULL;
34 static IDirectPlay8Client *dpclient = NULL;
35 static BOOL HasConnected = FALSE;
36 static DWORD port = 8888;
37 static HANDLE connected = NULL;
39 static const GUID appguid = { 0xcd0c3d4b, 0xe15e, 0x4cf2, { 0x9e, 0xa8, 0x6e, 0x1d, 0x65, 0x48, 0xc5, 0xa6 } };
40 static WCHAR sessionname[] = {'w','i','n','e','g','a','m','e','s','s','e','r','v','e','r',0};
41 static WCHAR localhost[] = {'l','o','c','a','l','h','o','s','t',0};
44 static HRESULT WINAPI DirectPlayMessageHandler(void *lpvUserContext, DWORD dwMessageId, void *lpMessage)
46 trace("msgid: 0x%08x\n", dwMessageId);
47 return S_OK;
50 static HRESULT WINAPI DirectPlayClientMessageHandler(void *lpvUserContext, DWORD dwMessageId, void *lpMessage)
52 trace("cmsgid: 0x%08x\n", dwMessageId);
53 switch(dwMessageId)
55 case DPN_MSGID_CONNECT_COMPLETE:
57 PDPNMSG_CONNECT_COMPLETE completemsg;
58 completemsg = (PDPNMSG_CONNECT_COMPLETE)lpMessage;
60 trace("DPN_MSGID_CONNECT_COMPLETE code: 0x%08x\n", completemsg->hResultCode);
61 SetEvent(connected);
62 break;
66 return S_OK;
69 static HRESULT CALLBACK DirectPlayVoiceServerMessageHandler(void *lpvUserContext, DWORD dwMessageId, void *lpMessage)
71 trace("vserver: 0x%08x\n", dwMessageId);
72 return S_OK;
75 static HRESULT CALLBACK DirectPlayVoiceClientMessageHandler(void *lpvUserContext, DWORD dwMessageId, void *lpMessage)
77 trace("cserver: 0x%08x\n", dwMessageId);
79 return S_OK;
82 static BOOL test_init_dpvoice_server(void)
84 HRESULT hr;
86 hr = CoCreateInstance(&CLSID_DirectPlayVoiceServer, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceServer, (void **)&vserver);
87 if(hr == S_OK)
89 DVSESSIONDESC dvSessionDesc;
90 IDirectPlay8Address *localaddr = NULL;
91 DPN_APPLICATION_DESC dpnAppDesc;
93 hr = CoCreateInstance(&CLSID_DirectPlay8Server, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay8Server, (void **)&dpserver);
94 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
96 hr = IDirectPlay8Server_Initialize(dpserver, NULL, DirectPlayMessageHandler, 0);
97 ok(hr == S_OK, "Initialize failed with 0x%08x\n", hr);
99 hr = CoCreateInstance(&CLSID_DirectPlay8Address, NULL, CLSCTX_ALL, &IID_IDirectPlay8Address, (void **)&localaddr);
100 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
102 hr = IDirectPlay8Address_SetSP(localaddr, &CLSID_DP8SP_TCPIP);
103 ok(hr == S_OK, "SetSP with 0x%08x\n", hr);
105 hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_HOSTNAME, localhost, (lstrlenW(localhost)+1)*sizeof(WCHAR),
106 DPNA_DATATYPE_STRING );
107 ok(hr == S_OK, "AddComponent(addr) with 0x%08x\n", hr);
109 hr = IDirectPlay8Address_AddComponent(localaddr, DPNA_KEY_PORT, &port, sizeof(port), DPNA_DATATYPE_DWORD);
110 ok(hr == S_OK, "AddComponent(port)) with 0x%08x\n", hr);
112 memset(&dpnAppDesc, 0, sizeof(DPN_APPLICATION_DESC) );
113 dpnAppDesc.dwSize = sizeof( DPN_APPLICATION_DESC );
114 dpnAppDesc.dwFlags = DPNSESSION_CLIENT_SERVER;
115 dpnAppDesc.guidApplication = appguid;
116 dpnAppDesc.pwszSessionName = sessionname;
118 hr = IDirectPlay8Server_Host(dpserver, &dpnAppDesc, &localaddr, 1, NULL, NULL, NULL, 0 );
119 todo_wine ok(hr == S_OK, "Host failed with 0x%08x\n", hr);
121 hr = IDirectPlayVoiceServer_Initialize(vserver, NULL, &DirectPlayVoiceServerMessageHandler, NULL, 0, 0);
122 todo_wine ok(hr == DVERR_NOTRANSPORT, "Initialize failed with 0x%08x\n", hr);
124 hr = IDirectPlayVoiceServer_Initialize(vserver, (IUnknown*)dpserver, &DirectPlayVoiceServerMessageHandler, NULL, 0, 0);
125 todo_wine ok(hr == S_OK, "Initialize failed with 0x%08x\n", hr);
127 memset( &dvSessionDesc, 0, sizeof(DVSESSIONDESC) );
128 dvSessionDesc.dwSize = sizeof( DVSESSIONDESC );
129 dvSessionDesc.dwBufferAggressiveness = DVBUFFERAGGRESSIVENESS_DEFAULT;
130 dvSessionDesc.dwBufferQuality = DVBUFFERQUALITY_DEFAULT;
131 dvSessionDesc.dwFlags = 0;
132 dvSessionDesc.dwSessionType = DVSESSIONTYPE_MIXING;
133 dvSessionDesc.guidCT = DPVCTGUID_DEFAULT;
135 hr = IDirectPlayVoiceServer_StartSession(vserver, &dvSessionDesc, 0);
136 todo_wine ok(hr == S_OK, "StartSession failed with 0x%08x\n", hr);
138 if(localaddr)
139 IDirectPlay8Address_Release(localaddr);
141 else
143 /* Everything after Windows XP doesn't have dpvoice installed. */
144 win_skip("IDirectPlayVoiceServer not supported on this platform\n");
147 return vserver != NULL;
150 static BOOL test_init_dpvoice_client(void)
152 HRESULT hr;
153 WCHAR player[] = {'w','i','n','e','u','s','e','r',0};
155 hr = CoCreateInstance(&CLSID_DirectPlayVoiceClient, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceClient, (void **)&vclient);
156 if(hr == S_OK)
158 DVSOUNDDEVICECONFIG soundDeviceConfig;
159 DVCLIENTCONFIG clientConfig;
160 IDirectPlay8Address *localaddr = NULL;
161 IDirectPlay8Address *hostaddr = NULL;
162 DPN_PLAYER_INFO playerinfo;
163 DPN_APPLICATION_DESC appdesc;
164 DPNHANDLE asyncop;
166 connected = CreateEventA(NULL, FALSE, FALSE, NULL);
168 hr = CoCreateInstance(&CLSID_DirectPlay8Client, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlay8Client, (void **)&dpclient);
169 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
171 hr = IDirectPlay8Client_Initialize(dpclient, NULL, DirectPlayClientMessageHandler, 0);
172 ok(hr == S_OK, "Initialize failed with 0x%08x\n", hr);
174 hr = CoCreateInstance(&CLSID_DirectPlay8Address, NULL, CLSCTX_ALL, &IID_IDirectPlay8Address, (void **)&hostaddr);
175 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
177 hr = IDirectPlay8Address_SetSP(hostaddr, &CLSID_DP8SP_TCPIP);
178 ok(hr == S_OK, "SetSP with 0x%08x\n", hr);
180 hr = CoCreateInstance(&CLSID_DirectPlay8Address, NULL, CLSCTX_ALL, &IID_IDirectPlay8Address, (void **)&localaddr);
181 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
183 hr = IDirectPlay8Address_SetSP(localaddr, &CLSID_DP8SP_TCPIP);
184 ok(hr == S_OK, "SetSP with 0x%08x\n", hr);
186 hr = IDirectPlay8Address_AddComponent(hostaddr, DPNA_KEY_HOSTNAME, localhost, (lstrlenW(localhost)+1)*sizeof(WCHAR),
187 DPNA_DATATYPE_STRING );
188 ok(hr == S_OK, "AddComponent(addr) with 0x%08x\n", hr);
190 hr = IDirectPlay8Address_AddComponent(hostaddr, DPNA_KEY_PORT, &port, sizeof(port), DPNA_DATATYPE_DWORD);
191 ok(hr == S_OK, "AddComponent(port)) with 0x%08x\n", hr);
193 memset( &playerinfo, 0, sizeof(DPN_PLAYER_INFO) );
194 playerinfo.dwSize = sizeof(DPN_PLAYER_INFO);
195 playerinfo.dwInfoFlags = DPNINFO_NAME;
196 playerinfo.pwszName = player;
198 hr = IDirectPlay8Client_SetClientInfo(dpclient, &playerinfo, NULL, NULL, DPNOP_SYNC);
199 ok(hr == S_OK, "SetClientInfo with 0x%08x\n", hr);
201 memset( &appdesc, 0, sizeof(DPN_APPLICATION_DESC));
202 appdesc.dwSize = sizeof( DPN_APPLICATION_DESC );
203 appdesc.guidApplication = appguid;
205 hr = IDirectPlay8Client_Connect(dpclient, &appdesc, hostaddr, localaddr, NULL, NULL, NULL, 0,
206 NULL, &asyncop, DPNCONNECT_OKTOQUERYFORADDRESSING);
207 ok(hr == S_OK || hr == DPNSUCCESS_PENDING, "Connect with 0x%08x\n", hr);
209 WaitForSingleObject(connected, 5000);
211 hr = IDirectPlayVoiceClient_Initialize(vclient, (IUnknown*)dpclient, DirectPlayVoiceClientMessageHandler, NULL, 0, 0 );
212 todo_wine ok(hr == S_OK, "Connect failed with 0x%08x\n", hr);
214 soundDeviceConfig.dwSize = sizeof(soundDeviceConfig);
215 soundDeviceConfig.dwFlags = 0;
216 soundDeviceConfig.guidPlaybackDevice = DSDEVID_DefaultVoicePlayback;
217 soundDeviceConfig.lpdsPlaybackDevice = NULL;
218 soundDeviceConfig.guidCaptureDevice = DSDEVID_DefaultVoiceCapture;
219 soundDeviceConfig.lpdsCaptureDevice = NULL;
220 soundDeviceConfig.hwndAppWindow = GetDesktopWindow();
221 soundDeviceConfig.lpdsMainBuffer = NULL;
222 soundDeviceConfig.dwMainBufferFlags = 0;
223 soundDeviceConfig.dwMainBufferPriority = 0;
225 memset(&clientConfig, 0, sizeof(clientConfig));
226 clientConfig.dwSize = sizeof(clientConfig);
227 clientConfig.dwFlags = DVCLIENTCONFIG_AUTOVOICEACTIVATED | DVCLIENTCONFIG_AUTORECORDVOLUME;
228 clientConfig.lPlaybackVolume = DVPLAYBACKVOLUME_DEFAULT;
229 clientConfig.dwBufferQuality = DVBUFFERQUALITY_DEFAULT;
230 clientConfig.dwBufferAggressiveness = DVBUFFERAGGRESSIVENESS_DEFAULT;
231 clientConfig.dwThreshold = DVTHRESHOLD_UNUSED;
232 clientConfig.lRecordVolume = DVRECORDVOLUME_LAST;
233 clientConfig.dwNotifyPeriod = 0;
235 /* Connect to the voice session */
236 hr = IDirectPlayVoiceClient_Connect(vclient, &soundDeviceConfig, &clientConfig, DVFLAGS_SYNC);
237 if(hr == DVERR_RUNSETUP)
239 IDirectPlayVoiceTest *voicetest;
241 /* See if we can get the default values from the registry and try again. */
242 hr = CoCreateInstance(&CLSID_DirectPlayVoiceTest, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceTest, (void **)&voicetest);
243 ok(hr == S_OK, "CoCreateInstance failed with 0x%08x\n", hr);
244 if(hr == S_OK)
246 hr = IDirectPlayVoiceTest_CheckAudioSetup(voicetest, &DSDEVID_DefaultVoicePlayback, &DSDEVID_DefaultVoiceCapture,
247 NULL, DVFLAGS_QUERYONLY);
248 todo_wine ok(hr == S_OK || hr == DVERR_RUNSETUP, "CheckAudioSetup failed with 0x%08x\n", hr);
249 if(hr == S_OK)
251 hr = IDirectPlayVoiceClient_Connect(vclient, &soundDeviceConfig, &clientConfig, DVFLAGS_SYNC);
252 todo_wine ok(hr == S_OK, "Voice Connect failed with 0x%08x\n", hr);
254 else
256 win_skip("DirectPlayVoice not setup.\n");
259 IDirectPlayVoiceTest_Release(voicetest);
263 HasConnected = (hr == S_OK);
264 if(!HasConnected)
266 IDirectPlayVoiceClient_Release(vclient);
267 vclient = NULL;
270 if(hostaddr)
271 IDirectPlay8Address_Release(hostaddr);
273 if(localaddr)
274 IDirectPlay8Address_Release(localaddr);
276 CloseHandle(connected);
278 else
280 /* Everything after Windows XP doesn't have dpvoice installed. */
281 win_skip("IDirectPlayVoiceClient not supported on this platform\n");
284 return vclient != NULL;
287 static void test_cleanup_dpvoice(void)
289 HRESULT hr;
291 if(vclient)
293 if(HasConnected)
295 hr = IDirectPlayVoiceClient_Disconnect(vclient, 0);
296 todo_wine ok(hr == S_OK || hr == DV_PENDING, "Disconnect failed with 0x%08x\n", hr);
298 IDirectPlayVoiceClient_Release(vclient);
301 if(dpclient)
303 hr = IDirectPlay8Client_Close(dpclient, 0);
304 ok(hr == S_OK, "IDirectPlay8Client_Close failed with 0x%08x\n", hr);
306 IDirectPlay8Client_Release(dpclient);
309 if(vserver)
311 hr = IDirectPlayVoiceServer_StopSession(vserver, 0);
312 todo_wine ok(hr == S_OK, "StopSession failed with 0x%08x\n", hr);
314 IDirectPlayVoiceServer_Release(vserver);
317 if(dpserver)
319 hr = IDirectPlay8Server_Close(dpserver, 0);
320 todo_wine ok(hr == S_OK, "got 0x%08x\n", hr);
322 IDirectPlay8Server_Release(dpserver);
326 static void create_voicetest(void)
328 HRESULT hr;
329 IDirectPlayVoiceTest *voicetest;
331 hr = CoCreateInstance(&CLSID_DirectPlayVoiceTest, NULL, CLSCTX_INPROC_SERVER, &IID_IDirectPlayVoiceTest, (void **)&voicetest);
332 if(hr == S_OK)
334 hr = IDirectPlayVoiceTest_CheckAudioSetup(voicetest, &DSDEVID_DefaultVoicePlayback, &DSDEVID_DefaultVoiceCapture,
335 NULL, DVFLAGS_QUERYONLY);
336 todo_wine ok(hr == S_OK || hr == DVERR_RUNSETUP, "CheckAudioSetup failed with 0x%08x\n", hr);
338 IDirectPlayVoiceTest_Release(voicetest);
340 else
342 /* Everything after Windows XP doesn't have dpvoice installed. */
343 win_skip("IDirectPlayVoiceClient not supported on this platform\n");
347 static void test_GetCompressionTypes(IDirectPlayVoiceClient *client_iface, IDirectPlayVoiceServer *server_iface)
349 const char *name = client_iface ? "client" : "server";
350 HRESULT ret;
351 DVCOMPRESSIONINFO data[32];
352 DWORD data_size = 0, num_elements, i, j;
353 WCHAR *string_loc;
354 BOOL found_pcm;
356 /* some variables are initialized to 99 just to check that they are not overwritten with 0 */
357 static struct
359 /* inputs */
360 DWORD data_size;
361 DWORD num_elements;
362 DWORD flags;
363 /* expected output */
364 HRESULT ret;
365 /* test flags */
366 enum
368 NULL_DATA = 1,
369 NULL_DATA_SIZE = 2,
370 NULL_NUM_ELEMENTS = 4,
371 SHARED_VARIABLE = 8
373 test_flags;
375 tests[] =
377 /* tests NULL data with an insufficient data_size */
378 { 10, 0, 0, DVERR_BUFFERTOOSMALL, NULL_DATA },
380 /* tests NULL data with an ample data_size */
381 { sizeof(data) - 1, 0, 0, DVERR_INVALIDPOINTER, NULL_DATA },
383 /* tests NULL data_size */
384 { 0, 99, 0, DVERR_INVALIDPOINTER, NULL_DATA_SIZE },
386 /* tests NULL num_elements */
387 { 99, 0, 0, DVERR_INVALIDPOINTER, NULL_NUM_ELEMENTS },
389 /* tests NULL everything */
390 { 99, 99, 0, DVERR_INVALIDPOINTER, NULL_DATA | NULL_DATA_SIZE | NULL_NUM_ELEMENTS },
392 /* tests passing the same pointer for data_size and num_elements */
393 { 10, 0, 0, DVERR_BUFFERTOOSMALL, SHARED_VARIABLE },
395 /* tests passing the same pointer but with an ample data_size */
396 { sizeof(data) - 1, 0, 0, DVERR_BUFFERTOOSMALL, SHARED_VARIABLE },
398 /* tests flags!=0 */
399 { 99, 99, 1, DVERR_INVALIDFLAGS },
401 /* tests data_size=0 */
402 { 0, 0, 0, DVERR_BUFFERTOOSMALL },
404 /* tests data_size=1 */
405 { 1, 0, 0, DVERR_BUFFERTOOSMALL },
407 /* tests data_size = sizeof(DVCOMPRESSIONINFO) */
408 { sizeof(DVCOMPRESSIONINFO), 0, 0, DVERR_BUFFERTOOSMALL },
410 /* tests data_size = returned data_size - 1 */
411 { 0 /* initialized later */, 0, 0, DVERR_BUFFERTOOSMALL },
413 /* tests data_size = returned data_size */
414 { 0 /* initialized later */, 0, 0, DV_OK },
416 /* tests data_size = returned data_size + 1 */
417 { 0 /* initialized later */, 0, 0, DV_OK }
420 /* either client_iface or server_iface must be given, but not both */
421 assert(!client_iface ^ !server_iface);
423 if (client_iface)
424 ret = IDirectPlayVoiceClient_GetCompressionTypes(client_iface, NULL, &data_size, &num_elements, 0);
425 else
426 ret = IDirectPlayVoiceServer_GetCompressionTypes(server_iface, NULL, &data_size, &num_elements, 0);
427 ok(ret == DVERR_BUFFERTOOSMALL,
428 "%s: expected ret=%x got ret=%x\n", name, DVERR_BUFFERTOOSMALL, ret);
429 ok(data_size > sizeof(DVCOMPRESSIONINFO) && data_size < sizeof(data) - 1,
430 "%s: got data_size=%u\n", name, data_size);
431 tests[sizeof(tests) / sizeof(tests[0]) - 3].data_size = data_size - 1;
432 tests[sizeof(tests) / sizeof(tests[0]) - 2].data_size = data_size;
433 tests[sizeof(tests) / sizeof(tests[0]) - 1].data_size = data_size + 1;
435 for(i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
437 memset(data, 0x23, sizeof(data));
439 data_size = tests[i].data_size;
440 num_elements = tests[i].num_elements;
442 if(client_iface)
443 ret = IDirectPlayVoiceClient_GetCompressionTypes(
444 client_iface,
445 tests[i].test_flags & NULL_DATA ? NULL : data,
446 tests[i].test_flags & NULL_DATA_SIZE ? NULL : &data_size,
447 tests[i].test_flags & NULL_NUM_ELEMENTS ? NULL :
448 tests[i].test_flags & SHARED_VARIABLE ? &data_size : &num_elements,
449 tests[i].flags
451 else
452 ret = IDirectPlayVoiceServer_GetCompressionTypes(
453 server_iface,
454 tests[i].test_flags & NULL_DATA ? NULL : data,
455 tests[i].test_flags & NULL_DATA_SIZE ? NULL : &data_size,
456 tests[i].test_flags & NULL_NUM_ELEMENTS ? NULL :
457 tests[i].test_flags & SHARED_VARIABLE ? &data_size : &num_elements,
458 tests[i].flags
461 ok(ret == tests[i].ret,
462 "%s: tests[%u]: expected ret=%x got ret=%x\n", name, i, tests[i].ret, ret);
464 if(ret == DV_OK || ret == DVERR_BUFFERTOOSMALL || tests[i].test_flags == NULL_DATA)
466 ok(data_size > sizeof(DVCOMPRESSIONINFO) && data_size < sizeof(data) - 1,
467 "%s: tests[%u]: got data_size=%u\n", name, i, data_size);
468 if(!(tests[i].test_flags & SHARED_VARIABLE))
469 ok(num_elements > 0 && num_elements < data_size / sizeof(DVCOMPRESSIONINFO) + 1,
470 "%s: tests[%u]: got num_elements=%u\n", name, i, num_elements);
472 else
474 ok(data_size == tests[i].data_size,
475 "%s: tests[%u]: expected data_size=%u got data_size=%u\n",
476 name, i, tests[i].data_size, data_size);
477 ok(num_elements == tests[i].num_elements,
478 "%s: tests[%u]: expected num_elements=%u got num_elements=%u\n",
479 name, i, tests[i].num_elements, num_elements);
482 if(ret == DV_OK)
484 string_loc = (WCHAR*)(data + num_elements);
485 found_pcm = FALSE;
486 for(j = 0; j < num_elements; j++)
488 if(memcmp(&data[j].guidType, &DPVCTGUID_NONE, sizeof(GUID)) == 0)
490 ok(data[j].dwMaxBitsPerSecond == 64000,
491 "%s: tests[%u]: data[%u]: expected dwMaxBitsPerSecond=64000 got dwMaxBitsPerSecond=%u\n",
492 name, i, j, data[j].dwMaxBitsPerSecond);
493 found_pcm = TRUE;
495 ok(data[j].dwSize == 80,
496 "%s: tests[%u]: data[%u]: expected dwSize=80 got dwSize=%u\n",
497 name, i, j, data[j].dwSize);
498 ok(data[j].lpszName == string_loc,
499 "%s: tests[%u]: data[%u]: expected lpszName=%p got lpszName=%p\n",
500 name, i, j, string_loc, data[j].lpszName);
501 ok(!data[j].lpszDescription,
502 "%s: tests[%u]: data[%u]: expected lpszDescription=NULL got lpszDescription=%s\n",
503 name, i, j, wine_dbgstr_w(data[j].lpszDescription));
504 ok(!data[j].dwFlags,
505 "%s: tests[%u]: data[%u]: expected dwFlags=0 got dwFlags=%u\n",
506 name, i, j, data[j].dwFlags);
507 string_loc += lstrlenW(data[j].lpszName) + 1;
509 ok((char*)string_loc == (char*)data + data_size,
510 "%s: tests[%u]: expected string_loc=%p got string_loc=%p\n",
511 name, i, (char*)data + data_size, string_loc);
512 ok(*(char*)string_loc == 0x23,
513 "%s: tests[%u]: expected *(char*)string_loc=0x23 got *(char*)string_loc=0x%x\n",
514 name, i, *(char*)string_loc);
515 ok(found_pcm, "%s: tests[%u]: MS-PCM codec not found\n", name, i);
517 else
519 ok(*(char*)data == 0x23,
520 "%s: tests[%u]: expected *(char*)data=0x23 got *(char*)data=0x%x\n",
521 name, i, *(char*)data);
526 START_TEST(voice)
528 HRESULT hr;
530 hr = CoInitialize(0);
531 ok(hr == S_OK, "failed to init com\n");
532 if(hr != S_OK)
533 return;
535 create_voicetest();
537 if(test_init_dpvoice_server())
539 test_GetCompressionTypes(NULL, vserver);
541 if(test_init_dpvoice_client())
543 test_GetCompressionTypes(vclient, NULL);
545 else
547 skip("client failed to initialize\n");
550 else
552 skip("server failed to initialize\n");
555 test_cleanup_dpvoice();
557 CoUninitialize();