Alexander Nicolaysen Sørnes : regedit: Convert openKey to Unicode.
Alexandre Julliard
julliard at winehq.org
Thu Jul 10 14:07:23 CDT 2008
Module: wine
Branch: master
Commit: db074ee9a336fe3c6576d05c96992b746e75e7e8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=db074ee9a336fe3c6576d05c96992b746e75e7e8
Author: Alexander Nicolaysen Sørnes <alex at thehandofagony.com>
Date: Wed Jul 9 21:42:20 2008 +0200
regedit: Convert openKey to Unicode.
---
programs/regedit/regproc.c | 28 ++++++++++++----------------
1 files changed, 12 insertions(+), 16 deletions(-)
diff --git a/programs/regedit/regproc.c b/programs/regedit/regproc.c
index bed68af..bbced33 100644
--- a/programs/regedit/regproc.c
+++ b/programs/regedit/regproc.c
@@ -418,10 +418,10 @@ static LONG setValue(WCHAR* val_name, WCHAR* val_data)
* A helper function for processRegEntry() that opens the current key.
* That key must be closed by calling closeKey().
*/
-static LONG openKey(LPSTR stdInput)
+static LONG openKeyW(WCHAR* stdInput)
{
HKEY keyClass;
- LPSTR keyPath;
+ WCHAR* keyPath;
DWORD dwDisp;
LONG res;
@@ -430,10 +430,10 @@ static LONG openKey(LPSTR stdInput)
return ERROR_INVALID_PARAMETER;
/* Get the registry class */
- if (!parseKeyName(stdInput, &keyClass, &keyPath))
+ if (!parseKeyNameW(stdInput, &keyClass, &keyPath))
return ERROR_INVALID_PARAMETER;
- res = RegCreateKeyEx(
+ res = RegCreateKeyExW(
keyClass, /* Class */
keyPath, /* Sub Key */
0, /* MUST BE 0 */
@@ -446,15 +446,9 @@ static LONG openKey(LPSTR stdInput)
REG_OPENED_EXISTING_KEY */
if (res == ERROR_SUCCESS)
- {
- currentKeyName = HeapAlloc(GetProcessHeap(), 0, strlen(stdInput)+1);
- CHECK_ENOUGH_MEMORY(currentKeyName);
- strcpy(currentKeyName, stdInput);
- }
+ currentKeyName = GetMultiByteString(stdInput);
else
- {
currentKeyHandle = NULL;
- }
return res;
@@ -558,6 +552,7 @@ static void processRegEntry(LPSTR stdInput)
if ( stdInput[0] == '[') /* We are reading a new key */
{
LPSTR keyEnd;
+ WCHAR* stdInputW;
closeKey(); /* Close the previous key */
/* Get rid of the square brackets */
@@ -566,17 +561,18 @@ static void processRegEntry(LPSTR stdInput)
if (keyEnd)
*keyEnd='\0';
+ stdInputW = GetWideString(stdInput);
+
/* delete the key if we encounter '-' at the start of reg key */
if ( stdInput[0] == '-')
{
- WCHAR* stdInputW = GetWideString(stdInput + 1);
- delete_registry_key(stdInputW);
- HeapFree(GetProcessHeap(), 0, stdInputW);
- } else if ( openKey(stdInput) != ERROR_SUCCESS )
+ delete_registry_key(stdInputW + 1);
+ } else if ( openKeyW(stdInputW) != ERROR_SUCCESS )
{
fprintf(stderr,"%s: setValue failed to open key %s\n",
getAppName(), stdInput);
}
+ HeapFree(GetProcessHeap(), 0, stdInputW);
} else if( currentKeyHandle &&
(( stdInput[0] == '@') || /* reading a default @=data pair */
( stdInput[0] == '\"'))) /* reading a new value=data pair */
@@ -1017,7 +1013,7 @@ BOOL export_registry_key(CHAR *file_name, CHAR *reg_key_name)
if (reg_key_name && reg_key_name[0]) {
HKEY reg_key_class;
- CHAR *branch_name;
+ CHAR *branch_name = NULL;
HKEY key;
REGPROC_resize_char_buffer(®_key_name_buf, ®_key_name_len,
More information about the wine-cvs
mailing list