[ros-diffs] [gadamopoulos] 55745: [win32k] - Peb->ProcessParameters->DesktopInfo must be probed and captured with SEH before used in win32k

gadamopoulos at svn.reactos.org gadamopoulos at svn.reactos.org
Mon Feb 20 10:51:07 UTC 2012


Author: gadamopoulos
Date: Mon Feb 20 10:51:07 2012
New Revision: 55745

URL: http://svn.reactos.org/svn/reactos?rev=55745&view=rev
Log:
[win32k]
- Peb->ProcessParameters->DesktopInfo must be probed and captured with SEH before used in win32k

Modified:
    trunk/reactos/subsystems/win32/win32k/main/dllmain.c

Modified: trunk/reactos/subsystems/win32/win32k/main/dllmain.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/main/dllmain.c?rev=55745&r1=55744&r2=55745&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] (original)
+++ trunk/reactos/subsystems/win32/win32k/main/dllmain.c [iso-8859-1] Mon Feb 20 10:51:07 2012
@@ -238,7 +238,7 @@
         HWINSTA hWinSta = NULL;
         PCLIENTINFO pci;
         HDESK hDesk = NULL;
-        PUNICODE_STRING DesktopPath;
+        UNICODE_STRING DesktopPath;
         PDESKTOP pdesk;
         PRTL_USER_PROCESS_PARAMETERS ProcessParams = Process->Peb->ProcessParameters;
 
@@ -297,11 +297,24 @@
              * inherit the thread desktop and process window station (if not yet inherited) from the process startup
              * info structure. See documentation of CreateProcess()
              */
-            DesktopPath = (ProcessParams ? ((ProcessParams->DesktopInfo.Length > 0) ? &ProcessParams->DesktopInfo : NULL) : NULL);
+            Status = STATUS_UNSUCCESSFUL;
+            if(ProcessParams && ProcessParams->DesktopInfo.Length > 0)
+            {
+                Status = IntSafeCopyUnicodeStringTerminateNULL(&DesktopPath, &ProcessParams->DesktopInfo);
+            }
+            if(!NT_SUCCESS(Status))
+            {
+                RtlInitUnicodeString(&DesktopPath, NULL);
+            }
+
             Status = IntParseDesktopPath(Process,
-                                         DesktopPath,
+                                         &DesktopPath,
                                          &hWinSta,
                                          &hDesk);
+
+            if (DesktopPath.Buffer)
+                ExFreePoolWithTag(DesktopPath.Buffer, TAG_STRING);
+
             if(!NT_SUCCESS(Status))
             {
                 ERR_CH(UserThread, "Failed to assign default dekstop and winsta to process\n");
@@ -545,6 +558,7 @@
     NT_ROF(InitKeyboardImpl());
     NT_ROF(MsqInitializeImpl());
     NT_ROF(InitTimerImpl());
+    NT_ROF(InitDCEImpl());
 
     /* Initialize FreeType library */
     if (!InitFontSupport())




More information about the Ros-diffs mailing list