Alexandre Julliard : kernel32/tests: Add tests for QueryActCtxSettingsW.
Alexandre Julliard
julliard at winehq.org
Fri Mar 23 19:17:04 CDT 2018
Module: wine
Branch: master
Commit: 678c5544c15352411dfdb5c717834724f21d8c5f
URL: https://source.winehq.org/git/wine.git/?a=commit;h=678c5544c15352411dfdb5c717834724f21d8c5f
Author: Alexandre Julliard <julliard at winehq.org>
Date: Fri Mar 23 09:14:21 2018 +0100
kernel32/tests: Add tests for QueryActCtxSettingsW.
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/kernel32/tests/actctx.c | 88 ++++++++++++++++++++++++++++++++++++++++++++
1 file changed, 88 insertions(+)
diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c
index 9aa081f..b63abac 100644
--- a/dlls/kernel32/tests/actctx.c
+++ b/dlls/kernel32/tests/actctx.c
@@ -38,6 +38,7 @@ static BOOL (WINAPI *pFindActCtxSectionStringW)(DWORD,const GUID *,ULONG,LPCWS
static BOOL (WINAPI *pGetCurrentActCtx)(HANDLE *);
static BOOL (WINAPI *pIsDebuggerPresent)(void);
static BOOL (WINAPI *pQueryActCtxW)(DWORD,HANDLE,PVOID,ULONG,PVOID,SIZE_T,SIZE_T*);
+static BOOL (WINAPI *pQueryActCtxSettingsW)(DWORD,HANDLE,LPCWSTR,LPCWSTR,LPWSTR,SIZE_T,SIZE_T*);
static VOID (WINAPI *pReleaseActCtx)(HANDLE);
static BOOL (WINAPI *pFindActCtxSectionGuid)(DWORD,const GUID*,ULONG,const GUID*,PACTCTX_SECTION_KEYED_DATA);
static BOOL (WINAPI *pZombifyActCtx)(HANDLE);
@@ -457,6 +458,16 @@ static const char compat_manifest_other_guid[] =
" </compatibility>"
"</assembly>";
+static const char settings_manifest[] =
+"<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\">"
+" <windowsSettings>"
+" <dpiAware xmlns=\"http://schemas.microsoft.com/SMI/2005/WindowsSettings\">true</dpiAware>"
+" </windowsSettings>"
+" </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);
@@ -2695,6 +2706,7 @@ static BOOL init_funcs(void)
X(ReleaseActCtx);
X(FindActCtxSectionGuid);
X(ZombifyActCtx);
+ pQueryActCtxSettingsW = (void *)GetProcAddress( hLibrary, "QueryActCtxSettingsW" );
hLibrary = GetModuleHandleA("ntdll.dll");
X(RtlFindActivationContextSectionString);
@@ -2949,6 +2961,81 @@ 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 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};
+ WCHAR buffer[80];
+ SIZE_T size;
+ HANDLE handle;
+ BOOL ret;
+
+ if (!pQueryActCtxSettingsW)
+ {
+ win_skip( "QueryActCtxSettingsW is missing\n" );
+ return;
+ }
+ create_manifest_file( "manifest_settings.manifest", settings_manifest, -1, NULL, NULL );
+ handle = test_create("manifest_settings.manifest");
+ ok( handle != INVALID_HANDLE_VALUE, "handle == INVALID_HANDLE_VALUE, error %u\n", GetLastError() );
+ DeleteFileA( "manifest_settings.manifest" );
+
+ SetLastError( 0xdeadbeef );
+ ret = pQueryActCtxSettingsW( 1, handle, NULL, dpiAwareW, buffer, 80, &size );
+ ok( !ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ SetLastError( 0xdeadbeef );
+ ret = pQueryActCtxSettingsW( 0, handle, dummyW, dpiAwareW, buffer, 80, &size );
+ ok( !ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INVALID_PARAMETER, "wrong error %u\n", GetLastError() );
+ 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 );
+ SetLastError( 0xdeadbeef );
+ 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( 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 );
+ 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 );
+ 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, 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) );
+ ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
+ SetLastError( 0xdeadbeef );
+ size = 0xdead;
+ memset( buffer, 0xcc, sizeof(buffer) );
+ ret = pQueryActCtxSettingsW( 0, handle, NULL, dpiAwareW, buffer, lstrlenW(trueW) - 1, &size );
+ ok( !ret, "QueryActCtxSettingsW failed err %u\n", GetLastError() );
+ ok( GetLastError() == ERROR_INSUFFICIENT_BUFFER, "wrong error %u\n", GetLastError() );
+ ok( buffer[0] == 0xcccc, "got %s\n", wine_dbgstr_w(buffer) );
+ ok( size == sizeof(trueW)/sizeof(WCHAR), "wrong len %lu\n", size );
+ pReleaseActCtx(handle);
+}
+
START_TEST(actctx)
{
int argc;
@@ -2975,4 +3062,5 @@ START_TEST(actctx)
test_ZombifyActCtx();
run_child_process();
test_compatibility();
+ test_settings();
}
More information about the wine-cvs
mailing list