Alexandre Julliard : winecfg: Add a couple of Unicode helper functions.

Alexandre Julliard julliard at winehq.org
Fri Apr 25 08:11:12 CDT 2008


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

Author: Alexandre Julliard <julliard at winehq.org>
Date:   Fri Apr 25 14:36:25 2008 +0200

winecfg: Add a couple of Unicode helper functions.

---

 programs/winecfg/winecfg.c |   33 +++++++++++++++++++++++++++++++++
 programs/winecfg/winecfg.h |    3 ++-
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/programs/winecfg/winecfg.c b/programs/winecfg/winecfg.c
index b21599d..3fdc796 100644
--- a/programs/winecfg/winecfg.c
+++ b/programs/winecfg/winecfg.c
@@ -461,6 +461,11 @@ void set_reg_key_dword(HKEY root, const char *path, const char *name, DWORD valu
     HeapFree(GetProcessHeap(), 0, wname);
 }
 
+void set_reg_keyW(HKEY root, const WCHAR *path, const WCHAR *name, const WCHAR *value)
+{
+    set_reg_key_ex(root, path, name, value, REG_SZ);
+}
+
 void set_reg_key_dwordW(HKEY root, const WCHAR *path, const WCHAR *name, DWORD value)
 {
     set_reg_key_ex(root, path, name, &value, REG_DWORD);
@@ -684,6 +689,34 @@ char *keypath(const char *section)
     return result;
 }
 
+WCHAR *keypathW(const WCHAR *section)
+{
+    static const WCHAR appdefaultsW[] = {'A','p','p','D','e','f','a','u','l','t','s','\\',0};
+    static WCHAR *result = NULL;
+
+    HeapFree(GetProcessHeap(), 0, result);
+
+    if (current_app)
+    {
+        DWORD len = sizeof(appdefaultsW) + (lstrlenW(current_app) + lstrlenW(section) + 1) * sizeof(WCHAR);
+        result = HeapAlloc(GetProcessHeap(), 0, len );
+        lstrcpyW( result, appdefaultsW );
+        lstrcatW( result, current_app );
+        if (section[0])
+        {
+            len = lstrlenW(result);
+            result[len++] = '\\';
+            lstrcpyW( result + len, section );
+        }
+    }
+    else
+    {
+        result = strdupW(section);
+    }
+
+    return result;
+}
+
 void PRINTERROR(void)
 {
         LPSTR msg;
diff --git a/programs/winecfg/winecfg.h b/programs/winecfg/winecfg.h
index b0e2d39..7b0006a 100644
--- a/programs/winecfg/winecfg.h
+++ b/programs/winecfg/winecfg.h
@@ -71,7 +71,8 @@ WCHAR* load_string (UINT id);
  
    no explicit free is needed of the string returned by this function
  */
-char *keypath(const char *section); 
+char *keypath(const char *section);
+WCHAR *keypathW(const WCHAR *section);
 
 int initialize(HINSTANCE hInstance);
 extern HKEY config_key;




More information about the wine-cvs mailing list