Nikolay Sivov : wbemprox: Handle __ProviderArchitecture in SetStringValue().

Alexandre Julliard julliard at winehq.org
Wed Mar 3 15:47:29 CST 2021


Module: wine
Branch: master
Commit: bc063aaaa272d342971a1237220e07c2ba4f6f1c
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=bc063aaaa272d342971a1237220e07c2ba4f6f1c

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Wed Mar  3 09:05:57 2021 +0300

wbemprox: Handle __ProviderArchitecture in SetStringValue().

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Hans Leidekker <hans at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wbemprox/reg.c | 15 ++++++++++++---
 1 file changed, 12 insertions(+), 3 deletions(-)

diff --git a/dlls/wbemprox/reg.c b/dlls/wbemprox/reg.c
index 59f94abfc4a..63870bfc52c 100644
--- a/dlls/wbemprox/reg.c
+++ b/dlls/wbemprox/reg.c
@@ -476,14 +476,23 @@ done:
     return hr;
 }
 
-static void set_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, const WCHAR *value, VARIANT *retval )
+static void set_stringvalue( HKEY root, const WCHAR *subkey, const WCHAR *name, const WCHAR *value,
+        IWbemContext *context, VARIANT *retval )
 {
+    HKEY hkey;
     LONG res;
 
     TRACE("%p, %s, %s, %s\n", root, debugstr_w(subkey), debugstr_w(name), debugstr_w(value));
 
-    res = RegSetKeyValueW( root, subkey, name, REG_SZ, value, (lstrlenW( value ) + 1) * sizeof(*value) );
+    if ((res = RegOpenKeyExW( root, subkey, 0, KEY_SET_VALUE | reg_get_access_mask( context ), &hkey )))
+    {
+        set_variant( VT_UI4, res, NULL, retval );
+        return;
+    }
+
+    res = RegSetKeyValueW( hkey, NULL, name, REG_SZ, value, (lstrlenW( value ) + 1) * sizeof(*value) );
     set_variant( VT_UI4, res, NULL, retval );
+    RegCloseKey( hkey );
 }
 
 HRESULT reg_set_stringvalue( IWbemClassObject *obj, IWbemContext *context, IWbemClassObject *in, IWbemClassObject **out )
@@ -524,7 +533,7 @@ HRESULT reg_set_stringvalue( IWbemClassObject *obj, IWbemContext *context, IWbem
         }
     }
 
-    set_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), V_BSTR(&value), &retval );
+    set_stringvalue( (HKEY)(INT_PTR)V_I4(&defkey), V_BSTR(&subkey), V_BSTR(&name), V_BSTR(&value), context, &retval );
     if (out_params)
         hr = IWbemClassObject_Put( out_params, L"ReturnValue", 0, &retval, CIM_UINT32 );
 




More information about the wine-cvs mailing list