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
f0a50452
Commit
f0a50452
authored
Mar 14, 2010
by
Henri Verbeet
Committed by
Alexandre Julliard
Mar 15, 2010
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Improve support for the ProcessDebugPort info class in NtQueryInformationProcess().
parent
4ce43cd9
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
107 additions
and
3 deletions
+107
-3
process.c
dlls/ntdll/process.c
+18
-1
info.c
dlls/ntdll/tests/info.c
+83
-0
server_protocol.h
include/wine/server_protocol.h
+2
-2
process.c
server/process.c
+1
-0
protocol.def
server/protocol.def
+1
-0
request.h
server/request.h
+1
-0
trace.c
server/trace.c
+1
-0
No files found.
dlls/ntdll/process.c
View file @
f0a50452
...
...
@@ -295,7 +295,24 @@ NTSTATUS WINAPI NtQueryInformationProcess(
* set it to 0 aka "no debugger" to satisfy copy protections */
len
=
sizeof
(
DWORD_PTR
);
if
(
ProcessInformationLength
==
len
)
memset
(
ProcessInformation
,
0
,
ProcessInformationLength
);
{
if
(
!
ProcessInformation
)
ret
=
STATUS_ACCESS_VIOLATION
;
else
if
(
!
ProcessHandle
)
ret
=
STATUS_INVALID_HANDLE
;
else
{
SERVER_START_REQ
(
get_process_info
)
{
req
->
handle
=
wine_server_obj_handle
(
ProcessHandle
);
if
((
ret
=
wine_server_call
(
req
))
==
STATUS_SUCCESS
)
{
*
(
DWORD_PTR
*
)
ProcessInformation
=
reply
->
debugger_present
?
~
(
DWORD_PTR
)
0
:
0
;
}
}
SERVER_END_REQ
;
}
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
...
...
dlls/ntdll/tests/info.c
View file @
f0a50452
...
...
@@ -20,6 +20,7 @@
#include "ntdll_test.h"
#include <winnls.h>
#include <stdio.h>
static
NTSTATUS
(
WINAPI
*
pNtQuerySystemInformation
)(
SYSTEM_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryInformationProcess
)(
HANDLE
,
PROCESSINFOCLASS
,
PVOID
,
ULONG
,
PULONG
);
...
...
@@ -751,6 +752,78 @@ static void test_query_process_times(void)
"Inconsistent length %d
\n
"
,
ReturnLength
);
}
static
void
test_query_process_debug_port
(
int
argc
,
char
**
argv
)
{
DWORD_PTR
debug_port
=
0xdeadbeef
;
char
cmdline
[
MAX_PATH
];
PROCESS_INFORMATION
pi
;
STARTUPINFO
si
=
{
0
};
NTSTATUS
status
;
BOOL
ret
;
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, last error %#x.
\n
"
,
GetLastError
());
if
(
!
ret
)
return
;
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugPort
,
NULL
,
0
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugPort
,
NULL
,
sizeof
(
debug_port
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
||
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_INVALID_HANDLE, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugPort
,
NULL
,
sizeof
(
debug_port
),
NULL
);
ok
(
status
==
STATUS_ACCESS_VIOLATION
,
"Expected STATUS_ACCESS_VIOLATION, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
),
NULL
);
ok
(
status
==
STATUS_INVALID_HANDLE
,
"Expected STATUS_ACCESS_VIOLATION, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
)
-
1
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
)
+
1
,
NULL
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"Expected STATUS_INFO_LENGTH_MISMATCH, got %#x.
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
),
NULL
);
ok
(
!
status
,
"NtQueryInformationProcess failed, status %#x.
\n
"
,
status
);
ok
(
debug_port
==
0
,
"Expected port 0, got %#lx.
\n
"
,
debug_port
);
status
=
pNtQueryInformationProcess
(
pi
.
hProcess
,
ProcessDebugPort
,
&
debug_port
,
sizeof
(
debug_port
),
NULL
);
ok
(
!
status
,
"NtQueryInformationProcess failed, status %#x.
\n
"
,
status
);
ok
(
debug_port
==
~
(
DWORD_PTR
)
0
,
"Expected port %#lx, got %#lx.
\n
"
,
~
(
DWORD_PTR
)
0
,
debug_port
);
for
(;;)
{
DEBUG_EVENT
ev
;
ret
=
WaitForDebugEvent
(
&
ev
,
INFINITE
);
ok
(
ret
,
"WaitForDebugEvent failed, last error %#x.
\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, last error %#x.
\n
"
,
GetLastError
());
if
(
!
ret
)
break
;
}
ret
=
CloseHandle
(
pi
.
hThread
);
ok
(
ret
,
"CloseHandle failed, last error %#x.
\n
"
,
GetLastError
());
ret
=
CloseHandle
(
pi
.
hProcess
);
ok
(
ret
,
"CloseHandle failed, last error %#x.
\n
"
,
GetLastError
());
}
static
void
test_query_process_handlecount
(
void
)
{
NTSTATUS
status
;
...
...
@@ -978,9 +1051,15 @@ static void test_affinity(void)
START_TEST
(
info
)
{
char
**
argv
;
int
argc
;
if
(
!
InitFunctionPtrs
())
return
;
argc
=
winetest_get_mainargs
(
&
argv
);
if
(
argc
>=
3
)
return
;
/* Child */
/* NtQuerySystemInformation */
/* 0x0 SystemBasicInformation */
...
...
@@ -1049,6 +1128,10 @@ START_TEST(info)
trace
(
"Starting test_query_process_times()
\n
"
);
test_query_process_times
();
/* 0x7 ProcessDebugPort */
trace
(
"Starting test_process_debug_port()
\n
"
);
test_query_process_debug_port
(
argc
,
argv
);
/* 0x14 ProcessHandleCount */
trace
(
"Starting test_query_process_handlecount()
\n
"
);
test_query_process_handlecount
();
...
...
include/wine/server_protocol.h
View file @
f0a50452
...
...
@@ -725,7 +725,7 @@ struct get_process_info_reply
int
exit_code
;
int
priority
;
cpu_type_t
cpu
;
char
__pad_60
[
4
]
;
int
debugger_present
;
};
...
...
@@ -5397,6 +5397,6 @@ union generic_reply
struct
free_user_handle_reply
free_user_handle_reply
;
};
#define SERVER_PROTOCOL_VERSION 39
5
#define SERVER_PROTOCOL_VERSION 39
6
#endif
/* __WINE_WINE_SERVER_PROTOCOL_H */
server/process.c
View file @
f0a50452
...
...
@@ -1091,6 +1091,7 @@ DECL_HANDLER(get_process_info)
reply
->
start_time
=
process
->
start_time
;
reply
->
end_time
=
process
->
end_time
;
reply
->
cpu
=
process
->
cpu
;
reply
->
debugger_present
=
!!
process
->
debugger
;
release_object
(
process
);
}
}
...
...
server/protocol.def
View file @
f0a50452
...
...
@@ -692,6 +692,7 @@ typedef union
int exit_code; /* process exit code */
int priority; /* priority class */
cpu_type_t cpu; /* CPU that this process is running on */
int debugger_present; /* process is being debugged */
@END
...
...
server/request.h
View file @
f0a50452
...
...
@@ -697,6 +697,7 @@ C_ASSERT( FIELD_OFFSET(struct get_process_info_reply, end_time) == 40 );
C_ASSERT
(
FIELD_OFFSET
(
struct
get_process_info_reply
,
exit_code
)
==
48
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_process_info_reply
,
priority
)
==
52
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_process_info_reply
,
cpu
)
==
56
);
C_ASSERT
(
FIELD_OFFSET
(
struct
get_process_info_reply
,
debugger_present
)
==
60
);
C_ASSERT
(
sizeof
(
struct
get_process_info_reply
)
==
64
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_process_info_request
,
handle
)
==
12
);
C_ASSERT
(
FIELD_OFFSET
(
struct
set_process_info_request
,
mask
)
==
16
);
...
...
server/trace.c
View file @
f0a50452
...
...
@@ -1118,6 +1118,7 @@ static void dump_get_process_info_reply( const struct get_process_info_reply *re
fprintf
(
stderr
,
", exit_code=%d"
,
req
->
exit_code
);
fprintf
(
stderr
,
", priority=%d"
,
req
->
priority
);
dump_cpu_type
(
", cpu="
,
&
req
->
cpu
);
fprintf
(
stderr
,
", debugger_present=%d"
,
req
->
debugger_present
);
}
static
void
dump_set_process_info_request
(
const
struct
set_process_info_request
*
req
)
...
...
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