qga/vss-win32: check old VSS SDK headers

The VssCoordinator & VssAdmin interfaces have been moved to vsadmin.h in
the Windows SDK.

Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Message-Id: <20220222194008.610377-3-marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Marc-André Lureau 2022-02-22 23:40:02 +04:00 committed by Paolo Bonzini
parent 32478cb6ed
commit 872b69e690
4 changed files with 13 additions and 1 deletions

View File

@ -1954,12 +1954,15 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.compiles(gnu_source_prefix + '''
}''')) }'''))
have_vss = false have_vss = false
have_vss_sdk = false # old xp/2003 SDK
if targetos == 'windows' and link_language == 'cpp' if targetos == 'windows' and link_language == 'cpp'
have_vss = cxx.compiles(''' have_vss = cxx.compiles('''
#define __MIDL_user_allocate_free_DEFINED__ #define __MIDL_user_allocate_free_DEFINED__
#include <vss.h> #include <vss.h>
int main(void) { return VSS_CTX_BACKUP; }''') int main(void) { return VSS_CTX_BACKUP; }''')
have_vss_sdk = cxx.has_header('vscoordint.h')
endif endif
config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
have_ntddscsi = false have_ntddscsi = false
if targetos == 'windows' if targetos == 'windows'

View File

@ -13,7 +13,11 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "vss-common.h" #include "vss-common.h"
#ifdef HAVE_VSS_SDK
#include <vscoordint.h> #include <vscoordint.h>
#else
#include <vsadmin.h>
#endif
#include "install.h" #include "install.h"
#include <wbemidl.h> #include <wbemidl.h>
#include <comdef.h> #include <comdef.h>

View File

@ -12,7 +12,11 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "vss-common.h" #include "vss-common.h"
#ifdef HAVE_VSS_SDK
#include <vscoordint.h> #include <vscoordint.h>
#else
#include <vsadmin.h>
#endif
#include <vsprov.h> #include <vsprov.h>
#define VSS_TIMEOUT_MSEC (60*1000) #define VSS_TIMEOUT_MSEC (60*1000)

View File

@ -64,12 +64,13 @@ const CLSID CLSID_QGAVSSProvider = { 0x6e6a3492, 0x8d4d, 0x440c,
const TCHAR g_szClsid[] = TEXT("{6E6A3492-8D4D-440C-9619-5E5D0CC31CA8}"); const TCHAR g_szClsid[] = TEXT("{6E6A3492-8D4D-440C-9619-5E5D0CC31CA8}");
const TCHAR g_szProgid[] = TEXT("QGAVSSProvider"); const TCHAR g_szProgid[] = TEXT("QGAVSSProvider");
#ifdef HAVE_VSS_SDK
/* Enums undefined in VSS SDK 7.2 but defined in newer Windows SDK */ /* Enums undefined in VSS SDK 7.2 but defined in newer Windows SDK */
enum __VSS_VOLUME_SNAPSHOT_ATTRIBUTES { enum __VSS_VOLUME_SNAPSHOT_ATTRIBUTES {
VSS_VOLSNAP_ATTR_NO_AUTORECOVERY = 0x00000002, VSS_VOLSNAP_ATTR_NO_AUTORECOVERY = 0x00000002,
VSS_VOLSNAP_ATTR_TXF_RECOVERY = 0x02000000 VSS_VOLSNAP_ATTR_TXF_RECOVERY = 0x02000000
}; };
#endif
/* COM pointer utility; call ->Release() when it goes out of scope */ /* COM pointer utility; call ->Release() when it goes out of scope */
template <class T> template <class T>