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
2e7dc357
Commit
2e7dc357
authored
Nov 08, 2010
by
Marcus Meissner
Committed by
Alexandre Julliard
Nov 08, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Check and fix PE header protections.
parent
62409c42
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
info.c
dlls/ntdll/tests/info.c
+11
-0
virtual.c
dlls/ntdll/virtual.c
+4
-1
No files found.
dlls/ntdll/tests/info.c
View file @
2e7dc357
...
...
@@ -1079,6 +1079,17 @@ static void test_queryvirtualmemory(void)
char
stackbuf
[
42
];
HMODULE
module
;
module
=
GetModuleHandle
(
"ntdll.dll"
);
trace
(
"Check flags of the PE header of NTDLL.DLL at %p
\n
"
,
module
);
status
=
pNtQueryVirtualMemory
(
NtCurrentProcess
(),
module
,
MemoryBasicInformation
,
&
mbi
,
sizeof
(
MEMORY_BASIC_INFORMATION
),
&
readcount
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08x
\n
"
,
status
);
ok
(
readcount
==
sizeof
(
MEMORY_BASIC_INFORMATION
),
"Expected to read %d bytes, got %ld
\n
"
,(
int
)
sizeof
(
MEMORY_BASIC_INFORMATION
),
readcount
);
ok
(
mbi
.
AllocationBase
==
module
,
"mbi.AllocationBase is 0x%p, expected 0x%p
\n
"
,
mbi
.
AllocationBase
,
module
);
ok
(
mbi
.
AllocationProtect
==
PAGE_EXECUTE_WRITECOPY
,
"mbi.AllocationProtect is 0x%x, expected 0x%x
\n
"
,
mbi
.
AllocationProtect
,
PAGE_EXECUTE_WRITECOPY
);
ok
(
mbi
.
State
==
MEM_COMMIT
,
"mbi.State is 0x%x, expected 0x%x
\n
"
,
mbi
.
State
,
MEM_COMMIT
);
ok
(
mbi
.
Protect
==
PAGE_READONLY
,
"mbi.Protect is 0x%x, expected 0x%x
\n
"
,
mbi
.
Protect
,
PAGE_READONLY
);
ok
(
mbi
.
Type
==
MEM_IMAGE
,
"mbi.Type is 0x%x, expected 0x%x
\n
"
,
mbi
.
Type
,
MEM_IMAGE
);
trace
(
"Check flags of a function entry in NTDLL.DLL at %p
\n
"
,
pNtQueryVirtualMemory
);
module
=
GetModuleHandle
(
"ntdll.dll"
);
status
=
pNtQueryVirtualMemory
(
NtCurrentProcess
(),
pNtQueryVirtualMemory
,
MemoryBasicInformation
,
&
mbi
,
sizeof
(
MEMORY_BASIC_INFORMATION
),
&
readcount
);
...
...
dlls/ntdll/virtual.c
View file @
2e7dc357
...
...
@@ -1445,10 +1445,13 @@ NTSTATUS virtual_create_builtin_view( void *module )
if
(
status
)
return
status
;
/* The PE header is always read-only, no write, no execute. */
view
->
prot
[
0
]
=
VPROT_COMMITTED
|
VPROT_READ
;
sec
=
(
IMAGE_SECTION_HEADER
*
)((
char
*
)
&
nt
->
OptionalHeader
+
nt
->
FileHeader
.
SizeOfOptionalHeader
);
for
(
i
=
0
;
i
<
nt
->
FileHeader
.
NumberOfSections
;
i
++
)
{
DWORD
flags
=
VPROT_SYSTEM
|
VPROT_IMAGE
|
VPROT_COMMITTED
;
BYTE
flags
=
VPROT_COMMITTED
;
if
(
sec
[
i
].
Characteristics
&
IMAGE_SCN_MEM_EXECUTE
)
flags
|=
VPROT_EXEC
;
if
(
sec
[
i
].
Characteristics
&
IMAGE_SCN_MEM_READ
)
flags
|=
VPROT_READ
;
...
...
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