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
39b20a2b
Commit
39b20a2b
authored
Apr 13, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
winedbg: Use QueryFullProcessImageNameW to retrieve the main image name.
Remove the psapi fallback that didn't work anyway. Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
405666b7
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
30 deletions
+13
-30
gdbproxy.c
programs/winedbg/gdbproxy.c
+3
-4
tgt_active.c
programs/winedbg/tgt_active.c
+10
-26
No files found.
programs/winedbg/gdbproxy.c
View file @
39b20a2b
...
...
@@ -404,6 +404,7 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx)
char
bufferA
[
256
];
WCHAR
buffer
[
256
];
}
u
;
DWORD
size
;
gdbctx
->
exec_tid
=
de
->
dwThreadId
;
gdbctx
->
other_tid
=
de
->
dwThreadId
;
...
...
@@ -417,10 +418,8 @@ static BOOL handle_debug_event(struct gdb_context* gdbctx)
if
(
!
gdbctx
->
process
)
return
TRUE
;
memory_get_string_indirect
(
gdbctx
->
process
,
de
->
u
.
CreateProcessInfo
.
lpImageName
,
de
->
u
.
CreateProcessInfo
.
fUnicode
,
u
.
buffer
,
ARRAY_SIZE
(
u
.
buffer
));
size
=
ARRAY_SIZE
(
u
.
buffer
);
QueryFullProcessImageNameW
(
gdbctx
->
process
->
handle
,
0
,
u
.
buffer
,
&
size
);
dbg_set_process_name
(
gdbctx
->
process
,
u
.
buffer
);
fprintf
(
stderr
,
"%04x:%04x: create process '%s'/%p @%p (%u<%u>)
\n
"
,
...
...
programs/winedbg/tgt_active.c
View file @
39b20a2b
...
...
@@ -297,33 +297,15 @@ static DWORD dbg_handle_exception(const EXCEPTION_RECORD* rec, BOOL first_chance
static
BOOL
tgt_process_active_close_process
(
struct
dbg_process
*
pcs
,
BOOL
kill
);
static
void
fetch_module_name
(
void
*
name_addr
,
BOOL
unicode
,
void
*
mod_addr
,
WCHAR
*
buffer
,
size_t
bufsz
,
BOOL
is_pcs
)
WCHAR
*
buffer
,
size_t
bufsz
)
{
static
const
WCHAR
pcspid
[]
=
{
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'_'
,
'%'
,
'0'
,
'8'
,
'x'
,
0
};
static
const
WCHAR
dlladdr
[]
=
{
'D'
,
'L'
,
'L'
,
'_'
,
'%'
,
'0'
,
'8'
,
'l'
,
'x'
,
0
};
memory_get_string_indirect
(
dbg_curr_process
,
name_addr
,
unicode
,
buffer
,
bufsz
);
if
(
!
buffer
[
0
]
&&
!
GetModuleFileNameExW
(
dbg_curr_process
->
handle
,
mod_addr
,
buffer
,
bufsz
))
{
if
(
is_pcs
)
{
HMODULE
h
;
WORD
(
WINAPI
*
gpif
)(
HANDLE
,
LPWSTR
,
DWORD
);
/* On Windows, when we get the process creation debug event for a process
* created by winedbg, the modules' list is not initialized yet. Hence,
* GetModuleFileNameExA (on the main module) will generate an error.
* Psapi (starting on XP) provides GetProcessImageFileName() which should
* give us the expected result
*/
if
(
!
(
h
=
GetModuleHandleA
(
"psapi"
))
||
!
(
gpif
=
(
void
*
)
GetProcAddress
(
h
,
"GetProcessImageFileNameW"
))
||
!
(
gpif
)(
dbg_curr_process
->
handle
,
buffer
,
bufsz
))
snprintfW
(
buffer
,
bufsz
,
pcspid
,
dbg_curr_pid
);
}
else
snprintfW
(
buffer
,
bufsz
,
dlladdr
,
(
ULONG_PTR
)
mod_addr
);
snprintfW
(
buffer
,
bufsz
,
dlladdr
,
(
ULONG_PTR
)
mod_addr
);
}
}
...
...
@@ -333,7 +315,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
char
bufferA
[
256
];
WCHAR
buffer
[
256
];
}
u
;
DWORD
cont
=
DBG_CONTINUE
;
DWORD
size
,
cont
=
DBG_CONTINUE
;
dbg_curr_pid
=
de
->
dwProcessId
;
dbg_curr_tid
=
de
->
dwThreadId
;
...
...
@@ -383,10 +365,12 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
WINE_ERR
(
"Couldn't create process
\n
"
);
break
;
}
fetch_module_name
(
de
->
u
.
CreateProcessInfo
.
lpImageName
,
de
->
u
.
CreateProcessInfo
.
fUnicode
,
de
->
u
.
CreateProcessInfo
.
lpBaseOfImage
,
u
.
buffer
,
ARRAY_SIZE
(
u
.
buffer
),
TRUE
);
size
=
ARRAY_SIZE
(
u
.
buffer
);
if
(
!
QueryFullProcessImageNameW
(
dbg_curr_process
->
handle
,
0
,
u
.
buffer
,
&
size
))
{
static
const
WCHAR
pcspid
[]
=
{
'P'
,
'r'
,
'o'
,
'c'
,
'e'
,
's'
,
's'
,
'_'
,
'%'
,
'0'
,
'8'
,
'x'
,
0
};
snprintfW
(
u
.
buffer
,
ARRAY_SIZE
(
u
.
buffer
),
pcspid
,
dbg_curr_pid
);
}
WINE_TRACE
(
"%04x:%04x: create process '%s'/%p @%p (%u<%u>)
\n
"
,
de
->
dwProcessId
,
de
->
dwThreadId
,
...
...
@@ -481,7 +465,7 @@ static unsigned dbg_handle_debug_event(DEBUG_EVENT* de)
fetch_module_name
(
de
->
u
.
LoadDll
.
lpImageName
,
de
->
u
.
LoadDll
.
fUnicode
,
de
->
u
.
LoadDll
.
lpBaseOfDll
,
u
.
buffer
,
ARRAY_SIZE
(
u
.
buffer
)
,
FALSE
);
u
.
buffer
,
ARRAY_SIZE
(
u
.
buffer
));
WINE_TRACE
(
"%04x:%04x: loads DLL %s @%p (%u<%u>)
\n
"
,
de
->
dwProcessId
,
de
->
dwThreadId
,
...
...
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