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.

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