diff --git a/README.txt b/README.txt index b0d32a7..0b44ed4 100644 --- a/README.txt +++ b/README.txt @@ -681,6 +681,7 @@ and/or stderr which attempt to read from stdin would fail. Thanks to Czenda Czendov for help with Visual Studio 2013 and Server 2012R2. Thanks to Alessandro Gherardi for reporting and draft fix of the bug whereby the second restart of the application would have a corrupted environment. +Thanks to Hadrien Kohl for suggesting to disable the console window's menu. Licence ------- diff --git a/console.cpp b/console.cpp index 0c7afbe..66c99ea 100644 --- a/console.cpp +++ b/console.cpp @@ -48,6 +48,11 @@ void alloc_console(nssm_service_t *service) { AllocConsole(); + /* Disable accidental closure. */ + HWND window = GetConsoleWindow(); + HMENU menu = GetSystemMenu(window, false); + EnableMenuItem(menu, SC_CLOSE, MF_GRAYED); + /* Set a title like "[NSSM] Jenkins" */ TCHAR displayname[SERVICE_NAME_LENGTH]; unsigned long len = _countof(displayname);