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
f98d4f3e
Commit
f98d4f3e
authored
Jun 03, 2022
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 06, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernelbase/tests: Add some more tests for region splitting.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
03fde5c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
process.c
dlls/kernelbase/tests/process.c
+61
-0
No files found.
dlls/kernelbase/tests/process.c
View file @
f98d4f3e
...
...
@@ -128,10 +128,23 @@ static void test_MapViewOfFile3(void)
ok
(
ret
,
"Failed to delete a test file.
\n
"
);
}
#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
)
{
MEMORY_BASIC_INFORMATION
info
;
SIZE_T
ret
;
memset
(
&
info
,
0
,
sizeof
(
info
));
ret
=
VirtualQuery
(
p
,
&
info
,
sizeof
(
info
));
ok_
(
__FILE__
,
line
)(
ret
==
sizeof
(
info
),
"Unexpected return value.
\n
"
);
ok_
(
__FILE__
,
line
)(
info
.
RegionSize
==
s
,
"Unexpected size %Iu, expected %Iu.
\n
"
,
info
.
RegionSize
,
s
);
}
static
void
test_VirtualAlloc2
(
void
)
{
void
*
placeholder1
,
*
placeholder2
,
*
view1
,
*
view2
,
*
addr
;
MEMORY_BASIC_INFORMATION
info
;
char
*
p
,
*
p1
,
*
p2
;
HANDLE
section
;
SIZE_T
size
;
BOOL
ret
;
...
...
@@ -194,6 +207,54 @@ static void test_VirtualAlloc2(void)
VirtualFree
(
placeholder1
,
0
,
MEM_RELEASE
);
VirtualFree
(
placeholder2
,
0
,
MEM_RELEASE
);
/* Split in three regions. */
p
=
pVirtualAlloc2
(
NULL
,
NULL
,
2
*
size
,
MEM_RESERVE_PLACEHOLDER
|
MEM_RESERVE
,
PAGE_NOACCESS
,
NULL
,
0
);
ok
(
!!
p
,
"Failed to create a placeholder range.
\n
"
);
p1
=
p
+
size
/
2
;
p2
=
p1
+
size
/
4
;
ret
=
VirtualFree
(
p1
,
size
/
4
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
ret
,
"Failed to split a placeholder.
\n
"
);
check_region_size
(
p
,
size
/
2
);
check_region_size
(
p1
,
size
/
4
);
check_region_size
(
p2
,
2
*
size
-
size
/
2
-
size
/
4
);
ret
=
VirtualFree
(
p
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
ret
=
VirtualFree
(
p1
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
ret
=
VirtualFree
(
p2
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
/* Split in two regions, specifying lower part. */
p
=
pVirtualAlloc2
(
NULL
,
NULL
,
2
*
size
,
MEM_RESERVE_PLACEHOLDER
|
MEM_RESERVE
,
PAGE_NOACCESS
,
NULL
,
0
);
ok
(
!!
p
,
"Failed to create a placeholder range.
\n
"
);
p1
=
p
;
p2
=
p
+
size
/
2
;
ret
=
VirtualFree
(
p1
,
size
/
2
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
ret
,
"Failed to split a placeholder.
\n
"
);
check_region_size
(
p1
,
size
/
2
);
check_region_size
(
p2
,
2
*
size
-
size
/
2
);
ret
=
VirtualFree
(
p1
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
ret
=
VirtualFree
(
p2
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
/* Split in two regions, specifying second half. */
p
=
pVirtualAlloc2
(
NULL
,
NULL
,
2
*
size
,
MEM_RESERVE_PLACEHOLDER
|
MEM_RESERVE
,
PAGE_NOACCESS
,
NULL
,
0
);
ok
(
!!
p
,
"Failed to create a placeholder range.
\n
"
);
p1
=
p
;
p2
=
p
+
size
;
ret
=
VirtualFree
(
p2
,
size
,
MEM_RELEASE
|
MEM_PRESERVE_PLACEHOLDER
);
ok
(
ret
,
"Failed to split a placeholder.
\n
"
);
check_region_size
(
p1
,
size
);
check_region_size
(
p2
,
size
);
ret
=
VirtualFree
(
p1
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
ret
=
VirtualFree
(
p2
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Failed to release a region.
\n
"
);
}
static
void
test_VirtualAllocFromApp
(
void
)
...
...
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