From 7b888e6f124b35725b1c4d70ffb8e2bf858e490e Mon Sep 17 00:00:00 2001 From: Johannes Anderwald Date: Mon, 3 Jul 2006 19:25:48 +0000 Subject: [PATCH] * 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 svn path=/trunk/; revision=22801 --- reactos/subsystems/win32/win32k/ntuser/menu.c | 33 ++++++++++++------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/reactos/subsystems/win32/win32k/ntuser/menu.c b/reactos/subsystems/win32/win32k/ntuser/menu.c index a92ad933e17..0a713370def 100644 --- a/reactos/subsystems/win32/win32k/ntuser/menu.c +++ b/reactos/subsystems/win32/win32k/ntuser/menu.c @@ -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) {