mirror of
https://github.com/reactos/reactos.git
synced 2025-05-20 09:36:16 +00:00
[NTOS:DBGK]
- Add SEH in DbgkpPostFakeModuleMessages. Fixes crash in ntdll_winetest:info when trying to debug another process that was started suspended. CORE-13369 #resolve svn path=/trunk/; revision=74946
This commit is contained in:
parent
68dca562d7
commit
c2486683cc
1 changed files with 100 additions and 83 deletions
|
@ -470,6 +470,7 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
|
||||||
OBJECT_ATTRIBUTES ObjectAttributes;
|
OBJECT_ATTRIBUTES ObjectAttributes;
|
||||||
IO_STATUS_BLOCK IoStatusBlock;
|
IO_STATUS_BLOCK IoStatusBlock;
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
|
UNICODE_STRING FullDllName;
|
||||||
PAGED_CODE();
|
PAGED_CODE();
|
||||||
DBGKTRACE(DBGK_PROCESS_DEBUG, "Process: %p Thread: %p DebugObject: %p\n",
|
DBGKTRACE(DBGK_PROCESS_DEBUG, "Process: %p Thread: %p DebugObject: %p\n",
|
||||||
Process, Thread, DebugObject);
|
Process, Thread, DebugObject);
|
||||||
|
@ -477,15 +478,22 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
|
||||||
/* Quit if there's no PEB */
|
/* Quit if there's no PEB */
|
||||||
if (!Peb) return STATUS_SUCCESS;
|
if (!Peb) return STATUS_SUCCESS;
|
||||||
|
|
||||||
|
/* Accessing user memory, need SEH */
|
||||||
|
_SEH2_TRY
|
||||||
|
{
|
||||||
/* Get the Loader Data List */
|
/* Get the Loader Data List */
|
||||||
|
ProbeForRead(Peb, sizeof(*Peb), 1);
|
||||||
LdrData = Peb->Ldr;
|
LdrData = Peb->Ldr;
|
||||||
|
ProbeForRead(LdrData, sizeof(*LdrData), 1);
|
||||||
ListHead = &LdrData->InLoadOrderModuleList;
|
ListHead = &LdrData->InLoadOrderModuleList;
|
||||||
|
ProbeForRead(ListHead, sizeof(*ListHead), 1);
|
||||||
NextEntry = ListHead->Flink;
|
NextEntry = ListHead->Flink;
|
||||||
|
|
||||||
/* Loop the modules */
|
/* Loop the modules */
|
||||||
i = 0;
|
i = 0;
|
||||||
while ((NextEntry != ListHead) && (i < 500))
|
while ((NextEntry != ListHead) && (i < 500))
|
||||||
{
|
{
|
||||||
|
ProbeForRead(NextEntry, sizeof(*NextEntry), 1);
|
||||||
/* Skip the first entry */
|
/* Skip the first entry */
|
||||||
if (!i)
|
if (!i)
|
||||||
{
|
{
|
||||||
|
@ -499,6 +507,7 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
|
||||||
LdrEntry = CONTAINING_RECORD(NextEntry,
|
LdrEntry = CONTAINING_RECORD(NextEntry,
|
||||||
LDR_DATA_TABLE_ENTRY,
|
LDR_DATA_TABLE_ENTRY,
|
||||||
InLoadOrderLinks);
|
InLoadOrderLinks);
|
||||||
|
ProbeForRead(LdrEntry, sizeof(*LdrEntry), 1);
|
||||||
|
|
||||||
/* Setup the API Message */
|
/* Setup the API Message */
|
||||||
RtlZeroMemory(&ApiMessage, sizeof(DBGKM_MSG));
|
RtlZeroMemory(&ApiMessage, sizeof(DBGKM_MSG));
|
||||||
|
@ -519,8 +528,10 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Trace */
|
/* Trace */
|
||||||
|
FullDllName = LdrEntry->FullDllName;
|
||||||
|
ProbeForRead(FullDllName.Buffer, FullDllName.MaximumLength, 1);
|
||||||
DBGKTRACE(DBGK_PROCESS_DEBUG, "Name: %wZ. Base: %p\n",
|
DBGKTRACE(DBGK_PROCESS_DEBUG, "Name: %wZ. Base: %p\n",
|
||||||
&LdrEntry->FullDllName, LdrEntry->DllBase);
|
&FullDllName, LdrEntry->DllBase);
|
||||||
|
|
||||||
/* Get the name of the DLL */
|
/* Get the name of the DLL */
|
||||||
Status = MmGetFileNameForAddress(NtHeader, &ModuleName);
|
Status = MmGetFileNameForAddress(NtHeader, &ModuleName);
|
||||||
|
@ -567,6 +578,12 @@ DbgkpPostFakeModuleMessages(IN PEPROCESS Process,
|
||||||
NextEntry = NextEntry->Flink;
|
NextEntry = NextEntry->Flink;
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||||
|
{
|
||||||
|
NOTHING;
|
||||||
|
}
|
||||||
|
_SEH2_END;
|
||||||
|
|
||||||
/* Return success */
|
/* Return success */
|
||||||
return STATUS_SUCCESS;
|
return STATUS_SUCCESS;
|
||||||
|
|
Loading…
Reference in a new issue