19 #ifndef _VMWARE_TOOLS_PLUGIN_H_ 20 #define _VMWARE_TOOLS_PLUGIN_H_ 45 #if defined(G_PLATFORM_WIN32) 49 #include "vmware/guestrpc/capabilities.h" 61 #define VMTOOLSAPP_ERROR(ctx, err) do { \ 63 (ctx)->errorCode = (err); \ 64 g_main_loop_quit((ctx)->mainLoop); \ 77 #define VMTOOLSAPP_ATTACH_SOURCE(ctx, src, cb, data, destroy) do { \ 78 GSource *__src = (src); \ 79 g_source_set_callback(__src, (GSourceFunc) (cb), (data), (destroy)); \ 80 g_source_attach(__src, g_main_loop_get_context((ctx)->mainLoop)); \ 87 #define TOOLS_IS_MAIN_SERVICE(ctx) (strcmp((ctx)->name, \ 88 VMTOOLS_GUEST_SERVICE) == 0) 94 #define TOOLS_IS_USER_SERVICE(ctx) (strcmp((ctx)->name, \ 95 VMTOOLS_USER_SERVICE) == 0) 98 #define TOOLS_STATE_LOG_ROOT 0 99 #define TOOLS_STATE_LOG_CONTAINER 1 100 #define TOOLS_STATE_LOG_PLUGIN 2 113 ToolsCore_LogState(guint level,
117 gchar *indented = g_strdup_printf(
"%*s%s", 3 * level,
"", fmt);
121 g_logv(
"state", G_LOG_LEVEL_INFO, indented, args);
139 #define TOOLS_CORE_SIG_CAPABILITIES "tcs_capabilities" 148 #define TOOLS_CORE_SIG_CONF_RELOAD "tcs_conf_reload" 159 #define TOOLS_CORE_SIG_DUMP_STATE "tcs_dump_state" 168 #define TOOLS_CORE_SIG_RESET "tcs_reset" 177 #define TOOLS_CORE_SIG_NO_RPC "tcs_no_rpc" 191 #define TOOLS_CORE_SIG_SET_OPTION "tcs_set_option" 200 #define TOOLS_CORE_SIG_SHUTDOWN "tcs_shutdown" 202 #if defined(G_PLATFORM_WIN32) 230 #define TOOLS_CORE_SIG_SERVICE_CONTROL "tcs_service_control" 241 #define TOOLS_CORE_PROP_CTX "tcs_app_ctx" 249 #define TOOLS_CORE_EVENTS_TOOLS_NEW_VERSION "VMToolsNewVersion" 258 #define TOOLS_CORE_EVENTS_TOOLS_NEED_REBOOT "VMToolsNeedReboot" 260 #define TOOLS_CORE_EVENTS_GLOBAL_SCOPE "Global" 274 TOOLS_CORE_API_V1 = 0x1,
309 #if defined(G_PLATFORM_WIN32) 311 gboolean comInitialized;
336 #if defined(G_PLATFORM_WIN32) 344 static inline gboolean
347 if (!ctx->comInitialized) {
348 HRESULT ret = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
349 ctx->comInitialized = SUCCEEDED(ret);
350 if (!ctx->comInitialized) {
351 g_log(ctx->
name, G_LOG_LEVEL_WARNING,
352 "COM initialization failed(0x%x)\n", ret);
355 return ctx->comInitialized;
365 TOOLS_CAP_OLD_NOVAL = 1,
541 const gchar *signame;
612 #if defined(G_PLATFORM_WIN32) 613 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __declspec(dllexport) 614 #elif defined(GCC_EXPLICIT_EXPORT) 615 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __attribute__((visibility("default"))) 617 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C