Module: wine Branch: master Commit: eb49e43506e964c53fdd2c67b71db694b9a4b598 URL: https://source.winehq.org/git/wine.git/?a=commit;h=eb49e43506e964c53fdd2c67b...
Author: Jacek Caban jacek@codeweavers.com Date: Fri Mar 6 14:49:15 2020 +0100
kernelbase/tests: Add test of assembly path of manifest embedded in exe module.
Signed-off-by: Jacek Caban jacek@codeweavers.com Signed-off-by: Alexandre Julliard julliard@winehq.org
---
dlls/kernelbase/tests/Makefile.in | 3 +++ dlls/kernelbase/tests/path.c | 21 +++++++++++++++++++++ dlls/kernelbase/tests/rsrc.rc | 22 ++++++++++++++++++++++ dlls/kernelbase/tests/test.manifest | 6 ++++++ 4 files changed, 52 insertions(+)
diff --git a/dlls/kernelbase/tests/Makefile.in b/dlls/kernelbase/tests/Makefile.in index 22e4a17a58..fe7ab212e6 100644 --- a/dlls/kernelbase/tests/Makefile.in +++ b/dlls/kernelbase/tests/Makefile.in @@ -3,3 +3,6 @@ TESTDLL = kernelbase.dll C_SRCS = \ path.c \ sync.c + +RC_SRCS = \ + rsrc.rc diff --git a/dlls/kernelbase/tests/path.c b/dlls/kernelbase/tests/path.c index d77eaebd91..2ee7b512b3 100644 --- a/dlls/kernelbase/tests/path.c +++ b/dlls/kernelbase/tests/path.c @@ -2337,6 +2337,26 @@ static void test_PathIsUNCEx(void) } }
+static void test_actctx(void) +{ + ACTCTX_SECTION_KEYED_DATA data = { sizeof(data) }; + WCHAR exe_path[MAX_PATH]; + char buf[1024]; + ACTIVATION_CONTEXT_ASSEMBLY_DETAILED_INFORMATION *info = (void *)buf; + SIZE_T size; + BOOL b; + + b = FindActCtxSectionStringW(FIND_ACTCTX_SECTION_KEY_RETURN_HACTCTX, NULL, ACTIVATION_CONTEXT_SECTION_DLL_REDIRECTION, L"testdll.dll", &data); + ok(b, "FindActCtxSectionString failed: %u\n", GetLastError()); + + b = QueryActCtxW(0, data.hActCtx, &data.ulAssemblyRosterIndex, AssemblyDetailedInformationInActivationContext, buf, sizeof(buf), &size); + ok(b, "QueryActCtx failed: %u\n", GetLastError()); + + GetModuleFileNameW(NULL, exe_path, ARRAY_SIZE(exe_path)); + ok(!lstrcmpW(info->lpAssemblyManifestPath, exe_path), "lpAssemblyManifestPath = %s expected %s\n", debugstr_w(info->lpAssemblyManifestPath), debugstr_w(exe_path)); + ok(!info->lpAssemblyDirectoryName, "lpAssemblyDirectoryName = %s\n", wine_dbgstr_w(info->lpAssemblyDirectoryName)); +} + START_TEST(path) { HMODULE hmod = LoadLibraryA("kernelbase.dll"); @@ -2386,4 +2406,5 @@ START_TEST(path) test_PathCchStripPrefix(); test_PathCchStripToRoot(); test_PathIsUNCEx(); + test_actctx(); } diff --git a/dlls/kernelbase/tests/rsrc.rc b/dlls/kernelbase/tests/rsrc.rc new file mode 100644 index 0000000000..57496b3ef2 --- /dev/null +++ b/dlls/kernelbase/tests/rsrc.rc @@ -0,0 +1,22 @@ +/* + * Copyright 2020 Jacek Caban + * + * 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 "winuser.h" + +/* @makedep: test.manifest */ +1 RT_MANIFEST test.manifest diff --git a/dlls/kernelbase/tests/test.manifest b/dlls/kernelbase/tests/test.manifest new file mode 100644 index 0000000000..6dad9c5fdc --- /dev/null +++ b/dlls/kernelbase/tests/test.manifest @@ -0,0 +1,6 @@ +<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> +<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0" xmlns:asmv3="urn:schemas-microsoft-com:asm.v3"> + <assemblyIdentity processorArchitecture="*" type="win32" name="Firefly" version="16.0.0.0" /> + <description>Wine Test</description> + <file name="testdll.dll" /> +</assembly>