Commit 56b3304a authored by Fabian Maurer's avatar Fabian Maurer Committed by Alexandre Julliard

ntdll/actctx: Don't stop looking for manifest if dll without manifest is found.

parent ce2be144
TESTDLL = kernel32.dll
IMPORTS = user32 advapi32
C_SRCS = \
SOURCES = \
actctx.c \
atom.c \
change.c \
......@@ -11,6 +11,8 @@ C_SRCS = \
debugger.c \
directory.c \
drive.c \
dummy.c \
dummy.spec \
environ.c \
fiber.c \
file.c \
......@@ -26,6 +28,7 @@ C_SRCS = \
process.c \
profile.c \
resource.c \
resource.rc \
sync.c \
thread.c \
time.c \
......@@ -34,5 +37,3 @@ C_SRCS = \
version.c \
virtual.c \
volume.c
RC_SRCS = resource.rc
......@@ -2598,9 +2598,27 @@ static void delete_manifest_file(const char *filename)
DeleteFileA(path);
}
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 +2655,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");
......
......@@ -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 );
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment