]> xenbits.xensource.com Git - people/pauldu/xeniface.git/commitdiff
Update branding
authorPaul Durrant <paul.durrant@citrix.com>
Fri, 15 Aug 2014 13:22:17 +0000 (14:22 +0100)
committerPaul Durrant <paul.durrant@citrix.com>
Fri, 15 Aug 2014 13:41:55 +0000 (14:41 +0100)
Remove the use of the 'XenServer' product name except where it is
still appropriate.
Remove use of 'Citrix' from all places except source file
copyrights.
Allow company and product name to be set at build time.

Signed-off-by: Paul Durrant <paul.durrant@citrix.com>
12 files changed:
WmiDocumentation.txt
build.py
proj/liteagent/LiteAgent.vcxproj
src/win32stubagent/WmiAccessor.cpp
src/win32stubagent/XService.h
src/win32stubagent/w32xagent.rc
src/xeniface.inf
src/xeniface.mof [new file with mode: 0644]
src/xeniface/wmi.c
src/xeniface/wmi.mof [deleted file]
src/xeniface/xeniface.rc
testwmi.vbs [deleted file]

index 40248a3fa5cf901703fa3cd65dd7b692e1b4c09a..1101f53f19842f0e4fe5ca14fa3feaf23766a58d 100644 (file)
@@ -1,14 +1,28 @@
 The Windows Guest WMI Interface
+===============================
 
-The Windows Guest WMI interface is intended to replace as the mechanism of choice for communicating with xenstore (and other hypervisor interfaces).  It is provided by the device driver xeniface.sys, which forms part of the Windows PV Drivers.   Access to this interface is available to those users which have been granted to the root\wmi namespace - which is to say the device driver namespace.  By default this is administrators only.
+The Windows Guest WMI interface is intended to replace as the mechanism of
+choice for communicating with xenstore (and other hypervisor interfaces). It
+is provided by the device driver xeniface.sys, which forms part of the Windows PV
+Drivers. Access to this interface is available to those users which have been
+granted to the root\wmi namespace - which is to say the device driver namespace.
+By default this is administrators only.
 
-The WMI Interface provides a base singleton object (CitrixXenStoreBase) which can be used to generate individual session objects (CitrixXenStoreSession).  These session objects represent individual applications (or functions of an application), and are the objects used to interact with xenstore - to read write, set and unset watches.  Sessions may also take advantage of the transaction semantics to ensure atomicity of xenstore operations.
+The WMI Interface provides a base singleton object which can be used to generate
+individual session objects. These session objects represent individual applications
+(or functions of an application), and are the objects used to interact with
+xenstore - to read write, set and unset watches. Sessions may also take advantage
+of the transaction semantics to ensure atomicity of xenstore operations.
 
-The lifetime of watches and transactions are limited by the lifetime of the session object which creates them 
+The lifetime of watches and transactions are limited by the lifetime of the session
+object which creates them.
 
-On driverload, one object is made available via WMI
+For branding purposes an object name PREFIX can be set at build time using the
+OBJECT_PREFIX environment variable.
 
-CitrixXenStoreBase
+On driverload, one object is made available via WMI:
+
+<PREFIX>XenStoreBase
 
 A singleton object representing xenstore
 
@@ -18,13 +32,13 @@ Properties:
         Hypervisor's clock.
 Methods:
     AddSession(String Id) returns SessionId:
-        Add a CitrixXenStoreSession object to the WMI namespace
+        Add a <PREFIX>XenStoreSession object to the WMI namespace
         The returned value (session id) is a unique value whcih can be used to
         identify the session which has been created (in case multiple sessions
         have the same string identifier)
 
 
-CitrixXenStoreSession
+<PREFIX>XenStoreSession
 
 Each instance represents a single session of communication with xenstore
 
@@ -78,13 +92,13 @@ Methods:
 
 About events:
 
-CitrixXenStoreWatchEvent:
+<PREFIX>XenStoreWatchEvent:
 
-Event emitted when a particular xenstore entry has changed.  Registering your interest in receiving such an event can be done by calling CitrixXenStoreSession.SetWatch(pathname)
+Event emitted when a particular xenstore entry has changed.  Registering your interest in receiving such an event can be done by calling <PREFIX>XenStoreSession.SetWatch(pathname)
 
     string EventId : The pathname of the xen store value which has changed
 
-CitrixXenStoreUnsuspendedEvent:
+<PREFIX>XenStoreUnsuspendedEvent:
 
     Event emitted whenever a vm resumes from being suspended.
 
@@ -96,13 +110,13 @@ Use:
 
     Locate the base object
 
-    $base = gwmi -n root\wmi -cl CitrixXenStoreBase
+    $base = gwmi -n root\wmi -cl <PREFIX>XenStoreBase
 
     Create a session
 
     $sid = $base.AddSession("MyNewSession")
 
-    $session = gwmi -n root\wmi -q "select * from CitrixXenStoreSession where SessionId=$($sid.SessionId)"
+    $session = gwmi -n root\wmi -q "select * from <PREFIX>XenStoreSession where SessionId=$($sid.SessionId)"
 
     Write a value
 
@@ -122,7 +136,7 @@ Use:
 
     Set Watch
 
-    $watch = Register-WMiEvent -n root\wmi -q "select * from CitrixXenStoreWatchEvent where EventId='data/TempValue'" -action {write $session.getvalue("data/TempValue") }
+    $watch = Register-WMiEvent -n root\wmi -q "select * from <PREFIX>XenStoreWatchEvent where EventId='data/TempValue'" -action {write $session.getvalue("data/TempValue") }
 
     $session.setvalue("data/TempValue","HELLO")
     $session.setvalue("data/TempValue","WORLD")
index 98cc6e4b5a602c44ee2f497cfb5e618cef96a072..763a8e30e00f88057cb515732cbca1ed10338583 100644 (file)
--- a/build.py
+++ b/build.py
@@ -61,6 +61,9 @@ def make_header():
     file.write('#define DAY_STR\t"' + str(now.day) + '"\n')
     file.write('\n')
 
+    file.write('#define OBJECT_PREFIX_STR\t"' + os.environ['OBJECT_PREFIX'] + '"\n')
+    file.write('#define OBJECT_GUID(_Name)\t' + os.environ['OBJECT_PREFIX'] + ' ## _Name ## _GUID\n')
+
     file.close()
 
 
@@ -81,6 +84,18 @@ def copy_inf(name):
     src.close()
 
 
+def copy_mof(name):
+    src = open('src\\%s.mof' % name, 'r')
+    dst = open('src\\%s\\wmi.mof' % name, 'w')
+
+    for line in src:
+        line = re.sub('@OBJECT_PREFIX@', os.environ['OBJECT_PREFIX'], line)
+        dst.write(line)
+
+    dst.close()
+    src.close()
+
+
 def get_expired_symbols(name, age = 30):
     path = os.path.join(os.environ['SYMBOL_SERVER'], '000Admin\\history.txt')
 
@@ -377,6 +392,9 @@ if __name__ == '__main__':
     if 'PRODUCT_NAME' not in os.environ.keys():
         os.environ['PRODUCT_NAME'] = 'Xen'
 
+    if 'OBJECT_PREFIX' not in os.environ.keys():
+        os.environ['OBJECT_PREFIX'] = 'XenProject'
+
     os.environ['MAJOR_VERSION'] = '8'
     os.environ['MINOR_VERSION'] = '0'
     os.environ['MICRO_VERSION'] = '0'
@@ -393,6 +411,8 @@ if __name__ == '__main__':
 
     make_header()
 
+    copy_mof(driver)
+
     copy_inf(driver)
 
     symstore_del(driver, 30)
index bb95411859802099e629939dc75ef9d4e0f6135d..e67918a8ac75191e5060d605449d87ec061f002b 100644 (file)
@@ -1,4 +1,4 @@
-<?xml version="1.0" encoding="utf-8"?>
+<?xml version="1.0" encoding="utf-8"?>
 <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
   <ItemGroup Label="ProjectConfigurations">
     <ProjectConfiguration Include="Debug|Win32">
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <LinkIncremental>false</LinkIncremental>
   </PropertyGroup>
+
+  <PropertyGroup>
+    <IncludePath>..\..\include;$(IncludePath)</IncludePath>
+  </PropertyGroup>
+
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <PrecompiledHeader>Use</PrecompiledHeader>
@@ -86,7 +91,7 @@
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
     </ClCompile>
     <Link>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
     </ClCompile>
     <Link>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <BrowseInformation>true</BrowseInformation>
       <PreprocessToFile>false</PreprocessToFile>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
       <IntrinsicFunctions>true</IntrinsicFunctions>
       <PreprocessorDefinitions>WIN32;NDEBUG;_CRT_SECURE_NO_WARNINGS;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <SDLCheck>true</SDLCheck>
-      <AdditionalIncludeDirectories>$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories>..\..\include;$(SolutionDir)\liteagent;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <BrowseInformation>true</BrowseInformation>
       <PreprocessToFile>false</PreprocessToFile>
       <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
index 288b801bf0dee1aedd3fb70c0eef0e1cc70cdeba..ad1636e8e776235fafb8c1c8bf7082f73095f4a7 100644 (file)
 //#include "xs_private.h"
 #include <wbemidl.h>
 
+#include <version.h>
+
+#define WIDEN2(x) L ## x
+#define WIDEN(x) WIDEN2(x)
+
+#define OBJECT_NAME_A(_Name) OBJECT_PREFIX_STR "XenStore" #_Name
+#define OBJECT_NAME_W(_Name) WIDEN(OBJECT_PREFIX_STR) L"XenStore" WIDEN(#_Name)
+
 #pragma comment(lib, "wbemuuid.lib")
 #pragma comment(lib, "uuid.lib")
 #pragma comment(lib, "comsuppw.lib")
@@ -732,7 +740,7 @@ public:
 
 IWbemClassObject *getBase(WMIAccessor** wmi) 
 {
-    IWbemClassObject* base = getObject(wmi, L"CitrixXenStoreBase");
+    IWbemClassObject* base = getObject(wmi, OBJECT_NAME_W(Base));
     if (base == NULL) {
         *wmi = NULL;
         return NULL;
@@ -742,7 +750,7 @@ IWbemClassObject *getBase(WMIAccessor** wmi)
 
 IWbemClassObject *getBaseClass(WMIAccessor** wmi) 
 {
-    IWbemClassObject* baseclass =  getClass(wmi, L"CitrixXenStoreBase");
+    IWbemClassObject* baseclass = getClass(wmi, OBJECT_NAME_W(Base));
     if (baseclass == NULL) {
         *wmi = NULL;
         return NULL;
@@ -806,7 +814,7 @@ IWbemClassObject *openSession(WMIAccessor** wmi, const char *sessionname)
 {
     HRESULT hres;
 
-    BSTR query = formatBstr("SELECT * FROM CitrixXenStoreSession WHERE Id=\"Citrix Xen Win32 Service : %s\"", sessionname);
+    BSTR query = formatBstr("SELECT * FROM " OBJECT_NAME_A(Session) " WHERE Id=\"" OBJECT_PREFIX_STR " Xen Win32 Service : %s\"", sessionname);
     if (query == NULL)
         goto formatsessionbstrfailed;
 
@@ -854,7 +862,7 @@ IWbemClassObject *openSession(WMIAccessor** wmi, const char *sessionname)
 
     VARIANT var;
     var.vt = VT_BSTR;
-    var.bstrVal=formatBstr("Citrix Xen Win32 Service : %s", sessionname);
+    var.bstrVal=formatBstr(COMPANY_NAME_STR " Xen Win32 Service : %s", sessionname);
 
     if (var.bstrVal == NULL)
         goto formatnamebstrfailed;
@@ -869,13 +877,13 @@ IWbemClassObject *openSession(WMIAccessor** wmi, const char *sessionname)
         goto outmethodgetfailed;
 
     size_t query_len;
-    query_len = strlen("SELECT * FROM CitrixXenStoreSession WHERE SessionId=")+10;
+    query_len = strlen("SELECT * FROM " OBJECT_NAME_A(Session) " WHERE SessionId=")+10;
     query = SysAllocStringLen(NULL, (UINT)query_len);
 
     if (query == NULL)
         goto allocqueryfailed;
 
-    swprintf_s(query,query_len, L"SELECT * FROM CitrixXenStoreSession WHERE SessionId=%d", var.uintVal);
+    swprintf_s(query,query_len, L"SELECT * FROM " OBJECT_NAME_W(Session) L" WHERE SessionId=%d", var.uintVal);
 
     sessions = runXSQuery(wmi, query );
     SysFreeString(query);
@@ -936,7 +944,7 @@ IWbemClassObject* sessionMethodStart(WMIAccessor**wmi,
 
     ASSERT(wmi != NULL);
 
-    sessionClass = getClass(wmi, L"CitrixXenStoreSession");
+    sessionClass = getClass(wmi, OBJECT_NAME_W(Session));
     if (sessionClass == NULL)
         goto getclassfailed;
 
@@ -1241,7 +1249,7 @@ void *WmiSessionWatch(WMIAccessor** wmi,  void **sessionhandle,
     ASSERT((*sessionhandle) != NULL);
 
     WatchSink * sink = new WatchSink(event, errorevent, path);
-    BSTR query=formatBstr("SELECT * from CitrixXenStoreWatchEvent WHERE EventId=\"%s\"", path);
+    BSTR query=formatBstr("SELECT * from " OBJECT_NAME_A(WatchEvent) " WHERE EventId=\"%s\"", path);
     if (query == NULL) {
         goto formatstringfailed;
     }
@@ -1302,7 +1310,7 @@ void *WmiUnsuspendedEventWatch(WMIAccessor **wmi, HANDLE event, HANDLE erroreven
     ASSERT(*wmi != NULL);
 
     WatchSink * sink = new WatchSink(event, errorevent, NULL);
-    BSTR query=formatBstr("SELECT * from CitrixXenStoreUnsuspendedEvent");
+    BSTR query=formatBstr("SELECT * from " OBJECT_NAME_A(UnsuspendedEvent));
     if (query==NULL) {
         goto formatstringfailed;
     }
index 144db5c3be9aaf1375ff869698058605b860112a..32ee1637365d92cd4c92cbe1e982c9e0d5215e1b 100644 (file)
 #ifndef _XSERVICE_H
 #define _XSERVICE_H
 
+#include <version.h>
+
 #define SVC_NAME "xensvc"
-#define SVC_DISPLAYNAME "Citrix Tools for Virtual Machines Service"
+#define SVC_DISPLAYNAME PRODUCT_NAME_STR ## "Interface Service"
 #define SVC_DESC "Monitors and provides various metrics to XenStore"
 
 void PrintError(const char *func);
index c1256348bcc3b779242567f95a3e24d1e5e1e763..63083d9da9579f83b50fcf0fe77da3625908fae7 100644 (file)
 #include <windows.h>
 #include <ntverp.h>
 
+#undef VER_COMPANYNAME_STR
+#undef VER_PRODUCTNAME_STR
+#undef VER_PRODUCTVERSION
+#undef VER_PRODUCTVERSION_STR
 
+#include <version.h>
+
+#define VER_COMPANYNAME_STR         COMPANY_NAME_STR
+#define VER_LEGALCOPYRIGHT_STR      "Copyright (c) Citrix Systems Inc."
+
+#define VER_PRODUCTNAME_STR         "XENIFACE"
+#define VER_PRODUCTVERSION          MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION,BUILD_NUMBER
+#define VER_PRODUCTVERSION_STR      MAJOR_VERSION_STR "." MINOR_VERSION_STR "." MICRO_VERSION_STR "." BUILD_NUMBER_STR
 
 #define VER_INTERNALNAME_STR "w32xagent.exe"
 #define VER_FILEVERSION_STR "1.0"
-#define VER_FILEDESCRIPTION_STR "XenSource Windows guest agent"
+#define VER_FILEDESCRIPTION_STR "w32agent"
 #define VER_ORIGINALFILENAME_STR "w32xagent.exe"
 #define VER_FILETYPE VFT_APP
 #define VER_FILESUBTYPE 0
index 189f156ef9abda9890ca8bfb3eec62d689d13ecd..ad3304159d392d53bed75230cc113915364e41ac 100644 (file)
 Signature="$WINDOWS NT$"\r
 Class=System\r
 ClassGUID={4d36e97d-e325-11ce-bfc1-08002be10318} \r
-Provider=%Citrix%\r
-DriverVer=09/07/2011,6.0.0.0\r
+Provider=%Company%\r
+DriverVer=01/01/1900,0.0.0.0\r
 CatalogFile=xeniface.cat\r
 \r
 [DestinationDirs]\r
 DefaultDestDir = 12\r
 ServiceDestDir.NT.Copy = 11\r
 \r
-;*****************************************\r
-; Xeniface Device  Install Section\r
-;*****************************************\r
-\r
 [Manufacturer]\r
-%Citrix%=Citrix,NT$ARCH$\r
+%Company%=Inst,NT$ARCH$\r
 \r
-[Citrix.NT$ARCH$]\r
+[Inst.NT$ARCH$]\r
 ; DisplayName              Section           DeviceID\r
 ; -----------              -------           --------\r
 \r
@@ -64,8 +60,6 @@ xeniface.sys
 [ServiceDestDir.NT.Copy]\r
 liteagent.exe\r
 \r
-;-------------- Service installation\r
-\r
 [Xeniface_Device.NT$ARCH$.Services]\r
 AddService = xeniface, %SPSVCINST_ASSOCSERVICE%, xeniface_Service_Inst\r
 AddService = xenlite, %LITESVC_FLAGS%, xenlite_Service_Inst\r
@@ -85,7 +79,6 @@ StartType      = 2               ; SERVICE_AUTO_START
 ErrorControl   = 1               ; SERVICE_ERROR_NORMAL\r
 ServiceBinary  = %11%\liteagent.exe\r
 \r
-\r
 [SourceDisksNames]\r
 1 = %DiskId1%,,,""\r
 \r
@@ -95,10 +88,9 @@ liteagent.exe = 1,,
 \r
 [Strings]\r
 SPSVCINST_ASSOCSERVICE= 0x00000002\r
-Citrix= "Citrix Systems, Inc." \r
-DiskId1 = "XenServer Tools for Virtual Machines"\r
-XenIfaceDevice.DeviceDesc = "XenServer Interface"\r
-xeniface.SVCDESC = "XenServer  Interface Device Driver"\r
+Company= "@COMPANY_NAME@" \r
+DiskId1 = "@PRODUCT_NAME@ Interface Package"\r
+XenIfaceDevice.DeviceDesc = "@PRODUCT_NAME Interface"\r
 LITESVC_FLAGS= 0x00000800\r
-xenlite.SVCDESC= "XenServer Lite Guest Agent"\r
+xenlite.SVCDESC= "@PRODUCT_NAME Interface Service"\r
 \r
diff --git a/src/xeniface.mof b/src/xeniface.mof
new file mode 100644 (file)
index 0000000..ad41c4b
--- /dev/null
@@ -0,0 +1,133 @@
+[Dynamic, Provider("WMIProv"),
+ WMI,
+ Description("Xenstore Node"),
+ guid("{1D80EB99-A1D6-4492-B62F-8B4549FF0B5E}"),
+ locale("MS\\0x409")]
+class @OBJECT_PREFIX@XenStoreNodes
+{
+    [key, read]
+     string InstanceName;
+    [read] boolean Active;
+
+    [WmiDataId(1),
+     read,
+     Description("Number of child nodes")]
+    uint32 NoOfChildNodes;
+
+    [WmiDataId(2),
+     read,
+     WmiSizeIs("NoOfChildNodes"),
+     Description("Child Nodes")]
+    string ChildNodes[];
+    
+};
+
+[Dynamic, Provider("WMIProv"),
+ WMI,
+ Description("Xenstore Session"),
+ guid("{12138A69-97B2-49DD-B9DE-54749AABC789}"),
+ locale("MS\\0x409")]
+
+class @OBJECT_PREFIX@XenStoreSession
+{
+    [key, read]
+     string InstanceName;
+    [read] boolean Active;
+
+    [WmiDataId(1), read]
+    uint32 SessionId;
+    [WmiDataId(2),read]
+    string Id;
+
+    [Implemented, WmiMethodId(1), Description("Get Value")]
+        void GetValue([In, IDQualifier(0)]string Pathname, [Out, IDQualifier(1)]string value);
+    
+    [Implemented, WmiMethodId(2), Description("Get Children")]
+        void GetChildren([In, IDQualifier(0)]string Pathname, [Out, IDQualifier(1)]@OBJECT_PREFIX@XenStoreNodes children);
+
+    [Implemented, WmiMethodId(3), Description("Set Value")]
+        void SetValue([In, IDQualifier(0)]string Pathname, [In, IDQualifier(1)]string value);
+
+    [Implemented, WmiMethodId(4), Description("End Session")]
+        void EndSession();
+
+    [Implemented, WmiMethodId(5), Description("Set Watch")]
+        void SetWatch([In, IDQualifier(0)]string Pathname);
+
+    [Implemented, WmiMethodId(6), Description("Remove Watch")]
+        void RemoveWatch([In, IDQualifier(0)]string Pathname);
+    
+    [Implemented, WmiMethodId(7), Description("Remove Value")]
+        void RemoveValue([In, IDQualifier(0)]string Pathname);
+
+    [Implemented, WmiMethodId(8), Description("Log")]
+        void Log([In, IDQualifier(0)]string Message); 
+
+    [Implemented, WmiMethodId(9), Description("Start Transaction")]
+        void StartTransaction();
+
+    [Implemented, WmiMethodId(10), Description("Commit Transaction")]
+        void CommitTransaction();
+    
+    [Implemented, WmiMethodId(11), Description("Abort Transaction")]
+        void AbortTransaction();
+    
+    [Implemented, WmiMethodId(12), Description("Get First Child")]
+        void GetFirstChild([In, IDQualifier(0)]string InPath, [Out, IDQualifier(1)]string OutPath);
+
+    [Implemented, WmiMethodId(13), Description("Get Next Sibling")]
+        void GetNextSibling([In, IDQualifier(0)]string InPath, [Out, IDQualifier(1)]string OutPath);
+};
+[WMI, Dynamic, Provider("WMIProv"),
+ guid("{8C436757-56BA-4273-9E58-CA4E689260E5}"),
+ locale("MS\\0x409"),
+ WmiExpense(1),
+ Description("Event notifying XenStore")]
+class @OBJECT_PREFIX@XenStoreWatchEvent : WMIEvent
+{
+    [key, read]
+    string        InstanceName;
+
+    [read]
+    boolean        Active;
+
+    [read,
+     Description("Triggered Event Id"),
+     WmiDataId(1)]    string    EventId;
+};
+
+[Dynamic, Provider("WMIProv"),
+ WMI,
+ Description("Base XenStore Object"),
+ guid("{AB8136BF-8EA7-420D-ADAD-89C83E587925}"),
+ locale("MS\\0x409")]
+class @OBJECT_PREFIX@XenStoreBase {
+   [key, read]
+    string        InstanceName;
+
+    [read]
+    boolean        Active;
+
+    
+    [read,
+     Description("Time provided by Xen hypervisor"),
+     WmiDataId(1)] uint64 XenTime;
+
+    [Implemented, WmiMethodId(1), Description("Add new session")]
+        void AddSession([In, IDQualifier(0)]string Id, [Out, IDQualifier(2)]uint32 SessionId);
+
+};
+
+[WMI, Dynamic, Provider("WMIProv"),
+ guid("{6456AAFA-4D71-497C-A34E-26AA995B14A4}"),
+ locale("MS\\0x409"),
+ WmiExpense(1),
+ Description("Event notifying the VM has unsuspended")]
+class @OBJECT_PREFIX@XenStoreUnsuspendedEvent : WMIEvent
+{
+    [key, read]
+    string        InstanceName;
+
+    [read]
+    boolean        Active;
+};
index 91aa2e996f81533adedd2c5bc725c68424a6ba61..bbdb780a8e217a33bde259b05053511fd32b5625 100644 (file)
@@ -45,6 +45,7 @@
 #include "..\..\include\suspend_interface.h"
 #include "log.h"
 #include "xeniface_ioctls.h"
+#include <version.h>
 
 __drv_raisesIRQL(APC_LEVEL)
 __drv_savesIRQLGlobal(OldIrql, fdoData->SessionLock) 
@@ -759,10 +760,10 @@ void FireSuspendEvent(PXENIFACE_FDO fdoData) {
     if (fdoData->WmiReady) {
         XenIfaceDebugPrint(TRACE,"Fire Suspend Event\n");
         WmiFireEvent(fdoData->Dx->DeviceObject,
-                (LPGUID)&CitrixXenStoreUnsuspendedEvent_GUID,
-                0,
-                0,
-                NULL);
+                     (LPGUID)&OBJECT_GUID(XenStoreUnsuspendedEvent),
+                     0,
+                     0,
+                     NULL);
     }
 } 
 void FireWatch(XenStoreWatch* watch) {
@@ -788,10 +789,10 @@ void FireWatch(XenStoreWatch* watch) {
     if (eventdata !=NULL) {
         XenIfaceDebugPrint(TRACE,"Fire Watch Event\n");
         WmiFireEvent(watch->fdoData->Dx->DeviceObject, 
-                        (LPGUID)&CitrixXenStoreWatchEvent_GUID,
-                        0,
-                        RequiredSize, 
-                        eventdata);
+                     (LPGUID)&OBJECT_GUID(XenStoreWatchEvent),
+                     0,
+                     RequiredSize, 
+                     eventdata);
     } 
 }
 
@@ -2560,12 +2561,14 @@ WmiExecuteMethod(
     OUT ULONG_PTR *byteswritten
    )
 {
-    if (IsEqualGUID(stack->Parameters.WMI.DataPath, &CitrixXenStoreBase_GUID)) {
+    if (IsEqualGUID(stack->Parameters.WMI.DataPath,
+                    &OBJECT_GUID(XenStoreBase))) {
         return BaseExecuteMethod(stack->Parameters.WMI.Buffer,
                                     stack->Parameters.WMI.BufferSize,  
                                     fdoData,  byteswritten);
     }
-    else if (IsEqualGUID(stack->Parameters.WMI.DataPath, &CitrixXenStoreSession_GUID)) {
+    else if (IsEqualGUID(stack->Parameters.WMI.DataPath,
+                         &OBJECT_GUID(XenStoreSession))) {
         return SessionExecuteMethod(stack->Parameters.WMI.Buffer,
                                     stack->Parameters.WMI.BufferSize,  
                                     fdoData,  byteswritten);
@@ -2845,14 +2848,14 @@ WmiQueryAllData(
 {
   
     if (IsEqualGUID(stack->Parameters.WMI.DataPath, 
-                    &CitrixXenStoreBase_GUID)) {
+                    &OBJECT_GUID(XenStoreBase))) {
         return GenerateBaseBlock(   fdoData,
                                     stack->Parameters.WMI.Buffer, 
                                     stack->Parameters.WMI.BufferSize,
                                     byteswritten);
     }
     else if (IsEqualGUID(stack->Parameters.WMI.DataPath, 
-                            &CitrixXenStoreSession_GUID)) {
+                         &OBJECT_GUID(XenStoreSession))) {
         return GenerateSessionBlock(stack->Parameters.WMI.Buffer, 
                                     stack->Parameters.WMI.BufferSize,
                                     fdoData,
@@ -2871,13 +2874,15 @@ WmiQuerySingleInstance(
     OUT ULONG_PTR *byteswritten
     )
 {
-    if (IsEqualGUID(stack->Parameters.WMI.DataPath, &CitrixXenStoreBase_GUID)) {
+    if (IsEqualGUID(stack->Parameters.WMI.DataPath,
+                    &OBJECT_GUID(XenStoreBase))) {
         return GenerateBaseInstance(fdoData,
                                     stack->Parameters.WMI.Buffer, 
                                     stack->Parameters.WMI.BufferSize,
                                     byteswritten);
     }
-    else if (IsEqualGUID(stack->Parameters.WMI.DataPath, &CitrixXenStoreSession_GUID)) {
+    else if (IsEqualGUID(stack->Parameters.WMI.DataPath,
+                         &OBJECT_GUID(XenStoreSession))) {
         return GenerateSessionInstance(stack->Parameters.WMI.Buffer, 
                                     stack->Parameters.WMI.BufferSize,
                                     fdoData,
@@ -2943,18 +2948,18 @@ WmiRegInfo(
 
     guid = &reginfo->WmiRegGuid[0];
     guid->InstanceCount = 1;
-    guid->Guid = CitrixXenStoreBase_GUID;
+    guid->Guid = OBJECT_GUID(XenStoreBase);
     guid->Flags = WMIREG_FLAG_INSTANCE_PDO;
     guid->Pdo = (ULONG_PTR)fdoData->PhysicalDeviceObject; 
        ObReferenceObject(fdoData->PhysicalDeviceObject);
     
     guid = &reginfo->WmiRegGuid[1];
-    guid->Guid = CitrixXenStoreSession_GUID;
+    guid->Guid = OBJECT_GUID(XenStoreSession);
     guid->Flags =0;
     
     guid = &reginfo->WmiRegGuid[2];
     guid->InstanceCount = 1;
-    guid->Guid = CitrixXenStoreWatchEvent_GUID;
+    guid->Guid = OBJECT_GUID(XenStoreWatchEvent);
     guid->Flags = WMIREG_FLAG_INSTANCE_PDO |
                 WMIREG_FLAG_EVENT_ONLY_GUID ;
     guid->Pdo = (ULONG_PTR)fdoData->PhysicalDeviceObject; 
@@ -2962,7 +2967,7 @@ WmiRegInfo(
 
     guid = &reginfo->WmiRegGuid[3];
     guid->InstanceCount = 1;
-    guid->Guid = CitrixXenStoreUnsuspendedEvent_GUID;
+    guid->Guid = OBJECT_GUID(XenStoreUnsuspendedEvent);
     guid->Flags = WMIREG_FLAG_INSTANCE_PDO |
                 WMIREG_FLAG_EVENT_ONLY_GUID ;
        guid->Pdo = (ULONG_PTR)fdoData->PhysicalDeviceObject; 
diff --git a/src/xeniface/wmi.mof b/src/xeniface/wmi.mof
deleted file mode 100644 (file)
index 9f91b78..0000000
+++ /dev/null
@@ -1,133 +0,0 @@
-[Dynamic, Provider("WMIProv"),
- WMI,
- Description("Xenstore Node"),
- guid("{1D80EB99-A1D6-4492-B62F-8B4549FF0B5E}"),
- locale("MS\\0x409")]
-class CitrixXenStoreNodes
-{
-    [key, read]
-     string InstanceName;
-    [read] boolean Active;
-
-    [WmiDataId(1),
-     read,
-     Description("Number of child nodes")]
-    uint32 NoOfChildNodes;
-
-    [WmiDataId(2),
-     read,
-     WmiSizeIs("NoOfChildNodes"),
-     Description("Child Nodes")]
-    string ChildNodes[];
-    
-};
-
-[Dynamic, Provider("WMIProv"),
- WMI,
- Description("Xenstore Session"),
- guid("{12138A69-97B2-49DD-B9DE-54749AABC789}"),
- locale("MS\\0x409")]
-
-class CitrixXenStoreSession
-{
-    [key, read]
-     string InstanceName;
-    [read] boolean Active;
-
-    [WmiDataId(1), read]
-    uint32 SessionId;
-    [WmiDataId(2),read]
-    string Id;
-
-    [Implemented, WmiMethodId(1), Description("Get Value")]
-        void GetValue([In, IDQualifier(0)]string Pathname, [Out, IDQualifier(1)]string value);
-    
-    [Implemented, WmiMethodId(2), Description("Get Children")]
-        void GetChildren([In, IDQualifier(0)]string Pathname, [Out, IDQualifier(1)]CitrixXenStoreNodes children);
-
-    [Implemented, WmiMethodId(3), Description("Set Value")]
-        void SetValue([In, IDQualifier(0)]string Pathname, [In, IDQualifier(1)]string value);
-
-    [Implemented, WmiMethodId(4), Description("End Session")]
-        void EndSession();
-
-    [Implemented, WmiMethodId(5), Description("Set Watch")]
-        void SetWatch([In, IDQualifier(0)]string Pathname);
-
-    [Implemented, WmiMethodId(6), Description("Remove Watch")]
-        void RemoveWatch([In, IDQualifier(0)]string Pathname);
-    
-    [Implemented, WmiMethodId(7), Description("Remove Value")]
-        void RemoveValue([In, IDQualifier(0)]string Pathname);
-
-    [Implemented, WmiMethodId(8), Description("Log")]
-        void Log([In, IDQualifier(0)]string Message); 
-
-    [Implemented, WmiMethodId(9), Description("Start Transaction")]
-        void StartTransaction();
-
-    [Implemented, WmiMethodId(10), Description("Commit Transaction")]
-        void CommitTransaction();
-    
-    [Implemented, WmiMethodId(11), Description("Abort Transaction")]
-        void AbortTransaction();
-    
-    [Implemented, WmiMethodId(12), Description("Get First Child")]
-        void GetFirstChild([In, IDQualifier(0)]string InPath, [Out, IDQualifier(1)]string OutPath);
-
-    [Implemented, WmiMethodId(13), Description("Get Next Sibling")]
-        void GetNextSibling([In, IDQualifier(0)]string InPath, [Out, IDQualifier(1)]string OutPath);
-};
-[WMI, Dynamic, Provider("WMIProv"),
- guid("{8C436757-56BA-4273-9E58-CA4E689260E5}"),
- locale("MS\\0x409"),
- WmiExpense(1),
- Description("Event notifying XenStore")]
-class CitrixXenStoreWatchEvent : WMIEvent
-{
-    [key, read]
-    string        InstanceName;
-
-    [read]
-    boolean        Active;
-
-    [read,
-     Description("Triggered Event Id"),
-     WmiDataId(1)]    string    EventId;
-};
-
-[Dynamic, Provider("WMIProv"),
- WMI,
- Description("Base Citrix XenStore Object"),
- guid("{AB8136BF-8EA7-420D-ADAD-89C83E587925}"),
- locale("MS\\0x409")]
-class CitrixXenStoreBase {
-   [key, read]
-    string        InstanceName;
-
-    [read]
-    boolean        Active;
-
-    
-    [read,
-     Description("Time provided by Xen hypervisor"),
-     WmiDataId(1)] uint64 XenTime;
-
-    [Implemented, WmiMethodId(1), Description("Add new session")]
-        void AddSession([In, IDQualifier(0)]string Id, [Out, IDQualifier(2)]uint32 SessionId);
-
-};
-
-[WMI, Dynamic, Provider("WMIProv"),
- guid("{6456AAFA-4D71-497C-A34E-26AA995B14A4}"),
- locale("MS\\0x409"),
- WmiExpense(1),
- Description("Event notifying the VM has unsuspended")]
-class CitrixXenStoreUnsuspendedEvent : WMIEvent
-{
-    [key, read]
-    string        InstanceName;
-
-    [read]
-    boolean        Active;
-};
index 1f17ac47c9239b70d76f44dd7253294d89411e79..df1167d0f9e339d7a3d242448e89409deda6e293 100644 (file)
 #undef VER_PRODUCTVERSION
 #undef VER_PRODUCTVERSION_STR
 
-#define        VER_COMPANYNAME_STR         "Citrix Systems Inc."
-#define VER_LEGALCOPYRIGHT_STR      "Copyright " YEAR_STR VER_COMPANYNAME_STR
+#include <version.h>
 
-#include "..\..\include\version.h"
+#define VER_COMPANYNAME_STR         COMPANY_NAME_STR
+#define VER_LEGALCOPYRIGHT_STR      "Copyright (c) Citrix Systems Inc."
 
 #define VER_PRODUCTNAME_STR         "XENIFACE"
 #define VER_PRODUCTVERSION          MAJOR_VERSION,MINOR_VERSION,MICRO_VERSION,BUILD_NUMBER
diff --git a/testwmi.vbs b/testwmi.vbs
deleted file mode 100644 (file)
index ef16ea7..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-rem testwmi.vbs
-
-rem Copyright (c) Citrix Systems Inc.
-rem All rights reserved.
-rem
-rem Redistribution and use in source and binary forms, 
-rem with or without modification, are permitted provided 
-rem that the following conditions are met:
-rem
-rem *   Redistributions of source code must retain the above 
-rem     copyright notice, this list of conditions and the 
-rem     following disclaimer.
-rem *   Redistributions in binary form must reproduce the above 
-rem     copyright notice, this list of conditions and the 
-rem     following disclaimer in the documentation and/or other 
-rem     materials provided with the distribution.
-rem
-rem THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND 
-rem CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, 
-rem INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF 
-rem MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 
-rem DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR 
-rem CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, 
-rem SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 
-rem BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 
-rem SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
-rem INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
-rem WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 
-rem NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 
-rem OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 
-rem SUCH DAMAGE.
-
-rem a sanity check for the xeniface wmi interface
-rem can be called using cscript.exe
-rem will set %ERRORLEVEL% to 0 on success and 1 on failure
-rem will also output the text 'SUCCESS' or an error message
-
-Set objWMIService = GetObject("winmgmts:\\.\root\wmi")
-Set base = objWmiService.InstancesOf("CitrixXenStoreBase")
-Dim answer
-Dim answer2
-Dim objItem
-
-
-rem Locate the base object
-
-if (base.Count) <> 1 then
-    wscript.echo("Too many base objects found")
-    wscript.quit(1)
-end if
-for each itementry in base
-  rem is there a more trivial way of getting the only item from a collection in vbscript?
-  set objItem = itementry
-next
-  
-rem Add two sessions
-
-objitem.AddSession "VBSTestSession", answer
-objitem.AddSession "AnotherVBSTestSession", answer2
-
-rem locate the first session
-
-query = "select * from CitrixXenStoreSession where SessionId = '" & answer & "'"
-Set sessions = objWMIService.ExecQuery(query)  
-if (sessions.count) <> 1 then
-    wscript.echo("Too many session-1 sessions found")
-    wscript.quit(1)
-end if
-for each itementry in sessions
-  rem is there a more trivial way of getting the only item from a collection in vbscript?
-  set session = itementry
-next
-
-rem locate te second session
-
-query = "select * from CitrixXenStoreSession where SessionId = '" & answer2 & "'"
-Set sessions2 = objWMIService.ExecQuery(query)
-if (sessions2.count) <> 1 then
-    wscript.echo("Too many session-2 sessions found")
-    wscript.quit(1)
-end if
-dim session2
-for each ses in sessions2
-  Set session2=ses
-next
-
-rem ensure we located the expected session
-
-if session.Id <> "VBSTestSession" then
-  wscript.echo("incorrect session found")
-  wscript.quit(1)
-end if
-
-rem blank a set of xenstore entries
-
-session.removevalue "data/wmitestrun"
-
-rem and put a known set of values there
-
-session.SetValue "data/wmitestrun/test1", "Testing"
-session.SetValue "data/wmitestrun/test2", "123 Testing"
-session.SetValue "data/wmitestrun/test3", "456 Testing"
-session.SetValue "data/wmitestrun/test4", "789 Testing"
-
-rem read back a value from xenstore, and check that it is right
-
-session.getvalue "data/wmitestrun/test1", res
-if res <> "Testing" then
-  wscript.echo("failed writing or reading to data/wmitestrun/test1")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-
-rem read back a different value from xenstore, and check that it is right
-
-session.getvalue "data/wmitestrun/test2", res
-if res <> "123 Testing" then
-  wscript.echo("failed writing or reading to data/wmitestrun/test2")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-
-rem transactions
-rem test that aborted transactions don't do anything
-
-session.starttransaction()
-session.SetValue "data/wmitestrun/test1", "WEIRD"
-session.getvalue "data/wmitestrun/test1", res
-if res <> "WEIRD" then
-  wscript.echo("failed writing or reading within transaction to data/wmitestrun/test1")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-session.aborttransaction()
-
-session.getvalue "data/wmitestrun/test1", res
-if res <> "Testing" then
-  wscript.echo("failed reading to data/wmitestrun/test1 after aborted transaction ")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if
-
-
-rem test that 2 overlapping transactions honour commits and aborts, and raise errors when needed
-
-session.starttransaction()
-session2.starttransaction()
-session.SetValue "data/wmitestrun/test1", "WEIRD"
-session2.SetValue "data/wmitestrun/test1", "Fish"
-session.getvalue "data/wmitestrun/test1", res
-session2.getvalue "data/wmitestrun/test1", res2
-if res <> "WEIRD" then
-  wscript.echo("failed writing or reading within transaction to data/wmitestrun/test1 session 1")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-if res2 <> "Fish" then
-  wscript.echo("failed writing or reading within transaction to data/wmitestrun/test1 session 2")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-
-on error resume next
-session.committransaction()
-Err.clear()
-if Err.Number <> 0 then
-    wscript.echo("Could not commit first transaction")
-    wscript.quit(1)
-end if
-session2.committransaction() 
-if Err.Number = 0 then
-    wscript.echo("Both transactions comitted")
-    wscript.quit(1)
-end if
-session2.aborttransaction()
-session2.getvalue "data/wmitestrun/test1", res2
-if res2 <> "WEIRD" then
-  wscript.echo("failed commiting the correct transaction")
-  wscript.echo("read = " & res)
-  wscript.quit(1)
-end if 
-
-rem events
-rem set up an event sink
-
-dim refsink
-set refsink = CreateObject("WBemScripting.SWbemSink")
-wscript.ConnectObject refsink, "EVENTSINK_"
-stq = "Select * from CitrixXenStoreWatchEvent"
-objwmiservice.ExecNotificationQueryAsync refsink, stq
-
-evtcount = 0
-
-rem watch a xenstore entry
-
-allevents=0
-session.setwatch "data/wmitestrun/test1"
-session.setvalue "data/wmitestrun/test1","MAGIC"
-session.removevalue "data/wmitestrun/test1"
-session.setvalue "data/wmitestrun/test1","GOLD"
-wscript.sleep(5000)
-session.removewatch "data/wmitestrun/test1"
-
-rem check we received an event.  Also, since events can be coalesced, check
-rem that when we receive our final event, the value we read from test1 is the
-rem final value we set it to
-
-rem (note the actual work of counting and checking events is done in the 
-rem EVENTSINK_OnObjectready sub below)
-
-if evtcount <= 4 and allevents <> 1 then
-    wscript.echo("Failed to catch all the expected events")
-    wscript.quit(1)
-end if
-
-session.removevalue "data/wmitestrun/test1"
-
-rem check that we can read the list of children an entry has
-
-strComputer = "."
-Set objWMIService = GetObject("winmgmts:" _
-    & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
-
-Set colOperatingSystems = objWMIService.ExecQuery _
-    ("Select * from Win32_OperatingSystem")
-
-for each os in colOperatingSystems
-  rem is there a more trivial way of getting the only item from a collection in vbscript?
-  set myos = os
-next
-
-wscript.echo(myos.Version)
-
-if Mid(myos.Version, 1 , 3) <> "6.0" then
-
-    dim children
-    session.getchildren "data/wmitestrun", children
-
-    if children.noofchildnodes <> 3 then
-        wscript.echo("Failed to find all the expected child nodes")
-        wscript.quit(1)
-    end if
-end if
-
-session.getfirstchild "data/wmitestrun", res
-session.getnextsibling res, res
-
-rem end both sessions that we created.
-
-session2.EndSession()
-session.EndSession()
-
-Wscript.echo("Success")
-
-Sub EVENTSINK_OnObjectReady(re, rc)
-   evtcount = evtcount + 1
-   session.getvalue "data/wmitestrun/test1", res
-   if res = "GOLD" then
-       allevents = 1
-   else
-       allevents = 0
-   end if
-end sub