kernel32/tests: Add tests for window settings namespaces.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2018-03-27 13:36:20 +02:00
parent e46259fb82
commit 7d16575df6
1 changed files with 105 additions and 4 deletions

View File

@ -464,10 +464,46 @@ static const char settings_manifest[] =
" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\">"
" <windowsSettings>"
" <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>"
" <dpiAwareness xmlns=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\">true</dpiAwareness>"
" </windowsSettings>"
" </application>"
"</assembly>";
static const char settings_manifest2[] =
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
" <application xmlns=\"urn:schemas-microsoft-com:asm.v3\""
" xmlns:ws05=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\""
" xmlns:ws11=\"http://schemas.microsoft.com/SMI/2011/WindowsSettings\""
" xmlns:ws16=\"http://schemas.microsoft.com/SMI/2016/WindowsSettings\""
" xmlns:ws17=\"http://schemas.microsoft.com/SMI/2017/WindowsSettings\">"
" <windowsSettings>"
" <ws05:autoElevate>true</ws05:autoElevate>"
" <ws05:disableTheming>true</ws05:disableTheming>"
" <ws11:disableWindowFiltering>true</ws11:disableWindowFiltering>"
" <ws05:dpiAware>true</ws05:dpiAware>"
" <ws16:dpiAwareness>true</ws16:dpiAwareness>"
" <ws17:gdiScaling>true</ws17:gdiScaling>"
" <ws17:highResolutionScrollingAware>true</ws17:highResolutionScrollingAware>"
" <ws16:longPathAware>true</ws16:longPathAware>"
" <ws17:magicFutureSetting>true</ws17:magicFutureSetting>"
" <ws11:printerDriverIsolation>true</ws11:printerDriverIsolation>"
" <ws17:ultraHighResolutionScrollingAware>true</ws17:ultraHighResolutionScrollingAware>"
" </windowsSettings>"
" </application>"
"</assembly>";
/* broken manifest found in some binaries: asmv3 namespace is used but not declared */
static const char settings_manifest3[] =
"<assembly xmlns=\"urn:schemas-microsoft-com:asm.v1\" manifestVersion=\"1.0\">"
" <assemblyIdentity version=\"1.0.0.0\" name=\"Wine.Test\" type=\"win32\"></assemblyIdentity>"
" <asmv3:application>"
" <asmv3:windowsSettings xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">"
" <dpiAware>true</dpiAware>"
" </asmv3:windowsSettings>"
" </asmv3:application>"
"</assembly>";
DEFINE_GUID(VISTA_COMPAT_GUID, 0xe2011457, 0x1546, 0x43c5, 0xa5, 0xfe, 0x00, 0x8d, 0xee, 0xe3, 0xd3, 0xf0);
DEFINE_GUID(WIN7_COMPAT_GUID, 0x35138b9a, 0x5d96, 0x4fbd, 0x8e, 0x2d, 0xa2, 0x44, 0x02, 0x25, 0xf9, 0x3a);
DEFINE_GUID(WIN8_COMPAT_GUID, 0x4a2f28e3, 0x53b9, 0x4441, 0xba, 0x9c, 0xd6, 0x9d, 0x4a, 0x4a, 0x6e, 0x38);
@ -2964,9 +3000,11 @@ static void test_compatibility(void)
static void test_settings(void)
{
static const WCHAR dpiAwareW[] = {'d','p','i','A','w','a','r','e',0};
static const WCHAR dpiAwarenessW[] = {'d','p','i','A','w','a','r','e','n','e','s','s',0};
static const WCHAR dummyW[] = {'d','u','m','m','y',0};
static const WCHAR trueW[] = {'t','r','u','e',0};
static const WCHAR namespaceW[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0};
static const WCHAR namespace2005W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','0','5','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0};
static const WCHAR namespace2016W[] = {'h','t','t','p',':','/','/','s','c','h','e','m','a','s','.','m','i','c','r','o','s','o','f','t','.','c','o','m','/','S','M','I','/','2','0','1','6','/','W','i','n','d','o','w','s','S','e','t','t','i','n','g','s',0};
WCHAR buffer[80];
SIZE_T size;
HANDLE handle;
@ -3001,26 +3039,60 @@ static void test_settings(void)
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, NULL, dummyW, buffer, 80, &size );
ok( !ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
ok( !ret, "QueryActCtxSettingsW succeeded\n" );
ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, namespaceW, dpiAwareW, buffer, 80, &size );
ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwareW, buffer, 80, &size );
ok( ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, namespaceW, dpiAwareW, buffer, lstrlenW(trueW) + 1, &size );
ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwareW, buffer, lstrlenW(trueW) + 1, &size );
ok( ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, namespace2016W, dpiAwareW, buffer, lstrlenW(trueW) + 1, &size );
ok( !ret, "QueryActCtxSettingsW succeeded\n" );
ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND || broken( GetLastError() == ERROR_INVALID_PARAMETER ),
"wrong error %u\n", GetLastError() );
ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
ok( !ret, "QueryActCtxSettingsW succeeded\n" );
ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, namespace2005W, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
ok( !ret, "QueryActCtxSettingsW succeeded\n" );
ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %u\n", GetLastError() );
ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, namespace2016W, dpiAwarenessW, buffer, lstrlenW(trueW) + 1, &size );
ok( ret || broken( GetLastError() == ERROR_INVALID_PARAMETER ),
"QueryActCtxSettingsW failed err %u\n", GetLastError() );
if (ret)
{
ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
}
else ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, lstrlenW(trueW), &size );
ok( ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
@ -3034,6 +3106,35 @@ static void test_settings(void)
ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
pReleaseActCtx(handle);
create_manifest_file( "manifest_settings2.manifest", settings_manifest2, -1, NULL, NULL );
handle = test_create("manifest_settings2.manifest");
ok( handle != INVALID_HANDLE_VALUE || broken( handle == INVALID_HANDLE_VALUE ), /* <= vista */
"handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
DeleteFileA( "manifest_settings2.manifest" );
if (handle != INVALID_HANDLE_VALUE)
{
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
ok( ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
ok( !lstrcmpW( buffer, trueW ), "got %s\n", wine_dbgstr_w(buffer) );
ok( size == lstrlenW( buffer ) + 1, "wrong len %lu\n", size );
pReleaseActCtx(handle);
}
create_manifest_file( "manifest_settings3.manifest", settings_manifest3, -1, NULL, NULL );
handle = test_create("manifest_settings3.manifest");
ok( handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
DeleteFileA( "manifest_settings3.manifest" );
SetLastError( 0xdeadbeef );
size = 0xdead;
memset( buffer, 0xcc, sizeof(buffer) );
ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, 80, &size );
ok( !ret, "QueryActCtxSettingsW succeeded\n" );
ok( GetLastError() == ERROR_SXS_KEY_NOT_FOUND, "wrong error %u\n", GetLastError() );
pReleaseActCtx(handle);
}
START_TEST(actctx)