[ros-diffs] [janderwald] 22801: * dont perform IntValidateWindowStationHandle in UserCreateMenu when current process is CsrProcess * this makes system menu for cmd.exe display * patch reviewed by w3seek and tested by me

janderwald at svn.reactos.org janderwald at svn.reactos.org
Mon Jul 3 21:25:49 CEST 2006


Author: janderwald
Date: Mon Jul  3 23:25:48 2006
New Revision: 22801

URL: http://svn.reactos.org/svn/reactos?rev=22801&view=rev
Log:
* dont perform IntValidateWindowStationHandle in UserCreateMenu when current process is CsrProcess
* this makes system menu for cmd.exe display
* patch reviewed by w3seek and tested by me

Modified:
    trunk/reactos/subsystems/win32/win32k/ntuser/menu.c

Modified: trunk/reactos/subsystems/win32/win32k/ntuser/menu.c
URL: http://svn.reactos.org/svn/reactos/trunk/reactos/subsystems/win32/win32k/ntuser/menu.c?rev=22801&r1=22800&r2=22801&view=diff
==============================================================================
--- trunk/reactos/subsystems/win32/win32k/ntuser/menu.c (original)
+++ trunk/reactos/subsystems/win32/win32k/ntuser/menu.c Mon Jul  3 23:25:48 2006
@@ -1397,27 +1397,38 @@
 {
    PWINSTATION_OBJECT WinStaObject;
    HANDLE Handle;
-
-   NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
+   NTSTATUS Status;
+   PEPROCESS CurrentProcess = PsGetCurrentProcess();
+
+   if (CsrProcess != CurrentProcess)
+   {
+      /*
+       * CsrProcess does not have a Win32WindowStation
+	   *
+	   */
+
+      Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
                      KernelMode,
                      0,
                      &WinStaObject);
 
-   if (!NT_SUCCESS(Status))
-   {
-      DPRINT("Validation of window station handle (0x%X) failed\n",
-             PsGetCurrentProcess()->Win32WindowStation);
-      SetLastNtError(Status);
-      return (HMENU)0;
-   }
-
-   IntCreateMenu(&Handle, !PopupMenu);
-
-   ObDereferenceObject(WinStaObject);
+       if (!NT_SUCCESS(Status))
+       {
+          DPRINT1("Validation of window station handle (0x%X) failed\n",
+             CurrentProcess->Win32WindowStation);
+          SetLastNtError(Status);
+          return (HMENU)0;
+       }
+       IntCreateMenu(&Handle, !PopupMenu);
+       ObDereferenceObject(WinStaObject);
+   }
+   else
+   {
+       IntCreateMenu(&Handle, !PopupMenu);
+   }
+
    return (HMENU)Handle;
 }
-
-
 
 HMENU STDCALL
 NtUserCreateMenu(BOOL PopupMenu)




More information about the Ros-diffs mailing list