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
30882eb0
Commit
30882eb0
authored
Nov 22, 2011
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Nov 22, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Add a test to see how a page protection changes after write.
parent
ad0f8b6b
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
26 additions
and
1 deletion
+26
-1
virtual.c
dlls/kernel32/tests/virtual.c
+26
-1
No files found.
dlls/kernel32/tests/virtual.c
View file @
30882eb0
...
...
@@ -1523,6 +1523,21 @@ static void test_VirtualProtect(void)
VirtualFree
(
base
,
0
,
MEM_FREE
);
}
static
BOOL
is_mem_writable
(
DWORD
prot
)
{
switch
(
prot
&
0xff
)
{
case
PAGE_READWRITE
:
case
PAGE_WRITECOPY
:
case
PAGE_EXECUTE_READWRITE
:
case
PAGE_EXECUTE_WRITECOPY
:
return
TRUE
;
default:
return
FALSE
;
}
}
static
void
test_VirtualAlloc_protection
(
void
)
{
static
const
struct
test_data
...
...
@@ -1575,7 +1590,7 @@ static void test_VirtualAlloc_protection(void)
for
(
i
=
0
;
i
<
sizeof
(
td
)
/
sizeof
(
td
[
0
]);
i
++
)
{
SetLastError
(
0xdeadbeef
);
base
=
VirtualAlloc
(
0
,
si
.
dwPageSize
,
MEM_
RESERVE
|
MEM_
COMMIT
,
td
[
i
].
prot
);
base
=
VirtualAlloc
(
0
,
si
.
dwPageSize
,
MEM_COMMIT
,
td
[
i
].
prot
);
if
(
td
[
i
].
success
)
{
...
...
@@ -1592,6 +1607,16 @@ static void test_VirtualAlloc_protection(void)
ok
(
info
.
State
==
MEM_COMMIT
,
"%d: %#x != MEM_COMMIT
\n
"
,
i
,
info
.
State
);
ok
(
info
.
Type
==
MEM_PRIVATE
,
"%d: %#x != MEM_PRIVATE
\n
"
,
i
,
info
.
Type
);
if
(
is_mem_writable
(
info
.
Protect
))
{
base
[
0
]
=
0xfe
;
SetLastError
(
0xdeadbeef
);
ret
=
VirtualQuery
(
base
,
&
info
,
sizeof
(
info
));
ok
(
ret
,
"VirtualQuery failed %d
\n
"
,
GetLastError
());
ok
(
info
.
Protect
==
td
[
i
].
prot
,
"%d: got %#x != expected %#x
\n
"
,
i
,
info
.
Protect
,
td
[
i
].
prot
);
}
VirtualFree
(
base
,
0
,
MEM_FREE
);
}
else
...
...
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