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
1942cc30
Commit
1942cc30
authored
Aug 30, 2023
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
wow64: Also send notifications for failed memory management calls.
parent
ef3e97db
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
20 deletions
+66
-20
wow64.c
dlls/ntdll/tests/wow64.c
+47
-0
syscall.c
dlls/wow64/syscall.c
+1
-0
virtual.c
dlls/wow64/virtual.c
+18
-20
No files found.
dlls/ntdll/tests/wow64.c
View file @
1942cc30
...
...
@@ -392,6 +392,21 @@ static void test_cross_process_notifications( HANDLE process, void *ptr )
}
ok
(
!
entry
,
"not at end of list
\n
"
);
addr
=
(
void
*
)
0x123
;
size
=
0x321
;
status
=
NtAllocateVirtualMemory
(
process
,
&
addr
,
0
,
&
size
,
MEM_COMMIT
,
PAGE_EXECUTE_READ
);
ok
(
status
==
STATUS_CONFLICTING_ADDRESSES
||
status
==
STATUS_INVALID_PARAMETER
,
"NtAllocateVirtualMemory failed %lx
\n
"
,
status
);
entry
=
pop_from_work_list
(
&
list
->
work_list
);
if
(
current_machine
!=
IMAGE_FILE_MACHINE_ARM64
)
{
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPreVirtualAlloc
,
addr
,
0x321
,
MEM_COMMIT
,
PAGE_EXECUTE_READ
,
0
,
0xcccccccc
);
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPostVirtualAlloc
,
addr
,
0x321
,
MEM_COMMIT
,
PAGE_EXECUTE_READ
,
status
,
0xcccccccc
);
}
ok
(
!
entry
,
"not at end of list
\n
"
);
addr
=
NULL
;
size
=
0x4321
;
status
=
NtAllocateVirtualMemory
(
process
,
&
addr
,
0
,
&
size
,
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
...
...
@@ -433,6 +448,23 @@ static void test_cross_process_notifications( HANDLE process, void *ptr )
}
ok
(
!
entry
,
"not at end of list
\n
"
);
addr2
=
(
char
*
)
addr
+
0x222
;
size
=
34
;
status
=
NtProtectVirtualMemory
(
process
,
&
addr2
,
&
size
,
PAGE_EXECUTE_WRITECOPY
,
&
old_prot
);
ok
(
status
==
STATUS_INVALID_PARAMETER_4
||
status
==
STATUS_INVALID_PAGE_PROTECTION
,
"NtProtectVirtualMemory failed %lx
\n
"
,
status
);
entry
=
pop_from_work_list
(
&
list
->
work_list
);
if
(
current_machine
!=
IMAGE_FILE_MACHINE_ARM64
)
{
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPreVirtualProtect
,
(
char
*
)
addr
+
0x222
,
34
,
PAGE_EXECUTE_WRITECOPY
,
0
,
0xcccccccc
,
0xcccccccc
);
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPostVirtualProtect
,
(
char
*
)
addr
+
0x222
,
34
,
PAGE_EXECUTE_WRITECOPY
,
status
,
0xcccccccc
,
0xcccccccc
);
}
ok
(
!
entry
,
"not at end of list
\n
"
);
status
=
NtWriteVirtualMemory
(
process
,
(
char
*
)
addr
+
0x1111
,
data
,
sizeof
(
data
),
&
size
);
ok
(
!
status
,
"NtWriteVirtualMemory failed %lx
\n
"
,
status
);
entry
=
pop_from_work_list
(
&
list
->
work_list
);
...
...
@@ -465,6 +497,21 @@ static void test_cross_process_notifications( HANDLE process, void *ptr )
}
ok
(
!
entry
,
"not at end of list
\n
"
);
addr
=
(
void
*
)
0x123
;
size
=
0
;
status
=
NtFreeVirtualMemory
(
process
,
&
addr
,
&
size
,
MEM_RELEASE
);
ok
(
status
==
STATUS_MEMORY_NOT_ALLOCATED
||
status
==
STATUS_INVALID_PARAMETER
,
"NtFreeVirtualMemory failed %lx
\n
"
,
status
);
entry
=
pop_from_work_list
(
&
list
->
work_list
);
if
(
current_machine
!=
IMAGE_FILE_MACHINE_ARM64
)
{
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPreVirtualFree
,
addr
,
0
,
MEM_RELEASE
,
0
,
0xcccccccc
,
0xcccccccc
);
entry
=
expect_cross_work_entry
(
list
,
entry
,
CrossProcessPostVirtualFree
,
addr
,
0
,
MEM_RELEASE
,
status
,
0xcccccccc
,
0xcccccccc
);
}
ok
(
!
entry
,
"not at end of list
\n
"
);
file
=
CreateFileA
(
"c:
\\
windows
\\
syswow64
\\
version.dll"
,
GENERIC_READ
|
GENERIC_EXECUTE
,
FILE_SHARE_READ
,
NULL
,
OPEN_EXISTING
,
0
,
0
);
ok
(
file
!=
INVALID_HANDLE_VALUE
,
"Failed to open version.dll
\n
"
);
mapping
=
CreateFileMappingA
(
file
,
NULL
,
PAGE_READONLY
|
SEC_IMAGE
,
0
,
0
,
NULL
);
...
...
dlls/wow64/syscall.c
View file @
1942cc30
...
...
@@ -1296,6 +1296,7 @@ void WINAPI Wow64ProcessPendingCrossProcessItems(void)
break
;
case
CrossProcessPostVirtualAlloc
:
if
(
!
pBTCpuNotifyMemoryAlloc
)
break
;
if
(
entry
->
args
[
2
])
break
;
pBTCpuNotifyMemoryAlloc
(
(
void
*
)
entry
->
addr
,
entry
->
size
,
entry
->
args
[
0
],
entry
->
args
[
1
]
);
break
;
case
CrossProcessPreVirtualFree
:
...
...
dlls/wow64/virtual.c
View file @
1942cc30
...
...
@@ -160,15 +160,14 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemory( UINT *args )
addr
,
size
,
3
,
type
,
protect
,
0
);
status
=
NtAllocateVirtualMemory
(
process
,
&
addr
,
get_zero_bits
(
zero_bits
),
&
size
,
type
,
protect
);
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualAlloc
,
addr
,
size
,
3
,
type
,
protect
,
status
);
if
(
!
status
)
{
if
(
is_current
)
{
if
(
pBTCpuNotifyMemoryAlloc
)
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
}
else
send_cross_process_notification
(
process
,
CrossProcessPostVirtualAlloc
,
addr
,
size
,
3
,
type
,
protect
,
0
);
if
(
is_current
&&
pBTCpuNotifyMemoryAlloc
)
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
@@ -204,15 +203,13 @@ NTSTATUS WINAPI wow64_NtAllocateVirtualMemoryEx( UINT *args )
addr
,
size
,
3
,
type
,
protect
,
0
);
status
=
NtAllocateVirtualMemoryEx
(
process
,
&
addr
,
&
size
,
type
,
protect
,
params64
,
count
);
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualAlloc
,
addr
,
size
,
3
,
type
,
protect
,
status
);
if
(
!
status
)
{
if
(
is_current
)
{
if
(
pBTCpuNotifyMemoryAlloc
)
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
}
else
send_cross_process_notification
(
process
,
CrossProcessPostVirtualAlloc
,
addr
,
size
,
3
,
type
,
protect
,
0
);
if
(
is_current
&&
pBTCpuNotifyMemoryAlloc
)
pBTCpuNotifyMemoryAlloc
(
addr
,
size
,
type
,
protect
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
@@ -299,11 +296,11 @@ NTSTATUS WINAPI wow64_NtFreeVirtualMemory( UINT *args )
addr
,
size
,
2
,
type
,
0
);
status
=
NtFreeVirtualMemory
(
process
,
&
addr
,
&
size
,
type
);
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualFree
,
addr
,
size
,
2
,
type
,
status
);
if
(
!
status
)
{
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualFree
,
addr
,
size
,
2
,
type
,
0
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
@@ -517,11 +514,12 @@ NTSTATUS WINAPI wow64_NtProtectVirtualMemory( UINT *args )
addr
,
size
,
2
,
new_prot
,
0
);
status
=
NtProtectVirtualMemory
(
process
,
&
addr
,
&
size
,
new_prot
,
old_prot
);
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualProtect
,
addr
,
size
,
2
,
new_prot
,
status
);
if
(
!
status
)
{
if
(
!
is_current
)
send_cross_process_notification
(
process
,
CrossProcessPostVirtualProtect
,
addr
,
size
,
2
,
new_prot
,
0
);
put_addr
(
addr32
,
addr
);
put_size
(
size32
,
size
);
}
...
...
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