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
0913e43b
Commit
0913e43b
authored
May 24, 2021
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskmgr: Fetch the debug channels from the PEB memory block.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1e5eee0f
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
58 deletions
+7
-58
dbgchnl.c
programs/taskmgr/dbgchnl.c
+7
-53
procpage.c
programs/taskmgr/procpage.c
+0
-3
taskmgr.h
programs/taskmgr/taskmgr.h
+0
-2
No files found.
programs/taskmgr/dbgchnl.c
View file @
0913e43b
...
...
@@ -28,7 +28,6 @@
#include <windows.h>
#include <commctrl.h>
#include <winnt.h>
#include <dbghelp.h>
#include "taskmgr.h"
#include "perfdata.h"
...
...
@@ -49,35 +48,6 @@
* setting for a fixme:s or err:s
*/
static
DWORD
(
WINAPI
*
pSymSetOptions
)(
DWORD
);
static
BOOL
(
WINAPI
*
pSymInitialize
)(
HANDLE
,
PSTR
,
BOOL
);
static
DWORD
(
WINAPI
*
pSymLoadModule
)(
HANDLE
,
HANDLE
,
PCSTR
,
PCSTR
,
DWORD
,
DWORD
);
static
BOOL
(
WINAPI
*
pSymCleanup
)(
HANDLE
);
static
BOOL
(
WINAPI
*
pSymFromName
)(
HANDLE
,
PCSTR
,
PSYMBOL_INFO
);
BOOL
AreDebugChannelsSupported
(
void
)
{
static
HANDLE
hDbgHelp
/* = NULL */
;
static
const
WCHAR
wszDbgHelp
[]
=
{
'D'
,
'B'
,
'G'
,
'H'
,
'E'
,
'L'
,
'P'
,
'.'
,
'D'
,
'L'
,
'L'
,
0
};
if
(
hDbgHelp
)
return
TRUE
;
if
(
!
(
hDbgHelp
=
LoadLibraryW
(
wszDbgHelp
)))
return
FALSE
;
pSymSetOptions
=
(
void
*
)
GetProcAddress
(
hDbgHelp
,
"SymSetOptions"
);
pSymInitialize
=
(
void
*
)
GetProcAddress
(
hDbgHelp
,
"SymInitialize"
);
pSymLoadModule
=
(
void
*
)
GetProcAddress
(
hDbgHelp
,
"SymLoadModule"
);
pSymFromName
=
(
void
*
)
GetProcAddress
(
hDbgHelp
,
"SymFromName"
);
pSymCleanup
=
(
void
*
)
GetProcAddress
(
hDbgHelp
,
"SymCleanup"
);
if
(
!
pSymSetOptions
||
!
pSymInitialize
||
!
pSymLoadModule
||
!
pSymCleanup
||
!
pSymFromName
)
{
FreeLibrary
(
hDbgHelp
);
hDbgHelp
=
NULL
;
return
FALSE
;
}
return
TRUE
;
}
static
DWORD
get_selected_pid
(
void
)
{
LVITEMW
lvitem
;
...
...
@@ -160,27 +130,6 @@ static int change_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_ch
return
1
;
}
static
void
*
get_symbol
(
HANDLE
hProcess
,
const
char
*
name
)
{
char
buffer
[
sizeof
(
IMAGEHLP_SYMBOL
)
+
256
];
SYMBOL_INFO
*
si
=
(
SYMBOL_INFO
*
)
buffer
;
void
*
ret
=
NULL
;
/* also ask for wine extensions (loading symbols from ELF files) */
pSymSetOptions
(
SYMOPT_DEFERRED_LOADS
|
SYMOPT_PUBLICS_ONLY
|
0x40000000
);
/* FIXME: the TRUE option is due to the fact that dbghelp requires it
* when loading an ELF module
*/
if
(
pSymInitialize
(
hProcess
,
NULL
,
TRUE
))
{
si
->
SizeOfStruct
=
sizeof
(
*
si
);
si
->
MaxNameLen
=
sizeof
(
buffer
)
-
sizeof
(
IMAGEHLP_SYMBOL
);
if
(
pSymFromName
(
hProcess
,
name
,
si
))
ret
=
(
void
*
)(
ULONG_PTR
)
si
->
Address
;
pSymCleanup
(
hProcess
);
}
return
ret
;
}
typedef
int
(
*
EnumChannelCB
)(
HANDLE
,
void
*
,
struct
__wine_debug_channel
*
,
void
*
);
...
...
@@ -193,11 +142,16 @@ typedef int (*EnumChannelCB)(HANDLE, void*, struct __wine_debug_channel*, void*)
static
int
enum_channel
(
HANDLE
hProcess
,
EnumChannelCB
ce
,
void
*
user
)
{
struct
__wine_debug_channel
channel
;
PROCESS_BASIC_INFORMATION
info
;
int
ret
=
1
;
void
*
addr
;
if
(
!
(
addr
=
get_symbol
(
hProcess
,
"libwine.so.1!debug_options"
)))
return
-
1
;
NtQueryInformationProcess
(
hProcess
,
ProcessBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
#ifdef _WIN64
addr
=
(
char
*
)
info
.
PebBaseAddress
+
0x2000
;
#else
addr
=
(
char
*
)
info
.
PebBaseAddress
+
0x1000
;
#endif
while
(
ret
&&
addr
&&
ReadProcessMemory
(
hProcess
,
addr
,
&
channel
,
sizeof
(
channel
),
NULL
))
{
if
(
!
channel
.
name
[
0
])
break
;
...
...
programs/taskmgr/procpage.c
View file @
0913e43b
...
...
@@ -97,9 +97,6 @@ static void ProcessPageShowContextMenu(DWORD dwProcessId)
if
(
si
.
dwNumberOfProcessors
<
2
)
RemoveMenu
(
hSubMenu
,
ID_PROCESS_PAGE_SETAFFINITY
,
MF_BYCOMMAND
);
if
(
!
AreDebugChannelsSupported
())
RemoveMenu
(
hSubMenu
,
ID_PROCESS_PAGE_DEBUGCHANNELS
,
MF_BYCOMMAND
);
switch
(
dwProcessPriorityClass
)
{
case
REALTIME_PRIORITY_CLASS
:
...
...
programs/taskmgr/taskmgr.h
View file @
0913e43b
...
...
@@ -157,8 +157,6 @@ LPWSTR GetLastErrorText( LPWSTR lpwszBuf, DWORD dwSize );
void
OnAbout
(
void
);
BOOL
AreDebugChannelsSupported
(
void
);
void
ProcessPage_OnSetAffinity
(
void
);
void
ProcessPage_OnDebug
(
void
);
void
ProcessPage_OnEndProcess
(
void
);
...
...
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