Module: wine Branch: master Commit: 512239d515ca7ba16b8a47c19a8baee583b33462 URL: http://source.winehq.org/git/wine.git/?a=commit;h=512239d515ca7ba16b8a47c19a...
Author: Rob Shearman rob@codeweavers.com Date: Wed Oct 24 16:07:15 2007 +0100
kernel32: Add tests for creating events with different initial security descriptors.
---
dlls/kernel32/tests/sync.c | 39 +++++++++++++++++++++++++++++++++++++++ 1 files changed, 39 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/sync.c b/dlls/kernel32/tests/sync.c index 6031fc5..716e56e 100644 --- a/dlls/kernel32/tests/sync.c +++ b/dlls/kernel32/tests/sync.c @@ -245,9 +245,48 @@ static void test_slist(void) ok(((struct item*)entry->Next)->value == 1, "item 1 not at the back of list\n"); }
+static void test_event_security(void) +{ + HANDLE handle; + SECURITY_ATTRIBUTES sa; + SECURITY_DESCRIPTOR sd; + ACL acl; + + /* no sd */ + handle = CreateEventA(NULL, FALSE, FALSE, __FILE__ ": Test Event"); + ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); + CloseHandle(handle); + + sa.nLength = sizeof(sa); + sa.lpSecurityDescriptor = &sd; + sa.bInheritHandle = FALSE; + + InitializeSecurityDescriptor(&sd, SECURITY_DESCRIPTOR_REVISION); + + /* blank sd */ + handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event"); + ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); + CloseHandle(handle); + + /* sd with NULL dacl */ + SetSecurityDescriptorDacl(&sd, TRUE, NULL, FALSE); + handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event"); + ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); + CloseHandle(handle); + + /* sd with empty dacl */ + InitializeAcl(&acl, sizeof(acl), ACL_REVISION); + SetSecurityDescriptorDacl(&sd, TRUE, &acl, FALSE); + handle = CreateEventA(&sa, FALSE, FALSE, __FILE__ ": Test Event"); + todo_wine + ok(handle != NULL, "CreateEventW with blank sd failed with error %d\n", GetLastError()); + CloseHandle(handle); +} + START_TEST(sync) { test_signalandwait(); test_mutex(); test_slist(); + test_event_security(); }