19 #ifndef _VMWARE_TOOLS_PLUGIN_H_
20 #define _VMWARE_TOOLS_PLUGIN_H_
33 #if defined(G_PLATFORM_WIN32)
37 #include "vmware/guestrpc/capabilities.h"
49 #define VMTOOLSAPP_ERROR(ctx, err) do { \
51 (ctx)->errorCode = (err); \
52 g_main_loop_quit((ctx)->mainLoop); \
65 #define VMTOOLSAPP_ATTACH_SOURCE(ctx, src, cb, data, destroy) do { \
66 GSource *__src = (src); \
67 g_source_set_callback(__src, (GSourceFunc) (cb), (data), (destroy)); \
68 g_source_attach(__src, g_main_loop_get_context((ctx)->mainLoop)); \
72 #define TOOLS_STATE_LOG_ROOT 0
73 #define TOOLS_STATE_LOG_CONTAINER 1
74 #define TOOLS_STATE_LOG_PLUGIN 2
87 ToolsCore_LogState(guint level,
91 gchar *indented = g_strdup_printf(
"%*s%s", 3 * level,
"", fmt);
95 g_logv(
"state", G_LOG_LEVEL_INFO, indented, args);
113 #define TOOLS_CORE_SIG_CAPABILITIES "tcs_capabilities"
122 #define TOOLS_CORE_SIG_CONF_RELOAD "tcs_conf_reload"
133 #define TOOLS_CORE_SIG_DUMP_STATE "tcs_dump_state"
142 #define TOOLS_CORE_SIG_RESET "tcs_reset"
156 #define TOOLS_CORE_SIG_SET_OPTION "tcs_set_option"
165 #define TOOLS_CORE_SIG_SHUTDOWN "tcs_shutdown"
167 #if defined(G_PLATFORM_WIN32)
195 #define TOOLS_CORE_SIG_SERVICE_CONTROL "tcs_service_control"
206 #define TOOLS_CORE_PROP_CTX "tcs_app_ctx"
219 TOOLS_CORE_API_V1 = 0x1,
242 #if defined(G_PLATFORM_WIN32)
244 gboolean comInitialized;
260 #if defined(G_PLATFORM_WIN32)
268 G_INLINE_FUNC gboolean
271 if (!ctx->comInitialized) {
272 HRESULT ret = CoInitializeEx(NULL, COINIT_APARTMENTTHREADED);
273 ctx->comInitialized = SUCCEEDED(ret);
274 if (!ctx->comInitialized) {
275 g_log(ctx->
name, G_LOG_LEVEL_WARNING,
276 "COM initialization failed(0x%x)\n", ret);
279 return ctx->comInitialized;
289 TOOLS_CAP_OLD_NOVAL = 1,
485 const gchar *signame;
556 #if defined(G_PLATFORM_WIN32)
557 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __declspec(dllexport)
558 #elif defined(GCC_EXPLICIT_EXPORT)
559 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C __attribute__((visibility("default")))
561 # define TOOLS_MODULE_EXPORT VMTOOLS_EXTERN_C