[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [win-pv-devel] [PATCH 04/20] Remove win32stubagent



> -----Original Message-----
> From: win-pv-devel [mailto:win-pv-devel-bounces@xxxxxxxxxxxxxxxxxxxx] On
> Behalf Of Owen Smith
> Sent: 24 May 2016 15:21
> To: win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> Cc: Owen Smith
> Subject: [win-pv-devel] [PATCH 04/20] Remove win32stubagent
> 
> This is 1 large code deletion patch, the liteagent will be reimplemented
> over the next set of patches
>
> Signed-off-by: Owen Smith <owen.smith@xxxxxxxxxx>

Do things still build after this patch is applied (since the lite agent vcxproj 
no longer has content)?

  Paul

> ---
>  src/win32stubagent/WmiAccessor.cpp | 1331 
> ------------------------------------
>  src/win32stubagent/WmiAccessor.h   |   88 ---
>  src/win32stubagent/XSAccessor.cpp  |  230 -------
>  src/win32stubagent/XSAccessor.h    |  126 ----
>  src/win32stubagent/XService.cpp    | 1044 ----------------------------
>  src/win32stubagent/XService.h      |   54 --
>  src/win32stubagent/errors.cpp      |  102 ---
>  src/win32stubagent/messages.mc     |   66 --
>  src/win32stubagent/stdafx.cpp      |   39 --
>  src/win32stubagent/stdafx.h        |   43 --
>  src/win32stubagent/w32xagent.rc    |   60 --
>  src/win32stubagent/xen.ico         |  Bin 25214 -> 0 bytes
>  vs2012/liteagent/LiteAgent.vcxproj |   34 +-
>  vs2013/liteagent/LiteAgent.vcxproj |   31 -
>  14 files changed, 2 insertions(+), 3246 deletions(-)
>  delete mode 100644 src/win32stubagent/WmiAccessor.cpp
>  delete mode 100644 src/win32stubagent/WmiAccessor.h
>  delete mode 100644 src/win32stubagent/XSAccessor.cpp
>  delete mode 100644 src/win32stubagent/XSAccessor.h
>  delete mode 100644 src/win32stubagent/XService.cpp
>  delete mode 100644 src/win32stubagent/XService.h
>  delete mode 100644 src/win32stubagent/errors.cpp
>  delete mode 100644 src/win32stubagent/messages.mc
>  delete mode 100644 src/win32stubagent/stdafx.cpp
>  delete mode 100644 src/win32stubagent/stdafx.h
>  delete mode 100644 src/win32stubagent/w32xagent.rc
>  delete mode 100644 src/win32stubagent/xen.ico
> 
> diff --git a/src/win32stubagent/WmiAccessor.cpp
> b/src/win32stubagent/WmiAccessor.cpp
> deleted file mode 100644
> index b85ff8e..0000000
> --- a/src/win32stubagent/WmiAccessor.cpp
> +++ /dev/null
> @@ -1,1331 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include "stdafx.h"
> -#define _WIN32_DCOM
> -#include <windows.h>
> -#include <iostream>
> -#include <algorithm>
> -#include <hash_map>
> -#include <stdio.h>
> -#include "winerror.h"
> -#include "WMIAccessor.h"
> -#include "XService.h"
> -#include "comutil.h"
> -
> -//#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")
> -
> -BSTR mkBstr(const char *string, size_t len) {
> -    BSTR res = NULL;
> -    size_t returned;
> -    wchar_t* wstring = new wchar_t[len+1];
> -    if (wstring == NULL) {
> -        goto malloc_wstring;
> -    }
> -    mbstowcs_s(&returned, wstring, len+1, string, len);
> -    res = SysAllocString(wstring);
> -    delete wstring;
> -malloc_wstring:
> -    return res;
> -}
> -
> -char * formatCharStrInt(const char *fmt, va_list l) {
> -    char *buf = NULL;
> -    int cnt = _vscprintf(fmt, l);
> -    buf = (char *)XsAlloc(cnt+1);
> -    if (buf == NULL) {
> -        goto malloc_buf;
> -    }
> -    _vsnprintf(buf, cnt+1, fmt, l);
> -malloc_buf:
> -    return buf;
> -}
> -
> -char * formatCharStr(const char *fmt, ... ) {
> -    char *buf =NULL;
> -    va_list l;
> -    va_start(l, fmt);
> -    buf = formatCharStrInt(fmt, l);
> -    va_end(l);
> -    return buf;
> -}
> -
> -BSTR formatBstr(const char *fmt, ...)
> -{
> -    char *buf;
> -    va_list l;
> -    BSTR res = NULL;
> -    va_start(l, fmt);
> -    buf = formatCharStrInt(fmt, l);
> -    va_end(l);
> -    res = mkBstr(buf, strlen(buf));
> -    XsFree(buf);
> -    return res;
> -}
> -
> -int setVariantString(VARIANT* var, const char *data, size_t len) {
> -    int err=-1;
> -    VariantInit(var);
> -    var->vt=VT_BSTR;
> -    var->bstrVal = mkBstr(data, len);
> -    if (var->bstrVal == NULL) {
> -        goto sysalloc;
> -    }
> -    err=0;
> -sysalloc:
> -    return err;
> -}
> -
> -
> -int setVariantString(VARIANT* var, const char *string) {
> -    return setVariantString(var, string, strlen(string));
> -}
> -
> -
> -class WatchSink : public IWbemObjectSink
> -{
> -    LONG m_lRef;
> -    bool bDone;
> -    HANDLE triggerevent;
> -    HANDLE triggererror;
> -public:
> -    char *path;
> -    WatchSink(HANDLE event, HANDLE errorevent, const char *path) {
> -        m_lRef = 1;
> -        triggerevent = event;
> -        triggererror = errorevent;
> -        this->path = NULL;
> -        if (path) {
> -            this->path=(char *)XsAlloc(strlen(path)+1);
> -            strcpy(this->path, path);
> -        }
> -    }
> -   ~WatchSink() { bDone = TRUE; }
> -
> -    virtual ULONG STDMETHODCALLTYPE AddRef();
> -    virtual ULONG STDMETHODCALLTYPE Release();
> -    virtual HRESULT STDMETHODCALLTYPE
> -        QueryInterface(REFIID riid, void** ppv);
> -
> -    virtual HRESULT STDMETHODCALLTYPE Indicate(
> -            /* [in] */
> -            LONG lObjectCount,
> -            /* [size_is][in] */
> -            IWbemClassObject __RPC_FAR *__RPC_FAR *apObjArray
> -            );
> -
> -    virtual HRESULT STDMETHODCALLTYPE SetStatus(
> -            /* [in] */ LONG lFlags,
> -            /* [in] */ HRESULT hResult,
> -            /* [in] */ BSTR strParam,
> -            /* [in] */ IWbemClassObject __RPC_FAR *pObjParam
> -            );
> -};
> -
> -
> -ULONG WatchSink::AddRef()
> -{
> -    return InterlockedIncrement(&m_lRef);
> -}
> -
> -ULONG WatchSink::Release()
> -{
> -    LONG lRef = InterlockedDecrement(&m_lRef);
> -    if(lRef == 0)
> -        delete this;
> -    return lRef;
> -}
> -
> -HRESULT WatchSink::QueryInterface(REFIID riid, void** ppv)
> -{
> -    if (riid == IID_IUnknown || riid == IID_IWbemObjectSink)
> -    {
> -        *ppv = (IWbemObjectSink *) this;
> -        AddRef();
> -        return WBEM_S_NO_ERROR;
> -    }
> -    else return E_NOINTERFACE;
> -}
> -
> -
> -HRESULT WatchSink::Indicate(long lObjCount, IWbemClassObject **pArray)
> -{
> -    for (long i = 0; i < lObjCount; i++)
> -    {
> -        IWbemClassObject *pObj = pArray[i];
> -        SetEvent(this->triggerevent);
> -        // ... use the object.
> -
> -        // AddRef() is only required if the object will be held after
> -        // the return to the caller.
> -    }
> -
> -    return WBEM_S_NO_ERROR;
> -}
> -
> -HRESULT WatchSink::SetStatus(
> -            /* [in] */ LONG lFlags,
> -            /* [in] */ HRESULT hResult,
> -            /* [in] */ BSTR strParam,
> -            /* [in] */ IWbemClassObject __RPC_FAR *pObjParam
> -        )
> -{
> -    if (FAILED(hResult)) {
> -        XsLog("WMI Asyc watch failed %p\n", this);
> -        SetEvent(this->triggererror);
> -    }
> -    return WBEM_S_NO_ERROR;
> -}
> -
> -
> -
> -struct WMIAccessor
> -{
> -    IWbemServices *mpSvc;
> -    IWbemServices *mpXSSvc;
> -
> -    HANDLE owning_thread;
> -};
> -
> -struct WMIAccessor *wmi = NULL;
> -
> -static string wstring2string(const wstring& wstr)
> -{
> -    int len;
> -
> -    len = WideCharToMultiByte(CP_UTF8,
> -                              0,
> -                              wstr.c_str(),
> -                              -1,
> -                              NULL,
> -                              0,
> -                              NULL,
> -                              NULL);
> -
> -    string str(len, 0);
> -
> -    len = WideCharToMultiByte(CP_UTF8,
> -                              0,
> -                              wstr.c_str(),
> -                              -1,
> -                              &str[0],
> -                              (int)str.length(),
> -                              NULL,
> -                              NULL);
> -
> -    return str;
> -}
> -
> -static string bstr2string(const BSTR& bstr)
> -{
> -    wstring wstr(bstr);
> -
> -    return wstring2string(wstr);
> -}
> -
> -IWbemClassObject *getClass(WMIAccessor **wmi, BSTR path) {
> -    if (*wmi == NULL)
> -        return NULL;
> -
> -    if ((*wmi)->mpXSSvc == NULL)
> -        return NULL;
> -
> -    IWbemClassObject *returnedObject;
> -    HRESULT hres = (*wmi)->mpXSSvc-
> >GetObject(path,WBEM_FLAG_RETURN_WBEM_COMPLETE,
> -            NULL, &returnedObject, NULL);
> -    if (FAILED(hres)) {
> -        returnedObject =NULL;
> -    }
> -    return returnedObject;
> -}
> -
> -IWbemClassObject *getObject(WMIAccessor **wmi, BSTR path) {
> -    IEnumWbemClassObject *returnedEnum;
> -    IWbemClassObject *returnedObject;
> -    if (*wmi == NULL)
> -        return NULL;
> -    ASSERT((*wmi)->mpXSSvc != NULL);
> -    HRESULT hres =  (*wmi)->mpXSSvc->CreateInstanceEnum(path,
> WBEM_FLAG_FORWARD_ONLY,
> -                                            NULL,
> -                                            &returnedEnum);
> -    if (FAILED(hres)) {
> -        OutputDebugString("GetEnum failed\n");
> -        returnedObject =NULL;
> -        return returnedObject;
> -    }
> -    ULONG objects;
> -
> -    hres = returnedEnum->Next(WBEM_INFINITE, 1, &returnedObject,
> &objects);
> -
> -
> -    if (FAILED(hres) || objects < 1) {
> -        OutputDebugString("GetFromEnum failed\n");
> -        returnedObject =NULL;
> -    }
> -
> -    return returnedObject;
> -}
> -
> -HRESULT methodExec(WMIAccessor** wmi,  IWbemClassObject* instance,
> const wchar_t *methodname, IWbemClassObject *inMethodInst,
> IWbemClassObject **outMethodInst)
> -{
> -    HRESULT hres=E_FAIL ;
> -
> -    IWbemClassObject *outstore=NULL;
> -    BSTR bpathname = SysAllocString(L"__PATH");
> -    if (bpathname == NULL){
> -        goto allocpathname;
> -    }
> -
> -
> -    VARIANT instancepath;
> -    VariantInit(&instancepath);
> -    hres = instance->Get(bpathname, 0, &instancepath, NULL, NULL);
> -    if (FAILED(hres)) {
> -        goto getclassname;
> -    }
> -
> -
> -    BSTR bmethodname = SysAllocString(methodname);
> -    if (bmethodname == NULL){
> -        goto allocmethodname;
> -    }
> -
> -    hres = (*wmi)->mpXSSvc->ExecMethod(instancepath.bstrVal,
> bmethodname, 0, NULL,inMethodInst, &outstore, NULL);
> -    if (outMethodInst != NULL) {
> -        *outMethodInst = NULL;
> -        if (!FAILED(hres)){
> -            *outMethodInst = outstore;
> -        }
> -    }
> -
> -    SysFreeString(bmethodname);
> -allocmethodname:
> -
> -getclassname:
> -    VariantClear(&instancepath);
> -    SysFreeString(bpathname);
> -allocpathname:
> -    return hres;
> -}
> -static IEnumWbemClassObject* runXSQuery(WMIAccessor **wmi, BSTR
> query)
> -{
> -    if (wmi == NULL)
> -        return NULL;
> -
> -    ASSERT((*wmi)->mpXSSvc != NULL);
> -
> -    // Use the IWbemServices pointer to make requests of WMI.
> -    // Make requests here:
> -    IEnumWbemClassObject* pEnumerator = NULL;
> -    HRESULT hres = (*wmi)->mpXSSvc->ExecQuery(L"WQL",
> -                                         query,
> -                                         WBEM_FLAG_FORWARD_ONLY |
> WBEM_FLAG_RETURN_IMMEDIATELY,
> -                                         NULL,
> -                                         &pEnumerator);
> -    if (FAILED(hres))
> -    {
> -        DBGPRINT(("ExecQuery failed\n"));
> -        pEnumerator = NULL;
> -    }
> -    return pEnumerator;
> -}
> -static IEnumWbemClassObject* runQuery(WMIAccessor *wmi, BSTR query)
> -{
> -    if (wmi == NULL)
> -        return NULL;
> -
> -    ASSERT(wmi->mpSvc != NULL);
> -
> -    // Use the IWbemServices pointer to make requests of WMI.
> -    // Make requests here:
> -    IEnumWbemClassObject* pEnumerator = NULL;
> -    HRESULT hres = wmi->mpSvc->ExecQuery(L"WQL",
> -                                         query,
> -                                         WBEM_FLAG_FORWARD_ONLY |
> WBEM_FLAG_RETURN_IMMEDIATELY,
> -                                         NULL,
> -                                         &pEnumerator);
> -    if (FAILED(hres))
> -    {
> -        DBGPRINT(("ExecQuery failed\n"));
> -        pEnumerator = NULL;
> -    }
> -    return pEnumerator;
> -}
> -
> -LONG wmicount = 0;
> -static BOOLEAN com_initialized = false;
> -static IWbemLocator *locator = 0;
> -BOOL InitCom(void) {
> -    HRESULT hres;
> -    XsLog("Init COM");
> -    hres = CoInitializeEx(0, COINIT_MULTITHREADED);
> -    if (FAILED(hres)) {
> -        goto err_out;
> -    }
> -    com_initialized = TRUE;
> -    //wmi->owning_thread = GetCurrentThread();
> -    //XsLog("Wmi connect thread %p", GetCurrentThread());
> -    // Initialize COM security.  Most of this is irrelevant to us.
> -    XsLog("Init security");
> -    hres = CoInitializeSecurity(
> -        NULL,     /* Security descriptor. Only relevant to servers */
> -        -1,       /* Nr. of auth services. Only relevant to servers */
> -        NULL,     /* List of auth services. Only relevant to servers */
> -        NULL,     /* Reserved */
> -        RPC_C_AUTHN_LEVEL_DEFAULT, /* Default authentication.  The
> -                                        details don't really matter when
> -                                        you're localhost. */
> -        RPC_C_IMP_LEVEL_IMPERSONATE, /* WMI needs to be able to
> -                                        impersonate us. */
> -        NULL,             /* Authentication info */
> -        EOAC_NONE,        /* Additional capabilities */
> -        NULL              /* Reserved */
> -        );
> -    if (FAILED(hres)) {
> -        goto err_out;
> -    }
> -            OutputDebugString("CreateInstance\n");
> -        hres = CoCreateInstance(
> -            CLSID_WbemLocator,
> -            0,
> -            CLSCTX_INPROC_SERVER,
> -            IID_IWbemLocator,
> -            (LPVOID *) &locator);
> -        OutputDebugString("Check hres\n");
> -        if (FAILED(hres)) {
> -            goto err_out;
> -        }
> -        if (locator == NULL) {
> -            OutputDebugString("Null locator");
> -            goto err_out;
> -        }
> -    return true;
> -err_out:
> -    return false;
> -}
> -
> -BOOL ConnectToWMI(void)
> -{
> -        InitCom();
> -        HRESULT hres;
> -        OutputDebugString("Connect to WMI");
> -        wmicount++;
> -
> -        wmi = (struct WMIAccessor *)XsAlloc(sizeof(*wmi));
> -        if (wmi == NULL) {
> -            return false;
> -        }
> -        memset(wmi, 0, sizeof(*wmi));
> -
> -
> -        OutputDebugString("Connect Server\n");
> -        try {
> -            hres = locator->ConnectServer(
> -                L"root\\CIMV2",          // WMI namespace
> -                NULL,                    // User name
> -                NULL,                    // User password
> -                NULL,                    // Locale
> -                0,                       // Security flags
> -                NULL,                    // Authority
> -                NULL,                    // Context object
> -                &(wmi->mpSvc)              // IWbemServices proxy
> -                );
> -        }
> -        catch(...) {
> -            OutputDebugString("Exception connecting to server\n");
> -            goto err_out;
> -        }
> -
> -        OutputDebugString("Check result\n");
> -        if (FAILED(hres)) {
> -            goto err_out;
> -        }
> -        /* WMI needs to impersonate us, because it normally runs as an
> -           unprivileged user and needs our authority in order to access
> -           device files and so forth.  Turn impersonation on. */
> -        OutputDebugString("Proxy blanket\n");
> -        hres = CoSetProxyBlanket(
> -            wmi->mpSvc,                  // the proxy to set
> -            RPC_C_AUTHN_WINNT,           /* LAN manager authentication,
> -                                            although it doesn't really
> -                                            matter on localhost. */
> -            RPC_C_AUTHZ_NONE,            // LANMAN can't do much 
> authorization.
> -            NULL,                        // Server principal name
> -            RPC_C_AUTHN_LEVEL_CALL,      // Do authentication on every call
> -            RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
> -            NULL,                        // Use current client identity
> -            EOAC_NONE                    // No extended proxy capabilities
> -        );
> -        if (FAILED(hres)) {
> -            goto err_out;
> -        }
> -        OutputDebugString("WMI Server\n");
> -        hres = locator->ConnectServer(
> -            L"root\\WMI",          // WMI namespace
> -            NULL,                    // User name
> -            NULL,                    // User password
> -            NULL,                    // Locale
> -            0,                       // Security flags
> -            NULL,                    // Authority
> -            NULL,                    // Context object
> -            &wmi->mpXSSvc              // IWbemServices proxy
> -            );
> -
> -        if (FAILED(hres)) {
> -            goto err_out;
> -        }
> -        OutputDebugString("Impersonation\n");
> -        /* WMI needs to impersonate us, because it normally runs as an
> -           unprivileged user and needs our authority in order to access
> -           device files and so forth.  Turn impersonation on. */
> -        hres = CoSetProxyBlanket(
> -            wmi->mpXSSvc,                  // the proxy to set
> -            RPC_C_AUTHN_WINNT,           /* LAN manager authentication,
> -                                            although it doesn't really
> -                                            matter on localhost. */
> -            RPC_C_AUTHZ_NONE,            // LANMAN can't do much 
> authorization.
> -            NULL,                        // Server principal name
> -            RPC_C_AUTHN_LEVEL_CALL,      // Do authentication on every call
> -            RPC_C_IMP_LEVEL_IMPERSONATE, // Allow full impersonation.
> -            NULL,                        // Use current client identity
> -            EOAC_NONE                    // No extended proxy capabilities
> -        );
> -        if (FAILED(hres)) {
> -            goto err_out;
> -        }
> -
> -
> -    OutputDebugString("Wmi connected\n");
> -    /* All done. */
> -    return true;
> -
> -err_out:
> -    OutputDebugString("WMI connection failed\n");
> -    ReleaseWMIAccessor(&wmi);
> -    return false;
> -}
> -
> -
> -void ReleaseCom(void) {
> -
> -    if (com_initialized) {
> -        OutputDebugString("Release locator\n");
> -        locator->Release();
> -        //XsLog("Wmi disconnect thread %p", GetCurrentThread());
> -        //ASSERT((*wmi)->owning_thread == GetCurrentThread());
> -        com_initialized = 0;
> -        OutputDebugString("Uninitialize com\n");
> -        CoUninitialize();
> -
> -    }
> -}
> -
> -/* Careful: WMI accessors must be released on the same thread that
> -   allocated them. */
> -void ReleaseWMIAccessor(struct WMIAccessor **wmi)
> -{
> -    OutputDebugString("Should I release wmi?\n");
> -    if (*wmi == NULL)
> -        return;
> -    OutputDebugString("Get rid of WMI servers\n");
> -    if ((*wmi)->mpXSSvc != NULL)
> -        (*wmi)->mpXSSvc->Release();
> -    if ((*wmi)->mpSvc != NULL)
> -        (*wmi)->mpSvc->Release();
> -    OutputDebugString("Clear WmI\n");
> -    /* Poison wmi to make use-after-free()s a bit more obvious. */
> -    memset((*wmi), 0xab, sizeof(**wmi));
> -    XsFree(*wmi);
> -    *wmi = NULL;
> -    ReleaseCom();
> -    OutputDebugString("Released WMI\n");
> -}
> -
> -/* The fact that something is documented as being a uint64_t field
> -   doesn't imply that it will be returned as a VT_UI8 field in a
> -   variant structure.  Work around this with a handy conversion
> -   function. */
> -static uint64_t
> -GetVariantUint64(VARIANT *vtData)
> -{
> -    switch (vtData->vt) {
> -    case VT_I2:
> -        return vtData->iVal;
> -    case VT_I4:
> -        return vtData->lVal;
> -    case VT_I8:
> -        return vtData->llVal;
> -    case VT_UI2:
> -        return vtData->uiVal;
> -    case VT_UI4:
> -        return vtData->ulVal;
> -    case VT_UI8:
> -        return vtData->ullVal;
> -    case VT_BSTR:
> -        /* Yes, I really do mean BSTR: XP returns 64 bit values as
> -           strings, and we then have to do atoill on it. */
> -        return _wtoi64(vtData->bstrVal);
> -    default:
> -        DBGPRINT(("Bad uint64_t variant %d.\n",vtData->vt));
> -        return -1;
> -    }
> -}
> -
> -static HRESULT
> -QueryVariant(WMIAccessor *wmi, PWCHAR field, PWCHAR table, VARIANT
> *vt)
> -{
> -    IEnumWbemClassObject *pEnum;
> -    BSTR query;
> -    size_t query_len;
> -    IWbemClassObject *pclsObj;
> -    HRESULT hr;
> -    ULONG uReturn;
> -
> -    query_len = strlen("SELECT  FROM ") + wcslen(field) + wcslen(table) + 1;
> -    query = SysAllocStringLen(NULL, (UINT)query_len);
> -    if (query == NULL) {
> -        hr = E_OUTOFMEMORY;
> -        goto err;
> -    }
> -    swprintf_s(query, query_len, L"SELECT %s FROM %s", field, table);
> -    pEnum = runQuery(wmi, query);
> -    SysFreeString(query);
> -
> -    if (pEnum == NULL) {
> -        hr = E_OUTOFMEMORY;
> -        goto err;
> -    }
> -
> -    hr = pEnum->Next(WBEM_INFINITE, 1, &pclsObj, &uReturn);
> -    pEnum->Release();
> -    if (FAILED(hr))
> -        goto err;
> -    if (uReturn == 0) {
> -        hr = E_FAIL;
> -        goto err;
> -    }
> -
> -    hr = pclsObj->Get(field, 0, vt, NULL, NULL);
> -    pclsObj->Release();
> -
> -    return hr;
> -
> -err:
> -    return hr;
> -}
> -
> -static uint64_t
> -QueryUint64(WMIAccessor *wmi, PWCHAR field, PWCHAR table)
> -{
> -    HRESULT hr;
> -    uint64_t res;
> -    VARIANT vt;
> -
> -    memset(&vt, 0, sizeof(vt));
> -
> -    hr = QueryVariant(wmi, field, table, &vt);
> -    if (FAILED(hr))
> -        return 0;
> -
> -    res = GetVariantUint64(&vt);
> -    VariantClear(&vt);
> -    return res;
> -}
> -
> -static BSTR
> -QueryBstr(WMIAccessor *wmi, PWCHAR field, PWCHAR table)
> -{
> -    HRESULT hr;
> -    VARIANT vt;
> -
> -    memset(&vt, 0, sizeof(vt));
> -
> -    hr = QueryVariant(wmi, field, table, &vt);
> -    if (FAILED(hr))
> -        return NULL;
> -    if (vt.vt != VT_BSTR) {
> -        VariantClear(&vt);
> -        return NULL;
> -    }
> -    return vt.bstrVal;
> -}
> -
> -
> -
> -/* hash comparator for strings which strips off trailing .exe
> - * suffix */
> -class string_eq_exe {
> -private:
> -    static size_t len_without_suffix(const char *x)
> -    {
> -        size_t l;
> -        l = strlen(x);
> -        if (l > 4 && !strcmp(x + l - 4, ".exe"))
> -            l -= 4;
> -        return l;
> -    }
> -
> -public:
> -    enum {bucket_size = 4, min_buckets = 8};
> -    bool operator()(const string &a, const string &b) const
> -    {
> -        const char *a_c, *b_c;
> -        size_t a_l, b_l;
> -        a_c = a.c_str();
> -        b_c = b.c_str();
> -        a_l = len_without_suffix(a_c);
> -        b_l = len_without_suffix(b_c);
> -
> -        if (a_l != b_l)
> -            return 1;
> -        if (memcmp(a_c, b_c, a_l))
> -            return 1;
> -        else
> -            return 0;
> -    }
> -
> -    size_t operator()(const string &a) const
> -    {
> -        size_t acc = 0;
> -        const char *c_str = a.c_str();
> -        size_t len = len_without_suffix(c_str);
> -        unsigned x;
> -        for (x = 0; x < len; x++)
> -            acc = (acc * 17 + c_str[x]) % 257;
> -        return acc;
> -    }
> -};
> -
> -
> -IWbemClassObject *getBase(WMIAccessor** wmi)
> -{
> -    IWbemClassObject* base = getObject(wmi, OBJECT_NAME_W(Base));
> -    if (base == NULL) {
> -        *wmi = NULL;
> -        return NULL;
> -    }
> -    return base;
> -}
> -
> -IWbemClassObject *getBaseClass(WMIAccessor** wmi)
> -{
> -    IWbemClassObject* baseclass = getClass(wmi, OBJECT_NAME_W(Base));
> -    if (baseclass == NULL) {
> -        *wmi = NULL;
> -        return NULL;
> -    }
> -    return baseclass;
> -}
> -
> -ULONGLONG get64BitUnsigned(VARIANT *var) {
> -    ULONGLONG res = 0;
> -    switch (var->vt) {
> -        case VT_BSTR: {
> -                VARIANT outvar;
> -                VariantInit(&outvar);
> -                VariantChangeType(&outvar, var, 0, VT_UI8);
> -                res = outvar.ullVal;
> -                VariantClear(&outvar);
> -            }
> -            break;
> -        case VT_UI8: {
> -                res = var->ullVal;
> -            }
> -            break;
> -    }
> -    return res;
> -}
> -
> -FILETIME WmiGetXenTime(WMIAccessor **wmi) {
> -     FILETIME out;
> -
> -     IWbemClassObject *base = getBase(wmi);
> -     if (base == NULL) {
> -         DBGPRINT(("Unable to find base WMI session\n"));
> -         goto getbasefailed;
> -     }
> -
> -     VARIANT timevar;
> -     BSTR timename = mkBstr("XenTime", 7);
> -     if (timename == NULL)
> -         goto buildtimenamefailed;
> -
> -
> -
> -     if (FAILED(base->Get(timename, 0, &timevar, NULL, NULL)))
> -         goto gettimefailed;
> -
> -     ULONGLONG time =get64BitUnsigned(&timevar);;
> -
> -     out.dwLowDateTime = (DWORD)time;
> -     out.dwHighDateTime = (DWORD)(time>>32);
> -     return out;
> -
> -gettimefailed:
> -buildtimenamefailed:
> -getbasefailed:
> -     out.dwLowDateTime = 0;
> -     out.dwHighDateTime = 0;
> -     return out ;
> -}
> -
> -IWbemClassObject *openSession(WMIAccessor** wmi, const char
> *sessionname)
> -{
> -    HRESULT hres;
> -
> -    BSTR query = formatBstr("SELECT * FROM " OBJECT_NAME_A(Session) "
> WHERE Id=\"" OBJECT_PREFIX_STR " Xen Win32 Service : %s\"",
> sessionname);
> -    if (query == NULL)
> -        goto formatsessionbstrfailed;
> -
> -    IEnumWbemClassObject * sessions = runXSQuery(wmi, query);
> -    SysFreeString(query);
> -
> -    if (sessions) {
> -        IWbemClassObject *returnedObject;
> -        ULONG count;
> -        hres = sessions->Next(WBEM_INFINITE, 1, &returnedObject, &count);
> -        sessions->Release();
> -
> -        if (count>0) {
> -            if (sessionname !=NULL ) {
> -                if (!WmiSessionEnd(wmi, returnedObject)) {
> -                    return NULL;
> -                }
> -            }
> -            else {
> -                return returnedObject;
> -            }
> -        }
> -    }
> -
> -    IWbemClassObject *base = getBase(wmi);
> -    if (base==NULL) {
> -        DBGPRINT(("Unable to find base WMI session\n"));
> -        goto getbasefailed;
> -    }
> -
> -    IWbemClassObject *baseclass = getBaseClass(wmi);
> -
> -    if (baseclass == NULL)
> -        goto getbaseclassfailed;
> -
> -    IWbemClassObject *inMethod;
> -
> -    IWbemClassObject *inMethodInst;
> -    IWbemClassObject *outMethodInst;
> -    if (FAILED(baseclass->GetMethod(L"AddSession",0,&inMethod, NULL)))
> -        goto getmethodaddsessionfailed;
> -
> -    if (FAILED(inMethod->SpawnInstance(0, &inMethodInst)))
> -        goto inmethodspawnfailed;
> -
> -    VARIANT var;
> -    var.vt = VT_BSTR;
> -    var.bstrVal=formatBstr(VENDOR_NAME_STR " " PRODUCT_NAME_STR "
> Win32 Service : %s", sessionname);
> -
> -    if (var.bstrVal == NULL)
> -        goto formatnamebstrfailed;
> -
> -    if (FAILED(inMethodInst->Put(L"Id", 0, &var, 0)))
> -        goto methodputfailed;
> -
> -    if (FAILED(methodExec(wmi, base, L"AddSession", inMethodInst,
> &outMethodInst)))
> -        goto methodexecaddsessionfailed;
> -
> -    if (FAILED(outMethodInst->Get(L"SessionId", 0, &var, NULL, NULL)))
> -        goto outmethodgetfailed;
> -
> -    size_t query_len;
> -    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 "
> OBJECT_NAME_W(Session) L" WHERE SessionId=%d", var.uintVal);
> -
> -    sessions = runXSQuery(wmi, query );
> -    SysFreeString(query);
> -
> -    if (sessions) {
> -        IWbemClassObject *returnedObject;
> -        ULONG count;
> -        hres = sessions->Next(WBEM_INFINITE, 1, &returnedObject, &count);
> -        sessions->Release();
> -        if (count>0) {
> -            return returnedObject;
> -        }
> -
> -    }
> -
> -    outMethodInst->Release();
> -    VariantClear(&var);
> -    inMethodInst->Release();
> -    inMethod->Release();
> -    base->Release();
> -    baseclass->Release();
> -    return NULL;
> -
> -allocqueryfailed:
> -outmethodgetfailed:
> -    outMethodInst->Release();
> -
> -methodexecaddsessionfailed:
> -methodputfailed:
> -    VariantClear(&var);
> -
> -formatnamebstrfailed:
> -    inMethodInst->Release();
> -inmethodspawnfailed:
> -    inMethod->Release();
> -
> -
> -getmethodaddsessionfailed:
> -    baseclass->Release();
> -
> -getbaseclassfailed:
> -    base->Release();
> -
> -getbasefailed:
> -
> -
> -formatsessionbstrfailed:
> -    return NULL;
> -}
> -
> -IWbemClassObject* sessionMethodStart(WMIAccessor**wmi,
> -                                     const wchar_t *methodname)
> -{
> -    IWbemClassObject *inMethod;
> -    IWbemClassObject *inMethodInst = NULL;
> -    IWbemClassObject *sessionClass;
> -    HRESULT hr;
> -
> -    ASSERT(wmi != NULL);
> -
> -    sessionClass = getClass(wmi, OBJECT_NAME_W(Session));
> -    if (sessionClass == NULL)
> -        goto getclassfailed;
> -
> -    hr = sessionClass->GetMethod(methodname,0,&inMethod, NULL);
> -    if (FAILED(hr))
> -        goto getmethodfailed;
> -
> -    hr = inMethod->SpawnInstance(0, &inMethodInst);
> -    if (FAILED(hr))
> -        goto spawninstancefailed;
> -
> -    inMethod->Release();
> -
> -    sessionClass->Release();
> -    return inMethodInst;
> -
> -
> -spawninstancefailed:
> -    inMethod->Release();
> -
> -getmethodfailed:
> -    sessionClass->Release();
> -
> -getclassfailed:
> -    return NULL;
> -}
> -
> -
> -char * bstrToChar(BSTR bst, size_t *len) {
> -    *len = wcslen(bst);
> -    char *space = (char *)XsAlloc(*len+1);
> -    if (space)
> -        wcstombs_s(len, space, *len+1, bst,  _TRUNCATE);
> -    return space;
> -}
> -
> -void WmiSessionLog(WMIAccessor** wmi,  void **sessionhandle,const
> char *fmt, va_list args) {
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -
> -    char* message = formatCharStrInt(fmt,args);
> -
> -    OutputDebugString(message);
> -    if (((*wmi)==NULL) || ((*sessionhandle)==NULL) ) {
> -        goto nowmi;
> -    }
> -    VARIANT vmessage;
> -    if (setVariantString(&vmessage, message))
> -        goto setvmessage;
> -
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi, L"Log");
> -    if (!inMethodInst)
> -        goto sessionstart;
> -
> -     if (FAILED(inMethodInst->Put(L"Message",0,&vmessage,0)))
> -         goto methodputfailed;
> -
> -     if (FAILED(methodExec(wmi,*session, L"Log", inMethodInst, NULL)))
> -         goto methodexecfailed;
> -
> -methodexecfailed:
> -methodputfailed:
> -     inMethodInst->Release();
> -
> -sessionstart:
> -    VariantClear(&vmessage);
> -
> -setvmessage:
> -nowmi:
> -    return;
> -}
> -
> -char* WmiSessionGetEntry(WMIAccessor** wmi, void **sessionhandle,
> -              const char * path, size_t* len)
> -{
> -    *len = 0;
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -
> -    VARIANT vpath;
> -    if (setVariantString(&vpath, path))
> -        goto setvpath;
> -
> -    IWbemClassObject *outMethodInst = NULL;
> -
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi,
> L"GetValue");
> -    if (inMethodInst == NULL)
> -        goto sessionmethodstartfailed;
> -
> -    if (FAILED(inMethodInst->Put(L"PathName",0,&vpath,0)))
> -        goto methodexecfailed;
> -
> -    methodExec(wmi,*session, L"GetValue", inMethodInst,
> &outMethodInst);
> -    if (outMethodInst==NULL)
> -        goto sessionExec;
> -
> -    VARIANT outval;
> -    VariantInit(&outval);
> -
> -    if (FAILED(outMethodInst->Get(L"value", 0, &outval, NULL, NULL)))
> -        goto methodgetfailed;
> -
> -    char *space = NULL;
> -
> -    if (V_VT(&outval) == VT_BSTR)
> -    {
> -        space = bstrToChar(outval.bstrVal, len);
> -    }
> -
> -    outMethodInst->Release();
> -    inMethodInst->Release();
> -    VariantClear(&vpath);
> -    VariantClear(&outval);
> -    return space;
> -
> -methodgetfailed:
> -    outMethodInst->Release();
> -
> -methodexecfailed:
> -sessionExec:
> -    inMethodInst->Release();
> -
> -sessionmethodstartfailed:
> -    VariantClear(&vpath);
> -
> -setvpath:
> -    return NULL;
> -}
> -
> -int WmiSessionSetEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path, const char * value, size_t len)
> -{
> -    int err = -1;
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -
> -    VARIANT vpath;
> -    if (setVariantString(&vpath, path))
> -        goto setvpath;
> -
> -    VARIANT vvalue;
> -    if (setVariantString(&vvalue, value))
> -        goto setvvalue;
> -
> -    IWbemClassObject *outMethodInst;
> -
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi,
> L"SetValue");
> -    if (!inMethodInst)
> -        goto sessionstart;
> -
> -    inMethodInst->Put(L"PathName",0,&vpath,0);
> -    inMethodInst->Put(L"value",0,&vvalue,0);
> -
> -    if (FAILED(methodExec(wmi,*session, L"SetValue", inMethodInst,
> &outMethodInst)))
> -        goto methodexecfailed;
> -
> -    if (outMethodInst!=NULL)
> -        outMethodInst->Release();
> -
> -    inMethodInst->Release();
> -    SysFreeString(vvalue.bstrVal);
> -    SysFreeString(vpath.bstrVal);
> -
> -    return 0;
> -
> -methodexecfailed:
> -    XsLog("WmiSessionSetEntry:MethodExec Failed");
> -    inMethodInst->Release();
> -
> -sessionstart:
> -    XsLog("WmiSessionSetEntry:SessionStart Failed");
> -    SysFreeString(vvalue.bstrVal);
> -
> -setvvalue:
> -    XsLog("WmiSessionSetEntry:SetVValue Failed");
> -    SysFreeString(vpath.bstrVal);
> -
> -setvpath:
> -    XsLog("WmiSessionSetEntry:SetVPath Failed ");
> -    return err;
> -}
> -
> -int WmiSessionSetEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path, const char * value) {
> -    return WmiSessionSetEntry(wmi, sessionhandle, path, value,
> strlen(value));
> -}
> -
> -int WmiSessionRemoveEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path){
> -
> -    int err = -1;
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -
> -    VARIANT vpath;
> -    if (setVariantString(&vpath, path))
> -        goto setvpath;
> -
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi,
> L"RemoveValue");
> -    if (!inMethodInst)
> -        goto sessionstart;
> -
> -    if (FAILED(inMethodInst->Put(L"PathName",0,&vpath,0)))
> -        goto methodputfailed;
> -
> -    IWbemClassObject* outMethodInst;
> -
> -    if (FAILED(methodExec(wmi,*session, L"RemoveValue", inMethodInst,
> &outMethodInst)))
> -        goto methodexecfailed;
> -
> -    if (outMethodInst != NULL)
> -        outMethodInst->Release();
> -
> -    err=0;
> -    inMethodInst->Release();
> -    VariantClear(&vpath);
> -    return err;
> -methodexecfailed:
> -    OutputDebugString(__FUNCTION__ " MethodExecFailed");
> -methodputfailed:
> -    OutputDebugString(__FUNCTION__ " MethodPutFailed");
> -    inMethodInst->Release();
> -
> -sessionstart:
> -    OutputDebugString(__FUNCTION__ " SessionStartFailed");
> -    VariantClear(&vpath);
> -
> -    OutputDebugString(__FUNCTION__ " SessionExecFailed");
> -setvpath:
> -    OutputDebugString(__FUNCTION__ " SetVpathFailed");
> -    return err;
> -}
> -
> -
> -BOOL WmiSessionUnwatch(WMIAccessor** wmi,  void **sessionhandle,
> -                         void *watchhandle) {
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -    XsLog("Unwatch %p",watchhandle);
> -    WatchSink * sink = (WatchSink *)watchhandle;
> -
> -    VARIANT vpath;
> -    if (setVariantString(&vpath, sink->path))
> -        goto setvpath;
> -
> -    IWbemClassObject *outMethodInst;
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi,
> L"RemoveWatch");
> -    if (!inMethodInst)
> -        goto sessionstart;
> -
> -    inMethodInst->Put(L"PathName",0,&vpath,0);
> -    if FAILED(methodExec(wmi,*session, L"RemoveWatch", inMethodInst,
> &outMethodInst))
> -        goto methodexecfailed;
> -    if (outMethodInst==NULL)
> -        goto sessionexecfailed;
> -
> -    outMethodInst->Release();
> -
> -methodexecfailed:
> -sessionexecfailed:
> -    inMethodInst->Release();
> -
> -sessionstart:
> -setvpath:
> -    sink->Release();
> -    return true;
> -}
> -
> -BOOL WmiSessionStart(WMIAccessor** wmi,  void **sessionhandle, const
> char* sessionname)
> -{
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -    if ((*session = openSession(wmi, sessionname)) == NULL) {
> -        return false;
> -    }
> -    return true;
> -}
> -
> -
> -BOOL WmiSessionEnd(WMIAccessor** wmi,  void *sessionhandle)
> -{
> -    HRESULT hr;
> -    ASSERT(*wmi != NULL);
> -
> -    IWbemClassObject *session = (IWbemClassObject *)sessionhandle;
> -    if (session==NULL) {
> -        return false;
> -    }
> -    hr = methodExec(wmi, session, L"EndSession", NULL,NULL);
> -    if FAILED(hr)
> -        goto execmethodfailed;
> -    session->Release();
> -    return true;
> -
> -execmethodfailed:
> -    return false;
> -
> -}
> -
> -void *WmiSessionWatch(WMIAccessor** wmi,  void **sessionhandle,
> -                      const char *path, HANDLE event, HANDLE errorevent) {
> -
> -    HRESULT hr;
> -
> -    IWbemClassObject **session = (IWbemClassObject **)sessionhandle;
> -
> -    ASSERT((*wmi) != NULL);
> -    ASSERT((*sessionhandle) != NULL);
> -
> -    WatchSink * sink = new WatchSink(event, errorevent, path);
> -    BSTR query=formatBstr("SELECT * from " OBJECT_NAME_A(WatchEvent)
> " WHERE EventId=\"%s\"", path);
> -    if (query == NULL) {
> -        goto formatstringfailed;
> -    }
> -
> -    hr = (*wmi)->mpXSSvc->ExecNotificationQueryAsync(L"WQL",
> query,0,NULL, sink);
> -    if (FAILED(hr)){
> -        *wmi = NULL;
> -        goto wmifailed;
> -    }
> -
> -    VARIANT vpath;
> -    if (setVariantString(&vpath, path)){
> -        goto setvpath;
> -    }
> -
> -
> -    IWbemClassObject *inMethodInst = sessionMethodStart( wmi,
> L"SetWatch");
> -    if (!inMethodInst)
> -        goto sessionstart;
> -
> -    hr = inMethodInst->Put(L"PathName",0,&vpath,0);
> -    if (FAILED(hr))
> -        goto methodputfailed;
> -
> -    hr = methodExec(wmi,*session, L"SetWatch", inMethodInst, NULL);
> -    if (FAILED(hr))
> -        goto methodexecfailed;
> -
> -    VariantClear(&vpath);
> -
> -    SysFreeString(query);
> -
> -    return sink;
> -
> -
> -methodexecfailed:
> -    OutputDebugString(__FUNCTION__ " : methodexecfailed\n");
> -methodputfailed:
> -    OutputDebugString(__FUNCTION__ " : methodputfailed\n");
> -    inMethodInst->Release();
> -sessionstart:
> -    OutputDebugString(__FUNCTION__ " : sessionstart\n");
> -    VariantClear(&vpath);
> -setvpath:
> -    OutputDebugString(__FUNCTION__ " : setvpath\n");
> -wmifailed:
> -    SysFreeString(query);
> -formatstringfailed:
> -    OutputDebugString(__FUNCTION__ " : formatstringfailed\n");
> -    delete sink;
> -    return NULL;
> -}
> -
> -void *WmiUnsuspendedEventWatch(WMIAccessor **wmi, HANDLE event,
> HANDLE errorevent)
> -{
> -    HRESULT hr;
> -
> -    ASSERT(*wmi != NULL);
> -
> -    WatchSink * sink = new WatchSink(event, errorevent, NULL);
> -    BSTR query=formatBstr("SELECT * from "
> OBJECT_NAME_A(UnsuspendedEvent));
> -    if (query==NULL) {
> -        goto formatstringfailed;
> -    }
> -
> -    hr = (*wmi)->mpXSSvc->ExecNotificationQueryAsync(L"WQL",
> query,0,NULL, sink);
> -    if FAILED(hr)
> -        goto asyncqueryfailed;
> -
> -    SysFreeString(query);
> -    return sink;
> -
> -asyncqueryfailed:
> -    SysFreeString(query);
> -formatstringfailed:
> -    delete sink;
> -    return NULL;
> -}
> -
> diff --git a/src/win32stubagent/WmiAccessor.h
> b/src/win32stubagent/WmiAccessor.h
> deleted file mode 100644
> index e37ef71..0000000
> --- a/src/win32stubagent/WmiAccessor.h
> +++ /dev/null
> @@ -1,88 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#ifndef _WMIACCESSOR_H
> -#define _WMIACCESSOR_H
> -
> -#include <Wbemidl.h>
> -#include <list>
> -#include <vector>
> -#include <map>
> -#include <string>
> -
> -#include "XSAccessor.h"
> -
> -using namespace std;
> -
> -typedef unsigned __int64 uint64_t;
> -
> -struct WMIAccessor;
> -
> -extern struct WMIAccessor *wmi;
> -
> -extern LONG wmicount;
> -BOOL InitCom(void);
> -void ReleaseCom(void);
> -BOOL ConnectToWMI(void);
> -void ReleaseWMIAccessor(struct WMIAccessor **);
> -
> -void UpdateProcessListInStore(WMIAccessor **wmi);
> -
> -int WmiSessionSetEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path, const char * value);
> -
> -int WmiSessionSetEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path, const char * value, size_t len);
> -char* WmiSessionGetEntry(WMIAccessor** wmi, void **sessionhandle,
> -              const char * path, size_t* len) ;
> -
> -void *WmiSessionWatch(WMIAccessor** wmi,  void **sessionhandle,
> -                      const char *path, HANDLE event, HANDLE errorevent);
> -BOOL WmiSessionUnwatch(WMIAccessor** wmi,  void **sessionhandle,
> -                         void *watchhandle);
> -
> -int WmiSessionRemoveEntry(WMIAccessor** wmi,  void **sessionhandle,
> -              const char*path);
> -
> -char **WmiSessionGetChildren(WMIAccessor** wmi, void
> **sessionhandle,
> -              const char * path, unsigned *numentries);
> -
> -
> -void *WmiUnsuspendedEventWatch(WMIAccessor **wmi, HANDLE event,
> HANDLE errorevent);
> -
> -int WmiSessionTransactionAbort(WMIAccessor** wmi,  void
> **sessionhandle);
> -int WmiSessionTransactionCommit(WMIAccessor** wmi,  void
> **sessionhandle);
> -int WmiSessionTransactionStart(WMIAccessor** wmi,  void
> **sessionhandle);
> -BOOL WmiSessionStart(WMIAccessor** wmi,  void **sessionhandle, const
> char *sessionname);
> -BOOL WmiSessionEnd(WMIAccessor** wmi,  void *sessionhandle);
> -FILETIME WmiGetXenTime(WMIAccessor **wmi);
> -void WmiSessionLog(WMIAccessor** wmi,  void **sessionhandle,const
> char *fmt, va_list args);
> -#endif
> diff --git a/src/win32stubagent/XSAccessor.cpp
> b/src/win32stubagent/XSAccessor.cpp
> deleted file mode 100644
> index c60fb8b..0000000
> --- a/src/win32stubagent/XSAccessor.cpp
> +++ /dev/null
> @@ -1,230 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <windows.h>
> -#include "stdafx.h"
> -#include "XSAccessor.h"
> -#include "WMIAccessor.h"
> -
> -static __declspec(thread) void *WmiSessionHandle = NULL;
> -
> -static LONG volatile threadcount = 0;
> -static __declspec(thread) LONG localthreadcount = 0;
> -static __declspec(thread) LONG localwmicount = 0;
> -
> -static long update_cnt=0xF0000000;
> -#define XENSTORE_MAGIC 0x7e6ec123
> -
> -void *XsAlloc(size_t size) {
> -    void *buf;
> -
> -    buf = malloc(size + 8);
> -    if (!buf) {
> -        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
> -        return NULL;
> -    }
> -    memset(buf, 0, size + 8);
> -    *(unsigned *)buf = XENSTORE_MAGIC;
> -    return (void *)((ULONG_PTR)buf + 8);
> -}
> -
> -void XsFree(const void *buf) {
> -    void *orig_buf;
> -
> -    if (!buf)
> -        return;
> -    orig_buf = (void *)((ULONG_PTR)buf - 8);
> -    if (*(unsigned *)orig_buf != XENSTORE_MAGIC) {
> -        OutputDebugString("XsFree() invoked on bad pointer\n");
> -        DebugBreak();
> -    }
> -    free(orig_buf);
> -}
> -
> -void GetXenTime(FILETIME *now)
> -{
> -    *now = WmiGetXenTime(&wmi);
> -}
> -
> -
> -int ListenSuspend(HANDLE event, HANDLE errorevent)
> -{
> -    if (!WmiUnsuspendedEventWatch(&wmi, event, errorevent))
> -        return -1;
> -    else
> -        return 0;
> -}
> -
> -BOOL InitXSAccessor()
> -{
> -    OutputDebugString("XSAccessor\n");
> -    if (wmicount != localwmicount) {
> -
> -        if (localthreadcount == 0) {
> -            localthreadcount = InterlockedIncrement(&threadcount);
> -        }
> -        char wminame[12];
> -        _snprintf(wminame, 12, "XS%x", localthreadcount);
> -        if (WmiSessionStart(&wmi, &WmiSessionHandle, wminame)) {
> -            localwmicount = wmicount;
> -            return true;
> -        }
> -        OutputDebugString("XSAccessor Failed\n");
> -        return false;
> -    }
> -    return true;
> -}
> -
> -void XsLog(const char *fmt, ...)
> -{
> -    va_list args;
> -
> -    va_start(args, fmt);
> -    WmiSessionLog(&wmi, &WmiSessionHandle, fmt, args);
> -    va_end(args);
> -}
> -
> -
> -BOOL ShutdownXSAccessor(void)
> -{
> -    if (wmi == NULL) {
> -        return false;
> -    }
> -    if (WmiSessionHandle == NULL) {
> -        return false;
> -    }
> -    return WmiSessionEnd(&wmi, WmiSessionHandle);
> -
> -}
> -
> -int XenstorePrintf(const char *path, const char *fmt, ...)
> -{
> -    va_list l;
> -    char buf[4096];
> -    int cnt;
> -
> -    va_start(l, fmt);
> -    cnt = _vsnprintf(buf, sizeof(buf), fmt, l);
> -    va_end(l);
> -    if (cnt < 0) {
> -        DBGPRINT (("Cannot format data for XenstorePrintf!"));
> -        return -1;
> -    }
> -    OutputDebugString(buf);
> -    /* Now have the thing we're trying to write. */
> -    return WmiSessionSetEntry(&wmi, &WmiSessionHandle, path, buf);
> -}
> -
> -BOOL XenstoreKickXapi()
> -{
> -    /* New protocol */
> -    if (XenstorePrintf("data/update_cnt", "%I64d", update_cnt)){
> -        XsLog("New kick failed ");
> -        return false;
> -    }
> -    /* Old protocol */
> -    if (WmiSessionSetEntry(&wmi, &WmiSessionHandle, "data/updated",
> "1")){
> -        XsLog("Old kick failed");
> -        return false;
> -    }
> -    update_cnt++;
> -    return true;
> -}
> -
> -
> -int
> -XenstoreRemove(const char *path)
> -{
> -    if (wmi == NULL)
> -        return -1;
> -
> -    if (WmiSessionHandle == NULL)
> -        return -1;
> -
> -    if (WmiSessionRemoveEntry(&wmi, &WmiSessionHandle, path))
> -        return -1;
> -    else
> -        return 0;
> -}
> -
> -ssize_t
> -XenstoreRead(const char* path, char** value)
> -{
> -    size_t len;
> -    *value =WmiSessionGetEntry(&wmi, &WmiSessionHandle, path, &len);
> -    if (*value)
> -        return (ssize_t)len;
> -    else
> -        return -1;
> -}
> -
> -
> -bool XenstoreReadDword(const char *path, DWORD *value) {
> -    char* buffer;
> -    ssize_t len;
> -    len = XenstoreRead(path, &buffer);
> -    if (len <= 0) {
> -        return false;
> -    }
> -    *value = atoi(buffer);
> -
> -    XsFree(buffer);
> -
> -    return true;
> -}
> -
> -void *
> -XenstoreWatch(const char *path, HANDLE event, HANDLE errorevent)
> -{
> -
> -    if (wmi == NULL) {
> -        OutputDebugString("WMI is null\n");
> -        return NULL;
> -    }
> -    if (WmiSessionHandle == NULL) {
> -        OutputDebugString("Session is null\n");
> -        return NULL;
> -    }
> -    return WmiSessionWatch(&wmi, &WmiSessionHandle, path, event,
> errorevent);
> -}
> -
> -BOOL
> -XenstoreUnwatch(void *watch)
> -{
> -    return WmiSessionUnwatch(&wmi, &WmiSessionHandle, watch);
> -}
> -
> -void
> -XenstoreFree(void *tofree)
> -{
> -    return XsFree(tofree);
> -}
> -
> diff --git a/src/win32stubagent/XSAccessor.h
> b/src/win32stubagent/XSAccessor.h
> deleted file mode 100644
> index 2ed41b0..0000000
> --- a/src/win32stubagent/XSAccessor.h
> +++ /dev/null
> @@ -1,126 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -
> -#ifndef _XSACCESSOR_H
> -#define _XSACCESSOR_H
> -
> -#include <string>
> -#include "windows.h"
> -
> -
> -using namespace std;
> -
> -#define MAX_XENBUS_PATH 256
> -
> -#ifdef AMD64
> -typedef long long ssize_t;
> -#else
> -typedef long ssize_t;
> -#endif
> -
> -BOOL InitXSAccessor();
> -BOOL ShutdownXSAccessor();
> -ssize_t XenstoreRead(const char *path, char **value);
> -int XenstoreRemove(const char *path);
> -int XenstorePrintf(const char *path, const char *fmt, ...);
> -int XenstoreWrite(const char *path, const void *data, size_t len);
> -BOOL XenstoreKickXapi(void);
> -void *XenstoreWatch(const char *path, HANDLE event, HANDLE
> errorevent);
> -BOOL XenstoreUnwatch(void *watch);
> -int ListenSuspend(HANDLE evt, HANDLE errorevent);
> -void GetXenTime(FILETIME *res);
> -void XsLog(const char *fmt, ...);
> -void XenstoreFree(void *tofree);
> -void *XsAlloc(size_t size);
> -void XsFree(const void *buf);
> -bool XenstoreReadDword(const char * path, DWORD *value);
> -
> -#if DBG
> -
> -#include <stdarg.h>         // va_list
> -#include <stdio.h>          // vsprintf
> -#include <malloc.h>
> -
> -#include <assert.h>
> -#include <tchar.h>
> -
> -__inline void DebugPrint( IN LPCTSTR msg, IN ... )
> -{
> -    TCHAR   buffer[256];
> -    int     res;
> -    va_list args;
> -
> -    va_start( args, msg );
> -#pragma prefast(suppress: 28719, "Yes, we all know _vsnprintf is banned in
> drivers, this is user level");
> -    res = _vsntprintf(buffer, sizeof(buffer) / sizeof(buffer[0]), msg, args);
> -    if (res >= 0)
> -    {
> -        OutputDebugString( buffer );
> -    }
> -    else
> -    {
> -        TCHAR *p;
> -        int count;
> -
> -        count = 512;
> -        for (;;) {
> -            p = (TCHAR *)malloc(count * sizeof (TCHAR));
> -            if (!p) {
> -                OutputDebugString(_T("Out of memory for debug message!\n"));
> -                break;
> -            }
> -            res = _vsntprintf(p, count, msg, args);
> -            if (res >= 0)
> -                break;
> -
> -            free(p);
> -            count += 256;
> -        }
> -        if (p) {
> -            OutputDebugString( p );
> -            free(p);
> -        }
> -    }
> -    va_end(args);
> -}
> -
> -#define DBGPRINT(_x_) DebugPrint _x_
> -#define ASSERT  assert
> -
> -#else
> -
> -#define DBGPRINT(_x_)
> -#define ASSERT
> -
> -#endif // DBG
> -
> -#endif
> diff --git a/src/win32stubagent/XService.cpp
> b/src/win32stubagent/XService.cpp
> deleted file mode 100644
> index 1fbb138..0000000
> --- a/src/win32stubagent/XService.cpp
> +++ /dev/null
> @@ -1,1044 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#include <windows.h>
> -#include <shlobj.h>
> -#include <process.h>
> -#include "powrprof.h"
> -#include <winuser.h>
> -#include "stdafx.h"
> -#include "XSAccessor.h"
> -#include "WMIAccessor.h"
> -#include "XService.h"
> -
> -#include "messages.h"
> -
> -#include <setupapi.h>
> -#include <cfgmgr32.h>
> -#include <initguid.h>
> -#include <devguid.h>
> -#include <wintrust.h>
> -#include <shellapi.h>
> -
> -#ifdef _WIN64
> -#define XENTOOLS_INSTALL_REG_KEY
> "SOFTWARE\\Wow6432Node\\Citrix\\XenTools"
> -#define XENTOOLS_INSTALL_REG_KEY64 "SOFTWARE\\Citrix\\XenTools"
> -#else
> -#define XENTOOLS_INSTALL_REG_KEY   "SOFTWARE\\Citrix\\XenTools"
> -#endif
> -
> -SERVICE_STATUS ServiceStatus;
> -SERVICE_STATUS_HANDLE hStatus;
> -
> -static HANDLE hServiceExitEvent;
> -static ULONG WindowsVersion;
> -static BOOL LegacyHal = FALSE;
> -static HINSTANCE local_hinstance;
> -
> -HANDLE eventLog;
> -#define SIZECHARS(x) (sizeof((x))/sizeof(TCHAR))
> -
> -// Internal routines
> -static DWORD WINAPI ServiceControlHandler(DWORD request, DWORD
> evtType,
> -                                          LPVOID, LPVOID);
> -static void ServiceControlManagerUpdate(DWORD dwExitCode, DWORD
> dwState);
> -static void WINAPI ServiceMain(int argc, char** argv);
> -static void GetWindowsVersion();
> -
> -void PrintError(const char *func, DWORD err)
> -{
> -    LPVOID lpMsgBuf;
> -    FormatMessage(
> -        FORMAT_MESSAGE_ALLOCATE_BUFFER |
> -        FORMAT_MESSAGE_FROM_SYSTEM,
> -        NULL,
> -        err,
> -        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
> -        (LPTSTR) &lpMsgBuf,
> -        0,
> -        NULL);
> -    OutputDebugString((LPTSTR)lpMsgBuf);
> -    XsLog("%s failed: %s (%x)", func, lpMsgBuf, err);
> -    XenstorePrintf("control/error", "%s failed: %s (%x)", func, lpMsgBuf, 
> err);
> -    LocalFree(lpMsgBuf);
> -}
> -
> -void PrintError(const char *func)
> -{
> -    PrintError(func, GetLastError());
> -}
> -
> -void PrintUsage()
> -{
> -    printf("Usage: xenservice [-u]\n");
> -
> -    printf("\t -u: uninstall service\n");
> -}
> -
> -
> -
> -struct watch_event {
> -    HANDLE event;
> -    void *watch;
> -};
> -
> -static void
> -ReleaseWatch(struct watch_event *we)
> -{
> -    if (we == NULL)
> -        return;
> -    if (we->event != INVALID_HANDLE_VALUE)
> -        CloseHandle(we->event);
> -    if (we->watch)
> -        XenstoreUnwatch(we->watch);
> -    free(we);
> -}
> -
> -static char * InitString(const char * inputstring)
> -{
> -    char *outputstring = (char 
> *)calloc((strlen(inputstring)+1),sizeof(char));
> -    if (outputstring == NULL)
> -        goto failalloc;
> -    strcpy(outputstring, inputstring);
> -    return outputstring;
> -
> -failalloc:
> -    XsLog(__FUNCTION__ " : Fail malloc");
> -    return NULL;
> -}
> -
> -static void FreeString(const char *string)
> -{
> -    free((void *)string);
> -}
> -
> -static char* PrintfString(const char *fmt, ...){
> -    va_list l;
> -    va_start(l, fmt);
> -    int numchars = _vscprintf(fmt, l);
> -    char *outputstring = (char *)calloc(numchars + 1, sizeof(char));
> -
> -    if (outputstring == NULL)
> -        return NULL;
> -
> -    _vsnprintf(outputstring, numchars, fmt, l);
> -    return outputstring;
> -}
> -
> -static struct watch_event *
> -EstablishWatch(const char *path, HANDLE errorevent)
> -{
> -    struct watch_event *we;
> -    DWORD err;
> -    XsLog("Establish watch %s",path);
> -    we = (struct watch_event *)malloc(sizeof(*we));
> -    if (!we) {
> -        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
> -        return NULL;
> -    }
> -    memset(we, 0, sizeof(*we));
> -    we->watch = NULL;
> -    we->event = CreateEvent(NULL, FALSE, FALSE, NULL);
> -    if (we->event != INVALID_HANDLE_VALUE)
> -        we->watch = XenstoreWatch(path, we->event, errorevent);
> -    if (we->watch == NULL) {
> -        OutputDebugString("Watch is null\n");
> -        err = GetLastError();
> -        ReleaseWatch(we);
> -        SetLastError(err);
> -        return NULL;
> -    }
> -    return we;
> -}
> -
> -struct watch_feature {
> -    struct watch_event *watch;
> -    const char *feature_flag;
> -    const char *name;
> -    BOOL (*handler)(void *);
> -    void *ctx;
> -};
> -
> -#define MAX_FEATURES 10
> -struct watch_feature_set {
> -    struct watch_feature features[MAX_FEATURES];
> -    unsigned nr_features;
> -};
> -
> -static BOOL
> -AddFeature(struct watch_feature_set *wfs, const char *path,
> -           const char *flag, const char *name,
> -           BOOL (*handler)(void *), void *ctx, HANDLE errorevent)
> -{
> -    unsigned n;
> -    if (wfs->nr_features == MAX_FEATURES)
> -        goto failfeatures;
> -
> -    n = wfs->nr_features;
> -
> -    wfs->features[n].watch = EstablishWatch(path, errorevent);
> -    if (wfs->features[n].watch == NULL)
> -        goto failwatch;
> -
> -    wfs->features[n].feature_flag = flag;
> -    wfs->features[n].handler = handler;
> -    wfs->features[n].ctx = ctx;
> -    wfs->features[n].name = InitString(name);
> -    if (wfs->features[n].name == NULL)
> -        goto failname;
> -    wfs->nr_features++;
> -    return true;
> -
> -failname:
> -    PrintError("Failed to allocate string");
> -failwatch:
> -    PrintError("EstablishWatch() for AddFeature()");
> -failfeatures:
> -    XsLog("Too many features");
> -    PrintError("Too many features!", ERROR_INVALID_FUNCTION);
> -    return false;
> -}
> -
> -static void RemoveFeatures(struct watch_feature_set *wfs) {
> -    unsigned x;
> -    for (x = 0; x < wfs->nr_features; x++) {
> -        ReleaseWatch(wfs->features[x].watch);
> -        wfs->features[x].watch = NULL;
> -        FreeString(wfs->features[x].name);
> -        XenstoreRemove(wfs->features[x].feature_flag);
> -    }
> -    wfs->nr_features = 0;
> -}
> -
> -static BOOL
> -AdvertiseFeatures(struct watch_feature_set *wfs)
> -{
> -    unsigned x;
> -    for (x = 0; x < wfs->nr_features; x++) {
> -        if (wfs->features[x].feature_flag != NULL)
> -            if (XenstorePrintf(wfs->features[x].feature_flag, "1")){
> -                XsLog("Failed to advertise %s",wfs->features[x].name);
> -            }
> -    }
> -    return true;
> -}
> -
> -
> -void ServiceUninstall()
> -{
> -    SC_HANDLE   hSvc;
> -    SC_HANDLE   hMgr;
> -
> -    hMgr = OpenSCManager(NULL, NULL, SC_MANAGER_ALL_ACCESS);
> -
> -    if ( hMgr )
> -    {
> -        hSvc = OpenService(hMgr, SVC_NAME, SERVICE_ALL_ACCESS);
> -
> -        if (hSvc)
> -        {
> -             // try to stop the service
> -             if ( ControlService( hSvc, SERVICE_CONTROL_STOP, &ServiceStatus 
> ) )
> -             {
> -                printf("Stopping %s.", SVC_DISPLAYNAME);
> -                Sleep( 1000 );
> -
> -                while ( QueryServiceStatus( hSvc, &ServiceStatus ) )
> -                {
> -                    if ( ServiceStatus.dwCurrentState == 
> SERVICE_STOP_PENDING )
> -                    {
> -                        printf(".");
> -                        Sleep( 1000 );
> -                    }
> -                    else
> -                        break;
> -                }
> -
> -                if ( ServiceStatus.dwCurrentState == SERVICE_STOPPED )
> -                    printf("\n%s stopped.\n", SVC_DISPLAYNAME );
> -                else
> -                    printf("\n%s failed to stop.\n", SVC_DISPLAYNAME );
> -         }
> -
> -         // now remove the service
> -         if ( DeleteService(hSvc) )
> -            printf("%s uninstalled.\n", SVC_DISPLAYNAME );
> -         else
> -            printf("Unable to uninstall - %d\n", GetLastError());
> -
> -         CloseServiceHandle(hSvc);
> -
> -      }
> -      else
> -         printf("Unable to open service - %d\n", GetLastError());
> -
> -      CloseServiceHandle(hMgr);
> -   }
> -   else
> -      printf("Unable to open scm - %d\n", GetLastError());
> -
> -}
> -
> -
> -int __stdcall
> -WinMain(HINSTANCE hInstance, HINSTANCE ignore,
> -        LPSTR lpCmdLine, int nCmdShow)
> -{
> -    local_hinstance = hInstance;
> -
> -    if (strlen(lpCmdLine) == 0) {
> -        SERVICE_TABLE_ENTRY ServiceTable[2];
> -        ServiceTable[0].lpServiceName = SVC_NAME;
> -        ServiceTable[0].lpServiceProc =
> (LPSERVICE_MAIN_FUNCTION)ServiceMain;
> -
> -        ServiceTable[1].lpServiceName = NULL;
> -        ServiceTable[1].lpServiceProc = NULL;
> -
> -        DBGPRINT(("XenSvc: starting ctrl dispatcher "));
> -
> -        // Start the control dispatcher thread for our service
> -        if (!StartServiceCtrlDispatcher(ServiceTable))
> -        {
> -            int err = GetLastError();
> -            if (GetLastError() ==
> ERROR_FAILED_SERVICE_CONTROLLER_CONNECT)
> -            {
> -                DBGPRINT(("XenSvc: unable to start ctrl dispatcher - %d",
> GetLastError()));
> -            }
> -        }
> -        else
> -        {
> -            // We get here when the service is shut down.
> -        }
> -    } else if (!strcmp(lpCmdLine, "-u") || !strcmp(lpCmdLine, "\"-u\"")) {
> -        ServiceUninstall();
> -    } else {
> -        PrintUsage();
> -    }
> -
> -    return 0;
> -}
> -
> -void AcquireSystemPrivilege(LPCTSTR name)
> -{
> -    HANDLE token;
> -    TOKEN_PRIVILEGES tkp;
> -    DWORD err;
> -
> -    LookupPrivilegeValue(NULL, name, &tkp.Privileges[0].Luid);
> -    tkp.PrivilegeCount = 1;
> -    tkp.Privileges[0].Attributes = SE_PRIVILEGE_ENABLED;
> -    if (!OpenProcessToken(GetCurrentProcess(),
> -                          TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,
> -                          &token)) {
> -        DBGPRINT(("Failed to open local token.\n"));
> -    } else {
> -        AdjustTokenPrivileges(token, FALSE, &tkp,
> -                              NULL, 0, NULL);
> -        err = GetLastError();
> -        if (err != ERROR_SUCCESS) {
> -            PrintError("AdjustTokenPrivileges", err);
> -        }
> -    }
> -}
> -
> -static void AcquireSystemShutdownPrivilege(void)
> -{
> -    AcquireSystemPrivilege(SE_SHUTDOWN_NAME);
> -}
> -
> -enum XShutdownType {
> -    XShutdownPoweroff,
> -    XShutdownReboot,
> -    XShutdownSuspend,
> -    XShutdownS3
> -};
> -
> -static BOOL maybeReboot(void *ctx)
> -{
> -    char *shutdown_type;
> -    BOOL res;
> -    enum XShutdownType type;
> -    int cntr = 0;
> -
> -    XsLog("Check if we need to shutdown");
> -
> -    if (XenstoreRead("control/shutdown", &shutdown_type) < 0) {
> -        XsLog("No need to shutdown");
> -        return true;
> -    }
> -    XsLog("Shutdown type %s\n", shutdown_type);
> -    if (strcmp(shutdown_type, "poweroff") == 0 ||
> -        strcmp(shutdown_type, "halt") == 0) {
> -        type = XShutdownPoweroff;
> -    } else if (strcmp(shutdown_type, "reboot") == 0) {
> -        type = XShutdownReboot;
> -    } else if (strcmp(shutdown_type, "hibernate") == 0) {
> -        type = XShutdownSuspend;
> -    } else if (strcmp(shutdown_type, "s3") == 0) {
> -        type = XShutdownS3;
> -    } else {
> -        DBGPRINT(("Bad shutdown type %s\n", shutdown_type));
> -        goto out;
> -    }
> -
> -    XsLog("Report Shutdown Event");
> -    /* We try to shutdown even if this fails, since it might work
> -       and it can't do any harm. */
> -    AcquireSystemShutdownPrivilege();
> -
> -    if (eventLog) {
> -        DWORD eventId;
> -
> -        switch (type) {
> -        case XShutdownPoweroff:
> -            eventId = EVENT_XENUSER_POWEROFF;
> -            break;
> -        case XShutdownReboot:
> -            eventId = EVENT_XENUSER_REBOOT;
> -            break;
> -        case XShutdownSuspend:
> -            eventId = EVENT_XENUSER_HIBERNATE;
> -            break;
> -        case XShutdownS3:
> -            eventId = EVENT_XENUSER_S3;
> -            break;
> -        }
> -    }
> -
> -    XsLog("Do the shutdown");
> -
> -    /* do the shutdown */
> -    switch (type) {
> -    case XShutdownPoweroff:
> -    case XShutdownReboot:
> -        if (WindowsVersion >= 0x500 && WindowsVersion < 0x600)
> -        {
> -            /* Windows 2000 InitiateSystemShutdownEx is funny in
> -               various ways (e.g. sometimes fails to power off after
> -               shutdown, especially if the local terminal is locked,
> -               not doing anything if there's nobody logged on, etc.).
> -               ExitWindowsEx seems to be more reliable, so use it
> -               instead. */
> -            /* XXX I don't really understand why
> -               InitiateSystemShutdownEx behaves so badly. */
> -            /* If this is a legacy hal then use EWX_SHUTDOWN when shutting
> -               down instead of EWX_POWEROFF. */
> -        /* Similar problem on XP. Shutdown/Reboot will hang until the
> Welcome
> -        screen screensaver is dismissed by the guest */
> -#pragma warning (disable : 28159)
> -            res = ExitWindowsEx((type == XShutdownReboot ?
> -                                    EWX_REBOOT :
> -                                    (LegacyHal ?
> -                                        EWX_SHUTDOWN :
> -                                        EWX_POWEROFF))|
> -                                EWX_FORCE,
> -                                SHTDN_REASON_MAJOR_OTHER|
> -                                SHTDN_REASON_MINOR_ENVIRONMENT |
> -                                SHTDN_REASON_FLAG_PLANNED);
> -#pragma warning (default: 28159)
> -            if (!res) {
> -                PrintError("ExitWindowsEx");
> -                return false;
> -            }
> -            else
> -            {
> -                if (XenstoreRemove("control/shutdown"))
> -                    return false;
> -            }
> -        } else {
> -#pragma warning (disable : 28159)
> -            res = InitiateSystemShutdownEx(
> -                NULL,
> -                NULL,
> -                0,
> -                TRUE,
> -                type == XShutdownReboot,
> -                SHTDN_REASON_MAJOR_OTHER |
> -                SHTDN_REASON_MINOR_ENVIRONMENT |
> -                SHTDN_REASON_FLAG_PLANNED);
> -#pragma warning (default: 28159)
> -            if (!res) {
> -                PrintError("InitiateSystemShutdownEx");
> -                return false;
> -            } else {
> -                if (XenstoreRemove("control/shutdown"))
> -                    return false;
> -            }
> -        }
> -        break;
> -    case XShutdownSuspend:
> -        if (XenstorePrintf ("control/hibernation-state", "started"))
> -            return false;
> -        /* Even if we think hibernation is disabled, try it anyway.
> -           It's not like it can do any harm. */
> -        res = SetSystemPowerState(FALSE, FALSE);
> -        if (XenstoreRemove ("control/shutdown"))
> -        {
> -            return false;
> -        }
> -        if (!res) {
> -            /* Tell the tools that we've failed. */
> -            PrintError("SetSystemPowerState");
> -            if (XenstorePrintf ("control/hibernation-state", "failed"))
> -                return false;
> -        }
> -        break;
> -    case XShutdownS3:
> -        if (XenstorePrintf ("control/s3-state", "started"))
> -            return false;
> -        res = SetSuspendState(FALSE, TRUE, FALSE);
> -        XenstoreRemove ("control/shutdown");
> -        if (!res) {
> -            PrintError("SetSuspendState");
> -            if (XenstorePrintf ("control/s3-state", "failed"))
> -                return false;
> -        }
> -        break;
> -    }
> -
> -out:
> -    XenstoreFree(shutdown_type);
> -    return true;
> -}
> -
> -static bool registryMatchString(HKEY    hKey,
> -                                LPCTSTR lpValueName,
> -                                LPCTSTR comparestring,
> -                                bool    matchcase)
> -{
> -    bool    result = false;
> -    LONG    buffersize = sizeof(TCHAR)*256;
> -    TCHAR   *outstring = NULL;
> -    DWORD  outstringsize;
> -    LONG    status;
> -    do {
> -        outstringsize = buffersize;
> -        outstring = (TCHAR *)realloc(outstring, outstringsize);
> -
> -        status = RegQueryValueEx(hKey,
> -                                 lpValueName,
> -                                 NULL,
> -                                 NULL,
> -                                 (LPBYTE) outstring,
> -                                 &outstringsize);
> -        buffersize *= 2;
> -    } while (status == ERROR_MORE_DATA);
> -
> -    if (status == ERROR_FILE_NOT_FOUND)
> -        goto done;
> -
> -    if (matchcase) {
> -        if (_tcsncmp(comparestring, outstring, outstringsize))
> -            goto done;
> -    }
> -    else {
> -        if (_tcsnicoll(comparestring, outstring, outstringsize))
> -            goto done;
> -    }
> -
> -    result = true;
> -
> -done:
> -    free(outstring);
> -
> -    return result;
> -}
> -
> -static bool
> -adjustXenTimeToUTC(FILETIME *now)
> -{
> -    DWORD           dwtimeoffset;
> -    long            timeoffset;
> -    char            *vm;
> -    char            *rtckey;
> -    LARGE_INTEGER   longoffset;
> -    ULARGE_INTEGER  longnow;
> -    size_t          vmlen;
> -
> -    // XenTime is assumed to be in UTC, so we need to remove any
> -    // offsets that are applied to it
> -
> -    __try {
> -        vmlen = XenstoreRead("vm", &vm);
> -        if (vmlen <= 0)
> -            goto fail_readvm;
> -    }
> -    __except(EXCEPTION_EXECUTE_HANDLER)
> -    {
> -        goto fail_readvm;
> -    }
> -
> -    rtckey = PrintfString("%s/rtc/timeoffset", vm);
> -    if (rtckey == NULL)
> -        goto fail_rtckey;
> -
> -    _try {
> -        BOOL rtcreadworked;
> -        __try {
> -            rtcreadworked = XenstoreReadDword(rtckey, &dwtimeoffset);
> -        }
> -        __except(EXCEPTION_EXECUTE_HANDLER) {
> -            rtcreadworked = false;
> -        }
> -        if (!rtcreadworked) {
> -            if (!XenstoreReadDword("platform/timeoffset", &dwtimeoffset))
> -                goto fail_platformtimeoffset;
> -        }
> -    }
> -    __except(EXCEPTION_EXECUTE_HANDLER)
> -    {
> -        goto fail_platformtimeoffset;
> -    }
> -    timeoffset = (long)dwtimeoffset;
> -
> -    //Convert offset from seconds to nanoseconds
> -    longoffset.QuadPart =  (LONGLONG)timeoffset;
> -    longoffset.QuadPart = longoffset.QuadPart * 10000000;
> -
> -    // Subtract nanosecond timeoffset from now
> -    longnow.LowPart = now->dwLowDateTime;
> -    longnow.HighPart = now->dwHighDateTime;
> -    longnow.QuadPart -= longoffset.QuadPart;
> -    now->dwLowDateTime = longnow.LowPart;
> -    now->dwHighDateTime = longnow.HighPart;
> -
> -    FreeString(rtckey);
> -    XsFree(vm);
> -    return true;
> -
> -fail_platformtimeoffset:
> -    XsLog("%s: Read platform time offset", __FUNCTION__);
> -    FreeString(rtckey);
> -
> -fail_rtckey:
> -    XsLog("%s: Read RTC Key", __FUNCTION__);
> -    XsFree(vm);
> -
> -fail_readvm:
> -    XsLog("%s: Read VM Key", __FUNCTION__);
> -    return false;
> -}
> -
> -static bool hosttimeIsUTC()
> -{
> -    HKEY        InstallRegKey;
> -    bool        utc = false;
> -    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
> -                     XENTOOLS_INSTALL_REG_KEY,
> -                     0,
> -                     KEY_ALL_ACCESS,
> -                     &InstallRegKey) != ERROR_SUCCESS)
> -        goto fail_registrykey;
> -
> -#ifdef _WIN64
> -
> -    if (registryMatchString(InstallRegKey, "HostTime", "UTC", false))
> -    {
> -         utc = true;
> -         goto done;
> -    }
> -
> -    RegCloseKey(InstallRegKey);
> -    if (RegOpenKeyEx(HKEY_LOCAL_MACHINE,
> -                     XENTOOLS_INSTALL_REG_KEY64,
> -                     0,
> -                     KEY_ALL_ACCESS,
> -                     &InstallRegKey) != ERROR_SUCCESS)
> -        goto fail_registrykey;
> -
> -#endif
> -
> -    if (registryMatchString(InstallRegKey, "HostTime", "UTC", false))
> -    {
> -        utc=true;
> -    }
> -
> -#ifdef _WIN64
> -done:
> -#endif
> -    RegCloseKey(InstallRegKey);
> -    return utc;
> -
> -fail_registrykey:
> -    XsLog("%s: Open Registry Key", __FUNCTION__);
> -
> -    return false;
> -}
> -
> -static void
> -setTimeToXenTime(void)
> -{
> -    FILETIME    now = {0};
> -    SYSTEMTIME  sys_time;
> -    SYSTEMTIME  current_time;
> -    bool        utc=false;
> -    XsLog("Set time to XenTime");
> -
> -    GetXenTime(&now);
> -    if ((now.dwLowDateTime == 0) && (now.dwHighDateTime == 0)) {
> -        XsLog("Cannot set system time to xentime, unable to contact WMI");
> -        goto fail_readtime;
> -    }
> -
> -    utc = hosttimeIsUTC();
> -
> -    if (utc) {
> -        XsLog("Try UTC");
> -        if (!adjustXenTimeToUTC(&now))
> -            goto fail_adjusttime;
> -    }
> -
> -    if (!FileTimeToSystemTime(&now, &sys_time)) {
> -        XsLog("Gould not convert file time to system time");
> -        PrintError("FileTimeToSystemTime()");
> -        DBGPRINT(("FileTimeToSystemTime(%x.%x)\n",
> -                  now.dwLowDateTime, now.dwHighDateTime));
> -    } else {
> -        GetLocalTime(&current_time);
> -        XsLog("Time is now  %d.%d.%d %d:%d:%d.%d",
> -              current_time.wYear, current_time.wMonth, current_time.wDay,
> -              current_time.wHour, current_time.wMinute,
> current_time.wSecond,
> -              current_time.wMilliseconds);
> -        XsLog("Set time to %d.%d.%d %d:%d:%d.%d",
> -              sys_time.wYear, sys_time.wMonth, sys_time.wDay,
> -              sys_time.wHour, sys_time.wMinute, sys_time.wSecond,
> -              sys_time.wMilliseconds);
> -        if (utc) {
> -            if (!SetSystemTime(&sys_time))
> -                PrintError("SetSystemTime()");
> -        }
> -        else {
> -            if (!SetLocalTime(&sys_time))
> -                PrintError("SetLocalTime()");
> -        }
> -    }
> -
> -    return;
> -
> -fail_adjusttime:
> -    XsLog("%s: Adjust time", __FUNCTION__);
> -
> -fail_readtime:
> -    XsLog("%s: ReadTime", __FUNCTION__);
> -}
> -
> -/* We need to resync the clock when we recover from suspend/resume. */
> -static void
> -finishSuspend(void)
> -{
> -    DBGPRINT(("Coming back from suspend.\n"));
> -    setTimeToXenTime();
> -}
> -
> -
> -
> -//
> -// Main loop
> -//
> -BOOL Run()
> -{
> -    bool exit=false;
> -    PCHAR pPVAddonsInstalled = NULL;
> -
> -    HANDLE suspendEvent;
> -
> -    int cntr = 0;
> -    struct watch_feature_set features;
> -    BOOL snap = FALSE;
> -
> -    OutputDebugString("Trying to connect to WMI\n");
> -    while (!ConnectToWMI()) {
> -        OutputDebugString("Unable to connect to WMI, sleeping\n");
> -        if (WaitForSingleObject(hServiceExitEvent, 1000*10) ==
> WAIT_OBJECT_0) {
> -            exit = true;
> -            return exit;
> -        }
> -    }
> -    while (InitXSAccessor()==false) {
> -        OutputDebugString("Unable to initialise WMI session, sleeping\n");
> -        if (WaitForSingleObject(hServiceExitEvent, 1000*10) ==
> WAIT_OBJECT_0) {
> -            exit = true;
> -            return exit;
> -        }
> -    }
> -    XsLog("Guest agent lite main loop starting");
> -
> -    if (eventLog == NULL)
> -        XsLog("Event log was not initialised");
> -
> -    setTimeToXenTime();
> -
> -    memset(&features, 0, sizeof(features));
> -
> -    HANDLE wmierrorEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> -    if (!wmierrorEvent) {
> -        PrintError("CreateEvent() wmierrorEvent");
> -        return exit;
> -    }
> -
> -
> -    XsLog("About to add feature shutdown");
> -    if (!AddFeature(&features, "control/shutdown", "control/feature-
> shutdown",
> -                    "shutdown", maybeReboot, NULL, wmierrorEvent)) {
> -        return exit;
> -    }
> -
> -    suspendEvent = CreateEvent(NULL, FALSE, FALSE, NULL);
> -    if (!suspendEvent) {
> -        PrintError("CreateEvent() suspendEvent");
> -        return exit;
> -    }
> -
> -    if (ListenSuspend(suspendEvent, wmierrorEvent) < 0) {
> -        PrintError("ListenSuspend()");
> -        CloseHandle(suspendEvent);
> -        suspendEvent = NULL;
> -        return exit;
> -    }
> -
> -
> -    XsLog("About to advertise features");
> -    AdvertiseFeatures(&features);
> -
> -    XsLog("About to kick xapi ");
> -    XenstoreKickXapi();
> -
> -    while (1)
> -    {
> -        DWORD status;
> -        int nr_handles = 1;
> -        HANDLE handles[3 + MAX_FEATURES];
> -        unsigned x;
> -
> -        handles[0] = hServiceExitEvent;
> -        if (wmierrorEvent)
> -            handles[nr_handles++] = wmierrorEvent;
> -        if (suspendEvent)
> -            handles[nr_handles++] = suspendEvent;
> -        for (x = 0; x < features.nr_features; x++)
> -            handles[nr_handles++] = features.features[x].watch->event;
> -
> -        XsLog("win agent going to sleep");
> -        status = WaitForMultipleObjects(nr_handles, handles, FALSE, 
> INFINITE);
> -        XsLog("win agent woke up for %d", status);
> -
> -        /* WAIT_OBJECT_0 happens to be 0, so the compiler gets shirty
> -           about status >= WAIT_OBJECT_0 (since status is unsigned).
> -           This is more obviously correct than the compiler-friendly
> -           version, though, so just disable the warning. */
> -
> -#pragma warning (disable: 4296)
> -        if (status >= WAIT_OBJECT_0 &&
> -            status < WAIT_OBJECT_0 + nr_handles)
> -#pragma warning (default: 4296)
> -        {
> -            HANDLE event = handles[status - WAIT_OBJECT_0];
> -            if (event == hServiceExitEvent)
> -            {
> -                XsLog("service exit event");
> -                exit = true;
> -                break;
> -            }
> -            else if (event == suspendEvent)
> -            {
> -                if (!ReportEvent(eventLog, EVENTLOG_SUCCESS, 0,
> EVENT_XENUSER_UNSUSPENDED, NULL, 0, 0,
> -                            NULL, NULL)) {
> -                    XsLog("Cannot send to event log %x",GetLastError());
> -                }
> -                XsLog("Suspend event");
> -                finishSuspend();
> -                AdvertiseFeatures(&features);
> -                XenstoreKickXapi();
> -                XsLog("Handled suspend event");
> -            }
> -            else if (event == wmierrorEvent)
> -            {
> -                ReportEvent(eventLog, EVENTLOG_SUCCESS, 0,
> EVENT_XENUSER_WMI, NULL, 0, 0,
> -                            NULL, NULL);
> -                break;
> -            }
> -            else
> -            {
> -                BOOL fail = false;
> -                for (x = 0; x < features.nr_features; x++) {
> -                    if (features.features[x].watch->event == event) {
> -                        XsLog("Fire %p",features.features[x].name);
> -                        XsLog("fire feature %s", features.features[x].name);
> -                        OutputDebugString("Event triggered\n");
> -                        if 
> (!(features.features[x].handler(features.features[x].ctx)))
> -                        {
> -                            XsLog("Firing feature failed");
> -                            PrintError("Feature failed");
> -                            fail = true;
> -                        }
> -                        XsLog("fired feature %s",
> -                                features.features[x].name);
> -                    }
> -                }
> -                if (fail) {
> -                    XsLog("Resetting");
> -                    ReportEvent(eventLog, EVENTLOG_SUCCESS, 0,
> EVENT_XENUSER_UNEXPECTED, NULL, 0, 0,
> -                                NULL, NULL);
> -                    break;
> -                }
> -            }
> -        }
> -        else
> -        {
> -            PrintError("WaitForMultipleObjects()");
> -            break;
> -        }
> -    }
> -    OutputDebugString("WMI Watch loop terminated\n");
> -    RemoveFeatures(&features);
> -    XenstoreKickXapi();
> -
> -    XsLog("Guest agent lite loop finishing");
> -    ReleaseWMIAccessor(&wmi);
> -
> -
> -
> -
> -    XsLog("Guest agent lite loop finished %d", exit);
> -    return exit;
> -}
> -
> -
> -// Service initialization
> -bool ServiceInit()
> -{
> -    ServiceStatus.dwServiceType        = SERVICE_WIN32;
> -    ServiceStatus.dwCurrentState       = SERVICE_START_PENDING;
> -    ServiceStatus.dwControlsAccepted   =
> -        SERVICE_ACCEPT_STOP | SERVICE_ACCEPT_SHUTDOWN |
> -        SERVICE_ACCEPT_SESSIONCHANGE;
> -    ServiceStatus.dwWin32ExitCode      = 0;
> -    ServiceStatus.dwServiceSpecificExitCode = 0;
> -    ServiceStatus.dwCheckPoint         = 0;
> -    ServiceStatus.dwWaitHint           = 0;
> -
> -    hStatus = RegisterServiceCtrlHandlerEx(
> -        "XenService",
> -        ServiceControlHandler,
> -        NULL);
> -    if (hStatus == (SERVICE_STATUS_HANDLE)0)
> -    {
> -        // Registering Control Handler failed
> -        DBGPRINT(("XenSvc: Registering service control handler failed - 
> %d\n",
> GetLastError()));
> -        return false;
> -    }
> -
> -    ServiceStatus.dwCurrentState = SERVICE_RUNNING;
> -    SetServiceStatus (hStatus, &ServiceStatus);
> -
> -    return true;
> -}
> -
> -void WINAPI ServiceMain(int argc, char** argv)
> -{
> -    // Perform common initialization
> -    eventLog = RegisterEventSource(NULL, "xensvc");
> -    hServiceExitEvent = CreateEvent(NULL, false, false, NULL);
> -    if (hServiceExitEvent == NULL)
> -    {
> -        DBGPRINT(("XenSvc: Unable to create the event obj - %d\n",
> GetLastError()));
> -        return;
> -    }
> -
> -    if (!ServiceInit())
> -    {
> -        DBGPRINT(("XenSvc: Unable to init xenservice\n"));
> -        return;
> -    }
> -    BOOL stopping;
> -
> -    do {
> -
> -        __try
> -        {
> -            stopping = Run();
> -
> -        }
> -        __except(EXCEPTION_EXECUTE_HANDLER)
> -        {
> -            __try {
> -                XsLog("Exception hit %x", GetExceptionCode());
> -            }
> -            __except(EXCEPTION_EXECUTE_HANDLER)
> -            {
> -            }
> -            stopping = false;
> -        }
> -    } while (!stopping);
> -
> -    XsLog("Guest agent service stopped");
> -    ShutdownXSAccessor();
> -    DeregisterEventSource(eventLog);
> -    ServiceControlManagerUpdate(0, SERVICE_STOPPED);
> -    return;
> -}
> -
> -void ServiceControlManagerUpdate(DWORD dwExitCode, DWORD dwState)
> -{
> -    ServiceStatus.dwWin32ExitCode = dwExitCode;
> -    ServiceStatus.dwCurrentState  = dwState;
> -    SetServiceStatus (hStatus, &ServiceStatus);
> -}
> -
> -// Service control handler function
> -static DWORD WINAPI ServiceControlHandler(DWORD request, DWORD
> evtType,
> -                                          LPVOID eventData, LPVOID ctxt)
> -{
> -    UNREFERENCED_PARAMETER(ctxt);
> -    UNREFERENCED_PARAMETER(eventData);
> -
> -    switch(request)
> -    {
> -        case SERVICE_CONTROL_STOP:
> -            DBGPRINT(("XenSvc: xenservice stopped.\n"));
> -            ServiceControlManagerUpdate(0, SERVICE_STOP_PENDING);
> -            SetEvent(hServiceExitEvent);
> -            return NO_ERROR;
> -
> -        case SERVICE_CONTROL_SHUTDOWN:
> -            DBGPRINT(("XenSvc: xenservice shutdown.\n"));
> -            ServiceControlManagerUpdate(0, SERVICE_STOP_PENDING);
> -            SetEvent(hServiceExitEvent);
> -            return NO_ERROR;
> -
> -        default:
> -        DBGPRINT(("XenSvc: unknown request."));
> -            break;
> -    }
> -
> -    ServiceControlManagerUpdate(0, SERVICE_RUNNING);
> -    return ERROR_CALL_NOT_IMPLEMENTED;
> -}
> diff --git a/src/win32stubagent/XService.h b/src/win32stubagent/XService.h
> deleted file mode 100644
> index 32ee163..0000000
> --- a/src/win32stubagent/XService.h
> +++ /dev/null
> @@ -1,54 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -#ifndef _XSERVICE_H
> -#define _XSERVICE_H
> -
> -#include <version.h>
> -
> -#define SVC_NAME "xensvc"
> -#define SVC_DISPLAYNAME PRODUCT_NAME_STR ## "Interface Service"
> -#define SVC_DESC "Monitors and provides various metrics to XenStore"
> -
> -void PrintError(const char *func);
> -void PrintError(const char *func, DWORD err);
> -void StartClipboardSync(void);
> -void FinishClipboardSync(void);
> -void ClipboardConsoleChanged(void);
> -
> -void XsDumpLogThisThread(void);
> -void XsInitPerThreadLogging(void);
> -void XsLogMsg(const char *fmt, ...);
> -void DoVolumeDump(void);
> -
> -void AcquireSystemPrivilege(LPCTSTR name);
> -
> -#endif
> diff --git a/src/win32stubagent/errors.cpp b/src/win32stubagent/errors.cpp
> deleted file mode 100644
> index caf47cc..0000000
> --- a/src/win32stubagent/errors.cpp
> +++ /dev/null
> @@ -1,102 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -/* Black-box data recorder.  This records stuff which is happening
> -   while the agent runs, and tries to push it out to dom0 syslog if we
> -   crash. */
> -#include "stdafx.h"
> -#include <windows.h>
> -#include <stdarg.h>
> -#include <stdio.h>
> -#include <stdlib.h>
> -#include "XService.h"
> -#include "XSAccessor.h"
> -
> -
> -#define RING_SIZE 8192
> -
> -struct message_ring {
> -    HANDLE handle;
> -    unsigned prod_idx;
> -    unsigned cons_idx;
> -    unsigned char payload[RING_SIZE];
> -};
> -
> -static __declspec(thread) struct message_ring message_ring;
> -
> -static char *
> -Xsvasprintf(const char *fmt, va_list args)
> -{
> -    char *work;
> -    int work_size;
> -    int r;
> -
> -    work_size = 32;
> -    while (1) {
> -        work = (char *)malloc(work_size);
> -        if (!work)
> -            return work;
> -        r = _vsnprintf(work, work_size, fmt, args);
> -        if (r == 0) {
> -            free(work);
> -            return NULL;
> -        }
> -        if (r != -1 && r < work_size) {
> -            return work;
> -        }
> -        free(work);
> -        work_size *= 2;
> -    }
> -}
> -
> -static char *
> -Xsasprintf(const char *fmt, ...)
> -{
> -    va_list args;
> -    char *res;
> -
> -    va_start(args, fmt);
> -    res = Xsvasprintf(fmt, args);
> -    va_end(args);
> -    return res;
> -}
> -
> -void
> -XsLogMsg(const char *fmt, ...)
> -{
> -    va_list args;
> -
> -    va_start(args, fmt);
> -    XsLog(fmt, args);
> -    va_end(args);
> -}
> -
> -
> diff --git a/src/win32stubagent/messages.mc
> b/src/win32stubagent/messages.mc
> deleted file mode 100644
> index 0289c44..0000000
> --- a/src/win32stubagent/messages.mc
> +++ /dev/null
> @@ -1,66 +0,0 @@
> -SeverityNames=(Informational=0x1)
> -FacilityNames=(XenUser=0xd60)
> -
> -MessageId=0x0001
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_POWEROFF
> -Language=English
> -The tools requested that the local VM shut itself down.
> -.
> -
> -MessageId=0x0002
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_REBOOT
> -Language=English
> -The tools requested that the local VM reboot.
> -.
> -
> -MessageId=0x0003
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_HIBERNATE
> -Language=English
> -The tools requested that the local VM hibernate itself.
> -.
> -
> -MessageId=0x0004
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_S3
> -Language=English
> -The tools requested that the local VM enter power state S3.
> -.
> -
> -MessageId=0x0005
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_WMI
> -Language=English
> -The tools noticed that WMI became non-functional.
> -.
> -
> -MessageId=0x0006
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_STARTED
> -Language=English
> -The tools initiated.
> -.
> -
> -MessageId=0x0007
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_UNSUSPENDED
> -Language=English
> -The tools returned from suspend.
> -.
> -
> -MessageId=0x0008
> -Facility=XenUser
> -Severity=Informational
> -SymbolicName=EVENT_XENUSER_UNEXPECTED
> -Language=English
> -The tools experienced an unexpected error.
> -.
> diff --git a/src/win32stubagent/stdafx.cpp b/src/win32stubagent/stdafx.cpp
> deleted file mode 100644
> index 72ced79..0000000
> --- a/src/win32stubagent/stdafx.cpp
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -// stdafx.cpp : source file that includes just the standard includes
> -// XenService.pch will be the pre-compiled header
> -// stdafx.obj will contain the pre-compiled type information
> -
> -#include "stdafx.h"
> -
> -// TODO: reference any additional headers you need in STDAFX.H
> -// and not in this file
> diff --git a/src/win32stubagent/stdafx.h b/src/win32stubagent/stdafx.h
> deleted file mode 100644
> index 391a848..0000000
> --- a/src/win32stubagent/stdafx.h
> +++ /dev/null
> @@ -1,43 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -// stdafx.h : include file for standard system include files,
> -// or project specific include files that are used frequently, but
> -// are changed infrequently
> -//
> -
> -#pragma once
> -
> -
> -#include <iostream>
> -#include <tchar.h>
> -
> -// TODO: reference additional headers your program requires here
> diff --git a/src/win32stubagent/w32xagent.rc
> b/src/win32stubagent/w32xagent.rc
> deleted file mode 100644
> index 78e5cc7..0000000
> --- a/src/win32stubagent/w32xagent.rc
> +++ /dev/null
> @@ -1,60 +0,0 @@
> -/* Copyright (c) Citrix Systems Inc.
> - * All rights reserved.
> - *
> - * Redistribution and use in source and binary forms,
> - * with or without modification, are permitted provided
> - * that the following conditions are met:
> - *
> - * *   Redistributions of source code must retain the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer.
> - * *   Redistributions in binary form must reproduce the above
> - *     copyright notice, this list of conditions and the
> - *     following disclaimer in the documentation and/or other
> - *     materials provided with the distribution.
> - *
> - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND
> - * CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES,
> - * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
> - * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
> - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
> - * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
> - * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
> - * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
> - * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
> - * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
> - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
> - * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
> - * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
> - * SUCH DAMAGE.
> - */
> -
> -
> -#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         VENDOR_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     "w32agent"
> -#define VER_ORIGINALFILENAME_STR    "w32xagent.exe"
> -#define VER_FILETYPE VFT_APP
> -#define VER_FILESUBTYPE 0
> -
> -xen_icon ICON "xen.ico"
> -
> -#include "common.ver"
> -#include "messages.rc"
> \ No newline at end of file
> diff --git a/src/win32stubagent/xen.ico b/src/win32stubagent/xen.ico
> deleted file mode 100644
> index
> 844c993ba290e5055a8900ca8786ea0e031138a6..0000000000000000000000000
> 000000000000000
> GIT binary patch
> literal 0
> HcmV?d00001
> 
> literal 25214
> zcmeHv30zgh`}eRfDyxbp%LPP0P*D&;Ku|!*C70CP%6&KYl**FK5>3So1>E;F_X
> T$}
> zv_#yu(o#fox2%4ZmHNETcg{JNdoN(xr{DX&|IfeC@0poro^94MXU@3@VJ7T
> EXs8p%
> zmSTXl5OakPI-QcgV=lxqra3t&`9L!vZrKUu7tC)f);I{^P!9ZR-d2d6?%-GQ1FVF2
> z(^uoyi8cO091YO;InR7UTWS0{F~CxY%5Mr0$Ud+M(SrfM5K@&$rj0MDT*#Ev
> R3+jo
> zCmE?CH#e6HNd6Z@NHO>yNVxoEuo*kH6rQnTQ_|ALjva1XWHUA`ZDL|#TG
> }LInUu7|
> z#FhmGiHXT+h7vXt6AP4(mpG|dlTC_7E-
> 1)LF4mMXk#%SxPp`?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yZh@
> z+(|h-
> 0{FXeU;6BW9+HM{AI{C}CuyKVhUKR*)*Wo?NvC`I(z$Uh>DPNV<j}dtdyo|)
> zcz^usFEU@WYq8`39{?H1GK#)@-
> G@$e^OGp(6H50_9yGdNe|P!_9e=Zio(H^;VOgN)
> zNQdf_-
> ^pK(Bc1v872kZNAHt^(=I}aDQ(q2V$f)w`_O|rnvLK0L9Dnx77%BVb<KO6q
> ztCwW@{;iv|tZO4ZA7ofwj;l=xI?C@HDzUtOJLx<2A{VnhqGNA1pgUjeku>a$R
> =+cl
> z@?Nh)kYRbWANqj4<ma{HZ${Da)c$mO(oi}zaWI|WJW%jvLpt^G5IXbeC^|D`
> 6z%WL
> z?@rYI!#Lvfh~*7E=nQ`&`62)>WK723y5-ScbaLP;bZ%68{+_;V37`x-
> ENe7=H9gSD
> zplxl!=<{Albm8qz5=euFGVo~prNvzSQuFr_|LvnfgWs)|rqhs?%4e;)yi!31vi}Ek
> CuCXov
> 
> diff --git a/vs2012/liteagent/LiteAgent.vcxproj
> b/vs2012/liteagent/LiteAgent.vcxproj
> index e67918a..b133576 100644
> --- a/vs2012/liteagent/LiteAgent.vcxproj
> +++ b/vs2012/liteagent/LiteAgent.vcxproj
> @@ -137,7 +137,7 @@
>    <ItemDefinitionGroup
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
>      <ClCompile>
>        <WarningLevel>Level3</WarningLevel>
> -      <PrecompiledHeader>Create</PrecompiledHeader>
> +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
>        <Optimization>MaxSpeed</Optimization>
>        <FunctionLevelLinking>true</FunctionLevelLinking>
>        <IntrinsicFunctions>true</IntrinsicFunctions>
> @@ -166,7 +166,7 @@
>    <ItemDefinitionGroup
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
>      <ClCompile>
>        <WarningLevel>Level3</WarningLevel>
> -      <PrecompiledHeader>Create</PrecompiledHeader>
> +      <PrecompiledHeader>NotUsing</PrecompiledHeader>
>        <Optimization>MaxSpeed</Optimization>
>        <FunctionLevelLinking>true</FunctionLevelLinking>
>        <IntrinsicFunctions>true</IntrinsicFunctions>
> @@ -193,38 +193,8 @@
>      </CustomBuildStep>
>    </ItemDefinitionGroup>
>    <ItemGroup>
> -    <ClCompile Include="..\..\src\win32stubagent\errors.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\stdafx.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\WmiAccessor.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\XSAccessor.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\XService.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
>    </ItemGroup>
>    <ItemGroup>
> -    <ClInclude Include="..\..\src\win32stubagent\stdafx.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\WmiAccessor.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\XSAccessor.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\XService.h" />
>    </ItemGroup>
>    <ItemGroup>
>      <CustomBuild Include="..\..\src\win32stubagent\messages.mc">
> diff --git a/vs2013/liteagent/LiteAgent.vcxproj
> b/vs2013/liteagent/LiteAgent.vcxproj
> index 50dbe43..a8f59a3 100644
> --- a/vs2013/liteagent/LiteAgent.vcxproj
> +++ b/vs2013/liteagent/LiteAgent.vcxproj
> @@ -197,39 +197,8 @@
>      </CustomBuildStep>
>    </ItemDefinitionGroup>
>    <ItemGroup>
> -    <ClCompile Include="..\..\src\win32stubagent\errors.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\stdafx.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\WmiAccessor.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\XSAccessor.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -    </ClCompile>
> -    <ClCompile Include="..\..\src\win32stubagent\XService.cpp">
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</Preco
> mpiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</Precomp
> iledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">NotUsing</Pr
> ecompiledHeader>
> -      <PrecompiledHeader
> Condition="'$(Configuration)|$(Platform)'=='Release|x64'">NotUsing</Prec
> ompiledHeader>
> -      <PreprocessToFile
> Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</Preproc
> essToFile>
> -    </ClCompile>
>    </ItemGroup>
>    <ItemGroup>
> -    <ClInclude Include="..\..\src\win32stubagent\stdafx.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\WmiAccessor.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\XSAccessor.h" />
> -    <ClInclude Include="..\..\src\win32stubagent\XService.h" />
>    </ItemGroup>
>    <ItemGroup>
>      <CustomBuild Include="..\..\src\win32stubagent\messages.mc">
> --
> 1.9.4.msysgit.1
> 
> 
> _______________________________________________
> win-pv-devel mailing list
> win-pv-devel@xxxxxxxxxxxxxxxxxxxx
> http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel
_______________________________________________
win-pv-devel mailing list
win-pv-devel@xxxxxxxxxxxxxxxxxxxx
http://lists.xenproject.org/cgi-bin/mailman/listinfo/win-pv-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.