Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
4156a716
Commit
4156a716
authored
Jul 25, 2007
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Create the per-module activation context at module load time.
parent
270f7255
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
0 deletions
+34
-0
loader.c
dlls/ntdll/loader.c
+33
-0
winternl.h
include/winternl.h
+1
-0
No files found.
dlls/ntdll/loader.c
View file @
4156a716
...
@@ -48,6 +48,10 @@ WINE_DECLARE_DEBUG_CHANNEL(snoop);
...
@@ -48,6 +48,10 @@ WINE_DECLARE_DEBUG_CHANNEL(snoop);
WINE_DECLARE_DEBUG_CHANNEL
(
loaddll
);
WINE_DECLARE_DEBUG_CHANNEL
(
loaddll
);
WINE_DECLARE_DEBUG_CHANNEL
(
imports
);
WINE_DECLARE_DEBUG_CHANNEL
(
imports
);
/* we don't want to include winuser.h */
#define RT_MANIFEST ((ULONG_PTR)24)
#define ISOLATIONAWARE_MANIFEST_RESOURCE_ID ((ULONG_PTR)2)
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC
)(
HMODULE
,
DWORD
,
LPVOID
);
typedef
DWORD
(
CALLBACK
*
DLLENTRYPROC
)(
HMODULE
,
DWORD
,
LPVOID
);
static
int
process_detaching
=
0
;
/* set on process detach to avoid deadlocks with thread detach */
static
int
process_detaching
=
0
;
/* set on process detach to avoid deadlocks with thread detach */
...
@@ -578,6 +582,32 @@ done:
...
@@ -578,6 +582,32 @@ done:
}
}
/***********************************************************************
* create_module_activation_context
*/
static
NTSTATUS
create_module_activation_context
(
LDR_MODULE
*
module
)
{
NTSTATUS
status
;
LDR_RESOURCE_INFO
info
;
const
IMAGE_RESOURCE_DATA_ENTRY
*
entry
;
info
.
Type
=
RT_MANIFEST
;
info
.
Name
=
ISOLATIONAWARE_MANIFEST_RESOURCE_ID
;
info
.
Language
=
0
;
if
(
!
(
status
=
LdrFindResource_U
(
module
->
BaseAddress
,
&
info
,
3
,
&
entry
)))
{
ACTCTXW
ctx
;
ctx
.
cbSize
=
sizeof
(
ctx
);
ctx
.
lpSource
=
NULL
;
ctx
.
dwFlags
=
ACTCTX_FLAG_RESOURCE_NAME_VALID
|
ACTCTX_FLAG_HMODULE_VALID
;
ctx
.
hModule
=
module
->
BaseAddress
;
ctx
.
lpResourceName
=
(
LPCWSTR
)
ISOLATIONAWARE_MANIFEST_RESOURCE_ID
;
status
=
RtlCreateActivationContext
(
&
module
->
ActivationContext
,
&
ctx
);
}
return
status
;
}
/****************************************************************
/****************************************************************
* fixup_imports
* fixup_imports
*
*
...
@@ -594,6 +624,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
...
@@ -594,6 +624,7 @@ static NTSTATUS fixup_imports( WINE_MODREF *wm, LPCWSTR load_path )
if
(
!
(
wm
->
ldr
.
Flags
&
LDR_DONT_RESOLVE_REFS
))
return
STATUS_SUCCESS
;
/* already done */
if
(
!
(
wm
->
ldr
.
Flags
&
LDR_DONT_RESOLVE_REFS
))
return
STATUS_SUCCESS
;
/* already done */
wm
->
ldr
.
Flags
&=
~
LDR_DONT_RESOLVE_REFS
;
wm
->
ldr
.
Flags
&=
~
LDR_DONT_RESOLVE_REFS
;
create_module_activation_context
(
&
wm
->
ldr
);
if
(
!
(
imports
=
RtlImageDirectoryEntryToData
(
wm
->
ldr
.
BaseAddress
,
TRUE
,
if
(
!
(
imports
=
RtlImageDirectoryEntryToData
(
wm
->
ldr
.
BaseAddress
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_IMPORT
,
&
size
)))
IMAGE_DIRECTORY_ENTRY_IMPORT
,
&
size
)))
...
@@ -651,6 +682,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
...
@@ -651,6 +682,7 @@ static WINE_MODREF *alloc_module( HMODULE hModule, LPCWSTR filename )
wm
->
ldr
.
SectionHandle
=
NULL
;
wm
->
ldr
.
SectionHandle
=
NULL
;
wm
->
ldr
.
CheckSum
=
0
;
wm
->
ldr
.
CheckSum
=
0
;
wm
->
ldr
.
TimeDateStamp
=
0
;
wm
->
ldr
.
TimeDateStamp
=
0
;
wm
->
ldr
.
ActivationContext
=
0
;
RtlCreateUnicodeString
(
&
wm
->
ldr
.
FullDllName
,
filename
);
RtlCreateUnicodeString
(
&
wm
->
ldr
.
FullDllName
,
filename
);
if
((
p
=
strrchrW
(
wm
->
ldr
.
FullDllName
.
Buffer
,
'\\'
)))
p
++
;
if
((
p
=
strrchrW
(
wm
->
ldr
.
FullDllName
.
Buffer
,
'\\'
)))
p
++
;
...
@@ -1983,6 +2015,7 @@ static void free_modref( WINE_MODREF *wm )
...
@@ -1983,6 +2015,7 @@ static void free_modref( WINE_MODREF *wm )
}
}
SERVER_END_REQ
;
SERVER_END_REQ
;
RtlReleaseActivationContext
(
wm
->
ldr
.
ActivationContext
);
NtUnmapViewOfSection
(
NtCurrentProcess
(),
wm
->
ldr
.
BaseAddress
);
NtUnmapViewOfSection
(
NtCurrentProcess
(),
wm
->
ldr
.
BaseAddress
);
if
(
wm
->
ldr
.
Flags
&
LDR_WINE_INTERNAL
)
wine_dll_unload
(
wm
->
ldr
.
SectionHandle
);
if
(
wm
->
ldr
.
Flags
&
LDR_WINE_INTERNAL
)
wine_dll_unload
(
wm
->
ldr
.
SectionHandle
);
if
(
cached_modref
==
wm
)
cached_modref
=
NULL
;
if
(
cached_modref
==
wm
)
cached_modref
=
NULL
;
...
...
include/winternl.h
View file @
4156a716
...
@@ -2357,6 +2357,7 @@ typedef struct _LDR_MODULE
...
@@ -2357,6 +2357,7 @@ typedef struct _LDR_MODULE
HANDLE
SectionHandle
;
HANDLE
SectionHandle
;
ULONG
CheckSum
;
ULONG
CheckSum
;
ULONG
TimeDateStamp
;
ULONG
TimeDateStamp
;
HANDLE
ActivationContext
;
}
LDR_MODULE
,
*
PLDR_MODULE
;
}
LDR_MODULE
,
*
PLDR_MODULE
;
/* those defines are (some of the) regular LDR_MODULE.Flags values */
/* those defines are (some of the) regular LDR_MODULE.Flags values */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment