1 // Copyright © 2015-2017 winapi-rs developers 2 // Licensed under the Apache License, Version 2.0 3 // <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0> or the MIT license 4 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your option. 5 // All files in the project carrying such notice may not be copied, modified, or distributed 6 // except according to those terms. 7 use shared::basetsd::UINT64; 8 use shared::guiddef::{GUID, REFGUID}; 9 use shared::minwindef::{BOOL, DWORD, FILETIME, ULONG}; 10 use um::unknwnbase::{IUnknown, IUnknownVtbl}; 11 use um::winnt::{HRESULT, LPCWSTR, LPWSTR, WCHAR}; 12 pub const BG_SIZE_UNKNOWN: UINT64 = -1i64 as u64; 13 STRUCT!{struct BG_FILE_PROGRESS { 14 BytesTotal: UINT64, 15 BytesTransferred: UINT64, 16 Completed: BOOL, 17 }} 18 RIDL!{#[uuid(0x01b7bd23, 0xfb88, 0x4a77, 0x84, 0x90, 0x58, 0x91, 0xd3, 0xe4, 0x65, 0x3a)] 19 interface IBackgroundCopyFile(IBackgroundCopyFileVtbl): IUnknown(IUnknownVtbl) { 20 fn GetRemoteName( 21 pVal: *mut LPWSTR, 22 ) -> HRESULT, 23 fn GetLocalName( 24 pVal: *mut LPWSTR, 25 ) -> HRESULT, 26 fn GetProgress( 27 pVal: *mut BG_FILE_PROGRESS, 28 ) -> HRESULT, 29 }} 30 RIDL!{#[uuid(0xca51e165, 0xc365, 0x424c, 0x8d, 0x41, 0x24, 0xaa, 0xa4, 0xff, 0x3c, 0x40)] 31 interface IEnumBackgroundCopyFiles(IEnumBackgroundCopyFilesVtbl): IUnknown(IUnknownVtbl) { 32 fn Next( 33 celt: ULONG, 34 rgelt: *mut *mut IBackgroundCopyFile, 35 pceltFetched: *mut ULONG, 36 ) -> HRESULT, 37 fn Skip( 38 celt: ULONG, 39 ) -> HRESULT, 40 fn Reset() -> HRESULT, 41 fn Clone( 42 ppenum: *mut *mut IEnumBackgroundCopyFiles, 43 ) -> HRESULT, 44 fn GetCount( 45 puCount: *mut ULONG, 46 ) -> HRESULT, 47 }} 48 ENUM!{enum BG_ERROR_CONTEXT { 49 BG_ERROR_CONTEXT_NONE = 0, 50 BG_ERROR_CONTEXT_UNKNOWN = 1, 51 BG_ERROR_CONTEXT_GENERAL_QUEUE_MANAGER = 2, 52 BG_ERROR_CONTEXT_QUEUE_MANAGER_NOTIFICATION = 3, 53 BG_ERROR_CONTEXT_LOCAL_FILE = 4, 54 BG_ERROR_CONTEXT_REMOTE_FILE = 5, 55 BG_ERROR_CONTEXT_GENERAL_TRANSPORT = 6, 56 BG_ERROR_CONTEXT_REMOTE_APPLICATION = 7, 57 }} 58 RIDL!{#[uuid(0x19c613a0, 0xfcb8, 0x4f28, 0x81, 0xae, 0x89, 0x7c, 0x3d, 0x07, 0x8f, 0x81)] 59 interface IBackgroundCopyError(IBackgroundCopyErrorVtbl): IUnknown(IUnknownVtbl) { 60 fn GetError( 61 pContext: *mut BG_ERROR_CONTEXT, 62 pCode: *mut HRESULT, 63 ) -> HRESULT, 64 fn GetFile( 65 pVal: *mut *mut IBackgroundCopyFile, 66 ) -> HRESULT, 67 fn GetErrorDescription( 68 LanguageId: DWORD, 69 pErrorDescription: *mut LPWSTR, 70 ) -> HRESULT, 71 fn GetErrorContextDescription( 72 LanguageId: DWORD, 73 pContextDescription: *mut LPWSTR, 74 ) -> HRESULT, 75 fn GetProtocol( 76 pProtocol: *mut LPWSTR, 77 ) -> HRESULT, 78 }} 79 STRUCT!{struct BG_FILE_INFO { 80 RemoteName: LPWSTR, 81 LocalName: LPWSTR, 82 }} 83 STRUCT!{struct BG_JOB_PROGRESS { 84 BytesTotal: UINT64, 85 BytesTransferred: UINT64, 86 FilesTotal: ULONG, 87 FilesTransferred: ULONG, 88 }} 89 STRUCT!{struct BG_JOB_TIMES { 90 CreationTime: FILETIME, 91 ModificationTime: FILETIME, 92 TransferCompletionTime: FILETIME, 93 }} 94 ENUM!{enum BG_JOB_PRIORITY { 95 BG_JOB_PRIORITY_FOREGROUND = 0, 96 BG_JOB_PRIORITY_HIGH = BG_JOB_PRIORITY_FOREGROUND + 1, 97 BG_JOB_PRIORITY_NORMAL = BG_JOB_PRIORITY_HIGH + 1, 98 BG_JOB_PRIORITY_LOW = BG_JOB_PRIORITY_NORMAL + 1, 99 }} 100 ENUM!{enum BG_JOB_STATE { 101 BG_JOB_STATE_QUEUED = 0, 102 BG_JOB_STATE_CONNECTING = BG_JOB_STATE_QUEUED + 1, 103 BG_JOB_STATE_TRANSFERRING = BG_JOB_STATE_CONNECTING + 1, 104 BG_JOB_STATE_SUSPENDED = BG_JOB_STATE_TRANSFERRING + 1, 105 BG_JOB_STATE_ERROR = BG_JOB_STATE_SUSPENDED + 1, 106 BG_JOB_STATE_TRANSIENT_ERROR = BG_JOB_STATE_ERROR + 1, 107 BG_JOB_STATE_TRANSFERRED = BG_JOB_STATE_TRANSIENT_ERROR + 1, 108 BG_JOB_STATE_ACKNOWLEDGED = BG_JOB_STATE_TRANSFERRED + 1, 109 BG_JOB_STATE_CANCELLED = BG_JOB_STATE_ACKNOWLEDGED + 1, 110 }} 111 ENUM!{enum BG_JOB_TYPE { 112 BG_JOB_TYPE_DOWNLOAD = 0, 113 BG_JOB_TYPE_UPLOAD = BG_JOB_TYPE_DOWNLOAD + 1, 114 BG_JOB_TYPE_UPLOAD_REPLY = BG_JOB_TYPE_UPLOAD + 1, 115 }} 116 ENUM!{enum BG_JOB_PROXY_USAGE { 117 BG_JOB_PROXY_USAGE_PRECONFIG = 0, 118 BG_JOB_PROXY_USAGE_NO_PROXY = BG_JOB_PROXY_USAGE_PRECONFIG + 1, 119 BG_JOB_PROXY_USAGE_OVERRIDE = BG_JOB_PROXY_USAGE_NO_PROXY + 1, 120 BG_JOB_PROXY_USAGE_AUTODETECT = BG_JOB_PROXY_USAGE_OVERRIDE + 1, 121 }} 122 RIDL!{#[uuid(0x37668d37, 0x507e, 0x4160, 0x93, 0x16, 0x26, 0x30, 0x6d, 0x15, 0x0b, 0x12)] 123 interface IBackgroundCopyJob(IBackgroundCopyJobVtbl): IUnknown(IUnknownVtbl) { 124 fn AddFileSet( 125 cFileCount: ULONG, 126 pFileSet: *mut BG_FILE_INFO, 127 ) -> HRESULT, 128 fn AddFile( 129 RemoteUrl: LPCWSTR, 130 LocalName: LPCWSTR, 131 ) -> HRESULT, 132 fn EnumFiles( 133 pErrorDescription: *mut *mut IEnumBackgroundCopyFiles, 134 ) -> HRESULT, 135 fn Suspend() -> HRESULT, 136 fn Resume() -> HRESULT, 137 fn Cancel() -> HRESULT, 138 fn Complete() -> HRESULT, 139 fn GetId( 140 pVal: *mut GUID, 141 ) -> HRESULT, 142 fn GetType( 143 pVal: *mut BG_JOB_TYPE, 144 ) -> HRESULT, 145 fn GetProgress( 146 pVal: *mut BG_JOB_PROGRESS, 147 ) -> HRESULT, 148 fn GetTimes( 149 pVal: *mut BG_JOB_TIMES, 150 ) -> HRESULT, 151 fn GetState( 152 pVal: *mut BG_JOB_STATE, 153 ) -> HRESULT, 154 fn GetError( 155 ppError: *mut *mut IBackgroundCopyError, 156 ) -> HRESULT, 157 fn GetOwner( 158 pVal: *mut LPWSTR, 159 ) -> HRESULT, 160 fn SetDisplayName( 161 Val: LPCWSTR, 162 ) -> HRESULT, 163 fn GetDisplayName( 164 pVal: *mut LPWSTR, 165 ) -> HRESULT, 166 fn SetDescription( 167 Val: LPCWSTR, 168 ) -> HRESULT, 169 fn GetDescription( 170 pVal: *mut LPWSTR, 171 ) -> HRESULT, 172 fn SetPriority( 173 Val: BG_JOB_PRIORITY, 174 ) -> HRESULT, 175 fn GetPriority( 176 pVal: *mut BG_JOB_PRIORITY, 177 ) -> HRESULT, 178 fn SetNotifyFlags( 179 Val: ULONG, 180 ) -> HRESULT, 181 fn GetNotifyFlags( 182 pVal: *mut ULONG, 183 ) -> HRESULT, 184 fn SetNotifyInterface( 185 Val: *mut IUnknown, 186 ) -> HRESULT, 187 fn GetNotifyInterface( 188 pVal: *mut *mut IUnknown, 189 ) -> HRESULT, 190 fn SetMinimumRetryDelay( 191 Seconds: ULONG, 192 ) -> HRESULT, 193 fn GetMinimumRetryDelay( 194 Seconds: *mut ULONG, 195 ) -> HRESULT, 196 fn SetNoProgressTimeout( 197 Seconds: ULONG, 198 ) -> HRESULT, 199 fn GetNoProgressTimeout( 200 Seconds: *mut ULONG, 201 ) -> HRESULT, 202 fn GetErrorCount( 203 Errors: *mut ULONG, 204 ) -> HRESULT, 205 fn SetProxySettings( 206 ProxyUsage: BG_JOB_PROXY_USAGE, 207 ProxyList: *const WCHAR, 208 ProxyBypassList: *const WCHAR, 209 ) -> HRESULT, 210 fn GetProxySettings( 211 pProxyUsage: *mut BG_JOB_PROXY_USAGE, 212 pProxyList: *mut LPWSTR, 213 pProxyBypassListpProxyList: *mut LPWSTR, 214 ) -> HRESULT, 215 fn TakeOwnership() -> HRESULT, 216 }} 217 RIDL!{#[uuid(0x1af4f612, 0x3b71, 0x466f, 0x8f, 0x58, 0x7b, 0x6f, 0x73, 0xac, 0x57, 0xad)] 218 interface IEnumBackgroundCopyJobs(IEnumBackgroundCopyJobsVtbl): IUnknown(IUnknownVtbl) { 219 fn Next( 220 celt: ULONG, 221 rgelt: *mut *mut IBackgroundCopyJob, 222 pceltFetched: *mut ULONG, 223 ) -> HRESULT, 224 fn Skip( 225 celt: ULONG, 226 ) -> HRESULT, 227 fn Reset() -> HRESULT, 228 fn Clone( 229 ppenum: *mut *mut IEnumBackgroundCopyJobs, 230 ) -> HRESULT, 231 fn GetCount( 232 puCount: *mut ULONG, 233 ) -> HRESULT, 234 }} 235 pub const BG_NOTIFY_JOB_TRANSFERRED: DWORD = 0x0001; 236 pub const BG_NOTIFY_JOB_ERROR: DWORD = 0x0002; 237 pub const BG_NOTIFY_DISABLE: DWORD = 0x0004; 238 pub const BG_NOTIFY_JOB_MODIFICATION: DWORD = 0x0008; 239 pub const BG_NOTIFY_FILE_TRANSFERRED: DWORD = 0x0010; 240 pub const BG_NOTIFY_FILE_RANGES_TRANSFERRED: DWORD = 0x0020; 241 RIDL!{#[uuid(0x97ea99c7, 0x0186, 0x4ad4, 0x8d, 0xf9, 0xc5, 0xb4, 0xe0, 0xed, 0x6b, 0x22)] 242 interface IBackgroundCopyCallback(IBackgroundCopyCallbackVtbl): IUnknown(IUnknownVtbl) { 243 fn JobTransferred( 244 pJob: *mut IBackgroundCopyJob, 245 ) -> HRESULT, 246 fn JobError( 247 pJob: *mut IBackgroundCopyJob, 248 pError: *mut IBackgroundCopyError, 249 ) -> HRESULT, 250 fn JobModification( 251 pJob: *mut IBackgroundCopyJob, 252 dwReserved: DWORD, 253 ) -> HRESULT, 254 }} 255 RIDL!{#[uuid(0xca29d251, 0xb4bb, 0x4679, 0xa3, 0xd9, 0xae, 0x80, 0x06, 0x11, 0x9d, 0x54)] 256 interface AsyncIBackgroundCopyCallback(AsyncIBackgroundCopyCallbackVtbl): IUnknown(IUnknownVtbl) { 257 fn Begin_JobTransferred( 258 pJob: *mut IBackgroundCopyJob, 259 ) -> HRESULT, 260 fn Finish_JobTransferred() -> HRESULT, 261 fn Begin_JobError( 262 pJob: *mut IBackgroundCopyJob, 263 pError: *mut IBackgroundCopyError, 264 ) -> HRESULT, 265 fn Finish_JobError() -> HRESULT, 266 fn Begin_JobModification( 267 pJob: *mut IBackgroundCopyJob, 268 dwReserved: DWORD, 269 ) -> HRESULT, 270 fn Finish_JobModification() -> HRESULT, 271 }} 272 pub const BG_JOB_ENUM_ALL_USERS: DWORD = 0x0001; 273 RIDL!{#[uuid(0x5ce34c0d, 0x0dc9, 0x4c1f, 0x89, 0x7c, 0xda, 0xa1, 0xb7, 0x8c, 0xee, 0x7c)] 274 interface IBackgroundCopyManager(IBackgroundCopyManagerVtbl): IUnknown(IUnknownVtbl) { 275 fn CreateJob( 276 DisplayName: LPCWSTR, 277 Type: BG_JOB_TYPE, 278 pJobId: *mut GUID, 279 ppJob: *mut *mut IBackgroundCopyJob, 280 ) -> HRESULT, 281 fn GetJob( 282 jobID: REFGUID, 283 ppJob: *mut *mut IBackgroundCopyJob, 284 ) -> HRESULT, 285 fn EnumJobs( 286 dwFlags: DWORD, 287 ppEnum: *mut *mut IEnumBackgroundCopyJobs, 288 ) -> HRESULT, 289 fn GetErrorDescription( 290 hResult: HRESULT, 291 LanguageId: DWORD, 292 pErrorDescription: *mut LPWSTR, 293 ) -> HRESULT, 294 }} 295