// Licensed under the Apache License, Version 2.0
// <LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0 > or the MIT license
// <LICENSE-MIT or http://opensource.org/licenses/MIT >, at your option.
// All files in the project carrying such notice may not be copied, modified, or distributed
// except according to those terms.
//! Declaration of backup interfaces.
use ctypes::c_void;
use shared::guiddef::IID;
use shared::minwindef::{BOOL, BYTE, DWORD, UINT};
use shared::wtypes::BSTR;
use um::unknwnbase::{IUnknown, IUnknownVtbl};
use um::vss::{
IVssAsync, IVssEnumObject, VSS_BACKUP_TYPE, VSS_ID, VSS_OBJECT_TYPE, VSS_PWSZ,
VSS_RESTORE_TYPE, VSS_ROLLFORWARD_TYPE, VSS_SNAPSHOT_PROP, VSS_WRITER_STATE
};
use um::vswriter::{
IVssWMDependency, IVssWMFiledesc, IVssWriterComponentsVtbl, VSS_COMPONENT_TYPE,
VSS_FILE_RESTORE_STATUS, VSS_RESTOREMETHOD_ENUM, VSS_SOURCE_TYPE, VSS_USAGE_TYPE,
VSS_WRITERRESTORE_ENUM
};
use um::winnt::{HRESULT, LONG, LPCWSTR};
DEFINE_GUID!{IID_IVssExamineWriterMetadata,
0 x902fcf7f,
0 xb7fd,
0 x42f8,
0 x81,
0 xf1,
0 xb2,
0 xe4,
0 x00,
0 xb1,
0 xe5,
0 xbd}
DEFINE_GUID!{IID_IVssExamineWriterMetadataEx,
0 x0c0e5ec0,
0 xca44,
0 x472b,
0 xb7,
0 x02,
0 xe6,
0 x52,
0 xdb,
0 x1c,
0 x04,
0 x51}
DEFINE_GUID!{IID_IVssBackupComponents,
0 x665c1d5f,
0 xc218,
0 x414d,
0 xa0,
0 x5d,
0 x7f,
0 xef,
0 x5f,
0 x9d,
0 x5c,
0 x86}
DEFINE_GUID!{IID_IVssBackupComponentsEx,
0 x963f03ad,
0 x9e4c,
0 x4a34,
0 xac,
0 x15,
0 xe4,
0 xb6,
0 x17,
0 x4e,
0 x50,
0 x36}
STRUCT !{
struct VSS_COMPONENTINFO {
type_: VSS_COMPONENT_TYPE,
// type is a keyword in rust
bstrLogicalPath: BSTR,
bstrComponentName: BSTR,
bstrCaption: BSTR,
pbIcon: *
mut BYTE,
cbIcon: UINT,
bRestoreMetadata: bool,
bNotifyOnBackupComplete: bool,
bSelectable: bool,
bSelectableForRestore: bool,
dwComponentFlags: DWORD,
cFileCount: UINT,
cDatabases: UINT,
cLogFiles: UINT,
cDependencies: UINT,
}}
pub type PVSSCOMPONENTINFO = *
const VSS_COMPONENTINFO;
RIDL!{
#[ uuid(
0 x00000000,
0 x0000,
0 x0000,
0 x00,
0 x00,
0 x00,
0 x00,
0 x00,
0 x00,
0 x00,
0 x00)]
interface IVssWMComponent(IVssWMComponentVtbl): IUnknown(IUnknownVtbl) {
fn GetComponentInfo(
ppInfo: *
mut PVSSCOMPONENTINFO,
) -> HRESULT,
fn FreeComponentInfo(
pInfo: PVSSCOMPONENTINFO,
) -> HRESULT,
fn GetFile(
iFile: UINT,
ppFiledesc: *
mut *
mut IVssWMFiledesc,
) -> HRESULT,
fn GetDatabaseFile(
iDBFile: UINT,
ppFiledesc: *
mut *
mut IVssWMFiledesc,
) -> HRESULT,
fn GetDatabaseLogFile(
iDbLogFile: UINT,
ppFiledesc: *
mut *
mut IVssWMFiledesc,
) -> HRESULT,
fn GetDependency(
iDependency: UINT,
ppDependency: *
mut *
mut IVssWMDependency,
) -> HRESULT,
}}
RIDL!{
#[ uuid(
0 x902fcf7f,
0 xb7fd,
0 x42f8,
0 x81,
0 xf1,
0 xb2,
0 xe4,
0 x00,
0 xb1,
0 xe5,
0 xbd)]
interface IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl): IUnknown(IUnkn
ownVtbl) {
fn GetIdentity(
pidInstance: *mut VSS_ID,
pidWriter: *mut VSS_ID,
pbstrWriterName: *mut BSTR,
pUsage: *mut VSS_USAGE_TYPE,
pSource: *mut VSS_SOURCE_TYPE,
) -> HRESULT,
fn GetFileCounts(
pcIncludeFiles: *mut UINT,
pcExcludeFiles: *mut UINT,
pcComponents: *mut UINT,
) -> HRESULT,
fn GetIncludeFile(
iFile: UINT,
ppFiledesc: *mut *mut IVssWMFiledesc,
) -> HRESULT,
fn GetExcludeFile(
iFile: UINT,
ppFiledesc: *mut *mut IVssWMFiledesc,
) -> HRESULT,
fn GetComponent(
iComponent: UINT,
ppComponent: *mut *mut IVssWMComponent,
) -> HRESULT,
fn GetRestoreMethod(
pMethod: *mut VSS_RESTOREMETHOD_ENUM,
pbstrService: *mut BSTR,
pbstrUserProcedure: *mut BSTR,
pwriterRestore: *mut VSS_WRITERRESTORE_ENUM,
pbRebootRequired: *mut bool,
pcMappings: *mut UINT,
) -> HRESULT,
fn GetAlternateLocationMapping(
iMapping: UINT,
ppFiledesc: *mut *mut IVssWMFiledesc,
) -> HRESULT,
fn GetBackupSchema(
pdwSchemaMask: *mut DWORD,
) -> HRESULT,
fn GetDocument(
pDoc: *mut c_void,
) -> HRESULT, //TODO IXMLDOMDocument,
fn SaveAsXML(
pbstrXML: *mut BSTR,
) -> HRESULT,
fn LoadFromXML(
pbstrXML: *mut BSTR,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x0c0e5ec0, 0 xca44, 0 x472b, 0 xb7, 0 x02, 0 xe6, 0 x52, 0 xdb, 0 x1c, 0 x04, 0 x51)]
interface IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl):
IVssExamineWriterMetadata(IVssExamineWriterMetadataVtbl) {
fn GetIdentityEx(
pidInstance: *mut VSS_ID,
pidWriter: *mut VSS_ID,
pbstrWriterName: *mut BSTR,
pbstrInstanceName: *mut BSTR,
pUsage: *mut VSS_USAGE_TYPE,
pSource: *mut VSS_SOURCE_TYPE,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xce115780, 0 xa611, 0 x431b, 0 xb5, 0 x7f, 0 xc3, 0 x83, 0 x03, 0 xab, 0 x6a, 0 xee)]
interface IVssExamineWriterMetadataEx2(IVssExamineWriterMetadataEx2Vtbl):
IVssExamineWriterMetadataEx(IVssExamineWriterMetadataExVtbl) {
fn GetVersion(
pdwMajorVersion: *mut DWORD,
pdwMinorVersion: *mut DWORD,
) -> HRESULT,
fn GetExcludeFromSnapshotCount(
pcExcludedFromSnapshot: *mut UINT,
) -> HRESULT,
fn GetExcludeFromSnapshotFile(
iFile: UINT,
ppFiledesc: *mut *mut IVssWMFiledesc,
) -> HRESULT,
}}
#[ repr(C)]
pub struct IVssWriterComponentsExt {
pub lpVtbl: *const IVssWriterComponentsExtVtbl,
}
#[ repr(C)]
pub struct IVssWriterComponentsExtVtbl {
pub parent1: IVssWriterComponentsVtbl,
pub parent2: IUnknownVtbl,
}
RIDL!{#[ uuid(0 x665c1d5f, 0 xc218, 0 x414d, 0 xa0, 0 x5d, 0 x7f, 0 xef, 0 x5f, 0 x9d, 0 x5c, 0 x86)]
interface IVssBackupComponents(IVssBackupComponentsVtbl): IUnknown(IUnknownVtbl) {
fn GetWriterComponentsCount(
pcComponents: *mut UINT,
) -> HRESULT,
fn GetWriterComponents(
iWriter: UINT,
ppWriter: *mut *mut IVssWriterComponentsExt,
) -> HRESULT,
fn InitializeForBackup(
bstrXML: BSTR,
) -> HRESULT,
fn SetBackupState(
bSelectComponents: bool,
bBackupBootableSystemState: bool,
backupType: VSS_BACKUP_TYPE,
bPartialFileSupport: bool,
) -> HRESULT,
fn InitializeForRestore(
bstrXML: BSTR,
) -> HRESULT,
fn SetRestoreState(
restoreType: VSS_RESTORE_TYPE,
) -> HRESULT,
fn GatherWriterMetadata(
pAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn GetWriterMetadataCount(
pcWriters: *mut UINT,
) -> HRESULT,
fn GetWriterMetadata(
iWriter: UINT,
pidInstance: *mut VSS_ID,
ppMetadata: *mut *mut IVssExamineWriterMetadata,
) -> HRESULT,
fn FreeWriterMetadata() -> HRESULT,
fn AddComponent(
instanceId: VSS_ID,
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
) -> HRESULT,
fn PrepareForBackup(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn AbortBackup() -> HRESULT,
fn GatherWriterStatus(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn GetWriterStatusCount(
pcWriters: *mut UINT,
) -> HRESULT,
fn FreeWriterStatus() -> HRESULT,
fn GetWriterStatus(
iWriter: UINT,
pidInstance: *mut VSS_ID,
pidWriter: *mut VSS_ID,
pbstrWriter: *mut BSTR,
pnStatus: *mut VSS_WRITER_STATE,
phResultFailure: *mut HRESULT,
) -> HRESULT,
fn SetBackupSucceeded(
instanceId: VSS_ID,
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
bSucceded: bool,
) -> HRESULT,
fn SetBackupOptions(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszBackupOptions: LPCWSTR,
) -> HRESULT,
fn SetSelectedForRestore(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
bSelectedForRestore: bool,
) -> HRESULT,
fn SetRestoreOptions(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszRestoreOptions: LPCWSTR,
) -> HRESULT,
fn SetAdditionalRestores(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
bAdditionalRestores: bool,
) -> HRESULT,
fn SetPreviousBackupStamp(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszPreviousBackupStamp: LPCWSTR,
) -> HRESULT,
fn SaveAsXML(
pbstrXML: *mut BSTR,
) -> HRESULT,
fn BackupComplete(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn AddAlternativeLocationMapping(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszPath: LPCWSTR,
wszFilespec: LPCWSTR,
bRecursive: bool,
wszDestination: LPCWSTR,
) -> HRESULT,
fn AddRestoreSubcomponent(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszSubComponentLogicalPath: LPCWSTR,
wszSubComponentName: LPCWSTR,
bRepair: bool,
) -> HRESULT,
fn SetFileRestoreStatus(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
status: VSS_FILE_RESTORE_STATUS,
) -> HRESULT,
fn AddNewTarget(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszPath: LPCWSTR,
wszFileName: LPCWSTR,
bRecursive: bool,
wszAlternatePath: LPCWSTR,
) -> HRESULT,
fn SetRangesFilePath(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
iPartialFile: UINT,
wszRangesFile: LPCWSTR,
) -> HRESULT,
fn PreRestore(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn PostRestore(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn SetContext(
lContext: LONG,
) -> HRESULT,
fn StartSnapshotSet(
pSnapshotSetId: *mut VSS_ID,
) -> HRESULT,
fn AddToSnapshotSet(
pwszVolumeName: VSS_PWSZ,
ProviderId: VSS_ID,
pidSnapshot: *mut VSS_ID,
) -> HRESULT,
fn DoSnapshotSet(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn DeleteSnapshots(
SourceObjectId: VSS_ID,
eSourceObjectType: VSS_OBJECT_TYPE,
bForceDelete: BOOL,
plDeletedSnapshots: *mut LONG,
pNondeletedSnapshotID: *mut VSS_ID,
) -> HRESULT,
fn ImportSnapshots(
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn BreakSnapshotSet(
SnapshotSetId: VSS_ID,
) -> HRESULT,
fn GetSnapshotProperties(
SnapshotId: VSS_ID,
pProp: *mut VSS_SNAPSHOT_PROP,
) -> HRESULT,
fn Query(
QueriedObjectId: VSS_ID,
eQueriedObjectType: VSS_OBJECT_TYPE,
eReturnedObjectsType: VSS_OBJECT_TYPE,
ppEnum: *mut *mut IVssEnumObject,
) -> HRESULT,
fn IsVolumeSupported(
ProviderId: VSS_ID,
pwszVolumeName: VSS_PWSZ,
pbSupportedByThisProvider: *mut BOOL,
) -> HRESULT,
fn DisableWriterClasses(
rgWriterClassId: *const VSS_ID,
cClassId: UINT,
) -> HRESULT,
fn EnableWriterClasses(
rgWriterClassId: *const VSS_ID,
cClassId: UINT,
) -> HRESULT,
fn DisableWriterInstances(
rgWriterInstanceId: *const VSS_ID,
cInstanceId: UINT,
) -> HRESULT,
fn ExposeSnapshot(
SnapshotId: VSS_ID,
wszPathFromRoot: VSS_PWSZ,
lAttributes: LONG,
wszExpose: VSS_PWSZ,
pwszExposed: VSS_PWSZ,
) -> HRESULT,
fn RevertToSnapshot(
SnapshotId: VSS_ID,
bForceDismount: BOOL,
) -> HRESULT,
fn QueryRevertStatus(
pwszVolume: VSS_PWSZ,
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 x963f03ad, 0 x9e4c, 0 x4a34, 0 xac, 0 x15, 0 xe4, 0 xb6, 0 x17, 0 x4e, 0 x50, 0 x36)]
interface IVssBackupComponentsEx(IVssBackupComponentsExVtbl):
IVssBackupComponents(IVssBackupComponentsVtbl) {
fn GetWriterMetadataEx(
iWriter: UINT,
pidInstance: *mut VSS_ID,
ppMetadata: *mut *mut IVssExamineWriterMetadataEx,
) -> HRESULT,
fn SetSelectedForRestoreEx(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
bSelectedForRestore: bool,
instanceId: VSS_ID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xacfe2b3a, 0 x22c9, 0 x4ef8, 0 xbd, 0 x03, 0 x2f, 0 x9c, 0 xa2, 0 x30, 0 x08, 0 x4e)]
interface IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl):
IVssBackupComponentsEx(IVssBackupComponentsExVtbl) {
fn UnexposeSnapshot(
snapshotId: VSS_ID,
) -> HRESULT,
fn SetAuthoritativeRestore(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
bAuth: bool,
) -> HRESULT,
fn SetRollForward(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
rollType: VSS_ROLLFORWARD_TYPE,
wszRollForwardPoint: LPCWSTR,
) -> HRESULT,
fn SetRestoreName(
writerId: VSS_ID,
ct: VSS_COMPONENT_TYPE,
wszLogicalPath: LPCWSTR,
wszComponentName: LPCWSTR,
wszRestoreName: LPCWSTR,
) -> HRESULT,
fn BreakSnapshotSetEx(
SnapshotSetID: VSS_ID,
dwBreakFlags: DWORD,
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn PreFastRecovery(
SnapshotSetID: VSS_ID,
dwPreFastRecoveryFlags: DWORD,
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn FastRecovery(
SnapshotSetID: VSS_ID,
dwFastRecoveryFlags: DWORD,
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xc191bfbc, 0 xb602, 0 x4675, 0 x8b, 0 xd1, 0 x67, 0 xd6, 0 x42, 0 xf5, 0 x29, 0 xd5)]
interface IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl):
IVssBackupComponentsEx2(IVssBackupComponentsEx2Vtbl) {
fn GetWriterStatusEx(
iWriter: UINT,
pidInstance: *mut VSS_ID,
pidWriter: *mut VSS_ID,
pbstrWriter: *mut BSTR,
pnStatus: *mut VSS_WRITER_STATE,
phrFailureWriter: *mut HRESULT,
phrApplication: *mut HRESULT,
pbstrApplicationMessage: *mut BSTR,
) -> HRESULT,
fn AddSnapshotToRecoverySet(
snapshotId: VSS_ID,
dwFlags: DWORD,
pwszDestinationVolume: VSS_PWSZ,
) -> HRESULT,
fn RecoverSet(
dwFlags: DWORD,
ppAsync: *mut *mut IVssAsync,
) -> HRESULT,
fn GetSessionId(
idSession: *mut VSS_ID,
) -> HRESULT,
}}
RIDL!{#[ uuid(0 xf434c2fd, 0 xb553, 0 x4961, 0 xa9, 0 xf9, 0 xa8, 0 xe9, 0 x0b, 0 x67, 0 x3e, 0 x53)]
interface IVssBackupComponentsEx4(IVssBackupComponentsEx4Vtbl):
IVssBackupComponentsEx3(IVssBackupComponentsEx3Vtbl) {
fn GetRootAndLogicalPrefixPaths(
pwszFilePath: VSS_PWSZ,
ppwszRootPath: *mut VSS_PWSZ,
ppwszLogicalPrefix: *mut VSS_PWSZ,
bNormalizeFQDNforRootPath: BOOL,
) -> HRESULT,
}}
pub const VSS_SW_BOOTABLE_STATE: DWORD = 1 ;
extern "system" {
#[ link_name="CreateVssBackupComponentsInternal" ]
pub fn CreateVssBackupComponents(
ppBackup: *mut *mut IVssBackupComponents,
) -> HRESULT;
#[ link_name="CreateVssExamineWriterMetadataInternal" ]
pub fn CreateVssExamineWriterMetadata(
bstrXML: BSTR,
ppMetadata: *mut *mut IVssExamineWriterMetadata,
) -> HRESULT;
#[ link_name="IsVolumeSnapshottedInternal" ]
pub fn IsVolumeSnapshotted(
pwszVolumeName: VSS_PWSZ,
pbSnapshotsPresent: *mut BOOL,
plSnapshotCapability: *mut LONG,
) -> HRESULT;
#[ link_name="VssFreeSnapshotPropertiesInternal" ]
pub fn VssFreeSnapshotProperties(
pProp: *mut VSS_SNAPSHOT_PROP,
);
#[ link_name="GetProviderMgmtInterfaceInternal" ]
pub fn GetProviderMgmtInterface(
ProviderId: VSS_ID,
InterfaceId: IID,
ppItf: *mut *mut IUnknown,
) -> HRESULT;
#[ link_name="ShouldBlockRevertInternal" ]
pub fn ShouldBlockRevert(
wszVolumeName: LPCWSTR,
pbBlock: *mut bool,
) -> HRESULT;
}
Messung V0.5 in Prozent C=98 H=100 G=98
¤ Dauer der Verarbeitung: 0.12 Sekunden
(vorverarbeitet am 2026-06-18)
¤
*© Formatika GbR, Deutschland