Bits.Idl 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445
  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_AUTODETECT
  156. } BG_JOB_PROXY_USAGE;
  157. //--------------------------------------------------------------------
  158. //
  159. // Returns E_INVALIDARG if one of the filesets has
  160. // - local name is blank
  161. // - local name contains invalid characters
  162. // - remote name is blank
  163. // - remote name has invalid format
  164. //
  165. // Returns CO_E_NOT_SUPPORTED if
  166. // - remote URL contains unsupported protocol
  167. //
  168. HRESULT
  169. AddFileSet(
  170. [in] ULONG cFileCount,
  171. [in, size_is(cFileCount)] BG_FILE_INFO *pFileSet
  172. );
  173. HRESULT
  174. AddFile(
  175. [in] LPCWSTR RemoteUrl,
  176. [in] LPCWSTR LocalName
  177. );
  178. //
  179. // Gets an enumerator object for all files in the job.
  180. //
  181. HRESULT
  182. EnumFiles(
  183. [out] IEnumBackgroundCopyFiles ** pEnum
  184. );
  185. //
  186. // Pause all activity on the job. The service will take no action until one of
  187. // Resume(), Cancel(), Complete() is called.
  188. //
  189. // if already suspended, just returns S_OK.
  190. //
  191. HRESULT Suspend();
  192. //
  193. // Enable downloading for this job. Job properties cannot be modified
  194. // after Resume() until the app calls Suspend().
  195. //
  196. // if already running, just returns S_OK.
  197. //
  198. HRESULT Resume();
  199. //
  200. // Permanently stop the job. The service will delete the job metadata and downloaded files.
  201. //
  202. // If already cancelled or resumed, returns ???
  203. //
  204. HRESULT Cancel();
  205. //
  206. // Acknowledges receipt of the job-complete notification. The service will delete
  207. // the job metadata and leave the downloaded files.
  208. //
  209. HRESULT Complete();
  210. //--------------------------------------------------------------------
  211. HRESULT GetId( [out] GUID *pVal );
  212. HRESULT GetType( [out] BG_JOB_TYPE * pVal );
  213. HRESULT GetProgress( [out] BG_JOB_PROGRESS *pVal );
  214. HRESULT GetTimes( [out] BG_JOB_TIMES * pVal );
  215. HRESULT GetState( [out] BG_JOB_STATE *pVal );
  216. HRESULT GetError( [out] IBackgroundCopyError ** ppError );
  217. //
  218. // The owner of the job, represented as a string.
  219. // Only the owner and admins are allowed to see or change the job.
  220. //
  221. HRESULT GetOwner( [out] LPWSTR *pVal );
  222. //
  223. // name of the job, suitable for display in UI
  224. //
  225. HRESULT SetDisplayName( [in] LPCWSTR Val );
  226. HRESULT GetDisplayName( [out] LPWSTR *pVal );
  227. //
  228. // a field for use by the app
  229. //
  230. HRESULT SetDescription( [in] LPCWSTR Val );
  231. HRESULT GetDescription( [out] LPWSTR *pVal );
  232. //
  233. // the priority of the job in the queue.
  234. // default = PRIORITY_NORMAL
  235. // values not in BG_JOB_PRIORITY return E_NOTIMPL.
  236. //
  237. HRESULT SetPriority( [in] BG_JOB_PRIORITY Val );
  238. HRESULT GetPriority( [out] BG_JOB_PRIORITY *pVal );
  239. //
  240. // ignores extra flags?
  241. //
  242. HRESULT SetNotifyFlags( [in] ULONG Val );
  243. HRESULT GetNotifyFlags( [out] ULONG *pVal );
  244. // interface pointer that implements the IBackgroundCallback interface for notifications.
  245. // If the pointer becomes invalid, the service will try to create a new notification object
  246. // with the notify CLSID.
  247. HRESULT SetNotifyInterface( [in] IUnknown * Val );
  248. HRESULT GetNotifyInterface( [out] IUnknown ** pVal );
  249. HRESULT SetMinimumRetryDelay( [in] ULONG Seconds );
  250. HRESULT GetMinimumRetryDelay( [out] ULONG * Seconds );
  251. HRESULT SetNoProgressTimeout( [in] ULONG Seconds );
  252. HRESULT GetNoProgressTimeout( [out] ULONG * Seconds );
  253. HRESULT GetErrorCount( [out] ULONG * Errors );
  254. HRESULT SetProxySettings(
  255. [in] BG_JOB_PROXY_USAGE ProxyUsage,
  256. [in,string,unique] const WCHAR * ProxyList,
  257. [in,string,unique] const WCHAR * ProxyBypassList );
  258. HRESULT GetProxySettings(
  259. [out] BG_JOB_PROXY_USAGE *pProxyUsage,
  260. [out] LPWSTR *pProxyList,
  261. [out] LPWSTR *pProxyBypassList );
  262. HRESULT TakeOwnership();
  263. }
  264. // ==============================================
  265. // IEnumJobs Interface
  266. // This interface allows enumerating the jobs under a Job
  267. [
  268. uuid(1af4f612-3b71-466f-8f58-7b6f73ac57ad),
  269. helpstring("IEnumBackgroundCopyJobs2 Interface"),
  270. odl
  271. ]
  272. interface IEnumBackgroundCopyJobs : IUnknown
  273. {
  274. HRESULT Next( [in] ULONG celt,
  275. [out, size_is(BG_ENUM_SIZEIS(celt)), length_is(BG_ENUM_LENGTHIS(celt,pceltFetched))] IBackgroundCopyJob **rgelt,
  276. [in,out,unique] ULONG *pceltFetched );
  277. HRESULT Skip( [in] ULONG celt);
  278. HRESULT Reset();
  279. HRESULT Clone( [out] IEnumBackgroundCopyJobs **ppenum );
  280. HRESULT GetCount( [out] ULONG *puCount );
  281. }
  282. cpp_quote("#define BG_NOTIFY_JOB_TRANSFERRED 0x0001")
  283. cpp_quote("#define BG_NOTIFY_JOB_ERROR 0x0002")
  284. cpp_quote("#define BG_NOTIFY_DISABLE 0x0004")
  285. cpp_quote("#define BG_NOTIFY_JOB_MODIFICATION 0x0008")
  286. // ==============================================
  287. // IBackgroundCallback Interface
  288. // This interface is implemented by the client and is used by the queue manager
  289. // to supply progress information to the client.
  290. [
  291. uuid(97ea99c7-0186-4ad4-8df9-c5b4e0ed6b22),
  292. #if !defined( BITS_DONT_USE_ASYNC_DCOM )
  293. async_uuid(ca29d251-b4bb-4679-a3d9-ae8006119d54),
  294. #endif
  295. helpstring("IBackgroundCopyCallback Interface"),
  296. odl
  297. ]
  298. interface IBackgroundCopyCallback : IUnknown
  299. {
  300. //
  301. // A job has transferred successfully.
  302. //
  303. HRESULT JobTransferred( [in] IBackgroundCopyJob *pJob );
  304. //
  305. // An error occurred, and the service has suspended the job.
  306. // Fix the error and resume the job.
  307. // Get error details by calling (*pFailingJob)->GetStatus().
  308. //
  309. HRESULT JobError( [in] IBackgroundCopyJob *pJob,
  310. [in] IBackgroundCopyError * pError );
  311. //
  312. // The job has been modified. Intendended for user interfaces.
  313. //
  314. HRESULT JobModification( [in] IBackgroundCopyJob *pJob,
  315. [in] DWORD dwReserved );
  316. }
  317. //
  318. // IBackgroundCopyManager is the "root" interface to the background file copy component.
  319. //
  320. [
  321. uuid(5ce34c0d-0dc9-4c1f-897c-daa1b78cee7c),
  322. helpstring("Background Copy interface"),
  323. odl
  324. ]
  325. interface IBackgroundCopyManager : IUnknown
  326. {
  327. HRESULT CreateJob(
  328. [in] LPCWSTR DisplayName,
  329. [in] BG_JOB_TYPE Type,
  330. [out] GUID * pJobId,
  331. [out] IBackgroundCopyJob **ppJob );
  332. HRESULT GetJob( [in] REFGUID jobID,
  333. [out] IBackgroundCopyJob **ppJob );
  334. //
  335. // Without this flag, jobs not owned by the caller are excluded from the enumeration.
  336. // With this flag, those jobs are included. Only works if the caller is an administrator.
  337. //
  338. cpp_quote("#define BG_JOB_ENUM_ALL_USERS 0x0001")
  339. HRESULT EnumJobs( [in] DWORD dwFlags,
  340. [out] IEnumBackgroundCopyJobs **ppEnum );
  341. HRESULT GetErrorDescription(
  342. [in] HRESULT hResult,
  343. [in] DWORD LanguageId,
  344. [out] LPWSTR *pErrorDescription );
  345. }
  346. //---------------------------------------------------------------------------
  347. [
  348. uuid(1deeb74f-7915-4560-b558-918c83f176a6),
  349. helpstring("Microsoft Background Copy Queue Manager 1.0"),
  350. lcid(0x0000),
  351. version(1.0)
  352. ]
  353. library BackgroundCopyManager
  354. {
  355. [
  356. uuid(4991d34b-80a1-4291-83b6-3328366b9097),
  357. helpstring("Background copy control class")
  358. ]
  359. coclass BackgroundCopyManager
  360. {
  361. [default] interface IBackgroundCopyManager;
  362. };
  363. interface IBackgroundCopyCallback;
  364. }
  365. cpp_quote("#include \"bits1_5.h\"")