Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
4f594e15
Commit
4f594e15
authored
Apr 05, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Move Wow64 initialization to LdrInitializeThunk().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
7a1ed2e1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
53 additions
and
47 deletions
+53
-47
loader.c
dlls/ntdll/loader.c
+53
-47
No files found.
dlls/ntdll/loader.c
View file @
4f594e15
...
...
@@ -3484,6 +3484,56 @@ static void process_breakpoint(void)
}
#ifndef _WIN64
void
*
Wow64Transition
=
NULL
;
static
void
map_wow64cpu
(
void
)
{
SIZE_T
size
=
0
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
string
;
HANDLE
file
,
section
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
RtlInitUnicodeString
(
&
string
,
L"
\\
??
\\
C:
\\
windows
\\
sysnative
\\
wow64cpu.dll"
);
InitializeObjectAttributes
(
&
attr
,
&
string
,
0
,
NULL
,
NULL
);
if
((
status
=
NtOpenFile
(
&
file
,
GENERIC_READ
|
SYNCHRONIZE
,
&
attr
,
&
io
,
FILE_SHARE_READ
,
FILE_SYNCHRONOUS_IO_NONALERT
|
FILE_NON_DIRECTORY_FILE
)))
{
WARN
(
"failed to open wow64cpu, status %#x
\n
"
,
status
);
return
;
}
if
(
!
NtCreateSection
(
&
section
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
,
NULL
,
NULL
,
PAGE_EXECUTE_READ
,
SEC_COMMIT
,
file
))
{
NtMapViewOfSection
(
section
,
NtCurrentProcess
(),
&
Wow64Transition
,
0
,
0
,
NULL
,
&
size
,
ViewShare
,
0
,
PAGE_EXECUTE_READ
);
NtClose
(
section
);
}
NtClose
(
file
);
}
static
void
init_wow64
(
void
)
{
PEB
*
peb
=
NtCurrentTeb
()
->
Peb
;
PEB64
*
peb64
;
if
(
!
NtCurrentTeb64
())
return
;
peb64
=
UlongToPtr
(
NtCurrentTeb64
()
->
Peb
);
peb64
->
ImageBaseAddress
=
PtrToUlong
(
peb
->
ImageBaseAddress
);
peb64
->
OSMajorVersion
=
peb
->
OSMajorVersion
;
peb64
->
OSMinorVersion
=
peb
->
OSMinorVersion
;
peb64
->
OSBuildNumber
=
peb
->
OSBuildNumber
;
peb64
->
OSPlatformId
=
peb
->
OSPlatformId
;
peb64
->
SessionId
=
peb
->
SessionId
;
map_wow64cpu
();
}
#endif
/******************************************************************
* LdrInitializeThunk (NTDLL.@)
*
...
...
@@ -3518,6 +3568,9 @@ void WINAPI LdrInitializeThunk( CONTEXT *context, ULONG_PTR unknown2, ULONG_PTR
ANSI_STRING
func_name
;
WINE_MODREF
*
kernel32
;
#ifndef _WIN64
init_wow64
();
#endif
wm
=
build_main_module
();
wm
->
ldr
.
LoadCount
=
-
1
;
...
...
@@ -3984,39 +4037,6 @@ BOOL WINAPI DllMain( HINSTANCE inst, DWORD reason, LPVOID reserved )
}
#ifndef _WIN64
void
*
Wow64Transition
=
NULL
;
static
void
map_wow64cpu
(
void
)
{
SIZE_T
size
=
0
;
OBJECT_ATTRIBUTES
attr
;
UNICODE_STRING
string
;
HANDLE
file
,
section
;
IO_STATUS_BLOCK
io
;
NTSTATUS
status
;
RtlInitUnicodeString
(
&
string
,
L"
\\
??
\\
C:
\\
windows
\\
sysnative
\\
wow64cpu.dll"
);
InitializeObjectAttributes
(
&
attr
,
&
string
,
0
,
NULL
,
NULL
);
if
((
status
=
NtOpenFile
(
&
file
,
GENERIC_READ
|
SYNCHRONIZE
,
&
attr
,
&
io
,
FILE_SHARE_READ
,
FILE_SYNCHRONOUS_IO_NONALERT
|
FILE_NON_DIRECTORY_FILE
)))
{
WARN
(
"failed to open wow64cpu, status %#x
\n
"
,
status
);
return
;
}
if
(
!
NtCreateSection
(
&
section
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
,
NULL
,
NULL
,
PAGE_EXECUTE_READ
,
SEC_COMMIT
,
file
))
{
NtMapViewOfSection
(
section
,
NtCurrentProcess
(),
&
Wow64Transition
,
0
,
0
,
NULL
,
&
size
,
ViewShare
,
0
,
PAGE_EXECUTE_READ
);
NtClose
(
section
);
}
NtClose
(
file
);
}
#endif
/***********************************************************************
* process_init
*/
...
...
@@ -4050,20 +4070,6 @@ static NTSTATUS process_init(void)
init_user_process_params
();
load_global_options
();
version_init
();
#ifndef _WIN64
if
(
NtCurrentTeb64
())
{
PEB64
*
peb64
=
UlongToPtr
(
NtCurrentTeb64
()
->
Peb
);
peb64
->
ImageBaseAddress
=
PtrToUlong
(
peb
->
ImageBaseAddress
);
peb64
->
OSMajorVersion
=
peb
->
OSMajorVersion
;
peb64
->
OSMinorVersion
=
peb
->
OSMinorVersion
;
peb64
->
OSBuildNumber
=
peb
->
OSBuildNumber
;
peb64
->
OSPlatformId
=
peb
->
OSPlatformId
;
peb64
->
SessionId
=
peb
->
SessionId
;
map_wow64cpu
();
}
#endif
return
STATUS_SUCCESS
;
}
...
...
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