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
ee2ee4d1
Commit
ee2ee4d1
authored
Jul 27, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Add a thunk for the NtQueryVirtualMemory syscall.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e57d5003
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
119 additions
and
0 deletions
+119
-0
struct32.h
dlls/wow64/struct32.h
+36
-0
syscall.h
dlls/wow64/syscall.h
+1
-0
virtual.c
dlls/wow64/virtual.c
+82
-0
No files found.
dlls/wow64/struct32.h
View file @
ee2ee4d1
...
...
@@ -71,6 +71,42 @@ typedef struct
typedef
struct
{
ULONG
BaseAddress
;
ULONG
AllocationBase
;
DWORD
AllocationProtect
;
ULONG
RegionSize
;
DWORD
State
;
DWORD
Protect
;
DWORD
Type
;
}
MEMORY_BASIC_INFORMATION32
;
typedef
struct
{
UNICODE_STRING32
SectionFileName
;
}
MEMORY_SECTION_NAME32
;
typedef
union
{
ULONG
Flags
;
struct
{
ULONG
Valid
:
1
;
ULONG
ShareCount
:
3
;
ULONG
Win32Protection
:
11
;
ULONG
Shared
:
1
;
ULONG
Node
:
6
;
ULONG
Locked
:
1
;
ULONG
LargePage
:
1
;
};
}
MEMORY_WORKING_SET_EX_BLOCK32
;
typedef
struct
{
ULONG
VirtualAddress
;
MEMORY_WORKING_SET_EX_BLOCK32
VirtualAttributes
;
}
MEMORY_WORKING_SET_EX_INFORMATION32
;
typedef
struct
{
ULONG
BaseAddress
;
ULONG
Attributes
;
LARGE_INTEGER
Size
;
...
...
dlls/wow64/syscall.h
View file @
ee2ee4d1
...
...
@@ -105,6 +105,7 @@
SYSCALL_ENTRY( NtQueryTimer ) \
SYSCALL_ENTRY( NtQueryTimerResolution ) \
SYSCALL_ENTRY( NtQueryValueKey ) \
SYSCALL_ENTRY( NtQueryVirtualMemory ) \
SYSCALL_ENTRY( NtReadVirtualMemory ) \
SYSCALL_ENTRY( NtReleaseKeyedEvent ) \
SYSCALL_ENTRY( NtReleaseMutant ) \
...
...
dlls/wow64/virtual.c
View file @
ee2ee4d1
...
...
@@ -292,6 +292,88 @@ NTSTATUS WINAPI wow64_NtProtectVirtualMemory( UINT *args )
/**********************************************************************
* wow64_NtQueryVirtualMemory
*/
NTSTATUS
WINAPI
wow64_NtQueryVirtualMemory
(
UINT
*
args
)
{
HANDLE
handle
=
get_handle
(
&
args
);
void
*
addr
=
get_ptr
(
&
args
);
MEMORY_INFORMATION_CLASS
class
=
get_ulong
(
&
args
);
void
*
ptr
=
get_ptr
(
&
args
);
ULONG
len
=
get_ulong
(
&
args
);
ULONG
*
retlen
=
get_ptr
(
&
args
);
SIZE_T
res_len
=
0
;
NTSTATUS
status
;
switch
(
class
)
{
case
MemoryBasicInformation
:
/* MEMORY_BASIC_INFORMATION */
if
(
len
>=
sizeof
(
MEMORY_BASIC_INFORMATION32
))
{
MEMORY_BASIC_INFORMATION
info
;
MEMORY_BASIC_INFORMATION32
*
info32
=
ptr
;
if
(
!
(
status
=
NtQueryVirtualMemory
(
handle
,
addr
,
class
,
&
info
,
sizeof
(
info
),
&
res_len
)))
{
info32
->
BaseAddress
=
PtrToUlong
(
info
.
BaseAddress
);
info32
->
AllocationBase
=
PtrToUlong
(
info
.
AllocationBase
);
info32
->
AllocationProtect
=
info
.
AllocationProtect
;
info32
->
RegionSize
=
info
.
RegionSize
;
info32
->
State
=
info
.
State
;
info32
->
Protect
=
info
.
Protect
;
info32
->
Type
=
info
.
Type
;
}
}
else
status
=
STATUS_INFO_LENGTH_MISMATCH
;
res_len
=
sizeof
(
MEMORY_BASIC_INFORMATION32
);
break
;
case
MemorySectionName
:
/* MEMORY_SECTION_NAME */
{
MEMORY_SECTION_NAME
*
info
;
MEMORY_SECTION_NAME32
*
info32
=
ptr
;
SIZE_T
size
=
len
+
sizeof
(
*
info
)
-
sizeof
(
*
info32
);
info
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
size
);
if
(
!
(
status
=
NtQueryVirtualMemory
(
handle
,
addr
,
class
,
info
,
size
,
&
res_len
)))
{
info32
->
SectionFileName
.
Length
=
info
->
SectionFileName
.
Length
;
info32
->
SectionFileName
.
MaximumLength
=
info
->
SectionFileName
.
MaximumLength
;
info32
->
SectionFileName
.
Buffer
=
PtrToUlong
(
info32
+
1
);
memcpy
(
info32
+
1
,
info
->
SectionFileName
.
Buffer
,
info
->
SectionFileName
.
MaximumLength
);
}
res_len
+=
sizeof
(
*
info32
)
-
sizeof
(
*
info
);
break
;
}
case
MemoryWorkingSetExInformation
:
/* MEMORY_WORKING_SET_EX_INFORMATION */
{
MEMORY_WORKING_SET_EX_INFORMATION32
*
info32
=
ptr
;
MEMORY_WORKING_SET_EX_INFORMATION
*
info
;
ULONG
i
,
count
=
len
/
sizeof
(
*
info32
);
info
=
RtlAllocateHeap
(
GetProcessHeap
(),
0
,
count
*
sizeof
(
*
info
)
);
for
(
i
=
0
;
i
<
count
;
i
++
)
info
[
i
].
VirtualAddress
=
ULongToPtr
(
info32
[
i
].
VirtualAddress
);
if
(
!
(
status
=
NtQueryVirtualMemory
(
handle
,
addr
,
class
,
info
,
count
*
sizeof
(
*
info
),
&
res_len
)))
{
count
=
res_len
/
sizeof
(
*
info
);
for
(
i
=
0
;
i
<
count
;
i
++
)
info32
[
i
].
VirtualAttributes
.
Flags
=
info
[
i
].
VirtualAttributes
.
Flags
;
res_len
=
count
*
sizeof
(
*
info32
);
}
break
;
}
default:
FIXME
(
"unsupported class %u
\n
"
,
class
);
return
STATUS_INVALID_INFO_CLASS
;
}
if
(
!
status
||
status
==
STATUS_INFO_LENGTH_MISMATCH
)
put_size
(
retlen
,
res_len
);
return
status
;
}
/**********************************************************************
* wow64_NtReadVirtualMemory
*/
NTSTATUS
WINAPI
wow64_NtReadVirtualMemory
(
UINT
*
args
)
...
...
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