Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
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-cw
Commits
78f60322
Commit
78f60322
authored
Sep 28, 2006
by
Peter Oberndorfer
Committed by
Alexandre Julliard
Oct 02, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Add a test for NtReadVirtualMemory.
parent
ed4b6e91
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
61 additions
and
0 deletions
+61
-0
info.c
dlls/ntdll/tests/info.c
+61
-0
No files found.
dlls/ntdll/tests/info.c
View file @
78f60322
...
...
@@ -22,6 +22,7 @@
static
NTSTATUS
(
WINAPI
*
pNtQuerySystemInformation
)(
SYSTEM_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationProcess
)(
HANDLE
,
PROCESSINFOCLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtReadVirtualMemory
)(
HANDLE
,
const
void
*
,
void
*
,
SIZE_T
,
SIZE_T
*
);
static
HMODULE
hntdll
=
0
;
...
...
@@ -49,6 +50,7 @@ static BOOL InitFunctionPtrs(void)
{
NTDLL_GET_PROC
(
NtQuerySystemInformation
)
NTDLL_GET_PROC
(
NtQueryInformationProcess
)
NTDLL_GET_PROC
(
NtReadVirtualMemory
)
}
return
TRUE
;
}
...
...
@@ -755,6 +757,61 @@ static void test_query_process_handlecount(void)
}
}
static
void
test_readvirtualmemory
(
void
)
{
HANDLE
process
;
DWORD
status
;
SIZE_T
readcount
;
static
const
char
teststring
[]
=
"test string"
;
char
buffer
[
12
];
process
=
OpenProcess
(
PROCESS_VM_READ
,
FALSE
,
GetCurrentProcessId
());
ok
(
process
!=
0
,
"Expected to be able to open own process for reading memory
\n
"
);
/* normal operation */
status
=
pNtReadVirtualMemory
(
process
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
readcount
==
12
,
"Expected to read 12 bytes, got %ld
\n
"
,
readcount
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory"
);
/* no number of bytes */
memset
(
buffer
,
0
,
12
);
status
=
pNtReadVirtualMemory
(
process
,
teststring
,
buffer
,
12
,
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory"
);
/* illegal remote address */
todo_wine
{
status
=
pNtReadVirtualMemory
(
process
,
(
void
*
)
0x1234
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_PARTIAL_COPY
,
"Expected STATUS_PARTIAL_COPY, got %08lx
\n
"
,
status
);
ok
(
readcount
==
0
,
"Expected to read 0 bytes, got %ld
\n
"
,
readcount
);
}
/* 0 handle */
status
=
pNtReadVirtualMemory
(
0
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08lx
\n
"
,
status
);
ok
(
readcount
==
0
,
"Expected to read 0 bytes, got %ld
\n
"
,
readcount
);
/* pseudo handle for current process*/
memset
(
buffer
,
0
,
12
);
status
=
pNtReadVirtualMemory
((
HANDLE
)
-
1
,
teststring
,
buffer
,
12
,
&
readcount
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
readcount
==
12
,
"Expected to read 12 bytes, got %ld
\n
"
,
readcount
);
ok
(
strcmp
(
teststring
,
buffer
)
==
0
,
"Expected read memory to be the same as original memory"
);
/* this test currently crashes wine with "wine client error:<process id>: read: Bad address"
* because the reply from wine server is directly read into the buffer and that fails with EFAULT
*/
/* illegal local address */
/*status = pNtReadVirtualMemory(process, teststring, (void *)0x1234, 12, &readcount);
ok( status == STATUS_ACCESS_VIOLATION, "Expected STATUS_ACCESS_VIOLATION, got %08lx\n", status);
ok( readcount == 0, "Expected to read 0 bytes, got %ld\n",readcount);
*/
CloseHandle
(
process
);
}
START_TEST
(
info
)
{
if
(
!
InitFunctionPtrs
())
...
...
@@ -832,5 +889,9 @@ START_TEST(info)
trace
(
"Starting test_query_process_handlecount()
\n
"
);
test_query_process_handlecount
();
/* belongs into it's own file */
trace
(
"Starting test_readvirtualmemory()
\n
"
);
test_readvirtualmemory
();
FreeLibrary
(
hntdll
);
}
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