Author: hbelusca
Date: Thu May 30 00:50:03 2013
New Revision: 59112

URL: http://svn.reactos.org/svn/reactos?rev=59112&view=rev
Log:
[KERNEL32-CONSRV]
- Implement ConsoleMenuControl; see 
http://undoc.airesoft.co.uk/kernel32.dll/ConsoleMenuControl.php for more 
information.
- Implement SetConsoleMenuClose; see 
http://www.mail-archive.com/harbour@harbour-project.org/msg27509.html (or 
http://harbour-devel.1590103.n2.nabble.com/Question-about-hb-gt-win-CtrlHandler-usage-td4670862i20.html
 ) for more information.

[CONSRV]
Remove two unneeded DPRINTs.

Modified:
    trunk/reactos/dll/win32/kernel32/client/console/console.c
    trunk/reactos/include/psdk/wincon.h
    trunk/reactos/include/reactos/subsys/win/conmsg.h
    trunk/reactos/win32ss/user/consrv/api.h
    trunk/reactos/win32ss/user/consrv/conio.h
    trunk/reactos/win32ss/user/consrv/console.c
    trunk/reactos/win32ss/user/consrv/frontends/gui/guisettings.h
    trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c
    trunk/reactos/win32ss/user/consrv/frontends/tui/tuiterm.c
    trunk/reactos/win32ss/user/consrv/include/conio.h
    trunk/reactos/win32ss/user/consrv/init.c

Modified: trunk/reactos/dll/win32/kernel32/client/console/console.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/kernel32/client/console/console.c?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/dll/win32/kernel32/client/console/console.c   [iso-8859-1] 
(original)
+++ trunk/reactos/dll/win32/kernel32/client/console/console.c   [iso-8859-1] 
Thu May 30 00:50:03 2013
@@ -240,17 +240,29 @@
 
 
 /*
- * @unimplemented (Undocumented)
- */
-BOOL
-WINAPI
-ConsoleMenuControl(HANDLE hConsole,
-                   DWORD Unknown1,
-                   DWORD Unknown2)
-{
-    DPRINT1("ConsoleMenuControl(0x%x, 0x%x, 0x%x) UNIMPLEMENTED!\n", hConsole, 
Unknown1, Unknown2);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+ * @implemented (Undocumented)
+ * @note See http://undoc.airesoft.co.uk/kernel32.dll/ConsoleMenuControl.php
+ */
+HMENU
+WINAPI
+ConsoleMenuControl(HANDLE hConsoleOutput,
+                   DWORD dwCmdIdLow,
+                   DWORD dwCmdIdHigh)
+{
+    CONSOLE_API_MESSAGE ApiMessage;
+    PCONSOLE_MENUCONTROL MenuControlRequest = 
&ApiMessage.Data.MenuControlRequest;
+
+    MenuControlRequest->OutputHandle = hConsoleOutput;
+    MenuControlRequest->dwCmdIdLow   = dwCmdIdLow;
+    MenuControlRequest->dwCmdIdHigh  = dwCmdIdHigh;
+    MenuControlRequest->hMenu        = NULL;
+
+    CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+                        NULL,
+                        CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, 
ConsolepMenuControl),
+                        sizeof(CONSOLE_MENUCONTROL));
+
+    return MenuControlRequest->hMenu;
 }
 
 
@@ -654,15 +666,29 @@
 
 
 /*
- * @unimplemented (Undocumented)
- */
-BOOL
-WINAPI
-SetConsoleMenuClose(DWORD Unknown0)
-{
-    DPRINT1("SetConsoleMenuClose(0x%x) UNIMPLEMENTED!\n", Unknown0);
-    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
-    return FALSE;
+ * @implemented (Undocumented)
+ */
+BOOL
+WINAPI
+SetConsoleMenuClose(BOOL bEnable)
+{
+    NTSTATUS Status;
+    CONSOLE_API_MESSAGE ApiMessage;
+    PCONSOLE_SETMENUCLOSE SetMenuCloseRequest = 
&ApiMessage.Data.SetMenuCloseRequest;
+
+    SetMenuCloseRequest->Enable = bEnable;
+
+    Status = CsrClientCallServer((PCSR_API_MESSAGE)&ApiMessage,
+                                 NULL,
+                                 CSR_CREATE_API_NUMBER(CONSRV_SERVERDLL_INDEX, 
ConsolepSetMenuClose),
+                                 sizeof(CONSOLE_SETMENUCLOSE));
+    if (!NT_SUCCESS(Status))
+    {
+        BaseSetLastNTError(Status);
+        return FALSE;
+    }
+
+    return TRUE;
 }
 
 

Modified: trunk/reactos/include/psdk/wincon.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/psdk/wincon.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/include/psdk/wincon.h [iso-8859-1] (original)
+++ trunk/reactos/include/psdk/wincon.h [iso-8859-1] Thu May 30 00:50:03 2013
@@ -451,6 +451,12 @@
 BOOL WINAPI SetConsoleTitleA(_In_ LPCSTR);
 BOOL WINAPI SetConsoleTitleW(_In_ LPCWSTR);
 BOOL WINAPI SetConsoleWindowInfo(_In_ HANDLE, _In_ BOOL, _In_ const 
SMALL_RECT*);
+
+/* Undocumented, see 
http://undoc.airesoft.co.uk/kernel32.dll/ConsoleMenuControl.php */
+HMENU WINAPI ConsoleMenuControl(_In_ HANDLE, _In_ DWORD, _In_ DWORD);
+/* Undocumented */
+BOOL WINAPI SetConsoleMenuClose(_In_ BOOL);
+
 BOOL WINAPI WriteConsoleA(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
 BOOL WINAPI WriteConsoleW(HANDLE,CONST VOID*,DWORD,LPDWORD,LPVOID);
 

Modified: trunk/reactos/include/reactos/subsys/win/conmsg.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/include/reactos/subsys/win/conmsg.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/include/reactos/subsys/win/conmsg.h   [iso-8859-1] (original)
+++ trunk/reactos/include/reactos/subsys/win/conmsg.h   [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -64,7 +64,7 @@
     // ConsolepVDMOperation,
     // ConsolepSetCursor,
     // ConsolepShowCursor,
-    // ConsolepMenuControl,
+    ConsolepMenuControl,
     // ConsolepSetPalette,
     ConsolepSetDisplayMode,
     // ConsolepRegisterVDM,
@@ -85,7 +85,7 @@
     ConsolepGetCP,
     ConsolepSetCP,
     // ConsolepSetKeyShortcuts,
-    // ConsolepSetMenuClose,
+    ConsolepSetMenuClose,
     // ConsolepNotifyLastClose,
     ConsolepGenerateCtrlEvent,
     // ConsolepGetKeyboardLayoutName,
@@ -472,6 +472,19 @@
 typedef struct
 {
     HANDLE OutputHandle;
+    DWORD  dwCmdIdLow;
+    DWORD  dwCmdIdHigh;
+    HMENU  hMenu;
+} CONSOLE_MENUCONTROL, *PCONSOLE_MENUCONTROL;
+
+typedef struct
+{
+    BOOL Enable;
+} CONSOLE_SETMENUCLOSE, *PCONSOLE_SETMENUCLOSE;
+
+typedef struct
+{
+    HANDLE OutputHandle;
     BOOL   Absolute;
     SMALL_RECT WindowRect; // New console window position in the screen-buffer 
frame (Absolute == TRUE)
                            // or in the old window position frame (Absolute == 
FALSE).
@@ -479,12 +492,12 @@
 
 typedef struct
 {
-    HWND    WindowHandle;
+    HWND WindowHandle;
 } CONSOLE_GETWINDOW, *PCONSOLE_GETWINDOW;
 
 typedef struct
 {
-    HICON   WindowIcon;
+    HICON WindowIcon;
 } CONSOLE_SETICON, *PCONSOLE_SETICON;
 
 
@@ -637,6 +650,8 @@
         CONSOLE_INVALIDATEDIBITS InvalidateDIBitsRequest;
         CONSOLE_GETSETCONSOLETITLE TitleRequest;
         CONSOLE_GETLARGESTWINDOWSIZE GetLargestWindowSizeRequest;
+        CONSOLE_MENUCONTROL MenuControlRequest;
+        CONSOLE_SETMENUCLOSE SetMenuCloseRequest;
         CONSOLE_SETWINDOWINFO SetWindowInfoRequest;
         CONSOLE_GETWINDOW GetWindowRequest;
         CONSOLE_SETICON SetIconRequest;

Modified: trunk/reactos/win32ss/user/consrv/api.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/api.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/api.h     [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/api.h     [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -54,6 +54,8 @@
 CSR_API(SrvGetConsoleDisplayMode);
 CSR_API(SrvSetConsoleDisplayMode);
 CSR_API(SrvGetLargestConsoleWindowSize);
+CSR_API(SrvConsoleMenuControl);
+CSR_API(SrvSetConsoleMenuClose);
 CSR_API(SrvSetConsoleWindowInfo);
 CSR_API(SrvGetConsoleWindow);
 CSR_API(SrvSetConsoleIcon);

Modified: trunk/reactos/win32ss/user/consrv/conio.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/conio.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/conio.h   [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/conio.h   [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -40,5 +40,9 @@
     (Console)->TermIFace.Vtbl->GetDisplayMode(Console)
 #define ConioSetDisplayMode(Console, NewMode) \
     (Console)->TermIFace.Vtbl->SetDisplayMode((Console), (NewMode))
+#define ConioMenuControl(Console, CmdIdLow, CmdIdHigh) \
+    (Console)->TermIFace.Vtbl->MenuControl((Console), (CmdIdLow), (CmdIdHigh))
+#define ConioSetMenuClose(Console, Enable) \
+    (Console)->TermIFace.Vtbl->SetMenuClose((Console), (Enable))
 
 /* EOF */

Modified: trunk/reactos/win32ss/user/consrv/console.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/console.c?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/console.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/console.c [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -1339,11 +1339,7 @@
 
     Status = 
ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
                               &Console, TRUE);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Failed to get console handle in SrvGetConsoleDisplayMode\n");
-        return Status;
-    }
+    if (!NT_SUCCESS(Status)) return Status;
 
     GetDisplayModeRequest->DisplayMode = ConioGetDisplayMode(Console);
 
@@ -1363,11 +1359,7 @@
                                    &Buff,
                                    GENERIC_WRITE,
                                    TRUE);
-    if (!NT_SUCCESS(Status))
-    {
-        DPRINT1("Failed to get console handle in SrvSetConsoleDisplayMode\n");
-        return Status;
-    }
+    if (!NT_SUCCESS(Status)) return Status;
 
     Console = Buff->Header.Console;
 
@@ -1404,6 +1396,47 @@
 
     ConSrvReleaseScreenBuffer(Buff, TRUE);
     return STATUS_SUCCESS;
+}
+
+CSR_API(SrvConsoleMenuControl)
+{
+    NTSTATUS Status;
+    PCONSOLE_MENUCONTROL MenuControlRequest = 
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.MenuControlRequest;
+    PCONSOLE Console;
+    PCONSOLE_SCREEN_BUFFER Buff;
+
+    Status = 
ConSrvGetScreenBuffer(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+                                   MenuControlRequest->OutputHandle,
+                                   &Buff,
+                                   GENERIC_WRITE,
+                                   TRUE);
+    if (!NT_SUCCESS(Status)) return Status;
+
+    Console = Buff->Header.Console;
+
+    MenuControlRequest->hMenu = ConioMenuControl(Console,
+                                                 
MenuControlRequest->dwCmdIdLow,
+                                                 
MenuControlRequest->dwCmdIdHigh);
+
+    ConSrvReleaseScreenBuffer(Buff, TRUE);
+    return STATUS_SUCCESS;
+}
+
+CSR_API(SrvSetConsoleMenuClose)
+{
+    NTSTATUS Status;
+    BOOL Success;
+    PCONSOLE_SETMENUCLOSE SetMenuCloseRequest = 
&((PCONSOLE_API_MESSAGE)ApiMessage)->Data.SetMenuCloseRequest;
+    PCONSOLE Console;
+
+    Status = 
ConSrvGetConsole(ConsoleGetPerProcessData(CsrGetClientThread()->Process),
+                              &Console, TRUE);
+    if (!NT_SUCCESS(Status)) return Status;
+
+    Success = ConioSetMenuClose(Console, SetMenuCloseRequest->Enable);
+
+    ConSrvReleaseConsole(Console, TRUE);
+    return (Success ? STATUS_SUCCESS : STATUS_UNSUCCESSFUL);
 }
 
 CSR_API(SrvSetConsoleWindowInfo)

Modified: trunk/reactos/win32ss/user/consrv/frontends/gui/guisettings.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/frontends/gui/guisettings.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontends/gui/guisettings.h       
[iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/frontends/gui/guisettings.h       
[iso-8859-1] Thu May 30 00:50:03 2013
@@ -48,6 +48,11 @@
     HICON hIcon;                /* Handle to the console's icon (big)   */
     HICON hIconSm;              /* Handle to the console's icon (small) */
     BOOL IgnoreNextMouseSignal; /* Used in cases where we don't want to treat 
a mouse signal */
+
+    BOOL IsCloseButtonEnabled;  /* TRUE if the Close button and the 
corresponding system menu item are enabled, FALSE otherwise */
+    UINT cmdIdLow ;             /* Lowest menu id of the user-reserved menu id 
range */
+    UINT cmdIdHigh;             /* Highest menu id of the user-reserved menu 
id range */
+
 //  COLORREF Colors[16];
 
 //  PVOID   ScreenBuffer;       /* Hardware screen buffer */

Modified: trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c   [iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/user/consrv/frontends/gui/guiterm.c   [iso-8859-1] 
Thu May 30 00:50:03 2013
@@ -83,21 +83,21 @@
 
 static const GUICONSOLE_MENUITEM GuiConsoleEditMenuItems[] =
 {
-    { IDS_MARK, NULL, ID_SYSTEM_EDIT_MARK },
-    { IDS_COPY, NULL, ID_SYSTEM_EDIT_COPY },
-    { IDS_PASTE, NULL, ID_SYSTEM_EDIT_PASTE },
-    { IDS_SELECTALL, NULL, ID_SYSTEM_EDIT_SELECTALL },
-    { IDS_SCROLL, NULL, ID_SYSTEM_EDIT_SCROLL },
-    { IDS_FIND, NULL, ID_SYSTEM_EDIT_FIND },
+    { IDS_MARK,         NULL, ID_SYSTEM_EDIT_MARK       },
+    { IDS_COPY,         NULL, ID_SYSTEM_EDIT_COPY       },
+    { IDS_PASTE,        NULL, ID_SYSTEM_EDIT_PASTE      },
+    { IDS_SELECTALL,    NULL, ID_SYSTEM_EDIT_SELECTALL  },
+    { IDS_SCROLL,       NULL, ID_SYSTEM_EDIT_SCROLL     },
+    { IDS_FIND,         NULL, ID_SYSTEM_EDIT_FIND       },
 
     { 0, NULL, 0 } /* End of list */
 };
 
 static const GUICONSOLE_MENUITEM GuiConsoleMainMenuItems[] =
 {
-    { IDS_EDIT, GuiConsoleEditMenuItems, 0 },
-    { IDS_DEFAULTS, NULL, ID_SYSTEM_DEFAULTS },
-    { IDS_PROPERTIES, NULL, ID_SYSTEM_PROPERTIES },
+    { IDS_EDIT,         GuiConsoleEditMenuItems, 0 },
+    { IDS_DEFAULTS,     NULL, ID_SYSTEM_DEFAULTS   },
+    { IDS_PROPERTIES,   NULL, ID_SYSTEM_PROPERTIES },
 
     { 0, NULL, 0 } /* End of list */
 };
@@ -186,8 +186,7 @@
 static VOID
 GuiConsoleCreateSysMenu(HWND hWnd)
 {
-    HMENU hMenu;
-    hMenu = GetSystemMenu(hWnd, FALSE);
+    HMENU hMenu = GetSystemMenu(hWnd, FALSE);
     if (hMenu != NULL)
     {
         GuiConsoleAppendMenuItems(hMenu, GuiConsoleMainMenuItems);
@@ -195,6 +194,16 @@
     }
 }
 
+static VOID
+GuiSendMenuEvent(PCONSOLE Console, UINT CmdId)
+{
+    INPUT_RECORD er;
+
+    er.EventType = MENU_EVENT;
+    er.Event.MenuEvent.dwCommandId = CmdId;
+
+    ConioProcessInputEvent(Console, &er);
+}
 
 static VOID
 GuiConsoleCopy(PGUI_CONSOLE_DATA GuiData);
@@ -222,6 +231,18 @@
     }
     ActiveBuffer = Console->ActiveBuffer;
 
+    /*
+     * In case the selected menu item belongs to the user-reserved menu id 
range,
+     * send to him a menu event and return directly. The user must handle those
+     * reserved menu commands...
+     */
+    if (GuiData->cmdIdLow <= (UINT)wParam && (UINT)wParam <= 
GuiData->cmdIdHigh)
+    {
+        GuiSendMenuEvent(Console, (UINT)wParam);
+        goto Unlock_Quit;
+    }
+
+    /* ... otherwise, perform actions. */
     switch (wParam)
     {
         case ID_SYSTEM_EDIT_MARK:
@@ -284,8 +305,8 @@
             break;
     }
 
+Unlock_Quit:
     LeaveCriticalSection(&Console->Lock);
-
 Quit:
     if (!Ret)
         Ret = DefWindowProcW(GuiData->hWindow, WM_SYSCOMMAND, wParam, lParam);
@@ -1570,9 +1591,11 @@
     if (GuiData == NULL) return 0;
 
     /*
-     * Each helper function which needs the console
-     * has to validate and lock it.
+     * Just retrieve a pointer to the console in case somebody needs it.
+     * It is not NULL because it was checked in GuiGetGuiData.
+     * Each helper function which needs the console has to validate and lock 
it.
      */
+    Console = GuiData->Console;
 
     /* We have a console, start message dispatching */
     switch (msg)
@@ -1683,6 +1706,36 @@
             }
         }
 
+        case WM_INITMENU:
+        {
+            HMENU hMenu = (HMENU)wParam;
+            if (hMenu != NULL)
+            {
+                /* Enables or disables the Close menu item */
+                EnableMenuItem(hMenu, SC_CLOSE, MF_BYCOMMAND | 
(GuiData->IsCloseButtonEnabled ? MF_ENABLED : MF_GRAYED));
+            }
+
+            if (ConSrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
+            {
+                GuiSendMenuEvent(Console, WM_INITMENU);
+                LeaveCriticalSection(&Console->Lock);
+            }
+            break;
+        }
+
+        case WM_MENUSELECT:
+        {
+            if (HIWORD(wParam) == 0xFFFF) // Allow all the menu flags
+            {
+                if (ConSrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, 
TRUE))
+                {
+                    GuiSendMenuEvent(Console, WM_MENUSELECT);
+                    LeaveCriticalSection(&Console->Lock);
+                }
+            }
+            break;
+        }
+
         case WM_COMMAND:
         case WM_SYSCOMMAND:
         {
@@ -1693,7 +1746,6 @@
         case WM_SETFOCUS:
         case WM_KILLFOCUS:
         {
-            Console = GuiData->Console; // Not NULL because checked in 
GuiGetGuiData.
             if (ConSrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
             {
                 INPUT_RECORD er;
@@ -1730,7 +1782,6 @@
 
         case PM_APPLY_CONSOLE_INFO:
         {
-            Console = GuiData->Console; // Not NULL because checked in 
GuiGetGuiData.
             if (ConSrvValidateConsoleUnsafe(Console, CONSOLE_RUNNING, TRUE))
             {
                 GuiApplyUserSettings(GuiData, (HANDLE)wParam, (BOOL)lParam);
@@ -2322,6 +2373,37 @@
     return TRUE;
 }
 
+static HMENU WINAPI
+GuiMenuControl(PCONSOLE Console, UINT cmdIdLow, UINT cmdIdHigh)
+{
+    PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
+
+    GuiData->cmdIdLow  = cmdIdLow ;
+    GuiData->cmdIdHigh = cmdIdHigh;
+
+    return GetSystemMenu(GuiData->hWindow, FALSE);
+}
+
+static BOOL WINAPI
+GuiSetMenuClose(PCONSOLE Console, BOOL Enable)
+{
+    /*
+     * NOTE: See 
http://www.mail-archive.com/harbour@harbour-project.org/msg27509.html
+     * or 
http://harbour-devel.1590103.n2.nabble.com/Question-about-hb-gt-win-CtrlHandler-usage-td4670862i20.html
+     * for more information.
+     */
+
+    PGUI_CONSOLE_DATA GuiData = Console->TermIFace.Data;
+    HMENU hSysMenu = GetSystemMenu(GuiData->hWindow, FALSE);
+
+    if (hSysMenu == NULL) return FALSE;
+
+    GuiData->IsCloseButtonEnabled = Enable;
+    EnableMenuItem(hSysMenu, SC_CLOSE, MF_BYCOMMAND | (Enable ? MF_ENABLED : 
MF_GRAYED));
+
+    return TRUE;
+}
+
 static FRONTEND_VTBL GuiVtbl =
 {
     GuiCleanupConsole,
@@ -2338,6 +2420,8 @@
     GuiGetLargestConsoleWindowSize,
     GuiGetDisplayMode,
     GuiSetDisplayMode,
+    GuiMenuControl,
+    GuiSetMenuClose,
 };
 
 NTSTATUS FASTCALL
@@ -2460,6 +2544,12 @@
         }
     }
 
+    /* Close button and the corresponding system menu item are enabled by 
default */
+    GuiData->IsCloseButtonEnabled = TRUE;
+
+    /* There is no user-reserved menu id range by default */
+    GuiData->cmdIdLow = GuiData->cmdIdHigh = 0;
+
     /*
      * We need to wait until the GUI has been fully initialized
      * to retrieve custom settings i.e. WindowSize etc...

Modified: trunk/reactos/win32ss/user/consrv/frontends/tui/tuiterm.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/frontends/tui/tuiterm.c?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/frontends/tui/tuiterm.c   [iso-8859-1] 
(original)
+++ trunk/reactos/win32ss/user/consrv/frontends/tui/tuiterm.c   [iso-8859-1] 
Thu May 30 00:50:03 2013
@@ -643,6 +643,18 @@
     return TRUE;
 }
 
+static HMENU WINAPI
+TuiMenuControl(PCONSOLE Console, UINT cmdIdLow, UINT cmdIdHigh)
+{
+    return NULL;
+}
+
+static BOOL WINAPI
+TuiSetMenuClose(PCONSOLE Console, BOOL Enable)
+{
+    return FALSE;
+}
+
 static FRONTEND_VTBL TuiVtbl =
 {
     TuiCleanupConsole,
@@ -659,6 +671,8 @@
     TuiGetLargestConsoleWindowSize,
     TuiGetDisplayMode,
     TuiSetDisplayMode,
+    TuiMenuControl,
+    TuiSetMenuClose,
 };
 
 NTSTATUS FASTCALL

Modified: trunk/reactos/win32ss/user/consrv/include/conio.h
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/include/conio.h?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/include/conio.h   [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/include/conio.h   [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -218,6 +218,11 @@
     ULONG (WINAPI *GetDisplayMode)(struct _CONSOLE* Console);
     BOOL  (WINAPI *SetDisplayMode)(struct _CONSOLE* Console,
                                    ULONG NewMode);
+    HMENU (WINAPI *MenuControl)(struct _CONSOLE* Console,
+                                UINT cmdIdLow,
+                                UINT cmdIdHigh);
+    BOOL  (WINAPI *SetMenuClose)(struct _CONSOLE* Console,
+                                 BOOL Enable);
 
 #if 0 // Possible future front-end interface
     BOOL (WINAPI *GetFrontEndProperty)(struct _CONSOLE* Console,

Modified: trunk/reactos/win32ss/user/consrv/init.c
URL: 
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/consrv/init.c?rev=59112&r1=59111&r2=59112&view=diff
==============================================================================
--- trunk/reactos/win32ss/user/consrv/init.c    [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/consrv/init.c    [iso-8859-1] Thu May 30 
00:50:03 2013
@@ -74,7 +74,7 @@
     // SrvVDMConsoleOperation,
     // SrvSetConsoleCursor,
     // SrvShowConsoleCursor,
-    // SrvConsoleMenuControl,
+    SrvConsoleMenuControl,
     // SrvSetConsolePalette,
     SrvSetConsoleDisplayMode,
     // SrvRegisterConsoleVDM,
@@ -95,7 +95,7 @@
     SrvGetConsoleCP,
     SrvSetConsoleCP,
     // SrvSetConsoleKeyShortcuts,
-    // SrvSetConsoleMenuClose,
+    SrvSetConsoleMenuClose,
     // SrvConsoleNotifyLastClose,
     SrvGenerateConsoleCtrlEvent,
     // SrvGetConsoleKeyboardLayoutName,
@@ -165,7 +165,7 @@
     // FALSE,   // SrvVDMConsoleOperation,
     // FALSE,   // SrvSetConsoleCursor,
     // FALSE,   // SrvShowConsoleCursor,
-    // FALSE,   // SrvConsoleMenuControl,
+    FALSE,   // SrvConsoleMenuControl,
     // FALSE,   // SrvSetConsolePalette,
     FALSE,   // SrvSetConsoleDisplayMode,
     // FALSE,   // SrvRegisterConsoleVDM,
@@ -186,7 +186,7 @@
     FALSE,   // SrvGetConsoleCP,
     FALSE,   // SrvSetConsoleCP,
     // FALSE,   // SrvSetConsoleKeyShortcuts,
-    // FALSE,   // SrvSetConsoleMenuClose,
+    FALSE,   // SrvSetConsoleMenuClose,
     // FALSE,   // SrvConsoleNotifyLastClose,
     FALSE,   // SrvGenerateConsoleCtrlEvent,
     // FALSE,   // SrvGetConsoleKeyboardLayoutName,
@@ -256,7 +256,7 @@
     // "VDMConsoleOperation",
     // "SetConsoleCursor",
     // "ShowConsoleCursor",
-    // "ConsoleMenuControl",
+    "ConsoleMenuControl",
     // "SetConsolePalette",
     "SetConsoleDisplayMode",
     // "RegisterConsoleVDM",
@@ -277,7 +277,7 @@
     "GetConsoleCP",
     "SetConsoleCP",
     // "SetConsoleKeyShortcuts",
-    // "SetConsoleMenuClose",
+    "SetConsoleMenuClose",
     // "ConsoleNotifyLastClose",
     "GenerateConsoleCtrlEvent",
     // "GetConsoleKeyboardLayoutName",


Reply via email to