Author: akhaldi
Date: Sat Jun 4 17:57:35 2016
New Revision: 71517
URL:
http://svn.reactos.org/svn/reactos?rev=71517&view=rev
Log:
[ADVAPI32_WINETEST] Sync with Wine Staging 1.9.11. CORE-11368
Modified:
trunk/rostests/winetests/advapi32/registry.c
trunk/rostests/winetests/advapi32/security.c
Modified: trunk/rostests/winetests/advapi32/registry.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/regist…
==============================================================================
--- trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/advapi32/registry.c [iso-8859-1] Sat Jun 4 17:57:35 2016
@@ -2237,7 +2237,7 @@
"subkey2 was not deleted\n");
size = MAX_PATH;
ok(!RegQueryValueA(subkey, NULL, buffer, &size),
- "Default value of subkey not longer present\n");
+ "Default value of subkey no longer present\n");
ret = RegCreateKeyA(subkey, "subkey2", &subkey2);
ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
@@ -2248,7 +2248,7 @@
ok(RegOpenKeyA(subkey, "subkey2", &subkey2),
"subkey2 was not deleted\n");
ok(!RegQueryValueA(subkey, NULL, buffer, &size),
- "Default value of subkey not longer present\n");
+ "Default value of subkey no longer present\n");
ret = RegCreateKeyA(subkey, "subkey2", &subkey2);
ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
@@ -2278,6 +2278,20 @@
dwsize = MAX_PATH;
ok(RegQueryValueExA(subkey, "value", NULL, &type, (BYTE *)buffer,
&dwsize),
"Value is still present\n");
+ ret = RegCloseKey(subkey);
+ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = RegOpenKeyA(hkey_main, "subkey", &subkey);
+ ok(ret == ERROR_SUCCESS, "subkey was deleted\n");
+ ret = pRegDeleteTreeA(subkey, "");
+ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
+ ret = RegCloseKey(subkey);
+ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = RegOpenKeyA(hkey_main, "subkey", &subkey);
+ ok(ret == ERROR_SUCCESS, "subkey was deleted\n");
+ ret = RegCloseKey(subkey);
+ ok(ret == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %d\n", ret);
ret = pRegDeleteTreeA(hkey_main, "not-here");
ok(ret == ERROR_FILE_NOT_FOUND,
@@ -2697,8 +2711,8 @@
check_key_value( key, "Winetest", 0, ptr_size );
check_key_value( key, "Winetest", KEY_WOW64_64KEY, is_vista ? 64 : ptr_size
);
dw = get_key_value( key, "Winetest", KEY_WOW64_32KEY );
- if (ptr_size == 32) ok( dw == 32, "wrong value %u\n", dw );
- else todo_wine ok( dw == 32, "wrong value %u\n", dw );
+ todo_wine_if (ptr_size != 32)
+ ok( dw == 32, "wrong value %u\n", dw );
RegCloseKey( key );
if (ptr_size == 32)
@@ -3358,6 +3372,19 @@
res = RegDeleteValueA( hkey_main, longname );
ok(res == ERROR_FILE_NOT_FOUND || broken(res == ERROR_MORE_DATA), /* nt4, win2k */
"expect ERROR_FILE_NOT_FOUND, got %i\n", res);
+
+ /* Default registry value */
+ res = RegSetValueExA(hkey_main, "", 0, REG_SZ, (const BYTE
*)"value", 6);
+ ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegQueryValueExA(hkey_main, "", NULL, NULL, NULL, NULL);
+ ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegDeleteValueA(hkey_main, "" );
+ ok(res == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", res);
+
+ res = RegQueryValueExA(hkey_main, "", NULL, NULL, NULL, NULL);
+ ok(res == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n",
res);
}
static void test_delete_key_value(void)
@@ -3405,6 +3432,19 @@
ret = RegQueryValueExA(subkey, "test", NULL, NULL, NULL, NULL);
ok(ret == ERROR_FILE_NOT_FOUND, "got %d\n", ret);
+
+ /* Default registry value */
+ ret = RegSetValueExA(subkey, "", 0, REG_SZ, (const BYTE
*)"value", 6);
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = RegQueryValueExA(subkey, "", NULL, NULL, NULL, NULL);
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = pRegDeleteKeyValueA(hkey_main, "Subkey1", "" );
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = RegQueryValueExA(subkey, "", NULL, NULL, NULL, NULL);
+ ok(ret == ERROR_FILE_NOT_FOUND, "expected ERROR_FILE_NOT_FOUND, got %d\n",
ret);
RegDeleteKeyA(subkey, "");
RegCloseKey(subkey);
@@ -3420,6 +3460,33 @@
ok(!ret, "got %d, error %d\n", ret, GetLastError());
ok(key != HKEY_CURRENT_USER, "got %p\n", key);
RegCloseKey(key);
+}
+
+static void test_RegNotifyChangeKeyValue(void)
+{
+ HKEY key, subkey;
+ HANDLE event;
+ DWORD dwret;
+ LONG ret;
+
+ event = CreateEventW(NULL, FALSE, TRUE, NULL);
+ ok(event != NULL, "CreateEvent failed, error %u\n", GetLastError());
+ ret = RegCreateKeyA(hkey_main, "TestKey", &key);
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+
+ ret = RegNotifyChangeKeyValue(key, TRUE, REG_NOTIFY_CHANGE_NAME, event, TRUE);
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+ dwret = WaitForSingleObject(event, 0);
+ ok(dwret == WAIT_TIMEOUT, "expected WAIT_TIMEOUT, got %u\n", dwret);
+
+ ret = RegCreateKeyA(key, "SubKey", &subkey);
+ ok(ret == ERROR_SUCCESS, "expected ERROR_SUCCESS, got %d\n", ret);
+ dwret = WaitForSingleObject(event, 0);
+ ok(dwret == WAIT_OBJECT_0, "expected WAIT_OBJECT_0, got %u\n", dwret);
+
+ RegDeleteKeyA(key, "");
+ RegCloseKey(key);
+ CloseHandle(event);
}
START_TEST(registry)
@@ -3456,6 +3523,7 @@
test_delete_value();
test_delete_key_value();
test_RegOpenCurrentUser();
+ test_RegNotifyChangeKeyValue();
/* cleanup */
delete_key( hkey_main );
Modified: trunk/rostests/winetests/advapi32/security.c
URL:
http://svn.reactos.org/svn/reactos/trunk/rostests/winetests/advapi32/securi…
==============================================================================
--- trunk/rostests/winetests/advapi32/security.c [iso-8859-1] (original)
+++ trunk/rostests/winetests/advapi32/security.c [iso-8859-1] Sat Jun 4 17:57:35 2016
@@ -3531,7 +3531,7 @@
GENERIC_ALL, admin_sid);
ok(bret, "Failed to add Administrator Group to ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
GetTempPathA(MAX_PATH, tmpdir);
lstrcatA(tmpdir, "Please Remove Me");
@@ -3578,7 +3578,7 @@
bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
ok(bret, "Failed to initialize ACL\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor\n");
+ ok(bret, "Failed to add ACL to security descriptor\n");
strcpy(tmpfile, tmpdir);
lstrcatA(tmpfile, "/tmpfile");
@@ -3646,7 +3646,7 @@
bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
ok(bret, "Failed to initialize ACL\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor\n");
+ ok(bret, "Failed to add ACL to security descriptor\n");
strcpy(tmpfile, tmpdir);
lstrcatA(tmpfile, "/tmpfile");
@@ -3671,6 +3671,7 @@
ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n",
error);
bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size),
AclSizeInformation);
ok(bret, "GetAclInformation failed\n");
+ todo_wine
ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count
(%d != 0).\n",
acl_size.AceCount);
LocalFree(pSD);
@@ -3729,7 +3730,6 @@
ok(error == ERROR_SUCCESS, "GetNamedSecurityInfo failed with error %d\n",
error);
bret = pGetAclInformation(pDacl, &acl_size, sizeof(acl_size),
AclSizeInformation);
ok(bret, "GetAclInformation failed\n");
- todo_wine
ok(acl_size.AceCount == 0, "GetAclInformation returned unexpected entry count
(%d != 0).\n",
acl_size.AceCount);
LocalFree(pSD);
@@ -3970,7 +3970,7 @@
bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, admin_sid);
ok(bret, "Failed to add Administrator Group to ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
GetTempFileNameA(".", "foo", 0, tmpfile);
hTemp = CreateFileA(tmpfile, WRITE_DAC|GENERIC_WRITE,
FILE_SHARE_DELETE|FILE_SHARE_READ,
NULL, OPEN_EXISTING, FILE_FLAG_DELETE_ON_CLOSE, NULL);
@@ -4078,7 +4078,7 @@
bret = InitializeAcl(pDacl, sizeof(ACL), ACL_REVISION);
ok(bret, "Failed to initialize ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
@@ -4114,7 +4114,7 @@
bret = pAddAccessDeniedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
ok(bret, "Failed to add Current User to ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
@@ -4130,7 +4130,7 @@
bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, user_sid);
ok(bret, "Failed to add Current User to ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
status = pNtSetSecurityObject(hTemp, DACL_SECURITY_INFORMATION, pSD);
ok(status == ERROR_SUCCESS, "NtSetSecurityObject returned %x\n", status);
@@ -4787,7 +4787,7 @@
bret = pAddAccessAllowedAceEx(pDacl, ACL_REVISION, 0, GENERIC_ALL, admin_sid);
ok(bret, "Failed to add Administrator Group to ACL.\n");
bret = SetSecurityDescriptorDacl(pSD, TRUE, pDacl, FALSE);
- ok(bret, "Failed to add ACL to security desciptor.\n");
+ ok(bret, "Failed to add ACL to security descriptor.\n");
ret = pSetSecurityInfo(obj, SE_FILE_OBJECT, DACL_SECURITY_INFORMATION,
NULL, NULL, pDacl, NULL);
ok(ret == ERROR_SUCCESS, "SetSecurityInfo returned %d\n", ret);
@@ -5835,17 +5835,23 @@
char temp_path[MAX_PATH];
char file_name[MAX_PATH];
DWORD ret, i, access;
- HANDLE file, mapping, dup;
+ HANDLE file, mapping, dup, created_mapping;
static const struct
{
int generic, mapped;
+ BOOL open_only;
} map[] =
{
{ 0, 0 },
{ GENERIC_READ, STANDARD_RIGHTS_READ | SECTION_QUERY | SECTION_MAP_READ },
{ GENERIC_WRITE, STANDARD_RIGHTS_WRITE | SECTION_MAP_WRITE },
{ GENERIC_EXECUTE, STANDARD_RIGHTS_EXECUTE | SECTION_MAP_EXECUTE },
- { GENERIC_ALL, STANDARD_RIGHTS_REQUIRED | SECTION_ALL_ACCESS }
+ { GENERIC_ALL, STANDARD_RIGHTS_REQUIRED | SECTION_ALL_ACCESS },
+ { SECTION_MAP_READ | SECTION_MAP_WRITE, SECTION_MAP_READ | SECTION_MAP_WRITE },
+ { SECTION_MAP_WRITE, SECTION_MAP_WRITE },
+ { SECTION_MAP_READ | SECTION_QUERY, SECTION_MAP_READ | SECTION_QUERY },
+ { SECTION_QUERY, SECTION_MAP_READ, TRUE },
+ { SECTION_QUERY | SECTION_MAP_READ, SECTION_QUERY | SECTION_MAP_READ }
};
static const struct
{
@@ -5874,6 +5880,8 @@
for (i = 0; i < sizeof(prot_map)/sizeof(prot_map[0]); i++)
{
+ if (map[i].open_only) continue;
+
SetLastError(0xdeadbeef);
mapping = CreateFileMappingW(file, NULL, prot_map[i].prot, 0, 4096, NULL);
if (prot_map[i].mapped)
@@ -5920,6 +5928,8 @@
for (i = 0; i < sizeof(map)/sizeof(map[0]); i++)
{
+ if (map[i].open_only) continue;
+
SetLastError( 0xdeadbeef );
ret = DuplicateHandle(GetCurrentProcess(), mapping, GetCurrentProcess(),
&dup,
map[i].generic, FALSE, 0);
@@ -5934,6 +5944,24 @@
CloseHandle(mapping);
CloseHandle(file);
DeleteFileA(file_name);
+
+ created_mapping = CreateFileMappingA(INVALID_HANDLE_VALUE, NULL, PAGE_READWRITE, 0,
0x1000,
+ "Wine Test Open Mapping");
+ ok(created_mapping != NULL, "CreateFileMapping failed with error %u\n",
GetLastError());
+
+ for (i = 0; i < sizeof(map)/sizeof(map[0]); i++)
+ {
+ if (!map[i].generic) continue;
+
+ mapping = OpenFileMappingA(map[i].generic, FALSE, "Wine Test Open
Mapping");
+ ok(mapping != NULL, "OpenFileMapping failed with error %d\n",
GetLastError());
+ access = get_obj_access(mapping);
+ ok(access == map[i].mapped, "%d: unexpected access flags %#x, expected
%#x\n",
+ i, access, map[i].mapped);
+ CloseHandle(mapping);
+ }
+
+ CloseHandle(created_mapping);
}
static void test_thread_security(void)