Rebase against 1ec8bf9b739f1528b742169670eac2350b33a7d4.

This commit is contained in:
Zebediah Figura 2020-08-07 17:06:06 -05:00
parent 59e6a606b9
commit 32082f4d6f
6 changed files with 23 additions and 383 deletions

View File

@ -1,167 +1,36 @@
From 4a846857e57963ceac9eb7302da17060facb12e3 Mon Sep 17 00:00:00 2001
From b9eb0aeed5bc09d8a54c383c9d5149cacf36f1c3 Mon Sep 17 00:00:00 2001
From: Louis Lenders <xerox.xerox2000x@gmail.com>
Date: Wed, 5 Dec 2018 13:18:26 +0100
Subject: [PATCH] dwmapi: add initial tests
Subject: [PATCH] dwmapi: Add tests for DwmGetTransportAttributes().
Signed-off-by: Louis Lenders <xerox.xerox2000x@gmail.com>
---
configure | 1 +
configure.ac | 1 +
dlls/dwmapi/tests/Makefile.in | 5 ++
dlls/dwmapi/tests/dwmapi.c | 108 ++++++++++++++++++++++++++++++++++
4 files changed, 115 insertions(+)
create mode 100644 dlls/dwmapi/tests/Makefile.in
create mode 100644 dlls/dwmapi/tests/dwmapi.c
dlls/dwmapi/tests/dwmapi.c | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/configure b/configure
index 588364f8e..ba145e3f4 100755
--- a/configure
+++ b/configure
@@ -20310,6 +20310,7 @@ wine_fn_config_makefile dlls/dssenh/tests enable_tests
wine_fn_config_makefile dlls/dswave enable_dswave
wine_fn_config_makefile dlls/dswave/tests enable_tests
wine_fn_config_makefile dlls/dwmapi enable_dwmapi
+wine_fn_config_makefile dlls/dwmapi/tests enable_tests
wine_fn_config_makefile dlls/dwrite enable_dwrite
wine_fn_config_makefile dlls/dwrite/tests enable_tests
wine_fn_config_makefile dlls/dx8vb enable_dx8vb
diff --git a/configure.ac b/configure.ac
index 0ad841773..0eb2ebbe6 100644
--- a/configure.ac
+++ b/configure.ac
@@ -3267,6 +3267,7 @@ WINE_CONFIG_MAKEFILE(dlls/dssenh/tests)
WINE_CONFIG_MAKEFILE(dlls/dswave)
WINE_CONFIG_MAKEFILE(dlls/dswave/tests)
WINE_CONFIG_MAKEFILE(dlls/dwmapi)
+WINE_CONFIG_MAKEFILE(dlls/dwmapi/tests)
WINE_CONFIG_MAKEFILE(dlls/dwrite)
WINE_CONFIG_MAKEFILE(dlls/dwrite/tests)
WINE_CONFIG_MAKEFILE(dlls/dx8vb)
diff --git a/dlls/dwmapi/tests/Makefile.in b/dlls/dwmapi/tests/Makefile.in
new file mode 100644
index 000000000..f365f96c7
--- /dev/null
+++ b/dlls/dwmapi/tests/Makefile.in
@@ -0,0 +1,5 @@
+TESTDLL = dwmapi.dll
+IMPORTS = dwmapi
+
+C_SRCS = \
+ dwmapi.c
diff --git a/dlls/dwmapi/tests/dwmapi.c b/dlls/dwmapi/tests/dwmapi.c
new file mode 100644
index 000000000..7c51e77c4
--- /dev/null
index 1904e283bba..d79861f53ed 100644
--- a/dlls/dwmapi/tests/dwmapi.c
+++ b/dlls/dwmapi/tests/dwmapi.c
@@ -0,0 +1,108 @@
+/*
+ * Unit tests for dwmapi
+ *
+ * Copyright 2018 Louis Lenders
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2.1 of the License, or (at your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
+ *
+ */
+
+#include "dwmapi.h"
+
+#include "wine/test.h"
+
+static HRESULT (WINAPI *pDwmIsCompositionEnabled)(BOOL*);
+static HRESULT (WINAPI *pDwmEnableComposition)(UINT);
+static HRESULT (WINAPI *pDwmGetTransportAttributes)(BOOL*,BOOL*,DWORD*);
+
+BOOL dwmenabled;
+
+static void test_isdwmenabled(void)
+{
+ HRESULT res;
+ BOOL ret;
+
+ ret = -1;
+ res = pDwmIsCompositionEnabled(&ret);
+ ok((res == S_OK && ret == TRUE) || (res == S_OK && ret == FALSE), "got %x and %d\n", res, ret);
+
+ if (res == S_OK && ret == TRUE)
+ dwmenabled = TRUE;
+ else
+ dwmenabled = FALSE;
+ /*tested on win7 by enabling/disabling DWM service via services.msc*/
+ if (dwmenabled)
+ {
+ res = pDwmEnableComposition(DWM_EC_DISABLECOMPOSITION); /* try disable and reenable dwm*/
+ ok(res == S_OK, "got %x expected S_OK\n", res);
+
+ ret = -1;
+ res = pDwmIsCompositionEnabled(&ret);
+ ok((res == S_OK && ret == FALSE) /*wvista win7*/ || (res == S_OK && ret == TRUE) /*>win7*/, "got %x and %d\n", res, ret);
+
+ res = pDwmEnableComposition(DWM_EC_ENABLECOMPOSITION);
+ ok(res == S_OK, "got %x\n", res);
+
+ ret = -1;
+ res = pDwmIsCompositionEnabled(&ret);
+ todo_wine ok(res == S_OK && ret == TRUE, "got %x and %d\n", res, ret);
+ }
+ else
+ {
+ res = pDwmEnableComposition(DWM_EC_ENABLECOMPOSITION); /*cannot enable DWM composition this way*/
+ ok(res == S_OK /*win7 testbot*/ || res == DWM_E_COMPOSITIONDISABLED /*win7 laptop*/, "got %x\n", res);
+ if (winetest_debug > 1)
+ trace("returning %x\n", res);
+
+ ret = -1;
+ res = pDwmIsCompositionEnabled(&ret);
+ ok(res == S_OK && ret == FALSE, "got %x and %d\n", res, ret);
+ }
+}
+
@@ -33,7 +33,18 @@ static void test_DwmIsCompositionEnabled(void)
ok(enabled == TRUE || enabled == FALSE, "Got unexpected %#x.\n", enabled);
}
+static void test_dwm_get_transport_attributes(void)
+{
+ BOOL isremoting, isconnected;
+ DWORD generation;
+ HRESULT res;
+ HRESULT hr;
+
+ res = pDwmGetTransportAttributes(&isremoting, &isconnected, &generation);
+ if (dwmenabled)
+ ok(res == S_OK, "got %x\n", res);
+ else
+ {
+ ok(res == S_OK /*win7 testbot*/ || res == DWM_E_COMPOSITIONDISABLED /*win7 laptop*/, "got %x\n", res);
+ if (winetest_debug > 1)
+ trace("returning %x\n", res);
+ }
+ hr = DwmGetTransportAttributes(&isremoting, &isconnected, &generation);
+ ok(hr == S_OK || hr == DWM_E_COMPOSITIONDISABLED, "Got unexpected %#x.\n", hr);
+}
+
+START_TEST(dwmapi)
+{
+ HMODULE hmod = LoadLibraryA("dwmapi.dll");
+
+ if (!hmod)
+ {
+ trace("dwmapi not found, skipping tests\n");
+ return;
+ }
+
+ pDwmIsCompositionEnabled = (void *)GetProcAddress(hmod, "DwmIsCompositionEnabled");
+ pDwmEnableComposition = (void *)GetProcAddress(hmod, "DwmEnableComposition");
+ pDwmGetTransportAttributes = (void *)GetProcAddress(hmod, "DwmGetTransportAttributes");
+
+ test_isdwmenabled();
START_TEST(dwmapi)
{
test_DwmIsCompositionEnabled();
+ test_dwm_get_transport_attributes();
+}
}
--
2.21.0
2.27.0

View File

@ -52,7 +52,7 @@ usage()
# Get the upstream commit sha
upstream_commit()
{
echo "8cbbb4f394678411fdb57237553f5d974527877f"
echo "1ec8bf9b739f1528b742169670eac2350b33a7d4"
}
# Show version information
@ -2758,12 +2758,12 @@ fi
# Patchset dwmapi-DwmGetTransportAttributes
# |
# | Modified files:
# | * configure, configure.ac, dlls/dwmapi/tests/Makefile.in, dlls/dwmapi/tests/dwmapi.c
# | * dlls/dwmapi/tests/dwmapi.c
# |
if test "$enable_dwmapi_DwmGetTransportAttributes" -eq 1; then
patch_apply dwmapi-DwmGetTransportAttributes/0002-dwmapi-add-initial-tests.patch
(
printf '%s\n' '+ { "Louis Lenders", "dwmapi: Add initial tests.", 1 },';
printf '%s\n' '+ { "Louis Lenders", "dwmapi: Add tests for DwmGetTransportAttributes().", 1 },';
) >> "$patchlist"
fi
@ -4251,7 +4251,7 @@ fi
# | * [#42027] systeminfo: Add basic functionality.
# |
# | Modified files:
# | * programs/systeminfo/main.c
# | * programs/systeminfo/Makefile.in, programs/systeminfo/main.c
# |
if test "$enable_programs_systeminfo" -eq 1; then
patch_apply programs-systeminfo/0001-systeminfo-add-basic-functionality.patch

View File

@ -1,123 +0,0 @@
From 28886253b9ea693b42b4e89325c4643a1c8baca4 Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Wed, 8 Jan 2020 20:51:09 +1100
Subject: [PATCH] xaudio2_7: Dont cast interface pointers
---
dlls/xaudio2_7/xact_dll.c | 51 ++++++++++++++++++++++++++-------------
1 file changed, 34 insertions(+), 17 deletions(-)
diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c
index 2bf6eaf374..6ed67c3a67 100644
--- a/dlls/xaudio2_7/xact_dll.c
+++ b/dlls/xaudio2_7/xact_dll.c
@@ -763,7 +763,7 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Prepare(IXACT3WaveBank *iface,
wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl;
wave->fact_wave = fwave;
- *ppWave = (IXACT3Wave*)wave;
+ *ppWave = &wave->IXACT3Wave_iface;
TRACE("Created Wave: %p\n", wave);
@@ -804,7 +804,9 @@ static HRESULT WINAPI IXACT3WaveBankImpl_Play(IXACT3WaveBank *iface,
wave->IXACT3Wave_iface.lpVtbl = &XACT3Wave_Vtbl;
wave->fact_wave = fwave;
- *ppWave = (IXACT3Wave*)wave;
+ *ppWave = &wave->IXACT3Wave_iface;
+
+ TRACE("Created Wave: %p\n", wave);
}
return hr;
@@ -1025,7 +1027,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateSoundBank(IXACT3Engine *iface,
sb->IXACT3SoundBank_iface.lpVtbl = &XACT3SoundBank_Vtbl;
sb->fact_soundbank = fsb;
- *ppSoundBank = (IXACT3SoundBank*)sb;
+ *ppSoundBank = &sb->IXACT3SoundBank_iface;
TRACE("Created SoundBank: %p\n", sb);
@@ -1060,7 +1062,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateInMemoryWaveBank(IXACT3Engine *ifac
wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl;
wb->fact_wavebank = fwb;
- *ppWaveBank = (IXACT3WaveBank*)wb;
+ *ppWaveBank = &wb->IXACT3WaveBank_iface;
TRACE("Created in-memory WaveBank: %p\n", wb);
@@ -1104,7 +1106,7 @@ static HRESULT WINAPI IXACT3EngineImpl_CreateStreamingWaveBank(IXACT3Engine *ifa
wb->IXACT3WaveBank_iface.lpVtbl = &XACT3WaveBank_Vtbl;
wb->fact_wavebank = fwb;
- *ppWaveBank = (IXACT3WaveBank*)wb;
+ *ppWaveBank = &wb->IXACT3WaveBank_iface;
TRACE("Created streaming WaveBank: %p\n", wb);
@@ -1145,7 +1147,11 @@ static HRESULT WINAPI IXACT3EngineImpl_PrepareStreamingWave(IXACT3Engine *iface,
static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
const XACT_NOTIFICATION_DESCRIPTION *xd)
{
+ memset(fd, 0, sizeof(*fd));
/* We have to unwrap the FACT object first! */
+
+ FIXME("Type %d\n", xd->type);
+
fd->type = xd->type;
fd->flags = xd->flags;
fd->cueIndex = xd->cueIndex;
@@ -1153,24 +1159,35 @@ static inline void unwrap_notificationdesc(FACTNotificationDescription *fd,
fd->pvContext = xd->pvContext;
if (xd->pCue != NULL)
- fd->pCue = ((XACT3CueImpl*) xd->pCue)->fact_cue;
- else
- fd->pCue = NULL;
+ {
+ XACT3CueImpl *cur = impl_from_IXACT3Cue(xd->pCue);
+ if (cur)
+ fd->pCue = cur->fact_cue;
+ }
if (xd->pSoundBank != NULL)
- fd->pSoundBank = ((XACT3SoundBankImpl*) xd->pSoundBank)->fact_soundbank;
- else
- fd->pSoundBank = NULL;
+ {
+ XACT3SoundBankImpl *sound = impl_from_IXACT3SoundBank(xd->pSoundBank);
+ if (sound)
+ fd->pSoundBank = sound->fact_soundbank;
+ }
if (xd->pWaveBank != NULL)
- fd->pWaveBank = ((XACT3WaveBankImpl*) xd->pWaveBank)->fact_wavebank;
- else
- fd->pWaveBank = NULL;
+ {
+ XACT3WaveBankImpl *bank = impl_from_IXACT3WaveBank(xd->pWaveBank);
+ if (bank)
+ fd->pWaveBank = bank->fact_wavebank;
+ }
if (xd->pWave != NULL)
- fd->pWave = ((XACT3WaveImpl*) xd->pWave)->fact_wave;
- else
- fd->pWave = NULL;
+ {
+ XACT3WaveImpl *wave = impl_from_IXACT3Wave(xd->pWave);
+ FIXME("Wave %p\n", wave);
+ if (wave)
+ {
+ fd->pWave = wave->fact_wave;
+ }
+ }
}
static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface,
--
2.25.1

View File

@ -1,78 +0,0 @@
From 885782f9e28d085b0d1b14e80ae4f9d440537f2b Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 14 Jan 2020 08:30:00 +1100
Subject: [PATCH] xaudio2_7: Correct callback to windows function.
The unix library cannot directly call the windows callback
due to calling conventions.
---
dlls/xaudio2_7/xact_dll.c | 25 +++++++++++++++++++++++++
1 file changed, 25 insertions(+)
diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c
index 92434a7084..dfe74cebc2 100644
--- a/dlls/xaudio2_7/xact_dll.c
+++ b/dlls/xaudio2_7/xact_dll.c
@@ -108,6 +108,7 @@ typedef struct _XACT3EngineImpl {
XACT_READFILE_CALLBACK pReadFile;
XACT_GETOVERLAPPEDRESULT_CALLBACK pGetOverlappedResult;
+ XACT_NOTIFICATION_CALLBACK notification_callback;
} XACT3EngineImpl;
typedef struct wrap_readfile_struct {
@@ -930,6 +931,25 @@ static HRESULT WINAPI IXACT3EngineImpl_GetFinalMixFormat(IXACT3Engine *iface,
(FAudioWaveFormatExtensible*) pFinalMixFormat);
}
+static void FACTCALL fact_notification_cb(const FACTNotification *pNotification)
+{
+ XACT3EngineImpl *engine = (XACT3EngineImpl *)pNotification->pvContext;
+
+ /* Older versions of FAudio don't pass through the context */
+ if (!engine)
+ {
+ WARN("Notification context is NULL\n");
+ return;
+ }
+
+ if (pNotification->type == XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED)
+ {
+ FIXME("Callback XACTNOTIFICATIONTYPE_SOUNDBANKDESTROYED\n");
+ }
+ else
+ FIXME("Unsupported callback type %d\n", pNotification->type);
+}
+
static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface,
const XACT_RUNTIME_PARAMETERS *pParams)
{
@@ -973,6 +993,9 @@ static HRESULT WINAPI IXACT3EngineImpl_Initialize(IXACT3Engine *iface,
GetOverlappedResult;
params.fileIOCallbacks.readFileCallback = wrap_readfile;
params.fileIOCallbacks.getOverlappedResultCallback = wrap_getoverlappedresult;
+ params.fnNotificationCallback = fact_notification_cb;
+
+ This->notification_callback = (XACT_NOTIFICATION_CALLBACK)pParams->fnNotificationCallback;
ret = FACTAudioEngine_Initialize(This->fact_engine, &params);
if (ret != 0)
@@ -1253,6 +1276,7 @@ static HRESULT WINAPI IXACT3EngineImpl_RegisterNotification(IXACT3Engine *iface,
TRACE("(%p)->(%p)\n", This, pNotificationDesc);
unwrap_notificationdesc(&fdesc, pNotificationDesc);
+ fdesc.pvContext = This;
return FACTAudioEngine_RegisterNotification(This->fact_engine, &fdesc);
}
@@ -1265,6 +1289,7 @@ static HRESULT WINAPI IXACT3EngineImpl_UnRegisterNotification(IXACT3Engine *ifac
TRACE("(%p)->(%p)\n", This, pNotificationDesc);
unwrap_notificationdesc(&fdesc, pNotificationDesc);
+ fdesc.pvContext = This;
return FACTAudioEngine_UnRegisterNotification(This->fact_engine, &fdesc);
}
--
2.25.1

View File

@ -1,28 +0,0 @@
From 3819655b9f19a5c1c6a456a278bfd9cf050c759d Mon Sep 17 00:00:00 2001
From: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
Date: Tue, 14 Jan 2020 15:47:43 +1100
Subject: [PATCH] xaudio2_7: Trace FAudio version being used
Signed-off-by: Alistair Leslie-Hughes <leslie_alistair@hotmail.com>
---
dlls/xaudio2_7/xact_dll.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/dlls/xaudio2_7/xact_dll.c b/dlls/xaudio2_7/xact_dll.c
index dfe74cebc2..2406964deb 100644
--- a/dlls/xaudio2_7/xact_dll.c
+++ b/dlls/xaudio2_7/xact_dll.c
@@ -52,6 +52,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD reason, void *pReserved)
case DLL_PROCESS_ATTACH:
instance = hinstDLL;
DisableThreadLibraryCalls( hinstDLL );
+
+#ifdef HAVE_FAUDIOLINKEDVERSION
+ TRACE("Using FAudio version %d\n", FAudioLinkedVersion() );
+#endif
break;
}
return TRUE;
--
2.17.1

View File

@ -1 +1 @@
8cbbb4f394678411fdb57237553f5d974527877f
1ec8bf9b739f1528b742169670eac2350b33a7d4