diff --git a/reactos/dll/ntdll/dbg/dbgui.c b/reactos/dll/ntdll/dbg/dbgui.c index 16e46d09b3c..ede05bff817 100644 --- a/reactos/dll/ntdll/dbg/dbgui.c +++ b/reactos/dll/ntdll/dbg/dbgui.c @@ -280,8 +280,9 @@ DbgUiConvertStateChangeStructure(IN PDBGUI_WAIT_STATE_CHANGE WaitStateChange, { /* Save the image name from the TIB */ DebugEvent->u.LoadDll.lpImageName = - &((PTEB)ThreadBasicInfo.TebBaseAddress)-> + ((PTEB)ThreadBasicInfo.TebBaseAddress)-> Tib.ArbitraryUserPointer; + DPRINT1("Image name: %p\n", DebugEvent->u.LoadDll.lpImageName); } else { diff --git a/reactos/dll/ntdll/ldr/utils.c b/reactos/dll/ntdll/ldr/utils.c index f7a94cd4d07..ce03c96c43f 100644 --- a/reactos/dll/ntdll/ldr/utils.c +++ b/reactos/dll/ntdll/ldr/utils.c @@ -1986,6 +1986,7 @@ LdrpLoadModule(IN PWSTR SearchPath OPTIONAL, PVOID ImageBase; PIMAGE_NT_HEADERS NtHeaders; BOOLEAN MappedAsDataFile; + PVOID ArbitraryUserPointer; if (Module == NULL) { @@ -2027,6 +2028,9 @@ LdrpLoadModule(IN PWSTR SearchPath OPTIONAL, /* Map the dll into the process */ ViewSize = 0; ImageBase = 0; + ArbitraryUserPointer = NtCurrentTeb()->Tib.ArbitraryUserPointer; + NtCurrentTeb()->Tib.ArbitraryUserPointer = FullDosName.Buffer; + DPRINT1("POI. DAT: %p %S\n", NtCurrentTeb()->Tib.ArbitraryUserPointer, FullDosName.Buffer); Status = NtMapViewOfSection(SectionHandle, NtCurrentProcess(), &ImageBase, @@ -2037,6 +2041,8 @@ LdrpLoadModule(IN PWSTR SearchPath OPTIONAL, 0, MEM_COMMIT, PAGE_READONLY); + NtCurrentTeb()->Tib.ArbitraryUserPointer = ArbitraryUserPointer; + DPRINT1("Poi gone!\n"); if (!NT_SUCCESS(Status)) { DPRINT1("map view of section failed (Status 0x%08lx)\n", Status); diff --git a/reactos/ntoskrnl/dbgk/dbgkutil.c b/reactos/ntoskrnl/dbgk/dbgkutil.c index c5218cd8839..10a4a2a4201 100644 --- a/reactos/ntoskrnl/dbgk/dbgkutil.c +++ b/reactos/ntoskrnl/dbgk/dbgkutil.c @@ -12,6 +12,8 @@ #define NDEBUG #include +extern ULONG DbgkpTraceLevel; + /* FUNCTIONS *****************************************************************/ HANDLE @@ -236,9 +238,11 @@ DbgkCreateThread(PVOID StartAddress) if (Teb) { /* Copy the system library name and link to it */ +#if 0 wcsncpy(Teb->StaticUnicodeBuffer, L"ntdll.dll", - sizeof(Teb->StaticUnicodeBuffer)); + sizeof(Teb->StaticUnicodeBuffer) / sizeof(WCHAR)); +#endif Teb->Tib.ArbitraryUserPointer = Teb->StaticUnicodeBuffer; /* Return it in the debug event as well */ @@ -369,7 +373,7 @@ DbgkExitThread(IN NTSTATUS ExitStatus) VOID NTAPI -DbgkMapViewOfSection(IN HANDLE SectionHandle, +DbgkMapViewOfSection(IN PVOID Section, IN PVOID BaseAddress, IN ULONG SectionOffset, IN ULONG_PTR ViewSize) @@ -380,6 +384,8 @@ DbgkMapViewOfSection(IN HANDLE SectionHandle, PETHREAD Thread = PsGetCurrentThread(); PIMAGE_NT_HEADERS NtHeader; PAGED_CODE(); + DBGKTRACE(DBGK_PROCESS_DEBUG, + "Section: %p. Base: %p\n", Section, BaseAddress); /* Check if this thread is hidden, doesn't have a debug port, or died */ if ((Thread->HideFromDebugger) || @@ -392,7 +398,7 @@ DbgkMapViewOfSection(IN HANDLE SectionHandle, } /* Setup the parameters */ - LoadDll->FileHandle = DbgkpSectionToFileHandle(SectionHandle); + LoadDll->FileHandle = DbgkpSectionToFileHandle(Section); LoadDll->BaseOfDll = BaseAddress; LoadDll->DebugInfoFileOffset = 0; LoadDll->DebugInfoSize = 0; diff --git a/reactos/ntoskrnl/dbgk/debug.c b/reactos/ntoskrnl/dbgk/debug.c index 1f112cf0cc9..6e67f4d232b 100644 --- a/reactos/ntoskrnl/dbgk/debug.c +++ b/reactos/ntoskrnl/dbgk/debug.c @@ -329,7 +329,7 @@ DbgkForwardException(IN PEXCEPTION_RECORD ExceptionRecord, PAGED_CODE(); DBGKTRACE(DBGK_EXCEPTION_DEBUG, "ExceptionRecord: %p Port: %p\n", ExceptionRecord, DebugPort); - KEBUGCHECK(0); + while (TRUE); /* Setup the API Message */ ApiMessage.h.u1.Length = sizeof(DBGKM_MSG) << 16 | @@ -442,13 +442,13 @@ DbgkpWakeTarget(IN PDEBUG_EVENT DebugEvent) /* Check if we have to wake up the event */ if (DebugEvent->Flags & 2) { - /* Signal the continue event */ - KeSetEvent(&DebugEvent->ContinueEvent, IO_NO_INCREMENT, FALSE); + /* Otherwise, free the debug event */ + DbgkpFreeDebugEvent(DebugEvent); } else { - /* Otherwise, free the debug event */ - DbgkpFreeDebugEvent(DebugEvent); + /* Signal the continue event */ + KeSetEvent(&DebugEvent->ContinueEvent, IO_NO_INCREMENT, FALSE); } } diff --git a/reactos/ntoskrnl/include/internal/dbgk.h b/reactos/ntoskrnl/include/internal/dbgk.h index 39cafe992f6..ffb9a7ad090 100644 --- a/reactos/ntoskrnl/include/internal/dbgk.h +++ b/reactos/ntoskrnl/include/internal/dbgk.h @@ -74,7 +74,7 @@ DbgkExitThread( VOID NTAPI DbgkMapViewOfSection( - IN HANDLE SectionHandle, + IN PVOID Section, IN PVOID BaseAddress, IN ULONG SectionOffset, IN ULONG_PTR ViewSize diff --git a/reactos/ntoskrnl/mm/section.c b/reactos/ntoskrnl/mm/section.c index 0ca3ca9385e..4cc998be1d7 100644 --- a/reactos/ntoskrnl/mm/section.c +++ b/reactos/ntoskrnl/mm/section.c @@ -3777,7 +3777,7 @@ NtMapViewOfSection(IN HANDLE SectionHandle, (Status != STATUS_IMAGE_NOT_AT_BASE)) { /* Notify the debugger */ - DbgkMapViewOfSection(SectionHandle, + DbgkMapViewOfSection(Section, SafeBaseAddress, SafeSectionOffset.LowPart, SafeViewSize);