ReactOS  0.4.14-dev-599-g2d4d3f5
reg.c File Reference
#include <stdio.h>
#include <windows.h>
#include "wine/test.h"
Include dependency graph for reg.c:

Go to the source code of this file.

Macros

#define lok   ok_(__FILE__,line)
 
#define KEY_BASE   "Software\\Wine\\reg_test"
 
#define REG_EXIT_SUCCESS   0
 
#define REG_EXIT_FAILURE   1
 
#define TODO_REG_TYPE   (0x0001u)
 
#define TODO_REG_SIZE   (0x0002u)
 
#define TODO_REG_DATA   (0x0004u)
 
#define TODO_REG_COMPARE   (0x0008u)
 
#define run_reg_exe(c, r)   run_reg_exe_(__LINE__,c,r)
 
#define verify_reg(k, v, t, d, s, todo)   verify_reg_(__LINE__,k,v,t,d,s,todo)
 
#define verify_reg_nonexist(k, v)   verify_reg_nonexist_(__LINE__,k,v)
 
#define open_key(b, p, s, k)   open_key_(__LINE__,b,p,s,k)
 
#define verify_key(k, s)   verify_key_(__LINE__,k,s)
 
#define verify_key_nonexist(k, s)   verify_key_nonexist_(__LINE__,k,s)
 
#define add_key(k, p, s)   add_key_(__LINE__,k,p,s)
 
#define delete_key(k, p)   delete_key_(__LINE__,k,p)
 
#define add_value(k, n, t, d, s)   add_value_(__LINE__,k,n,t,d,s)
 
#define delete_value(k, n)   delete_value_(__LINE__,k,n)
 
#define test_import_str(c, r)   import_reg(__LINE__,c,FALSE,r)
 
#define test_import_wstr(c, r)   import_reg(__LINE__,c,TRUE,r)
 
#define compare_export(f, e, todo)   compare_export_(__LINE__,f,e,todo)
 

Functions

static BOOL run_reg_exe_ (unsigned line, const char *cmd, DWORD *rc)
 
static void verify_reg_ (unsigned line, HKEY hkey, const char *value, DWORD exp_type, const void *exp_data, DWORD exp_size, DWORD todo)
 
static void verify_reg_nonexist_ (unsigned line, HKEY hkey, const char *value)
 
static void open_key_ (unsigned line, const HKEY base, const char *path, const DWORD sam, HKEY *hkey)
 
static void verify_key_ (unsigned line, HKEY key_base, const char *subkey)
 
static void verify_key_nonexist_ (unsigned line, HKEY key_base, const char *subkey)
 
static void add_key_ (unsigned line, const HKEY hkey, const char *path, HKEY *subkey)
 
static void delete_key_ (unsigned line, const HKEY hkey, const char *path)
 
static LONG delete_tree (const HKEY key, const char *subkey)
 
static void add_value_ (unsigned line, HKEY hkey, const char *name, DWORD type, const void *data, size_t size)
 
static void delete_value_ (unsigned line, const HKEY hkey, const char *name)
 
static void test_add (void)
 
static void test_delete (void)
 
static void test_query (void)
 
static void test_v_flags (void)
 
static BOOL write_file (const void *str, DWORD size)
 
static BOOL import_reg (unsigned line, const char *contents, BOOL unicode, DWORD *rc)
 
static void test_import (void)
 
static void test_unicode_import (void)
 
static void test_import_with_whitespace (void)
 
static void test_unicode_import_with_whitespace (void)
 
static void test_import_31 (void)
 
static BOOL compare_export_ (unsigned line, const char *filename, const char *expected, DWORD todo)
 
static void test_export (void)
 
 START_TEST (reg)
 

Macro Definition Documentation

◆ add_key

#define add_key (   k,
  p,
  s 
)    add_key_(__LINE__,k,p,s)

Definition at line 134 of file reg.c.

◆ add_value

#define add_value (   k,
  n,
  t,
  d,
  s 
)    add_value_(__LINE__,k,n,t,d,s)

Definition at line 198 of file reg.c.

◆ compare_export

#define compare_export (   f,
  e,
  todo 
)    compare_export_(__LINE__,f,e,todo)

Definition at line 4317 of file reg.c.

◆ delete_key

#define delete_key (   k,
  p 
)    delete_key_(__LINE__,k,p)

Definition at line 144 of file reg.c.

◆ delete_value

#define delete_value (   k,
  n 
)    delete_value_(__LINE__,k,n)

Definition at line 208 of file reg.c.

◆ KEY_BASE

#define KEY_BASE   "Software\\Wine\\reg_test"

Definition at line 24 of file reg.c.

◆ lok

#define lok   ok_(__FILE__,line)

Definition at line 23 of file reg.c.

◆ open_key

#define open_key (   b,
  p,
  s,
  k 
)    open_key_(__LINE__,b,p,s,k)

Definition at line 98 of file reg.c.

◆ REG_EXIT_FAILURE

#define REG_EXIT_FAILURE   1

Definition at line 26 of file reg.c.

◆ REG_EXIT_SUCCESS

#define REG_EXIT_SUCCESS   0

Definition at line 25 of file reg.c.

◆ run_reg_exe

#define run_reg_exe (   c,
  r 
)    run_reg_exe_(__LINE__,c,r)

Definition at line 32 of file reg.c.

◆ test_import_str

#define test_import_str (   c,
  r 
)    import_reg(__LINE__,c,FALSE,r)

Definition at line 818 of file reg.c.

◆ test_import_wstr

#define test_import_wstr (   c,
  r 
)    import_reg(__LINE__,c,TRUE,r)

Definition at line 819 of file reg.c.

◆ TODO_REG_COMPARE

#define TODO_REG_COMPARE   (0x0008u)

Definition at line 30 of file reg.c.

◆ TODO_REG_DATA

#define TODO_REG_DATA   (0x0004u)

Definition at line 29 of file reg.c.

◆ TODO_REG_SIZE

#define TODO_REG_SIZE   (0x0002u)

Definition at line 28 of file reg.c.

◆ TODO_REG_TYPE

#define TODO_REG_TYPE   (0x0001u)

Definition at line 27 of file reg.c.

◆ verify_key

#define verify_key (   k,
  s 
)    verify_key_(__LINE__,k,s)

Definition at line 107 of file reg.c.

◆ verify_key_nonexist

#define verify_key_nonexist (   k,
  s 
)    verify_key_nonexist_(__LINE__,k,s)

Definition at line 120 of file reg.c.

◆ verify_reg

#define verify_reg (   k,
  v,
  t,
  d,
  s,
  todo 
)    verify_reg_(__LINE__,k,v,t,d,s,todo)

Definition at line 62 of file reg.c.

◆ verify_reg_nonexist

#define verify_reg_nonexist (   k,
  v 
)    verify_reg_nonexist_(__LINE__,k,v)

Definition at line 88 of file reg.c.

Function Documentation

◆ add_key_()

static void add_key_ ( unsigned  line,
const HKEY  hkey,
const char path,
HKEY subkey 
)
static

Definition at line 135 of file reg.c.

136 {
137  LONG err;
138 
140  KEY_READ|KEY_WRITE, NULL, subkey, NULL);
141  lok(err == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", err);
142 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define lok
Definition: reg.c:23
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define KEY_WRITE
Definition: nt_native.h:1031
#define err(...)
LONG WINAPI RegCreateKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD Reserved, _In_ LPSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_ LPDWORD lpdwDisposition)
Definition: reg.c:1029

◆ add_value_()

static void add_value_ ( unsigned  line,
HKEY  hkey,
const char name,
DWORD  type,
const void data,
size_t  size 
)
static

Definition at line 199 of file reg.c.

201 {
202  LONG err;
203 
204  err = RegSetValueExA(hkey, name, 0, type, (const BYTE *)data, size);
205  lok(err == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", err);
206 }
#define ERROR_SUCCESS
Definition: deptool.c:10
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
long LONG
Definition: pedump.c:60
#define lok
Definition: reg.c:23
GLsizeiptr size
Definition: glext.h:5919
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl.h:1950
unsigned char BYTE
Definition: mem.h:68
#define err(...)
Definition: name.c:38
LONG WINAPI RegSetValueExA(HKEY hKey, LPCSTR lpValueName, DWORD Reserved, DWORD dwType, CONST BYTE *lpData, DWORD cbData)
Definition: reg.c:4812

◆ compare_export_()

static BOOL compare_export_ ( unsigned  line,
const char filename,
const char expected,
DWORD  todo 
)
static

Definition at line 4318 of file reg.c.

4319 {
4320  FILE *fp;
4321  long file_size;
4322  WCHAR *fbuf = NULL, *wstr = NULL;
4323  size_t len;
4324  BOOL ret = FALSE;
4325 
4326  fp = fopen(filename, "rb");
4327  if (!fp) return FALSE;
4328 
4329  if (fseek(fp, 0, SEEK_END)) goto error;
4330  file_size = ftell(fp);
4331  if (file_size == -1) goto error;
4332  rewind(fp);
4333 
4334  fbuf = HeapAlloc(GetProcessHeap(), 0, file_size + sizeof(WCHAR));
4335  if (!fbuf) goto error;
4336 
4337  fread(fbuf, file_size, 1, fp);
4338  fbuf[file_size/sizeof(WCHAR)] = 0;
4339  fclose(fp);
4340 
4341  len = MultiByteToWideChar(CP_UTF8, 0, expected, -1, NULL, 0);
4342  wstr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
4343  if (!wstr) goto exit;
4344  MultiByteToWideChar(CP_UTF8, 0, expected, -1, wstr, len);
4345 
4347  lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n");
4348 
4350  lok(ret, "DeleteFile failed: %u\n", GetLastError());
4351 
4352 exit:
4353  HeapFree(GetProcessHeap(), 0, fbuf);
4354  HeapFree(GetProcessHeap(), 0, wstr);
4355  return ret;
4356 
4357 error:
4358  fclose(fp);
4359  return FALSE;
4360 }
#define error(str)
Definition: mkdosfs.c:1605
int WINAPI lstrcmpW(LPCWSTR lpString1, LPCWSTR lpString2)
Definition: lstring.c:170
BOOL todo
Definition: filedlg.c:313
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
const char * filename
Definition: ioapi.h:135
#define TODO_REG_COMPARE
Definition: reg.c:30
_Check_return_opt_ _CRTIMP size_t __cdecl fread(_Out_writes_bytes_(_ElementSize *_Count) void *_DstBuf, _In_ size_t _ElementSize, _In_ size_t _Count, _Inout_ FILE *_File)
#define CP_UTF8
Definition: nls.h:20
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
_Check_return_opt_ _CRTIMP int __cdecl fseek(_Inout_ FILE *_File, _In_ long _Offset, _In_ int _Origin)
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define lok
Definition: reg.c:23
_CRTIMP void __cdecl rewind(_Inout_ FILE *_File)
#define todo_wine_if(is_todo)
Definition: test.h:164
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
_Check_return_opt_ _CRTIMP int __cdecl fclose(_Inout_ FILE *_File)
_Check_return_ _CRTIMP FILE *__cdecl fopen(_In_z_ const char *_Filename, _In_z_ const char *_Mode)
#define MultiByteToWideChar
Definition: compat.h:100
_Check_return_ _CRTIMP long __cdecl ftell(_Inout_ FILE *_File)
#define SEEK_END
Definition: cabinet.c:27
void exit(int exitcode)
Definition: _exit.c:33
#define HeapFree(x, y, z)
Definition: compat.h:402
BOOL expected
Definition: store.c:2063
#define file_size(inode)
Definition: reiserfs_fs.h:1869

◆ delete_key_()

static void delete_key_ ( unsigned  line,
const HKEY  hkey,
const char path 
)
static

Definition at line 145 of file reg.c.

146 {
147  if (path && *path)
148  {
149  LONG err;
150 
151  err = RegDeleteKeyA(hkey, path);
152  lok(err == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", err);
153  }
154 }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
#define lok
Definition: reg.c:23
#define err(...)
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222

◆ delete_tree()

static LONG delete_tree ( const HKEY  key,
const char subkey 
)
static

Definition at line 156 of file reg.c.

157 {
158  HKEY hkey;
159  LONG ret;
160  char *subkey_name = NULL;
161  DWORD max_subkey_len, subkey_len;
162  static const char empty[1];
163 
164  ret = RegOpenKeyExA(key, subkey, 0, KEY_READ, &hkey);
165  if (ret) return ret;
166 
167  ret = RegQueryInfoKeyA(hkey, NULL, NULL, NULL, NULL, &max_subkey_len,
168  NULL, NULL, NULL, NULL, NULL, NULL);
169  if (ret) goto cleanup;
170 
171  max_subkey_len++;
172 
173  subkey_name = HeapAlloc(GetProcessHeap(), 0, max_subkey_len);
174  if (!subkey_name)
175  {
177  goto cleanup;
178  }
179 
180  for (;;)
181  {
182  subkey_len = max_subkey_len;
183  ret = RegEnumKeyExA(hkey, 0, subkey_name, &subkey_len, NULL, NULL, NULL, NULL);
184  if (ret == ERROR_NO_MORE_ITEMS) break;
185  if (ret) goto cleanup;
186  ret = delete_tree(hkey, subkey_name);
187  if (ret) goto cleanup;
188  }
189 
190  ret = RegDeleteKeyA(hkey, empty);
191 
192 cleanup:
193  HeapFree(GetProcessHeap(), 0, subkey_name);
194  RegCloseKey(hkey);
195  return ret;
196 }
#define ERROR_NO_MORE_ITEMS
Definition: compat.h:95
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegQueryInfoKeyA(HKEY hKey, LPSTR lpClass, LPDWORD lpcClass, LPDWORD lpReserved, LPDWORD lpcSubKeys, LPDWORD lpcMaxSubKeyLen, LPDWORD lpcMaxClassLen, LPDWORD lpcValues, LPDWORD lpcMaxValueNameLen, LPDWORD lpcMaxValueLen, LPDWORD lpcbSecurityDescriptor, PFILETIME lpftLastWriteTime)
Definition: reg.c:3607
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
#define ERROR_NOT_ENOUGH_MEMORY
Definition: dderror.h:7
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
unsigned long DWORD
Definition: ntddk_ex.h:95
int ret
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
BOOL empty
Definition: button.c:170
char * cleanup(char *str)
Definition: wpickclick.c:99
static LONG delete_tree(const HKEY key, const char *subkey)
Definition: reg.c:156
#define HeapFree(x, y, z)
Definition: compat.h:402
LONG WINAPI RegEnumKeyExA(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
Definition: reg.c:2442
Definition: path.c:41

Referenced by test_export().

◆ delete_value_()

static void delete_value_ ( unsigned  line,
const HKEY  hkey,
const char name 
)
static

Definition at line 209 of file reg.c.

210 {
211  LONG err;
212 
213  err = RegDeleteValueA(hkey, name);
214  lok(err == ERROR_SUCCESS, "RegDeleteValueA failed: %d\n", err);
215 }
#define ERROR_SUCCESS
Definition: deptool.c:10
long LONG
Definition: pedump.c:60
#define lok
Definition: reg.c:23
#define err(...)
LONG WINAPI RegDeleteValueA(HKEY hKey, LPCSTR lpValueName)
Definition: reg.c:2319
Definition: name.c:38

◆ import_reg()

static BOOL import_reg ( unsigned  line,
const char contents,
BOOL  unicode,
DWORD rc 
)
static

Definition at line 821 of file reg.c.

822 {
823  int lenA;
824  BOOL ret;
825 
826  lenA = strlen(contents);
827 
828  if (unicode)
829  {
830  int len = MultiByteToWideChar(CP_UTF8, 0, contents, lenA, NULL, 0);
831  int size = len * sizeof(WCHAR);
832  WCHAR *wstr = HeapAlloc(GetProcessHeap(), 0, size);
833  if (!wstr) return FALSE;
834  MultiByteToWideChar(CP_UTF8, 0, contents, lenA, wstr, len);
835 
836  ret = write_file(wstr, size);
837  HeapFree(GetProcessHeap(), 0, wstr);
838  }
839  else
840  ret = write_file(contents, lenA);
841 
842  if (!ret) return FALSE;
843 
844  run_reg_exe("reg import test.reg", rc);
845 
846  ret = DeleteFileA("test.reg");
847  lok(ret, "DeleteFile failed: %u\n", GetLastError());
848 
849  return ret;
850 }
ACPI_SIZE strlen(const char *String)
Definition: utclib.c:269
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
#define CP_UTF8
Definition: nls.h:20
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
BOOL WINAPI DeleteFileA(IN LPCSTR lpFileName)
Definition: delete.c:24
#define lok
Definition: reg.c:23
#define run_reg_exe(c, r)
Definition: reg.c:32
GLsizeiptr size
Definition: glext.h:5919
#define GetProcessHeap()
Definition: compat.h:403
PVOID WINAPI HeapAlloc(HANDLE, DWORD, SIZE_T)
__wchar_t WCHAR
Definition: xmlstorage.h:180
int ret
GLenum GLsizei len
Definition: glext.h:6722
#define MultiByteToWideChar
Definition: compat.h:100
static BOOL write_file(const void *str, DWORD size)
Definition: reg.c:799
#define HeapFree(x, y, z)
Definition: compat.h:402

◆ open_key_()

static void open_key_ ( unsigned  line,
const HKEY  base,
const char path,
const DWORD  sam,
HKEY hkey 
)
static

Definition at line 99 of file reg.c.

100 {
101  LONG err;
102 
103  err = RegOpenKeyExA(base, path, 0, KEY_READ|sam, hkey);
104  lok(err == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", err);
105 }
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_READ
Definition: nt_native.h:1023
LONG WINAPI RegOpenKeyExA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey, _In_ DWORD ulOptions, _In_ REGSAM samDesired, _Out_ PHKEY phkResult)
Definition: reg.c:3331
long LONG
Definition: pedump.c:60
#define lok
Definition: reg.c:23
#define err(...)

◆ run_reg_exe_()

static BOOL run_reg_exe_ ( unsigned  line,
const char cmd,
DWORD rc 
)
static

Definition at line 33 of file reg.c.

34 {
35  STARTUPINFOA si = {sizeof(STARTUPINFOA)};
37  BOOL bret;
38  DWORD ret;
39  char cmdline[256];
40 
45 
46  strcpy(cmdline, cmd);
47  if (!CreateProcessA(NULL, cmdline, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi))
48  return FALSE;
49 
50  ret = WaitForSingleObject(pi.hProcess, 10000);
51  if (ret == WAIT_TIMEOUT)
52  TerminateProcess(pi.hProcess, 1);
53 
54  bret = GetExitCodeProcess(pi.hProcess, rc);
55  lok(bret, "GetExitCodeProcess failed: %d\n", GetLastError());
56 
57  CloseHandle(pi.hThread);
58  CloseHandle(pi.hProcess);
59  return bret;
60 }
struct _STARTUPINFOA STARTUPINFOA
#define TRUE
Definition: types.h:120
#define CloseHandle
Definition: compat.h:406
Definition: ftp_var.h:139
BOOL WINAPI GetExitCodeProcess(IN HANDLE hProcess, IN LPDWORD lpExitCode)
Definition: proc.c:1168
#define INVALID_HANDLE_VALUE
Definition: compat.h:399
DWORD WINAPI GetLastError(VOID)
Definition: except.c:1059
DWORD dwFlags
Definition: winbase.h:814
TCHAR * cmdline
Definition: stretchblt.cpp:32
DWORD WINAPI WaitForSingleObject(IN HANDLE hHandle, IN DWORD dwMilliseconds)
Definition: synch.c:82
unsigned int BOOL
Definition: ntddk_ex.h:94
smooth NULL
Definition: ftsmooth.c:416
#define lok
Definition: reg.c:23
#define STARTF_USESTDHANDLES
Definition: winbase.h:480
static refpint_t pi[]
Definition: server.c:96
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessA(LPCSTR lpApplicationName, LPSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCSTR lpCurrentDirectory, LPSTARTUPINFOA lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4742
unsigned long DWORD
Definition: ntddk_ex.h:95
HANDLE hStdOutput
Definition: winbase.h:819
#define WAIT_TIMEOUT
Definition: dderror.h:14
int ret
HANDLE hStdInput
Definition: winbase.h:818
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1532
char * strcpy(char *DstString, const char *SrcString)
Definition: utclib.c:388
HANDLE hStdError
Definition: winbase.h:820

◆ START_TEST()

START_TEST ( reg  )

Definition at line 4687 of file reg.c.

4688 {
4689  DWORD r;
4690  if (!run_reg_exe("reg.exe /?", &r)) {
4691  win_skip("reg.exe not available, skipping reg.exe tests\n");
4692  return;
4693  }
4694 
4695  test_add();
4696  test_delete();
4697  test_query();
4698  test_v_flags();
4699  test_import();
4703  test_import_31();
4704  test_export();
4705 }
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
static void test_import_with_whitespace(void)
Definition: reg.c:3906
static void test_v_flags(void)
Definition: reg.c:762
static void test_add(void)
Definition: reg.c:217
static void test_query(void)
Definition: reg.c:654
#define run_reg_exe(c, r)
Definition: reg.c:32
static void test_import_31(void)
Definition: reg.c:4202
static void test_import(void)
Definition: reg.c:852
unsigned long DWORD
Definition: ntddk_ex.h:95
static void test_unicode_import_with_whitespace(void)
Definition: reg.c:4054
static void test_export(void)
Definition: reg.c:4362
static void test_unicode_import(void)
Definition: reg.c:2381
static void test_delete(void)
Definition: reg.c:601
#define win_skip
Definition: test.h:150

◆ test_add()

static void test_add ( void  )
static

Definition at line 217 of file reg.c.

218 {
219  HKEY hkey;
220  LONG err;
221  DWORD r, dword, type, size;
222  char buffer[22];
223 
224  run_reg_exe("reg add", &r);
225  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
226 
227  run_reg_exe("reg add /?", &r);
228  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
229 
230  run_reg_exe("reg add /h", &r);
231  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
232 
233  run_reg_exe("reg add -H", &r);
234  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
235 
237  ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
238 
240 
241  run_reg_exe("reg add HKCU\\" KEY_BASE " /f", &r);
242  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
243 
244  open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
245 
246  /* Test empty type */
247  run_reg_exe("reg add HKCU\\" KEY_BASE " /v emptyType /t \"\" /d WineTest /f", &r);
248  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
249 
250  /* Test input key formats */
251  run_reg_exe("reg add \\HKCU\\" KEY_BASE "\\keytest0 /f", &r);
252  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
253  err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest0");
254  ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err);
255 
256  run_reg_exe("reg add \\\\HKCU\\" KEY_BASE "\\keytest1 /f", &r);
257  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
258  err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest1");
259  ok(err == ERROR_FILE_NOT_FOUND, "got exit code %d\n", err);
260 
261  run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest2\\\\ /f", &r);
262  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
263  "got exit code %u\n", r);
264  err = RegDeleteKeyA(HKEY_CURRENT_USER, KEY_BASE "\\keytest2");
265  ok(err == ERROR_FILE_NOT_FOUND || broken(err == ERROR_SUCCESS /* WinXP */),
266  "got exit code %d\n", err);
267 
268  run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest3\\ /f", &r);
269  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
270  verify_key(hkey, "keytest3");
271  delete_key(hkey, "keytest3");
272 
273  run_reg_exe("reg add HKCU\\" KEY_BASE "\\keytest4 /f", &r);
274  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
275  verify_key(hkey, "keytest4");
276  delete_key(hkey, "keytest4");
277 
278  /* REG_NONE */
279  run_reg_exe("reg add HKCU\\" KEY_BASE " /v none0 /d deadbeef /t REG_NONE /f", &r);
280  ok(r == REG_EXIT_SUCCESS, "got exit code %d\n", r);
281  verify_reg(hkey, "none0", REG_NONE, "d\0e\0a\0d\0b\0e\0e\0f\0\0", 18, 0);
282 
283  run_reg_exe("reg add HKCU\\" KEY_BASE " /v none1 /t REG_NONE /f", &r);
284  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
285  verify_reg(hkey, "none1", REG_NONE, "\0", 2, 0);
286 
287  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_NONE /f", &r);
288  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
289  verify_reg(hkey, NULL, REG_NONE, "\0", 2, 0);
290 
291  /* REG_SZ */
292  run_reg_exe("reg add HKCU\\" KEY_BASE " /d WineTest /f", &r);
293  ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
294  "got exit code %d, expected 0\n", r);
295  if (r == REG_EXIT_SUCCESS)
296  verify_reg(hkey, "", REG_SZ, "WineTest", 9, 0);
297  else
298  win_skip("broken reg.exe detected\n");
299 
300  run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /d deadbeef /f", &r);
301  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
302  verify_reg(hkey, "test", REG_SZ, "deadbeef", 9, 0);
303 
304  run_reg_exe("reg add HKCU\\" KEY_BASE " /v test /f", &r);
305  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
306  verify_reg(hkey, "test", REG_SZ, "", 1, 0);
307 
308  run_reg_exe("reg add HKCU\\" KEY_BASE " /v test1 /t REG_SZ /f /d", &r);
309  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
310 
311  run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /d WineTEST /f", &r);
312  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
313  verify_reg(hkey, "", REG_SZ, "WineTEST", 9, 0);
314 
315  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test2 /f", &r);
316  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
317  verify_reg(hkey, "test2", REG_SZ, "", 1, 0);
318 
319  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_SZ /v test3 /f /d \"\"", &r);
320  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
321  verify_reg(hkey, "test3", REG_SZ, "", 1, 0);
322 
323  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /f", &r);
324  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
325  verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
326 
327  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_SZ /f", &r);
328  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
329  verify_reg(hkey, NULL, REG_SZ, "", 1, 0);
330 
331  /* REG_EXPAND_SZ */
332  run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand0 /t REG_EXpand_sz /d \"dead%PATH%beef\" /f", &r);
333  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
334  verify_reg(hkey, "expand0", REG_EXPAND_SZ, "dead%PATH%beef", 15, 0);
335 
336  run_reg_exe("reg add HKCU\\" KEY_BASE " /v expand1 /t REG_EXpand_sz /d \"dead^%PATH^%beef\" /f", &r);
337  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
338  verify_reg(hkey, "expand1", REG_EXPAND_SZ, "dead^%PATH^%beef", 17, 0);
339 
340  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand2 /f", &r);
341  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
342  verify_reg(hkey, "expand2", REG_EXPAND_SZ, "", 1, 0);
343 
344  run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_EXPAND_SZ /d WineTEST /f", &r);
345  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
346  verify_reg(hkey, "", REG_EXPAND_SZ, "WineTEST", 9, 0);
347 
348  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_EXPAND_SZ /v expand3 /f /d \"\"", &r);
349  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
350  verify_reg(hkey, "expand3", REG_EXPAND_SZ, "", 1, 0);
351 
352  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_EXPAND_SZ /f", &r);
353  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
354  verify_reg(hkey, NULL, REG_EXPAND_SZ, "", 1, 0);
355 
356  /* REG_BINARY */
357  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin0 /f", &r);
358  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
359  verify_reg(hkey, "bin0", REG_BINARY, buffer, 0, 0);
360 
361  run_reg_exe("reg add HKEY_CURRENT_USER\\" KEY_BASE " /ve /t REG_BINARY /d deadbeef /f", &r);
362  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
363  dword = 0xefbeadde;
364  verify_reg(hkey, "", REG_BINARY, &dword, sizeof(DWORD), 0);
365 
366  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin1 /f /d 0xDeAdBeEf", &r);
367  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
368  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin2 /f /d x01", &r);
369  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
370  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin3 /f /d 01x", &r);
371  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
372 
373  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin4 /f /d DeAdBeEf0DD", &r);
374  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
375  /* Remaining nibble prefixed */
376  buffer[0] = 0x0d; buffer[1] = 0xea; buffer[2] = 0xdb;
377  buffer[3] = 0xee; buffer[4] = 0xf0; buffer[5] = 0xdd;
378  /* Remaining nibble suffixed on winXP */
379  buffer[6] = 0xde; buffer[7] = 0xad; buffer[8] = 0xbe;
380  buffer[9] = 0xef; buffer[10] = 0x0d; buffer[11] = 0xd0;
381  size = 6;
382  err = RegQueryValueExA(hkey, "bin4", NULL, &type, (void *) (buffer+12), &size);
383  ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
384  ok(type == REG_BINARY, "got wrong type %u\n", type);
385  ok(size == 6, "got wrong size %u\n", size);
386  ok(memcmp(buffer, buffer+12, 6) == 0 ||
387  broken(memcmp(buffer+6, buffer+12, 6) == 0 /* WinXP */), "got wrong data\n");
388 
389  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_BINARY /v bin5 /d \"\" /f", &r);
390  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
391  verify_reg(hkey, "bin5", REG_BINARY, buffer, 0, 0);
392 
393  run_reg_exe("reg add HKCU\\" KEY_BASE " /v bin6 /t REG_BINARY /f /d", &r);
394  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
395 
396  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_BINARY /f", &r);
397  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
398  verify_reg(hkey, NULL, REG_BINARY, buffer, 0, 0);
399 
400  /* REG_DWORD */
401  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /f /d 12345678", &r);
402  ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE /* WinXP */),
403  "got exit code %d, expected 0\n", r);
404  dword = 12345678;
405  if (r == REG_EXIT_SUCCESS)
406  verify_reg(hkey, "", REG_DWORD, &dword, sizeof(dword), 0);
407  else
408  win_skip("broken reg.exe detected\n");
409 
410  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword0 /t REG_DWORD /f /d", &r);
411  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
412  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword1 /t REG_DWORD /f", &r);
413  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
414  "got exit code %d, expected 1\n", r);
415  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword2 /t REG_DWORD /d zzz /f", &r);
416  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
417  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword3 /t REG_DWORD /d deadbeef /f", &r);
418  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
419  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword4 /t REG_DWORD /d 123xyz /f", &r);
420  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
421 
422  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword5 /t reg_dword /d 12345678 /f", &r);
423  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
424  dword = 12345678;
425  verify_reg(hkey, "dword5", REG_DWORD, &dword, sizeof(dword), 0);
426 
427  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword6 /t REG_DWORD /D 0123 /f", &r);
428  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
429  size = sizeof(dword);
430  err = RegQueryValueExA(hkey, "dword6", NULL, &type, (LPBYTE)&dword, &size);
431  ok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
432  ok(type == REG_DWORD, "got wrong type %d, expected %d\n", type, REG_DWORD);
433  ok(size == sizeof(DWORD), "got wrong size %d, expected %d\n", size, (int)sizeof(DWORD));
434  ok(dword == 123 || broken(dword == 0123 /* WinXP */), "got wrong data %d, expected 123\n", dword);
435 
436  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword7 /t reg_dword /d 0xabcdefg /f", &r);
437  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
438 
439  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0xdeadbeef /f", &r);
440  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
441  dword = 0xdeadbeef;
442  verify_reg(hkey, "dword8", REG_DWORD, &dword, sizeof(dword), 0);
443 
444  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword9 /f /d -1", &r);
445  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
446  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_DWORD /v dword10 /f /d -0x1", &r);
447  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
448 
449  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword8 /t REG_dword /d 0x01ffffffff /f", &r);
450  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %d\n", r);
451 
452  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword12 /t REG_DWORD /d 0xffffffff /f", &r);
453  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
454  dword = ~0u;
455  verify_reg(hkey, "dword12", REG_DWORD, &dword, sizeof(dword), 0);
456 
457  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword13 /t REG_DWORD /d 00x123 /f", &r);
458  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
459 
460  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword14 /t REG_DWORD /d 0X123 /f", &r);
461  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
462  dword = 0x123;
463  verify_reg(hkey, "dword14", REG_DWORD, &dword, sizeof(dword), 0);
464 
465  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dword15 /t REG_DWORD /d 4294967296 /f", &r);
466  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
467 
468  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD /f", &r);
469  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
470 
471  /* REG_DWORD_LITTLE_ENDIAN */
472  run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_LE /t REG_DWORD_LITTLE_ENDIAN /d 456 /f", &r);
473  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
474  dword = 456;
475  verify_reg(hkey, "DWORD_LE", REG_DWORD_LITTLE_ENDIAN, &dword, sizeof(dword), 0);
476 
477  /* REG_DWORD_BIG_ENDIAN */
478  run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE /t REG_DWORD_BIG_ENDIAN /d 456 /f", &r);
479  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
480  dword = 456;
481  verify_reg(hkey, "DWORD_BE", REG_DWORD_BIG_ENDIAN, &dword, sizeof(dword), 0);
482  /* REG_DWORD_BIG_ENDIAN is broken in every version of windows. It behaves like
483  * an ordinary REG_DWORD - that is little endian. GG */
484 
485  run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE2 /t REG_DWORD_BIG_ENDIAN /f /d", &r);
486  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
487 
488  run_reg_exe("reg add HKCU\\" KEY_BASE " /v DWORD_BE3 /t REG_DWORD_BIG_ENDIAN /f", &r);
489  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
490 
491  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_DWORD_BIG_ENDIAN /f", &r);
492  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */), "got exit code %u\n", r);
493 
494  /* REG_MULTI_SZ */
495  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi0 /t REG_MULTI_SZ /d \"three\\0little\\0strings\" /f", &r);
496  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
497  memcpy(buffer, "three\0little\0strings\0", 22);
498  verify_reg(hkey, "multi0", REG_MULTI_SZ, buffer, 22, 0);
499 
500  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi1 /s \"#\" /d \"three#little#strings\" /f", &r);
501  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
502  verify_reg(hkey, "multi1", REG_MULTI_SZ, buffer, 22, 0);
503 
504  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi2 /d \"\" /f", &r);
505  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
506  verify_reg(hkey, "multi2", REG_MULTI_SZ, &buffer[21], 1, 0);
507 
508  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi3 /f", &r);
509  ok(r == REG_EXIT_SUCCESS, "got exit code %u\n", r);
510  verify_reg(hkey, "multi3", REG_MULTI_SZ, &buffer[21], 1, 0);
511 
512  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi4 /s \"#\" /d \"threelittlestrings\" /f", &r);
513  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
514  verify_reg(hkey, "multi4", REG_MULTI_SZ, "threelittlestrings\0", 20, 0);
515 
516  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi5 /s \"#randomgibberish\" /d \"three#little#strings\" /f", &r);
517  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
518  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi6 /s \"\\0\" /d \"three\\0little\\0strings\" /f", &r);
519  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
520  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi7 /s \"\" /d \"three#little#strings\" /f", &r);
521  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
522  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi8 /s \"#\" /d \"##\" /f", &r);
523  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
524  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi9 /s \"#\" /d \"two##strings\" /f", &r);
525  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
526  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi10 /s \"#\" /d \"#a\" /f", &r);
527  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
528 
529  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi11 /s \"#\" /d \"a#\" /f", &r);
530  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
531  buffer[0]='a'; buffer[1]=0; buffer[2]=0;
532  verify_reg(hkey, "multi11", REG_MULTI_SZ, buffer, 3, 0);
533 
534  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi12 /t REG_MULTI_SZ /f /d", &r);
535  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
536 
537  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi13 /t REG_MULTI_SZ /f /s", &r);
538  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
539 
540  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi14 /t REG_MULTI_SZ /d \"\\0a\" /f", &r);
541  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
542 
543  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi15 /t REG_MULTI_SZ /d \"a\\0\" /f", &r);
544  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
545  verify_reg(hkey, "multi15", REG_MULTI_SZ, buffer, 3, 0);
546 
547  run_reg_exe("reg add HKCU\\" KEY_BASE " /t REG_MULTI_SZ /v multi16 /d \"two\\0\\0strings\" /f", &r);
548  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
549 
550  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi17 /t REG_MULTI_SZ /s \"#\" /d \"#\" /f", &r);
551  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
552  buffer[0] = 0; buffer[1] = 0;
553  verify_reg(hkey, "multi17", REG_MULTI_SZ, buffer, 2, 0);
554 
555  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi18 /t REG_MULTI_SZ /d \"\\0\" /f", &r);
556  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
557  verify_reg(hkey, "multi18", REG_MULTI_SZ, buffer, 2, 0);
558 
559  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi19 /t REG_MULTI_SZ /s \"#\" /d \"two\\0#strings\" /f", &r);
560  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
561  verify_reg(hkey, "multi19", REG_MULTI_SZ, "two\\0\0strings\0", 15, 0);
562 
563  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi20 /t REG_MULTI_SZ /s \"#\" /d \"two#\\0strings\" /f", &r);
564  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
565  verify_reg(hkey, "multi20", REG_MULTI_SZ, "two\0\\0strings\0", 15, 0);
566 
567  run_reg_exe("reg add HKCU\\" KEY_BASE " /v multi21 /t REG_MULTI_SZ /s \"#\" /d \"two\\0\\0strings\" /f", &r);
568  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
569  verify_reg(hkey, "multi21", REG_MULTI_SZ, "two\\0\\0strings\0", 16, 0);
570 
571  run_reg_exe("reg add HKCU\\" KEY_BASE " /ve /t REG_MULTI_SZ /f", &r);
572  ok(r == REG_EXIT_SUCCESS, "got exit code %u, expected 0\n", r);
573  verify_reg(hkey, NULL, REG_MULTI_SZ, buffer, 1, 0);
574 
575  RegCloseKey(hkey);
576 
577  /* Test duplicate switches */
578  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup1 /t REG_DWORD /d 123 /f /t REG_SZ", &r);
579  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS /* WinXP */),
580  "got exit code %u, expected 1\n", r);
581 
582  run_reg_exe("reg add HKCU\\" KEY_BASE " /v dup2 /t REG_DWORD /d 123 /f /d 456", &r);
583  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
584 
585  /* Test invalid switches */
586  run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid1 /a", &r);
587  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
588 
589  run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid2 /ae", &r);
590  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
591 
592  run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid3 /", &r);
593  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
594 
595  run_reg_exe("reg add HKCU\\" KEY_BASE " /v invalid4 -", &r);
596  ok(r == REG_EXIT_FAILURE, "got exit code %u, expected 1\n", r);
597 
599 }
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble * u
Definition: glfuncs.h:240
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define verify_key(k, s)
Definition: reg.c:107
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define verify_reg(k, v, t, d, s, todo)
Definition: reg.c:62
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
#define verify_key_nonexist(k, s)
Definition: reg.c:120
#define open_key(b, p, s, k)
Definition: reg.c:98
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
unsigned char * LPBYTE
Definition: typedefs.h:52
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define run_reg_exe(c, r)
Definition: reg.c:32
GLsizeiptr size
Definition: glext.h:5919
#define KEY_BASE
Definition: reg.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define delete_key(k, p)
Definition: reg.c:144
#define REG_DWORD_LITTLE_ENDIAN
Definition: nt_native.h:1498
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define err(...)
#define REG_EXIT_FAILURE
Definition: reg.c:26
#define broken(x)
Definition: _sntprintf.h:21
#define REG_DWORD_BIG_ENDIAN
Definition: nt_native.h:1499
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define REG_EXIT_SUCCESS
Definition: reg.c:25
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define ok(value,...)
Definition: atltest.h:57
#define REG_NONE
Definition: nt_native.h:1492
#define REG_DWORD
Definition: sdbapi.c:596
#define win_skip
Definition: test.h:150
DWORD type
Definition: reg.c:66
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_delete()

static void test_delete ( void  )
static

Definition at line 601 of file reg.c.

602 {
603  HKEY hkey, hsubkey;
604  LONG err;
605  DWORD r;
606  const DWORD deadbeef = 0xdeadbeef;
607 
609  ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
610 
611  run_reg_exe("reg delete", &r);
612  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
613 
614  run_reg_exe("reg delete /?", &r);
615  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
616 
617  run_reg_exe("reg delete /h", &r);
618  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
619 
620  run_reg_exe("reg delete -H", &r);
621  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
622 
624  add_value(hkey, "foo", REG_DWORD, &deadbeef, sizeof(deadbeef));
625  add_value(hkey, "bar", REG_DWORD, &deadbeef, sizeof(deadbeef));
626  add_value(hkey, NULL, REG_DWORD, &deadbeef, sizeof(deadbeef));
627 
628  add_key(hkey, "subkey", &hsubkey);
629  RegCloseKey(hsubkey);
630 
631  run_reg_exe("reg delete HKCU\\" KEY_BASE " /v bar /f", &r);
632  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
633  verify_reg_nonexist(hkey, "bar");
634 
635  run_reg_exe("reg delete HKCU\\" KEY_BASE " /ve /f", &r);
636  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
637  verify_reg_nonexist(hkey, "");
638 
639  run_reg_exe("reg delete HKCU\\" KEY_BASE " /va /f", &r);
640  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
641  verify_reg_nonexist(hkey, "foo");
642  verify_key(hkey, "subkey");
643 
644  RegCloseKey(hkey);
645 
646  run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r);
647  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
649 
650  run_reg_exe("reg delete HKCU\\" KEY_BASE " /f", &r);
651  ok(r == REG_EXIT_FAILURE, "got exit code %u\n", r);
652 }
#define verify_key(k, s)
Definition: reg.c:107
#define ERROR_SUCCESS
Definition: deptool.c:10
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define verify_reg_nonexist(k, v)
Definition: reg.c:88
#define verify_key_nonexist(k, s)
Definition: reg.c:120
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define run_reg_exe(c, r)
Definition: reg.c:32
#define add_value(k, n, t, d, s)
Definition: reg.c:198
#define KEY_BASE
Definition: reg.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define err(...)
#define REG_EXIT_FAILURE
Definition: reg.c:26
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define REG_EXIT_SUCCESS
Definition: reg.c:25
#define ok(value,...)
Definition: atltest.h:57
#define add_key(k, p, s)
Definition: reg.c:134
#define REG_DWORD
Definition: sdbapi.c:596

Referenced by START_TEST().

◆ test_export()

static void test_export ( void  )
static

Definition at line 4362 of file reg.c.

4363 {
4364  LONG err;
4365  DWORD r, dword, type, size;
4366  HKEY hkey, subkey;
4367  BYTE hex[4], buffer[8];
4368 
4369  const char *empty_key_test =
4370  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4371  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n";
4372 
4373  const char *simple_test =
4374  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4375  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4376  "\"DWORD\"=dword:00000100\r\n"
4377  "\"String\"=\"Your text here...\"\r\n\r\n";
4378 
4379  const char *complex_test =
4380  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4381  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4382  "\"DWORD\"=dword:00000100\r\n"
4383  "\"String\"=\"Your text here...\"\r\n\r\n"
4384  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n"
4385  "\"Binary\"=hex:11,22,33,44\r\n"
4386  "\"Undefined hex\"=hex(100):25,50,41,54,48,25,00\r\n\r\n"
4387  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\r\n"
4388  "\"double\\\"quote\"=\"\\\"Hello, World!\\\"\"\r\n"
4389  "\"single'quote\"=dword:00000008\r\n\r\n"
4390  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a\\Subkey2b]\r\n"
4391  "@=\"Default value name\"\r\n"
4392  "\"Multiple strings\"=hex(7):4c,00,69,00,6e,00,65,00,31,00,00,00,4c,00,69,00,6e,\\\r\n"
4393  " 00,65,00,32,00,00,00,4c,00,69,00,6e,00,65,00,33,00,00,00,00,00\r\n\r\n"
4394  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a]\r\n"
4395  "\"Backslash\"=\"Use \\\\\\\\ to escape a backslash\"\r\n\r\n"
4396  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b]\r\n\r\n"
4397  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey3a\\Subkey3b\\Subkey3c]\r\n"
4398  "\"String expansion\"=hex(2):25,00,48,00,4f,00,4d,00,45,00,25,00,5c,00,25,00,50,\\\r\n"
4399  " 00,41,00,54,00,48,00,25,00,00,00\r\n"
4400  "\"Zero data type\"=hex(0):56,61,6c,75,65,00\r\n\r\n"
4401  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4]\r\n"
4402  "@=dword:12345678\r\n"
4403  "\"43981\"=hex(abcd):56,61,6c,75,65,00\r\n\r\n";
4404 
4405  const char *key_order_test =
4406  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4407  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n\r\n"
4408  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\r\n\r\n"
4409  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\r\n\r\n";
4410 
4411  const char *value_order_test =
4412  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4413  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4414  "\"Value 2\"=\"I was added first!\"\r\n"
4415  "\"Value 1\"=\"I was added second!\"\r\n\r\n";
4416 
4417  const char *empty_hex_test =
4418  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4419  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4420  "\"Wine1a\"=hex(0):\r\n"
4421  "\"Wine1b\"=\"\"\r\n"
4422  "\"Wine1c\"=hex(2):\r\n"
4423  "\"Wine1d\"=hex:\r\n"
4424  "\"Wine1e\"=hex(4):\r\n"
4425  "\"Wine1f\"=hex(7):\r\n"
4426  "\"Wine1g\"=hex(100):\r\n"
4427  "\"Wine1h\"=hex(abcd):\r\n\r\n";
4428 
4429  const char *empty_hex_test2 =
4430  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4431  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4432  "\"Wine2a\"=\"\"\r\n"
4433  "\"Wine2b\"=hex:\r\n"
4434  "\"Wine2c\"=hex(4):\r\n\r\n";
4435 
4436  const char *hex_types_test =
4437  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4438  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4439  "\"Wine3a\"=\"Value\"\r\n"
4440  "\"Wine3b\"=hex:12,34,56,78\r\n"
4441  "\"Wine3c\"=dword:10203040\r\n\r\n";
4442 
4443  const char *embedded_null_test =
4444  "\xef\xbb\xbfWindows Registry Editor Version 5.00\r\n\r\n"
4445  "[HKEY_CURRENT_USER\\" KEY_BASE "]\r\n"
4446  "\"Wine4a\"=dword:00000005\r\n"
4447  "\"Wine4b\"=\"\"\r\n"
4448  "\"Wine4c\"=\"Value\"\r\n"
4449  "\"Wine4d\"=\"\"\r\n"
4450  "\"Wine4e\"=dword:00000100\r\n"
4451  "\"Wine4f\"=\"\"\r\n"
4452  "\"Wine4g\"=\"Value2\"\r\n"
4453  "\"Wine4h\"=\"abc\"\r\n\r\n";
4454 
4456  ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
4457 
4458  run_reg_exe("reg export", &r);
4459  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4460 
4461  run_reg_exe("reg export /?", &r);
4462  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4463 
4464  run_reg_exe("reg export /h", &r);
4465  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4466 
4467  run_reg_exe("reg export -H", &r);
4468  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4469 
4470  run_reg_exe("reg export \\\\remote-pc\\HKLM\\Wine file.reg", &r);
4471  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4472 
4473  run_reg_exe("reg export HKEY_DYN_DATA file.reg", &r);
4474  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4475 
4476  run_reg_exe("reg export HKDD file.reg", &r);
4477  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4478 
4479  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r);
4480  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4481 
4482  run_reg_exe("reg export file.reg", &r);
4483  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4484 
4485  run_reg_exe("reg export file.reg HKEY_CURRENT_USER\\" KEY_BASE, &r);
4486  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4487 
4488  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE, &r);
4489  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4490 
4491  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4492  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4493 
4494  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg file2.reg", &r);
4495  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4496 
4497  /* Test registry export with an empty key */
4499 
4500  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4501  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4502 
4503  run_reg_exe("reg export /y HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4504  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4505 
4506  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " /y file.reg", &r);
4507  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
4508 
4509  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg /y", &r);
4510  ok(r == REG_EXIT_SUCCESS || broken(r == REG_EXIT_FAILURE), /* winxp */
4511  "got exit code %d, expected 0\n", r);
4512 
4513  ok(compare_export("file.reg", empty_key_test, 0), "compare_export() failed\n");
4514 
4515  /* Test registry export with a simple data structure */
4516  dword = 0x100;
4517  add_value(hkey, "DWORD", REG_DWORD, &dword, sizeof(dword));
4518  add_value(hkey, "String", REG_SZ, "Your text here...", 18);
4519 
4520  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4521  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4522  ok(compare_export("file.reg", simple_test, 0), "compare_export() failed\n");
4523 
4524  /* Test registry export with a complex data structure */
4525  add_key(hkey, "Subkey1", &subkey);
4526  add_value(subkey, "Binary", REG_BINARY, "\x11\x22\x33\x44", 4);
4527  add_value(subkey, "Undefined hex", 0x100, "%PATH%", 7);
4528  RegCloseKey(subkey);
4529 
4530  add_key(hkey, "Subkey2a", &subkey);
4531  add_value(subkey, "double\"quote", REG_SZ, "\"Hello, World!\"", 16);
4532  dword = 0x8;
4533  add_value(subkey, "single'quote", REG_DWORD, &dword, sizeof(dword));
4534  RegCloseKey(subkey);
4535 
4536  add_key(hkey, "Subkey2a\\Subkey2b", &subkey);
4537  add_value(subkey, NULL, REG_SZ, "Default value name", 19);
4538  add_value(subkey, "Multiple strings", REG_MULTI_SZ, "Line1\0Line2\0Line3\0", 19);
4539  RegCloseKey(subkey);
4540 
4541  add_key(hkey, "Subkey3a", &subkey);
4542  add_value(subkey, "Backslash", REG_SZ, "Use \\\\ to escape a backslash", 29);
4543  RegCloseKey(subkey);
4544 
4545  add_key(hkey, "Subkey3a\\Subkey3b\\Subkey3c", &subkey);
4546  add_value(subkey, "String expansion", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14);
4547  add_value(subkey, "Zero data type", REG_NONE, "Value", 6);
4548  RegCloseKey(subkey);
4549 
4550  add_key(hkey, "Subkey4", &subkey);
4551  dword = 0x12345678;
4552  add_value(subkey, NULL, REG_DWORD, &dword, sizeof(dword));
4553  add_value(subkey, "43981", 0xabcd, "Value", 6);
4554  RegCloseKey(subkey);
4555 
4556  RegCloseKey(hkey);
4557 
4558  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4559  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4560  ok(compare_export("file.reg", complex_test, 0), "compare_export() failed\n");
4561 
4563  ok(err == ERROR_SUCCESS, "delete_tree() failed: %d\n", err);
4564 
4565  /* Test the export order of registry keys */
4567  add_key(hkey, "Subkey2", &subkey);
4568  RegCloseKey(subkey);
4569  add_key(hkey, "Subkey1", &subkey);
4570  RegCloseKey(subkey);
4571 
4572  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4573  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4574  ok(compare_export("file.reg", key_order_test, 0), "compare_export() failed\n");
4575 
4576  delete_key(hkey, "Subkey1");
4577  delete_key(hkey, "Subkey2");
4578 
4579  /* Test the export order of registry values. Windows exports registry values
4580  * in order of creation; Wine uses alphabetical order.
4581  */
4582  add_value(hkey, "Value 2", REG_SZ, "I was added first!", 19);
4583  add_value(hkey, "Value 1", REG_SZ, "I was added second!", 20);
4584 
4585  RegCloseKey(hkey);
4586 
4587  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4588  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4589  ok(compare_export("file.reg", value_order_test, TODO_REG_COMPARE), "compare_export() failed\n");
4590 
4592 
4593  /* Test registry export with empty hex data */
4595  add_value(hkey, "Wine1a", REG_NONE, NULL, 0);
4596  add_value(hkey, "Wine1b", REG_SZ, NULL, 0);
4597  add_value(hkey, "Wine1c", REG_EXPAND_SZ, NULL, 0);
4598  add_value(hkey, "Wine1d", REG_BINARY, NULL, 0);
4599  add_value(hkey, "Wine1e", REG_DWORD, NULL, 0);
4600  add_value(hkey, "Wine1f", REG_MULTI_SZ, NULL, 0);
4601  add_value(hkey, "Wine1g", 0x100, NULL, 0);
4602  add_value(hkey, "Wine1h", 0xabcd, NULL, 0);
4603  RegCloseKey(hkey);
4604 
4605  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4606  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4607  ok(compare_export("file.reg", empty_hex_test, 0), "compare_export() failed\n");
4608 
4610 
4611  /* Test registry export after importing alternative registry data types */
4612  test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
4613  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
4614  "\"Wine2a\"=hex(1):\n"
4615  "\"Wine2b\"=hex(3):\n"
4616  "\"Wine2c\"=hex(4):\n\n", &r);
4617  open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
4618  verify_reg(hkey, "Wine2a", REG_SZ, NULL, 0, 0);
4619  verify_reg(hkey, "Wine2b", REG_BINARY, NULL, 0, 0);
4620  verify_reg(hkey, "Wine2c", REG_DWORD, NULL, 0, 0);
4621  RegCloseKey(hkey);
4622 
4623  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4624  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4625  ok(compare_export("file.reg", empty_hex_test2, 0), "compare_export() failed\n");
4626 
4628 
4629  test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
4630  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
4631  "\"Wine3a\"=hex(1):56,00,61,00,6c,00,75,00,65,00,00,00\n"
4632  "\"Wine3b\"=hex(3):12,34,56,78\n"
4633  "\"Wine3c\"=hex(4):40,30,20,10\n\n", &r);
4634  open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
4635  verify_reg(hkey, "Wine3a", REG_SZ, "Value", 6, 0);
4636  memcpy(hex, "\x12\x34\x56\x78", 4);
4637  verify_reg(hkey, "Wine3b", REG_BINARY, hex, 4, 0);
4638  dword = 0x10203040;
4639  verify_reg(hkey, "Wine3c", REG_DWORD, &dword, sizeof(dword), 0);
4640  RegCloseKey(hkey);
4641 
4642  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4643  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4644  ok(compare_export("file.reg", hex_types_test, 0), "compare_export() failed\n");
4645 
4647 
4648  /* Test registry export with embedded null characters */
4649  test_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
4650  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
4651  "\"Wine4a\"=dword:00000005\n"
4652  "\"Wine4b\"=hex(1):00,00,00,00,00,00,00,00\n"
4653  "\"Wine4c\"=\"Value\"\n"
4654  "\"Wine4d\"=hex(1):00,00,61,00,62,00,63,00\n"
4655  "\"Wine4e\"=dword:00000100\n"
4656  "\"Wine4f\"=hex(1):00,00,56,00,61,00,6c,00,75,00,65,00,00,00\n"
4657  "\"Wine4g\"=\"Value2\"\n"
4658  "\"Wine4h\"=hex(1):61,00,62,00,63,00,00,00, \\\n"
4659  " 64,00,65,00,66,00,00,00\n\n", &r);
4660  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4661  open_key(HKEY_CURRENT_USER, KEY_BASE, 0, &hkey);
4662  dword = 0x5;
4663  verify_reg(hkey, "Wine4a", REG_DWORD, &dword, sizeof(dword), 0);
4664  verify_reg(hkey, "Wine4b", REG_SZ, "\0\0\0\0\0\0\0", 4, 0);
4665  verify_reg(hkey, "Wine4c", REG_SZ, "Value", 6, 0);
4666  /* Wine4d */
4667  size = sizeof(buffer);
4668  err = RegQueryValueExA(hkey, "Wine4d", NULL, &type, (BYTE *)&buffer, &size);
4669  ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
4670  ok(type == REG_SZ, "got wrong type %u, expected %u\n", type, REG_SZ);
4671  ok(size == 5 || broken(size == 4) /* WinXP */, "got wrong size %u, expected 5\n", size);
4672  ok(memcmp(buffer, "\0abc", size) == 0, "got wrong data\n");
4673  dword = 0x100;
4674  verify_reg(hkey, "Wine4e", REG_DWORD, &dword, sizeof(dword), 0);
4675  verify_reg(hkey, "Wine4f", REG_SZ, "\0Value", 7, 0);
4676  verify_reg(hkey, "Wine4g", REG_SZ, "Value2", 7, 0);
4677  verify_reg(hkey, "Wine4h", REG_SZ, "abc\0def", 8, 0);
4678  RegCloseKey(hkey);
4679 
4680  run_reg_exe("reg export HKEY_CURRENT_USER\\" KEY_BASE " file.reg", &r);
4681  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4682  ok(compare_export("file.reg", embedded_null_test, 0), "compare_export() failed\n");
4683 
4685 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
#define REG_BINARY
Definition: nt_native.h:1496
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define verify_reg(k, v, t, d, s, todo)
Definition: reg.c:62
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
static const char hex[16]
Definition: profile.c:123
#define TODO_REG_COMPARE
Definition: reg.c:30
#define open_key(b, p, s, k)
Definition: reg.c:98
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
#define test_import_wstr(c, r)
Definition: reg.c:819
#define compare_export(f, e, todo)
Definition: reg.c:4317
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define run_reg_exe(c, r)
Definition: reg.c:32
GLsizeiptr size
Definition: glext.h:5919
#define add_value(k, n, t, d, s)
Definition: reg.c:198
#define KEY_BASE
Definition: reg.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define delete_key(k, p)
Definition: reg.c:144
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
unsigned char BYTE
Definition: mem.h:68
#define err(...)
#define REG_EXIT_FAILURE
Definition: reg.c:26
#define broken(x)
Definition: _sntprintf.h:21
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define REG_EXIT_SUCCESS
Definition: reg.c:25
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define ok(value,...)
Definition: atltest.h:57
#define add_key(k, p, s)
Definition: reg.c:134
#define REG_NONE
Definition: nt_native.h:1492
static LONG delete_tree(const HKEY key, const char *subkey)
Definition: reg.c:156
#define REG_DWORD
Definition: sdbapi.c:596
DWORD type
Definition: reg.c:66
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_import()

static void test_import ( void  )
static

Definition at line 852 of file reg.c.

853 {
854  DWORD r, dword = 0x123, type, size;
855  char buffer[24];
856  HKEY hkey, subkey = NULL;
857  LONG err;
858  BYTE hex[8];
859 
861  ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "got %d\n", err);
862 
863  run_reg_exe("reg import", &r);
864  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
865 
866  run_reg_exe("reg import /?", &r);
867  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
868 
869  run_reg_exe("reg import /h", &r);
870  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
871 
872  run_reg_exe("reg import -H", &r);
873  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
874 
875  run_reg_exe("reg import missing.reg", &r);
876  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
877 
878  run_reg_exe("reg import a.reg b.reg", &r);
879  ok(r == REG_EXIT_FAILURE, "got exit code %d, expected 1\n", r);
880 
881  /* Test file contents */
882  test_import_str("regedit\n", &r);
883  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
884  "got exit code %d, expected 1\n", r);
885 
886  test_import_str("regedit4\n", &r);
887  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
888  "got exit code %d, expected 1\n", r);
889 
890  test_import_str("REGEDIT", &r);
891  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
892 
893  test_import_str("REGEDIT\n", &r);
894  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
895 
896  test_import_str("REGEDIT4\n", &r);
897  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
898 
899  test_import_str(" REGEDIT4\n", &r);
900  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
901 
902  test_import_str("\tREGEDIT4\n", &r);
903  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
904 
905  test_import_str("\nREGEDIT4\n", &r);
906  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
907  "got exit code %d, expected 1\n", r);
908 
909  test_import_str("AREGEDIT4\n", &r);
910  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
911  "got exit code %d, expected 1\n", r);
912 
913  test_import_str("1REGEDIT4\n", &r);
914  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
915  "got exit code %d, expected 1\n", r);
916 
917  test_import_str("REGEDIT3\n", &r);
918  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
919 
920  test_import_str("REGEDIT5\n", &r);
921  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
922 
923  test_import_str("REGEDIT9\n", &r);
924  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
925 
926  test_import_str("REGEDIT 4\n", &r);
927  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
928 
929  test_import_str("REGEDIT4 FOO\n", &r);
930  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
931 
932  test_import_str("REGEDIT4\n"
933  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n", &r);
934  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
935 
937 
938  test_import_str("REGEDIT4\n"
939  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
940  "\"Wine\"=dword:00000123\n\n", &r);
941  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
942  verify_reg(hkey, "Wine", REG_DWORD, &dword, sizeof(dword), 0);
943 
944  test_import_str("REGEDIT4\n"
945  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
946  "@=\"Test string\"\n\n", &r);
947  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
948  verify_reg(hkey, NULL, REG_SZ, "Test string", 12, 0);
949 
950  test_import_str("REGEDIT3\n\n"
951  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
952  "\"Test1\"=\"Value\"\n", &r);
953  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
954  verify_reg_nonexist(hkey, "Test1");
955 
956  test_import_str("regedit4\n\n"
957  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
958  "\"Test2\"=\"Value\"\n", &r);
959  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
960  "got exit code %d, expected 1\n", r);
961  verify_reg_nonexist(hkey, "Test2");
962 
963  test_import_str("Regedit4\n\n"
964  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
965  "\"Test3\"=\"Value\"\n", &r);
966  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
967  "got exit code %d, expected 1\n", r);
968  verify_reg_nonexist(hkey, "Test3");
969 
970  test_import_str("REGEDIT 4\n\n"
971  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
972  "\"Test4\"=\"Value\"\n", &r);
973  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
974  verify_reg_nonexist(hkey, "Test4");
975 
976  test_import_str("REGEDIT4FOO\n\n"
977  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
978  "\"Test5\"=\"Value\"\n", &r);
979  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
980  verify_reg_nonexist(hkey, "Test5");
981 
982  test_import_str("REGEDIT4 FOO\n\n"
983  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
984  "\"Test6\"=\"Value\"\n", &r);
985  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
986  verify_reg_nonexist(hkey, "Test6");
987 
988  test_import_str("REGEDIT5\n\n"
989  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
990  "\"Test7\"=\"Value\"\n", &r);
991  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
992  verify_reg_nonexist(hkey, "Test7");
993 
994  test_import_str("REGEDIT9\n\n"
995  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
996  "\"Test8\"=\"Value\"\n", &r);
997  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
998  verify_reg_nonexist(hkey, "Test8");
999 
1000  test_import_str("Windows Registry Editor Version 4.00\n\n"
1001  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1002  "\"Test9\"=\"Value\"\n", &r);
1003  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1004  "got exit code %d, expected 1\n", r);
1005  verify_reg_nonexist(hkey, "Test9");
1006 
1007  test_import_str("Windows Registry Editor Version 5\n\n"
1008  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1009  "\"Test10\"=\"Value\"\n", &r);
1010  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1011  "got exit code %d, expected 1\n", r);
1012  verify_reg_nonexist(hkey, "Test10");
1013 
1014  test_import_str("WINDOWS REGISTRY EDITOR VERSION 5.00\n\n"
1015  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1016  "\"Test11\"=\"Value\"\n", &r);
1017  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1018  "got exit code %d, expected 1\n", r);
1019  verify_reg_nonexist(hkey, "Test11");
1020 
1021  test_import_str("Windows Registry Editor version 5.00\n\n"
1022  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1023  "\"Test12\"=\"Value\"\n", &r);
1024  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1025  "got exit code %d, expected 1\n", r);
1026  verify_reg_nonexist(hkey, "Test12");
1027 
1028  test_import_str("REGEDIT4\n"
1029  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1030  "\"Test1\"=\"Value1\"\n", &r);
1031  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1032  verify_reg(hkey, "Test1", REG_SZ, "Value1", 7, 0);
1033 
1034  test_import_str("REGEDIT4\n"
1035  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1036  "\"Test2\"=\"Value2\"\n\n", &r);
1037  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1038  verify_reg(hkey, "Test2", REG_SZ, "Value2", 7, 0);
1039 
1040  test_import_str("REGEDIT4\n\n"
1041  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1042  "\"Test3\"=\"Value3\"\n\n", &r);
1043  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1044  verify_reg(hkey, "Test3", REG_SZ, "Value3", 7, 0);
1045 
1046  test_import_str("Windows Registry Editor Version 4.00\n", &r);
1047  ok(r == REG_EXIT_FAILURE || broken(r == REG_EXIT_SUCCESS) /* WinXP */,
1048  "got exit code %d, expected 1\n", r);
1049 
1050  test_import_str("Windows Registry Editor Version 5.00\n", &r);
1051  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1052 
1053  test_import_str("Windows Registry Editor Version 5.00\n"
1054  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1055  "\"Test4\"=\"Value4\"\n", &r);
1056  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1057  verify_reg(hkey, "Test4", REG_SZ, "Value4", 7, 0);
1058 
1059  test_import_str("Windows Registry Editor Version 5.00\n"
1060  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1061  "\"Test5\"=\"Value5\"\n\n", &r);
1062  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1063  verify_reg(hkey, "Test5", REG_SZ, "Value5", 7, 0);
1064 
1065  test_import_str("Windows Registry Editor Version 5.00\n\n"
1066  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1067  "\"Test6\"=\"Value6\"\n\n", &r);
1068  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1069  verify_reg(hkey, "Test6", REG_SZ, "Value6", 7, 0);
1070 
1071  test_import_str("REGEDIT4\n\n"
1072  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1073  "\"Line1\"=\"Value1\"\n\n"
1074  "\"Line2\"=\"Value2\"\n\n\n"
1075  "\"Line3\"=\"Value3\"\n\n\n\n"
1076  "\"Line4\"=\"Value4\"\n\n", &r);
1077  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1078  verify_reg(hkey, "Line1", REG_SZ, "Value1", 7, 0);
1079  verify_reg(hkey, "Line2", REG_SZ, "Value2", 7, 0);
1080  verify_reg(hkey, "Line3", REG_SZ, "Value3", 7, 0);
1081  verify_reg(hkey, "Line4", REG_SZ, "Value4", 7, 0);
1082 
1083  test_import_str("REGEDIT4\n\n"
1084  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1085  "\"Wine1\"=dword:00000782\n\n"
1086  "\"Wine2\"=\"Test Value\"\n"
1087  "\"Wine3\"=hex(7):4c,69,6e,65,20,\\\n"
1088  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1089  "#comment\n"
1090  "@=\"Test\"\n"
1091  ";comment\n\n"
1092  "\"Wine4\"=dword:12345678\n\n", &r);
1093  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1094  dword = 0x782;
1095  verify_reg(hkey, "Wine1", REG_DWORD, &dword, sizeof(dword), 0);
1096  verify_reg(hkey, "Wine2", REG_SZ, "Test Value", 11, 0);
1097  verify_reg(hkey, "Wine3", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1098  verify_reg(hkey, "", REG_SZ, "Test", 5, 0);
1099  dword = 0x12345678;
1100  verify_reg(hkey, "Wine4", REG_DWORD, &dword, sizeof(dword), 0);
1101 
1102  test_import_str("REGEDIT4\n\n"
1103  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1104  "\"Wine5\"=\"No newline\"", &r);
1105  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1106  err = RegQueryValueExA(hkey, "Wine5", NULL, NULL, NULL, NULL);
1107  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
1108  "got %d, expected 0\n", err);
1109  if (err == ERROR_SUCCESS)
1110  verify_reg(hkey, "Wine5", REG_SZ, "No newline", 11, 0);
1111 
1112  test_import_str("REGEDIT4\n\n"
1113  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1114  "\"Wine6\"=dword:00000050\n\n"
1115  "\"Wine7\"=\"No newline\"", &r);
1116  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1117  dword = 0x50;
1118  verify_reg(hkey, "Wine6", REG_DWORD, &dword, sizeof(dword), 0);
1119  err = RegQueryValueExA(hkey, "Wine7", NULL, NULL, NULL, NULL);
1120  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND /* WinXP */),
1121  "got %d, expected 0\n", err);
1122  if (err == ERROR_SUCCESS)
1123  verify_reg(hkey, "Wine7", REG_SZ, "No newline", 11, 0);
1124 
1125  test_import_str("REGEDIT4\n\n"
1126  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1127  "#comment\\\n"
1128  "\"Wine8\"=\"Line 1\"\n"
1129  ";comment\\\n"
1130  "\"Wine9\"=\"Line 2\"\n\n", &r);
1131  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1132  verify_reg(hkey, "Wine8", REG_SZ, "Line 1", 7, 0);
1133  verify_reg(hkey, "Wine9", REG_SZ, "Line 2", 7, 0);
1134 
1135  test_import_str("REGEDIT4\n\n"
1136  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1137  "\"Wine10\"=\"Value 1\"#comment\n"
1138  "\"Wine11\"=\"Value 2\";comment\n"
1139  "\"Wine12\"=dword:01020304 #comment\n"
1140  "\"Wine13\"=dword:02040608 ;comment\n\n", &r);
1141  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1142  verify_reg_nonexist(hkey, "Wine10");
1143  verify_reg(hkey, "Wine11", REG_SZ, "Value 2", 8, 0);
1144  verify_reg_nonexist(hkey, "Wine12");
1145  dword = 0x2040608;
1146  verify_reg(hkey, "Wine13", REG_DWORD, &dword, sizeof(dword), 0);
1147 
1148  test_import_str("REGEDIT4\n\n"
1149  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1150  "\"Wine14\"=hex(7):4c,69,6e,65,20,\\\n"
1151  " #comment\n"
1152  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1153  "\"Wine15\"=\"A valid line\"\n"
1154  "\"Wine16\"=hex(7):4c,69,6e,65,20,\\\n"
1155  " ;comment\n"
1156  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1157  "\"Wine17\"=\"Another valid line\"\n\n", &r);
1158  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1159  verify_reg_nonexist(hkey, "Wine14");
1160  verify_reg(hkey, "Wine15", REG_SZ, "A valid line", 13, 0);
1161  verify_reg(hkey, "Wine16", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1162  verify_reg(hkey, "Wine17", REG_SZ, "Another valid line", 19, 0);
1163 
1164  test_import_str("REGEDIT4\n\n"
1165  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1166  "#\"Comment1\"=\"Value 1\"\n"
1167  ";\"Comment2\"=\"Value 2\"\n"
1168  " #\"Comment3\"=\"Value 3\"\n"
1169  " ;\"Comment4\"=\"Value 4\"\n"
1170  "\"Wine18\"=\"Value 6\"#\"Comment5\"=\"Value 5\"\n"
1171  "\"Wine19\"=\"Value 7\";\"Comment6\"=\"Value 6\"\n\n", &r);
1172  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1173  verify_reg_nonexist(hkey, "Comment1");
1174  verify_reg_nonexist(hkey, "Comment2");
1175  verify_reg_nonexist(hkey, "Comment3");
1176  verify_reg_nonexist(hkey, "Comment4");
1177  verify_reg_nonexist(hkey, "Wine18");
1178  verify_reg_nonexist(hkey, "Comment5");
1179  verify_reg(hkey, "Wine19", REG_SZ, "Value 7", 8, 0);
1180  verify_reg_nonexist(hkey, "Comment6");
1181 
1182  test_import_str("REGEDIT4\n\n"
1183  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1184  "\"Wine20\"=#\"Value 8\"\n"
1185  "\"Wine21\"=;\"Value 9\"\n"
1186  "\"Wine22\"=\"#comment1\"\n"
1187  "\"Wine23\"=\";comment2\"\n"
1188  "\"Wine24\"=\"Value#comment3\"\n"
1189  "\"Wine25\"=\"Value;comment4\"\n"
1190  "\"Wine26\"=\"Value #comment5\"\n"
1191  "\"Wine27\"=\"Value ;comment6\"\n"
1192  "\"Wine28\"=#dword:00000001\n"
1193  "\"Wine29\"=;dword:00000002\n"
1194  "\"Wine30\"=dword:00000003#comment\n"
1195  "\"Wine31\"=dword:00000004;comment\n\n", &r);
1196  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1197  verify_reg_nonexist(hkey, "Wine20");
1198  verify_reg_nonexist(hkey, "Wine21");
1199  verify_reg(hkey, "Wine22", REG_SZ, "#comment1", 10, 0);
1200  verify_reg(hkey, "Wine23", REG_SZ, ";comment2", 10, 0);
1201  verify_reg(hkey, "Wine24", REG_SZ, "Value#comment3", 15, 0);
1202  verify_reg(hkey, "Wine25", REG_SZ, "Value;comment4", 15, 0);
1203  verify_reg(hkey, "Wine26", REG_SZ, "Value #comment5", 16, 0);
1204  verify_reg(hkey, "Wine27", REG_SZ, "Value ;comment6", 16, 0);
1205  verify_reg_nonexist(hkey, "Wine28");
1206  verify_reg_nonexist(hkey, "Wine29");
1207  verify_reg_nonexist(hkey, "Wine30");
1208  dword = 0x00000004;
1209  verify_reg(hkey, "Wine31", REG_DWORD, &dword, sizeof(dword), 0);
1210 
1211  test_import_str("REGEDIT4\n\n"
1212  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1213  "\"Multi-Line1\"=hex(7):4c,69,6e,65,20,\\\n"
1214  " 63,6f,6e,\\;comment\n"
1215  " 63,61,74,\\;comment\n"
1216  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1217  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1218  verify_reg(hkey, "Multi-Line1", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1219 
1220  test_import_str("REGEDIT4\n\n"
1221  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1222  "\"Multi-Line2\"=hex(7):4c,69,6e,65,20,\\\n"
1223  " 63,6f,6e,\\;comment\n"
1224  " 63,61,74,;comment\n"
1225  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1226  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1227  verify_reg(hkey, "Multi-Line2", REG_MULTI_SZ, "Line concat", 12, 0);
1228 
1229  test_import_str("REGEDIT4\n\n"
1230  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1231  "\"Multi-Line3\"=hex(7):4c,69,6e,65,20\\\n"
1232  ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1233  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1234  verify_reg_nonexist(hkey, "Multi-Line3");
1235 
1236  test_import_str("REGEDIT4\n\n"
1237  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1238  "\"Multi-Line4\"=hex(7):4c,69,6e,65,20\\\n"
1239  " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1240  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1241  verify_reg_nonexist(hkey, "Multi-Line4");
1242 
1243  test_import_str("Windows Registry Editor Version 5.00\n\n"
1244  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1245  "\"Multi-Line5\"=hex(7):4c,69,6e,65,20\\\n"
1246  ",63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1247  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1248  verify_reg_nonexist(hkey, "Multi-Line5");
1249 
1250  test_import_str("Windows Registry Editor Version 5.00\n\n"
1251  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1252  "\"Multi-Line6\"=hex(7):4c,69,6e,65,20\\\n"
1253  " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1254  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1255  verify_reg_nonexist(hkey, "Multi-Line6");
1256 
1257  test_import_str("REGEDIT4\n\n"
1258  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1259  "\"Multi-Line7\"=hex(7):4c,69,6e,\\;comment\n"
1260  " 65,20,\\;comment\n"
1261  " 63,6f,6e,\\;comment\n"
1262  " 63,61,74,\\;comment\n"
1263  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1264  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1265  verify_reg(hkey, "Multi-Line7", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1266 
1267  test_import_str("REGEDIT4\n\n"
1268  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1269  "\"Multi-Line8\"=hex(7):4c,69,6e,\\;#comment\n"
1270  " 65,20,\\;#comment\n"
1271  " 63,6f,6e,\\;#comment\n"
1272  " 63,61,74,\\;#comment\n"
1273  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1274  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1275  verify_reg(hkey, "Multi-Line8", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1276 
1277  test_import_str("REGEDIT4\n\n"
1278  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1279  "\"Multi-Line9\"=hex(7):4c,69,6e,\\;comment\n"
1280  " 65,20,\\;comment\n"
1281  " 63,6f,6e,\\;comment\n"
1282  " 63,61,74,\\#comment\n"
1283  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1284  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1285  verify_reg_nonexist(hkey, "Multi-Line9");
1286 
1287  test_import_str("REGEDIT4\n\n"
1288  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1289  "\"Multi-Line10\"=hex(7):4c,69,6e,65,20,\\\n"
1290  " 63,6f,6e,\\;comment\n"
1291  " 63,61,74,\\\n\n"
1292  " 65,6e,\\;comment\n\n"
1293  " 61,74,69,6f,6e,00,00\n\n", &r);
1294  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1295  verify_reg(hkey, "Multi-Line10", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1296 
1297  test_import_str("REGEDIT4\n\n"
1298  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1299  "\"Wine32a\"=dword:1\n"
1300  "\"Wine32b\"=dword:4444\n\n", &r);
1301  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1302  dword = 0x1;
1303  verify_reg(hkey, "Wine32a", REG_DWORD, &dword, sizeof(dword), 0);
1304  dword = 0x4444;
1305  verify_reg(hkey, "Wine32b", REG_DWORD, &dword, sizeof(dword), 0);
1306 
1307  test_import_str("REGEDIT4\n\n"
1308  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1309  "\"Wine33a\"=dword:\n"
1310  "\"Wine33b\"=dword:hello\n"
1311  "\"Wine33c\"=dword:123456789\n"
1312  "\"Wine33d\"=dword:012345678\n"
1313  "\"Wine33e\"=dword:000000001\n\n", &r);
1314  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1315  verify_reg_nonexist(hkey, "Wine33a");
1316  verify_reg_nonexist(hkey, "Wine33b");
1317  verify_reg_nonexist(hkey, "Wine33c");
1318  verify_reg_nonexist(hkey, "Wine33d");
1319  verify_reg_nonexist(hkey, "Wine33e");
1320 
1321  test_import_str("REGEDIT4\n\n"
1322  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1323  "\"Wine34a\"=dword:12345678abc\n"
1324  "\"Wine34b\"=dword:12345678 abc\n\n", &r);
1325  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1326  verify_reg_nonexist(hkey, "Wine34a");
1327  verify_reg_nonexist(hkey, "Wine34b");
1328 
1329  test_import_str("REGEDIT4\n\n"
1330  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1331  "\"Wine35a\"=dword:0x123\n"
1332  "\"Wine35b\"=dword:123 456\n"
1333  "\"Wine35c\"=dword:1234 5678\n\n", &r);
1334  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1335  verify_reg_nonexist(hkey, "Wine35a");
1336  verify_reg_nonexist(hkey, "Wine35b");
1337  verify_reg_nonexist(hkey, "Wine35c");
1338 
1339  test_import_str("REGEDIT4\n\n"
1340  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1341  "\"Wine36a\"=dword:1234;5678\n"
1342  "\"Wine36b\"=dword:1234 ;5678\n"
1343  "\"Wine36c\"=dword:1234#5678\n"
1344  "\"Wine36d\"=dword:1234 #5678\n\n", &r);
1345  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1346  dword = 0x1234;
1347  verify_reg(hkey, "Wine36a", REG_DWORD, &dword, sizeof(dword), 0);
1348  verify_reg(hkey, "Wine36b", REG_DWORD, &dword, sizeof(dword), 0);
1349  verify_reg_nonexist(hkey, "Wine36c");
1350  verify_reg_nonexist(hkey, "Wine36d");
1351 
1352  test_import_str("REGEDIT4\n\n"
1353  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1354  "\"Wine37a\"=\"foo\"bar\"\n"
1355  "\"Wine37b\"=\"foo\"\"bar\"\n\n", &r);
1356  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1357  verify_reg_nonexist(hkey, "Wine37a");
1358  verify_reg_nonexist(hkey, "Wine37b");
1359 
1360  test_import_str("REGEDIT4\n\n"
1361  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1362  "\"Empty string\"=\"\"\n"
1363  "\"\"=\"Default Value Name\"\n\n", &r);
1364  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1365  verify_reg(hkey, "Empty string", REG_SZ, "", 1, 0);
1366  verify_reg(hkey, NULL, REG_SZ, "Default Value Name", 19, 0);
1367 
1368  test_import_str("REGEDIT4\n\n"
1369  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1370  "\"Test38a\"=\n"
1371  "\"Test38b\"=\\\"\n"
1372  "\"Test38c\"=\\\"Value\\\"\n"
1373  "\"Test38d\"=\\\"Value\"\n\n", &r);
1374  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1375  verify_reg_nonexist(hkey, "Test38a");
1376  verify_reg_nonexist(hkey, "Test38b");
1377  verify_reg_nonexist(hkey, "Test38c");
1378  verify_reg_nonexist(hkey, "Test38d");
1379 
1380  test_import_str("REGEDIT4\n\n"
1381  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1382  "\"Wine39a\"=\"Value1\" ;comment\n"
1383  "\"Wine39b\"=\"Value2\"\t\t;comment\n"
1384  "\"Wine39c\"=\"Value3\" #comment\n"
1385  "\"Wine39d\"=\"Value4\"\t\t#comment\n\n", &r);
1386  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1387  verify_reg(hkey, "Wine39a", REG_SZ, "Value1", 7, 0);
1388  verify_reg(hkey, "Wine39b", REG_SZ, "Value2", 7, 0);
1389  verify_reg_nonexist(hkey, "Wine39c");
1390  verify_reg_nonexist(hkey, "Wine39d");
1391 
1392  test_import_str("REGEDIT4\n\n"
1393  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1394  "\"TestNoBeginQuote\"=Asdffdsa\"\n", &r);
1395  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1396  verify_reg_nonexist(hkey, "TestNoBeginQuote");
1397 
1398  test_import_str("REGEDIT4\n\n"
1399  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1400  "\"TestNoEndQuote\"=\"Asdffdsa\n", &r);
1401  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1402  verify_reg_nonexist(hkey, "TestNoEndQuote");
1403 
1404  test_import_str("REGEDIT4\n\n"
1405  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1406  "\"TestNoQuotes\"=Asdffdsa\n", &r);
1407  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1408  verify_reg_nonexist(hkey, "TestNoQuotes");
1409 
1410  test_import_str("REGEDIT4\n\n"
1411  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1412  "NameNoBeginQuote\"=\"Asdffdsa\"\n", &r);
1413  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1414  verify_reg_nonexist(hkey, "NameNoBeginQuote");
1415 
1416  test_import_str("REGEDIT4\n\n"
1417  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1418  "\"NameNoEndQuote=\"Asdffdsa\"\n", &r);
1419  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1420  verify_reg_nonexist(hkey, "NameNoEndQuote");
1421 
1422  test_import_str("REGEDIT4\n\n"
1423  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1424  "NameNoQuotes=\"Asdffdsa\"\n", &r);
1425  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1426  verify_reg_nonexist(hkey, "NameNoQuotes");
1427 
1428  test_import_str("REGEDIT4\n\n"
1429  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1430  "\"MixedQuotes=Asdffdsa\"\n", &r);
1431  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1432  verify_reg_nonexist(hkey, "MixedQuotes");
1433  verify_reg_nonexist(hkey, "MixedQuotes=Asdffdsa");
1434 
1435  test_import_str("REGEDIT4\n\n"
1436  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1437  "\"Wine40a\"=hex(2):4c,69,6e,65,00\n"
1438  "\"Wine40b\"=\"Value 1\"\n"
1439  "\"Wine40c\"=hex(2):4c,69,6e,65\\\n"
1440  "\"Wine40d\"=\"Value 2\"\n"
1441  "\"Wine40e\"=hex(2):4c,69,6e,65,\\\n"
1442  "\"Wine40f\"=\"Value 3\"\n"
1443  "\"Wine40g\"=\"Value 4\"\n\n", &r);
1444  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1445  verify_reg(hkey, "Wine40a", REG_EXPAND_SZ, "Line", 5, 0);
1446  verify_reg(hkey, "Wine40b", REG_SZ, "Value 1", 8, 0);
1447  verify_reg_nonexist(hkey, "Wine40c");
1448  verify_reg(hkey, "Wine40d", REG_SZ, "Value 2", 8, 0);
1449  verify_reg_nonexist(hkey, "Wine40e");
1450  verify_reg_nonexist(hkey, "Wine40f");
1451  verify_reg(hkey, "Wine40g", REG_SZ, "Value 4", 8, 0);
1452 
1453  test_import_str("REGEDIT4\n\n"
1454  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1455  "\"Wine41a\"=dword:1234\\\n"
1456  "5678\n"
1457  "\"Wine41b\"=\"Test \\\n"
1458  "Value\"\n\n", &r);
1459  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1460  verify_reg_nonexist(hkey, "Wine41a");
1461  verify_reg_nonexist(hkey, "Wine41b");
1462 
1463  test_import_str("REGEDIT4\n\n"
1464  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1465  "\"double\\\"quote\"=\"valid \\\"or\\\" not\"\n"
1466  "\"single'quote\"=dword:00000008\n\n", &r);
1467  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1468  verify_reg(hkey, "double\"quote", REG_SZ, "valid \"or\" not", 15, 0);
1469  dword = 0x00000008;
1470  verify_reg(hkey, "single'quote", REG_DWORD, &dword, sizeof(dword), 0);
1471 
1472  /* Test key name and value name concatenation */
1473  test_import_str("REGEDIT4\n\n"
1474  "[HKEY_CURRENT_USER\\" KEY_BASE "\\\n"
1475  "Subkey1]\n", &r);
1476  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1477  verify_key_nonexist(hkey, "Subkey1");
1478 
1479  test_import_str("REGEDIT4\n\n"
1480  "[HKEY_CURRENT_USER\\" KEY_BASE "\n"
1481  "\\Subkey2]\n", &r);
1482  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1483  verify_key_nonexist(hkey, "Subkey2");
1484 
1485  test_import_str("REGEDIT4\n\n"
1486  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1487  "\"Wine\\\n"
1488  "42a\"=\"Value 1\"\n"
1489  "\"Wine42b\"=\"Value 2\"\n"
1490  "\"Wine\n"
1491  "\\42c\"=\"Value 3\"\n\n", &r);
1492  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1493  verify_reg_nonexist(hkey, "Wine42a");
1494  verify_reg(hkey, "Wine42b", REG_SZ, "Value 2", 8, 0);
1495  verify_reg_nonexist(hkey, "Wine42c");
1496 
1497  /* Test hex data concatenation for REG_NONE, REG_EXPAND_SZ and REG_BINARY */
1498  test_import_str("REGEDIT4\n\n"
1499  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1500  "\"Wine43a\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n"
1501  "\"Wine43b\"=hex(0):56,00,61,00,6c,00,\\\n"
1502  " 75,00,65,00,00,00\n"
1503  "\"Wine43c\"=hex(0):56,00,61,00,6c,00\\\n"
1504  ",75,00,65,00,00,00\n"
1505  "\"Wine43d\"=hex(0):56,00,61,00,6c,00\\\n"
1506  " ,75,00,65,00,00,00\n"
1507  "\"Wine43e\"=hex(0):56,00,61,00,6c,00\\\n"
1508  " 75,00,65,00,00,00\n"
1509  "\"Wine43f\"=hex(0):56,00,61,00,6c,00,7\\\n"
1510  "5,00,65,00,00,00\n"
1511  "\"Wine43g\"=hex(0):56,00,61,00,6c,00,7\\\n"
1512  " 5,00,65,00,00,00\n"
1513  "\"Wine43h\"=hex(0):56,00,61,00,\\;comment\n"
1514  " 6c,00,75,00,\\\n"
1515  " 65,00,00,00\n"
1516  "\"Wine43i\"=hex(0):56,00,61,00,\\;comment\n"
1517  " 6c,00,75,00,\n"
1518  " 65,00,00,00\n"
1519  "\"Wine43j\"=hex(0):56,00,61,00,\\;comment\n"
1520  " 6c,00,75,00,;comment\n"
1521  " 65,00,00,00\n"
1522  "\"Wine43k\"=hex(0):56,00,61,00,\\;comment\n"
1523  " 6c,00,75,00,\\#comment\n"
1524  " 65,00,00,00\n\n", &r);
1525  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1526  verify_reg(hkey, "Wine43a", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1527  verify_reg(hkey, "Wine43b", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1528  verify_reg_nonexist(hkey, "Wine43c");
1529  verify_reg_nonexist(hkey, "Wine43d");
1530  verify_reg_nonexist(hkey, "Wine43e");
1531  verify_reg_nonexist(hkey, "Wine43f");
1532  verify_reg_nonexist(hkey, "Wine43g");
1533  verify_reg(hkey, "Wine43h", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1534  verify_reg(hkey, "Wine43i", REG_NONE, "V\0a\0l\0u", 8, 0);
1535  verify_reg(hkey, "Wine43j", REG_NONE, "V\0a\0l\0u", 8, 0);
1536  verify_reg_nonexist(hkey, "Wine43k");
1537 
1538  test_import_str("REGEDIT4\n\n"
1539  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1540  "\"Wine44a\"=hex(2):25,50,41,54,48,25,00\n"
1541  "\"Wine44b\"=hex(2):25,50,41,\\\n"
1542  " 54,48,25,00\n"
1543  "\"Wine44c\"=hex(2):25,50,41\\\n"
1544  ",54,48,25,00\n"
1545  "\"Wine44d\"=hex(2):25,50,41\\\n"
1546  " ,54,48,25,00\n"
1547  "\"Wine44e\"=hex(2):25,50,41\\\n"
1548  " 54,48,25,00\n"
1549  "\"Wine44f\"=hex(2):25,50,4\\\n"
1550  "1,54,48,25,00\n"
1551  "\"Wine44g\"=hex(2):25,50,4\\\n"
1552  " 1,54,48,25,00\n"
1553  "\"Wine44h\"=hex(2):25,50,41,\\;comment\n"
1554  " 54,48,\\\n"
1555  " 25,00\n"
1556  "\"Wine44i\"=hex(2):25,50,41,\\;comment\n"
1557  " 54,48,\n"
1558  " 25,00\n"
1559  "\"Wine44j\"=hex(2):25,50,41,\\;comment\n"
1560  " 54,48,;comment\n"
1561  " 25,00\n"
1562  "\"Wine44k\"=hex(2):25,50,41,\\;comment\n"
1563  " 54,48,\\#comment\n"
1564  " 25,00\n\n", &r);
1565  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1566  verify_reg(hkey, "Wine44a", REG_EXPAND_SZ, "%PATH%", 7, 0);
1567  verify_reg(hkey, "Wine44b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1568  verify_reg_nonexist(hkey, "Wine44c");
1569  verify_reg_nonexist(hkey, "Wine44d");
1570  verify_reg_nonexist(hkey, "Wine44e");
1571  verify_reg_nonexist(hkey, "Wine44f");
1572  verify_reg_nonexist(hkey, "Wine44g");
1573  verify_reg(hkey, "Wine44h", REG_EXPAND_SZ, "%PATH%", 7, 0);
1574  /* Wine44i */
1575  size = sizeof(buffer);
1576  err = RegQueryValueExA(hkey, "Wine44i", NULL, &type, (BYTE *)&buffer, &size);
1577  ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
1578  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
1579  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
1580  ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
1581  /* Wine44j */
1582  size = sizeof(buffer);
1583  memset(buffer, '-', size);
1584  err = RegQueryValueExA(hkey, "Wine44j", NULL, &type, (BYTE *)&buffer, &size);
1585  ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
1586  ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
1587  ok(size == 6 || broken(size == 5) /* WinXP */, "got wrong size %u, expected 6\n", size);
1588  ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
1589  /* Wine44k */
1590  verify_reg_nonexist(hkey, "Wine44k");
1591 
1592  test_import_str("REGEDIT4\n\n"
1593  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1594  "\"Wine45a\"=hex:11,22,33,44,55,66,77,88\n"
1595  "\"Wine45b\"=hex:11,22,33,44,\\\n"
1596  " 55,66,77,88\n"
1597  "\"Wine45c\"=hex:11,22,33,44\\\n"
1598  ",55,66,77,88\n"
1599  "\"Wine45d\"=hex:11,22,33,44\\\n"
1600  " ,55,66,77,88\n"
1601  "\"Wine45e\"=hex:11,22,33,44\\\n"
1602  " 55,66,77,88\n"
1603  "\"Wine45f\"=hex:11,22,33,4\\\n"
1604  "4,55,66,77,88\n"
1605  "\"Wine45g\"=hex:11,22,33,4\\\n"
1606  " 4,55,66,77,88\n"
1607  "\"Wine45h\"=hex:11,22,33,44,\\;comment\n"
1608  " 55,66,\\\n"
1609  " 77,88\n"
1610  "\"Wine45i\"=hex:11,22,33,44,\\;comment\n"
1611  " 55,66,\n"
1612  " 77,88\n"
1613  "\"Wine45j\"=hex:11,22,33,44,\\;comment\n"
1614  " 55,66,;comment\n"
1615  " 77,88\n"
1616  "\"Wine45k\"=hex:11,22,33,\\;comment\n"
1617  " 44,55,66,\\#comment\n"
1618  " 77,88\n\n", &r);
1619  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1620  hex[0] = 0x11; hex[1] = 0x22; hex[2] = 0x33; hex[3] = 0x44;
1621  hex[4] = 0x55; hex[5] = 0x66; hex[6] = 0x77; hex[7] = 0x88;
1622  verify_reg(hkey, "Wine45a", REG_BINARY, hex, sizeof(hex), 0);
1623  verify_reg(hkey, "Wine45b", REG_BINARY, hex, sizeof(hex), 0);
1624  verify_reg_nonexist(hkey, "Wine45c");
1625  verify_reg_nonexist(hkey, "Wine45d");
1626  verify_reg_nonexist(hkey, "Wine45e");
1627  verify_reg_nonexist(hkey, "Wine45f");
1628  verify_reg_nonexist(hkey, "Wine45g");
1629  verify_reg(hkey, "Wine45h", REG_BINARY, hex, sizeof(hex), 0);
1630  verify_reg(hkey, "Wine45i", REG_BINARY, hex, 6, 0);
1631  verify_reg(hkey, "Wine45j", REG_BINARY, hex, 6, 0);
1632  verify_reg_nonexist(hkey, "Wine45k");
1633 
1634  /* Test import with subkeys */
1635  test_import_str("REGEDIT4\n\n"
1636  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey\"1]\n"
1637  "\"Wine\\\\31\"=\"Test value\"\n\n", &r);
1638  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1639  open_key(hkey, "Subkey\"1", 0, &subkey);
1640  verify_reg(subkey, "Wine\\31", REG_SZ, "Test value", 11, 0);
1641  err = RegCloseKey(subkey);
1642  ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
1643  delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey\"1");
1644 
1645  test_import_str("REGEDIT4\n\n"
1646  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey/2]\n"
1647  "\"123/\\\"4;'5\"=\"Random value name\"\n\n", &r);
1648  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1649  open_key(hkey, "Subkey/2", 0, &subkey);
1650  verify_reg(subkey, "123/\"4;'5", REG_SZ, "Random value name", 18, 0);
1651  err = RegCloseKey(subkey);
1652  ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
1653  delete_key(HKEY_CURRENT_USER, KEY_BASE "\\Subkey/2");
1654 
1655  /* Test key creation */
1656  test_import_str("REGEDIT4\n\n"
1657  "HKEY_CURRENT_USER\\" KEY_BASE "\\No_Opening_Bracket]\n", &r);
1658  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1659  verify_key_nonexist(hkey, "No_Opening_Bracket");
1660 
1661  test_import_str("REGEDIT4\n\n"
1662  "[HKEY_CURRENT_USER\\" KEY_BASE "\\No_Closing_Bracket\n", &r);
1663  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1664  verify_key_nonexist(hkey, "No_Closing_Bracket");
1665 
1666  test_import_str("REGEDIT4\n\n"
1667  "[ HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1a]\n", &r);
1668  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1669  verify_key_nonexist(hkey, "Subkey1a");
1670 
1671  test_import_str("REGEDIT4\n\n"
1672  "[\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1b]\n", &r);
1673  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1674  verify_key_nonexist(hkey, "Subkey1b");
1675 
1676  test_import_str("REGEDIT4\n\n"
1677  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1c ]\n", &r);
1678  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1679  verify_key(hkey, "Subkey1c ");
1680  delete_key(hkey, "Subkey1c ");
1681 
1682  test_import_str("REGEDIT4\n\n"
1683  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1d\t]\n", &r);
1684  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1685  verify_key(hkey, "Subkey1d\t");
1686  delete_key(hkey, "Subkey1d\t");
1687 
1688  test_import_str("REGEDIT4\n\n"
1689  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1e\\]\n"
1690  "\"Wine\"=\"Test value\"\n\n", &r);
1691  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1692  verify_key(hkey, "Subkey1e\\");
1693  verify_key(hkey, "Subkey1e");
1694  open_key(hkey, "Subkey1e", 0, &subkey);
1695  verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
1696  RegCloseKey(subkey);
1697  delete_key(hkey, "Subkey1e");
1698 
1699  test_import_str("REGEDIT4\n\n"
1700  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1f\\\\]\n"
1701  "\"Wine\"=\"Test value\"\n\n", &r);
1702  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1703  verify_key(hkey, "Subkey1f\\\\");
1704  verify_key(hkey, "Subkey1f\\");
1705  verify_key(hkey, "Subkey1f");
1706  open_key(hkey, "Subkey1f\\\\", 0, &subkey);
1707  verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
1708  RegCloseKey(subkey);
1709  delete_key(hkey, "Subkey1f\\\\");
1710 
1711  test_import_str("REGEDIT4\n\n"
1712  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1g\\\\\\\\]\n"
1713  "\"Wine\"=\"Test value\"\n\n", &r);
1714  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1715  verify_key(hkey, "Subkey1g\\\\\\\\");
1716  verify_key(hkey, "Subkey1g\\\\");
1717  verify_key(hkey, "Subkey1g\\");
1718  verify_key(hkey, "Subkey1g");
1719  open_key(hkey, "Subkey1g\\\\", 0, &subkey);
1720  verify_reg(subkey, "Wine", REG_SZ, "Test value", 11, 0);
1721  RegCloseKey(subkey);
1722  delete_key(hkey, "Subkey1g\\\\");
1723 
1724  /* Test key deletion. We start by creating some registry keys. */
1725  test_import_str("REGEDIT4\n\n"
1726  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
1727  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
1728  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1729  verify_key(hkey, "Subkey2a");
1730  verify_key(hkey, "Subkey2b");
1731 
1732  test_import_str("REGEDIT4\n\n"
1733  "[ -HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
1734  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1735  verify_key(hkey, "Subkey2a");
1736 
1737  test_import_str("REGEDIT4\n\n"
1738  "[\t-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
1739  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1740  verify_key(hkey, "Subkey2b");
1741 
1742  test_import_str("REGEDIT4\n\n"
1743  "[- HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n", &r);
1744  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1745  verify_key(hkey, "Subkey2a");
1746 
1747  test_import_str("REGEDIT4\n\n"
1748  "[-\tHKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n", &r);
1749  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1750  verify_key(hkey, "Subkey2b");
1751 
1752  test_import_str("REGEDIT4\n\n"
1753  "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2a]\n\n"
1754  "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2b]\n\n", &r);
1755  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1756  verify_key_nonexist(hkey, "Subkey2a");
1757  verify_key_nonexist(hkey, "Subkey2b");
1758 
1759  /* Test case sensitivity when creating and deleting registry keys. */
1760  test_import_str("REGEDIT4\n\n"
1761  "[hkey_CURRENT_user\\" KEY_BASE "\\Subkey3a]\n\n"
1762  "[HkEy_CuRrEnT_uSeR\\" KEY_BASE "\\SuBkEy3b]\n\n", &r);
1763  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1764  verify_key(hkey, "Subkey3a");
1765  verify_key(hkey, "Subkey3b");
1766 
1767  test_import_str("REGEDIT4\n\n"
1768  "[-HKEY_current_USER\\" KEY_BASE "\\sUBKEY3A]\n\n"
1769  "[-hKeY_cUrReNt_UsEr\\" KEY_BASE "\\sUbKeY3B]\n\n", &r);
1770  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1771  verify_key_nonexist(hkey, "Subkey3a");
1772  verify_key_nonexist(hkey, "Subkey3b");
1773 
1774  /* Test mixed key creation and deletion. We start by creating a subkey. */
1775  test_import_str("REGEDIT4\n\n"
1776  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n\n", &r);
1777  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1778  verify_key(hkey, "Subkey4a");
1779 
1780  test_import_str("REGEDIT4\n\n"
1781  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
1782  "[-HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey4a]\n"
1783  "\"Wine46a\"=dword:12345678\n\n", &r);
1784  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1785  verify_key_nonexist(hkey, "Subkey4a");
1786  verify_reg_nonexist(hkey, "Wine46a");
1787 
1788  test_import_str("REGEDIT4\n\n"
1789  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n\n"
1790  "[HKEY_CURRENT_USERS\\" KEY_BASE "\\Subkey4b]\n"
1791  "\"Wine46b\"=dword:12345678\n\n", &r);
1792  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1793  verify_key_nonexist(hkey, "Subkey4b");
1794  verify_reg_nonexist(hkey, "Wine46b");
1795 
1796  /* Test value deletion. We start by creating some registry values. */
1797  test_import_str("REGEDIT4\n\n"
1798  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1799  "\"Wine46a\"=\"Test Value\"\n"
1800  "\"Wine46b\"=dword:00000008\n"
1801  "\"Wine46c\"=hex:11,22,33,44\n"
1802  "\"Wine46d\"=hex(7):4c,69,6e,65,20,\\\n"
1803  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1804  "\"Wine46e\"=hex(2):25,50,41,54,48,25,00\n"
1805  "\"Wine46f\"=hex(0):56,00,61,00,6c,00,75,00,65,00,00,00\n\n", &r);
1806  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1807  verify_reg(hkey, "Wine46a", REG_SZ, "Test Value", 11, 0);
1808  verify_reg(hkey, "Wine46b", REG_DWORD, &dword, sizeof(dword), 0);
1809  verify_reg(hkey, "Wine46c", REG_BINARY, hex, 4, 0);
1810  verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1811  verify_reg(hkey, "Wine46e", REG_EXPAND_SZ, "%PATH%", 7, 0);
1812  verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1813 
1814  test_import_str("REGEDIT4\n\n"
1815  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1816  "\"Wine46a\"=-\n"
1817  "\"Wine46b\"= -\n"
1818  "\"Wine46c\"= \t-\t \n"
1819  "\"Wine46d\"=-\"Test\"\n"
1820  "\"Wine46e\"=- ;comment\n"
1821  "\"Wine46f\"=- #comment\n\n", &r);
1822  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1823  verify_reg_nonexist(hkey, "Wine46a");
1824  verify_reg_nonexist(hkey, "Wine46b");
1825  verify_reg_nonexist(hkey, "Wine46c");
1826  verify_reg(hkey, "Wine46d", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1827  verify_reg_nonexist(hkey, "Wine46e");
1828  verify_reg(hkey, "Wine46f", REG_NONE, "V\0a\0l\0u\0e\0\0", 12, 0);
1829 
1830  /* Test the accepted range of the hex-based data types */
1831  test_import_str("REGEDIT4\n\n"
1832  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1833  "\"Wine47a\"=hex(0):56,61,6c,75,65,00\n"
1834  "\"Wine47b\"=hex(10):56,61,6c,75,65,00\n"
1835  "\"Wine47c\"=hex(100):56,61,6c,75,65,00\n"
1836  "\"Wine47d\"=hex(1000):56,61,6c,75,65,00\n"
1837  "\"Wine47e\"=hex(7fff):56,61,6c,75,65,00\n"
1838  "\"Wine47f\"=hex(ffff):56,61,6c,75,65,00\n"
1839  "\"Wine47g\"=hex(7fffffff):56,61,6c,75,65,00\n"
1840  "\"Wine47h\"=hex(ffffffff):56,61,6c,75,65,00\n"
1841  "\"Wine47i\"=hex(100000000):56,61,6c,75,65,00\n"
1842  "\"Wine47j\"=hex(0x2):56,61,6c,75,65,00\n"
1843  "\"Wine47k\"=hex(0X2):56,61,6c,75,65,00\n"
1844  "\"Wine47l\"=hex(x2):56,61,6c,75,65,00\n\n", &r);
1845  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1846  verify_reg(hkey, "Wine47a", REG_NONE, "Value", 6, 0);
1847  verify_reg(hkey, "Wine47b", 0x10, "Value", 6, 0);
1848  verify_reg(hkey, "Wine47c", 0x100, "Value", 6, 0);
1849  verify_reg(hkey, "Wine47d", 0x1000, "Value", 6, 0);
1850  verify_reg(hkey, "Wine47e", 0x7fff, "Value", 6, 0);
1851  verify_reg(hkey, "Wine47f", 0xffff, "Value", 6, 0);
1852  verify_reg(hkey, "Wine47g", 0x7fffffff, "Value", 6, 0);
1853  verify_reg(hkey, "Wine47h", 0xffffffff, "Value", 6, 0);
1854  verify_reg_nonexist(hkey, "Wine47i");
1855  verify_reg_nonexist(hkey, "Wine47j");
1856  verify_reg_nonexist(hkey, "Wine47k");
1857  verify_reg_nonexist(hkey, "Wine47l");
1858 
1859  test_import_str("REGEDIT4\n\n"
1860  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1861  "\"Wine48a\"=hex(7):4c,69,6e,65,20, \\\n"
1862  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
1863  "\"Wine48b\"=hex(7):4c,69,6e,65,20,\t\\\n"
1864  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
1865  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1866  verify_reg(hkey, "Wine48a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1867  verify_reg(hkey, "Wine48b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
1868 
1869  test_import_str("REGEDIT4\n\n"
1870  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1871  "\"Wine49\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
1872  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1873  verify_reg(hkey, "Wine49", REG_EXPAND_SZ, "%PATH%", 7, 0);
1874 
1875  test_import_str("REGEDIT4\n\n"
1876  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1877  "\"Wine50a\"=hex(2):25,50,41,54,48,25,00 ;comment\n"
1878  "\"Wine50b\"=hex(2):25,50,41,54,48,25,00\t;comment\n"
1879  "\"Wine50c\"=hex(2):25,50,41,54,48,25,00 #comment\n"
1880  "\"Wine50d\"=hex(2):25,50,41,54,48,25,00\t#comment\n\n", &r);
1881  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1882  verify_reg(hkey, "Wine50a", REG_EXPAND_SZ, "%PATH%", 7, 0);
1883  verify_reg(hkey, "Wine50b", REG_EXPAND_SZ, "%PATH%", 7, 0);
1884  verify_reg_nonexist(hkey, "Wine50c");
1885  verify_reg_nonexist(hkey, "Wine50d");
1886 
1887  /* Test support for characters greater than 0xff */
1888  test_import_str("REGEDIT4\n\n"
1889  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1890  "\"Wine51a\"=hex(0):25,50,100,54,48,25,00\n"
1891  "\"Wine51b\"=hex(0):25,1a4,100,164,124,25,00\n\n", &r);
1892  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1893  verify_reg_nonexist(hkey, "Wine51a");
1894  verify_reg_nonexist(hkey, "Wine51b");
1895 
1896  /* Test the effect of backslashes in hex data */
1897  test_import_str("REGEDIT4\n\n"
1898  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1899  "\"Wine52a\"=hex(2):25,48\\,4f,4d,45,25,00\n"
1900  "\"Wine52b\"=hex(2):25,48,\\4f,4d,45,25,00\n"
1901  "\"Wine52c\"=hex(2):25,48\\ ,4f,4d,45,25,00\n"
1902  "\"Wine52d\"=hex(2):25,48,\\ 4f,4d,45,25,00\n"
1903  "\"Wine52e\"=hex(2):\\25,48,4f,4d,45,25,00\n"
1904  "\"Wine52f\"=hex(2):\\ 25,48,4f,4d,45,25,00\n"
1905  "\"Wine52g\"=hex(2):25,48,4\\f,4d,45,25,00\n"
1906  "\"Wine52h\"=hex(2):25,48,4\\\n"
1907  " f,4d,45,25,00\n"
1908  "\"Wine52i\"=hex(2):25,50,\\,41,54,48,25,00\n"
1909  "\"Wine52j\"=hex(2):25,48,4f,4d,45,25,5c,\\\\\n"
1910  " 25,50,41,54,48,25,00\n"
1911  "\"Wine52k\"=hex(2):,\\\n"
1912  " 25,48,4f,4d,45,25,00\n"
1913  "\"Wine52l\"=hex(2):\\\n"
1914  " 25,48,4f,4d,45,25,00\n\n", &r);
1915  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1916  verify_reg_nonexist(hkey, "Wine52a");
1917  verify_reg_nonexist(hkey, "Wine52b");
1918  verify_reg_nonexist(hkey, "Wine52c");
1919  verify_reg_nonexist(hkey, "Wine52d");
1920  verify_reg_nonexist(hkey, "Wine52e");
1921  verify_reg_nonexist(hkey, "Wine52f");
1922  verify_reg_nonexist(hkey, "Wine52g");
1923  verify_reg_nonexist(hkey, "Wine52h");
1924  verify_reg_nonexist(hkey, "Wine52i");
1925  verify_reg_nonexist(hkey, "Wine52j");
1926  verify_reg_nonexist(hkey, "Wine52k");
1927  verify_reg(hkey, "Wine52l", REG_EXPAND_SZ, "%HOME%", 7, 0);
1928 
1929  test_import_str("REGEDIT4\n\n"
1930  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1931  "\"Wine53a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
1932  " 25,50,41,54,48,25,00\n"
1933  "\"Wine53b\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
1934  " 25,50,41,54,48,25,00\n"
1935  "\"Wine53c\"=hex(2):25,48,4f,4d,45,25,5c, \\ ;comment\n"
1936  " 25,50,41,54,48,25,00\n"
1937  "\"Wine53d\"=hex(2):25,48,4f,4d,45,25,5c \\ ;comment\n"
1938  " 25,50,41,54,48,25,00\n"
1939  "\"Wine53e\"=hex(2):25,48,4f,4d,45,25,5c,\\\t ;comment\n"
1940  " 25,50,41,54,48,25,00\n"
1941  "\"Wine53f\"=hex(2):25,48,4f,4d,45,25,5c\\\t ;comment\n"
1942  " 25,50,41,54,48,25,00\n\n", &r);
1943  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1944  verify_reg(hkey, "Wine53a", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1945  verify_reg_nonexist(hkey, "Wine53b");
1946  verify_reg(hkey, "Wine53c", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1947  verify_reg_nonexist(hkey, "Wine53d");
1948  verify_reg(hkey, "Wine53e", REG_EXPAND_SZ, "%HOME%\\%PATH%", 14, 0);
1949  verify_reg_nonexist(hkey, "Wine53f");
1950 
1951  test_import_str("REGEDIT4\n\n"
1952  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1953  "\"Wine54a\"=hex(2):4c,69,6e,65,20,\\\n"
1954  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey1]\n", &r);
1955  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1956  verify_reg_nonexist(hkey, "Wine54a");
1957  verify_key_nonexist(hkey, "Subkey1");
1958 
1959  test_import_str("REGEDIT4\n\n"
1960  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1961  "\"Wine54b\"=hex(2):4c,69,6e,65,20\\\n"
1962  "[HKEY_CURRENT_USER\\" KEY_BASE "\\Subkey2]\n", &r);
1963  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1964  verify_reg_nonexist(hkey, "Wine54b");
1965  verify_key(hkey, "Subkey2");
1966 
1967  delete_key(hkey, "Subkey2");
1968 
1969  test_import_str("REGEDIT4\n\n"
1970  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
1971  "\"Wine55a\"=hex(2):4c,69,6e,65,20,\\\n"
1972  "\"Wine55b\"=\"Test value\"\n"
1973 
1974  "\"Wine55c\"=hex(2):4c,69,6e,65,20,\\\n"
1975  ";comment\n"
1976  "\"Wine55d\"=\"Test value\"\n"
1977 
1978  "\"Wine55e\"=hex(2):4c,69,6e,65,20,\\\n"
1979  "#comment\n"
1980  "\"Wine55f\"=\"Test value\"\n"
1981 
1982  "\"Wine55g\"=hex(2):4c,69,6e,65,20,\\\n\n"
1983  "\"Wine55h\"=\"Test value\"\n"
1984 
1985  "\"Wine55i\"=hex(2):4c,69,6e,65,20\\\n"
1986  "\"Wine55j\"=\"Test value\"\n\n", &r);
1987  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
1988  verify_reg_nonexist(hkey, "Wine55a");
1989  verify_reg_nonexist(hkey, "Wine55b");
1990  verify_reg_nonexist(hkey, "Wine55c");
1991  verify_reg_nonexist(hkey, "Wine55d");
1992  verify_reg_nonexist(hkey, "Wine55e");
1993  verify_reg(hkey, "Wine55f", REG_SZ, "Test value", 11, 0);
1994  verify_reg_nonexist(hkey, "Wine55g");
1995  verify_reg_nonexist(hkey, "Wine55h");
1996  verify_reg_nonexist(hkey, "Wine55i");
1997  verify_reg(hkey, "Wine55j", REG_SZ, "Test value", 11, 0);
1998 
1999  test_import_str("REGEDIT4\n\n"
2000  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2001  "\"Wine56a\"=hex(2):4c,69,6e,65,20,\\\n"
2002  "\"Wine56b\"=dword:00000008\n"
2003 
2004  "\"Wine56c\"=hex(2):4c,69,6e,65,20,\\\n"
2005  ";comment\n"
2006  "\"Wine56d\"=dword:00000008\n"
2007 
2008  "\"Wine56e\"=hex(2):4c,69,6e,65,20,\\\n"
2009  "#comment\n"
2010  "\"Wine56f\"=dword:00000008\n"
2011 
2012  "\"Wine56g\"=hex(2):4c,69,6e,65,20,\\\n\n"
2013  "\"Wine56h\"=dword:00000008\n"
2014 
2015  "\"Wine56i\"=hex(2):4c,69,6e,65,20\\\n"
2016  "\"Wine56j\"=dword:00000008\n\n", &r);
2017  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2018  verify_reg_nonexist(hkey, "Wine56a");
2019  verify_reg_nonexist(hkey, "Wine56b");
2020  verify_reg_nonexist(hkey, "Wine56c");
2021  verify_reg_nonexist(hkey, "Wine56d");
2022  verify_reg_nonexist(hkey, "Wine56e");
2023  verify_reg(hkey, "Wine56f", REG_DWORD, &dword, sizeof(dword), 0);
2024  verify_reg_nonexist(hkey, "Wine56g");
2025  verify_reg_nonexist(hkey, "Wine56h");
2026  verify_reg_nonexist(hkey, "Wine56i");
2027  verify_reg(hkey, "Wine56j", REG_DWORD, &dword, sizeof(dword), 0);
2028 
2029  test_import_str("REGEDIT4\n\n"
2030  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2031  "\"Wine57a\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
2032  "\"Wine57b\"=hex(2):25,50,41,54,48,25,00\n"
2033 
2034  "\"Wine57c\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
2035  ";comment\n"
2036  "\"Wine57d\"=hex(2):25,50,41,54,48,25,00\n"
2037 
2038  "\"Wine57e\"=hex(2):25,48,4f,4d,45,25,5c,\\\n"
2039  "#comment\n"
2040  "\"Wine57f\"=hex(2):25,50,41,54,48,25,00\n"
2041 
2042  "\"Wine57g\"=hex(2):25,48,4f,4d,45,25,5c,\\\n\n"
2043  "\"Wine57h\"=hex(2):25,50,41,54,48,25,00\n"
2044 
2045  "\"Wine57i\"=hex(2):25,48,4f,4d,45,25,5c\\\n"
2046  "\"Wine57j\"=hex(2):25,50,41,54,48,25,00\n\n", &r);
2047  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2048  verify_reg_nonexist(hkey, "Wine57a");
2049  verify_reg_nonexist(hkey, "Wine57b");
2050  verify_reg_nonexist(hkey, "Wine57c");
2051  verify_reg_nonexist(hkey, "Wine57d");
2052  verify_reg_nonexist(hkey, "Wine57e");
2053  verify_reg(hkey, "Wine57f", REG_EXPAND_SZ, "%PATH%", 7, 0);
2054  verify_reg_nonexist(hkey, "Wine57g");
2055  verify_reg_nonexist(hkey, "Wine57h");
2056  verify_reg_nonexist(hkey, "Wine57i");
2057  verify_reg(hkey, "Wine57j", REG_EXPAND_SZ, "%PATH%", 7, 0);
2058 
2059  delete_value(hkey, NULL);
2060 
2061  test_import_str("REGEDIT4\n\n"
2062  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2063  "\"Wine58a\"=hex(2):4c,69,6e,65,20,\\\n"
2064  "@=\"Default value 1\"\n\n", &r);
2065  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2066  verify_reg_nonexist(hkey, "Wine58a");
2067  verify_reg_nonexist(hkey, NULL);
2068 
2069  test_import_str("REGEDIT4\n\n"
2070  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2071  "\"Wine58b\"=hex(2):4c,69,6e,65,20,\\\n"
2072  ";comment\n"
2073  "@=\"Default value 2\"\n\n", &r);
2074  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2075  verify_reg_nonexist(hkey, "Wine58b");
2076  verify_reg_nonexist(hkey, NULL);
2077 
2078  test_import_str("REGEDIT4\n\n"
2079  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2080  "\"Wine58c\"=hex(2):4c,69,6e,65,20,\\\n"
2081  "#comment\n"
2082  "@=\"Default value 3\"\n\n", &r);
2083  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2084  verify_reg_nonexist(hkey, "Wine58c");
2085  verify_reg(hkey, NULL, REG_SZ, "Default value 3", 16, 0);
2086 
2087  delete_value(hkey, NULL);
2088 
2089  test_import_str("REGEDIT4\n\n"
2090  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2091  "\"Wine58d\"=hex(2):4c,69,6e,65,20,\\\n\n"
2092  "@=\"Default value 4\"\n\n", &r);
2093  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2094  verify_reg_nonexist(hkey, "Wine58d");
2095  verify_reg_nonexist(hkey, NULL);
2096 
2097  test_import_str("REGEDIT4\n\n"
2098  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2099  "\"Wine58e\"=hex(2):4c,69,6e,65,20\\\n"
2100  "@=\"Default value 5\"\n\n", &r);
2101  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2102  verify_reg_nonexist(hkey, "Wine58e");
2103  verify_reg(hkey, NULL, REG_SZ, "Default value 5", 16, 0);
2104 
2105  test_import_str("REGEDIT4\n\n"
2106  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2107  "\"Wine59a\"=hex:11,22,33,\\\n"
2108  "\\\n"
2109  " 44,55,66\n"
2110  "\"Wine59b\"=hex:11,22,33,\\\n"
2111  " \\\n"
2112  " 44,55,66\n\n", &r);
2113  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2114  verify_reg_nonexist(hkey, "Wine59a");
2115  verify_reg_nonexist(hkey, "Wine59b");
2116 
2117  test_import_str("REGEDIT4\n\n"
2118  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2119  "\"Wine60a\"=hex(7):4c,69,6e,65,20,\\\n"
2120  " 63,6f,6e,63,61,74,\\\n"
2121  ";comment\n"
2122  " 65,6e,\\;comment\n"
2123  " 61,74,69,6f,6e,00,00\n\n", &r);
2124  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2125  verify_reg(hkey, "Wine60a", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2126 
2127  test_import_str("REGEDIT4\n\n"
2128  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2129  "\"Wine60b\"=hex(7):4c,69,6e,65,20,\\\n"
2130  " 63,6f,6e,63,61,74,\\\n"
2131  " ;comment\n"
2132  " 65,6e,\\;comment\n"
2133  " 61,74,69,6f,6e,00,00\n\n", &r);
2134  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2135  verify_reg(hkey, "Wine60b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2136 
2137  test_import_str("REGEDIT4\n\n"
2138  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2139  "\"Wine60c\"=hex(7):4c,69,6e,65,20,\\\n"
2140  " 63,6f,6e,63,61,74,\\\n"
2141  "#comment\n"
2142  " 65,6e,\\;comment\n"
2143  " 61,74,69,6f,6e,00,00\n\n", &r);
2144  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2145  verify_reg_nonexist(hkey, "Wine60c");
2146 
2147  test_import_str("REGEDIT4\n\n"
2148  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2149  "\"Wine60d\"=hex(7):4c,69,6e,65,20,\\\n"
2150  " 63,6f,6e,63,61,74,\\\n"
2151  " #comment\n"
2152  " 65,6e,\\;comment\n"
2153  " 61,74,69,6f,6e,00,00\n\n", &r);
2154  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2155  verify_reg_nonexist(hkey, "Wine60d");
2156 
2157  test_import_str("REGEDIT4\n\n"
2158  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2159  "\"Wine60e\"=hex(7):4c,69,6e,65,20,\\\n"
2160  " 63,6f,6e,\\\n\n"
2161  " 63,61,74,\\\n\n\n"
2162  " 65,6e,\\\n\n\n\n"
2163  " 61,74,69,6f,6e,00,00\n\n", &r);
2164  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2165  verify_reg(hkey, "Wine60e", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2166 
2167  test_import_str("REGEDIT4\n\n"
2168  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2169  "\"Wine60f\"=hex(7):4c,69,6e,65,20,\\\n"
2170  " 63,6f,6e,\\\n \n"
2171  " 63,61,74,\\\n\t\n\t\n"
2172  " 65,6e,\\\n\t \t\n\t \t\n\t \t\n"
2173  " 61,74,69,6f,6e,00,00\n\n", &r);
2174  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2175  verify_reg(hkey, "Wine60f", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2176 
2177  test_import_str("REGEDIT4\n\n"
2178  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2179  "\"Wine61a\"=hex(0):25,48,4f,4d,45,25,5c,/\n"
2180  " 25,50,41,54,48,25,00\n"
2181  "\"Wine61b\"=hex(0):25,48,4f,4d,45,25,5c/\n"
2182  " 25,50,41,54,48,25,00\n\n", &r);
2183  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2184  verify_reg_nonexist(hkey, "Wine61a");
2185  verify_reg_nonexist(hkey, "Wine61b");
2186 
2187  test_import_str("REGEDIT4\n\n"
2188  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2189  "\"Wine62a\"=hex(0):56,61,6c,75,65,\\", &r);
2190  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2191  err = RegQueryValueExA(hkey, "Wine62a", NULL, NULL, NULL, NULL);
2192  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
2193  "got %u, expected 0\n", err);
2194  if (err == ERROR_SUCCESS)
2195  verify_reg(hkey, "Wine62a", REG_NONE, "Value", 5, 0);
2196 
2197  test_import_str("REGEDIT4\n\n"
2198  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2199  "\"Wine62b\"=hex(2):25,50,41,54,48,25,\\", &r);
2200  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2201  err = RegQueryValueExA(hkey, "Wine62b", NULL, NULL, NULL, NULL);
2202  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
2203  "got %u, expected 0\n", err);
2204  if (err == ERROR_SUCCESS)
2205  verify_reg(hkey, "Wine62b", REG_EXPAND_SZ, "%PATH%", 7, 0);
2206 
2207  test_import_str("REGEDIT4\n\n"
2208  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2209  "\"Wine62c\"=hex:11,22,33,44,55,\\", &r);
2210  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2211  err = RegQueryValueExA(hkey, "Wine62c", NULL, NULL, NULL, NULL);
2212  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
2213  "got %u, expected 0\n", err);
2214  if (err == ERROR_SUCCESS)
2215  verify_reg(hkey, "Wine62c", REG_BINARY, hex, 5, 0);
2216 
2217  test_import_str("REGEDIT4\n\n"
2218  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2219  "\"Wine62d\"=hex(7):4c,69,6e,65,\\", &r);
2220  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2221  err = RegQueryValueExA(hkey, "Wine62d", NULL, NULL, NULL, NULL);
2222  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
2223  "got %u, expected 0\n", err);
2224  if (err == ERROR_SUCCESS)
2225  verify_reg(hkey, "Wine62d", REG_MULTI_SZ, "Line", 5, 0);
2226 
2227  test_import_str("REGEDIT4\n\n"
2228  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2229  "\"Wine62e\"=hex(100):56,61,6c,75,65,\\", &r);
2230  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2231  err = RegQueryValueExA(hkey, "Wine62e", NULL, NULL, NULL, NULL);
2232  ok(err == ERROR_SUCCESS || broken(err == ERROR_FILE_NOT_FOUND) /* WinXP */,
2233  "got %u, expected 0\n", err);
2234  if (err == ERROR_SUCCESS)
2235  verify_reg(hkey, "Wine62e", 0x100, "Value", 5, 0);
2236 
2237  test_import_str("REGEDIT4\n\n"
2238  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2239  "\"Wine62f\"=hex(7):4c,69,6e,65,20\\", &r);
2240  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2241  verify_reg_nonexist(hkey, "Wine62f");
2242 
2243  test_import_str("REGEDIT4\n\n"
2244  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2245  "\"Wine63a\"=hex(7):4c,69,6e,65,20,\\\n"
2246  " ,63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
2247  "\"Wine63b\"=hex(7):4c,69,6e,65,20,\\\n"
2248  " 63,,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2249  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2250  verify_reg_nonexist(hkey, "Wine63a");
2251  verify_reg_nonexist(hkey, "Wine63b");
2252 
2253  test_import_str("REGEDIT4\n\n"
2254  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2255  "\"Wine64a\"=hex(7):4c,69,6e,65,00,00\n"
2256  "\"Wine64b\"=hex(7):4c,69,6e,65,20,\\\n"
2257  " 63,6f,6e,63,61,74,65,6e,61,74,69,6f,6e,00,00\n"
2258  "\"Wine64c\"=hex(7):4c,69,6e,65,20,\\;comment\n"
2259  " 63,6f,6e,63,61,74,\\\n"
2260  " 65,6e,61,74,69,6f,6e,00,00\n"
2261  "\"Wine64d\"=hex(7):4c,69,6e,65,20,\\;comment\n"
2262  " 63,6f,6e,63,61,74,\n"
2263  " 65,6e,61,74,69,6f,6e,00,00\n"
2264  "\"Wine64e\"=hex(7):4c,69,6e,65,20,\\\n"
2265  " 63,6f,6e,63,61,74,;comment\n"
2266  " 65,6e,61,74,69,6f,6e,00,00\n\n", &r);
2267  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2268  verify_reg(hkey, "Wine64a", REG_MULTI_SZ, "Line\0", 6, 0);
2269  verify_reg(hkey, "Wine64b", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2270  verify_reg(hkey, "Wine64c", REG_MULTI_SZ, "Line concatenation\0", 20, 0);
2271  /* Wine64d */
2272  size = sizeof(buffer);
2273  err = RegQueryValueExA(hkey, "Wine64d", NULL, &type, (BYTE *)&buffer, &size);
2274  ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
2275  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
2276  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
2277  ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
2278  /* Wine64e */
2279  size = sizeof(buffer);
2280  err = RegQueryValueExA(hkey, "Wine64e", NULL, &type, (BYTE *)&buffer, &size);
2281  ok(err == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", err);
2282  ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
2283  ok(size == 12 || broken(size == 11) /* WinXP */, "got wrong size %u, expected 12\n", size);
2284  ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
2285 
2286  test_import_str("REGEDIT4\n\n"
2287  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2288  "\"Wine65a\"=hex(100):25,50,41,54,48,25,00\n"
2289  "\"Wine65b\"=hex(100):25,50,41,\\\n"
2290  " 54,48,25,00\n"
2291  "\"Wine65c\"=hex(100):25,50,41,\\;comment\n"
2292  " 54,48,\\\n"
2293  " 25,00\n"
2294  "\"Wine65d\"=hex(100):25,50,41,\\;comment\n"
2295  " 54,48,\n"
2296  " 25,00\n"
2297  "\"Wine65e\"=hex(100):25,50,41,\\;comment\n"
2298  " 54,48,;comment\n"
2299  " 25,00\n", &r);
2300  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2301  verify_reg(hkey, "Wine65a", 0x100, "%PATH%", 7, 0);
2302  verify_reg(hkey, "Wine65b", 0x100, "%PATH%", 7, 0);
2303  verify_reg(hkey, "Wine65c", 0x100, "%PATH%", 7, 0);
2304  verify_reg(hkey, "Wine65d", 0x100, "%PATH", 5, 0);
2305  verify_reg(hkey, "Wine65e", 0x100, "%PATH", 5, 0);
2306 
2307  /* Test null-termination of REG_EXPAND_SZ and REG_MULTI_SZ data*/
2308  test_import_str("REGEDIT4\n\n"
2309  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2310  "\"Wine66a\"=hex(7):4c,69,6e,65\n"
2311  "\"Wine66b\"=hex(7):4c,69,6e,65,\n"
2312  "\"Wine66c\"=hex(7):4c,69,6e,65,00\n"
2313  "\"Wine66d\"=hex(7):4c,69,6e,65,00,\n"
2314  "\"Wine66e\"=hex(7):4c,69,6e,65,00,00\n"
2315  "\"Wine66f\"=hex(7):4c,69,6e,65,00,00,\n\n", &r);
2316  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2317  verify_reg(hkey, "Wine66a", REG_MULTI_SZ, "Line", 5, 0);
2318  verify_reg(hkey, "Wine66b", REG_MULTI_SZ, "Line", 5, 0);
2319  verify_reg(hkey, "Wine66c", REG_MULTI_SZ, "Line", 5, 0);
2320  verify_reg(hkey, "Wine66d", REG_MULTI_SZ, "Line", 5, 0);
2321  verify_reg(hkey, "Wine66e", REG_MULTI_SZ, "Line\0", 6, 0);
2322  verify_reg(hkey, "Wine66f", REG_MULTI_SZ, "Line\0", 6, 0);
2323 
2324  test_import_str("REGEDIT4\n\n"
2325  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2326  "\"Wine67a\"=hex(2):25,50,41,54,48,25\n"
2327  "\"Wine67b\"=hex(2):25,50,41,54,48,25,\n"
2328  "\"Wine67c\"=hex(2):25,50,41,54,48,25,00\n"
2329  "\"Wine67d\"=hex(2):25,50,41,54,48,25,00,\n\n", &r);
2330  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2331  verify_reg(hkey, "Wine67a", REG_EXPAND_SZ, "%PATH%", 7, 0);
2332  verify_reg(hkey, "Wine67b", REG_EXPAND_SZ, "%PATH%", 7, 0);
2333  verify_reg(hkey, "Wine67c", REG_EXPAND_SZ, "%PATH%", 7, 0);
2334  verify_reg(hkey, "Wine67d", REG_EXPAND_SZ, "%PATH%", 7, 0);
2335 
2336  test_import_str("REGEDIT4\n\n"
2337  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2338  "\"Wine68a\"=hex(1):\n"
2339  "\"Wine68b\"=hex(2):\n"
2340  "\"Wine68c\"=hex(3):\n"
2341  "\"Wine68d\"=hex(4):\n"
2342  "\"Wine68e\"=hex(7):\n"
2343  "\"Wine68f\"=hex(100):\n"
2344  "\"Wine68g\"=hex(abcd):\n"
2345  "\"Wine68h\"=hex:\n"
2346  "\"Wine68i\"=hex(0):\n\n", &r);
2347  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2348  verify_reg(hkey, "Wine68a", REG_SZ, NULL, 0, 0);
2349  verify_reg(hkey, "Wine68b", REG_EXPAND_SZ, NULL, 0, 0);
2350  verify_reg(hkey, "Wine68c", REG_BINARY, NULL, 0, 0);
2351  verify_reg(hkey, "Wine68d", REG_DWORD, NULL, 0, 0);
2352  verify_reg(hkey, "Wine68e", REG_MULTI_SZ, NULL, 0, 0);
2353  verify_reg(hkey, "Wine68f", 0x100, NULL, 0, 0);
2354  verify_reg(hkey, "Wine68g", 0xabcd, NULL, 0, 0);
2355  verify_reg(hkey, "Wine68h", REG_BINARY, NULL, 0, 0);
2356  verify_reg(hkey, "Wine68i", REG_NONE, NULL, 0, 0);
2357 
2358  /* Test with embedded null characters */
2359  test_import_str("REGEDIT4\n\n"
2360  "[HKEY_CURRENT_USER\\" KEY_BASE "]\n"
2361  "\"Wine69a\"=\"\\0\n"
2362  "\"Wine69b\"=\"\\0\\0\n"
2363  "\"Wine69c\"=\"Value1\\0\n"
2364  "\"Wine69d\"=\"Value2\\0\\0\\0\\0\n"
2365  "\"Wine69e\"=\"Value3\\0Value4\n"
2366  "\"Wine69f\"=\"\\0Value4\n\n", &r);
2367  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
2368  verify_reg_nonexist(hkey, "Wine69a");
2369  verify_reg_nonexist(hkey, "Wine69b");
2370  verify_reg_nonexist(hkey, "Wine69c");
2371  verify_reg_nonexist(hkey, "Wine69d");
2372  verify_reg_nonexist(hkey, "Wine69e");
2373  verify_reg_nonexist(hkey, "Wine69f");
2374 
2375  err = RegCloseKey(hkey);
2376  ok(err == ERROR_SUCCESS, "got %d, expected 0\n", err);
2377 
2379 }
LONG WINAPI RegQueryValueExA(_In_ HKEY hkeyorg, _In_ LPCSTR name, _In_ LPDWORD reserved, _Out_opt_ LPDWORD type, _Out_opt_ LPBYTE data, _Inout_opt_ LPDWORD count)
Definition: reg.c:4023
#define verify_key(k, s)
Definition: reg.c:107
int memcmp(void *Buffer1, void *Buffer2, ACPI_SIZE Count)
Definition: utclib.c:112
#define ERROR_SUCCESS
Definition: deptool.c:10
#define KEY_SET_VALUE
Definition: nt_native.h:1017
#define REG_BINARY
Definition: nt_native.h:1496
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
#define test_import_str(c, r)
Definition: reg.c:818
#define HKEY_CURRENT_USER
Definition: winreg.h:11
#define verify_reg_nonexist(k, v)
Definition: reg.c:88
#define verify_reg(k, v, t, d, s, todo)
Definition: reg.c:62
GLuint GLuint GLsizei GLenum type
Definition: gl.h:1545
GLuint buffer
Definition: glext.h:5915
static const char hex[16]
Definition: profile.c:123
#define verify_key_nonexist(k, s)
Definition: reg.c:120
#define open_key(b, p, s, k)
Definition: reg.c:98
LONG WINAPI RegCloseKey(HKEY hKey)
Definition: reg.c:423
long LONG
Definition: pedump.c:60
#define REG_MULTI_SZ
Definition: nt_native.h:1501
smooth NULL
Definition: ftsmooth.c:416
#define ERROR_FILE_NOT_FOUND
Definition: disk.h:79
#define run_reg_exe(c, r)
Definition: reg.c:32
GLsizeiptr size
Definition: glext.h:5919
#define KEY_BASE
Definition: reg.c:24
unsigned long DWORD
Definition: ntddk_ex.h:95
#define delete_key(k, p)
Definition: reg.c:144
unsigned char BYTE
Definition: mem.h:68
#define err(...)
#define REG_EXIT_FAILURE
Definition: reg.c:26
#define broken(x)
Definition: _sntprintf.h:21
LONG WINAPI RegDeleteKeyA(_In_ HKEY hKey, _In_ LPCSTR lpSubKey)
Definition: reg.c:1222
#define REG_EXIT_SUCCESS
Definition: reg.c:25
#define REG_EXPAND_SZ
Definition: nt_native.h:1494
#define ok(value,...)
Definition: atltest.h:57
#define delete_value(k, n)
Definition: reg.c:208
#define REG_NONE
Definition: nt_native.h:1492
#define memset(x, y, z)
Definition: compat.h:39
#define REG_DWORD
Definition: sdbapi.c:596
DWORD type
Definition: reg.c:66
#define REG_SZ
Definition: layer.c:22

Referenced by START_TEST().

◆ test_import_31()

static void test_import_31 ( void  )
static

Definition at line 4202 of file reg.c.

4203 {
4204  LONG err;
4205  HKEY hkey;
4206  DWORD r;
4207 
4209  ok(err == ERROR_SUCCESS || err == ERROR_FILE_NOT_FOUND, "RegDeleteKeyA failed: %d\n", err);
4210 
4211  /* Check if reg.exe is running with elevated privileges */
4213  KEY_READ|KEY_SET_VALUE, NULL, &hkey, NULL);
4214  if (err == ERROR_ACCESS_DENIED)
4215  {
4216  win_skip("reg.exe is not running with elevated privileges; "
4217  "skipping Windows 3.1 import tests\n");
4218  return;
4219  }
4220 
4221  /* Test simple value */
4222  test_import_str("REGEDIT\r\n"
4223  "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value0\r\n", &r);
4224  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4225  verify_reg(hkey, "", REG_SZ, "Value0", 7, 0);
4226 
4227  /* Test proper handling of spaces and equals signs */
4228  test_import_str("REGEDIT\r\n"
4229  "HKEY_CLASSES_ROOT\\" KEY_BASE " =Value1\r\n", &r);
4230  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4231  verify_reg(hkey, "", REG_SZ, "Value1", 7, 0);
4232 
4233  test_import_str("REGEDIT\r\n"
4234  "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value2\r\n", &r);
4235  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4236  verify_reg(hkey, "", REG_SZ, " Value2", 8, 0);
4237 
4238  test_import_str("REGEDIT\r\n"
4239  "HKEY_CLASSES_ROOT\\" KEY_BASE " = Value3 \r\n", &r);
4240  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4241  verify_reg(hkey, "", REG_SZ, "Value3 ", 8, 0);
4242 
4243  test_import_str("REGEDIT\r\n"
4244  "HKEY_CLASSES_ROOT\\" KEY_BASE " Value4\r\n", &r);
4245  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4246  verify_reg(hkey, "", REG_SZ, "Value4", 7, 0);
4247 
4248  test_import_str("REGEDIT\r\n"
4249  "HKEY_CLASSES_ROOT\\" KEY_BASE " Value5\r\n", &r);
4250  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4251  verify_reg(hkey, "", REG_SZ, "Value5", 7, 0);
4252 
4253  test_import_str("REGEDIT\r\n"
4254  "HKEY_CLASSES_ROOT\\" KEY_BASE "\r\n", &r);
4255  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4256  verify_reg(hkey, "", REG_SZ, "", 1, 0);
4257 
4258  test_import_str("REGEDIT\r\n"
4259  "HKEY_CLASSES_ROOT\\" KEY_BASE " \r\n", &r);
4260  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4261  verify_reg(hkey, "", REG_SZ, "", 1, 0);
4262 
4263  test_import_str("REGEDIT\r\n"
4264  "HKEY_CLASSES_ROOT\\" KEY_BASE " = No newline", &r);
4265  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4266  verify_reg(hkey, "", REG_SZ, "No newline", 11, 0);
4267 
4268  delete_value(hkey, NULL);
4269 
4270  /* Test character validity at the start of the line */
4271  test_import_str("REGEDIT\r\n"
4272  " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1a\r\n", &r);
4273  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4274  verify_reg_nonexist(hkey, "");
4275 
4276  test_import_str("REGEDIT\r\n"
4277  " HKEY_CLASSES_ROOT\\" KEY_BASE " = Value1b\r\n", &r);
4278  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4279  verify_reg_nonexist(hkey, "");
4280 
4281  test_import_str("REGEDIT\r\n"
4282  "\tHKEY_CLASSES_ROOT\\" KEY_BASE " = Value1c\r\n", &r);
4283  ok(r == REG_EXIT_SUCCESS, "got exit code %d, expected 0\n", r);
4284  verify_reg_nonexist(hkey, "");
4285 
4286  test_import_str("REGEDIT\r\n"