35#define IS_HKCR(hk) ((UINT_PTR)hk > 0 && ((UINT_PTR)hk & 3) == 2)
40static const char *
sTestpath1 =
"%LONGSYSTEMVAR%\\subdir1";
64 static char *
list[32];
80 static const char hex[16] =
"0123456789abcdef";
86 if (!
str)
return "(null)";
98 unsigned char c = *
str++;
101 case '\n': *
dst++ =
'\\'; *
dst++ =
'n';
break;
102 case '\r': *
dst++ =
'\\'; *
dst++ =
'r';
break;
103 case '\t': *
dst++ =
'\\'; *
dst++ =
't';
break;
104 case '"': *
dst++ =
'\\'; *
dst++ =
'"';
break;
105 case '\\': *
dst++ =
'\\'; *
dst++ =
'\\';
break;
107 if (
c >=
' ' &&
c <= 126)
129#define ADVAPI32_GET_PROC(func) \
130 p ## func = (void*)GetProcAddress(hadvapi32, #func)
191 ok(hkey !=
NULL,
"RegOpenKeyExA succeeded but returned NULL hkey\n");
196 ok(hkey ==
NULL,
"RegOpenKeyExA failed but returned hkey %p\n", hkey);
198 trace(
"running as limited user\n");
202#define lok ok_(__FILE__, line)
203#define test_hkey_main_Value_A(name, string, full_byte_len) _test_hkey_main_Value_A(__LINE__, name, string, full_byte_len)
221 ok(
GLE == 0xdeadbeef,
"RegQueryValueExA set GLE = %u\n",
GLE);
224 str_byte_len = (
string ?
lstrlenA(
string) : 0) + 1;
226 lok(cbData == full_byte_len,
"cbData=%d instead of %d or %d\n", cbData, full_byte_len, str_byte_len);
237 lok(*
value == 0xbd,
"RegQueryValueExA overflowed: cbData=%u *value=%02x\n", cbData, *
value);
241 lok(
memcmp(
value,
string, cbData) == 0,
"RegQueryValueExA/2 failed: %s/%d != %s/%d\n",
244 lok(*(
value+cbData) == 0xbd,
"RegQueryValueExA/2 overflowed at offset %u: %02x != bd\n", cbData, *(
value+cbData));
249#define test_hkey_main_Value_W(name, string, full_byte_len) _test_hkey_main_Value_W(__LINE__, name, string, full_byte_len)
267 win_skip(
"RegQueryValueExW() is not implemented\n");
272 lok(cbData == full_byte_len,
273 "cbData=%d instead of %d\n", cbData, full_byte_len);
284 lok(
memcmp(
value,
string, cbData) == 0,
"RegQueryValueExW failed: %s/%d != %s/%d\n",
289 lok(*(
value+cbData) == 0xbd,
"RegQueryValueExW/2 overflowed at %u: %02x != bd\n", cbData, *(
value+cbData));
290 lok(*(
value+cbData+1) == 0xbd,
"RegQueryValueExW/2 overflowed at %u+1: %02x != bd\n", cbData, *(
value+cbData+1));
298 static const WCHAR name1W[] = {
'C',
'l',
'e',
'a',
'n',
'S',
'i',
'n',
'g',
'l',
'e',
'S',
't',
'r',
'i',
'n',
'g', 0};
299 static const WCHAR name2W[] = {
'S',
'o',
'm',
'e',
'I',
'n',
't',
'r',
'a',
'Z',
'e',
'r',
'o',
'e',
'd',
'S',
't',
'r',
'i',
'n',
'g', 0};
301 static const WCHAR string1W[] = {
'T',
'h',
'i',
's',
'N',
'e',
'v',
'e',
'r',
'B',
'r',
'e',
'a',
'k',
's', 0};
302 static const WCHAR string2W[] = {
'T',
'h',
'i',
's', 0 ,
'B',
'r',
'e',
'a',
'k',
's', 0 , 0 ,
'A', 0 , 0 , 0 ,
'L',
'o',
't', 0 , 0 , 0 , 0, 0};
303 static const WCHAR substring2W[] = {
'T',
'h',
'i',
's',0};
305 static const char name1A[] =
"CleanSingleString";
306 static const char name2A[] =
"SomeIntraZeroedString";
307 static const char emptyA[] =
"";
308 static const char string1A[] =
"ThisNeverBreaks";
309 static const char string2A[] =
"This\0Breaks\0\0A\0\0\0Lot\0\0\0\0";
310 static const char substring2A[] =
"This";
458 if (!pRegSetKeyValueW)
459 win_skip(
"RegSetKeyValue() is not supported.\n");
462 static const WCHAR subkeyW[] = {
's',
'u',
'b',
'k',
'e',
'y',0};
471 ret = pRegSetKeyValueW(
hkey_main, subkeyW, name1W,
REG_SZ, string1W,
sizeof(string1W));
479 ok(
len ==
sizeof(string1W),
"got %d\n",
len);
497 static const DWORD qw[2] = { 0x12345678, 0x87654321 };
503 "RegSetValueExA failed\n");
505 "RegSetValueExA failed\n");
507 "RegSetValueExA failed\n");
509 "RegSetValueExA failed\n");
511 "RegSetValueExA failed\n");
513 "RegSetValueExA failed\n");
515 "RegSetValueExA failed\n");
525 static const WCHAR foobarW[] = {
'f',
'o',
'o',
'b',
'a',
'r',0};
526 static const WCHAR testW[] = {
'T',
'e',
's',
't',0};
527 static const WCHAR xxxW[] = {
'x',
'x',
'x',
'x',
'x',
'x',
'x',
'x',0};
538 ok( !
res,
"RegSetValueExA returned %d\n",
res );
552 ok( val_count == 4,
"val_count set to %d instead of 4\n", val_count );
553 ok( data_count == 0,
"data_count set to %d instead of 0\n", data_count );
556 ok( !
strcmp(
data,
"xxxxxxxxxx" ),
"data is '%s' instead of xxxxxxxxxx\n",
data );
562 memcpy( dataW, xxxW,
sizeof(xxxW) );
565 ok( val_count == 4,
"val_count set to %d instead of 4\n", val_count );
566 ok( data_count == 0,
"data_count set to %d instead of 0\n", data_count );
569 ok( !
memcmp( dataW, xxxW,
sizeof(xxxW) ),
"data is not 'xxxxxxxxxx'\n" );
572 ok(
res == 0,
"RegSetValueExA failed error %d\n",
res );
582 ok( val_count == 2,
"val_count set to %d\n", val_count );
583 ok( data_count == 7 ||
broken( data_count == 8 ),
"data_count set to %d instead of 7\n", data_count );
596 ok( val_count == 3,
"val_count set to %d\n", val_count );
597 ok( data_count == 7 ||
broken( data_count == 8 ),
"data_count set to %d instead of 7\n", data_count );
601 "value set to '%s' instead of 'Te' or 'xxxxxxxxxx'\n",
value );
603 "data set to '%s' instead of 'foobar' or 'xxxxxxx'\n",
data );
613 ok( val_count == 0,
"val_count set to %d\n", val_count );
614 ok( data_count == 7 ||
broken( data_count == 8 ),
"data_count set to %d instead of 7\n", data_count );
619 "data set to '%s' instead of 'foobar' or 'xxxxxxx'\n",
data );
629 ok( val_count == 20,
"val_count set to %d\n", val_count );
630 ok( data_count == 7,
"data_count set to %d instead of 7\n", data_count );
643 ok( val_count == 4,
"val_count set to %d instead of 4\n", val_count );
644 ok( data_count == 7,
"data_count set to %d instead of 7\n", data_count );
681 win_skip(
"RegSetValueExW is not implemented\n");
684 ok(
res == 0,
"RegSetValueExW failed error %d\n",
res );
691 memcpy( dataW, xxxW,
sizeof(xxxW) );
694 ok( val_count == 2,
"val_count set to %d\n", val_count );
695 ok( data_count == 7*
sizeof(
WCHAR),
"data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
698 ok( !
memcmp( dataW, xxxW,
sizeof(xxxW) ),
"data modified\n" );
705 memcpy( dataW, xxxW,
sizeof(xxxW) );
708 ok( val_count == 3,
"val_count set to %d\n", val_count );
709 ok( data_count == 7*
sizeof(
WCHAR),
"data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
712 ok( !
memcmp( dataW, xxxW,
sizeof(xxxW) ),
"data modified\n" );
719 memcpy( dataW, xxxW,
sizeof(xxxW) );
722 ok( val_count == 4,
"val_count set to %d instead of 4\n", val_count );
723 ok( data_count == 7*
sizeof(
WCHAR),
"data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
726 ok( !
memcmp( dataW, xxxW,
sizeof(xxxW) ),
"data modified\n" );
733 memcpy( dataW, xxxW,
sizeof(xxxW) );
736 ok( val_count == 4,
"val_count set to %d instead of 4\n", val_count );
737 ok( data_count == 7*
sizeof(
WCHAR),
"data_count set to %d instead of 7*sizeof(WCHAR)\n", data_count );
747 memcpy( dataW, xxxW,
sizeof(xxxW) );
755 memcpy( dataW, xxxW,
sizeof(xxxW) );
763 memcpy( dataW, xxxW,
sizeof(xxxW) );
788 ok(
size == 0,
"size should have been set to 0 instead of %d\n",
size);
793 ok(
size ==
sizeof(
buffer),
"size shouldn't have been changed to %d\n",
size);
807 CHAR expanded[] =
"bar\\subdir1";
808 CHAR expanded2[] =
"ImARatherLongButIndeedNeededString\\subdir1";
812 win_skip(
"RegGetValue not available on this platform\n");
826 ok(
dw == 0x12345678,
"dw=%d\n",
dw);
839 ok(
dw == 0x12345678,
"dw=%d\n",
dw);
849 ok(
dw == 0,
"dw=%d\n",
dw);
864 ok(
dw == 0x12345678,
"dw=%d\n",
dw);
872 ok(
dw == 0x12345678,
"dw=%d\n",
dw);
875 qw[0] = qw[1] =
size =
type = 0xdeadbeef;
880 ok(qw[0] == 0x12345678 &&
881 qw[1] == 0x87654321,
"qw={%d,%d}\n", qw[0], qw[1]);
887 ok(
dw == 0xdeadbeef,
"dw=%d\n",
dw);
891 qw[0] = qw[1] =
size =
type = 0xdeadbeef;
896 ok(qw[0] == 0x12345678 &&
897 qw[1] == 0x87654321,
"qw={%d,%d}\n", qw[0], qw[1]);
956 ok(!
strcmp(expanded,
buf),
"expanded=\"%s\" buf=\"%s\"\n", expanded,
buf);
966 ok(!
strcmp(expanded2,
buf),
"expanded2=\"%s\" buf=\"%s\"\n", expanded2,
buf);
1001 ok(!
strcmp(expanded,
buf),
"expanded=\"%s\" buf=\"%s\"\n", expanded,
buf);
1021 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1022 hkPreserve = hkResult;
1027 ok(hkResult != hkPreserve,
"expected hkResult != hkPreserve\n");
1028 ok(hkResult !=
NULL,
"hkResult != NULL\n");
1039 hkResult = hkPreserve;
1042 ok(hkResult ==
NULL,
"expected hkResult == NULL\n");
1045 hkResult = hkPreserve;
1048 ok(hkResult ==
NULL,
"expected hkResult == NULL\n");
1053 hkResult = hkPreserve;
1059 hkResult = hkPreserve;
1067 hkResult = hkPreserve;
1070 ok(hkResult ==
NULL,
"expected hkResult == NULL\n");
1075 hkResult = hkPreserve;
1078 "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n",
ret);
1079 ok(hkResult == hkPreserve,
"expected hkResult == hkPreserve\n");
1095 "expected ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d\n",
ret);
1102 "expected ERROR_SUCCESS, ERROR_BAD_PATHNAME or ERROR_FILE_NOT_FOUND, got %d\n",
ret);
1123 hkResult = hkPreserve;
1126 ok(hkResult != hkPreserve,
"expected hkResult != hkPreserve\n");
1130 hkResult = hkPreserve;
1133 ok(hkResult != hkPreserve,
"expected hkResult != hkPreserve\n");
1137 hkResult = hkPreserve;
1140 ok(hkResult == hkPreserve,
"expected hkResult == hkPreserve\n");
1148 "RegOpenKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1154 "RegOpenKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1165 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1170 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1175 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1180 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1186 ok(hkResult !=
NULL,
"expected hkResult != NULL\n");
1194 if (!pIsWow64Process)
1196 win_skip(
"WOW64 flags are not recognized\n");
1204 "RegCreateKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1207 "RegCreateKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1213 "RegCreateKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1216 "RegCreateKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1219 0, 0, 0, 0, 0, 0, 0, &world_sid);
1221 "Expected AllocateAndInitializeSid to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1230 access.Trustee.ptstrName = (
char *)world_sid;
1234 "Expected SetEntriesInAclA to return ERROR_SUCCESS, got %u, last error %u\n",
ret,
GetLastError());
1239 "Expected InitializeSecurityDescriptor to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1243 "Expected SetSecurityDescriptorDacl to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1247 skip(
"not enough privileges to modify HKLM\n");
1255 "Expected RegSetKeySecurity to return success, got error %u\n",
error);
1259 "Expected RegSetKeySecurity to return success, got error %u\n",
error);
1264 "RegOpenKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1270 "RegOpenKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1298 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1302 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1312 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1317 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1321 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1334 ok(!
ret,
"RegCreateKeyExA failed with error %d\n",
ret);
1356 "RegOpenKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1362 "RegOpenKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1369 if (!pIsWow64Process)
1371 win_skip(
"WOW64 flags are not recognized\n");
1379 "RegCreateKeyEx with KEY_WOW64_32KEY failed (err=%d)\n",
ret);
1382 "RegCreateKeyEx with KEY_WOW64_32KEY failed (err=%d)\n",
ret);
1388 "RegCreateKeyEx with KEY_WOW64_64KEY failed (err=%d)\n",
ret);
1391 "RegCreateKeyEx with KEY_WOW64_64KEY failed (err=%d)\n",
ret);
1394 0, 0, 0, 0, 0, 0, 0, &world_sid);
1396 "Expected AllocateAndInitializeSid to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1405 access.Trustee.ptstrName = (
char *)world_sid;
1409 "Expected SetEntriesInAclA to return ERROR_SUCCESS, got %u, last error %u\n", dwRet,
GetLastError());
1414 "Expected InitializeSecurityDescriptor to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1418 "Expected SetSecurityDescriptorDacl to return TRUE, got %d, last error %u\n", bRet,
GetLastError());
1422 skip(
"not enough privileges to modify HKLM\n");
1428 "Expected RegSetKeySecurity to return success, got error %u\n",
ret);
1432 "Expected RegSetKeySecurity to return success, got error %u\n",
ret);
1438 "RegOpenKeyEx with KEY_WOW64_64KEY failed (err=%u)\n",
ret);
1445 "RegOpenKeyEx with KEY_WOW64_32KEY failed (err=%u)\n",
ret);
1474 "expected ERROR_INVALID_HANDLE or ERROR_SUCCESS, got %d\n",
ret);
1479 "expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n",
ret);
1487 trace(
"The main handle is most likely closed, so re-opening\n");
1505 trace(
"We are probably running on NT4 or W2K as the main key is deleted,"
1506 " re-creating the main key\n");
1540 tp.PrivilegeCount = 1;
1541 tp.Privileges[0].Luid = luid;
1546 tp.Privileges[0].Attributes = 0;
1566 win_skip(
"Failed to set SE_BACKUP_NAME privileges, skipping tests\n");
1584 win_skip(
"Failed to set SE_RESTORE_NAME privileges, skipping tests\n");
1606 win_skip(
"Failed to set SE_RESTORE_NAME privileges, skipping tests\n");
1644 "RegConnectRegistryA failed err = %d\n", retl);
1651 "RegConnectRegistryA failed err = %d\n", retl);
1658 win_skip(
"OpenSCManagerA is not implemented\n");
1694 "Expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n",
ret);
1702 "Expected ERROR_INVALID_HANDLE or ERROR_BADKEY, got %d\n",
ret);
1717 ok(!
val[0],
"Expected val to be untouched, got %s\n",
val);
1730 ok(!
val[0],
"Expected val to be untouched, got %s\n",
val);
1754 win_skip(
"RegQueryValueW is not implemented\n");
1759 ok(!valW[0],
"Expected valW to be untouched\n");
1768 ok(!valW[0],
"Expected valW to be untouched\n");
1772 size =
sizeof(valW);
1783 memset(valW,
'a',
sizeof(valW));
1784 size =
sizeof(valW);
1800 char classbuffer[32];
1801 WCHAR classbufferW[32];
1802 char expectbuffer[32];
1803 WCHAR expectbufferW[32];
1804 char subkey_class[] =
"subkey class";
1805 WCHAR subkey_classW[] = {
's',
'u',
'b',
'k',
'e',
'y',
' ',
'c',
'l',
'a',
's',
's',0};
1806 char subsubkey_class[] =
"subsubkey class";
1808 DWORD subkeys, maxsubkeylen, maxclasslen;
1817 ret =
RegQueryInfoKeyA(
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1820 ret =
RegQueryInfoKeyW(
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1824 ret =
RegQueryInfoKeyA(subkey,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1827 ret =
RegQueryInfoKeyW(subkey,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1831 memset(classbuffer, 0x55,
sizeof(classbuffer));
1832 ret =
RegQueryInfoKeyA(subkey, classbuffer,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1834 ok(classbuffer[0] == 0x55,
"classbuffer[0] = 0x%x\n", classbuffer[0]);
1836 memset(classbufferW, 0x55,
sizeof(classbufferW));
1837 ret =
RegQueryInfoKeyW(subkey, classbufferW,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1839 ok(classbufferW[0] == 0x5555,
"classbufferW[0] = 0x%x\n", classbufferW[0]);
1842 sdlen = classlen =0;
1843 ret =
RegQueryInfoKeyA(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1845 ok(classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1846 ok(subkeys == 0,
"subkeys = %u\n", subkeys);
1847 ok(maxsubkeylen == 0,
"maxsubkeylen = %u\n", maxsubkeylen);
1848 ok(maxclasslen == 0,
"maxclasslen = %u\n", maxclasslen);
1850 ok(maxvaluenamelen == 0,
"maxvaluenamelen = %u\n", maxvaluenamelen);
1851 ok(maxvaluelen == 0,
"maxvaluelen = %u\n", maxvaluelen);
1856 sdlen = classlen = 0;
1857 ret =
RegQueryInfoKeyW(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1859 ok(classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1860 ok(subkeys == 0,
"subkeys = %u\n", subkeys);
1861 ok(maxsubkeylen == 0,
"maxsubkeylen = %u\n", maxsubkeylen);
1862 ok(maxclasslen == 0,
"maxclasslen = %u\n", maxclasslen);
1864 ok(maxvaluenamelen == 0,
"maxvaluenamelen = %u\n", maxvaluenamelen);
1865 ok(maxvaluelen == 0,
"maxvaluelen = %u\n", maxvaluelen);
1877 sdlen = classlen = 0;
1878 ret =
RegQueryInfoKeyA(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1880 ok(classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1881 ok(subkeys == 1,
"subkeys = %u\n", subkeys);
1882 ok(maxsubkeylen ==
strlen(
"subsubkey"),
"maxsubkeylen = %u\n", maxsubkeylen);
1883 ok(maxclasslen ==
strlen(subsubkey_class),
"maxclasslen = %u\n", maxclasslen);
1885 ok(maxvaluenamelen == 0,
"maxvaluenamelen = %u\n", maxvaluenamelen);
1886 ok(maxvaluelen ==
sizeof(
"data") *
sizeof(
WCHAR),
"maxvaluelen = %u\n", maxvaluelen);
1891 sdlen = classlen = 0;
1892 ret =
RegQueryInfoKeyW(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1894 ok(classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1895 ok(subkeys == 1,
"subkeys = %u\n", subkeys);
1896 ok(maxsubkeylen ==
strlen(
"subsubkey"),
"maxsubkeylen = %u\n", maxsubkeylen);
1897 ok(maxclasslen ==
strlen(subsubkey_class),
"maxclasslen = %u\n", maxclasslen);
1899 ok(maxvaluenamelen == 0,
"maxvaluenamelen = %u\n", maxvaluenamelen);
1900 ok(maxvaluelen ==
sizeof(
"data") *
sizeof(
WCHAR),
"maxvaluelen = %u\n", maxvaluelen);
1913 ret =
RegQueryInfoKeyA(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1916 ok(maxvaluenamelen ==
strlen(
"value one"),
"maxvaluenamelen = %u\n", maxvaluenamelen);
1917 ok(maxvaluelen ==
sizeof(
"second value data") *
sizeof(
WCHAR),
"maxvaluelen = %u\n", maxvaluelen);
1920 ret =
RegQueryInfoKeyW(subkey,
NULL, &classlen,
NULL, &subkeys, &maxsubkeylen, &maxclasslen, &
values, &maxvaluenamelen, &maxvaluelen, &sdlen, &lastwrite);
1923 ok(maxvaluenamelen ==
strlen(
"value one"),
"maxvaluenamelen = %u\n", maxvaluenamelen);
1924 ok(maxvaluelen ==
sizeof(
"second value data") *
sizeof(
WCHAR),
"maxvaluelen = %u\n", maxvaluelen);
1927 memset(classbuffer, 0x55,
sizeof(classbuffer));
1929 ret =
RegQueryInfoKeyA(subkey, classbuffer, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1931 ok(classlen ==
strlen(subkey_class) ||
1932 classlen == 0,
"classlen = %u\n", classlen);
1933 memset(expectbuffer, 0x55,
sizeof(expectbuffer));
1934 ok(!
memcmp(classbuffer, expectbuffer,
sizeof(classbuffer)),
"classbuffer was modified\n");
1936 memset(classbufferW, 0x55,
sizeof(classbufferW));
1938 ret =
RegQueryInfoKeyW(subkey, classbufferW, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1940 ok(classlen ==
strlen(subkey_class) ||
1941 classlen == 0,
"classlen = %u\n", classlen);
1942 memset(expectbufferW, 0x55,
sizeof(expectbufferW));
1943 ok(!
memcmp(classbufferW, expectbufferW,
sizeof(classbufferW)),
"classbufferW was modified\n");
1946 memset(classbuffer, 0x55,
sizeof(classbuffer));
1948 ret =
RegQueryInfoKeyA(subkey, classbuffer, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1950 ok(classlen == 0,
"classlen = %u\n", classlen);
1951 memset(expectbuffer, 0x55,
sizeof(expectbuffer));
1952 expectbuffer[0] = 0;
1953 ok(!
memcmp(classbuffer, expectbuffer,
sizeof(classbuffer)),
"classbuffer was modified\n");
1955 memset(classbufferW, 0x55,
sizeof(classbufferW));
1957 ret =
RegQueryInfoKeyW(subkey, classbufferW, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1960 classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1961 memset(expectbufferW, 0x55,
sizeof(expectbufferW));
1962 ok(!
memcmp(classbufferW, expectbufferW,
sizeof(classbufferW)),
"classbufferW was modified\n");
1965 memset(classbuffer, 0x55,
sizeof(classbuffer));
1966 classlen =
sizeof(subkey_class) - 1;
1967 ret =
RegQueryInfoKeyA(subkey, classbuffer, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1969 ok(classlen ==
sizeof(subkey_class) - 2,
"classlen = %u\n", classlen);
1970 memset(expectbuffer, 0x55,
sizeof(expectbuffer));
1971 strcpy(expectbuffer, subkey_class);
1972 expectbuffer[
sizeof(subkey_class) - 2] = 0;
1973 expectbuffer[
sizeof(subkey_class) - 1] = 0x55;
1974 ok(!
memcmp(classbuffer, expectbuffer,
sizeof(classbuffer)),
1975 "classbuffer = %.*s, expected %s\n",
1976 (
int)
sizeof(classbuffer), classbuffer, expectbuffer);
1978 memset(classbufferW, 0x55,
sizeof(classbufferW));
1979 classlen =
sizeof(subkey_class) - 1;
1980 ret =
RegQueryInfoKeyW(subkey, classbufferW, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1982 ok(classlen ==
sizeof(subkey_class) - 2 ||
1983 classlen ==
strlen(subkey_class),
"classlen = %u\n", classlen);
1984 memset(expectbufferW, 0x55,
sizeof(expectbufferW));
1985 ok(!
memcmp(classbufferW, expectbufferW,
sizeof(classbufferW)),
"classbufferW was modified\n");
1988 memset(classbuffer, 0x55,
sizeof(classbuffer));
1989 classlen =
sizeof(subkey_class);
1990 ret =
RegQueryInfoKeyA(subkey, classbuffer, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
1992 ok(classlen ==
sizeof(subkey_class) - 1,
"classlen = %u\n", classlen);
1993 memset(expectbuffer, 0x55,
sizeof(expectbuffer));
1994 strcpy(expectbuffer, subkey_class);
1995 ok(!
memcmp(classbuffer, expectbuffer,
sizeof(classbuffer)),
1996 "classbuffer = \"%.*s\", expected %s\n",
1997 (
int)
sizeof(classbuffer), classbuffer, expectbuffer);
1999 memset(classbuffer, 0x55,
sizeof(classbuffer));
2000 classlen = 0xdeadbeef;
2001 ret =
RegQueryInfoKeyA(subkey, classbuffer, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
2003 ok(classlen ==
sizeof(subkey_class) - 1,
"classlen = %u\n", classlen);
2004 memset(expectbuffer, 0x55,
sizeof(expectbuffer));
2005 strcpy(expectbuffer, subkey_class);
2006 ok(!
memcmp(classbuffer, expectbuffer,
sizeof(classbuffer)),
2007 "classbuffer = \"%.*s\", expected %s\n",
2008 (
int)
sizeof(classbuffer), classbuffer, expectbuffer);
2010 memset(classbufferW, 0x55,
sizeof(classbufferW));
2011 classlen =
sizeof(subkey_class);
2012 ret =
RegQueryInfoKeyW(subkey, classbufferW, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
2014 ok(classlen ==
sizeof(subkey_class) - 1,
"classlen = %u\n", classlen);
2015 memset(expectbufferW, 0x55,
sizeof(expectbufferW));
2016 lstrcpyW(expectbufferW, subkey_classW);
2017 ok(!
memcmp(classbufferW, expectbufferW,
sizeof(classbufferW)),
2018 "classbufferW = %s, expected %s\n",
2021 memset(classbufferW, 0x55,
sizeof(classbufferW));
2022 classlen = 0xdeadbeef;
2023 ret =
RegQueryInfoKeyW(subkey, classbufferW, &classlen,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL,
NULL);
2025 ok(classlen ==
sizeof(subkey_class) - 1,
"classlen = %u\n", classlen);
2026 memset(expectbufferW, 0x55,
sizeof(expectbufferW));
2027 lstrcpyW(expectbufferW, subkey_classW);
2028 ok(!
memcmp(classbufferW, expectbufferW,
sizeof(classbufferW)),
2029 "classbufferW = %s, expected %s\n",
2042 static const char string[] =
"FullString";
2124 win_skip(
"Skipping RegCopyTreeA tests, function not present\n");
2134 ret = pRegCopyTreeA(
src,
"nonexistent_subkey",
dst);
2158 ret = pRegCopyTreeA(
src,
"subkey2",
dst);
2213 HKEY subkey, subkey2;
2217 if(!pRegDeleteTreeA) {
2218 win_skip(
"Skipping RegDeleteTreeA tests, function not present\n");
2233 ret = pRegDeleteTreeA(subkey,
"subkey2");
2236 "subkey2 was not deleted\n");
2239 "Default value of subkey no longer present\n");
2248 "subkey2 was not deleted\n");
2250 "Default value of subkey no longer present\n");
2264 ret = pRegDeleteTreeA(subkey,
NULL);
2267 "subkey was deleted\n");
2269 "subkey2 was not deleted\n");
2271 "subkey3 was not deleted\n");
2275 "Default value of subkey is not present\n");
2279 "Value is still present\n");
2285 ret = pRegDeleteTreeA(subkey,
"");
2297 "Expected ERROR_FILE_NOT_FOUND, got %d\n",
ret);
2304 static const char keyname[] =
"test_rw_order";
2312 skip(
"Couldn't create key. Skipping.\n");
2317 "RegSetValueExA for value \"A\" failed\n");
2319 "RegSetValueExA for value \"C\" failed\n");
2321 "RegSetValueExA for value \"D\" failed\n");
2323 "RegSetValueExA for value \"B\" failed\n");
2326 &value_name_max_len,
NULL,
NULL,
NULL),
"RegQueryInfoKeyA failed\n");
2332 ok(
strcmp(value_buf,
"A") == 0,
"Expected name \"A\", got %s\n", value_buf);
2335 todo_wine ok(
strcmp(value_buf,
"C") == 0,
"Expected name \"C\", got %s\n", value_buf);
2338 todo_wine ok(
strcmp(value_buf,
"D") == 0,
"Expected name \"D\", got %s\n", value_buf);
2341 todo_wine ok(
strcmp(value_buf,
"B") == 0,
"Expected name \"B\", got %s\n", value_buf);
2348 static const WCHAR targetW[] = {
'\\',
'S',
'o',
'f',
't',
'w',
'a',
'r',
'e',
'\\',
'W',
'i',
'n',
'e',
2349 '\\',
'T',
'e',
's',
't',
'\\',
't',
'a',
'r',
'g',
'e',
't',0};
2357 if (!pRtlFormatCurrentUserKeyPath || !pNtDeleteKey)
2359 win_skip(
"Can't perform symlink tests\n" );
2363 pRtlFormatCurrentUserKeyPath( &target_str );
2365 target_len = target_str.
Length +
sizeof(targetW);
2416 ok(
len == target_len -
sizeof(
WCHAR),
"wrong len %u\n",
len );
2441 ok(
len == target_len -
sizeof(
WCHAR),
"wrong len %u\n",
len );
2450 ok(
len == target_len -
sizeof(
WCHAR),
"wrong len %u\n",
len );
2472 pRtlFreeUnicodeString( &target_str );
2498#define check_key_value(root,name,flags,expect) _check_key_value( __LINE__, root, name, flags, expect )
2503 HKEY key, root32, root64, key32, key64, native, op_key;
2512 skip(
"Not on Wow64, no redirection\n" );
2519 skip(
"not enough privileges to modify HKLM\n");
2551 ok(
dw == 32,
"wrong value %u\n",
dw );
2557 ok(
dw == 64,
"wrong value %u\n",
dw );
2569 trace(
"using Vista-style Wow6432Node handling\n" );
2583 trace(
"using Vista-style Wow6432Node handling\n" );
2671 ok(
dw == (is_vista ? 64 : 32) ||
broken(
dw == 32) ,
"wrong value %u\n",
dw );