From fdd483c083a1618ec2b15410d23472c585e40f16 Mon Sep 17 00:00:00 2001 From: Dmitry Timoshkov Date: Fri, 31 Jan 2014 15:28:04 +0900 Subject: [PATCH] server: Fix generic access mapping for a semaphore. --- dlls/advapi32/tests/security.c | 16 ++++++---------- server/semaphore.c | 4 ++-- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/dlls/advapi32/tests/security.c b/dlls/advapi32/tests/security.c index e649674ecc..8f70fafbf0 100644 --- a/dlls/advapi32/tests/security.c +++ b/dlls/advapi32/tests/security.c @@ -4653,14 +4653,14 @@ static void test_semaphore_security(HANDLE token) STANDARD_RIGHTS_ALL | SEMAPHORE_ALL_ACCESS }; static const struct { - int todo, generic, mapped; + int generic, mapped; } map[] = { - { 0, 0, 0 }, - { 1, GENERIC_READ, STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE }, - { 0, GENERIC_WRITE, STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE }, - { 1, GENERIC_EXECUTE, STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE }, - { 0, GENERIC_ALL, STANDARD_RIGHTS_ALL | SEMAPHORE_QUERY_STATE | SEMAPHORE_MODIFY_STATE } + { 0, 0 }, + { GENERIC_READ, STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE }, + { GENERIC_WRITE, STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE }, + { GENERIC_EXECUTE, STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE }, + { GENERIC_ALL, STANDARD_RIGHTS_ALL | SEMAPHORE_QUERY_STATE | SEMAPHORE_MODIFY_STATE } }; SetLastError(0xdeadbeef); @@ -4683,10 +4683,6 @@ static void test_semaphore_security(HANDLE token) ok(ret, "DuplicateHandle error %d\n", GetLastError()); access = get_obj_access(dup); - if (map[i].todo) -todo_wine - ok(access == map[i].mapped, "%d: expected %#x, got %#x\n", i, map[i].mapped, access); - else ok(access == map[i].mapped, "%d: expected %#x, got %#x\n", i, map[i].mapped, access); CloseHandle(dup); diff --git a/server/semaphore.c b/server/semaphore.c index bdc35fe49d..d87325cf24 100644 --- a/server/semaphore.c +++ b/server/semaphore.c @@ -153,9 +153,9 @@ static void semaphore_satisfied( struct object *obj, struct wait_queue_entry *en static unsigned int semaphore_map_access( struct object *obj, unsigned int access ) { - if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | SYNCHRONIZE; + if (access & GENERIC_READ) access |= STANDARD_RIGHTS_READ | SEMAPHORE_QUERY_STATE; if (access & GENERIC_WRITE) access |= STANDARD_RIGHTS_WRITE | SEMAPHORE_MODIFY_STATE; - if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE; + if (access & GENERIC_EXECUTE) access |= STANDARD_RIGHTS_EXECUTE | SYNCHRONIZE; if (access & GENERIC_ALL) access |= STANDARD_RIGHTS_ALL | SEMAPHORE_ALL_ACCESS; return access & ~(GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | GENERIC_ALL); }