Source code of Windows XP (NT5)
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.

444 lines
12 KiB

  1. //=======================================================================
  2. //
  3. // Copyright (c) 2000 Microsoft Corporation. All Rights Reserved.
  4. //
  5. // File: bits.idl
  6. //
  7. // Description:
  8. //
  9. // Interface to the background file copier.
  10. //
  11. //=======================================================================
  12. #ifndef DO_NO_IMPORTS
  13. import "unknwn.idl";
  14. #endif
  15. cpp_quote("#include \"bitsmsg.h\"")
  16. cpp_quote("#define BG_SIZE_UNKNOWN (UINT64)(-1)")
  17. #define BG_ENUM_SIZEIS(maxcount) maxcount
  18. #define BG_ENUM_LENGTHIS(maxcount,lengthptr) \
  19. lengthptr ? *lengthptr : maxcount
  20. //
  21. // =============================
  22. // Marshalled interfaces
  23. // =============================
  24. [
  25. uuid(01b7bd23-fb88-4a77-8490-5891d3e4653a),
  26. odl
  27. ]
  28. interface IBackgroundCopyFile : IUnknown
  29. {
  30. typedef struct _BG_FILE_PROGRESS
  31. {
  32. UINT64 BytesTotal;
  33. UINT64 BytesTransferred;
  34. BOOL Completed;
  35. }
  36. BG_FILE_PROGRESS;
  37. //--------------------------------------------------------------------
  38. HRESULT GetRemoteName( [out] LPWSTR *pVal );
  39. HRESULT GetLocalName( [out] LPWSTR *pVal );
  40. HRESULT GetProgress( [out] BG_FILE_PROGRESS *pVal );
  41. }
  42. //--------------------------------------------------------------------
  43. //
  44. [
  45. uuid(ca51e165-c365-424c-8d41-24aaa4ff3c40),
  46. helpstring("IEnumBackgroundCopyFiles Interface"),
  47. odl
  48. ]
  49. interface IEnumBackgroundCopyFiles : IUnknown
  50. {
  51. HRESULT Next( [in] ULONG celt,
  52. [out, size_is(BG_ENUM_SIZEIS(celt)), length_is(BG_ENUM_LENGTHIS(celt,pceltFetched))] IBackgroundCopyFile **rgelt,
  53. [in,out,unique] ULONG *pceltFetched );
  54. HRESULT Skip( [in] ULONG celt);
  55. HRESULT Reset();
  56. HRESULT Clone( [out] IEnumBackgroundCopyFiles **ppenum );
  57. HRESULT GetCount( [out] ULONG *puCount );
  58. }
  59. //--------------------------------------------------------------------
  60. //
  61. [
  62. uuid(19c613a0-fcb8-4f28-81ae-897c3d078f81),
  63. helpstring("error object for IBackgroundCopyJob"),
  64. odl
  65. ]
  66. interface IBackgroundCopyError : IUnknown
  67. {
  68. typedef enum
  69. {
  70. BG_ERROR_CONTEXT_NONE = 0,
  71. BG_ERROR_CONTEXT_UNKNOWN = 1,
  72. BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER = 2,
  73. BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION = 3,
  74. BG_ERROR_CONTEXT_LOCAL_FILE = 4,
  75. BG_ERROR_CONTEXT_REMOTE_FILE = 5,
  76. BG_ERROR_CONTEXT_GENERAL_TRANSPORT = 6,
  77. BG_ERROR_CONTEXT_REMOTE_APPLICATION = 7
  78. } BG_ERROR_CONTEXT;
  79. HRESULT GetError( [out,ref] BG_ERROR_CONTEXT *pContext,
  80. [out,ref] HRESULT *pCode );
  81. // Returns BG_E_FILE_NOT_AVAILABLE if no file is available
  82. HRESULT GetFile( [out] IBackgroundCopyFile ** pVal );
  83. // Return a human readable description of the error.
  84. // Use CoTaskMemFree to free the description.
  85. HRESULT GetErrorDescription( [in] DWORD LanguageId,
  86. [out,ref] LPWSTR *pErrorDescription );
  87. // Return a human readable description of the error context.
  88. // Use CoTaskMemFree to free the description.
  89. HRESULT GetErrorContextDescription(
  90. [in] DWORD LanguageId,
  91. [out,ref] LPWSTR *pContextDescription );
  92. // Returns BG_E_PROTOCOL_NOT_AVAILABLE if no protocol is available
  93. HRESULT GetProtocol( [out,ref] LPWSTR *pProtocol );
  94. }
  95. // ==============================================
  96. // Job Interface
  97. [
  98. uuid(37668d37-507e-4160-9316-26306d150b12),
  99. helpstring("IBackgroundCopyJob Interface"),
  100. odl
  101. ]
  102. interface IBackgroundCopyJob : IUnknown
  103. {
  104. typedef struct _BG_FILE_INFO
  105. {
  106. LPWSTR RemoteName;
  107. LPWSTR LocalName;
  108. }
  109. BG_FILE_INFO;
  110. typedef struct _BG_JOB_PROGRESS
  111. {
  112. UINT64 BytesTotal;
  113. UINT64 BytesTransferred;
  114. ULONG FilesTotal;
  115. ULONG FilesTransferred;
  116. }
  117. BG_JOB_PROGRESS;
  118. typedef struct _BG_JOB_TIMES
  119. {
  120. FILETIME CreationTime;
  121. FILETIME ModificationTime;
  122. FILETIME TransferCompletionTime;
  123. }
  124. BG_JOB_TIMES;
  125. typedef enum
  126. {
  127. BG_JOB_PRIORITY_FOREGROUND,
  128. BG_JOB_PRIORITY_HIGH,
  129. BG_JOB_PRIORITY_NORMAL,
  130. BG_JOB_PRIORITY_LOW,
  131. } BG_JOB_PRIORITY;
  132. typedef enum
  133. {
  134. BG_JOB_STATE_QUEUED,
  135. BG_JOB_STATE_CONNECTING,
  136. BG_JOB_STATE_TRANSFERRING,
  137. BG_JOB_STATE_SUSPENDED,
  138. BG_JOB_STATE_ERROR,
  139. BG_JOB_STATE_TRANSIENT_ERROR,
  140. BG_JOB_STATE_TRANSFERRED,
  141. BG_JOB_STATE_ACKNOWLEDGED,
  142. BG_JOB_STATE_CANCELLED
  143. } BG_JOB_STATE;
  144. typedef enum
  145. {
  146. BG_JOB_TYPE_DOWNLOAD,
  147. BG_JOB_TYPE_UPLOAD,
  148. BG_JOB_TYPE_UPLOAD_REPLY
  149. } BG_JOB_TYPE;
  150. typedef enum
  151. {
  152. BG_JOB_PROXY_USAGE_PRECONFIG,
  153. BG_JOB_PROXY_USAGE_NO_PROXY,
  154. BG_JOB_PROXY_USAGE_OVERRIDE
  155. } BG_JOB_PROXY_USAGE;
  156. //--------------------------------------------------------------------
  157. //
  158. // Returns E_INVALIDARG if one of the filesets has
  159. // - local name is blank
  160. // - local name contains invalid characters
  161. // - remote name is blank
  162. // - remote name has invalid format
  163. //
  164. // Returns CO_E_NOT_SUPPORTED if
  165. // - remote URL contains unsupported protocol
  166. //
  167. HRESULT
  168. AddFileSet(
  169. [in] ULONG cFileCount,
  170. [in, size_is(cFileCount)] BG_FILE_INFO *pFileSet
  171. );
  172. HRESULT
  173. AddFile(
  174. [in] LPCWSTR RemoteUrl,
  175. [in] LPCWSTR LocalName
  176. );
  177. //
  178. // Gets an enumerator object for all files in the job.
  179. //
  180. HRESULT
  181. EnumFiles(
  182. [out] IEnumBackgroundCopyFiles ** pEnum
  183. );
  184. //
  185. // Pause all activity on the job. The service will take no action until one of
  186. // Resume(), Cancel(), Complete() is called.
  187. //
  188. // if already suspended, just returns S_OK.
  189. //
  190. HRESULT Suspend();
  191. //
  192. // Enable downloading for this job. Job properties cannot be modified
  193. // after Resume() until the app calls Suspend().
  194. //
  195. // if already running, just returns S_OK.
  196. //
  197. HRESULT Resume();
  198. //
  199. // Permanently stop the job. The service will delete the job metadata and downloaded files.
  200. //
  201. // If already cancelled or resumed, returns ???
  202. //
  203. HRESULT Cancel();
  204. //
  205. // Acknowledges receipt of the job-complete notification. The service will delete
  206. // the job metadata and leave the downloaded files.
  207. //
  208. HRESULT Complete();
  209. //--------------------------------------------------------------------
  210. HRESULT GetId( [out] GUID *pVal );
  211. HRESULT GetType( [out] BG_JOB_TYPE * pVal );
  212. HRESULT GetProgress( [out] BG_JOB_PROGRESS *pVal );
  213. HRESULT GetTimes( [out] BG_JOB_TIMES * pVal );
  214. HRESULT GetState( [out] BG_JOB_STATE *pVal );
  215. HRESULT GetError( [out] IBackgroundCopyError ** ppError );
  216. //
  217. // The owner of the job, represented as a string.
  218. // Only the owner and admins are allowed to see or change the job.
  219. //
  220. HRESULT GetOwner( [out] LPWSTR *pVal );
  221. //
  222. // name of the job, suitable for display in UI
  223. //
  224. HRESULT SetDisplayName( [in] LPCWSTR Val );
  225. HRESULT GetDisplayName( [out] LPWSTR *pVal );
  226. //
  227. // a field for use by the app
  228. //
  229. HRESULT SetDescription( [in] LPCWSTR Val );
  230. HRESULT GetDescription( [out] LPWSTR *pVal );
  231. //
  232. // the priority of the job in the queue.
  233. // default = PRIORITY_NORMAL
  234. // values not in BG_JOB_PRIORITY return E_NOTIMPL.
  235. //
  236. HRESULT SetPriority( [in] BG_JOB_PRIORITY Val );
  237. HRESULT GetPriority( [out] BG_JOB_PRIORITY *pVal );
  238. //
  239. // ignores extra flags?
  240. //
  241. HRESULT SetNotifyFlags( [in] ULONG Val );
  242. HRESULT GetNotifyFlags( [out] ULONG *pVal );
  243. // interface pointer that implements the IBackgroundCallback interface for notifications.
  244. // If the pointer becomes invalid, the service will try to create a new notification object
  245. // with the notify CLSID.
  246. HRESULT SetNotifyInterface( [in] IUnknown * Val );
  247. HRESULT GetNotifyInterface( [out] IUnknown ** pVal );
  248. HRESULT SetMinimumRetryDelay( [in] ULONG Seconds );
  249. HRESULT GetMinimumRetryDelay( [out] ULONG * Seconds );
  250. HRESULT SetNoProgressTimeout( [in] ULONG Seconds );
  251. HRESULT GetNoProgressTimeout( [out] ULONG * Seconds );
  252. HRESULT GetErrorCount( [out] ULONG * Errors );
  253. HRESULT SetProxySettings(
  254. [in] BG_JOB_PROXY_USAGE ProxyUsage,
  255. [in,string,unique] const WCHAR * ProxyList,
  256. [in,string,unique] const WCHAR * ProxyBypassList );
  257. HRESULT GetProxySettings(
  258. [out] BG_JOB_PROXY_USAGE *pProxyUsage,
  259. [out] LPWSTR *pProxyList,
  260. [out] LPWSTR *pProxyBypassList );
  261. HRESULT TakeOwnership();
  262. }
  263. // ==============================================
  264. // IEnumJobs Interface
  265. // This interface allows enumerating the jobs under a Job
  266. [
  267. uuid(1af4f612-3b71-466f-8f58-7b6f73ac57ad),
  268. helpstring("IEnumBackgroundCopyJobs2 Interface"),
  269. odl
  270. ]
  271. interface IEnumBackgroundCopyJobs : IUnknown
  272. {
  273. HRESULT Next( [in] ULONG celt,
  274. [out, size_is(BG_ENUM_SIZEIS(celt)), length_is(BG_ENUM_LENGTHIS(celt,pceltFetched))] IBackgroundCopyJob **rgelt,
  275. [in,out,unique] ULONG *pceltFetched );
  276. HRESULT Skip( [in] ULONG celt);
  277. HRESULT Reset();
  278. HRESULT Clone( [out] IEnumBackgroundCopyJobs **ppenum );
  279. HRESULT GetCount( [out] ULONG *puCount );
  280. }
  281. cpp_quote("#define BG_NOTIFY_JOB_TRANSFERRED 0x0001")
  282. cpp_quote("#define BG_NOTIFY_JOB_ERROR 0x0002")
  283. cpp_quote("#define BG_NOTIFY_DISABLE 0x0004")
  284. cpp_quote("#define BG_NOTIFY_JOB_MODIFICATION 0x0008")
  285. // ==============================================
  286. // IBackgroundCallback Interface
  287. // This interface is implemented by the client and is used by the queue manager
  288. // to supply progress information to the client.
  289. [
  290. uuid(97ea99c7-0186-4ad4-8df9-c5b4e0ed6b22),
  291. #if !defined( BITS_DONT_USE_ASYNC_DCOM )
  292. async_uuid(ca29d251-b4bb-4679-a3d9-ae8006119d54),
  293. #endif
  294. helpstring("IBackgroundCopyCallback Interface"),
  295. odl
  296. ]
  297. interface IBackgroundCopyCallback : IUnknown
  298. {
  299. //
  300. // A job has transferred successfully.
  301. //
  302. HRESULT JobTransferred( [in] IBackgroundCopyJob *pJob );
  303. //
  304. // An error occurred, and the service has suspended the job.
  305. // Fix the error and resume the job.
  306. // Get error details by calling (*pFailingJob)->GetStatus().
  307. //
  308. HRESULT JobError( [in] IBackgroundCopyJob *pJob,
  309. [in] IBackgroundCopyError * pError );
  310. //
  311. // The job has been modified. Intendended for user interfaces.
  312. //
  313. HRESULT JobModification( [in] IBackgroundCopyJob *pJob,
  314. [in] DWORD dwReserved );
  315. }
  316. //
  317. // IBackgroundCopyManager is the "root" interface to the background file copy component.
  318. //
  319. [
  320. uuid(5ce34c0d-0dc9-4c1f-897c-daa1b78cee7c),
  321. helpstring("Background Copy interface"),
  322. odl
  323. ]
  324. interface IBackgroundCopyManager : IUnknown
  325. {
  326. HRESULT CreateJob(
  327. [in] LPCWSTR DisplayName,
  328. [in] BG_JOB_TYPE Type,
  329. [out] GUID * pJobId,
  330. [out] IBackgroundCopyJob **ppJob );
  331. HRESULT GetJob( [in] REFGUID jobID,
  332. [out] IBackgroundCopyJob **ppJob );
  333. //
  334. // Without this flag, jobs not owned by the caller are excluded from the enumeration.
  335. // With this flag, those jobs are included. Only works if the caller is an administrator.
  336. //
  337. cpp_quote("#define BG_JOB_ENUM_ALL_USERS 0x0001")
  338. HRESULT EnumJobs( [in] DWORD dwFlags,
  339. [out] IEnumBackgroundCopyJobs **ppEnum );
  340. HRESULT GetErrorDescription(
  341. [in] HRESULT hResult,
  342. [in] DWORD LanguageId,
  343. [out] LPWSTR *pErrorDescription );
  344. }
  345. //---------------------------------------------------------------------------
  346. [
  347. uuid(1deeb74f-7915-4560-b558-918c83f176a6),
  348. helpstring("Microsoft Background Copy Queue Manager 1.0"),
  349. lcid(0x0000),
  350. version(1.0)
  351. ]
  352. library BackgroundCopyManager
  353. {
  354. [
  355. uuid(4991d34b-80a1-4291-83b6-3328366b9097),
  356. helpstring("Background copy control class")
  357. ]
  358. coclass BackgroundCopyManager
  359. {
  360. [default] interface IBackgroundCopyManager;
  361. };
  362. interface IBackgroundCopyCallback;
  363. }
  364. cpp_quote("#include \"bits1_5.h\"")