ntdll: Open source file only when needed during context creation.
This commit is contained in:
parent
0c4b3514a5
commit
031c027262
@ -2113,14 +2113,41 @@ static void test_CreateActCtx(void)
|
|||||||
actctx.lpAssemblyDirectory = dir;
|
actctx.lpAssemblyDirectory = dir;
|
||||||
actctx.lpSource = path;
|
actctx.lpSource = path;
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
handle = pCreateActCtxA(&actctx);
|
handle = pCreateActCtxA(&actctx);
|
||||||
todo_wine
|
todo_wine {
|
||||||
ok(handle == INVALID_HANDLE_VALUE && GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX,
|
ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
|
||||||
"got handle %p, supposed to fail\n", handle);
|
ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX, "got error %d\n", GetLastError());
|
||||||
|
}
|
||||||
if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx(handle);
|
if (handle != INVALID_HANDLE_VALUE) pReleaseActCtx(handle);
|
||||||
|
|
||||||
delete_manifest_file("main.manifest");
|
delete_manifest_file("main.manifest");
|
||||||
delete_manifest_file("testdep1.manifest");
|
delete_manifest_file("testdep1.manifest");
|
||||||
|
|
||||||
|
/* ACTCTX_FLAG_HMODULE_VALID but hModule is not set */
|
||||||
|
memset(&actctx, 0, sizeof(ACTCTXA));
|
||||||
|
actctx.cbSize = sizeof(ACTCTXA);
|
||||||
|
actctx.dwFlags = ACTCTX_FLAG_HMODULE_VALID;
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
handle = pCreateActCtxA(&actctx);
|
||||||
|
ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
|
||||||
|
todo_wine
|
||||||
|
ok(GetLastError() == ERROR_SXS_CANT_GEN_ACTCTX || broken(GetLastError() == ERROR_NOT_ENOUGH_MEMORY) /* XP, win2k3 */,
|
||||||
|
"got error %d\n", GetLastError());
|
||||||
|
|
||||||
|
/* create from HMODULE - resource doesn't exist, lpSource is set */
|
||||||
|
memset(&actctx, 0, sizeof(ACTCTXA));
|
||||||
|
actctx.cbSize = sizeof(ACTCTXA);
|
||||||
|
actctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
|
||||||
|
actctx.lpSource = "dummyfile.dll";
|
||||||
|
actctx.lpResourceName = MAKEINTRESOURCEA(20);
|
||||||
|
actctx.hModule = GetModuleHandleA(NULL);
|
||||||
|
|
||||||
|
SetLastError(0xdeadbeef);
|
||||||
|
handle = pCreateActCtxA(&actctx);
|
||||||
|
ok(handle == INVALID_HANDLE_VALUE, "got handle %p\n", handle);
|
||||||
|
todo_wine
|
||||||
|
ok(GetLastError() == ERROR_RESOURCE_TYPE_NOT_FOUND, "got error %d\n", GetLastError());
|
||||||
}
|
}
|
||||||
|
|
||||||
static BOOL init_funcs(void)
|
static BOOL init_funcs(void)
|
||||||
|
@ -4519,7 +4519,10 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
|
|||||||
}
|
}
|
||||||
|
|
||||||
nameW.Buffer = NULL;
|
nameW.Buffer = NULL;
|
||||||
if (pActCtx->lpSource)
|
|
||||||
|
/* open file only if it's going to be used */
|
||||||
|
if (pActCtx->lpSource && !((pActCtx->dwFlags & ACTCTX_FLAG_RESOURCE_NAME_VALID) &&
|
||||||
|
(pActCtx->dwFlags & ACTCTX_FLAG_HMODULE_VALID)))
|
||||||
{
|
{
|
||||||
if (!RtlDosPathNameToNtPathName_U(pActCtx->lpSource, &nameW, NULL, NULL))
|
if (!RtlDosPathNameToNtPathName_U(pActCtx->lpSource, &nameW, NULL, NULL))
|
||||||
{
|
{
|
||||||
@ -4550,7 +4553,6 @@ NTSTATUS WINAPI RtlCreateActivationContext( HANDLE *handle, const void *ptr )
|
|||||||
status = get_manifest_in_module( &acl, NULL, NULL, directory, FALSE, pActCtx->hModule,
|
status = get_manifest_in_module( &acl, NULL, NULL, directory, FALSE, pActCtx->hModule,
|
||||||
pActCtx->lpResourceName, lang );
|
pActCtx->lpResourceName, lang );
|
||||||
if (status && status != STATUS_SXS_CANT_GEN_ACTCTX)
|
if (status && status != STATUS_SXS_CANT_GEN_ACTCTX)
|
||||||
/* FIXME: what to do if pActCtx->lpSource is set */
|
|
||||||
status = get_manifest_in_associated_manifest( &acl, NULL, NULL, directory,
|
status = get_manifest_in_associated_manifest( &acl, NULL, NULL, directory,
|
||||||
pActCtx->hModule, pActCtx->lpResourceName );
|
pActCtx->hModule, pActCtx->lpResourceName );
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user