Commit 33ce8e04 authored by Alex Henrie's avatar Alex Henrie Committed by Alexandre Julliard

regedit: Use the wcsdup function instead or reimplementing it.

parent 0a7084f4
......@@ -637,8 +637,7 @@ BOOL RenameKey(HWND hwnd, HKEY hRootKey, LPCWSTR keyPath, LPCWSTR newName)
} else {
LPWSTR srcSubKey_copy;
parentPath = malloc((lstrlenW(keyPath) + 1) * sizeof(WCHAR));
lstrcpyW(parentPath, keyPath);
parentPath = wcsdup(keyPath);
srcSubKey_copy = wcsrchr(parentPath, '\\');
*srcSubKey_copy = 0;
srcSubKey = srcSubKey_copy + 1;
......
......@@ -73,8 +73,7 @@ BOOL update_listview_path(const WCHAR *path)
{
free(g_currentPath);
g_currentPath = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
lstrcpyW(g_currentPath, path);
g_currentPath = wcsdup(path);
return TRUE;
}
......@@ -154,13 +153,7 @@ int AddEntryToList(HWND hwndLV, WCHAR *Name, DWORD dwValType, void *ValBuf, DWOR
linfo = malloc(sizeof(LINE_INFO));
linfo->dwValType = dwValType;
linfo->val_len = dwCount;
if (Name)
{
linfo->name = malloc((lstrlenW(Name) + 1) * sizeof(WCHAR));
lstrcpyW(linfo->name, Name);
}
else linfo->name = NULL;
linfo->name = wcsdup(Name);
if (ValBuf && dwCount)
{
......
......@@ -447,10 +447,7 @@ static LONG open_key(struct parser *parser, WCHAR *path)
KEY_ALL_ACCESS, NULL, &parser->hkey, NULL);
if (res == ERROR_SUCCESS)
{
parser->key_name = malloc((lstrlenW(path) + 1) * sizeof(WCHAR));
lstrcpyW(parser->key_name, path);
}
parser->key_name = wcsdup(path);
else
parser->hkey = NULL;
......@@ -699,8 +696,7 @@ static WCHAR *quoted_value_name_state(struct parser *parser, WCHAR *pos)
goto invalid;
/* copy the value name in case we need to parse multiple lines and the buffer is overwritten */
parser->value_name = malloc((lstrlenW(val_name) + 1) * sizeof(WCHAR));
lstrcpyW(parser->value_name, val_name);
parser->value_name = wcsdup(val_name);
set_state(parser, DATA_START);
return p;
......@@ -1486,8 +1482,7 @@ static BOOL export_all(WCHAR *file_name, WCHAR *path, BOOL unicode)
return FALSE;
}
class_name = malloc((lstrlenW(reg_class_namesW[i]) + 1) * sizeof(WCHAR));
lstrcpyW(class_name, reg_class_namesW[i]);
class_name = wcsdup(reg_class_namesW[i]);
export_registry_data(fp, classes[i], class_name, unicode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment