Alexandre Julliard : ntdll: Create the process activation context at initialization time.

Alexandre Julliard julliard at wine.codeweavers.com
Thu Jul 26 06:36:40 CDT 2007


Module: wine
Branch: master
Commit: 270f725526ebe3bde8458b8eee44b2ea63cee3f6
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=270f725526ebe3bde8458b8eee44b2ea63cee3f6

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Wed Jul 25 16:48:40 2007 +0200

ntdll: Create the process activation context at initialization time.

---

 dlls/ntdll/actctx.c     |   17 +++++++++++++++++
 dlls/ntdll/loader.c     |    1 +
 dlls/ntdll/ntdll_misc.h |    1 +
 3 files changed, 19 insertions(+), 0 deletions(-)

diff --git a/dlls/ntdll/actctx.c b/dlls/ntdll/actctx.c
index 1e2e101..2f2e28b 100644
--- a/dlls/ntdll/actctx.c
+++ b/dlls/ntdll/actctx.c
@@ -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.@)
diff --git a/dlls/ntdll/loader.c b/dlls/ntdll/loader.c
index ca06e89..207d391 100644
--- a/dlls/ntdll/loader.c
+++ b/dlls/ntdll/loader.c
@@ -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;
diff --git a/dlls/ntdll/ntdll_misc.h b/dlls/ntdll/ntdll_misc.h
index 8f41ff8..05df507 100644
--- a/dlls/ntdll/ntdll_misc.h
+++ b/dlls/ntdll/ntdll_misc.h
@@ -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);
 




More information about the wine-cvs mailing list