Signed-off-by: Fabian Maurer <dark.shadow4(a)web.de>
---
dlls/kernel32/tests/Makefile.in | 2 ++
dlls/kernel32/tests/actctx.c | 37 ++++++++++++++++++++++++++++++++-
dlls/kernel32/tests/dummy.c | 0
dlls/kernel32/tests/dummy.spec | 0
dlls/ntdll/actctx.c | 3 ++-
5 files changed, 40 insertions(+), 2 deletions(-)
create mode 100644 dlls/kernel32/tests/dummy.c
create mode 100644 dlls/kernel32/tests/dummy.spec
diff --git a/dlls/kernel32/tests/Makefile.in b/dlls/kernel32/tests/Makefile.in
index 2f2ac5f8c3..ee0bbd2c8b 100644
--- a/dlls/kernel32/tests/Makefile.in
+++ b/dlls/kernel32/tests/Makefile.in
@@ -11,6 +11,8 @@ C_SRCS = \
debugger.c \
directory.c \
drive.c \
+ dummy.c \
+ dummy.spec \
environ.c \
fiber.c \
file.c \
diff --git a/dlls/kernel32/tests/actctx.c b/dlls/kernel32/tests/actctx.c
index 96d9b8cbb6..5f1c33f162 100644
--- a/dlls/kernel32/tests/actctx.c
+++ b/dlls/kernel32/tests/actctx.c
@@ -2598,9 +2598,28 @@ static void delete_manifest_file(const char *filename)
DeleteFileA(path);
}
+/* Copied from msi tests */
+static void extract_resource(const char *name, const char *type, const char *path)
+{
+ DWORD written;
+ HANDLE file;
+ HRSRC res;
+ void *ptr;
+
+ file = CreateFileA(path, GENERIC_READ|GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, 0, 0);
+ ok(file != INVALID_HANDLE_VALUE, "file creation failed, at %s, error %d\n", path, GetLastError());
+
+ res = FindResourceA(NULL, name, type);
+ ok( res != 0, "couldn't find resource\n" );
+ ptr = LockResource( LoadResource( GetModuleHandleA(NULL), res ));
+ WriteFile( file, ptr, SizeofResource( GetModuleHandleA(NULL), res ), &written, NULL );
+ ok( written == SizeofResource( GetModuleHandleA(NULL), res ), "couldn't write resource\n" );
+ CloseHandle( file );
+}
+
static void test_CreateActCtx(void)
{
- CHAR path[MAX_PATH], dir[MAX_PATH];
+ CHAR path[MAX_PATH], dir[MAX_PATH], dll[MAX_PATH];
ACTCTXA actctx;
HANDLE handle;
@@ -2637,6 +2656,22 @@ todo_wine {
}
if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx(handle);
+ /* with specified directory, that does contain dependent assembly */
+ GetTempPathA(ARRAY_SIZE(dir), dir);
+ actctx.lpAssemblyDirectory = dir;
+ handle = pCreateActCtxA(&actctx);
+ ok(handle != INVALID_HANDLE_VALUE, "got handle %p\n", handle);
+ pReleaseActCtx(handle);
+
+ /* Should still work if we add a dll with the same name, but without manifest */
+ strcpy(dll, dir);
+ strcat(dll, "testdep1.dll");
+ extract_resource("dummy.dll", "TESTDLL", dll);
+ handle = pCreateActCtxA(&actctx);
+ ok(handle != INVALID_HANDLE_VALUE || broken(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX) , "got error %d\n", GetLastError());
+ pReleaseActCtx(handle);
+ DeleteFileA(dll);
+
delete_manifest_file("main_wndcls.manifest");
delete_manifest_file("testdep1.manifest");
delete_manifest_file("testdep2.manifest");
diff --git a/dlls/kernel32/tests/dummy.c b/dlls/kernel32/tests/dummy.c
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/dlls/kernel32/tests/dummy.spec b/dlls/kernel32/tests/dummy.spec
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 53a8b06882..08b6c509ae 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -3294,7 +3294,8 @@ static NTSTATUS lookup_assembly(struct actctx_loader* acl,
status = get_manifest_in_pe_file( acl, ai, nameW.Buffer, directory, FALSE, file,
(LPCWSTR)CREATEPROCESS_MANIFEST_RESOURCE_ID, 0 );
NtClose( file );
- break;
+ if (status == STATUS_SUCCESS)
+ break;
}
RtlFreeUnicodeString( &nameW );
}
--
2.18.0