https://git.reactos.org/?p=reactos.git;a=commitdiff;h=dd77ac67d0fa45f08885a9b511125268ae93860d

commit dd77ac67d0fa45f08885a9b511125268ae93860d
Author:     Hermès Bélusca-Maïto <[email protected]>
AuthorDate: Tue Apr 14 22:58:22 2020 +0200
Commit:     Hermès Bélusca-Maïto <[email protected]>
CommitDate: Wed Apr 15 02:06:58 2020 +0200

    [CSRSRV] Protect the Server DLL entrypoint calls under SEH.
---
 subsystems/win32/csrsrv/server.c | 20 ++++++++++++++++++--
 1 file changed, 18 insertions(+), 2 deletions(-)

diff --git a/subsystems/win32/csrsrv/server.c b/subsystems/win32/csrsrv/server.c
index c161bb4166b..4fa35367927 100644
--- a/subsystems/win32/csrsrv/server.c
+++ b/subsystems/win32/csrsrv/server.c
@@ -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))
         {
             /*

Reply via email to