20 #ifndef _VMWARE_TOOLS_PLUGIN_H_ 21 #define _VMWARE_TOOLS_PLUGIN_H_ 46 #if defined(G_PLATFORM_WIN32) 50 #include "vmware/guestrpc/capabilities.h" 62 #define VMTOOLSAPP_ERROR(ctx, err) do { \ 64 (ctx)->errorCode = (err); \ 65 g_main_loop_quit((ctx)->mainLoop); \ 78 #define VMTOOLSAPP_ATTACH_SOURCE(ctx, src, cb, data, destroy) do { \ 79 GSource *__src = (src); \ 80 g_source_set_callback(__src, (GSourceFunc) (cb), (data), (destroy)); \ 81 g_source_attach(__src, g_main_loop_get_context((ctx)->mainLoop)); \ 88 #define TOOLS_IS_MAIN_SERVICE(ctx) (strcmp((ctx)->name, \ 89 VMTOOLS_GUEST_SERVICE) == 0) 95 #define TOOLS_IS_USER_SERVICE(ctx) (strcmp((ctx)->name, \ 96 VMTOOLS_USER_SERVICE) == 0) 99 #define TOOLS_STATE_LOG_ROOT 0 100 #define TOOLS_STATE_LOG_CONTAINER 1 101 #define TOOLS_STATE_LOG_PLUGIN 2 114 ToolsCore_LogState(guint level,
118 gchar *indented = g_strdup_printf(
"%*s%s", 3 * level,
"", fmt);
122 g_logv(
"state", G_LOG_LEVEL_INFO, indented, args);
140 #define TOOLS_CORE_SIG_CAPABILITIES "tcs_capabilities" 149 #define TOOLS_CORE_SIG_CONF_RELOAD "tcs_conf_reload" 160 #define TOOLS_CORE_SIG_DUMP_STATE "tcs_dump_state" 169 #define TOOLS_CORE_SIG_RESET "tcs_reset" 178 #define TOOLS_CORE_SIG_NO_RPC "tcs_no_rpc" 192 #define TOOLS_CORE_SIG_SET_OPTION "tcs_set_option" 204 #define TOOLS_CORE_SIG_PRE_SHUTDOWN "tcs_pre_shutdown" 213 #define TOOLS_CORE_SIG_SHUTDOWN "tcs_shutdown" 215 #if defined(G_PLATFORM_WIN32) 243 #define TOOLS_CORE_SIG_SERVICE_CONTROL "tcs_service_control" 254 #define TOOLS_CORE_PROP_CTX "tcs_app_ctx" 262 #define TOOLS_CORE_EVENTS_TOOLS_NEW_VERSION "VMToolsNewVersion" 271 #define TOOLS_CORE_EVENTS_TOOLS_NEED_REBOOT "VMToolsNeedReboot" 273 #define TOOLS_CORE_EVENTS_GLOBAL_SCOPE "Global" 287 TOOLS_CORE_API_V1 = 0x1,
322 #if defined(G_PLATFORM_WIN32) 324 gboolean comInitialized;
349 #if defined(G_PLATFORM_WIN32) 357 static inline gboolean
360 if (!ctx->comInitialized) {
361 HRESULT ret = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
362 ctx->comInitialized = SUCCEEDED(ret);
363 if (!ctx->comInitialized) {
364 g_log(ctx->
name, G_LOG_LEVEL_WARNING,
365 "COM initialization failed(0x%x)\n", ret);
368 return ctx->comInitialized;
378 TOOLS_CAP_OLD_NOVAL = 1,
554 const gchar *signame;
625 #if defined(G_PLATFORM_WIN32) 626 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __declspec(dllexport) 627 #elif defined(GCC_EXPLICIT_EXPORT) 628 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __attribute__((visibility("default"))) 630 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C