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
19927ee5
Commit
19927ee5
authored
Oct 21, 2014
by
Sebastian Lackner
Committed by
Alexandre Julliard
Oct 21, 2014
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32/tests: Add test for GetProcessDEPPolicy.
parent
1c1e7ed0
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
43 additions
and
0 deletions
+43
-0
virtual.c
dlls/kernel32/tests/virtual.c
+40
-0
winbase.h
include/winbase.h
+3
-0
No files found.
dlls/kernel32/tests/virtual.c
View file @
19927ee5
...
...
@@ -46,6 +46,7 @@ static DWORD (WINAPI *pNtUnmapViewOfSection)(HANDLE, PVOID);
static
struct
_TEB
*
(
WINAPI
*
pNtCurrentTeb
)(
void
);
static
PVOID
(
WINAPI
*
pRtlAddVectoredExceptionHandler
)(
ULONG
,
PVECTORED_EXCEPTION_HANDLER
);
static
ULONG
(
WINAPI
*
pRtlRemoveVectoredExceptionHandler
)(
PVOID
);
static
BOOL
(
WINAPI
*
pGetProcessDEPPolicy
)(
HANDLE
,
LPDWORD
,
PBOOL
);
/* ############################### */
...
...
@@ -1972,6 +1973,44 @@ static void test_atl_thunk_emulation( ULONG dep_flags )
base
=
VirtualAlloc
(
0
,
size
,
MEM_RESERVE
|
MEM_COMMIT
,
PAGE_READWRITE
);
ok
(
base
!=
NULL
,
"VirtualAlloc failed %u
\n
"
,
GetLastError
()
);
/* Check result of GetProcessDEPPolicy */
if
(
!
pGetProcessDEPPolicy
)
win_skip
(
"GetProcessDEPPolicy not supported
\n
"
);
else
{
BOOL
(
WINAPI
*
get_dep_policy
)(
HANDLE
,
LPDWORD
,
PBOOL
)
=
(
void
*
)
base
;
BOOL
policy_permanent
=
0xdeadbeef
;
DWORD
policy_flags
=
0xdeadbeef
;
/* GetProcessDEPPolicy crashes on Windows when a NULL pointer is passed.
* Moreover this function has a bug on Windows 8, which has the effect that
* policy_permanent is set to the content of the CL register instead of 0,
* when the policy is not permanent. To detect that we use an assembler
* wrapper to call the function. */
memcpy
(
base
,
code_atl2
,
sizeof
(
code_atl2
)
);
*
(
DWORD
*
)(
base
+
6
)
=
(
DWORD_PTR
)
pGetProcessDEPPolicy
-
(
DWORD_PTR
)(
base
+
10
);
success
=
VirtualProtect
(
base
,
size
,
PAGE_EXECUTE_READWRITE
,
&
old_prot
);
ok
(
success
,
"VirtualProtect failed %u
\n
"
,
GetLastError
()
);
success
=
get_dep_policy
(
GetCurrentProcess
(),
&
policy_flags
,
&
policy_permanent
);
todo_wine
ok
(
success
,
"GetProcessDEPPolicy failed %u
\n
"
,
GetLastError
()
);
ret
=
0
;
if
(
dep_flags
&
MEM_EXECUTE_OPTION_DISABLE
)
ret
|=
PROCESS_DEP_ENABLE
;
if
(
dep_flags
&
MEM_EXECUTE_OPTION_DISABLE_THUNK_EMULATION
)
ret
|=
PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION
;
todo_wine
ok
(
policy_flags
==
ret
,
"expected policy flags %d, got %d
\n
"
,
ret
,
policy_flags
);
todo_wine
ok
(
!
policy_permanent
||
broken
(
policy_permanent
==
0x44
),
"expected policy permanent FALSE, got %d
\n
"
,
policy_permanent
);
}
memcpy
(
base
,
code_jmp
,
sizeof
(
code_jmp
)
);
*
(
DWORD
*
)(
base
+
1
)
=
(
DWORD_PTR
)
jmp_test_func
-
(
DWORD_PTR
)(
base
+
5
);
...
...
@@ -3424,6 +3463,7 @@ START_TEST(virtual)
pVirtualFreeEx
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"VirtualFreeEx"
);
pGetWriteWatch
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetWriteWatch"
);
pResetWriteWatch
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"ResetWriteWatch"
);
pGetProcessDEPPolicy
=
(
void
*
)
GetProcAddress
(
hkernel32
,
"GetProcessDEPPolicy"
);
pNtAreMappedFilesTheSame
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtAreMappedFilesTheSame"
);
pNtMapViewOfSection
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtMapViewOfSection"
);
pNtUnmapViewOfSection
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtUnmapViewOfSection"
);
...
...
include/winbase.h
View file @
19927ee5
...
...
@@ -1449,6 +1449,9 @@ typedef enum _DEP_SYSTEM_POLICY_TYPE {
OptOut
=
3
}
DEP_SYSTEM_POLICY_TYPE
;
#define PROCESS_DEP_ENABLE 1
#define PROCESS_DEP_DISABLE_ATL_THUNK_EMULATION 2
/* Event Logging */
#define EVENTLOG_FULL_INFO 0
...
...
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