ntdll: Create the process activation context at initialization time.

This commit is contained in:
Alexandre Julliard 2007-07-25 16:48:40 +02:00
parent 82e1aac81d
commit 270f725526
3 changed files with 19 additions and 0 deletions

View file

@ -227,6 +227,8 @@ struct actctx_loader
static const WCHAR dotManifestW[] = {'.','m','a','n','i','f','e','s','t',0};
static ACTIVATION_CONTEXT system_actctx = { ACTCTX_MAGIC, 1 };
static ACTIVATION_CONTEXT *process_actctx = &system_actctx;
static WCHAR *strdupW(const WCHAR* str)
{
@ -1827,6 +1829,21 @@ static NTSTATUS parse_depend_manifests(struct actctx_loader* acl)
return status;
}
/* initialize the activation context for the current process */
void actctx_init(void)
{
ACTCTXW ctx;
HANDLE handle;
ctx.cbSize = sizeof(ctx);
ctx.lpSource = NULL;
ctx.dwFlags = ACTCTX_FLAG_RESOURCE_NAME_VALID | ACTCTX_FLAG_HMODULE_VALID;
ctx.hModule = NtCurrentTeb()->Peb->ImageBaseAddress;
ctx.lpResourceName = (LPCWSTR)CREATEPROCESS_MANIFEST_RESOURCE_ID;
if (!RtlCreateActivationContext( &handle, &ctx )) process_actctx = check_actctx(handle);
}
/***********************************************************************
* RtlCreateActivationContext (NTDLL.@)

View file

@ -2166,6 +2166,7 @@ void WINAPI LdrInitializeThunk( ULONG unknown1, ULONG unknown2, ULONG unknown3,
RtlEnterCriticalSection( &loader_section );
actctx_init();
load_path = NtCurrentTeb()->Peb->ProcessParameters->DllPath.Buffer;
if ((status = fixup_imports( wm, load_path )) != STATUS_SUCCESS) goto error;
if ((status = alloc_process_tls()) != STATUS_SUCCESS) goto error;

View file

@ -49,6 +49,7 @@ extern size_t get_signal_stack_total_size(void);
extern void version_init( const WCHAR *appname );
extern void debug_init(void);
extern HANDLE thread_init(void);
extern void actctx_init(void);
extern void virtual_init(void);
extern void virtual_init_threading(void);