mirror of
https://github.com/reactos/reactos.git
synced 2025-07-31 09:11:42 +00:00
[WINESYNC] reg: Support use of registry views when exporting registry data.
Signed-off-by: Hugh McMaster <hugh.mcmaster@outlook.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org> wine commit id fcf79426147adf0d9f1d80b0cf24d0b6abd8bf59 by Hugh McMaster <hugh.mcmaster@outlook.com>
This commit is contained in:
parent
bac2e89b05
commit
35b9e2d380
3 changed files with 26 additions and 12 deletions
|
@ -225,7 +225,7 @@ static void export_key_name(HANDLE hFile, WCHAR *name)
|
|||
free(buf);
|
||||
}
|
||||
|
||||
static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path)
|
||||
static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path, REGSAM sam)
|
||||
{
|
||||
LONG rc;
|
||||
DWORD max_value_len = 256, value_len;
|
||||
|
@ -284,9 +284,9 @@ static int export_registry_data(HANDLE hFile, HKEY hkey, WCHAR *path)
|
|||
if (rc == ERROR_SUCCESS)
|
||||
{
|
||||
subkey_path = build_subkey_path(path, path_len, subkey_name, subkey_len);
|
||||
if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ, &subkey))
|
||||
if (!RegOpenKeyExW(hkey, subkey_name, 0, KEY_READ|sam, &subkey))
|
||||
{
|
||||
export_registry_data(hFile, subkey, subkey_path);
|
||||
export_registry_data(hFile, subkey, subkey_path, sam);
|
||||
RegCloseKey(subkey);
|
||||
}
|
||||
free(subkey_path);
|
||||
|
@ -349,6 +349,7 @@ int reg_export(int argc, WCHAR *argvW[])
|
|||
HKEY root, hkey;
|
||||
WCHAR *path, *key_name;
|
||||
BOOL overwrite_file = FALSE;
|
||||
REGSAM sam = 0;
|
||||
HANDLE hFile;
|
||||
int i, ret;
|
||||
|
||||
|
@ -368,13 +369,26 @@ int reg_export(int argc, WCHAR *argvW[])
|
|||
|
||||
if (is_char(*str, 'y') && !str[1])
|
||||
overwrite_file = TRUE;
|
||||
else if (!lstrcmpiW(str, L"reg:32") || !lstrcmpiW(str, L"reg:64"))
|
||||
else if (!lstrcmpiW(str, L"reg:32"))
|
||||
{
|
||||
if (sam & KEY_WOW64_32KEY) goto invalid;
|
||||
sam |= KEY_WOW64_32KEY;
|
||||
continue;
|
||||
}
|
||||
else if (!lstrcmpiW(str, L"reg:64"))
|
||||
{
|
||||
if (sam & KEY_WOW64_64KEY) goto invalid;
|
||||
sam |= KEY_WOW64_64KEY;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
goto invalid;
|
||||
}
|
||||
|
||||
if (RegOpenKeyExW(root, path, 0, KEY_READ, &hkey))
|
||||
if (sam == (KEY_WOW64_32KEY|KEY_WOW64_64KEY))
|
||||
goto invalid;
|
||||
|
||||
if (RegOpenKeyExW(root, path, 0, KEY_READ|sam, &hkey))
|
||||
{
|
||||
output_message(STRING_KEY_NONEXIST);
|
||||
return 1;
|
||||
|
@ -384,7 +398,7 @@ int reg_export(int argc, WCHAR *argvW[])
|
|||
|
||||
hFile = get_file_handle(argvW[3], overwrite_file);
|
||||
export_file_header(hFile);
|
||||
ret = export_registry_data(hFile, hkey, key_name);
|
||||
ret = export_registry_data(hFile, hkey, key_name, sam);
|
||||
export_newline(hFile);
|
||||
CloseHandle(hFile);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue