]> wimlib.net Git - wimlib/blob - include/wimlib/win32_vss.h
Add randomized testing program
[wimlib] / include / wimlib / win32_vss.h
1 /*
2  * win32_vss.h - Declarations for managing VSS snapshots.  This header should
3  * only be included by Windows-specific files.
4  */
5
6 #ifndef _WIMLIB_WIN32_VSS_H
7 #define _WIMLIB_WIN32_VSS_H
8
9 #include "wimlib/win32_common.h"
10
11 /* A reference counter for a VSS snapshot.  This is embedded in another data
12  * structure only visible to win32_vss.c.  */
13 struct vss_snapshot {
14         size_t refcnt;
15 };
16
17 extern void
18 vss_delete_snapshot(struct vss_snapshot *snapshot);
19
20 /* Acquire a reference to the specified VSS snapshot.  */
21 static inline struct vss_snapshot *
22 vss_get_snapshot(struct vss_snapshot *snapshot)
23 {
24         if (snapshot)
25                 snapshot->refcnt++;
26         return snapshot;
27 }
28
29 /* Release a reference to the specified VSS snapshot.  When the last reference
30  * is released, the snapshot is deleted.  */
31 static inline void
32 vss_put_snapshot(struct vss_snapshot *snapshot)
33 {
34         if (snapshot && --snapshot->refcnt == 0)
35                 vss_delete_snapshot(snapshot);
36 }
37
38 extern int
39 vss_create_snapshot(const wchar_t *source, UNICODE_STRING *vss_path_ret,
40                     struct vss_snapshot **snapshot_ret);
41
42 extern void
43 vss_global_cleanup(void);
44
45 #endif /* _WIMLIB_WIN32_VSS_H */