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 //! Declaration of Writer 8 use shared::minwindef::{BOOL, BYTE, DWORD, FILETIME, UINT}; 9 use shared::wtypes::BSTR; 10 use um::unknwnbase::{IUnknown, IUnknownVtbl}; 11 use um::vss::{VSS_ID, VSS_ROLLFORWARD_TYPE}; 12 use um::winnt::{HRESULT, LPCWSTR, VOID}; 13 ENUM!{enum VSS_USAGE_TYPE { 14 VSS_UT_UNDEFINED = 0, 15 VSS_UT_BOOTABLESYSTEMSTATE = 1, 16 VSS_UT_SYSTEMSERVICE = 2, 17 VSS_UT_USERDATA = 3, 18 VSS_UT_OTHER = 4, 19 }} 20 ENUM!{enum VSS_SOURCE_TYPE { 21 VSS_ST_UNDEFINED = 0, 22 VSS_ST_TRANSACTEDDB = 1, 23 VSS_ST_NONTRANSACTEDDB = 2, 24 VSS_ST_OTHER = 3, 25 }} 26 ENUM!{enum VSS_RESTOREMETHOD_ENUM { 27 VSS_RME_UNDEFINED = 0, 28 VSS_RME_RESTORE_IF_NOT_THERE = 1, 29 VSS_RME_RESTORE_IF_CAN_REPLACE = 2, 30 VSS_RME_STOP_RESTORE_START = 3, 31 VSS_RME_RESTORE_TO_ALTERNATE_LOCATION = 4, 32 VSS_RME_RESTORE_AT_REBOOT = 5, 33 VSS_RME_RESTORE_AT_REBOOT_IF_CANNOT_REPLACE = 6, 34 VSS_RME_CUSTOM = 7, 35 VSS_RME_RESTORE_STOP_START = 8, 36 }} 37 ENUM!{enum VSS_WRITERRESTORE_ENUM { 38 VSS_WRE_UNDEFINED = 0, 39 VSS_WRE_NEVER = 1, 40 VSS_WRE_IF_REPLACE_FAILS = 2, 41 VSS_WRE_ALWAYS = 3, 42 }} 43 ENUM!{enum VSS_COMPONENT_TYPE { 44 VSS_CT_UNDEFINED = 0, 45 VSS_CT_DATABASE = 1, 46 VSS_CT_FILEGROUP = 2, 47 }} 48 ENUM!{enum VSS_ALTERNATE_WRITER_STATE { 49 VSS_AWS_UNDEFINED = 0, 50 VSS_AWS_NO_ALTERNATE_WRITER = 1, 51 VSS_AWS_ALTERNATE_WRITER_EXISTS = 2, 52 VSS_AWS_THIS_IS_ALTERNATE_WRITER = 3, 53 }} 54 ENUM!{enum VSS_SUBSCRIBE_MASK { 55 VSS_SM_POST_SNAPSHOT_FLAG = 0x00000001, 56 VSS_SM_BACKUP_EVENTS_FLAG = 0x00000002, 57 VSS_SM_RESTORE_EVENTS_FLAG = 0x00000004, 58 VSS_SM_IO_THROTTLING_FLAG = 0x00000008, 59 VSS_SM_ALL_FLAGS = 0xffffffff, 60 }} 61 ENUM!{enum VSS_RESTORE_TARGET { 62 VSS_RT_UNDEFINED = 0, 63 VSS_RT_ORIGINAL = 1, 64 VSS_RT_ALTERNATE = 2, 65 VSS_RT_DIRECTED = 3, 66 VSS_RT_ORIGINAL_LOCATION = 4, 67 }} 68 ENUM!{enum VSS_FILE_RESTORE_STATUS { 69 VSS_RS_UNDEFINED = 0, 70 VSS_RS_NONE = 1, 71 VSS_RS_ALL = 2, 72 VSS_RS_FAILED = 3, 73 }} 74 ENUM!{enum VSS_COMPONENT_FLAGS { 75 VSS_CF_BACKUP_RECOVERY = 0x00000001, 76 VSS_CF_APP_ROLLBACK_RECOVERY = 0x00000002, 77 VSS_CF_NOT_SYSTEM_STATE = 0x00000004, 78 }} 79 RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] 80 interface IVssWMFiledesc(IVssWMFiledescVtbl): IUnknown(IUnknownVtbl) { 81 fn GetPath( 82 pbstrPath: *mut BSTR, 83 ) -> HRESULT, 84 fn GetFilespec( 85 pbstrFilespec: *mut BSTR, 86 ) -> HRESULT, 87 fn GetRecursive( 88 pbRecursive: *mut bool, 89 ) -> HRESULT, 90 fn GetAlternateLocation( 91 pbstrAlternateLocation: *mut BSTR, 92 ) -> HRESULT, 93 fn GetBackupTypeMask( 94 pdwTypeMask: *mut DWORD, 95 ) -> HRESULT, 96 }} 97 RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] 98 interface IVssWMDependency(IVssWMDependencyVtbl): IUnknown(IUnknownVtbl) { 99 fn GetWriterId( 100 pWriterId: *mut VSS_ID, 101 ) -> HRESULT, 102 fn GetLogicalPath( 103 pbstrLogicalPath: *mut BSTR, 104 ) -> HRESULT, 105 fn GetComponentName( 106 pbstrComponentName: *mut BSTR, 107 ) -> HRESULT, 108 }} 109 RIDL!{#[uuid(0xd2c72c96, 0xc121, 0x4518, 0xb6, 0x27, 0xe5, 0xa9, 0x3d, 0x01, 0x0e, 0xad)] 110 interface IVssComponent(IVssComponentVtbl): IUnknown(IUnknownVtbl) { 111 fn GetLogicalPath( 112 pbstrPath: *mut BSTR, 113 ) -> HRESULT, 114 fn GetComponentType( 115 pct: *mut VSS_COMPONENT_TYPE, 116 ) -> HRESULT, 117 fn GetComponentName( 118 pbstrName: *mut BSTR, 119 ) -> HRESULT, 120 fn GetBackupSucceeded( 121 pbSucceeded: *mut bool, 122 ) -> HRESULT, 123 fn GetAlternateLocationMappingCount( 124 pcMappings: *mut UINT, 125 ) -> HRESULT, 126 fn GetAlternateLocationMapping( 127 iMapping: UINT, 128 ppFiledesc: *mut *mut IVssWMFiledesc, 129 ) -> HRESULT, 130 fn SetBackupMetadata( 131 wszData: LPCWSTR, 132 ) -> HRESULT, 133 fn GetBackupMetadata( 134 pbstrData: *mut BSTR, 135 ) -> HRESULT, 136 fn AddPartialFile( 137 wszPath: LPCWSTR, 138 wszFilename: LPCWSTR, 139 wszRanges: LPCWSTR, 140 wszMetadata: LPCWSTR, 141 ) -> HRESULT, 142 fn GetPartialFileCount( 143 pcPartialFiles: *mut UINT, 144 ) -> HRESULT, 145 fn GetPartialFile( 146 iPartialFile: UINT, 147 pbstrPath: *mut BSTR, 148 pbstrFilename: *mut BSTR, 149 pbstrRange: *mut BSTR, 150 pbstrMetadata: *mut BSTR, 151 ) -> HRESULT, 152 fn IsSelectedForRestore( 153 pbSelectedForRestore: *mut bool, 154 ) -> HRESULT, 155 fn GetAdditionalRestores( 156 pbAdditionalRestores: *mut bool, 157 ) -> HRESULT, 158 fn GetNewTargetCount( 159 pcNewTarget: *mut UINT, 160 ) -> HRESULT, 161 fn GetNewTarget( 162 iNewTarget: UINT, 163 ppFiledesc: *mut *mut IVssWMFiledesc, 164 ) -> HRESULT, 165 fn AddDirectedTarget( 166 wszSourcePath: LPCWSTR, 167 wszSourceFilename: LPCWSTR, 168 wszSourceRangeList: LPCWSTR, 169 wszDestinationPath: LPCWSTR, 170 wszDestinationFilename: LPCWSTR, 171 wszDestinationRangeList: LPCWSTR, 172 ) -> HRESULT, 173 fn GetDirectedTargetCount( 174 pcDirectedTarget: *mut UINT, 175 ) -> HRESULT, 176 fn GetDirectedTarget( 177 iDirectedTarget: UINT, 178 pbstrSourcePath: *mut BSTR, 179 pbstrSourceFileName: *mut BSTR, 180 pbstrSourceRangeList: *mut BSTR, 181 pbstrDestinationPath: *mut BSTR, 182 pbstrDestinationFilename: *mut BSTR, 183 pbstrDestinationRangeList: *mut BSTR, 184 ) -> HRESULT, 185 fn SetRestoreMetadata( 186 wszRestoreMetadata: LPCWSTR, 187 ) -> HRESULT, 188 fn GetRestoreMetadata( 189 pbstrRestoreMetadata: *mut BSTR, 190 ) -> HRESULT, 191 fn SetRestoreTarget( 192 target: VSS_RESTORE_TARGET, 193 ) -> HRESULT, 194 fn GetRestoreTarget( 195 pTarget: *mut VSS_RESTORE_TARGET, 196 ) -> HRESULT, 197 fn SetPreRestoreFailureMsg( 198 wszPreRestoreFailureMsg: LPCWSTR, 199 ) -> HRESULT, 200 fn GetPreRestoreFailureMsg( 201 pbstrPreRestoreFailureMsg: *mut BSTR, 202 ) -> HRESULT, 203 fn SetPostRestoreFailureMsg( 204 wszPostRestoreFailureMsg: LPCWSTR, 205 ) -> HRESULT, 206 fn GetPostRestoreFailureMsg( 207 pbstrPostRestoreFailureMsg: *mut BSTR, 208 ) -> HRESULT, 209 fn SetBackupStamp( 210 wszBackupStamp: LPCWSTR, 211 ) -> HRESULT, 212 fn GetBackupStamp( 213 pbstrBackupStamp: *mut BSTR, 214 ) -> HRESULT, 215 fn GetPreviousBackupStamp( 216 pbstrBackupStamp: *mut BSTR, 217 ) -> HRESULT, 218 fn GetBackupOptions( 219 pbstrBackupOptions: *mut BSTR, 220 ) -> HRESULT, 221 fn GetRestoreOptions( 222 pbstrRestoreOptions: *mut BSTR, 223 ) -> HRESULT, 224 fn GetRestoreSubcomponentCount( 225 pcRestoreSubcomponent: *mut UINT, 226 ) -> HRESULT, 227 fn GetRestoreSubcomponent( 228 iComponent: UINT, 229 pbstrLogicalPath: *mut BSTR, 230 pbstrComponentName: *mut BSTR, 231 pbRepair: *mut bool, 232 ) -> HRESULT, 233 fn GetFileRestoreStatus( 234 pStatus: *mut VSS_FILE_RESTORE_STATUS, 235 ) -> HRESULT, 236 fn AddDifferencedFilesByLastModifyTime( 237 wszPath: LPCWSTR, 238 wszFilespec: LPCWSTR, 239 bRecursive: BOOL, 240 ftLastModifyTime: FILETIME, 241 ) -> HRESULT, 242 fn AddDifferencedFilesByLastModifyLSN( 243 wszPath: LPCWSTR, 244 wszFilespec: LPCWSTR, 245 bRecursive: BOOL, 246 bstrLsnString: BSTR, 247 ) -> HRESULT, 248 fn GetDifferencedFilesCount( 249 pcDifferencedFiles: *mut UINT, 250 ) -> HRESULT, 251 fn GetDifferencedFile( 252 iDifferencedFile: UINT, 253 pbstrPath: *mut BSTR, 254 pbstrFilespec: *mut BSTR, 255 pbRecursive: *mut BOOL, 256 pbstrLsnString: *mut BSTR, 257 pftLastModifyTime: *mut FILETIME, 258 ) -> HRESULT, 259 }} 260 RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] 261 interface IVssWriterComponents(IVssWriterComponentsVtbl) { 262 fn GetComponentCount( 263 pcComponents: *mut UINT, 264 ) -> HRESULT, 265 fn GetWriterInfo( 266 pidInstance: *mut VSS_ID, 267 pidWriter: *mut VSS_ID, 268 ) -> HRESULT, 269 fn GetComponent( 270 iComponent: UINT, 271 ppComponent: *mut *mut IVssComponent, 272 ) -> HRESULT, 273 }} 274 RIDL!{#[uuid(0x156c8b5e, 0xf131, 0x4bd7, 0x9c, 0x97, 0xd1, 0x92, 0x3b, 0xe7, 0xe1, 0xfa)] 275 interface IVssComponentEx(IVssComponentExVtbl): IVssComponent(IVssComponentVtbl) { 276 fn SetPrepareForBackupFailureMsg( 277 wszFailureMsg: LPCWSTR, 278 ) -> HRESULT, 279 fn SetPostSnapshotFailureMsg( 280 wszFailureMsg: LPCWSTR, 281 ) -> HRESULT, 282 fn GetPrepareForBackupFailureMsg( 283 pbstrFailureMsg: *mut BSTR, 284 ) -> HRESULT, 285 fn GetPostSnapshotFailureMsg( 286 pbstrFailureMsg: *mut BSTR, 287 ) -> HRESULT, 288 fn GetAuthoritativeRestore( 289 pbAuth: *mut bool, 290 ) -> HRESULT, 291 fn GetRollForward( 292 pRollType: *mut VSS_ROLLFORWARD_TYPE, 293 pbstrPoint: *mut BSTR, 294 ) -> HRESULT, 295 fn GetRestoreName( 296 pbstrName: *mut BSTR, 297 ) -> HRESULT, 298 }} 299 RIDL!{#[uuid(0x3b5be0f2, 0x07a9, 0x4e4b, 0xbd, 0xd3, 0xcf, 0xdc, 0x8e, 0x2c, 0x0d, 0x2d)] 300 interface IVssComponentEx2(IVssComponentEx2Vtbl): IVssComponentEx(IVssComponentExVtbl) { 301 fn SetFailure( 302 hr: HRESULT, 303 hrApplication: HRESULT, 304 wszApplicationMessage: LPCWSTR, 305 dwReserved: DWORD, 306 ) -> HRESULT, 307 fn GetFailure( 308 phr: *mut HRESULT, 309 phrApplication: *mut HRESULT, 310 pbstrApplicationMessage: *mut BSTR, 311 pdwReserved: *mut DWORD, 312 ) -> HRESULT, 313 }} 314 RIDL!{#[uuid(0x00000000, 0x0000, 0x0000, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00)] 315 interface IVssCreateWriterMetadata(IVssCreateWriterMetadataVtbl) { 316 fn AddIncludeFiles( 317 wszPath: LPCWSTR, 318 wszFilespec: LPCWSTR, 319 bRecursive: bool, 320 wszAlternateLocation: LPCWSTR, 321 ) -> HRESULT, 322 fn AddExcludeFiles( 323 wszPath: LPCWSTR, 324 wszFilespec: LPCWSTR, 325 bRecursive: bool, 326 ) -> HRESULT, 327 fn AddComponent( 328 ct: VSS_COMPONENT_TYPE, 329 wszLogicalPath: LPCWSTR, 330 wszComponentName: LPCWSTR, 331 wszCaption: LPCWSTR, 332 pbIcon: *const BYTE, 333 cbIcon: UINT, 334 bRestoreMetadata: bool, 335 bNotifyOnBackupComplete: bool, 336 bSelectableForRestore: bool, 337 dwComponentFlags: DWORD, 338 ) -> HRESULT, 339 fn AddDatabaseFiles( 340 wszLogicalPath: LPCWSTR, 341 wszDatabaseName: LPCWSTR, 342 wszPath: LPCWSTR, 343 wszFilespec: LPCWSTR, 344 dwBackupTypeMask: DWORD, 345 ) -> HRESULT, 346 fn AddDatabaseLogFiles( 347 wszLogicalPath: LPCWSTR, 348 wszDatabaseName: LPCWSTR, 349 wszPath: LPCWSTR, 350 wszFilespec: LPCWSTR, 351 dwBackupTypeMask: DWORD, 352 ) -> HRESULT, 353 fn AddFilesToFileGroup( 354 wszLogicalPath: LPCWSTR, 355 wszGroupName: LPCWSTR, 356 wszPath: LPCWSTR, 357 wszFilespec: LPCWSTR, 358 bRecursive: bool, 359 wszAlternateLocation: LPCWSTR, 360 dwBackupTypeMask: DWORD, 361 ) -> HRESULT, 362 fn SetRestoreMethod( 363 method: VSS_RESTOREMETHOD_ENUM, 364 wszService: LPCWSTR, 365 wszUserProcedure: LPCWSTR, 366 writerRestore: VSS_WRITERRESTORE_ENUM, 367 bRebootRequired: bool, 368 ) -> HRESULT, 369 fn AddAlternateLocationMapping( 370 wszSourcePath: LPCWSTR, 371 wszSourceFilespec: LPCWSTR, 372 bRecursive: bool, 373 wszDestination: LPCWSTR, 374 ) -> HRESULT, 375 fn AddComponentDependency( 376 wszForLogicalPath: LPCWSTR, 377 wszForComponentName: LPCWSTR, 378 onWriterId: VSS_ID, 379 wszOnLogicalPath: LPCWSTR, 380 wszOnComponentName: LPCWSTR, 381 ) -> HRESULT, 382 fn SetBackupSchema( 383 dwSchemaMask: DWORD, 384 ) -> HRESULT, 385 fn GetDocument( 386 pDoc: *mut *mut VOID, 387 ) -> HRESULT, //TODO IXMLDOMDocument, 388 fn SaveAsXML( 389 pbstrXML: *mut BSTR, 390 ) -> HRESULT, 391 }} 392 //IVssCreateWriterMetadataEx 393 //IVssWriterImpl 394 //IVssCreateExpressWriterMetadata 395 //IVssExpressWriter 396 //CVssWriter 397 //CVssWriterEx 398 //CVssWriterEx2 399