acpi: avoid potential uninitialized access to cpu_hp_io_base
[qemu.git] / qga / vss-win32 / vss-common.h
blobce14e142903a4cbf8dbc7016e4391264d4094d5e
1 /*
2 * QEMU Guest Agent win32 VSS common declarations
4 * Copyright Hitachi Data Systems Corp. 2013
6 * Authors:
7 * Tomoki Sekiyama <tomoki.sekiyama@hds.com>
9 * This work is licensed under the terms of the GNU GPL, version 2 or later.
10 * See the COPYING file in the top-level directory.
13 #ifndef VSS_WIN32_H
14 #define VSS_WIN32_H
16 #define __MIDL_user_allocate_free_DEFINED__
17 #include "config-host.h"
18 #include <windows.h>
19 #include <shlwapi.h>
21 /* Reduce warnings to include vss.h */
23 /* Ignore annotations for MS IDE */
24 #define __in IN
25 #define __out OUT
26 #define __RPC_unique_pointer
27 #define __RPC_string
28 #define __RPC__deref_inout_opt
29 #define __RPC__out
30 #ifndef __RPC__out_ecount_part
31 #define __RPC__out_ecount_part(x, y)
32 #endif
33 #define _declspec(x)
34 #undef uuid
35 #define uuid(x)
37 /* Undef some duplicated error codes redefined in vss.h */
38 #undef VSS_E_BAD_STATE
39 #undef VSS_E_PROVIDER_NOT_REGISTERED
40 #undef VSS_E_PROVIDER_VETO
41 #undef VSS_E_OBJECT_NOT_FOUND
42 #undef VSS_E_VOLUME_NOT_SUPPORTED
43 #undef VSS_E_VOLUME_NOT_SUPPORTED_BY_PROVIDER
44 #undef VSS_E_OBJECT_ALREADY_EXISTS
45 #undef VSS_E_UNEXPECTED_PROVIDER_ERROR
46 #undef VSS_E_INVALID_XML_DOCUMENT
47 #undef VSS_E_MAXIMUM_NUMBER_OF_VOLUMES_REACHED
48 #undef VSS_E_MAXIMUM_NUMBER_OF_SNAPSHOTS_REACHED
51 * VSS headers must be installed from Microsoft VSS SDK 7.2 available at:
52 * http://www.microsoft.com/en-us/download/details.aspx?id=23490
54 #include "inc/win2003/vss.h"
56 /* Macros to convert char definitions to wchar */
57 #define _L(a) L##a
58 #define L(a) _L(a)
60 /* Constants for QGA VSS Provider */
62 #define QGA_PROVIDER_NAME "QEMU Guest Agent VSS Provider"
63 #define QGA_PROVIDER_LNAME L(QGA_PROVIDER_NAME)
64 #define QGA_PROVIDER_VERSION L(QEMU_VERSION)
66 #define EVENT_NAME_FROZEN "Global\\QGAVSSEvent-frozen"
67 #define EVENT_NAME_THAW "Global\\QGAVSSEvent-thaw"
68 #define EVENT_NAME_TIMEOUT "Global\\QGAVSSEvent-timeout"
70 const GUID g_gProviderId = { 0x3629d4ed, 0xee09, 0x4e0e,
71 {0x9a, 0x5c, 0x6d, 0x8b, 0xa2, 0x87, 0x2a, 0xef} };
72 const GUID g_gProviderVersion = { 0x11ef8b15, 0xcac6, 0x40d6,
73 {0x8d, 0x5c, 0x8f, 0xfc, 0x16, 0x3f, 0x24, 0xca} };
75 const CLSID CLSID_QGAVSSProvider = { 0x6e6a3492, 0x8d4d, 0x440c,
76 {0x96, 0x19, 0x5e, 0x5d, 0x0c, 0xc3, 0x1c, 0xa8} };
78 const TCHAR g_szClsid[] = TEXT("{6E6A3492-8D4D-440C-9619-5E5D0CC31CA8}");
79 const TCHAR g_szProgid[] = TEXT("QGAVSSProvider");
81 /* Enums undefined in VSS SDK 7.2 but defined in newer Windows SDK */
82 enum __VSS_VOLUME_SNAPSHOT_ATTRIBUTES {
83 VSS_VOLSNAP_ATTR_NO_AUTORECOVERY = 0x00000002,
84 VSS_VOLSNAP_ATTR_TXF_RECOVERY = 0x02000000
88 /* COM pointer utility; call ->Release() when it goes out of scope */
89 template <class T>
90 class COMPointer {
91 COMPointer(const COMPointer<T> &p) { } /* no copy */
92 T *p;
93 public:
94 COMPointer &operator=(T *new_p)
96 /* Assignment of a new T* (or NULL) causes release of previous p */
97 if (p && p != new_p) {
98 p->Release();
100 p = new_p;
101 return *this;
103 /* Replace by assignment to the pointer of p */
104 T **replace(void)
106 *this = NULL;
107 return &p;
109 /* Make COMPointer be used like T* */
110 operator T*() { return p; }
111 T *operator->(void) { return p; }
112 T &operator*(void) { return *p; }
113 operator bool() { return !!p; }
115 COMPointer(T *p = NULL) : p(p) { }
116 ~COMPointer() { *this = NULL; } /* Automatic release */
120 * COM initializer; this should declared before COMPointer to uninitialize COM
121 * after releasing COM objects.
123 class COMInitializer {
124 public:
125 COMInitializer() { CoInitialize(NULL); }
126 ~COMInitializer() { CoUninitialize(); }
129 #endif