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.

160 lines
4.8 KiB

  1. #ifndef _CLSHNDLR_HXX_
  2. #define _CLSHNDLR_HXX_
  3. enum INSTALLSTATE
  4. {
  5. installingNone,
  6. installingDone,
  7. installingBoth,
  8. installingDocObject,
  9. installingHandler
  10. };
  11. class CClassInstallFilterSink;
  12. class CInstallBindInfo : public IOInetBindInfo
  13. {
  14. public:
  15. // IUnknown methods
  16. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  17. STDMETHODIMP_(ULONG) AddRef(void);
  18. STDMETHODIMP_(ULONG) Release(void);
  19. // IOInetBindInfo methods
  20. STDMETHODIMP GetBindInfo(DWORD *grfBINDF, BINDINFO * pbindinfo);
  21. STDMETHODIMP GetBindString(ULONG ulStringType, LPOLESTR *ppwzStr, ULONG cEl, ULONG *pcElFetched);
  22. CInstallBindInfo();
  23. ~CInstallBindInfo();
  24. private:
  25. DWORD _CRefs;
  26. };
  27. class CClassInstallFilter : public IOInetProtocol
  28. ,public IOInetProtocolSink
  29. ,public IServiceProvider
  30. ,public IInternetHostSecurityManager
  31. {
  32. friend class CClassInstallFilterSink;
  33. public:
  34. CClassInstallFilter();
  35. ~CClassInstallFilter();
  36. // IUnknown methods
  37. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  38. STDMETHODIMP_(ULONG) AddRef(void);
  39. STDMETHODIMP_(ULONG) Release(void);
  40. //IOInetProtocol methods
  41. STDMETHODIMP Start(LPCWSTR szUrl,IOInetProtocolSink *pProtSink,
  42. IOInetBindInfo *pOIBindInfo,DWORD grfSTI,DWORD_PTR dwReserved);
  43. STDMETHODIMP Continue(PROTOCOLDATA *pStateInfo);
  44. STDMETHODIMP Abort(HRESULT hrReason,DWORD dwOptions);
  45. STDMETHODIMP Terminate(DWORD dwOptions);
  46. STDMETHODIMP Suspend();
  47. STDMETHODIMP Resume();
  48. STDMETHODIMP Read(void *pv,ULONG cb,ULONG *pcbRead);
  49. STDMETHODIMP Seek(LARGE_INTEGER dlibMove,DWORD dwOrigin,
  50. ULARGE_INTEGER *plibNewPosition);
  51. STDMETHODIMP LockRequest(DWORD dwOptions);
  52. STDMETHODIMP UnlockRequest();
  53. // IOInetProtocolSink methods
  54. STDMETHODIMP Switch(PROTOCOLDATA *pStateInfo);
  55. STDMETHODIMP ReportProgress(ULONG ulStatusCode, LPCWSTR szStatusText);
  56. STDMETHODIMP ReportData(DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax);
  57. STDMETHODIMP ReportResult(HRESULT hrResult, DWORD dwError, LPCWSTR wzResult);
  58. // IServiceProvider
  59. STDMETHODIMP QueryService(REFGUID rsid, REFIID riid, void ** ppvObj);
  60. INSTALLSTATE GetInstallState()
  61. {
  62. return _state;
  63. };
  64. void SetInstallState(INSTALLSTATE state)
  65. {
  66. _state = state;
  67. };
  68. // IInternetHostSecurityManager
  69. STDMETHODIMP GetSecurityId(BYTE *pbSecurityId, DWORD *pcbSecurityId,
  70. DWORD_PTR dwReserved);
  71. STDMETHODIMP ProcessUrlAction(DWORD dwAction, BYTE *pPolicy, DWORD cbPolicy,
  72. BYTE *pContext, DWORD cbContext, DWORD dwFlags,
  73. DWORD dwReserved);
  74. STDMETHODIMP QueryCustomPolicy(REFGUID guidKey, BYTE **ppPolicy,
  75. DWORD *pcbPolicy, BYTE *pContext,
  76. DWORD cbContext, DWORD dwReserved);
  77. private:
  78. HRESULT InstallerReportResult(HRESULT hrResult, DWORD dwError, LPCWSTR wzResult);
  79. CClassInstallFilterSink* _pInstallSink;
  80. IOInetProtocolSink* _pProtSnk;
  81. IOInetProtocol* _pCDLnetProtocol;
  82. IOInetProtocol* _pProt;
  83. LPWSTR _pwzCDLURL;
  84. INSTALLSTATE _state;
  85. BOOL _bAddRef;
  86. DWORD _grfBSCF;
  87. ULONG _ulProgress;
  88. ULONG _ulProgressMax;
  89. DWORD _dwTotalSize;
  90. // cached ReportData if main DocObject finishes downloading before install handler
  91. BOOL _fDocObjectDone;
  92. DWORD _hrResult;
  93. DWORD _dwError;
  94. LPWSTR _wzResult;
  95. BOOL _fReportResult;
  96. DWORD _CRefs;
  97. LPWSTR _pwzUrl;
  98. LPWSTR _pwzClsId;
  99. LPWSTR _pwzMime;
  100. WCHAR _pwzDocBase[INTERNET_MAX_URL_LENGTH];
  101. IInternetSecurityManager *_pSecMgr;
  102. };
  103. class CClassInstallFilterSink : public IOInetProtocolSink
  104. ,public IServiceProvider
  105. {
  106. public:
  107. // IUnknown methods
  108. STDMETHODIMP QueryInterface(REFIID iid, void **ppvObj);
  109. STDMETHODIMP_(ULONG) AddRef(void);
  110. STDMETHODIMP_(ULONG) Release(void);
  111. // IOInetProtocolSink methods
  112. STDMETHODIMP Switch(PROTOCOLDATA *pStateInfo);
  113. STDMETHODIMP ReportProgress(ULONG ulStatusCode, LPCWSTR szStatusText);
  114. STDMETHODIMP ReportData( DWORD grfBSCF, ULONG ulProgress, ULONG ulProgressMax);
  115. STDMETHODIMP ReportResult(HRESULT hrResult, DWORD dwError, LPCWSTR wzResult);
  116. // IServiceProvider
  117. STDMETHODIMP QueryService(REFGUID rsid, REFIID riid, void ** ppvObj);
  118. CClassInstallFilterSink(CClassInstallFilter *pInstallFilter);
  119. ~CClassInstallFilterSink();
  120. private:
  121. CClassInstallFilter *_pInstallFilter;
  122. DWORD _dwRef;
  123. BOOL _bDone;
  124. };
  125. #endif // _CLSHNDLR_HXX_