[PATCH v2] Implement DwmIsCompositionEnabled
Zhiyi Zhang
zzhang at codeweavers.com
Thu Oct 3 08:56:25 CDT 2019
Hi Joel,
Just so you know, DwmIsCompositionEnabled always return TRUE on Windows 8.
So it shouldn't be that much of a problem only setting *enabled to TRUE.
If you are seriously thinking about a more complete implementation.
You should also consider implementing DwmEnableComposition and related
functions and some tests.
Thanks,
Zhiyi
On 10/3/19 8:14 PM, Joel Leclerc wrote:
> Signed-off-by: Joel Leclerc <meerkatanonymous at gmail.com>
> ---
> v2: Ensure the registry key is closed, small refactor
> ---
> dlls/dwmapi/Makefile.in | 1 +
> dlls/dwmapi/dwmapi_main.c | 27 ++++++++++++++++++++-------
> 2 files changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/dlls/dwmapi/Makefile.in b/dlls/dwmapi/Makefile.in
> index 3a3691326f..ebdd3aae05 100644
> --- a/dlls/dwmapi/Makefile.in
> +++ b/dlls/dwmapi/Makefile.in
> @@ -1,5 +1,6 @@
> MODULE = dwmapi.dll
> IMPORTLIB = dwmapi
> +IMPORTS = advapi32
>
> EXTRADLLFLAGS = -mno-cygwin
>
> diff --git a/dlls/dwmapi/dwmapi_main.c b/dlls/dwmapi/dwmapi_main.c
> index 6378a091f0..3a8a5ab856 100644
> --- a/dlls/dwmapi/dwmapi_main.c
> +++ b/dlls/dwmapi/dwmapi_main.c
> @@ -26,6 +26,7 @@
> #include "winbase.h"
> #include "wingdi.h"
> #include "winuser.h"
> +#include "winreg.h"
> #include "dwmapi.h"
> #include "wine/debug.h"
>
> @@ -51,16 +52,28 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
> */
> HRESULT WINAPI DwmIsCompositionEnabled(BOOL *enabled)
> {
> - static int once;
> - if (!once)
> + static const WCHAR dwn_reg_keyW[] = {'S','o','f','t','w','a','r','e','\\',
> + 'M','i','c','r','o','s','o','f','t','\\',
> + 'W','i','n','d','o','w','s','\\',
> + 'D','W','M','\0'};
> + static const WCHAR compositionW[] = {'C','o','m','p','o','s','i','t','i','o','n','\0'};
> +
> + HKEY hkey;
> + DWORD type, value, count = sizeof(value);
> +
> + *enabled = FALSE;
> +
> + if (RegOpenKeyW(HKEY_CURRENT_USER, dwn_reg_keyW, &hkey) == ERROR_SUCCESS)
> {
> - FIXME("%p\n", enabled);
> - once = 1;
> + if (RegQueryValueExW(hkey, compositionW, NULL, &type, &value, &count) == ERROR_SUCCESS &&
> + type == REG_DWORD)
> + {
> + if (value == 1) *enabled = TRUE;
> + }
> + RegCloseKey(hkey);
> }
> - else
> - TRACE("%p\n", enabled);
>
> - *enabled = FALSE;
> + TRACE("*%p = %i\n", enabled, *enabled);
> return S_OK;
> }
>
More information about the wine-devel
mailing list