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
f2a07805
Commit
f2a07805
authored
Jan 10, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Initialize win32u syscall table when it is mapped.
parent
4d8091cc
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
56 deletions
+17
-56
syscall.c
dlls/wow64/syscall.c
+17
-56
No files found.
dlls/wow64/syscall.c
View file @
f2a07805
...
@@ -88,6 +88,7 @@ SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock = NULL;
...
@@ -88,6 +88,7 @@ SYSTEM_DLL_INIT_BLOCK *pLdrSystemDllInitBlock = NULL;
/* wow64win syscall table */
/* wow64win syscall table */
static
const
SYSTEM_SERVICE_TABLE
*
psdwhwin32
;
static
const
SYSTEM_SERVICE_TABLE
*
psdwhwin32
;
static
HMODULE
win32u_module
;
/* cpu backend dll functions */
/* cpu backend dll functions */
static
void
*
(
WINAPI
*
pBTCpuGetBopCode
)(
void
);
static
void
*
(
WINAPI
*
pBTCpuGetBopCode
)(
void
);
...
@@ -393,17 +394,6 @@ static DWORD get_syscall_num( const BYTE *syscall )
...
@@ -393,17 +394,6 @@ static DWORD get_syscall_num( const BYTE *syscall )
/**********************************************************************
/**********************************************************************
* init_image_mapping
*/
void
init_image_mapping
(
HMODULE
module
)
{
void
**
ptr
=
RtlFindExportedRoutineByName
(
module
,
"Wow64Transition"
);
if
(
ptr
)
*
ptr
=
pBTCpuGetBopCode
();
}
/**********************************************************************
* init_syscall_table
* init_syscall_table
*/
*/
static
void
init_syscall_table
(
HMODULE
module
,
ULONG
idx
,
const
SYSTEM_SERVICE_TABLE
*
orig_table
)
static
void
init_syscall_table
(
HMODULE
module
,
ULONG
idx
,
const
SYSTEM_SERVICE_TABLE
*
orig_table
)
...
@@ -468,66 +458,41 @@ static void init_syscall_table( HMODULE module, ULONG idx, const SYSTEM_SERVICE_
...
@@ -468,66 +458,41 @@ static void init_syscall_table( HMODULE module, ULONG idx, const SYSTEM_SERVICE_
/**********************************************************************
/**********************************************************************
*
load_64bit_module
*
init_image_mapping
*/
*/
static
HMODULE
load_64bit_module
(
const
WCHAR
*
nam
e
)
void
init_image_mapping
(
HMODULE
modul
e
)
{
{
NTSTATUS
status
;
void
**
ptr
=
RtlFindExportedRoutineByName
(
module
,
"Wow64Transition"
);
HMODULE
module
;
UNICODE_STRING
str
;
WCHAR
path
[
MAX_PATH
];
const
WCHAR
*
dir
=
get_machine_wow64_dir
(
IMAGE_FILE_MACHINE_TARGET_HOST
);
swprintf
(
path
,
MAX_PATH
,
L"%s
\\
%s"
,
dir
,
name
)
;
if
(
!
ptr
)
return
;
RtlInitUnicodeString
(
&
str
,
path
);
*
ptr
=
pBTCpuGetBopCode
(
);
if
(
(
status
=
LdrLoadDll
(
dir
,
0
,
&
str
,
&
module
)
))
if
(
!
win32u_module
&&
RtlFindExportedRoutineByName
(
module
,
"NtUserInitializeClientPfnArrays"
))
{
{
ERR
(
"failed to load dll %lx
\n
"
,
status
)
;
win32u_module
=
module
;
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
init_syscall_table
(
win32u_module
,
1
,
psdwhwin32
);
}
}
return
module
;
}
}
/**********************************************************************
/**********************************************************************
* load_
32
bit_module
* load_
64
bit_module
*/
*/
static
HMODULE
load_
32
bit_module
(
const
WCHAR
*
name
)
static
HMODULE
load_
64
bit_module
(
const
WCHAR
*
name
)
{
{
NTSTATUS
status
;
NTSTATUS
status
;
HMODULE
module
;
UNICODE_STRING
str
;
UNICODE_STRING
str
;
WCHAR
path
[
MAX_PATH
];
WCHAR
path
[
MAX_PATH
];
HANDLE
file
,
mapping
;
const
WCHAR
*
dir
=
get_machine_wow64_dir
(
IMAGE_FILE_MACHINE_TARGET_HOST
);
LARGE_INTEGER
size
;
IO_STATUS_BLOCK
io
;
OBJECT_ATTRIBUTES
attr
;
SIZE_T
len
=
0
;
void
*
module
=
NULL
;
const
WCHAR
*
dir
=
get_machine_wow64_dir
(
current_machine
);
swprintf
(
path
,
MAX_PATH
,
L"%s
\\
%s"
,
dir
,
name
);
swprintf
(
path
,
MAX_PATH
,
L"%s
\\
%s"
,
dir
,
name
);
RtlInitUnicodeString
(
&
str
,
path
);
RtlInitUnicodeString
(
&
str
,
path
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
OBJ_CASE_INSENSITIVE
,
0
,
NULL
);
if
((
status
=
LdrLoadDll
(
dir
,
0
,
&
str
,
&
module
)))
if
((
status
=
NtOpenFile
(
&
file
,
GENERIC_READ
|
SYNCHRONIZE
,
&
attr
,
&
io
,
{
FILE_SHARE_READ
|
FILE_SHARE_DELETE
,
FILE_SYNCHRONOUS_IO_NONALERT
|
FILE_NON_DIRECTORY_FILE
)))
goto
failed
;
size
.
QuadPart
=
0
;
status
=
NtCreateSection
(
&
mapping
,
STANDARD_RIGHTS_REQUIRED
|
SECTION_QUERY
|
SECTION_MAP_READ
|
SECTION_MAP_EXECUTE
,
NULL
,
&
size
,
PAGE_EXECUTE_READ
,
SEC_IMAGE
,
file
);
NtClose
(
file
);
if
(
status
)
goto
failed
;
status
=
NtMapViewOfSection
(
mapping
,
GetCurrentProcess
(),
&
module
,
0
,
0
,
NULL
,
&
len
,
ViewShare
,
0
,
PAGE_EXECUTE_READ
);
NtClose
(
mapping
);
if
(
!
status
)
return
module
;
failed:
ERR
(
"failed to load dll %lx
\n
"
,
status
);
ERR
(
"failed to load dll %lx
\n
"
,
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
NtTerminateProcess
(
GetCurrentProcess
(),
status
);
return
NULL
;
}
return
module
;
}
}
...
@@ -589,10 +554,6 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
...
@@ -589,10 +554,6 @@ static DWORD WINAPI process_init( RTL_RUN_ONCE *once, void *param, void **contex
*
(
void
**
)
RtlFindExportedRoutineByName
(
module
,
"__wine_syscall_dispatcher"
)
=
pBTCpuGetBopCode
();
*
(
void
**
)
RtlFindExportedRoutineByName
(
module
,
"__wine_syscall_dispatcher"
)
=
pBTCpuGetBopCode
();
*
(
void
**
)
RtlFindExportedRoutineByName
(
module
,
"__wine_unix_call_dispatcher"
)
=
p__wine_get_unix_opcode
();
*
(
void
**
)
RtlFindExportedRoutineByName
(
module
,
"__wine_unix_call_dispatcher"
)
=
p__wine_get_unix_opcode
();
module
=
load_32bit_module
(
L"win32u.dll"
);
init_syscall_table
(
module
,
1
,
psdwhwin32
);
NtUnmapViewOfSection
(
GetCurrentProcess
(),
module
);
init_file_redirects
();
init_file_redirects
();
return
TRUE
;
return
TRUE
;
...
...
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