Leaked source code of windows server 2003
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

  1. //
  2. // update.cpp - assembly update
  3. //
  4. #include "server.h"
  5. #include "fusenet.h"
  6. #include "CUnknown.h" // Base class for IUnknown
  7. ///////////////////////////////////////////////////////////
  8. //
  9. // Component AssemblyUpdate
  10. //
  11. class CAssemblyUpdate : public CUnknown,
  12. public IAssemblyUpdate
  13. {
  14. public:
  15. // Interface IUnknown
  16. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  17. STDMETHODIMP_(ULONG) AddRef();
  18. STDMETHODIMP_(ULONG) Release();
  19. // Interface IAssemblyUpdate
  20. STDMETHOD(RegisterAssemblySubscription)(LPWSTR pwzDisplayName,
  21. LPWSTR pwzUrl, DWORD dwInterval);
  22. STDMETHOD(RegisterAssemblySubscriptionEx)(LPWSTR pwzDisplayName,
  23. LPWSTR pwzUrl, DWORD dwInterval, DWORD dwIntervalUnit,
  24. DWORD dwEvent, BOOL bEventDemandConnection) ;
  25. STDMETHOD(UnRegisterAssemblySubscription)(LPWSTR pwzDisplayName);
  26. // Public non-interface methods.
  27. // Creation
  28. CAssemblyUpdate() ;
  29. ~CAssemblyUpdate() ;
  30. static HRESULT CreateInstance(IUnknown* pUnknownOuter,
  31. CUnknown** ppNewComponent) ;
  32. // Initialization
  33. HRESULT Init();
  34. // Registration
  35. HRESULT RegisterAssemblySubscriptionFromInfo(LPWSTR pwzDisplayName,
  36. LPWSTR pwzUrl, IManifestInfo *pSubscriptionInfo) ;
  37. // Kick off polling on startup.
  38. static HRESULT InitializeSubscriptions();
  39. // Helpers
  40. static HRESULT GetCurrentVersion(ULONGLONG *pullCurrentVersion);
  41. static HRESULT RemoveUpdateRegistryEntry();
  42. static HRESULT ReadUpdateRegistryEntry(ULONGLONG *pullUpdateVersion, CString &sUpdatePath);
  43. static HRESULT IsDuplicate(LPWSTR pwzURL, BOOL *pbIsDuplicate);
  44. static HRESULT CheckForUpdate();
  45. // Private non-interface methods.
  46. HRESULT _hr;
  47. } ;
  48. ///////////////////////////////////////////////////////////
  49. //
  50. // Component AssemblyBindSink
  51. //
  52. class CAssemblyBindSink : public IAssemblyBindSink
  53. {
  54. public:
  55. LONG _cRef;
  56. IAssemblyDownload *_pAssemblyDownload;
  57. CAssemblyBindSink(IAssemblyDownload *pAssemblyDownload);
  58. ~CAssemblyBindSink();
  59. STDMETHOD(OnProgress)(
  60. DWORD dwNotification,
  61. HRESULT hrNotification,
  62. LPCWSTR szNotification,
  63. DWORD dwProgress,
  64. DWORD dwProgressMax,
  65. IUnknown *pUnk);
  66. // IUnknown methods
  67. STDMETHODIMP QueryInterface(REFIID riid,void ** ppv);
  68. STDMETHODIMP_(ULONG) AddRef();
  69. STDMETHODIMP_(ULONG) Release();
  70. };
  71. ///////////////////////////////////////////////////////////
  72. //
  73. // DownloadInstance
  74. //
  75. struct CDownloadInstance
  76. {
  77. IAssemblyDownload * _pAssemblyDownload;
  78. CString _sUrl;
  79. };