diff --git a/configure b/configure index e14a35b5266..2ffbfd8520c 100755 --- a/configure +++ b/configure @@ -22205,6 +22205,7 @@ wine_fn_config_makefile dlls/wlanui enable_wlanui wine_fn_config_makefile dlls/wldap32 enable_wldap32 wine_fn_config_makefile dlls/wldap32/tests enable_tests wine_fn_config_makefile dlls/wldp enable_wldp +wine_fn_config_makefile dlls/wldp/tests enable_tests wine_fn_config_makefile dlls/wmasf enable_wmasf wine_fn_config_makefile dlls/wmi enable_wmi wine_fn_config_makefile dlls/wmiutils enable_wmiutils diff --git a/configure.ac b/configure.ac index 154e0ee06aa..aba623ee6e7 100644 --- a/configure.ac +++ b/configure.ac @@ -3247,6 +3247,7 @@ WINE_CONFIG_MAKEFILE(dlls/wlanui) WINE_CONFIG_MAKEFILE(dlls/wldap32) WINE_CONFIG_MAKEFILE(dlls/wldap32/tests) WINE_CONFIG_MAKEFILE(dlls/wldp) +WINE_CONFIG_MAKEFILE(dlls/wldp/tests) WINE_CONFIG_MAKEFILE(dlls/wmasf) WINE_CONFIG_MAKEFILE(dlls/wmi) WINE_CONFIG_MAKEFILE(dlls/wmiutils) diff --git a/dlls/wldp/tests/Makefile.in b/dlls/wldp/tests/Makefile.in new file mode 100644 index 00000000000..3271c17dad2 --- /dev/null +++ b/dlls/wldp/tests/Makefile.in @@ -0,0 +1,4 @@ +TESTDLL = wldp.dll + +SOURCES = \ + wldp.c diff --git a/dlls/wldp/tests/wldp.c b/dlls/wldp/tests/wldp.c new file mode 100644 index 00000000000..4a41f1e9407 --- /dev/null +++ b/dlls/wldp/tests/wldp.c @@ -0,0 +1,82 @@ +/* + * Copyright 2023 Hans Leidekker 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 + +#include "windef.h" +#include "winbase.h" +#include "wldp.h" + +#include "wine/test.h" + +static HRESULT (WINAPI *pWldpGetLockdownPolicy)(WLDP_HOST_INFORMATION *, DWORD *, DWORD); +static HRESULT (WINAPI *pWldpQueryWindowsLockdownMode)(WLDP_WINDOWS_LOCKDOWN_MODE *); + +static void test_WldpGetLockdownPolicy(void) +{ + WLDP_HOST_INFORMATION info; + DWORD state; + HRESULT hr; + + if (!pWldpGetLockdownPolicy) + { + win_skip( "WldpGetLockdownPolicy not available\n" ); + return; + } + + state = 0xdeadbeef; + hr = pWldpGetLockdownPolicy( NULL, &state, 0 ); + ok( hr == 0x10000000, "got %#lx\n", hr ); + ok( state == WLDP_LOCKDOWN_DEFINED_FLAG, "got %#lx\n", state ); + + memset( &info, 0, sizeof(info) ); + info.dwRevision = 1; + info.dwHostId = WLDP_HOST_ID_GLOBAL; + state = 0xdeadbeef; + hr = pWldpGetLockdownPolicy( &info, &state, 0 ); + ok( hr == S_OK, "got %#lx\n", hr ); + ok( state == WLDP_LOCKDOWN_DEFINED_FLAG, "got %#lx\n", state ); +} + +static void test_WldpQueryWindowsLockdownMode(void) +{ + WLDP_WINDOWS_LOCKDOWN_MODE mode; + HRESULT hr; + + if (!pWldpQueryWindowsLockdownMode) + { + win_skip( "WldpQueryWindowsLockdownMode not available\n" ); + return; + } + + mode = 0xdeadbeef; + hr = pWldpQueryWindowsLockdownMode( &mode ); + ok( hr == S_OK, "got %#lx\n", hr ); + ok( mode == WLDP_WINDOWS_LOCKDOWN_MODE_UNLOCKED, "got %u\n", mode ); +} + +START_TEST(wldp) +{ + HMODULE hwldp = LoadLibraryW( L"wldp" ); + + pWldpGetLockdownPolicy = (void *)GetProcAddress( hwldp, "WldpGetLockdownPolicy" ); + pWldpQueryWindowsLockdownMode = (void *)GetProcAddress( hwldp, "WldpQueryWindowsLockdownMode" ); + + test_WldpGetLockdownPolicy(); + test_WldpQueryWindowsLockdownMode(); +} diff --git a/dlls/wldp/wldp.c b/dlls/wldp/wldp.c index 0c2fd0c4b70..25c85c68304 100644 --- a/dlls/wldp/wldp.c +++ b/dlls/wldp/wldp.c @@ -44,9 +44,10 @@ HRESULT WINAPI WldpIsDynamicCodePolicyEnabled(BOOL *is_enabled) */ HRESULT WINAPI WldpGetLockdownPolicy(WLDP_HOST_INFORMATION *info, DWORD *state, DWORD flags) { - FIXME("%p %p %lu\n", info, state, flags); + FIXME("%p %p %lx\n", info, state, flags); - *state = 0; + *state = WLDP_LOCKDOWN_DEFINED_FLAG; + if (!info) return HRESULT_FROM_NT(0); return S_OK; } diff --git a/include/wldp.h b/include/wldp.h index 93f246fffa4..262e917b5bc 100644 --- a/include/wldp.h +++ b/include/wldp.h @@ -19,6 +19,14 @@ #ifndef WLDP_H #define WLDP_H +#define WLDP_LOCKDOWN_UNDEFINED 0x00000000 +#define WLDP_LOCKDOWN_DEFINED_FLAG 0x80000000 +#define WLDP_LOCKDOWN_CONFIG_CI_FLAG 0x00000001 +#define WLDP_LOCKDOWN_CONFIG_CI_AUDIT_FLAG 0x00000002 +#define WLDP_LOCKDOWN_UMCIENFORCE_FLAG 0x00000004 +#define WLDP_LOCKDOWN_AUDIT_FLAG 0x00000008 +#define WLDP_LOCKDOWN_EXCLUSION_FLAG 0x00000010 + typedef enum WLDP_HOST_ID { WLDP_HOST_ID_UNKNOWN, @@ -50,5 +58,6 @@ typedef struct WLDP_HOST_INFORMATION HRESULT WINAPI WldpGetLockdownPolicy(WLDP_HOST_INFORMATION*,DWORD*,DWORD); HRESULT WINAPI WldpIsDynamicCodePolicyEnabled(BOOL*); +HRESULT WINAPI WldpQueryWindowsLockdownMode(WLDP_WINDOWS_LOCKDOWN_MODE*); #endif