* dont perform IntValidateWindowStationHandle in UserCreateMenu when current process...
authorJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 3 Jul 2006 19:25:48 +0000 (19:25 +0000)
committerJohannes Anderwald <johannes.anderwald@reactos.org>
Mon, 3 Jul 2006 19:25:48 +0000 (19:25 +0000)
* this makes system menu for cmd.exe display
* patch reviewed by w3seek and tested by me

svn path=/trunk/; revision=22801

reactos/subsystems/win32/win32k/ntuser/menu.c

index a92ad93..0a71337 100644 (file)
@@ -1397,28 +1397,39 @@ HMENU FASTCALL UserCreateMenu(BOOL PopupMenu)
 {
    PWINSTATION_OBJECT WinStaObject;
    HANDLE Handle;
+   NTSTATUS Status;
+   PEPROCESS CurrentProcess = PsGetCurrentProcess();
 
-   NTSTATUS Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
+   if (CsrProcess != CurrentProcess)
+   {
+      /*
+       * CsrProcess does not have a Win32WindowStation
+          *
+          */
+
+      Status = IntValidateWindowStationHandle(PsGetCurrentProcess()->Win32WindowStation,
                      KernelMode,
                      0,
                      &WinStaObject);
 
-   if (!NT_SUCCESS(Status))
+       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
    {
-      DPRINT("Validation of window station handle (0x%X) failed\n",
-             PsGetCurrentProcess()->Win32WindowStation);
-      SetLastNtError(Status);
-      return (HMENU)0;
+       IntCreateMenu(&Handle, !PopupMenu);
    }
 
-   IntCreateMenu(&Handle, !PopupMenu);
-
-   ObDereferenceObject(WinStaObject);
    return (HMENU)Handle;
 }
 
-
-
 HMENU STDCALL
 NtUserCreateMenu(BOOL PopupMenu)
 {