mirror of
https://github.com/reactos/reactos.git
synced 2025-06-25 00:19:43 +00:00
[NTDLL:DBG]
- Use NtReadVirtualMemory instead of dereferencing a pointer from a different process in DbgUiConvertStateChangeStructure. CORE-8622 #resolve svn path=/trunk/; revision=64690
This commit is contained in:
parent
98b2bae8db
commit
64e2bc0bcd
1 changed files with 26 additions and 5 deletions
|
@ -66,6 +66,9 @@ DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
|
||||||
THREAD_BASIC_INFORMATION ThreadBasicInfo;
|
THREAD_BASIC_INFORMATION ThreadBasicInfo;
|
||||||
LPDEBUG_EVENT DebugEvent = Win32DebugEvent;
|
LPDEBUG_EVENT DebugEvent = Win32DebugEvent;
|
||||||
HANDLE ThreadHandle;
|
HANDLE ThreadHandle;
|
||||||
|
HANDLE ProcessHandle;
|
||||||
|
PTEB Teb;
|
||||||
|
PVOID Pointer;
|
||||||
|
|
||||||
/* Write common data */
|
/* Write common data */
|
||||||
DebugEvent->dwProcessId = (DWORD)WaitStateChange->
|
DebugEvent->dwProcessId = (DWORD)WaitStateChange->
|
||||||
|
@ -256,13 +259,31 @@ DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange,
|
||||||
NtClose(ThreadHandle);
|
NtClose(ThreadHandle);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if we got thread information */
|
/* If we got thread information, open the process */
|
||||||
if (NT_SUCCESS(Status))
|
if (NT_SUCCESS(Status))
|
||||||
{
|
{
|
||||||
/* Save the image name from the TIB */
|
Status = NtOpenProcess(&ProcessHandle,
|
||||||
DebugEvent->u.LoadDll.lpImageName =
|
PROCESS_VM_READ,
|
||||||
((PTEB)ThreadBasicInfo.TebBaseAddress)->
|
&ObjectAttributes,
|
||||||
NtTib.ArbitraryUserPointer;
|
&WaitStateChange->AppClientId);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* Read the image name from the TIB */
|
||||||
|
Teb = ThreadBasicInfo.TebBaseAddress;
|
||||||
|
Status = NtReadVirtualMemory(ProcessHandle,
|
||||||
|
&Teb->NtTib.ArbitraryUserPointer,
|
||||||
|
&Pointer,
|
||||||
|
sizeof(Pointer),
|
||||||
|
NULL);
|
||||||
|
NtClose(ProcessHandle);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (NT_SUCCESS(Status))
|
||||||
|
{
|
||||||
|
/* If everything was successful, set the image name */
|
||||||
|
DebugEvent->u.LoadDll.lpImageName = Pointer;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue