From 60c419320d2229ace017d1f599b6ab0a7b9e2927 Mon Sep 17 00:00:00 2001 From: Samuel Mannehed Date: Fri, 7 Feb 2014 14:53:24 +0000 Subject: Make WinVNC service mode work on Windows Vista and beyond. Patch by Jochen Tucht, fixes bug 135. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5158 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- win/winvnc/VNCServerWin32.cxx | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'win/winvnc/VNCServerWin32.cxx') diff --git a/win/winvnc/VNCServerWin32.cxx b/win/winvnc/VNCServerWin32.cxx index 4d89a0ef..9d77c27c 100644 --- a/win/winvnc/VNCServerWin32.cxx +++ b/win/winvnc/VNCServerWin32.cxx @@ -55,6 +55,8 @@ static BoolParameter showTrayIcon("ShowTrayIcon", VNCServerWin32::VNCServerWin32() : command(NoCommand), commandSig(commandLock), commandEvent(CreateEvent(0, TRUE, FALSE, 0)), + sessionEvent(isServiceProcess() ? + CreateEvent(0, FALSE, FALSE, "Global\\SessionEventTigerVNC") : 0), vncServer(CStr(ComputerName().buf), &desktop), hostThread(0), runServer(false), isDesktopStarted(false), httpServer(&vncServer), config(&sockMgr), trayIcon(0), @@ -72,6 +74,8 @@ VNCServerWin32::VNCServerWin32() // Register the queued command event to be handled sockMgr.addEvent(commandEvent, this); + if (sessionEvent) + sockMgr.addEvent(sessionEvent, this); } VNCServerWin32::~VNCServerWin32() { @@ -322,6 +326,8 @@ void VNCServerWin32::processEvent(HANDLE event_) { command = NoCommand; commandSig.signal(); } + } else if (event_ == sessionEvent.h) { + stop(); } } -- cgit v1.2.3