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
diff --git a/win/rfb_win32/Service.cxx b/win/rfb_win32/Service.cxx
index 982a5b3..89be92e 100644
--- a/win/rfb_win32/Service.cxx
+++ b/win/rfb_win32/Service.cxx
@@ -40,6 +40,7 @@
// - Internal service implementation functions
Service* service = 0;
+bool runAsService = false;
VOID WINAPI serviceHandler(DWORD control) {
switch (control) {
@@ -323,6 +324,13 @@
if (!osVersion.isPlatformNT)
return false;
+ if (osVersion.dwMajorVersion >= 6) {
+ rfb::win32::Handle sessionEventCad =
+ CreateEvent(0, FALSE, FALSE, "Global\\SessionEventTigerVNCCad");
+ SetEvent(sessionEventCad);
+ return true;
+ }
+
CADThread* cad_thread = new CADThread();
vlog.debug("emulate Ctrl-Alt-Del");
if (cad_thread) {
@@ -641,5 +649,5 @@
bool rfb::win32::isServiceProcess() {
- return service != 0;
+ return runAsService;
}