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
1d457b14
Commit
1d457b14
authored
Jul 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Add thunks for the Wow64-specific virtual memory syscalls.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
ee2ee4d1
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
63 additions
and
0 deletions
+63
-0
syscall.c
dlls/wow64/syscall.c
+3
-0
syscall.h
dlls/wow64/syscall.h
+3
-0
virtual.c
dlls/wow64/virtual.c
+46
-0
wow64_private.h
dlls/wow64/wow64_private.h
+11
-0
No files found.
dlls/wow64/syscall.c
View file @
1d457b14
...
...
@@ -34,6 +34,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(wow);
USHORT
native_machine
=
0
;
USHORT
current_machine
=
0
;
ULONG_PTR
args_alignment
=
0
;
typedef
NTSTATUS
(
WINAPI
*
syscall_thunk
)(
UINT
*
args
);
...
...
@@ -271,6 +272,8 @@ static void init_syscall_table( HMODULE ntdll )
const
USHORT
*
ordinals
;
ULONG
id
,
exp_size
,
exp_pos
,
wrap_pos
;
args_alignment
=
(
current_machine
==
IMAGE_FILE_MACHINE_I386
)
?
sizeof
(
ULONG
)
:
sizeof
(
ULONG64
);
exports
=
RtlImageDirectoryEntryToData
(
ntdll
,
TRUE
,
IMAGE_DIRECTORY_ENTRY_EXPORT
,
&
exp_size
);
ordinals
=
get_rva
(
ntdll
,
exports
->
AddressOfNameOrdinals
);
functions
=
get_rva
(
ntdll
,
exports
->
AddressOfFunctions
);
...
...
dlls/wow64/syscall.h
View file @
1d457b14
...
...
@@ -139,6 +139,9 @@
SYSCALL_ENTRY( NtWaitForKeyedEvent ) \
SYSCALL_ENTRY( NtWaitForMultipleObjects ) \
SYSCALL_ENTRY( NtWaitForSingleObject ) \
SYSCALL_ENTRY( NtWow64AllocateVirtualMemory64 ) \
SYSCALL_ENTRY( NtWow64ReadVirtualMemory64 ) \
SYSCALL_ENTRY( NtWow64WriteVirtualMemory64 ) \
SYSCALL_ENTRY( NtWriteVirtualMemory ) \
SYSCALL_ENTRY( NtYieldExecution )
...
...
dlls/wow64/virtual.c
View file @
1d457b14
...
...
@@ -444,6 +444,52 @@ NTSTATUS WINAPI wow64_NtUnmapViewOfSection( UINT *args )
/**********************************************************************
* wow64_NtWow64AllocateVirtualMemory64
*/
NTSTATUS
WINAPI
wow64_NtWow64AllocateVirtualMemory64
(
UINT
*
args
)
{
HANDLE
process
=
get_handle
(
&
args
);
void
**
addr
=
get_ptr
(
&
args
);
ULONG_PTR
zero_bits
=
get_ulong64
(
&
args
);
SIZE_T
*
size
=
get_ptr
(
&
args
);
ULONG
type
=
get_ulong
(
&
args
);
ULONG
protect
=
get_ulong
(
&
args
);
return
NtAllocateVirtualMemory
(
process
,
addr
,
zero_bits
,
size
,
type
,
protect
);
}
/**********************************************************************
* wow64_NtWow64ReadVirtualMemory64
*/
NTSTATUS
WINAPI
wow64_NtWow64ReadVirtualMemory64
(
UINT
*
args
)
{
HANDLE
process
=
get_handle
(
&
args
);
void
*
addr
=
(
void
*
)(
ULONG_PTR
)
get_ulong64
(
&
args
);
void
*
buffer
=
get_ptr
(
&
args
);
SIZE_T
size
=
get_ulong64
(
&
args
);
SIZE_T
*
ret_size
=
get_ptr
(
&
args
);
return
NtReadVirtualMemory
(
process
,
addr
,
buffer
,
size
,
ret_size
);
}
/**********************************************************************
* wow64_NtWow64WriteVirtualMemory64
*/
NTSTATUS
WINAPI
wow64_NtWow64WriteVirtualMemory64
(
UINT
*
args
)
{
HANDLE
process
=
get_handle
(
&
args
);
void
*
addr
=
(
void
*
)(
ULONG_PTR
)
get_ulong64
(
&
args
);
const
void
*
buffer
=
get_ptr
(
&
args
);
SIZE_T
size
=
get_ulong64
(
&
args
);
SIZE_T
*
ret_size
=
get_ptr
(
&
args
);
return
NtWriteVirtualMemory
(
process
,
addr
,
buffer
,
size
,
ret_size
);
}
/**********************************************************************
* wow64_NtWriteVirtualMemory
*/
NTSTATUS
WINAPI
wow64_NtWriteVirtualMemory
(
UINT
*
args
)
...
...
dlls/wow64/wow64_private.h
View file @
1d457b14
...
...
@@ -32,6 +32,7 @@ void WINAPI Wow64ApcRoutine( ULONG_PTR arg1, ULONG_PTR arg2, ULONG_PTR arg3, CON
extern
USHORT
native_machine
DECLSPEC_HIDDEN
;
extern
USHORT
current_machine
DECLSPEC_HIDDEN
;
extern
ULONG_PTR
args_alignment
DECLSPEC_HIDDEN
;
struct
object_attr64
{
...
...
@@ -63,6 +64,16 @@ static inline ULONG get_ulong( UINT **args ) { return *(*args)++; }
static
inline
HANDLE
get_handle
(
UINT
**
args
)
{
return
LongToHandle
(
*
(
*
args
)
++
);
}
static
inline
void
*
get_ptr
(
UINT
**
args
)
{
return
ULongToPtr
(
*
(
*
args
)
++
);
}
static
inline
ULONG64
get_ulong64
(
UINT
**
args
)
{
ULONG64
ret
;
*
args
=
(
UINT
*
)(((
ULONG_PTR
)
*
args
+
args_alignment
-
1
)
&
~
(
args_alignment
-
1
));
ret
=
*
(
ULONG64
*
)
*
args
;
*
args
+=
2
;
return
ret
;
}
static
inline
ULONG_PTR
get_zero_bits
(
ULONG_PTR
zero_bits
)
{
return
zero_bits
?
zero_bits
:
0x7fffffff
;
...
...
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