]> git.ipfire.org Git - thirdparty/open-vm-tools.git/commitdiff
Changes in shared code that don't affect open-vm-tools functionality.
authorVMware, Inc <>
Mon, 20 Dec 2010 22:13:46 +0000 (14:13 -0800)
committerMarcelo Vanzin <mvanzin@vmware.com>
Mon, 20 Dec 2010 22:13:46 +0000 (14:13 -0800)
Signed-off-by: Marcelo Vanzin <mvanzin@vmware.com>
open-vm-tools/services/vmtoolsd/cmdLine.c
open-vm-tools/services/vmtoolsd/toolsCoreInt.h

index fe0969d2214815473789c04a3657a5e287b55ca5..e0f51a9f96f75d10b38654a7dbe603e387d87436 100644 (file)
@@ -109,7 +109,9 @@ ToolsCoreIgnoreArg(const gchar *option,
 
 
 /**
- * Signals a specific event in a running service instance.
+ * Signals a specific event in a running service instance. Since this function
+ * doesn't know whether the service is running through the SCM, it first tries
+ * to open a local event, and if that fails, tries a global event.
  *
  * @param[in]  svcname     Name of the service to be signaled.
  * @param[in]  evtFmt      Format string for the event name. It should expect
@@ -129,7 +131,19 @@ ToolsCoreSignalEvent(const gchar *svcname,
 
    ASSERT(svcname != NULL);
 
-   evt = Str_Aswprintf(NULL, evtFmt, svcname);
+   evt = Str_Aswprintf(NULL, evtFmt, L"Local", svcname);
+   if (evt == NULL) {
+      g_printerr("Out of memory!\n");
+      goto exit;
+   }
+
+   h = OpenEvent(EVENT_MODIFY_STATE, FALSE, evt);
+   if (h != NULL) {
+      goto dispatch;
+   }
+
+   vm_free(evt);
+   evt = Str_Aswprintf(NULL, evtFmt, L"Global", svcname);
    if (evt == NULL) {
       g_printerr("Out of memory!\n");
       goto exit;
@@ -140,6 +154,7 @@ ToolsCoreSignalEvent(const gchar *svcname,
       goto error;
    }
 
+dispatch:
    if (!SetEvent(h)) {
       goto error;
    }
index 872827cd51999e142ccf2d7fcaf5dedd2a354d19..1b8279fa57c5beac526a95e4614e52fea51d44d0 100644 (file)
@@ -37,8 +37,8 @@
 
 /* Used by the Windows implementation to communicate with other processes. */
 #if defined(G_PLATFORM_WIN32)
-#  define QUIT_EVENT_NAME_FMT         L"Global\\VMwareToolsQuitEvent_%s"
-#  define DUMP_STATE_EVENT_NAME_FMT   L"Global\\VMwareToolsDumpStateEvent_%s"
+#  define QUIT_EVENT_NAME_FMT         L"%S\\VMwareToolsQuitEvent_%s"
+#  define DUMP_STATE_EVENT_NAME_FMT   L"%S\\VMwareToolsDumpStateEvent_%s"
 #endif
 
 /* On Mac OS, G_MODULE_SUFFIX seems to be defined to "so"... */