Commit 839bc113fb for qemu.org

commit 839bc113fb5e2aea3fd0d68a929725f76cd6a9b1
Author: Marc-André Lureau <marcandre.lureau@redhat.com>
Date:   Mon Sep 7 14:50:15 2026 +0400

    qga/vss-win32: log to file during COM+ registration

    COMRegister and COMUnregister are invoked both from the MSI installer
    (via DLLCOMRegister/rundll32) and from qemu-ga -s vss-install, where
    stderr is typically not visible. Redirect stderr to
    %SystemRoot%\Temp\qga-vss-install.log so that qga_debug output is
    captured for post-install troubleshooting.

    Suggested-by: Konstantin Kostiuk <kkostiuk@redhat.com>
    Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
    Reviewed-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
    Link: https://lore.kernel.org/qemu-devel/20260907-qga-v1-17-86456ad356e2@redhat.com
    Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 9e8db79c12..09d94edd4f 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -241,10 +241,27 @@ out:
     return hr;
 }

+static void qga_vss_open_log(void)
+{
+    char path[MAX_PATH];
+    UINT n;
+
+    n = GetSystemWindowsDirectoryA(path, sizeof(path));
+    if (n == 0 || n >= sizeof(path)) {
+        return;
+    }
+    snprintf(path + n, sizeof(path) - n,
+             "\\Temp\\qga-vss-install.log");
+    if (freopen(path, "a", stderr)) {
+        setvbuf(stderr, NULL, _IONBF, 0);
+    }
+}
+
 /* Unregister this module from COM+ Applications Catalog */
 STDAPI COMUnregister(void);
 STDAPI COMUnregister(void)
 {
+    qga_vss_open_log();
     qga_debug_begin;

     HRESULT hr;
@@ -260,6 +277,7 @@ out:
 STDAPI COMRegister(void);
 STDAPI COMRegister(void)
 {
+    qga_vss_open_log();
     qga_debug_begin;

     HRESULT hr;