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.

296 lines
13 KiB

  1. /******************************************************************************
  2. Copyright (c) 2000 Microsoft Corporation
  3. Module Name:
  4. MPCUploadJob.h
  5. Abstract:
  6. This file contains the declaration of the CMPCUploadJob class,
  7. the descriptor of all jobs present in the Upload Library system.
  8. Revision History:
  9. Davide Massarenti (Dmassare) 04/15/99
  10. created
  11. ******************************************************************************/
  12. #if !defined(__INCLUDED___ULMANAGER___MPCUPLOADJOB_H___)
  13. #define __INCLUDED___ULMANAGER___MPCUPLOADJOB_H___
  14. class CMPCUpload;
  15. class ATL_NO_VTABLE CMPCUploadJob : // Hungarian: mpcuj
  16. public MPC::ConnectionPointImpl<CMPCUploadJob, &DIID_DMPCUploadEvents, MPC::CComSafeMultiThreadModel>,
  17. public IDispatchImpl<IMPCUploadJob, &IID_IMPCUploadJob, &LIBID_UPLOADMANAGERLib>,
  18. public IMPCPersist // Persistence
  19. {
  20. typedef UploadLibrary::Signature Sig;
  21. CMPCUpload* m_mpcuRoot; // Volatile
  22. DWORD m_dwRetryInterval; // Volatile
  23. ULONG m_dwInternalSeq; // Local
  24. Sig m_sigClient; // Global
  25. CComBSTR m_bstrServer; // Local
  26. CComBSTR m_bstrJobID; // Global
  27. CComBSTR m_bstrProviderID; // Global
  28. CComBSTR m_bstrCreator; // Local
  29. CComBSTR m_bstrUsername; // Global
  30. CComBSTR m_bstrPassword; // Global
  31. CComBSTR m_bstrFileNameResponse; // Local
  32. CComBSTR m_bstrFileName; // Local
  33. long m_lOriginalSize; // Global
  34. long m_lTotalSize; // Global
  35. long m_lSentSize; // Global
  36. DWORD m_dwCRC; // Global
  37. UL_HISTORY m_uhHistory; // Local
  38. UL_STATUS m_usStatus; // Local
  39. DWORD m_dwErrorCode; // Local
  40. UL_MODE m_umMode; // Local
  41. VARIANT_BOOL m_fPersistToDisk; // Local
  42. VARIANT_BOOL m_fCompressed; // Local
  43. long m_lPriority; // Local
  44. DATE m_dCreationTime; // Local
  45. DATE m_dCompleteTime; // Local
  46. DATE m_dExpirationTime; // Local
  47. MPC::Connectivity::Proxy m_Proxy; // Local
  48. CComPtr<IDispatch> m_sink_onStatusChange; // Volatile
  49. CComPtr<IDispatch> m_sink_onProgressChange; // Volatile
  50. mutable bool m_fDirty; // Volatile
  51. ////////////////////////////////////////
  52. HRESULT CreateFileName ( /*[out]*/ CComBSTR& bstrFileName );
  53. HRESULT CreateTmpFileName( /*[out]*/ CComBSTR& bstrTmpFileName );
  54. HRESULT CreateDataFromStream ( /*[in ]*/ IStream* streamIn , /*[in]*/ DWORD dwQueueSize );
  55. HRESULT OpenReadStreamForData( /*[out]*/ IStream* *pstreamOut );
  56. public:
  57. DECLARE_NO_REGISTRY()
  58. DECLARE_NOT_AGGREGATABLE(CMPCUploadJob)
  59. DECLARE_GET_CONTROLLING_UNKNOWN()
  60. BEGIN_COM_MAP(CMPCUploadJob)
  61. COM_INTERFACE_ENTRY(IDispatch)
  62. COM_INTERFACE_ENTRY(IMPCUploadJob)
  63. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  64. END_COM_MAP()
  65. CMPCUploadJob();
  66. virtual ~CMPCUploadJob();
  67. HRESULT LinkToSystem( /*[in]*/ CMPCUpload* mpcuRoot );
  68. HRESULT Unlink ( );
  69. ////////////////////////////////////////
  70. HRESULT SetSequence( /*[in]*/ ULONG lSeq );
  71. ////////////////////////////////////////
  72. HRESULT CanModifyProperties();
  73. HRESULT CanRelease( bool& fResult );
  74. HRESULT RemoveData ();
  75. HRESULT RemoveResponse();
  76. bool operator<( /*[in]*/ const CMPCUploadJob& x ) const
  77. {
  78. if(m_lPriority < x.m_lPriority) return true;
  79. if(m_umMode < x.m_umMode ) return true; // Works, because BACKGROUND < FOREGROUND.
  80. return false;
  81. }
  82. HRESULT Fire_onStatusChange ( IMPCUploadJob* mpcujJob, tagUL_STATUS usStatus );
  83. HRESULT Fire_onProgressChange( IMPCUploadJob* mpcujJob, LONG lCurrentSize, LONG lTotalSize );
  84. public:
  85. // IMPCPersist
  86. STDMETHOD_(bool,IsDirty)();
  87. STDMETHOD(Load)( /*[in]*/ MPC::Serializer& streamIn );
  88. STDMETHOD(Save)( /*[in]*/ MPC::Serializer& streamOut );
  89. // IMPCUploadJob
  90. HRESULT get_Sequence ( /*[out]*/ ULONG *pVal ); // INTERNAL METHOD
  91. STDMETHOD(get_Sig )( /*[out]*/ BSTR *pVal );
  92. STDMETHOD(put_Sig )( /*[in] */ BSTR newVal );
  93. STDMETHOD(get_Server )( /*[out]*/ BSTR *pVal );
  94. STDMETHOD(put_Server )( /*[in] */ BSTR newVal );
  95. STDMETHOD(get_JobID )( /*[out]*/ BSTR *pVal );
  96. STDMETHOD(put_JobID )( /*[in] */ BSTR newVal );
  97. STDMETHOD(get_ProviderID )( /*[out]*/ BSTR *pVal );
  98. STDMETHOD(put_ProviderID )( /*[in] */ BSTR newVal );
  99. HRESULT put_Creator ( /*[out]*/ BSTR newVal ); // INTERNAL METHOD
  100. STDMETHOD(get_Creator )( /*[out]*/ BSTR *pVal );
  101. STDMETHOD(get_Username )( /*[out]*/ BSTR *pVal );
  102. STDMETHOD(put_Username )( /*[in] */ BSTR newVal );
  103. STDMETHOD(get_Password )( /*[out]*/ BSTR *pVal );
  104. STDMETHOD(put_Password )( /*[in] */ BSTR newVal );
  105. HRESULT get_FileName ( /*[out]*/ BSTR *pVal ); // INTERNAL METHOD
  106. STDMETHOD(get_OriginalSize )( /*[out]*/ long *pVal );
  107. STDMETHOD(get_TotalSize )( /*[out]*/ long *pVal );
  108. STDMETHOD(get_SentSize )( /*[out]*/ long *pVal );
  109. HRESULT put_SentSize ( /*[in] */ long newVal ); // INTERNAL METHOD
  110. HRESULT put_Response ( /*[in] */ long lSize, /*[in]*/ LPBYTE pData ); // INTERNAL METHOD
  111. STDMETHOD(get_History )( /*[out]*/ UL_HISTORY *pVal );
  112. STDMETHOD(put_History )( /*[in] */ UL_HISTORY newVal );
  113. STDMETHOD(get_Status )( /*[out]*/ UL_STATUS *pVal );
  114. HRESULT put_Status ( /*[in] */ UL_STATUS newVal ); // INTERNAL METHOD
  115. STDMETHOD(get_ErrorCode )( /*[out]*/ long *pVal );
  116. HRESULT put_ErrorCode ( /*[in] */ DWORD newVal ); // INTERNAL METHOD
  117. HRESULT get_RetryInterval ( /*[in] */ DWORD *pVal ); // INTERNAL METHOD
  118. HRESULT put_RetryInterval ( /*[in] */ DWORD newVal ); // INTERNAL METHOD
  119. HRESULT try_Status ( /*[in]*/ UL_STATUS ulPreVal, /*[in]*/ UL_STATUS ulPostVal ); // INTERNAL METHOD
  120. STDMETHOD(get_Mode )( /*[out]*/ UL_MODE *pVal );
  121. STDMETHOD(put_Mode )( /*[in] */ UL_MODE newVal );
  122. STDMETHOD(get_PersistToDisk )( /*[out]*/ VARIANT_BOOL *pVal );
  123. STDMETHOD(put_PersistToDisk )( /*[in] */ VARIANT_BOOL newVal );
  124. STDMETHOD(get_Compressed )( /*[out]*/ VARIANT_BOOL *pVal );
  125. STDMETHOD(put_Compressed )( /*[in] */ VARIANT_BOOL newVal );
  126. STDMETHOD(get_Priority )( /*[out]*/ long *pVal );
  127. STDMETHOD(put_Priority )( /*[in] */ long newVal );
  128. STDMETHOD(get_CreationTime )( /*[out]*/ DATE *pVal );
  129. STDMETHOD(get_CompleteTime )( /*[out]*/ DATE *pVal );
  130. STDMETHOD(get_ExpirationTime)( /*[out]*/ DATE *pVal );
  131. STDMETHOD(put_ExpirationTime)( /*[in] */ DATE newVal );
  132. STDMETHOD(ActivateSync )();
  133. STDMETHOD(ActivateAsync)();
  134. STDMETHOD(Suspend )();
  135. STDMETHOD(Delete )();
  136. STDMETHOD(GetDataFromFile)( /*[in]*/ BSTR bstrFileName );
  137. STDMETHOD(PutDataIntoFile)( /*[in]*/ BSTR bstrFileName );
  138. STDMETHOD(GetDataFromStream )( /*[in] */ IUnknown* stream );
  139. STDMETHOD(PutDataIntoStream )( /*[out]*/ IUnknown* *pstream );
  140. STDMETHOD(GetResponseAsStream)( /*[out]*/ IUnknown* *pstream );
  141. STDMETHOD(put_onStatusChange )( /*[in]*/ IDispatch* function );
  142. STDMETHOD(put_onProgressChange)( /*[in]*/ IDispatch* function );
  143. //
  144. // Support Methods.
  145. //
  146. HRESULT SetupRequest( /*[out]*/ UploadLibrary::ClientRequest_OpenSession& crosReq );
  147. HRESULT SetupRequest( /*[out]*/ UploadLibrary::ClientRequest_WriteSession& crwsReq, /*[in]*/ DWORD dwSize );
  148. HRESULT GetProxySettings( );
  149. HRESULT SetProxySettings( /*[in]*/ HINTERNET hSession );
  150. };
  151. typedef MPC::CComObjectNoLock<CMPCUploadJob> CMPCUploadJob_Object;
  152. ////////////////////////////////////////////////////////////////////////////////
  153. class ATL_NO_VTABLE CMPCUploadJobWrapper : // Hungarian: mpcujr
  154. public CComObjectRootEx<MPC::CComSafeMultiThreadModel>,
  155. public IDispatchImpl<IMPCUploadJob, &IID_IMPCUploadJob, &LIBID_UPLOADMANAGERLib>,
  156. public IConnectionPointContainer
  157. {
  158. CMPCUploadJob* m_Object;
  159. public:
  160. CMPCUploadJobWrapper();
  161. HRESULT Init ( /*[in]*/ CMPCUploadJob* obj );
  162. void FinalRelease( );
  163. BEGIN_COM_MAP(CMPCUploadJobWrapper)
  164. COM_INTERFACE_ENTRY(IDispatch)
  165. COM_INTERFACE_ENTRY(IMPCUploadJob)
  166. COM_INTERFACE_ENTRY(IConnectionPointContainer)
  167. END_COM_MAP()
  168. public:
  169. // IMPCUploadJob
  170. STDMETHOD(get_Sig )( /*[out]*/ BSTR *pVal );
  171. STDMETHOD(put_Sig )( /*[in] */ BSTR newVal );
  172. STDMETHOD(get_Server )( /*[out]*/ BSTR *pVal );
  173. STDMETHOD(put_Server )( /*[in] */ BSTR newVal );
  174. STDMETHOD(get_JobID )( /*[out]*/ BSTR *pVal );
  175. STDMETHOD(put_JobID )( /*[in] */ BSTR newVal );
  176. STDMETHOD(get_ProviderID )( /*[out]*/ BSTR *pVal );
  177. STDMETHOD(put_ProviderID )( /*[in] */ BSTR newVal );
  178. STDMETHOD(get_Creator )( /*[out]*/ BSTR *pVal );
  179. STDMETHOD(get_Username )( /*[out]*/ BSTR *pVal );
  180. STDMETHOD(put_Username )( /*[in] */ BSTR newVal );
  181. STDMETHOD(get_Password )( /*[out]*/ BSTR *pVal );
  182. STDMETHOD(put_Password )( /*[in] */ BSTR newVal );
  183. STDMETHOD(get_OriginalSize )( /*[out]*/ long *pVal );
  184. STDMETHOD(get_TotalSize )( /*[out]*/ long *pVal );
  185. STDMETHOD(get_SentSize )( /*[out]*/ long *pVal );
  186. STDMETHOD(get_History )( /*[out]*/ UL_HISTORY *pVal );
  187. STDMETHOD(put_History )( /*[in] */ UL_HISTORY newVal );
  188. STDMETHOD(get_Status )( /*[out]*/ UL_STATUS *pVal );
  189. STDMETHOD(get_ErrorCode )( /*[out]*/ long *pVal );
  190. STDMETHOD(get_Mode )( /*[out]*/ UL_MODE *pVal );
  191. STDMETHOD(put_Mode )( /*[in] */ UL_MODE newVal );
  192. STDMETHOD(get_PersistToDisk )( /*[out]*/ VARIANT_BOOL *pVal );
  193. STDMETHOD(put_PersistToDisk )( /*[in] */ VARIANT_BOOL newVal );
  194. STDMETHOD(get_Compressed )( /*[out]*/ VARIANT_BOOL *pVal );
  195. STDMETHOD(put_Compressed )( /*[in] */ VARIANT_BOOL newVal );
  196. STDMETHOD(get_Priority )( /*[out]*/ long *pVal );
  197. STDMETHOD(put_Priority )( /*[in] */ long newVal );
  198. STDMETHOD(get_CreationTime )( /*[out]*/ DATE *pVal );
  199. STDMETHOD(get_CompleteTime )( /*[out]*/ DATE *pVal );
  200. STDMETHOD(get_ExpirationTime)( /*[out]*/ DATE *pVal );
  201. STDMETHOD(put_ExpirationTime)( /*[in] */ DATE newVal );
  202. STDMETHOD(ActivateSync )();
  203. STDMETHOD(ActivateAsync)();
  204. STDMETHOD(Suspend )();
  205. STDMETHOD(Delete )();
  206. STDMETHOD(GetDataFromFile)( /*[in]*/ BSTR bstrFileName );
  207. STDMETHOD(PutDataIntoFile)( /*[in]*/ BSTR bstrFileName );
  208. STDMETHOD(GetDataFromStream )( /*[in] */ IUnknown* stream );
  209. STDMETHOD(PutDataIntoStream )( /*[out]*/ IUnknown* *pstream );
  210. STDMETHOD(GetResponseAsStream)( /*[out]*/ IUnknown* *pstream );
  211. STDMETHOD(put_onStatusChange )( /*[in]*/ IDispatch* function );
  212. STDMETHOD(put_onProgressChange)( /*[in]*/ IDispatch* function );
  213. // IConnectionPointContainer
  214. STDMETHOD(EnumConnectionPoints)( /*[out]*/ IEnumConnectionPoints* *ppEnum );
  215. STDMETHOD(FindConnectionPoint )( /*[in] */ REFIID riid, /*[out]*/ IConnectionPoint* *ppCP );
  216. };
  217. #endif // !defined(__INCLUDED___ULMANAGER___MPCUPLOADJOB_H___)