From: VMware, Inc <> Date: Mon, 20 Dec 2010 22:13:46 +0000 (-0800) Subject: Changes in shared code that don't affect open-vm-tools functionality. X-Git-Tag: 2010.12.19-339835~19 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=098fc22fdbf225ba0722e5a1b217e5826b03d175;p=thirdparty%2Fopen-vm-tools.git Changes in shared code that don't affect open-vm-tools functionality. Signed-off-by: Marcelo Vanzin --- diff --git a/open-vm-tools/services/vmtoolsd/cmdLine.c b/open-vm-tools/services/vmtoolsd/cmdLine.c index fe0969d22..e0f51a9f9 100644 --- a/open-vm-tools/services/vmtoolsd/cmdLine.c +++ b/open-vm-tools/services/vmtoolsd/cmdLine.c @@ -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; } diff --git a/open-vm-tools/services/vmtoolsd/toolsCoreInt.h b/open-vm-tools/services/vmtoolsd/toolsCoreInt.h index 872827cd5..1b8279fa5 100644 --- a/open-vm-tools/services/vmtoolsd/toolsCoreInt.h +++ b/open-vm-tools/services/vmtoolsd/toolsCoreInt.h @@ -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"... */