regedit/tests: Enable compilation with long types.

Signed-off-by: Eric Pouech <eric.pouech@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Eric Pouech 2022-02-03 12:04:22 +01:00 committed by Alexandre Julliard
parent 9111ef38c8
commit acdbe6c296
2 changed files with 40 additions and 41 deletions

View File

@ -1,4 +1,3 @@
EXTRADEFS = -DWINE_NO_LONG_TYPES
TESTDLL = regedit.exe
IMPORTS = advapi32

View File

@ -56,12 +56,12 @@ static BOOL write_file(const void *str, DWORD size)
file = CreateFileA("test.reg", GENERIC_WRITE, 0, NULL, CREATE_ALWAYS,
FILE_ATTRIBUTE_NORMAL, NULL);
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
ok(file != INVALID_HANDLE_VALUE, "CreateFile failed: %lu\n", GetLastError());
if (file == INVALID_HANDLE_VALUE)
return FALSE;
ret = WriteFile(file, str, size, &written, NULL);
ok(ret, "WriteFile failed: %u\n", GetLastError());
ok(ret, "WriteFile failed: %lu\n", GetLastError());
CloseHandle(file);
return ret;
@ -96,7 +96,7 @@ static BOOL import_reg(unsigned line, const char *contents, BOOL unicode)
run_regedit_exe("regedit.exe /s test.reg");
ret = DeleteFileA("test.reg");
lok(ret, "DeleteFile failed: %u\n", GetLastError());
lok(ret, "DeleteFile failed: %lu\n", GetLastError());
return ret;
}
@ -118,14 +118,14 @@ static void verify_reg_(unsigned line, HKEY hkey, const char *value,
size = sizeof(data);
memset(data, 0xdd, size);
err = RegQueryValueExA(hkey, value, NULL, &type, data, &size);
lok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %d\n", err);
lok(err == ERROR_SUCCESS, "RegQueryValueEx failed: got %ld\n", err);
if (err != ERROR_SUCCESS)
return;
todo_wine_if (todo & TODO_REG_TYPE)
lok(type == exp_type, "got wrong type %d, expected %d\n", type, exp_type);
lok(type == exp_type, "got wrong type %ld, expected %ld\n", type, exp_type);
todo_wine_if (todo & TODO_REG_SIZE)
lok(size == exp_size, "got wrong size %d, expected %d\n", size, exp_size);
lok(size == exp_size, "got wrong size %ld, expected %ld\n", size, exp_size);
if (exp_data)
{
todo_wine_if (todo & TODO_REG_DATA)
@ -139,7 +139,7 @@ static void r_verify_reg_nonexist(unsigned line, HKEY key, const char *value_nam
LONG lr;
lr = RegQueryValueExA(key, value_name, NULL, NULL, NULL, NULL);
lok(lr == ERROR_FILE_NOT_FOUND, "registry value '%s' shouldn't exist; got %d, expected 2\n",
lok(lr == ERROR_FILE_NOT_FOUND, "registry value '%s' shouldn't exist; got %ld, expected 2\n",
(value_name && *value_name) ? value_name : "(Default)", lr);
}
@ -149,7 +149,7 @@ static void open_key_(unsigned line, const HKEY base, const char *path, const DW
LONG lr;
lr = RegOpenKeyExA(base, path, 0, KEY_READ|sam, hkey);
lok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: %ld\n", lr);
}
#define close_key(k) close_key_(__LINE__,k)
@ -158,7 +158,7 @@ static void close_key_(unsigned line, HKEY hkey)
LONG lr;
lr = RegCloseKey(hkey);
lok(lr == ERROR_SUCCESS, "RegCloseKey failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegCloseKey failed: %ld\n", lr);
}
#define verify_key(k,s) verify_key_(__LINE__,k,s)
@ -168,7 +168,7 @@ static void verify_key_(unsigned line, HKEY key_base, const char *subkey)
LONG lr;
lr = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey);
lok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: got %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegOpenKeyExA failed: got %ld\n", lr);
if (hkey)
RegCloseKey(hkey);
@ -181,7 +181,7 @@ static void verify_key_nonexist_(unsigned line, HKEY key_base, const char *subke
LONG lr;
lr = RegOpenKeyExA(key_base, subkey, 0, KEY_READ, &hkey);
lok(lr == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %d, expected 2\n",
lok(lr == ERROR_FILE_NOT_FOUND, "registry key '%s' shouldn't exist; got %ld, expected 2\n",
subkey, lr);
if (hkey)
@ -195,7 +195,7 @@ static void add_key_(unsigned line, const HKEY hkey, const char *path, HKEY *sub
lr = RegCreateKeyExA(hkey, path, 0, NULL, REG_OPTION_NON_VOLATILE,
KEY_READ|KEY_WRITE, NULL, subkey, NULL);
lok(lr == ERROR_SUCCESS, "RegCreateKeyExA failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegCreateKeyExA failed: %ld\n", lr);
}
#define delete_key(k,p) delete_key_(__LINE__,k,p)
@ -206,7 +206,7 @@ static void delete_key_(unsigned line, const HKEY hkey, const char *path)
LONG lr;
lr = RegDeleteKeyA(hkey, path);
lok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegDeleteKeyA failed: %ld\n", lr);
}
}
@ -259,7 +259,7 @@ static void add_value_(unsigned line, HKEY hkey, const char *name, DWORD type,
LONG lr;
lr = RegSetValueExA(hkey, name, 0, type, (const BYTE *)data, size);
lok(lr == ERROR_SUCCESS, "RegSetValueExA failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegSetValueExA failed: %ld\n", lr);
}
#define delete_value(k,n) delete_value_(__LINE__,k,n)
@ -268,7 +268,7 @@ static void delete_value_(unsigned line, const HKEY hkey, const char *name)
LONG lr;
lr = RegDeleteValueA(hkey, name);
lok(lr == ERROR_SUCCESS, "RegDeleteValueA failed: %d\n", lr);
lok(lr == ERROR_SUCCESS, "RegDeleteValueA failed: %ld\n", lr);
}
#define KEY_BASE "Software\\Wine\\regedit_test"
@ -450,17 +450,17 @@ static void test_basic_import(void)
/* Wine11d */
size = sizeof(buffer);
lr = RegQueryValueExA(hkey, "Wine11d", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %u, expected 6\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %lu, expected 6\n", size);
ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
/* Wine11e */
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine11e", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %u, expected 6\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %lu, expected 6\n", size);
ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
exec_import_str("REGEDIT4\n\n"
@ -596,17 +596,17 @@ static void test_basic_import(void)
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine18d", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %u, expected 12\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %lu, expected 12\n", size);
ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
/* Wine18e */
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine18e", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %u, expected 12\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %lu, expected 12\n", size);
ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
exec_import_str("REGEDIT4\n\n"
@ -886,17 +886,17 @@ static void test_basic_import_unicode(void)
/* Wine11d */
size = sizeof(buffer);
lr = RegQueryValueExA(hkey, "Wine11d", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %u, expected 6\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %lu, expected 6\n", size);
ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
/* Wine11e */
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine11e", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %u, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %u, expected 6\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_EXPAND_SZ, "got wrong type %lu, expected %u\n", type, REG_EXPAND_SZ);
ok(size == 6 || broken(size == 5) /* Win2k */, "got wrong size %lu, expected 6\n", size);
ok(memcmp(buffer, "%PATH", size) == 0, "got wrong data\n");
exec_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
@ -1035,17 +1035,17 @@ static void test_basic_import_unicode(void)
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine18d", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %u, expected 12\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %lu, expected 12\n", size);
ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
/* Wine18e */
size = sizeof(buffer);
memset(buffer, '-', size);
lr = RegQueryValueExA(hkey, "Wine18e", NULL, &type, (BYTE *)&buffer, &size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %d\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %u, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %u, expected 12\n", size);
ok(lr == ERROR_SUCCESS, "RegQueryValueExA failed: %ld\n", lr);
ok(type == REG_MULTI_SZ, "got wrong type %lu, expected %u\n", type, REG_MULTI_SZ);
ok(size == 12 || broken(size == 11) /* Win2k */, "got wrong size %lu, expected 12\n", size);
ok(memcmp(buffer, "Line concat", size) == 0, "got wrong data\n");
exec_import_wstr("\xef\xbb\xbfWindows Registry Editor Version 5.00\n\n"
@ -3450,7 +3450,7 @@ static BOOL compare_export_(unsigned line, const char *filename, const char *exp
lok(!lstrcmpW(fbuf, wstr), "export data does not match expected data\n");
ret = DeleteFileA(filename);
lok(ret, "DeleteFile failed: %u\n", GetLastError());
lok(ret, "DeleteFile failed: %lu\n", GetLastError());
exit:
HeapFree(GetProcessHeap(), 0, fbuf);