NULL
};
- ToolsPluginSignalCb sigs[] = {
- { TOOLS_CORE_SIG_CAPABILITIES, (void *) DnDCPCapabilities, NULL },
- { TOOLS_CORE_SIG_RESET, (void *) DnDCPReset, NULL },
- { TOOLS_CORE_SIG_SET_OPTION, (void *) DnDCPSetOption, NULL },
- { TOOLS_CORE_SIG_SHUTDOWN, (void *) DnDCPShutdown, NULL }
- };
-
- ToolsAppReg regs[] = {
- { TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
- };
-
- /*
- * DnD/CP Initialization here.
- */
-
- CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
- if (p) {
- p->Init(ctx);
- p->PointerInit();
+ if (ctx->rpc != NULL) {
+ ToolsPluginSignalCb sigs[] = {
+ { TOOLS_CORE_SIG_CAPABILITIES, (void *) DnDCPCapabilities, NULL },
+ { TOOLS_CORE_SIG_RESET, (void *) DnDCPReset, NULL },
+ { TOOLS_CORE_SIG_SET_OPTION, (void *) DnDCPSetOption, NULL },
+ { TOOLS_CORE_SIG_SHUTDOWN, (void *) DnDCPShutdown, NULL }
+ };
+
+ ToolsAppReg regs[] = {
+ { TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
+ };
+
+ /*
+ * DnD/CP Initialization here.
+ */
+
+ CopyPasteDnDWrapper *p = CopyPasteDnDWrapper::GetInstance();
+ if (p) {
+ p->Init(ctx);
+ p->PointerInit();
+ }
+
+ regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
+ return ®Data;
}
- regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
- return ®Data;
+ return NULL;
}
}
NULL
};
- ToolsPluginSignalCb sigs[] = {
- { TOOLS_CORE_SIG_RESET, (void *) UnityPluginReset, ®Data },
- { TOOLS_CORE_SIG_SHUTDOWN, (void *) UnityPluginShutdown, ®Data },
- { TOOLS_CORE_SIG_CAPABILITIES, (void *) UnityPluginCapabilities, ®Data },
- { TOOLS_CORE_SIG_SET_OPTION, (void *) UnityPluginSetOption, ®Data },
- };
+ if (ctx->rpc != NULL) {
+ ToolsPluginSignalCb sigs[] = {
+ { TOOLS_CORE_SIG_RESET, (void *) UnityPluginReset, ®Data },
+ { TOOLS_CORE_SIG_SHUTDOWN, (void *) UnityPluginShutdown, ®Data },
+ { TOOLS_CORE_SIG_CAPABILITIES, (void *) UnityPluginCapabilities, ®Data },
+ { TOOLS_CORE_SIG_SET_OPTION, (void *) UnityPluginSetOption, ®Data },
+ };
- ToolsPlugin *pluginInstance = NULL;
+ ToolsPlugin *pluginInstance = NULL;
#if WIN32
- pluginInstance = new UnityPluginWin32(ctx);
+ pluginInstance = new UnityPluginWin32(ctx);
#else // Linux
- pluginInstance = new UnityPlugin(ctx);
+ pluginInstance = new UnityPlugin(ctx);
#endif
- if (!pluginInstance) {
- // There's nothing we can do if we can't construct the plugin instance
- return NULL;
- }
- regData._private = pluginInstance;
+ if (!pluginInstance) {
+ // There's nothing we can do if we can't construct the plugin instance
+ return NULL;
+ }
+ regData._private = pluginInstance;
- std::vector<RpcChannelCallback> rpcs = pluginInstance->GetRpcCallbackList();
+ std::vector<RpcChannelCallback> rpcs = pluginInstance->GetRpcCallbackList();
- ToolsAppReg regs[] = {
- { TOOLS_APP_GUESTRPC, VMTools_WrapArray(&rpcs[0], sizeof rpcs[0], rpcs.size()) },
- { TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
- };
+ ToolsAppReg regs[] = {
+ { TOOLS_APP_GUESTRPC, VMTools_WrapArray(&rpcs[0], sizeof rpcs[0], rpcs.size()) },
+ { TOOLS_APP_SIGNALS, VMTools_WrapArray(sigs, sizeof *sigs, ARRAYSIZE(sigs)) }
+ };
- regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
+ regData.regs = VMTools_WrapArray(regs, sizeof *regs, ARRAYSIZE(regs));
+
+ return ®Data;
+ }
- return ®Data;
+ return NULL;
}
#include "conf.h"
#include "rpcout.h"
#include "str.h"
+#include "vmcheck.h"
#include "vmtoolsd_version.h"
#include "vmware/tools/utils.h"
#include "vmware/tools/i18n.h"
gpointer data,
GError **error)
{
- char *result = NULL;
- Bool status = FALSE;
+#if defined(_WIN32)
+ VMTools_AttachConsole();
+#endif
+ if (VmCheck_IsVirtualWorld()) {
+ char *result = NULL;
+ Bool status = FALSE;
- status = RpcOut_sendOne(&result, NULL, "%s", value);
+ status = RpcOut_sendOne(&result, NULL, "%s", value);
- if (!status) {
- g_printerr("%s\n", result ? result : "NULL");
- } else {
- g_print("%s\n", result);
- }
+ if (!status) {
+ g_printerr("%s\n", result ? result : "NULL");
+ } else {
+ g_print("%s\n", result);
+ }
- vm_free(result);
- exit(status ? 0 : 1);
+ vm_free(result);
+ exit(status ? 0 : 1);
+ }
+ g_printerr(SU_(cmdline.rpcerror, "Unable to send command to VMware hypervisor.\n"));
+ exit(1);
}
* Stop all app providers, and free the memory we allocated for the two
* internal app providers.
*/
- for (i = 0; i < state->providers->len; i++) {
+ for (i = 0; state->providers != NULL && i < state->providers->len; i++) {
ToolsAppProviderReg *preg = &g_array_index(state->providers,
ToolsAppProviderReg,
i);
g_free(plugin);
}
- g_array_free(state->providers, TRUE);
- state->providers = NULL;
+ if (state->providers != NULL) {
+ g_array_free(state->providers, TRUE);
+ state->providers = NULL;
+ }
g_ptr_array_free(state->plugins, TRUE);
state->plugins = NULL;