*/
std::vector<ToolsAppCapability>
-UnityPlugin::GetCapabilities(gboolean set) // IN: Whether capabilities are being
- // set or unset.
- // XXX UNUSED Fix this or mark as such.
+UnityPlugin::GetCapabilities(gboolean set) // IN
{
- std::vector<ToolsAppCapability> capsVector;
-
/*
- * We can't use UNITY_RPC_UNITY_CAP here because that define includes the
- * tools.capability prefix which CoreServices will automatically prepend to the
- * supplied name.
+ * Note that we can't use UNITY_RPC_UNITY_CAP here because it includes the
+ * "tools.capability" prefix which vmtoolsd will automatically prepend to the
+ * supplied capability name.
*/
- capsVector.push_back(ToolsAppCapabilityOldEntry(UNITY_CAP_NAME, Unity_IsSupported() ? 1 : 0));
- capsVector.push_back(ToolsAppCapabilityOldEntry("unity.taskbar",
- Unity_IsSupported() ? 1 : 0));
-
- capsVector.push_back(ToolsAppCapabilityNewEntry(UNITY_CAP_STATUS_UNITY_ACTIVE, TRUE));
-
- return capsVector;
+ Bool b = set ? Unity_IsSupported() : FALSE;
+ std::vector<ToolsAppCapability> caps;
+ caps.push_back(ToolsAppCapabilityOldEntry(UNITY_CAP_NAME, b));
+ caps.push_back(ToolsAppCapabilityOldEntry("unity.taskbar", b));
+ caps.push_back(ToolsAppCapabilityNewEntry(UNITY_CAP_STATUS_UNITY_ACTIVE, b));
+ return caps;
}
virtual gboolean SetOption(gpointer src,
const std::string &option,
const std::string &value) = 0;
+
+#ifdef WIN32
+ // Handler for the TOOLS_CORE_SIG_SERVICE_CONTROL signal.
+ virtual DWORD OnServiceControl(gpointer src,
+ ToolsAppCtx *ctx,
+ SERVICE_STATUS_HANDLE handle,
+ guint control,
+ guint evtType,
+ gpointer evtData) = 0;
+#endif
+
virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set) = 0;
virtual std::vector<RpcChannelCallback> GetRpcCallbackList() = 0;
{
return FALSE;
}
+
virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
virtual std::vector<RpcChannelCallback> GetRpcCallbackList();
virtual std::vector<ToolsAppCapability> GetCapabilities(gboolean set);
virtual void SessionChange(gpointer src, DWORD code, DWORD id) {};
+ virtual DWORD OnServiceControl(gpointer src,
+ ToolsAppCtx *ctx,
+ SERVICE_STATUS_HANDLE handle,
+ guint control,
+ guint evtType,
+ gpointer evtData);
+
protected:
boost::shared_ptr<UnityPBRPCServer> mUnityPBRPCServer;
};
using namespace vmware::tools;
-
/*
*-----------------------------------------------------------------------------
*
return pluginInstance->SetOption(src, std::string(option), std::string(value));
}
+#ifdef WIN32
+/*
+ *-----------------------------------------------------------------------------
+ *
+ * UnityPluginServiceControl --
+ *
+ * C thunk for TOOLS_CORE_SIG_SERVICE_CONTROL messages.
+ *
+ * Results:
+ * Returns the result of calling OnServiceControl on the plugin object.
+ *
+ * Side effects:
+ * None
+ *
+ *-----------------------------------------------------------------------------
+ */
+
+DWORD
+UnityPluginServiceControl(gpointer src, // IN
+ ToolsAppCtx *ctx, // IN
+ SERVICE_STATUS_HANDLE handle, // IN
+ guint control, // IN
+ guint evtType, // IN
+ gpointer evtData, // IN
+ ToolsPluginData *data) // IN
+{
+ ToolsPlugin *p = reinterpret_cast<ToolsPlugin*>(data->_private);
+ ASSERT(p);
+ return p->OnServiceControl(src, ctx, handle, control, evtType, evtData);
+}
+#endif
/*
*-----------------------------------------------------------------------------
*
- * ToolsOnLoad` --
+ * ToolsOnLoad --
*
* Plugin entry point. Returns the registration data.
*
{ TOOLS_CORE_SIG_SHUTDOWN, (void *) UnityPluginShutdown, ®Data },
{ TOOLS_CORE_SIG_CAPABILITIES, (void *) UnityPluginCapabilities, ®Data },
{ TOOLS_CORE_SIG_SET_OPTION, (void *) UnityPluginSetOption, ®Data },
+#ifdef WIN32
+ { TOOLS_CORE_SIG_SERVICE_CONTROL, (void *) UnityPluginServiceControl, ®Data },
+#endif
};
ToolsPlugin *pluginInstance = NULL;