mirror of
https://github.com/reactos/reactos.git
synced 2024-11-20 06:15:26 +00:00
[LDR] Add debug logging when we encountered an exception in dll/tls callbacks.
CORE-14532
This commit is contained in:
parent
dfff8ed0d8
commit
55053f0099
4 changed files with 28 additions and 21 deletions
|
@ -62,9 +62,9 @@ VOID NTAPI LdrpInitializeThread(IN PCONTEXT Context);
|
|||
NTSTATUS NTAPI LdrpInitializeTls(VOID);
|
||||
NTSTATUS NTAPI LdrpAllocateTls(VOID);
|
||||
VOID NTAPI LdrpFreeTls(VOID);
|
||||
VOID NTAPI LdrpCallTlsInitializers(PVOID BaseAddress, ULONG Reason);
|
||||
BOOLEAN NTAPI LdrpCallInitRoutine(PDLL_INIT_ROUTINE EntryPoint, PVOID BaseAddress, ULONG Reason, PVOID Context);
|
||||
NTSTATUS NTAPI LdrpInitializeProcess(PCONTEXT Context, PVOID SystemArgument1);
|
||||
VOID NTAPI LdrpCallTlsInitializers(IN PLDR_DATA_TABLE_ENTRY LdrEntry, IN ULONG Reason);
|
||||
BOOLEAN NTAPI LdrpCallInitRoutine(IN PDLL_INIT_ROUTINE EntryPoint, IN PVOID BaseAddress, IN ULONG Reason, IN PVOID Context);
|
||||
NTSTATUS NTAPI LdrpInitializeProcess(IN PCONTEXT Context, IN PVOID SystemArgument1);
|
||||
VOID NTAPI LdrpInitFailure(NTSTATUS Status);
|
||||
VOID NTAPI LdrpValidateImageForMp(IN PLDR_DATA_TABLE_ENTRY LdrDataTableEntry);
|
||||
VOID NTAPI LdrpEnsureLoaderLockIsHeld(VOID);
|
||||
|
|
|
@ -1485,7 +1485,8 @@ LdrUnloadDll(IN PVOID BaseAddress)
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Do nothing */
|
||||
DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_PROCESS_DETACH) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
|
|
@ -561,7 +561,7 @@ LdrpInitializeThread(IN PCONTEXT Context)
|
|||
if (!LdrpShutdownInProgress)
|
||||
{
|
||||
/* Call TLS */
|
||||
LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_THREAD_ATTACH);
|
||||
LdrpCallTlsInitializers(LdrEntry, DLL_THREAD_ATTACH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -581,7 +581,8 @@ LdrpInitializeThread(IN PCONTEXT Context)
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Do nothing */
|
||||
DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_THREAD_ATTACH) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -610,7 +611,7 @@ LdrpInitializeThread(IN PCONTEXT Context)
|
|||
_SEH2_TRY
|
||||
{
|
||||
/* Do TLS callbacks */
|
||||
LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_ATTACH);
|
||||
LdrpCallTlsInitializers(LdrpImageEntry, DLL_THREAD_ATTACH);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -818,7 +819,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
|
|||
if (LdrEntry->TlsIndex && Context)
|
||||
{
|
||||
/* Call TLS */
|
||||
LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_PROCESS_ATTACH);
|
||||
LdrpCallTlsInitializers(LdrEntry, DLL_PROCESS_ATTACH);
|
||||
}
|
||||
|
||||
/* Call the Entrypoint */
|
||||
|
@ -835,6 +836,8 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
|
|||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
DllStatus = FALSE;
|
||||
DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_PROCESS_ATTACH) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -889,7 +892,7 @@ LdrpRunInitializeRoutines(IN PCONTEXT Context OPTIONAL)
|
|||
_SEH2_TRY
|
||||
{
|
||||
/* Do TLS callbacks */
|
||||
LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_ATTACH);
|
||||
LdrpCallTlsInitializers(LdrpImageEntry, DLL_PROCESS_ATTACH);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -996,7 +999,7 @@ LdrShutdownProcess(VOID)
|
|||
if (LdrEntry->TlsIndex)
|
||||
{
|
||||
/* Call TLS */
|
||||
LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_PROCESS_DETACH);
|
||||
LdrpCallTlsInitializers(LdrEntry, DLL_PROCESS_DETACH);
|
||||
}
|
||||
|
||||
/* Call the Entrypoint */
|
||||
|
@ -1009,7 +1012,8 @@ LdrShutdownProcess(VOID)
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Do nothing */
|
||||
DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_PROCESS_DETACH) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -1034,7 +1038,7 @@ LdrShutdownProcess(VOID)
|
|||
_SEH2_TRY
|
||||
{
|
||||
/* Do TLS callbacks */
|
||||
LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_PROCESS_DETACH);
|
||||
LdrpCallTlsInitializers(LdrpImageEntry, DLL_PROCESS_DETACH);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
@ -1123,7 +1127,7 @@ LdrShutdownThread(VOID)
|
|||
if (!LdrpShutdownInProgress)
|
||||
{
|
||||
/* Call TLS */
|
||||
LdrpCallTlsInitializers(LdrEntry->DllBase, DLL_THREAD_DETACH);
|
||||
LdrpCallTlsInitializers(LdrEntry, DLL_THREAD_DETACH);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1141,7 +1145,8 @@ LdrShutdownThread(VOID)
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Do nothing */
|
||||
DPRINT1("WARNING: Exception 0x%x during LdrpCallInitRoutine(DLL_THREAD_DETACH) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
|
||||
|
@ -1167,7 +1172,7 @@ LdrShutdownThread(VOID)
|
|||
_SEH2_TRY
|
||||
{
|
||||
/* Do TLS callbacks */
|
||||
LdrpCallTlsInitializers(Peb->ImageBaseAddress, DLL_THREAD_DETACH);
|
||||
LdrpCallTlsInitializers(LdrpImageEntry, DLL_THREAD_DETACH);
|
||||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
|
|
|
@ -470,7 +470,7 @@ LdrpUpdateLoadCount2(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
|||
|
||||
VOID
|
||||
NTAPI
|
||||
LdrpCallTlsInitializers(IN PVOID BaseAddress,
|
||||
LdrpCallTlsInitializers(IN PLDR_DATA_TABLE_ENTRY LdrEntry,
|
||||
IN ULONG Reason)
|
||||
{
|
||||
PIMAGE_TLS_DIRECTORY TlsDirectory;
|
||||
|
@ -478,7 +478,7 @@ LdrpCallTlsInitializers(IN PVOID BaseAddress,
|
|||
ULONG Size;
|
||||
|
||||
/* Get the TLS Directory */
|
||||
TlsDirectory = RtlImageDirectoryEntryToData(BaseAddress,
|
||||
TlsDirectory = RtlImageDirectoryEntryToData(LdrEntry->DllBase,
|
||||
TRUE,
|
||||
IMAGE_DIRECTORY_ENTRY_TLS,
|
||||
&Size);
|
||||
|
@ -497,7 +497,7 @@ LdrpCallTlsInitializers(IN PVOID BaseAddress,
|
|||
if (ShowSnaps)
|
||||
{
|
||||
DPRINT1("LDR: Tls Callbacks Found. Imagebase %p Tls %p CallBacks %p\n",
|
||||
BaseAddress, TlsDirectory, Array);
|
||||
LdrEntry->DllBase, TlsDirectory, Array);
|
||||
}
|
||||
|
||||
/* Loop the array */
|
||||
|
@ -510,12 +510,12 @@ LdrpCallTlsInitializers(IN PVOID BaseAddress,
|
|||
if (ShowSnaps)
|
||||
{
|
||||
DPRINT1("LDR: Calling Tls Callback Imagebase %p Function %p\n",
|
||||
BaseAddress, Callback);
|
||||
LdrEntry->DllBase, Callback);
|
||||
}
|
||||
|
||||
/* Call it */
|
||||
LdrpCallInitRoutine((PDLL_INIT_ROUTINE)Callback,
|
||||
BaseAddress,
|
||||
LdrEntry->DllBase,
|
||||
Reason,
|
||||
NULL);
|
||||
}
|
||||
|
@ -524,7 +524,8 @@ LdrpCallTlsInitializers(IN PVOID BaseAddress,
|
|||
}
|
||||
_SEH2_EXCEPT(EXCEPTION_EXECUTE_HANDLER)
|
||||
{
|
||||
/* Do nothing */
|
||||
DPRINT1("LDR: Exception 0x%x during Tls Callback(%u) for %wZ\n",
|
||||
_SEH2_GetExceptionCode(), Reason, &LdrEntry->BaseDllName);
|
||||
}
|
||||
_SEH2_END;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue