qga-pull-2023-03-08
-----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmQI6V0ACgkQ711egWG6 hOegDBAAk9S6bszwuvPUIupNofujYkFKrrgHiujTOmPVXvD52C8FhojKTlW3d1QT f50vkMkMgavewPzsJU0SAu9kX80uOprDZwUYZ/3awSRPgL1zfFnZSZj5C/Pk4tD2 9rD8YjVPgvRpIhqZGTaAr97NFpigslMdba8SaucHPA1FmwRUzs1lWCX2hK9ewWuD /3/6Dy9mVoFGdEru2kNO5uZFUVsfatZMUQS8oOdgwHtYRkVwV7olPglQZ/iqACor yegxAt5tUL3WJIiYAVntiGSos0QnD7AgrGnSM5398uA4/oMVdehpAf5TyUOJ0QEy aq51TGZQ6Vc/0sYrsO65zaNXNsgNx1jAl7BcBleawyrdM8q/ILStXelk3MFR7Dbz dNi5NNHK4acEStk5XJZHc+bPQybjeWGCsQY9NBO5zLmZO2gCWnjN/nWxT6ivAgzF JlYfiiuLku/sZBGun7giHsKQ0EFeMzi+DdKsX3AoJhA+RJ/XEa88MTIh4EIK/tsj BwoPtrngsHvkazwgpb1Fa204kTAhmjx+2bpyEiNAxcRTgShxXIsm09xGOi5w8z3Q 48kLmkPL/xwKLImh1hx4z612VhCwdhMaLgKmri5i99jWoKJqwpnUf04JtEvyYM0d ErlBQsz1GOjVZTm9yCtqZwjZeM5kK83lRu7fUxmtTTA3G1H/EAM= =wWvd -----END PGP SIGNATURE----- Merge tag 'qga-pull-2023-03-08' of github.com:kostyanf14/qemu into staging qga-pull-2023-03-08 # -----BEGIN PGP SIGNATURE----- # # iQIzBAABCgAdFiEEwsLBCepDxjwUI+uE711egWG6hOcFAmQI6V0ACgkQ711egWG6 # hOegDBAAk9S6bszwuvPUIupNofujYkFKrrgHiujTOmPVXvD52C8FhojKTlW3d1QT # f50vkMkMgavewPzsJU0SAu9kX80uOprDZwUYZ/3awSRPgL1zfFnZSZj5C/Pk4tD2 # 9rD8YjVPgvRpIhqZGTaAr97NFpigslMdba8SaucHPA1FmwRUzs1lWCX2hK9ewWuD # /3/6Dy9mVoFGdEru2kNO5uZFUVsfatZMUQS8oOdgwHtYRkVwV7olPglQZ/iqACor # yegxAt5tUL3WJIiYAVntiGSos0QnD7AgrGnSM5398uA4/oMVdehpAf5TyUOJ0QEy # aq51TGZQ6Vc/0sYrsO65zaNXNsgNx1jAl7BcBleawyrdM8q/ILStXelk3MFR7Dbz # dNi5NNHK4acEStk5XJZHc+bPQybjeWGCsQY9NBO5zLmZO2gCWnjN/nWxT6ivAgzF # JlYfiiuLku/sZBGun7giHsKQ0EFeMzi+DdKsX3AoJhA+RJ/XEa88MTIh4EIK/tsj # BwoPtrngsHvkazwgpb1Fa204kTAhmjx+2bpyEiNAxcRTgShxXIsm09xGOi5w8z3Q # 48kLmkPL/xwKLImh1hx4z612VhCwdhMaLgKmri5i99jWoKJqwpnUf04JtEvyYM0d # ErlBQsz1GOjVZTm9yCtqZwjZeM5kK83lRu7fUxmtTTA3G1H/EAM= # =wWvd # -----END PGP SIGNATURE----- # gpg: Signature made Wed 08 Mar 2023 20:00:29 GMT # gpg: using RSA key C2C2C109EA43C63C1423EB84EF5D5E8161BA84E7 # gpg: Good signature from "Kostiantyn Kostiuk (Upstream PR sign) <kkostiuk@redhat.com>" [unknown] # gpg: WARNING: This key is not certified with a trusted signature! # gpg: There is no indication that the signature belongs to the owner. # Primary key fingerprint: C2C2 C109 EA43 C63C 1423 EB84 EF5D 5E81 61BA 84E7 * tag 'qga-pull-2023-03-08' of github.com:kostyanf14/qemu: qga/win/vss: requester_freeze changes qga/win/vss: query VSS backup type qga/win/installer: add VssOption to installer qga/win32: Use rundll for VSS installation qga/win32: Remove change action from MSI installer Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
7dfce9bd0f
@ -31,6 +31,7 @@
|
||||
/>
|
||||
<Media Id="1" Cabinet="qemu_ga.$(var.QEMU_GA_VERSION).cab" EmbedCab="yes" />
|
||||
<Property Id="WHSLogo">1</Property>
|
||||
<Property Id="ARPNOMODIFY" Value="yes" Secure="yes" />
|
||||
<MajorUpgrade
|
||||
DowngradeErrorMessage="Error: A newer version of QEMU guest agent is already installed."
|
||||
/>
|
||||
@ -121,27 +122,31 @@
|
||||
<RegistryValue Type="integer" Name="TypesSupported" Value="7" />
|
||||
<RegistryValue Type="string" Name="EventMessageFile" Value="[qemu_ga_directory]qemu-ga.exe" />
|
||||
</RegistryKey>
|
||||
<RegistryKey Root="HKLM"
|
||||
Key="System\CurrentControlSet\Services\QEMU Guest Agent VSS Provider">
|
||||
<RegistryValue Type="integer" Name="VssOption" Value="1" />
|
||||
</RegistryKey>
|
||||
</Component>
|
||||
</Directory>
|
||||
</Directory>
|
||||
</Directory>
|
||||
|
||||
<Property Id="cmd" Value="cmd.exe"/>
|
||||
<Property Id="rundll" Value="rundll32.exe"/>
|
||||
<Property Id="REINSTALLMODE" Value="amus"/>
|
||||
|
||||
<?ifdef var.InstallVss?>
|
||||
<CustomAction Id="RegisterCom"
|
||||
ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-install'
|
||||
ExeCommand='"[qemu_ga_directory]qga-vss.dll",DLLCOMRegister'
|
||||
Execute="deferred"
|
||||
Property="cmd"
|
||||
Property="rundll"
|
||||
Impersonate="no"
|
||||
Return="check"
|
||||
>
|
||||
</CustomAction>
|
||||
<CustomAction Id="UnRegisterCom"
|
||||
ExeCommand='/c "[qemu_ga_directory]qemu-ga.exe" -s vss-uninstall'
|
||||
ExeCommand='"[qemu_ga_directory]qga-vss.dll",DLLCOMUnregister'
|
||||
Execute="deferred"
|
||||
Property="cmd"
|
||||
Property="rundll"
|
||||
Impersonate="no"
|
||||
Return="check"
|
||||
>
|
||||
|
@ -357,6 +357,15 @@ out:
|
||||
return hr;
|
||||
}
|
||||
|
||||
STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
COMRegister();
|
||||
}
|
||||
|
||||
STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int)
|
||||
{
|
||||
COMUnregister();
|
||||
}
|
||||
|
||||
static BOOL CreateRegistryKey(LPCTSTR key, LPCTSTR value, LPCTSTR data)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
LIBRARY "QGA-PROVIDER.DLL"
|
||||
|
||||
EXPORTS
|
||||
DLLCOMRegister
|
||||
DLLCOMUnregister
|
||||
COMRegister PRIVATE
|
||||
COMUnregister PRIVATE
|
||||
DllCanUnloadNow PRIVATE
|
||||
|
@ -23,6 +23,8 @@
|
||||
/* Call QueryStatus every 10 ms while waiting for frozen event */
|
||||
#define VSS_TIMEOUT_EVENT_MSEC 10
|
||||
|
||||
#define DEFAULT_VSS_BACKUP_TYPE VSS_BT_FULL
|
||||
|
||||
#define err_set(e, err, fmt, ...) \
|
||||
((e)->error_setg_win32_wrapper((e)->errp, __FILE__, __LINE__, __func__, \
|
||||
err, fmt, ## __VA_ARGS__))
|
||||
@ -234,6 +236,42 @@ out:
|
||||
}
|
||||
}
|
||||
|
||||
DWORD get_reg_dword_value(HKEY baseKey, LPCSTR subKey, LPCSTR valueName,
|
||||
DWORD defaultData)
|
||||
{
|
||||
DWORD regGetValueError;
|
||||
DWORD dwordData;
|
||||
DWORD dataSize = sizeof(DWORD);
|
||||
|
||||
regGetValueError = RegGetValue(baseKey, subKey, valueName, RRF_RT_DWORD,
|
||||
NULL, &dwordData, &dataSize);
|
||||
if (regGetValueError != ERROR_SUCCESS) {
|
||||
return defaultData;
|
||||
}
|
||||
return dwordData;
|
||||
}
|
||||
|
||||
bool is_valid_vss_backup_type(VSS_BACKUP_TYPE vssBT)
|
||||
{
|
||||
return (vssBT > VSS_BT_UNDEFINED && vssBT < VSS_BT_OTHER);
|
||||
}
|
||||
|
||||
VSS_BACKUP_TYPE get_vss_backup_type(
|
||||
VSS_BACKUP_TYPE defaultVssBT = DEFAULT_VSS_BACKUP_TYPE)
|
||||
{
|
||||
VSS_BACKUP_TYPE vssBackupType;
|
||||
|
||||
vssBackupType = static_cast<VSS_BACKUP_TYPE>(
|
||||
get_reg_dword_value(HKEY_LOCAL_MACHINE,
|
||||
QGA_PROVIDER_REGISTRY_ADDRESS,
|
||||
"VssOption",
|
||||
defaultVssBT));
|
||||
if (!is_valid_vss_backup_type(vssBackupType)) {
|
||||
return defaultVssBT;
|
||||
}
|
||||
return vssBackupType;
|
||||
}
|
||||
|
||||
void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
{
|
||||
COMPointer<IVssAsync> pAsync;
|
||||
@ -247,6 +285,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
DWORD wait_status;
|
||||
int num_fixed_drives = 0, i;
|
||||
int num_mount_points = 0;
|
||||
VSS_BACKUP_TYPE vss_bt = get_vss_backup_type();
|
||||
|
||||
if (vss_ctx.pVssbc) { /* already frozen */
|
||||
*num_vols = 0;
|
||||
@ -294,7 +333,7 @@ void requester_freeze(int *num_vols, void *mountpoints, ErrorSet *errset)
|
||||
goto out;
|
||||
}
|
||||
|
||||
hr = vss_ctx.pVssbc->SetBackupState(true, true, VSS_BT_FULL, false);
|
||||
hr = vss_ctx.pVssbc->SetBackupState(true, true, vss_bt, false);
|
||||
if (FAILED(hr)) {
|
||||
err_set(errset, hr, "failed to set backup state");
|
||||
goto out;
|
||||
|
@ -6,6 +6,9 @@
|
||||
#define QGA_PROVIDER_NAME "QEMU Guest Agent VSS Provider"
|
||||
#define QGA_PROVIDER_LNAME L(QGA_PROVIDER_NAME)
|
||||
#define QGA_PROVIDER_VERSION L(QEMU_VERSION)
|
||||
#define QGA_PROVIDER_REGISTRY_ADDRESS "SYSTEM\\CurrentControlSet"\
|
||||
"\\Services"\
|
||||
"\\" QGA_PROVIDER_NAME
|
||||
|
||||
#define EVENT_NAME_FROZEN "Global\\QGAVSSEvent-frozen"
|
||||
#define EVENT_NAME_THAW "Global\\QGAVSSEvent-thaw"
|
||||
|
Loading…
Reference in New Issue
Block a user