Added patch to implement semi-stub for IDirectPlayVoiceClient::GetCompressionTypes.

This commit is contained in:
Sebastian Lackner 2015-01-20 19:11:58 +01:00
parent 277cf9f50f
commit 372c004139
6 changed files with 379 additions and 1 deletions

View File

@ -37,7 +37,7 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
===================================
**Bugfixes and features included in the next upcoming release [13]:**
**Bugfixes and features included in the next upcoming release [14]:**
* Add stubs for D3DXCreateAnimationController interface
* Anno 1602 installer depends on Windows 98 behavior of SHFileOperationW ([Wine Bug #37916](https://bugs.winehq.org/show_bug.cgi?id=37916))
@ -47,6 +47,7 @@ Included bug fixes and improvements
* Fix init of LONGLONG variable with a negative value in TGA decoder
* Fix wrong colors in Wolfenstein (2009) ([Wine Bug #34692](https://bugs.winehq.org/show_bug.cgi?id=34692))
* Graphical issues in Inquisitor ([Wine Bug #32490](https://bugs.winehq.org/show_bug.cgi?id=32490))
* Implement semi-stub for IDirectPlayVoiceClient::GetCompressionTypes ([Wine Bug #29238](https://bugs.winehq.org/show_bug.cgi?id=29238))
* Multiple applications start wrong executable if whitespace present in name ([Wine Bug #19666](https://bugs.winehq.org/show_bug.cgi?id=19666))
* Port Royale doesn't display ocean correctly ([Wine Bug #17913](https://bugs.winehq.org/show_bug.cgi?id=17913))
* Scrolling causes mouse and screen to lock in Call to Power II ([Wine Bug #34559](https://bugs.winehq.org/show_bug.cgi?id=34559))

1
debian/changelog vendored
View File

@ -10,6 +10,7 @@ wine-staging (1.7.35) UNRELEASED; urgency=low
* Added patch for IConnectionPoint/INetworkListManagerEvents stub interface.
* Added patch to fix init of LONGLONG variable with a negative value in TGA decoder.
* Added patch to implement stubs for D3DXCreateAnimationController interface.
* Added patch to implement semi-stub for IDirectPlayVoiceClient::GetCompressionTypes.
* Removed patch to set last error on success in WSARecv (accepted upstream).
* Removed patch to fix handling of subdirectory in FtpFindFirstFile (accepted upstream).
* Removed patch to initialize irp.Tail.Overlay.OriginalFileObject with stub file object (accepted upstream).

View File

@ -0,0 +1,221 @@
From 083ee79fc88df1d26160cf23411e05e6a3615ac0 Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Fri, 16 Jan 2015 00:44:23 -0700
Subject: dpvoice/tests: Add GetCompressionTypes tests.
---
dlls/dpvoice/tests/voice.c | 190 ++++++++++++++++++++++++++++++++++++++++++++-
1 file changed, 188 insertions(+), 2 deletions(-)
diff --git a/dlls/dpvoice/tests/voice.c b/dlls/dpvoice/tests/voice.c
index 8048280..e42fb7b 100644
--- a/dlls/dpvoice/tests/voice.c
+++ b/dlls/dpvoice/tests/voice.c
@@ -343,6 +343,179 @@ static void create_voicetest(void)
}
}
+static void test_GetCompressionTypes(HRESULT (WINAPI *GetCompressionTypes)(void*,void*,DWORD*,DWORD*,DWORD),
+ void *iface, const char *name)
+{
+ DVCOMPRESSIONINFO data[32];
+ HRESULT ret;
+ DWORD data_size, num_elements, i, j;
+ WCHAR *string_loc;
+ BOOL found_pcm;
+
+ /* some variables are initialized to 99 just to check that they are not overwritten with 0 */
+ static struct
+ {
+ /* inputs */
+ DWORD data_size;
+ DWORD num_elements;
+ DWORD flags;
+ /* expected output */
+ HRESULT ret;
+ /* test flags */
+ enum
+ {
+ NULL_DATA = 1,
+ NULL_DATA_SIZE = 2,
+ NULL_NUM_ELEMENTS = 4,
+ SHARED_VARIABLE = 8
+ }
+ test_flags;
+ }
+ tests[] =
+ {
+ /* tests NULL data with an insufficient data_size */
+ { 10, 0, 0, DVERR_BUFFERTOOSMALL, NULL_DATA },
+
+ /* tests NULL data with an ample data_size */
+ { sizeof(data) - 1, 0, 0, DVERR_INVALIDPOINTER, NULL_DATA },
+
+ /* tests NULL data_size */
+ { 0, 99, 0, DVERR_INVALIDPOINTER, NULL_DATA_SIZE },
+
+ /* tests NULL num_elements */
+ { 99, 0, 0, DVERR_INVALIDPOINTER, NULL_NUM_ELEMENTS },
+
+ /* tests NULL everything */
+ { 99, 99, 0, DVERR_INVALIDPOINTER, NULL_DATA | NULL_DATA_SIZE | NULL_NUM_ELEMENTS },
+
+ /* tests passing the same pointer for data_size and num_elements */
+ { 10, 0, 0, DVERR_BUFFERTOOSMALL, SHARED_VARIABLE },
+
+ /* tests passing the same pointer but with an ample data_size */
+ { sizeof(data) - 1, 0, 0, DVERR_BUFFERTOOSMALL, SHARED_VARIABLE },
+
+ /* tests flags!=0 */
+ { 99, 99, 1, DVERR_INVALIDFLAGS },
+
+ /* tests data_size=0 */
+ { 0, 0, 0, DVERR_BUFFERTOOSMALL },
+
+ /* tests data_size=1 */
+ { 1, 0, 0, DVERR_BUFFERTOOSMALL },
+
+ /* tests data_size = sizeof(DVCOMPRESSIONINFO) */
+ { sizeof(DVCOMPRESSIONINFO), 0, 0, DVERR_BUFFERTOOSMALL },
+
+ /* tests data_size = returned data_size - 1 */
+ { 0 /* initialized later */, 0, 0, DVERR_BUFFERTOOSMALL },
+
+ /* tests data_size = returned data_size */
+ { 0 /* initialized later */, 0, 0, DV_OK },
+
+ /* tests data_size = returned data_size + 1 */
+ { 0 /* initialized later */, 0, 0, DV_OK }
+ };
+
+ if(GetCompressionTypes(iface, NULL, NULL, NULL, 0) == E_NOTIMPL)
+ {
+ skip("%s: GetCompressionTypes not implemented\n", name);
+ return;
+ }
+
+ data_size = 0;
+ ret = GetCompressionTypes(iface, NULL, &data_size, &num_elements, 0);
+ ok(ret == DVERR_BUFFERTOOSMALL,
+ "%s: expected ret=%x got ret=%x\n", name, DVERR_BUFFERTOOSMALL, ret);
+ ok(data_size > sizeof(DVCOMPRESSIONINFO) && data_size < sizeof(data) - 1,
+ "%s: expected data_size between %u and %u got data_size=%u\n",
+ name, sizeof(DVCOMPRESSIONINFO), sizeof(data) - 1, data_size);
+ tests[sizeof(tests) / sizeof(tests[0]) - 3].data_size = data_size - 1;
+ tests[sizeof(tests) / sizeof(tests[0]) - 2].data_size = data_size;
+ tests[sizeof(tests) / sizeof(tests[0]) - 1].data_size = data_size + 1;
+
+ for(i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
+ {
+ memset(data, 0x23, sizeof(data));
+
+ data_size = tests[i].data_size;
+ num_elements = tests[i].num_elements;
+
+ ret = GetCompressionTypes(
+ iface,
+ tests[i].test_flags & NULL_DATA ? NULL : data,
+ tests[i].test_flags & NULL_DATA_SIZE ? NULL : &data_size,
+ tests[i].test_flags & NULL_NUM_ELEMENTS ? NULL :
+ tests[i].test_flags & SHARED_VARIABLE ? &data_size : &num_elements,
+ tests[i].flags
+ );
+
+ ok(ret == tests[i].ret,
+ "%s: tests[%u]: expected ret=%x got ret=%x\n", name, i, tests[i].ret, ret);
+
+ if(ret == DV_OK || ret == DVERR_BUFFERTOOSMALL || tests[i].test_flags == NULL_DATA)
+ {
+ ok(data_size > sizeof(DVCOMPRESSIONINFO) && data_size < sizeof(data) - 1,
+ "%s: tests[%u]: expected data_size between %u and %u got data_size=%u\n",
+ name, i, sizeof(DVCOMPRESSIONINFO), sizeof(data) - 1, data_size);
+ if(!(tests[i].test_flags & SHARED_VARIABLE))
+ ok(num_elements > 0 && num_elements < data_size / sizeof(DVCOMPRESSIONINFO) + 1,
+ "%s: tests[%u]: expected num_elements between 0 and %u got num_elements=%u\n",
+ name, i, data_size / sizeof(DVCOMPRESSIONINFO) + 1, num_elements);
+ }
+ else
+ {
+ ok(data_size == tests[i].data_size,
+ "%s: tests[%u]: expected data_size=%u got data_size=%u\n",
+ name, i, tests[i].data_size, data_size);
+ ok(num_elements == tests[i].num_elements,
+ "%s: tests[%u]: expected num_elements=%u got num_elements=%u\n",
+ name, i, tests[i].num_elements, num_elements);
+ }
+
+ if(ret == DV_OK)
+ {
+ string_loc = (WCHAR *)(data + num_elements);
+ found_pcm = FALSE;
+ for(j = 0; j < num_elements; j++)
+ {
+ if(memcmp(&data[j].guidType, &DPVCTGUID_NONE, sizeof(GUID)) == 0)
+ {
+ ok(data[j].dwMaxBitsPerSecond == 64000,
+ "%s: tests[%u]: data[%u]: expected dwMaxBitsPerSecond=64000 got dwMaxBitsPerSecond=%u\n",
+ name, i, j, data[j].dwMaxBitsPerSecond);
+ found_pcm = TRUE;
+ }
+ ok(data[j].dwSize == 80,
+ "%s: tests[%u]: data[%u]: expected dwSize=80 got dwSize=%u\n",
+ name, i, j, data[j].dwSize);
+ ok(data[j].lpszName == string_loc,
+ "%s: tests[%u]: data[%u]: expected lpszName=%p got lpszName=%p\n",
+ name, i, j, string_loc, data[j].lpszName);
+ ok(!data[j].lpszDescription,
+ "%s: tests[%u]: data[%u]: expected lpszDescription=NULL got lpszDescription=%s\n",
+ name, i, j, wine_dbgstr_w(data[j].lpszDescription));
+ ok(!data[j].dwFlags,
+ "%s: tests[%u]: data[%u]: expected dwFlags=0 got dwFlags=%u\n",
+ name, i, j, data[j].dwFlags);
+ string_loc += lstrlenW(data[j].lpszName) + 1;
+ }
+ ok((char *)string_loc == (char *)data + data_size,
+ "%s: tests[%u]: expected string_loc=%p got string_loc=%p\n",
+ name, i, (char *)data + data_size, string_loc);
+ ok(*(char *)string_loc == 0x23,
+ "%s: tests[%u]: expected *(char*)string_loc=0x23 got *(char *)string_loc=0x%x\n",
+ name, i, *(char *)string_loc);
+ ok(found_pcm, "%s: tests[%u]: MS-PCM codec not found\n", name, i);
+ }
+ else
+ {
+ ok(*(char *)data == 0x23,
+ "%s: tests[%u]: expected *(char*)data=0x23 got *(char *)data=0x%x\n",
+ name, i, *(char *)data);
+ }
+ }
+}
+
START_TEST(voice)
{
HRESULT hr;
@@ -354,9 +527,22 @@ START_TEST(voice)
create_voicetest();
- if(test_init_dpvoice_server() && test_init_dpvoice_client())
+ if(test_init_dpvoice_server())
+ {
+ test_GetCompressionTypes((void *)vserver->lpVtbl->GetCompressionTypes, vserver, "server");
+ }
+ else
+ {
+ skip("server failed to initialize\n");
+ }
+
+ if(test_init_dpvoice_client())
+ {
+ test_GetCompressionTypes((void *)vclient->lpVtbl->GetCompressionTypes, vclient, "client");
+ }
+ else
{
- /* TODO */
+ skip("client failed to initialize\n");
}
test_cleanup_dpvoice();
--
2.2.1

View File

@ -0,0 +1,133 @@
From 25a2c26cb36b59d5d820707e8d5a6313d6a3636d Mon Sep 17 00:00:00 2001
From: Alex Henrie <alexhenrie24@gmail.com>
Date: Fri, 16 Jan 2015 00:44:24 -0700
Subject: dpvoice: Turn GetCompressionTypes into a semi-stub.
Star Trek Armada II needs GetCompressionTypes to return at least one
value, see https://bugs.winehq.org/show_bug.cgi?id=29238
MS-PCM is guaranteed to be present on Windows XP, and it's already
implemented in Wine, so advertising this codec shouldn't cause any
trouble.
---
dlls/dpvoice/client.c | 5 +++--
dlls/dpvoice/dvoice_private.h | 1 +
dlls/dpvoice/server.c | 43 +++++++++++++++++++++++++++++++++++++++++--
dlls/dpvoice/tests/voice.c | 6 ------
4 files changed, 45 insertions(+), 10 deletions(-)
diff --git a/dlls/dpvoice/client.c b/dlls/dpvoice/client.c
index 29b5336..bdae160 100644
--- a/dlls/dpvoice/client.c
+++ b/dlls/dpvoice/client.c
@@ -32,6 +32,7 @@
#include "wine/debug.h"
#include "dvoice.h"
+#include "dvoice_private.h"
WINE_DEFAULT_DEBUG_CHANNEL(dpvoice);
@@ -149,8 +150,8 @@ static HRESULT WINAPI dpvclient_GetCompressionTypes(IDirectPlayVoiceClient *ifac
DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
{
IDirectPlayVoiceClientImpl *This = impl_from_IDirectPlayVoiceClient(iface);
- FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
- return E_NOTIMPL;
+ FIXME("%p %p %p %p %d semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
+ return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags);
}
static HRESULT WINAPI dpvclient_SetTransmitTargets(IDirectPlayVoiceClient *iface, PDVID pdvIDTargets,
diff --git a/dlls/dpvoice/dvoice_private.h b/dlls/dpvoice/dvoice_private.h
index 5b0e57d..ededeab 100644
--- a/dlls/dpvoice/dvoice_private.h
+++ b/dlls/dpvoice/dvoice_private.h
@@ -23,5 +23,6 @@
extern HRESULT DPVOICE_CreateDirectPlayVoiceClient(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPVOICE_CreateDirectPlayVoiceServer(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
extern HRESULT DPVOICE_CreateDirectPlayVoiceTest(IClassFactory *iface, IUnknown *pUnkOuter, REFIID riid, void **ppobj) DECLSPEC_HIDDEN;
+extern HRESULT DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags) DECLSPEC_HIDDEN;
#endif
diff --git a/dlls/dpvoice/server.c b/dlls/dpvoice/server.c
index e9291e2..80ef199 100644
--- a/dlls/dpvoice/server.c
+++ b/dlls/dpvoice/server.c
@@ -41,6 +41,45 @@ typedef struct IDirectPlayVoiceServerImpl
LONG ref;
} IDirectPlayVoiceServerImpl;
+HRESULT DPVOICE_GetCompressionTypes(DVCOMPRESSIONINFO *pData, DWORD *pdwDataSize, DWORD *pdwNumElements, DWORD dwFlags)
+{
+ static const DVCOMPRESSIONINFO pcm_type =
+ {80, {0x8de12fd4,0x7cb3,0x48ce,{0xa7,0xe8,0x9c,0x47,0xa2,0x2e,0x8a,0xc5}}, NULL, NULL, 0, 64000};
+ static const WCHAR pcm_name[] =
+ {'M','S','-','P','C','M',' ','6','4',' ','k','b','i','t','/','s',0};
+
+ HRESULT ret;
+ LPWSTR string_loc;
+
+ if (!pdwDataSize || !pdwNumElements)
+ return DVERR_INVALIDPOINTER;
+
+ if (dwFlags)
+ return DVERR_INVALIDFLAGS;
+
+ *pdwNumElements = 1;
+
+ if (*pdwDataSize < sizeof(pcm_type) + sizeof(pcm_name))
+ {
+ ret = DVERR_BUFFERTOOSMALL;
+ }
+ else if (!pData)
+ {
+ ret = DVERR_INVALIDPOINTER;
+ }
+ else
+ {
+ string_loc = (LPWSTR)((char*)pData + sizeof(pcm_type));
+ memcpy(pData, &pcm_type, sizeof(pcm_type));
+ memcpy(string_loc, pcm_name, sizeof(pcm_name));
+ pData->lpszName = string_loc;
+ ret = DV_OK;
+ }
+
+ *pdwDataSize = sizeof(pcm_type) + sizeof(pcm_name);
+ return ret;
+}
+
static inline IDirectPlayVoiceServerImpl *impl_from_IDirectPlayVoiceServer(IDirectPlayVoiceServer *iface)
{
return CONTAINING_RECORD(iface, IDirectPlayVoiceServerImpl, IDirectPlayVoiceServer_iface);
@@ -130,8 +169,8 @@ static HRESULT WINAPI dpvserver_GetCompressionTypes(IDirectPlayVoiceServer *ifac
DWORD *pdwNumElements, DWORD dwFlags)
{
IDirectPlayVoiceServerImpl *This = impl_from_IDirectPlayVoiceServer(iface);
- FIXME("%p %p %p %p %d\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
- return E_NOTIMPL;
+ FIXME("%p %p %p %p %d semi-stub\n", This, pData, pdwDataSize, pdwNumElements, dwFlags);
+ return DPVOICE_GetCompressionTypes(pData, pdwDataSize, pdwNumElements, dwFlags);
}
static HRESULT WINAPI dpvserver_SetTransmitTargets(IDirectPlayVoiceServer *iface, DVID dvSource, PDVID pdvIDTargets,
diff --git a/dlls/dpvoice/tests/voice.c b/dlls/dpvoice/tests/voice.c
index e42fb7b..ad84b3f 100644
--- a/dlls/dpvoice/tests/voice.c
+++ b/dlls/dpvoice/tests/voice.c
@@ -416,12 +416,6 @@ static void test_GetCompressionTypes(HRESULT (WINAPI *GetCompressionTypes)(void*
{ 0 /* initialized later */, 0, 0, DV_OK }
};
- if(GetCompressionTypes(iface, NULL, NULL, NULL, 0) == E_NOTIMPL)
- {
- skip("%s: GetCompressionTypes not implemented\n", name);
- return;
- }
-
data_size = 0;
ret = GetCompressionTypes(iface, NULL, &data_size, &num_elements, 0);
ok(ret == DVERR_BUFFERTOOSMALL,
--
2.2.1

View File

@ -0,0 +1 @@
Fixes: [29238] Implement semi-stub for IDirectPlayVoiceClient::GetCompressionTypes

View File

@ -79,6 +79,7 @@ patch_enable_all ()
enable_dbghelp_KdHelp="$1"
enable_ddraw_d3d_execute_buffer="$1"
enable_dinput_Events="$1"
enable_dpvoice_GetCompressionTypes="$1"
enable_dsound_Fast_Mixer="$1"
enable_dxgi_GetDesc="$1"
enable_fonts_Missing_Fonts="$1"
@ -262,6 +263,9 @@ patch_enable ()
dinput-Events)
enable_dinput_Events="$2"
;;
dpvoice-GetCompressionTypes)
enable_dpvoice_GetCompressionTypes="$2"
;;
dsound-Fast_Mixer)
enable_dsound_Fast_Mixer="$2"
;;
@ -1359,6 +1363,23 @@ if test "$enable_dinput_Events" -eq 1; then
) >> "$patchlist"
fi
# Patchset dpvoice-GetCompressionTypes
# |
# | This patchset fixes the following Wine bugs:
# | * [#29238] Implement semi-stub for IDirectPlayVoiceClient::GetCompressionTypes
# |
# | Modified files:
# | * dlls/dpvoice/client.c, dlls/dpvoice/dvoice_private.h, dlls/dpvoice/server.c, dlls/dpvoice/tests/voice.c
# |
if test "$enable_dpvoice_GetCompressionTypes" -eq 1; then
patch_apply dpvoice-GetCompressionTypes/0001-dpvoice-tests-Add-GetCompressionTypes-tests.patch
patch_apply dpvoice-GetCompressionTypes/0002-dpvoice-Turn-GetCompressionTypes-into-a-semi-stub.patch
(
echo '+ { "Alex Henrie", "dpvoice/tests: Add GetCompressionTypes tests.", 1 },';
echo '+ { "Alex Henrie", "dpvoice: Turn GetCompressionTypes into a semi-stub.", 1 },';
) >> "$patchlist"
fi
# Patchset dsound-Fast_Mixer
# |
# | This patchset fixes the following Wine bugs: