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
afdfb382
Commit
afdfb382
authored
Jun 03, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll/tests: Add some tests for VM regions splitting.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
f98d4f3e
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
99 additions
and
3 deletions
+99
-3
virtual.c
dlls/ntdll/tests/virtual.c
+99
-3
No files found.
dlls/ntdll/tests/virtual.c
View file @
afdfb382
...
...
@@ -272,12 +272,27 @@ static void test_NtAllocateVirtualMemory(void)
ok
(
!!
status
,
"Unexpected status %08lx.
\n
"
,
status
);
}
static
void
test_NtAllocateVirtualMemoryEx
(
void
)
#define check_region_size(p, s) check_region_size_(p, s, __LINE__)
static
void
check_region_size_
(
void
*
p
,
SIZE_T
s
,
unsigned
int
line
)
{
void
*
addr1
,
*
addr2
;
MEMORY_BASIC_INFORMATION
mbi
;
NTSTATUS
status
;
SIZE_T
size
;
memset
(
&
mbi
,
0
,
sizeof
(
mbi
));
status
=
NtQueryVirtualMemory
(
NtCurrentProcess
(),
p
,
MemoryBasicInformation
,
&
mbi
,
sizeof
(
mbi
),
&
size
);
ok_
(
__FILE__
,
line
)(
!
status
,
"Unexpected return value %08lx
\n
"
,
status
);
ok_
(
__FILE__
,
line
)(
size
==
sizeof
(
mbi
),
"Unexpected return value.
\n
"
);
ok_
(
__FILE__
,
line
)(
mbi
.
RegionSize
==
s
,
"Unexpected size %Iu, expected %Iu.
\n
"
,
mbi
.
RegionSize
,
s
);
}
static
void
test_NtAllocateVirtualMemoryEx
(
void
)
{
SIZE_T
size
,
size2
;
char
*
p
,
*
p1
,
*
p2
;
NTSTATUS
status
;
void
*
addr1
;
if
(
!
pNtAllocateVirtualMemoryEx
)
{
win_skip
(
"NtAllocateVirtualMemoryEx() is missing
\n
"
);
...
...
@@ -291,7 +306,7 @@ static void test_NtAllocateVirtualMemoryEx(void)
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
size
=
0
;
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
2
,
&
size
,
MEM_RELEASE
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr
1
,
&
size
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
/* specifying a count of >0 with NULL parameters should fail */
...
...
@@ -322,6 +337,87 @@ static void test_NtAllocateVirtualMemoryEx(void)
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
&
addr1
,
&
size
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
}
/* Placeholder region splitting. */
/* Split in three regions. */
addr1
=
NULL
;
size
=
0x10000
;
status
=
pNtAllocateVirtualMemoryEx
(
NtCurrentProcess
(),
&
addr1
,
&
size
,
MEM_RESERVE
|
MEM_RESERVE_PLACEHOLDER
,
PAGE_NOACCESS
,
NULL
,
0
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
if
(
status
==
STATUS_SUCCESS
)
{
p
=
addr1
;
p1
=
p
+
size
/
2
;
p2
=
p1
+
size
/
4
;
size2
=
size
/
4
;
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p1
,
&
size2
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
check_region_size
(
p
,
size
/
2
);
check_region_size
(
p1
,
size
/
4
);
check_region_size
(
p2
,
size
-
size
/
2
-
size
/
4
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p1
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p2
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
}
/* Split in two regions, specifying lower part. */
addr1
=
NULL
;
size
=
0x10000
;
status
=
pNtAllocateVirtualMemoryEx
(
NtCurrentProcess
(),
&
addr1
,
&
size
,
MEM_RESERVE
|
MEM_RESERVE_PLACEHOLDER
,
PAGE_NOACCESS
,
NULL
,
0
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
if
(
status
==
STATUS_SUCCESS
)
{
p1
=
addr1
;
p2
=
p1
+
size
/
4
;
size2
=
size
/
4
;
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p1
,
&
size2
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
ok
(
p1
==
addr1
,
"Unexpected address.
\n
"
);
check_region_size
(
p1
,
size
/
4
);
check_region_size
(
p2
,
size
-
size
/
4
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p1
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p2
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
}
/* Split in two regions, specifying second half. */
addr1
=
NULL
;
size
=
0x10000
;
status
=
pNtAllocateVirtualMemoryEx
(
NtCurrentProcess
(),
&
addr1
,
&
size
,
MEM_RESERVE
|
MEM_RESERVE_PLACEHOLDER
,
PAGE_NOACCESS
,
NULL
,
0
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
if
(
status
==
STATUS_SUCCESS
)
{
p1
=
addr1
;
p2
=
p1
+
size
/
2
;
size2
=
size
/
2
;
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p2
,
&
size2
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
ok
(
p2
==
p1
+
size
/
2
,
"Unexpected address.
\n
"
);
check_region_size
(
p1
,
size
/
2
);
check_region_size
(
p2
,
size
/
2
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p1
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
status
=
NtFreeVirtualMemory
(
NtCurrentProcess
(),
(
void
**
)
&
p2
,
&
size2
,
MEM_RELEASE
);
ok
(
status
==
STATUS_SUCCESS
,
"Unexpected status %08lx.
\n
"
,
status
);
}
}
struct
test_stack_size_thread_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