-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #28 from rossphilipson/remove-win-tools
[windows] Remove all win-tools and add a new user agent.
- Loading branch information
Showing
44 changed files
with
5,949 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
/* | ||
* Copyright (c) 2012 Citrix Systems, Inc. | ||
* Copyright (c) 2016 Assured Information Security, Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
// OxtGuestServices.cpp : Implementation of COxtGuestServices | ||
|
||
#include "stdafx.h" | ||
#include <sys/stat.h> | ||
#include "oxtmsg.h" | ||
#include "OxtGuestServices.h" | ||
#include "OxtSecurityHelper.h" | ||
|
||
HRESULT COxtGuestServices::FinalConstruct() | ||
{ | ||
HRESULT hr = S_OK; | ||
|
||
do { | ||
// Open an XS instance for use by this object | ||
if (!m_clXs.XS2Open()) | ||
{ | ||
hr = LogCreateFailure((IDS_FAILED_TO_OPEN_XENSTORE___HRESUL_OXTGUESTSERVICES_32), | ||
E_FAIL); | ||
break; | ||
} | ||
|
||
// Register this object - if it fails the global count is exceeded | ||
if (!m_pclOxtSvc->RegisterXgs()) | ||
{ | ||
m_clXs.XS2Close(); | ||
hr = E_ACCESSDENIED; | ||
LogCreateFailure((IDS_MAXIMUM_INSTANCE_COUNT_REACHED___OXTGUESTSERVICES_61), hr); | ||
} | ||
} while (false); | ||
|
||
return hr; | ||
} | ||
|
||
void COxtGuestServices::FinalRelease() | ||
{ | ||
// Drop out of the main list | ||
m_pclOxtSvc->UnregisterXgs(); | ||
|
||
m_clXs.XS2Close(); | ||
} | ||
|
||
HRESULT COxtGuestServices::LogCreateFailure(ULONG ulMsg, HRESULT hr) | ||
{ | ||
m_pclOxtSvc->LogEventTypeId(ulMsg, EVENTLOG_ERROR_TYPE, EVMSG_CREATION_FAILURE, hr); | ||
return hr; | ||
} | ||
|
||
STDMETHODIMP COxtGuestServices::InterfaceSupportsErrorInfo(REFIID riid) | ||
{ | ||
static const IID* arr[] = | ||
{ | ||
&IID_IOxtGuestServices | ||
}; | ||
|
||
for (int i=0; i < sizeof(arr) / sizeof(arr[0]); i++) | ||
{ | ||
if (InlineIsEqualGUID(*arr[i],riid)) | ||
return S_OK; | ||
} | ||
return S_FALSE; | ||
} | ||
|
||
STDMETHODIMP COxtGuestServices::XenStoreRead(BSTR bstrPath, BSTR *pbstrValue) | ||
{ | ||
LPCSTR szValue; | ||
CComBSTR bstrValue; | ||
HRESULT hr; | ||
|
||
szValue = (LPCSTR)m_clXs.XS2Read(CW2A(bstrPath), NULL); | ||
if (szValue == NULL) | ||
{ | ||
hr = LogCreateFailure((IDS_FAILED_TO_OPEN_XENSTORE___HRESUL_OXTGUESTSERVICES_32), | ||
E_UNEXPECTED); | ||
return hr; | ||
} | ||
|
||
bstrValue = szValue; | ||
|
||
m_clXs.XS2Free((LPVOID)szValue); | ||
*pbstrValue = bstrValue.Copy(); | ||
return S_OK; | ||
} | ||
|
||
STDMETHODIMP COxtGuestServices::XenStoreWrite(BSTR bstrPath, BSTR bstrValue) | ||
{ | ||
HRESULT hr; | ||
|
||
if (!m_clXs.XS2Write(CW2A(bstrPath), CW2A(bstrValue))) | ||
{ | ||
hr = LogCreateFailure((IDS_FAILED_TO_OPEN_XENSTORE___HRESUL_OXTGUESTSERVICES_32), | ||
E_UNEXPECTED); | ||
return hr; | ||
} | ||
|
||
return S_OK; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
/* | ||
* Copyright (c) 2012 Citrix Systems, Inc. | ||
* Copyright (c) 2016 Assured Information Security, Inc | ||
* | ||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||
* of this software and associated documentation files (the "Software"), to deal | ||
* in the Software without restriction, including without limitation the rights | ||
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
* copies of the Software, and to permit persons to whom the Software is | ||
* furnished to do so, subject to the following conditions: | ||
* | ||
* The above copyright notice and this permission notice shall be included in | ||
* all copies or substantial portions of the Software. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
* THE SOFTWARE. | ||
*/ | ||
|
||
// OxtGuestServices.h : Declaration of the COxtGuestServices | ||
|
||
#pragma once | ||
#include "resource.h" // main symbols | ||
|
||
#include "OxtService_i.h" | ||
#include "OxtService.h" | ||
#include "XenStoreWrapper.h" | ||
|
||
// COxtGuestServices | ||
|
||
class ATL_NO_VTABLE COxtGuestServices : | ||
public CComObjectRootEx<CComMultiThreadModel>, | ||
public CComCoClass<COxtGuestServices, &CLSID_OxtGuestServices>, | ||
public ISupportErrorInfo, | ||
public IDispatchImpl<IOxtGuestServices, &IID_IOxtGuestServices, &LIBID_OxtServiceLib, /*wMajor =*/ 1, /*wMinor =*/ 0> | ||
{ | ||
private: | ||
COxtService *m_pclOxtSvc; | ||
CXenStoreWrapper m_clXs; | ||
|
||
public: | ||
COxtGuestServices() : m_pclOxtSvc(&_OxtService) | ||
{ | ||
} | ||
|
||
DECLARE_REGISTRY_RESOURCEID(IDR_OXTGUESTSERVICES) | ||
|
||
BEGIN_COM_MAP(COxtGuestServices) | ||
COM_INTERFACE_ENTRY(IOxtGuestServices) | ||
COM_INTERFACE_ENTRY(IDispatch) | ||
COM_INTERFACE_ENTRY(ISupportErrorInfo) | ||
END_COM_MAP() | ||
|
||
// ISupportsErrorInfo | ||
STDMETHOD(InterfaceSupportsErrorInfo)(REFIID riid); | ||
|
||
DECLARE_PROTECT_FINAL_CONSTRUCT() | ||
|
||
HRESULT FinalConstruct(); | ||
void FinalRelease(); | ||
|
||
HRESULT LogCreateFailure(ULONG ulMsg, HRESULT hr); | ||
|
||
public: | ||
|
||
STDMETHOD(XenStoreRead)(BSTR bstrPath, BSTR *pbstrValue); | ||
STDMETHOD(XenStoreWrite)(BSTR bstrPath, BSTR bstrValue); | ||
}; | ||
|
||
OBJECT_ENTRY_AUTO(__uuidof(OxtGuestServices), COxtGuestServices) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
HKCR | ||
{ | ||
OxtService.OxtGuestServices.1 = s 'OxtGuestServices Class' | ||
{ | ||
CLSID = s '{79E8108A-57E6-4E3D-B98F-DB90572B7F5A}' | ||
} | ||
OxtService.OxtGuestServices = s 'OxtGuestServices Class' | ||
{ | ||
CLSID = s '{79E8108A-57E6-4E3D-B98F-DB90572B7F5A}' | ||
CurVer = s 'OxtService.OxtGuestServices.1' | ||
} | ||
NoRemove CLSID | ||
{ | ||
ForceRemove {79E8108A-57E6-4E3D-B98F-DB90572B7F5A} = s 'OxtGuestServices Class' | ||
{ | ||
ProgID = s 'OxtService.OxtGuestServices.1' | ||
VersionIndependentProgID = s 'OxtService.OxtGuestServices' | ||
ForceRemove 'Programmable' | ||
LocalServer32 = s '%MODULE%' | ||
val AppID = s '%APPID%' | ||
'TypeLib' = s '{CB46685A-BBB0-406B-BB1D-CF1641FFF17D}' | ||
} | ||
} | ||
} |
Oops, something went wrong.