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
93f88725
Commit
93f88725
authored
Jun 14, 2005
by
Paul Vriens
Committed by
Alexandre Julliard
Jun 14, 2005
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Return STATUS_INVALID_INFO_CLASS for non-implemented classes.
Return STATUS_ACCESS_VIOLATION if no buffer given. Added tests for ProcessBasicInformation.
parent
f1248789
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
92 additions
and
12 deletions
+92
-12
process.c
dlls/ntdll/process.c
+22
-12
info.c
dlls/ntdll/tests/info.c
+70
-0
No files found.
dlls/ntdll/process.c
View file @
93f88725
...
...
@@ -77,26 +77,36 @@ NTSTATUS WINAPI NtQueryInformationProcess(
NTSTATUS
ret
=
STATUS_SUCCESS
;
ULONG
len
=
0
;
TRACE
(
"(%p,0x%08x,%p,0x%08lx,%p)
\n
"
,
ProcessHandle
,
ProcessInformationClass
,
ProcessInformation
,
ProcessInformationLength
,
ReturnLength
);
switch
(
ProcessInformationClass
)
{
case
ProcessBasicInformation
:
if
(
ProcessInformationLength
==
sizeof
(
PROCESS_BASIC_INFORMATION
))
{
SERVER_START_REQ
(
get_process_info
)
if
(
!
ProcessInformation
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
{
req
->
handle
=
ProcessHandle
;
if
((
ret
=
wine_server_call
(
req
))
==
STATUS_SUCCESS
)
SERVER_START_REQ
(
get_process_info
)
{
PROCESS_BASIC_INFORMATION
*
pbi
=
(
PROCESS_BASIC_INFORMATION
*
)
ProcessInformation
;
pbi
->
ExitStatus
=
reply
->
exit_code
;
pbi
->
PebBaseAddress
=
(
DWORD
)
reply
->
peb
;
pbi
->
AffinityMask
=
reply
->
process_affinity
;
pbi
->
BasePriority
=
reply
->
priority
;
pbi
->
UniqueProcessId
=
reply
->
pid
;
pbi
->
InheritedFromUniqueProcessId
=
reply
->
ppid
;
req
->
handle
=
ProcessHandle
;
if
((
ret
=
wine_server_call
(
req
))
==
STATUS_SUCCESS
)
{
PROCESS_BASIC_INFORMATION
*
pbi
=
(
PROCESS_BASIC_INFORMATION
*
)
ProcessInformation
;
pbi
->
ExitStatus
=
reply
->
exit_code
;
pbi
->
PebBaseAddress
=
(
DWORD
)
reply
->
peb
;
pbi
->
AffinityMask
=
reply
->
process_affinity
;
pbi
->
BasePriority
=
reply
->
priority
;
pbi
->
UniqueProcessId
=
reply
->
pid
;
pbi
->
InheritedFromUniqueProcessId
=
reply
->
ppid
;
len
=
sizeof
(
PROCESS_BASIC_INFORMATION
);
}
}
SERVER_END_REQ
;
}
SERVER_END_REQ
;
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
...
...
@@ -131,7 +141,7 @@ NTSTATUS WINAPI NtQueryInformationProcess(
ProcessHandle
,
ProcessInformationClass
,
ProcessInformation
,
ProcessInformationLength
,
ReturnLength
);
ret
=
STATUS_
NOT_IMPLEMENTED
;
ret
=
STATUS_
INVALID_INFO_CLASS
;
break
;
}
...
...
dlls/ntdll/tests/info.c
View file @
93f88725
...
...
@@ -21,6 +21,7 @@
#include "ntdll_test.h"
static
NTSTATUS
(
WINAPI
*
pNtQuerySystemInformation
)(
SYSTEM_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationProcess
)(
HANDLE
,
PROCESSINFOCLASS
,
PVOID
,
ULONG
,
PULONG
);
static
HMODULE
hntdll
=
0
;
...
...
@@ -42,6 +43,7 @@ static BOOL InitFunctionPtrs(void)
if
(
hntdll
)
{
NTDLL_GET_PROC
(
NtQuerySystemInformation
)
NTDLL_GET_PROC
(
NtQueryInformationProcess
)
}
return
TRUE
;
}
...
...
@@ -317,11 +319,74 @@ static void test_query_handle()
HeapFree
(
GetProcessHeap
(),
0
,
shi
);
}
static
void
test_query_process_basic
()
{
DWORD
status
;
ULONG
ReturnLength
;
typedef
struct
_PROCESS_BASIC_INFORMATION_PRIVATE
{
DWORD
ExitStatus
;
DWORD
PebBaseAddress
;
DWORD
AffinityMask
;
DWORD
BasePriority
;
ULONG
UniqueProcessId
;
ULONG
InheritedFromUniqueProcessId
;
}
PROCESS_BASIC_INFORMATION_PRIVATE
,
*
PPROCESS_BASIC_INFORMATION_PRIVATE
;
PROCESS_BASIC_INFORMATION_PRIVATE
pbi
;
/* This test also covers some basic parameter testing that should be the same for
* every information class
*/
/* Use a nonexistent info class */
trace
(
"Check nonexistent info class
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
-
1
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INVALID_INFO_CLASS
,
"Expected STATUS_INVALID_INFO_CLASS, got %08lx
\n
"
,
status
);
/* Do not give a handle and buffer */
trace
(
"Check NULL handle and buffer and zero-length buffersize
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
/* Use a correct info class and buffer size, but still no handle and buffer */
trace
(
"Check NULL handle and buffer
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
NULL
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %08lx
\n
"
,
status
);
/* Use a correct info class and buffer size, but still no handle */
trace
(
"Check NULL handle
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_INVALID_HANDLE, got %08lx
\n
"
,
status
);
/* Use a greater buffer size */
trace
(
"Check NULL handle and too large buffersize
\n
"
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
)
*
2
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %08lx
\n
"
,
status
);
/* Use no ReturnLength */
trace
(
"Check NULL ReturnLength
\n
"
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
/* Finally some correct calls */
trace
(
"Check with correct parameters
\n
"
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessBasicInformation
,
&
pbi
,
sizeof
(
pbi
),
&
ReturnLength
);
ok
(
status
==
STATUS_SUCCESS
,
"Expected STATUS_SUCCESS, got %08lx
\n
"
,
status
);
ok
(
sizeof
(
pbi
)
==
ReturnLength
,
"Inconsistent length (%d) <-> (%ld)
\n
"
,
sizeof
(
pbi
),
ReturnLength
);
/* Check if we have some return values */
trace
(
"ProcessID : %ld
\n
"
,
pbi
.
UniqueProcessId
);
ok
(
pbi
.
UniqueProcessId
>
0
,
"Expected a ProcessID > 0, got 0, got %ld
\n
"
,
pbi
.
UniqueProcessId
);
}
START_TEST
(
info
)
{
if
(
!
InitFunctionPtrs
())
return
;
/* NtQuerySystemInformation */
/* 0x0 SystemBasicInformation */
trace
(
"Starting test_query_basic()
\n
"
);
test_query_basic
();
...
...
@@ -342,5 +407,10 @@ START_TEST(info)
trace
(
"Starting test_query_handle()
\n
"
);
test_query_handle
();
/* NtQueryInformationProcess */
trace
(
"Starting test_query_process_basic()
\n
"
);
test_query_process_basic
();
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