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
3dcb85f5
Commit
3dcb85f5
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: Move VirtualAllocFromApp() tests.
Signed-off-by:
Nikolay Sivov
<
nsivov@codeweavers.com
>
parent
e44a9d2c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
45 additions
and
45 deletions
+45
-45
virtual.c
dlls/kernel32/tests/virtual.c
+0
-36
process.c
dlls/kernelbase/tests/process.c
+45
-9
No files found.
dlls/kernel32/tests/virtual.c
View file @
3dcb85f5
...
...
@@ -50,7 +50,6 @@ static ULONG (WINAPI *pRtlRemoveVectoredExceptionHandler)(PVOID);
static
BOOL
(
WINAPI
*
pGetProcessDEPPolicy
)(
HANDLE
,
LPDWORD
,
PBOOL
);
static
BOOL
(
WINAPI
*
pIsWow64Process
)(
HANDLE
,
PBOOL
);
static
NTSTATUS
(
WINAPI
*
pNtProtectVirtualMemory
)(
HANDLE
,
PVOID
*
,
SIZE_T
*
,
ULONG
,
ULONG
*
);
static
PVOID
(
WINAPI
*
pVirtualAllocFromApp
)(
PVOID
,
SIZE_T
,
DWORD
,
DWORD
);
/* ############################### */
...
...
@@ -454,39 +453,6 @@ static void test_VirtualAlloc(void)
ok
(
VirtualFree
(
addr1
,
0
,
MEM_RELEASE
),
"VirtualFree failed
\n
"
);
}
static
void
test_VirtualAllocFromApp
(
void
)
{
void
*
p
;
BOOL
ret
;
if
(
!
pVirtualAllocFromApp
)
{
win_skip
(
"VirtualAllocFromApp is not available.
\n
"
);
return
;
}
p
=
GetProcAddress
(
hkernel32
,
"VirtualAllocFromApp"
);
ok
(
!
p
,
"Found VirtualAllocFromApp in kernel32.dll.
\n
"
);
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_READWRITE
);
ok
(
p
&&
GetLastError
()
==
0xdeadbeef
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
ret
=
VirtualFree
(
p
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %lu.
\n
"
,
ret
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE_READ
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
}
static
void
test_MapViewOfFile
(
void
)
{
static
const
char
testfile
[]
=
"testfile.xxx"
;
...
...
@@ -4304,7 +4270,6 @@ START_TEST(virtual)
pRtlAddVectoredExceptionHandler
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlAddVectoredExceptionHandler"
);
pRtlRemoveVectoredExceptionHandler
=
(
void
*
)
GetProcAddress
(
hntdll
,
"RtlRemoveVectoredExceptionHandler"
);
pNtProtectVirtualMemory
=
(
void
*
)
GetProcAddress
(
hntdll
,
"NtProtectVirtualMemory"
);
pVirtualAllocFromApp
=
(
void
*
)
GetProcAddress
(
hkernelbase
,
"VirtualAllocFromApp"
);
GetSystemInfo
(
&
si
);
trace
(
"system page size %#lx
\n
"
,
si
.
dwPageSize
);
...
...
@@ -4319,7 +4284,6 @@ START_TEST(virtual)
test_VirtualProtect
();
test_VirtualAllocEx
();
test_VirtualAlloc
();
test_VirtualAllocFromApp
();
test_MapViewOfFile
();
test_NtAreMappedFilesTheSame
();
test_CreateFileMapping
();
...
...
dlls/kernelbase/tests/process.c
View file @
3dcb85f5
...
...
@@ -34,6 +34,7 @@ static BOOL (WINAPI *pCompareObjectHandles)(HANDLE, HANDLE);
static
LPVOID
(
WINAPI
*
pMapViewOfFile3
)(
HANDLE
,
HANDLE
,
PVOID
,
ULONG64
offset
,
SIZE_T
size
,
ULONG
,
ULONG
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
static
LPVOID
(
WINAPI
*
pVirtualAlloc2
)(
HANDLE
,
void
*
,
SIZE_T
,
DWORD
,
DWORD
,
MEM_EXTENDED_PARAMETER
*
,
ULONG
);
static
PVOID
(
WINAPI
*
pVirtualAllocFromApp
)(
PVOID
,
SIZE_T
,
DWORD
,
DWORD
);
static
void
test_CompareObjectHandles
(
void
)
{
...
...
@@ -194,20 +195,55 @@ static void test_VirtualAlloc2(void)
VirtualFree
(
placeholder2
,
0
,
MEM_RELEASE
);
}
START_TEST
(
process
)
static
void
test_VirtualAllocFromApp
(
void
)
{
HMODULE
hmod
;
BOOL
ret
;
void
*
p
;
hmod
=
GetModuleHandleA
(
"kernel32.dll"
);
pCompareObjectHandles
=
(
void
*
)
GetProcAddress
(
hmod
,
"CompareObjectHandles"
);
ok
(
!
pCompareObjectHandles
,
"expected CompareObjectHandles only in kernelbase.dll
\n
"
);
if
(
!
pVirtualAllocFromApp
)
{
win_skip
(
"VirtualAllocFromApp is not available.
\n
"
);
return
;
}
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
pCompareObjectHandles
=
(
void
*
)
GetProcAddress
(
hmod
,
"CompareObjectHandles"
);
pMapViewOfFile3
=
(
void
*
)
GetProcAddress
(
hmod
,
"MapViewOfFile3"
);
pVirtualAlloc2
=
(
void
*
)
GetProcAddress
(
hmod
,
"VirtualAlloc2"
);
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_READWRITE
);
ok
(
p
&&
GetLastError
()
==
0xdeadbeef
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
ret
=
VirtualFree
(
p
,
0
,
MEM_RELEASE
);
ok
(
ret
,
"Got unexpected ret %#x, GetLastError() %lu.
\n
"
,
ret
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE_READ
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
p
=
pVirtualAllocFromApp
(
NULL
,
0x1000
,
MEM_RESERVE
,
PAGE_EXECUTE_READWRITE
);
ok
(
!
p
&&
GetLastError
()
==
ERROR_INVALID_PARAMETER
,
"Got unexpected mem %p, GetLastError() %lu.
\n
"
,
p
,
GetLastError
());
}
static
void
init_funcs
(
void
)
{
HMODULE
hmod
=
GetModuleHandleA
(
"kernelbase.dll"
);
#define X(f) { p##f = (void*)GetProcAddress(hmod, #f); }
X
(
CompareObjectHandles
);
X
(
MapViewOfFile3
);
X
(
VirtualAlloc2
);
X
(
VirtualAllocFromApp
);
#undef X
}
START_TEST
(
process
)
{
init_funcs
();
test_CompareObjectHandles
();
test_MapViewOfFile3
();
test_VirtualAlloc2
();
test_VirtualAllocFromApp
();
}
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