dwmapi: Check NULL parameter in DwmIsCompositionEnabled().

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=49664
Signed-off-by: Zhiyi Zhang <zzhang@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Zhiyi Zhang 2020-08-08 00:02:25 +08:00 committed by Alexandre Julliard
parent ee9c13511d
commit 1ec8bf9b73
5 changed files with 49 additions and 0 deletions

1
configure vendored
View File

@ -20756,6 +20756,7 @@ wine_fn_config_makefile dlls/dsuiext enable_dsuiext
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

View File

@ -3278,6 +3278,7 @@ WINE_CONFIG_MAKEFILE(dlls/dsuiext)
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)

View File

@ -60,6 +60,9 @@ HRESULT WINAPI DwmIsCompositionEnabled(BOOL *enabled)
else
TRACE("%p\n", enabled);
if (!enabled)
return E_INVALIDARG;
*enabled = FALSE;
return S_OK;
}

View File

@ -0,0 +1,5 @@
TESTDLL = dwmapi.dll
IMPORTS = dwmapi
C_SRCS = \
dwmapi.c

View File

@ -0,0 +1,39 @@
/*
* Copyright 2020 Zhiyi Zhang for CodeWeavers
*
* 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 void test_DwmIsCompositionEnabled(void)
{
BOOL enabled;
HRESULT hr;
hr = DwmIsCompositionEnabled(NULL);
ok(hr == E_INVALIDARG, "Expected %#x, got %#x.\n", E_INVALIDARG, hr);
enabled = -1;
hr = DwmIsCompositionEnabled(&enabled);
ok(hr == S_OK, "Expected %#x, got %#x.\n", S_OK, hr);
ok(enabled == TRUE || enabled == FALSE, "Got unexpected %#x.\n", enabled);
}
START_TEST(dwmapi)
{
test_DwmIsCompositionEnabled();
}