Skip to contentSkip to conversation

qga-vss: Exit with non-zero code when register fail

PATCH In review Kostiantyn Kostiuk 3 participants 3 messages Jun 20, 2025 – Jun 26, 2025

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 qga-vss: Exit with non-zero code when register fail

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

---
 qga/vss-win32/install.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qga/vss-win32/install.cpp +4 -1
index 5cea5bcf74..6ee2f44a10 100644
@@ -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);
Signature · 1 line
2.48.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 34 lines · 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

---
 qga/vss-win32/install.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qga/vss-win32/install.cpp +4 -2
index 5cea5bcf74..6ee2f44a10 100644
@@ -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);
--
Quoted 3 lines

2.48.1

Tested-by
#2 lore raw
Tested-by Dehan Meng <*[email protected] <[email protected]>*>
Quoted 45 lines · Yan Vugenfirer
Quoted 11 lines · 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

Quoted 23 lines
---
 qga/vss-win32/install.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)
qga/vss-win32/install.cpp +4 -2
index 5cea5bcf74..6ee2f44a10 100644
@@ -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);
--
Quoted 3 lines

2.48.1