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