qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] qga-vss: Exit with non-zero code when register fail
@ 2025-06-20  8:31 Kostiantyn Kostiuk
  2025-06-20 12:29 ` Yan Vugenfirer
  0 siblings, 1 reply; 3+ messages in thread
From: Kostiantyn Kostiuk @ 2025-06-20  8:31 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Roth, Kostiantyn Kostiuk

QGA installer uses rundll32 to run the DLLCOMRegister function
from qga-vss.dll and perform VSS provider registration.
rundll32 ignores the return value of the function and always
exits with a zero exit code. This causes a situation where
the installer does not know the status of VSS provider registration.

This commit forces to change exit code when the VSS provider
registration fails.

https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32

Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
---
 qga/vss-win32/install.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
index 5cea5bcf74..6ee2f44a10 100644
--- a/qga/vss-win32/install.cpp
+++ b/qga/vss-win32/install.cpp
@@ -385,7 +385,10 @@ out:
 STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int);
 STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int)
 {
-    COMRegister();
+    HRESULT hr = COMRegister();
+    if (FAILED(hr)) {
+        exit(hr);
+    }
 }
 
 STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int);
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] qga-vss: Exit with non-zero code when register fail
  2025-06-20  8:31 [PATCH] qga-vss: Exit with non-zero code when register fail Kostiantyn Kostiuk
@ 2025-06-20 12:29 ` Yan Vugenfirer
  2025-06-26  7:45   ` Dehan Meng
  0 siblings, 1 reply; 3+ messages in thread
From: Yan Vugenfirer @ 2025-06-20 12:29 UTC (permalink / raw)
  To: Kostiantyn Kostiuk; +Cc: qemu-devel, Michael Roth

On Fri, Jun 20, 2025 at 12:33 PM Kostiantyn Kostiuk <kkostiuk@redhat.com> wrote:
>
> QGA installer uses rundll32 to run the DLLCOMRegister function
> from qga-vss.dll and perform VSS provider registration.
> rundll32 ignores the return value of the function and always
> exits with a zero exit code. This causes a situation where
> the installer does not know the status of VSS provider registration.
>
> This commit forces to change exit code when the VSS provider
> registration fails.
>
> https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32
>
> Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> ---
>  qga/vss-win32/install.cpp | 5 ++++-
>  1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> index 5cea5bcf74..6ee2f44a10 100644
> --- a/qga/vss-win32/install.cpp
> +++ b/qga/vss-win32/install.cpp
> @@ -385,7 +385,10 @@ out:
>  STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int);
>  STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int)
>  {
> -    COMRegister();
> +    HRESULT hr = COMRegister();
> +    if (FAILED(hr)) {
> +        exit(hr);
> +    }
>  }
>
>  STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int);
> --
> 2.48.1
>
>

Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] qga-vss: Exit with non-zero code when register fail
  2025-06-20 12:29 ` Yan Vugenfirer
@ 2025-06-26  7:45   ` Dehan Meng
  0 siblings, 0 replies; 3+ messages in thread
From: Dehan Meng @ 2025-06-26  7:45 UTC (permalink / raw)
  To: Yan Vugenfirer; +Cc: Kostiantyn Kostiuk, qemu-devel, Michael Roth

[-- Attachment #1: Type: text/plain, Size: 1633 bytes --]

Tested-by: Dehan Meng <*demeng@redhat.com <demeng@redhat.com>*>

On Fri, Jun 20, 2025 at 8:31 PM Yan Vugenfirer <yvugenfi@redhat.com> wrote:

> On Fri, Jun 20, 2025 at 12:33 PM Kostiantyn Kostiuk <kkostiuk@redhat.com>
> wrote:
> >
> > QGA installer uses rundll32 to run the DLLCOMRegister function
> > from qga-vss.dll and perform VSS provider registration.
> > rundll32 ignores the return value of the function and always
> > exits with a zero exit code. This causes a situation where
> > the installer does not know the status of VSS provider registration.
> >
> > This commit forces to change exit code when the VSS provider
> > registration fails.
> >
> >
> https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/rundll32
> >
> > Signed-off-by: Kostiantyn Kostiuk <kkostiuk@redhat.com>
> > ---
> >  qga/vss-win32/install.cpp | 5 ++++-
> >  1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/qga/vss-win32/install.cpp b/qga/vss-win32/install.cpp
> > index 5cea5bcf74..6ee2f44a10 100644
> > --- a/qga/vss-win32/install.cpp
> > +++ b/qga/vss-win32/install.cpp
> > @@ -385,7 +385,10 @@ out:
> >  STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int);
> >  STDAPI_(void) CALLBACK DLLCOMRegister(HWND, HINSTANCE, LPSTR, int)
> >  {
> > -    COMRegister();
> > +    HRESULT hr = COMRegister();
> > +    if (FAILED(hr)) {
> > +        exit(hr);
> > +    }
> >  }
> >
> >  STDAPI_(void) CALLBACK DLLCOMUnregister(HWND, HINSTANCE, LPSTR, int);
> > --
> > 2.48.1
> >
> >
>
> Reviewed-by: Yan Vugenfirer <yvugenfi@redhat.com>
>
>
>

[-- Attachment #2: Type: text/html, Size: 2523 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2025-06-26  7:51 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-20  8:31 [PATCH] qga-vss: Exit with non-zero code when register fail Kostiantyn Kostiuk
2025-06-20 12:29 ` Yan Vugenfirer
2025-06-26  7:45   ` Dehan Meng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).