[CSRSRV] Protect the Server DLL entrypoint calls under SEH.

This commit is contained in:
Hermès Bélusca-Maïto 2020-04-14 22:58:22 +02:00
parent 835f3ef13d
commit dd77ac67d0
No known key found for this signature in database
GPG Key ID: 3B2539C65E7B93D0

View File

@ -205,6 +205,9 @@ CsrLoadServerDll(IN PCHAR DllString,
else
{
/* No handle, so we are loading ourselves */
#ifdef CSR_DBG
RtlInitAnsiString(&EntryPointString, "CsrServerDllInitialization");
#endif
ServerDllInitProcedure = CsrServerDllInitialization;
Status = STATUS_SUCCESS;
}
@ -212,8 +215,21 @@ CsrLoadServerDll(IN PCHAR DllString,
/* Check if we got the pointer, and call it */
if (NT_SUCCESS(Status))
{
/* Get the result from the Server DLL */
Status = ServerDllInitProcedure(ServerDll);
/* Call the Server DLL entrypoint */
_SEH2_TRY
{
Status = ServerDllInitProcedure(ServerDll);
}
_SEH2_EXCEPT(CsrUnhandledExceptionFilter(_SEH2_GetExceptionInformation()))
{
Status = _SEH2_GetExceptionCode();
#ifdef CSR_DBG
DPRINT1("CSRSS: Exception 0x%lx while calling Server DLL entrypoint %Z!%Z()\n",
Status, &DllName, &EntryPointString);
#endif
}
_SEH2_END;
if (NT_SUCCESS(Status))
{
/*