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
d7956bab
Commit
d7956bab
authored
Jul 27, 2010
by
Andrew Nguyen
Committed by
Alexandre Julliard
Jul 28, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Fix the status code for ProcessDebugObjectHandle class in…
ntdll: Fix the status code for ProcessDebugObjectHandle class in NtQueryInformationProcess when the debugger is absent.
parent
4c7f9efd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
104 additions
and
3 deletions
+104
-3
process.c
dlls/ntdll/process.c
+3
-2
info.c
dlls/ntdll/tests/info.c
+101
-1
No files found.
dlls/ntdll/process.c
View file @
d7956bab
...
...
@@ -291,8 +291,6 @@ NTSTATUS WINAPI NtQueryInformationProcess(
}
break
;
case
ProcessDebugPort
:
/* "These are not the debuggers you are looking for." *
* set it to 0 aka "no debugger" to satisfy copy protections */
len
=
sizeof
(
DWORD_PTR
);
if
(
ProcessInformationLength
==
len
)
{
...
...
@@ -327,7 +325,10 @@ NTSTATUS WINAPI NtQueryInformationProcess(
else
if
(
!
ProcessHandle
)
ret
=
STATUS_INVALID_HANDLE
;
else
{
memset
(
ProcessInformation
,
0
,
ProcessInformationLength
);
ret
=
STATUS_PORT_NOT_SET
;
}
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
...
...
dlls/ntdll/tests/info.c
View file @
d7956bab
...
...
@@ -920,6 +920,102 @@ static void test_query_process_image_file_name(void)
HeapFree
(
GetProcessHeap
(),
0
,
file_nameA
);
}
static
void
test_query_process_debug_object_handle
(
int
argc
,
char
**
argv
)
{
char
cmdline
[
MAX_PATH
];
STARTUPINFO
si
=
{
0
};
PROCESS_INFORMATION
pi
;
BOOL
ret
;
HANDLE
debug_object
;
NTSTATUS
status
;
sprintf
(
cmdline
,
"%s %s %s"
,
argv
[
0
],
argv
[
1
],
"debuggee"
);
si
.
cb
=
sizeof
(
si
);
ret
=
CreateProcess
(
NULL
,
cmdline
,
NULL
,
NULL
,
FALSE
,
DEBUG_PROCESS
,
NULL
,
NULL
,
&
si
,
&
pi
);
ok
(
ret
,
"CreateProcess failed with last error %u
\n
"
,
GetLastError
());
if
(
!
ret
)
return
;
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugObjectHandle
,
NULL
,
0
,
NULL
);
if
(
status
==
STATUS_INVALID_INFO_CLASS
||
status
==
STATUS_NOT_IMPLEMENTED
)
{
win_skip
(
"ProcessDebugObjectHandle is not supported
\n
"
);
return
;
}
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugObjectHandle
,
NULL
,
sizeof
(
debug_object
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
||
status
==
STATUS_ACCESS_VIOLATION
,
/* XP */
"Expected NtQueryInformationProcess to return STATUS_INVALID_HANDLE, got 0x%08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugObjectHandle
,
NULL
,
sizeof
(
debug_object
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugObjectHandle
,
&
debug_object
,
sizeof
(
debug_object
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected NtQueryInformationProcess to return STATUS_ACCESS_VIOLATION, got 0x%08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugObjectHandle
,
&
debug_object
,
sizeof
(
debug_object
)
-
1
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugObjectHandle
,
&
debug_object
,
sizeof
(
debug_object
)
+
1
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected NtQueryInformationProcess to return STATUS_INFO_LENGTH_MISMATCH, got 0x%08x
\n
"
,
status
);
debug_object
=
(
HANDLE
)
0xdeadbeef
;
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugObjectHandle
,
&
debug_object
,
sizeof
(
debug_object
),
NULL
);
ok
(
status
==
STATUS_PORT_NOT_SET
,
"Expected NtQueryInformationProcess to return STATUS_PORT_NOT_SET, got 0x%08x
\n
"
,
status
);
ok
(
debug_object
==
NULL
||
broken
(
debug_object
==
(
HANDLE
)
0xdeadbeef
),
/* Wow64 */
"Expected debug object handle to be NULL, got %p
\n
"
,
debug_object
);
debug_object
=
(
HANDLE
)
0xdeadbeef
;
status
=
pNtQueryInformationProcess
(
pi
.
hProcess
,
ProcessDebugObjectHandle
,
&
debug_object
,
sizeof
(
debug_object
),
NULL
);
todo_wine
ok
(
status
==
STATUS_SUCCESS
,
"Expected NtQueryInformationProcess to return STATUS_SUCCESS, got 0x%08x
\n
"
,
status
);
todo_wine
ok
(
debug_object
!=
NULL
,
"Expected debug object handle to be non-NULL, got %p
\n
"
,
debug_object
);
for
(;;)
{
DEBUG_EVENT
ev
;
ret
=
WaitForDebugEvent
(
&
ev
,
INFINITE
);
ok
(
ret
,
"WaitForDebugEvent failed with last error %u
\n
"
,
GetLastError
());
if
(
!
ret
)
break
;
if
(
ev
.
dwDebugEventCode
==
EXIT_PROCESS_DEBUG_EVENT
)
break
;
ret
=
ContinueDebugEvent
(
ev
.
dwProcessId
,
ev
.
dwThreadId
,
DBG_CONTINUE
);
ok
(
ret
,
"ContinueDebugEvent failed with last error %u
\n
"
,
GetLastError
());
if
(
!
ret
)
break
;
}
ret
=
CloseHandle
(
pi
.
hThread
);
ok
(
ret
,
"CloseHandle failed with last error %u
\n
"
,
GetLastError
());
ret
=
CloseHandle
(
pi
.
hProcess
);
ok
(
ret
,
"CloseHandle failed with last error %u
\n
"
,
GetLastError
());
}
static
void
test_readvirtualmemory
(
void
)
{
...
...
@@ -1202,10 +1298,14 @@ START_TEST(info)
trace
(
"Starting test_query_process_handlecount()
\n
"
);
test_query_process_handlecount
();
/*
27
ProcessImageFileName */
/*
0x1B
ProcessImageFileName */
trace
(
"Starting test_query_process_image_file_name()
\n
"
);
test_query_process_image_file_name
();
/* 0x1E ProcessDebugObjectHandle */
trace
(
"Starting test_query_process_debug_object_handle()
\n
"
);
test_query_process_debug_object_handle
(
argc
,
argv
);
/* belongs into it's own file */
trace
(
"Starting test_readvirtualmemory()
\n
"
);
test_readvirtualmemory
();
...
...
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