You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
107 lines
2.7 KiB
107 lines
2.7 KiB
//
|
|
// update.cpp - assembly update
|
|
//
|
|
#include "server.h"
|
|
#include "fusenet.h"
|
|
#include "CUnknown.h" // Base class for IUnknown
|
|
|
|
///////////////////////////////////////////////////////////
|
|
//
|
|
// Component AssemblyUpdate
|
|
//
|
|
class CAssemblyUpdate : public CUnknown,
|
|
public IAssemblyUpdate
|
|
{
|
|
|
|
public:
|
|
|
|
// Interface IUnknown
|
|
STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
|
|
STDMETHODIMP_(ULONG) AddRef();
|
|
STDMETHODIMP_(ULONG) Release();
|
|
|
|
// Interface IAssemblyUpdate
|
|
STDMETHOD(RegisterAssemblySubscription)(LPWSTR pwzDisplayName,
|
|
LPWSTR pwzUrl, DWORD dwInterval);
|
|
|
|
STDMETHOD(RegisterAssemblySubscriptionEx)(LPWSTR pwzDisplayName,
|
|
LPWSTR pwzUrl, DWORD dwInterval, DWORD dwIntervalUnit,
|
|
DWORD dwEvent, BOOL bEventDemandConnection) ;
|
|
|
|
|
|
STDMETHOD(UnRegisterAssemblySubscription)(LPWSTR pwzDisplayName);
|
|
|
|
// Public non-interface methods.
|
|
|
|
// Creation
|
|
|
|
CAssemblyUpdate() ;
|
|
|
|
~CAssemblyUpdate() ;
|
|
|
|
static HRESULT CreateInstance(IUnknown* pUnknownOuter,
|
|
CUnknown** ppNewComponent) ;
|
|
|
|
// Initialization
|
|
HRESULT Init();
|
|
|
|
// Registration
|
|
HRESULT RegisterAssemblySubscriptionFromInfo(LPWSTR pwzDisplayName,
|
|
LPWSTR pwzUrl, IManifestInfo *pSubscriptionInfo) ;
|
|
|
|
// Kick off polling on startup.
|
|
static HRESULT InitializeSubscriptions();
|
|
|
|
// Helpers
|
|
static HRESULT GetCurrentVersion(ULONGLONG *pullCurrentVersion);
|
|
static HRESULT RemoveUpdateRegistryEntry();
|
|
static HRESULT ReadUpdateRegistryEntry(ULONGLONG *pullUpdateVersion, CString &sUpdatePath);
|
|
static HRESULT IsDuplicate(LPWSTR pwzURL, BOOL *pbIsDuplicate);
|
|
static HRESULT CheckForUpdate();
|
|
|
|
// Private non-interface methods.
|
|
|
|
|
|
HRESULT _hr;
|
|
|
|
} ;
|
|
|
|
|
|
///////////////////////////////////////////////////////////
|
|
//
|
|
// Component AssemblyBindSink
|
|
//
|
|
class CAssemblyBindSink : public IAssemblyBindSink
|
|
{
|
|
public:
|
|
|
|
LONG _cRef;
|
|
IAssemblyDownload *_pAssemblyDownload;
|
|
|
|
CAssemblyBindSink(IAssemblyDownload *pAssemblyDownload);
|
|
~CAssemblyBindSink();
|
|
|
|
STDMETHOD(OnProgress)(
|
|
DWORD dwNotification,
|
|
HRESULT hrNotification,
|
|
LPCWSTR szNotification,
|
|
DWORD dwProgress,
|
|
DWORD dwProgressMax,
|
|
IUnknown *pUnk);
|
|
|
|
// IUnknown methods
|
|
STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
|
|
STDMETHODIMP_(ULONG) AddRef();
|
|
STDMETHODIMP_(ULONG) Release();
|
|
};
|
|
|
|
///////////////////////////////////////////////////////////
|
|
//
|
|
// DownloadInstance
|
|
//
|
|
struct CDownloadInstance
|
|
{
|
|
IAssemblyDownload * _pAssemblyDownload;
|
|
CString _sUrl;
|
|
};
|
|
|