Added patch to implement enumeration of sound devices and basic properties to dxdiagn.

This commit is contained in:
Sebastian Lackner 2015-08-15 05:02:51 +02:00
parent e265cf1024
commit e7fceb902c
5 changed files with 342 additions and 2 deletions

View File

@ -39,10 +39,11 @@ Wine. All those differences are also documented on the
Included bug fixes and improvements
-----------------------------------
**Bug fixes and features included in the next upcoming release [4]:**
**Bug fixes and features included in the next upcoming release [5]:**
* Catch invalid memory accesses in imagehlp.CheckSumMappedFile
* Fix implementation of ntdll.MapViewOfSection
* Implement enumeration of sound devices and basic properties to dxdiagn ([Wine Bug #32613](https://bugs.winehq.org/show_bug.cgi?id=32613))
* Implement vcomp locking functions ([Wine Bug #26688](https://bugs.winehq.org/show_bug.cgi?id=26688))
* Properly implement imagehlp.ImageLoad and ImageUnload

2
debian/changelog vendored
View File

@ -2,6 +2,8 @@ wine-staging (1.7.50) UNRELEASED; urgency=low
* Add patch to implement remaining OpenMP locking functions.
* Added various patches for imagehlp cleanup (fixes Wine Staging Bug #502).
* Added patch to fix implementation of ntdll.MapViewOfSection.
* Added patch to implement enumeration of sound devices and basic properties
to dxdiagn.
* Removed patch to move security cookie initialization from memory management
to loader.
-- Sebastian Lackner <sebastian@fds-team.de> Tue, 11 Aug 2015 06:12:14 +0200

View File

@ -0,0 +1,317 @@
From b9c35ad92af95d7ee45a698d7282fd896247c128 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Michael=20M=C3=BCller?= <michael@fds-team.de>
Date: Sat, 15 Aug 2015 02:59:17 +0200
Subject: dxdiagn: Enumerate DirectSound devices and add some basic properties.
---
dlls/dxdiagn/Makefile.in | 2 +-
dlls/dxdiagn/provider.c | 91 ++++++++++++++++++++++++++
dlls/dxdiagn/tests/container.c | 141 +++++++++++++++++++++++++++++++++++++++++
3 files changed, 233 insertions(+), 1 deletion(-)
diff --git a/dlls/dxdiagn/Makefile.in b/dlls/dxdiagn/Makefile.in
index df3fc77..9d67410 100644
--- a/dlls/dxdiagn/Makefile.in
+++ b/dlls/dxdiagn/Makefile.in
@@ -1,5 +1,5 @@
MODULE = dxdiagn.dll
-IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 psapi user32 advapi32
+IMPORTS = strmiids dxguid uuid d3d9 ddraw version ole32 oleaut32 psapi user32 advapi32 dsound
C_SRCS = \
container.c \
diff --git a/dlls/dxdiagn/provider.c b/dlls/dxdiagn/provider.c
index 3b5fcab..a5f06e3 100644
--- a/dlls/dxdiagn/provider.c
+++ b/dlls/dxdiagn/provider.c
@@ -38,6 +38,7 @@
#include "fil_data.h"
#include "psapi.h"
#include "wbemcli.h"
+#include "dsound.h"
#include "wine/debug.h"
@@ -1189,11 +1190,85 @@ static HRESULT build_displaydevices_tree(IDxDiagContainerImpl_Container *node)
return fill_display_information_fallback(node);
}
+struct enum_context
+{
+ IDxDiagContainerImpl_Container *cont;
+ HRESULT hr;
+ int index;
+};
+
+static const WCHAR szGUIDFmt[] =
+{
+ '%','0','8','x','-','%','0','4','x','-','%','0','4','x','-','%','0',
+ '2','x','%','0','2','x','-','%','0','2','x','%','0','2','x','%','0','2',
+ 'x','%','0','2','x','%','0','2','x','%','0','2','x',0
+};
+
+static LPWSTR guid_to_string(LPWSTR lpwstr, REFGUID lpcguid)
+{
+ wsprintfW(lpwstr, szGUIDFmt, lpcguid->Data1, lpcguid->Data2,
+ lpcguid->Data3, lpcguid->Data4[0], lpcguid->Data4[1],
+ lpcguid->Data4[2], lpcguid->Data4[3], lpcguid->Data4[4],
+ lpcguid->Data4[5], lpcguid->Data4[6], lpcguid->Data4[7]);
+
+ return lpwstr;
+}
+
+BOOL CALLBACK dsound_enum(LPGUID guid, LPCWSTR desc, LPCWSTR module, LPVOID context)
+{
+ static const WCHAR deviceid_fmtW[] = {'%','u',0};
+ static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+ static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+
+ struct enum_context *enum_ctx = context;
+ IDxDiagContainerImpl_Container *device;
+ WCHAR buffer[256];
+ const WCHAR *p, *name;
+
+ /* the default device is enumerated twice, one time without GUID */
+ if (!guid) return TRUE;
+
+ snprintfW(buffer, sizeof(buffer)/sizeof(WCHAR), deviceid_fmtW, enum_ctx->index);
+ device = allocate_information_node(buffer);
+ if (!device)
+ {
+ enum_ctx->hr = E_OUTOFMEMORY;
+ return FALSE;
+ }
+
+ add_subcontainer(enum_ctx->cont, device);
+
+ guid_to_string(buffer, guid);
+ enum_ctx->hr = add_bstr_property(device, szGuidDeviceID, buffer);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->hr = add_bstr_property(device, szDescription, desc);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->hr = add_bstr_property(device, szDriverPath, module);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ name = module;
+ if ((p = strrchrW(name, '\\'))) name = p + 1;
+ if ((p = strrchrW(name, '/'))) name = p + 1;
+
+ enum_ctx->hr = add_bstr_property(device, szDriverName, name);
+ if (FAILED(enum_ctx->hr))
+ return FALSE;
+
+ enum_ctx->index++;
+ return TRUE;
+}
+
static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
{
static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
static const WCHAR DxDiag_SoundCaptureDevices[] = {'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e','D','e','v','i','c','e','s',0};
+ struct enum_context enum_ctx;
IDxDiagContainerImpl_Container *cont;
cont = allocate_information_node(DxDiag_SoundDevices);
@@ -1202,12 +1277,28 @@ static HRESULT build_directsound_tree(IDxDiagContainerImpl_Container *node)
add_subcontainer(node, cont);
+ enum_ctx.cont = cont;
+ enum_ctx.hr = S_OK;
+ enum_ctx.index = 0;
+
+ DirectSoundEnumerateW(dsound_enum, &enum_ctx);
+ if (FAILED(enum_ctx.hr))
+ return enum_ctx.hr;
+
cont = allocate_information_node(DxDiag_SoundCaptureDevices);
if (!cont)
return E_OUTOFMEMORY;
add_subcontainer(node, cont);
+ enum_ctx.cont = cont;
+ enum_ctx.hr = S_OK;
+ enum_ctx.index = 0;
+
+ DirectSoundCaptureEnumerateW(dsound_enum, &enum_ctx);
+ if (FAILED(enum_ctx.hr))
+ return enum_ctx.hr;
+
return S_OK;
}
diff --git a/dlls/dxdiagn/tests/container.c b/dlls/dxdiagn/tests/container.c
index 5bc5161..2ffe0fb 100644
--- a/dlls/dxdiagn/tests/container.c
+++ b/dlls/dxdiagn/tests/container.c
@@ -36,6 +36,11 @@ static IDxDiagContainer *pddc;
static const WCHAR DxDiag_SystemInfo[] = {'D','x','D','i','a','g','_','S','y','s','t','e','m','I','n','f','o',0};
static const WCHAR DxDiag_DisplayDevices[] = {'D','x','D','i','a','g','_','D','i','s','p','l','a','y','D','e','v','i','c','e','s',0};
+static const WCHAR DxDiag_SoundDevices[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
+ 'D','x','D','i','a','g','_','S','o','u','n','d','D','e','v','i','c','e','s',0};
+static const WCHAR DxDiag_SoundCaptureDevices[] = {'D','x','D','i','a','g','_','D','i','r','e','c','t','S','o','u','n','d','.',
+ 'D','x','D','i','a','g','_','S','o','u','n','d','C','a','p','t','u','r','e',
+ 'D','e','v','i','c','e','s',0};
/* Based on debugstr_variant in dlls/jscript/jsutils.c. */
static const char *debugstr_variant(const VARIANT *var)
@@ -1020,6 +1025,140 @@ cleanup:
IDxDiagProvider_Release(pddp);
}
+static void test_DxDiag_SoundDevices(void)
+{
+ static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
+ static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+ static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+ static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+
+ static const struct property_test property_tests[] =
+ {
+ {szDescription, VT_BSTR},
+ {szGuidDeviceID, VT_BSTR},
+ {szDriverName, VT_BSTR},
+ {szDriverPath, VT_BSTR},
+ };
+
+ IDxDiagContainer *sound_cont = NULL;
+ DWORD count, i;
+ HRESULT hr;
+
+ if (!create_root_IDxDiagContainer())
+ {
+ skip("Unable to create the root IDxDiagContainer\n");
+ return;
+ }
+
+ hr = IDxDiagContainer_GetChildContainer(pddc, DxDiag_SoundDevices, &sound_cont);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+ if (hr == S_OK)
+ ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+ hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ for (i = 0; i < count; i++)
+ {
+ WCHAR child_container[256];
+ IDxDiagContainer *child;
+
+ hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+ ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+ hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr == S_OK)
+ {
+ trace("Testing container %s\n", wine_dbgstr_w(child_container));
+ test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+ }
+ IDxDiagContainer_Release(child);
+ }
+
+cleanup:
+ if (sound_cont) IDxDiagContainer_Release(sound_cont);
+ IDxDiagContainer_Release(pddc);
+ IDxDiagProvider_Release(pddp);
+}
+
+static void test_DxDiag_SoundCaptureDevices(void)
+{
+ static const WCHAR szDescription[] = {'s','z','D','e','s','c','r','i','p','t','i','o','n',0};
+ static const WCHAR szGuidDeviceID[] = {'s','z','G','u','i','d','D','e','v','i','c','e','I','D',0};
+ static const WCHAR szDriverPath[] = {'s','z','D','r','i','v','e','r','P','a','t','h',0};
+ static const WCHAR szDriverName[] = {'s','z','D','r','i','v','e','r','N','a','m','e',0};
+
+ static const struct property_test property_tests[] =
+ {
+ {szDescription, VT_BSTR},
+ {szGuidDeviceID, VT_BSTR},
+ {szDriverName, VT_BSTR},
+ {szDriverPath, VT_BSTR},
+ };
+
+ IDxDiagContainer *sound_cont = NULL;
+ DWORD count, i;
+ HRESULT hr;
+
+ if (!create_root_IDxDiagContainer())
+ {
+ skip("Unable to create the root IDxDiagContainer\n");
+ return;
+ }
+
+ hr = IDxDiagContainer_GetChildContainer(pddc, DxDiag_SoundCaptureDevices, &sound_cont);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ hr = IDxDiagContainer_GetNumberOfProps(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfProps to return S_OK, got 0x%08x\n", hr);
+ if (hr == S_OK)
+ ok(count == 0, "Expected count to be 0, got %u\n", count);
+
+ hr = IDxDiagContainer_GetNumberOfChildContainers(sound_cont, &count);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetNumberOfChildContainers to return S_OK, got 0x%08x\n", hr);
+
+ if (hr != S_OK)
+ goto cleanup;
+
+ for (i = 0; i < count; i++)
+ {
+ WCHAR child_container[256];
+ IDxDiagContainer *child;
+
+ hr = IDxDiagContainer_EnumChildContainerNames(sound_cont, i, child_container, sizeof(child_container)/sizeof(WCHAR));
+ ok(hr == S_OK, "Expected IDxDiagContainer::EnumChildContainerNames to return S_OK, got 0x%08x\n", hr);
+
+ hr = IDxDiagContainer_GetChildContainer(sound_cont, child_container, &child);
+ ok(hr == S_OK, "Expected IDxDiagContainer::GetChildContainer to return S_OK, got 0x%08x\n", hr);
+
+ if (hr == S_OK)
+ {
+ trace("Testing container %s\n", wine_dbgstr_w(child_container));
+ test_container_properties(child, property_tests, sizeof(property_tests)/sizeof(property_tests[0]));
+ }
+ IDxDiagContainer_Release(child);
+ }
+
+cleanup:
+ if (sound_cont) IDxDiagContainer_Release(sound_cont);
+ IDxDiagContainer_Release(pddc);
+ IDxDiagProvider_Release(pddp);
+}
+
START_TEST(container)
{
CoInitialize(NULL);
@@ -1034,5 +1173,7 @@ START_TEST(container)
test_root_children();
test_DxDiag_SystemInfo();
test_DxDiag_DisplayDevices();
+ test_DxDiag_SoundDevices();
+ test_DxDiag_SoundCaptureDevices();
CoUninitialize();
}
--
2.5.0

View File

@ -0,0 +1 @@
Fixes: [32613] Implement enumeration of sound devices and basic properties to dxdiagn

View File

@ -55,7 +55,7 @@ version()
echo "Copyright (C) 2014-2015 the Wine Staging project authors."
echo ""
echo "Patchset to be applied on upstream Wine:"
echo " commit e083986df52bd706d0c7e8ae8820a5d886942585"
echo " commit 36a39cea9096a1eef46c59392858c26ecae40c39"
echo ""
}
@ -117,6 +117,7 @@ patch_enable_all ()
enable_dinput_Events="$1"
enable_dsound_EAX="$1"
enable_dsound_Fast_Mixer="$1"
enable_dxdiagn_Enumerate_DirectSound="$1"
enable_dxgi_GetDesc="$1"
enable_dxgi_MakeWindowAssociation="$1"
enable_dxva2_Video_Decoder="$1"
@ -435,6 +436,9 @@ patch_enable ()
dsound-Fast_Mixer)
enable_dsound_Fast_Mixer="$2"
;;
dxdiagn-Enumerate_DirectSound)
enable_dxdiagn_Enumerate_DirectSound="$2"
;;
dxgi-GetDesc)
enable_dxgi_GetDesc="$2"
;;
@ -2757,6 +2761,21 @@ if test "$enable_dsound_EAX" -eq 1; then
) >> "$patchlist"
fi
# Patchset dxdiagn-Enumerate_DirectSound
# |
# | This patchset fixes the following Wine bugs:
# | * [#32613] Implement enumeration of sound devices and basic properties to dxdiagn
# |
# | Modified files:
# | * dlls/dxdiagn/Makefile.in, dlls/dxdiagn/provider.c, dlls/dxdiagn/tests/container.c
# |
if test "$enable_dxdiagn_Enumerate_DirectSound" -eq 1; then
patch_apply dxdiagn-Enumerate_DirectSound/0001-dxdiagn-Enumerate-DirectSound-devices-and-add-some-b.patch
(
echo '+ { "Michael Müller", "dxdiagn: Enumerate DirectSound devices and add some basic properties.", 1 },';
) >> "$patchlist"
fi
# Patchset dxgi-GetDesc
# |
# | This patchset fixes the following Wine bugs: