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
54a7e592
Commit
54a7e592
authored
May 26, 2020
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Implement ProcessImageInformation class in NtQueryInformationProcess().
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
e076fff5
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
78 additions
and
1 deletion
+78
-1
process.c
dlls/ntdll/process.c
+23
-0
info.c
dlls/ntdll/tests/info.c
+32
-0
server_protocol.h
include/wine/server_protocol.h
+2
-1
file.h
server/file.h
+1
-0
mapping.c
server/mapping.c
+11
-0
process.c
server/process.c
+7
-0
protocol.def
server/protocol.def
+1
-0
trace.c
server/trace.c
+1
-0
No files found.
dlls/ntdll/process.c
View file @
54a7e592
...
...
@@ -621,6 +621,29 @@ NTSTATUS WINAPI NtQueryInformationProcess(
else
ret
=
STATUS_INVALID_PARAMETER
;
break
;
case
ProcessImageInformation
:
len
=
sizeof
(
SECTION_IMAGE_INFORMATION
);
if
(
ProcessInformationLength
==
len
)
{
if
(
ProcessInformation
)
{
pe_image_info_t
pe_info
;
SERVER_START_REQ
(
get_process_info
)
{
req
->
handle
=
wine_server_obj_handle
(
ProcessHandle
);
wine_server_set_reply
(
req
,
&
pe_info
,
sizeof
(
pe_info
)
);
if
((
ret
=
wine_server_call
(
req
))
==
STATUS_SUCCESS
)
virtual_fill_image_information
(
&
pe_info
,
ProcessInformation
);
}
SERVER_END_REQ
;
}
else
ret
=
STATUS_ACCESS_VIOLATION
;
}
else
ret
=
STATUS_INFO_LENGTH_MISMATCH
;
break
;
default:
FIXME
(
"(%p,info_class=%d,%p,0x%08x,%p) Unknown information class
\n
"
,
ProcessHandle
,
ProcessInformationClass
,
...
...
dlls/ntdll/tests/info.c
View file @
54a7e592
...
...
@@ -1821,6 +1821,34 @@ todo_wine
heap_free
(
buffer
);
}
static
void
test_query_process_image_info
(
void
)
{
IMAGE_NT_HEADERS
*
nt
=
RtlImageNtHeader
(
NtCurrentTeb
()
->
Peb
->
ImageBaseAddress
);
NTSTATUS
status
;
SECTION_IMAGE_INFORMATION
info
;
ULONG
len
;
status
=
pNtQueryInformationProcess
(
NULL
,
ProcessImageInformation
,
&
info
,
sizeof
(
info
),
&
len
);
ok
(
status
==
STATUS_INVALID_HANDLE
||
broken
(
status
==
STATUS_INVALID_PARAMETER
),
/* winxp */
"got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessImageInformation
,
&
info
,
sizeof
(
info
)
-
1
,
&
len
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"got %08x
\n
"
,
status
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessImageInformation
,
&
info
,
sizeof
(
info
)
+
1
,
&
len
);
ok
(
status
==
STATUS_INFO_LENGTH_MISMATCH
,
"got %08x
\n
"
,
status
);
memset
(
&
info
,
0xcc
,
sizeof
(
info
)
);
status
=
pNtQueryInformationProcess
(
GetCurrentProcess
(),
ProcessImageInformation
,
&
info
,
sizeof
(
info
),
&
len
);
ok
(
status
==
STATUS_SUCCESS
,
"got %08x
\n
"
,
status
);
ok
(
len
==
sizeof
(
info
),
"wrong len %u
\n
"
,
len
);
ok
(
info
.
SubsystemVersionHigh
==
nt
->
OptionalHeader
.
MajorSubsystemVersion
,
"wrong major version %x/%x
\n
"
,
info
.
SubsystemVersionHigh
,
nt
->
OptionalHeader
.
MajorSubsystemVersion
);
ok
(
info
.
SubsystemVersionLow
==
nt
->
OptionalHeader
.
MinorSubsystemVersion
,
"wrong minor version %x/%x
\n
"
,
info
.
SubsystemVersionLow
,
nt
->
OptionalHeader
.
MinorSubsystemVersion
);
}
static
void
test_query_process_debug_object_handle
(
int
argc
,
char
**
argv
)
{
char
cmdline
[
MAX_PATH
];
...
...
@@ -2741,6 +2769,10 @@ START_TEST(info)
trace
(
"Starting test_process_debug_flags()
\n
"
);
test_query_process_debug_flags
(
argc
,
argv
);
/* 0x25 ProcessImageInformation */
trace
(
"Starting test_process_image_info()
\n
"
);
test_query_process_image_info
();
/* 0x4C SystemFirmwareTableInformation */
trace
(
"Starting test_query_firmware()
\n
"
);
test_query_firmware
();
...
...
include/wine/server_protocol.h
View file @
54a7e592
...
...
@@ -962,6 +962,7 @@ struct get_process_info_reply
client_cpu_t
cpu
;
short
int
debugger_present
;
short
int
debug_children
;
/* VARARG(image,pe_image_info); */
};
...
...
@@ -6684,7 +6685,7 @@ union generic_reply
/* ### protocol_version begin ### */
#define SERVER_PROTOCOL_VERSION 60
3
#define SERVER_PROTOCOL_VERSION 60
4
/* ### protocol_version end ### */
...
...
server/file.h
View file @
54a7e592
...
...
@@ -171,6 +171,7 @@ extern struct mapping *get_mapping_obj( struct process *process, obj_handle_t ha
unsigned
int
access
);
extern
struct
file
*
get_mapping_file
(
struct
process
*
process
,
client_ptr_t
base
,
unsigned
int
access
,
unsigned
int
sharing
);
extern
const
pe_image_info_t
*
get_mapping_image_info
(
struct
process
*
process
,
client_ptr_t
base
);
extern
void
free_mapped_views
(
struct
process
*
process
);
extern
int
get_page_size
(
void
);
...
...
server/mapping.c
View file @
54a7e592
...
...
@@ -127,6 +127,7 @@ struct memory_view
struct
fd
*
fd
;
/* fd for mapped file */
struct
ranges
*
committed
;
/* list of committed ranges in this mapping */
struct
shared_map
*
shared
;
/* temp file for shared PE mapping */
pe_image_info_t
image
;
/* image info (for PE image mapping) */
unsigned
int
flags
;
/* SEC_* flags */
client_ptr_t
base
;
/* view base address (in process addr space) */
mem_size_t
size
;
/* view size */
...
...
@@ -894,6 +895,15 @@ struct file *get_mapping_file( struct process *process, client_ptr_t base,
return
create_file_for_fd_obj
(
view
->
fd
,
access
,
sharing
);
}
/* get the image info for a SEC_IMAGE mapping */
const
pe_image_info_t
*
get_mapping_image_info
(
struct
process
*
process
,
client_ptr_t
base
)
{
struct
memory_view
*
view
=
find_mapped_view
(
process
,
base
);
if
(
!
view
||
!
(
view
->
flags
&
SEC_IMAGE
))
return
NULL
;
return
&
view
->
image
;
}
static
void
mapping_dump
(
struct
object
*
obj
,
int
verbose
)
{
struct
mapping
*
mapping
=
(
struct
mapping
*
)
obj
;
...
...
@@ -1062,6 +1072,7 @@ DECL_HANDLER(map_view)
view
->
fd
=
!
is_fd_removable
(
mapping
->
fd
)
?
(
struct
fd
*
)
grab_object
(
mapping
->
fd
)
:
NULL
;
view
->
committed
=
mapping
->
committed
?
(
struct
ranges
*
)
grab_object
(
mapping
->
committed
)
:
NULL
;
view
->
shared
=
mapping
->
shared
?
(
struct
shared_map
*
)
grab_object
(
mapping
->
shared
)
:
NULL
;
if
(
mapping
->
flags
&
SEC_IMAGE
)
view
->
image
=
mapping
->
image
;
list_add_tail
(
&
current
->
process
->
views
,
&
view
->
entry
);
}
...
...
server/process.c
View file @
54a7e592
...
...
@@ -1447,6 +1447,13 @@ DECL_HANDLER(get_process_info)
reply
->
cpu
=
process
->
cpu
;
reply
->
debugger_present
=
!!
process
->
debugger
;
reply
->
debug_children
=
process
->
debug_children
;
if
(
get_reply_max_size
())
{
const
pe_image_info_t
*
info
;
struct
process_dll
*
exe
=
get_process_exe_module
(
process
);
if
(
exe
&&
(
info
=
get_mapping_image_info
(
process
,
exe
->
base
)))
set_reply_data
(
info
,
min
(
sizeof
(
*
info
),
get_reply_max_size
()
));
}
release_object
(
process
);
}
}
...
...
server/protocol.def
View file @
54a7e592
...
...
@@ -915,6 +915,7 @@ struct rawinput_device
client_cpu_t cpu; /* CPU that this process is running on */
short int debugger_present; /* process is being debugged */
short int debug_children; /* inherit debugger to child processes */
VARARG(image,pe_image_info); /* image info for main exe */
@END
...
...
server/trace.c
View file @
54a7e592
...
...
@@ -1389,6 +1389,7 @@ static void dump_get_process_info_reply( const struct get_process_info_reply *re
dump_client_cpu
(
", cpu="
,
&
req
->
cpu
);
fprintf
(
stderr
,
", debugger_present=%d"
,
req
->
debugger_present
);
fprintf
(
stderr
,
", debug_children=%d"
,
req
->
debug_children
);
dump_varargs_pe_image_info
(
", image="
,
cur_size
);
}
static
void
dump_get_process_vm_counters_request
(
const
struct
get_process_vm_counters_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