Commit a6361204 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

ntdll/tests: Add some RtlValidSecurityDescriptor() tests.

parent 5a3fd972
......@@ -8560,6 +8560,34 @@ static void test_group_as_file_owner(void)
ok(ret, "got error %lu\n", GetLastError());
}
static void test_IsValidSecurityDescriptor(void)
{
SECURITY_DESCRIPTOR *sd;
BOOL ret;
SetLastError(0xdeadbeef);
ret = IsValidSecurityDescriptor(NULL);
ok(!ret, "Unexpected return value %d.\n", ret);
ok(GetLastError() == ERROR_INVALID_SECURITY_DESCR, "Unexpected error %ld.\n", GetLastError());
sd = calloc(1, SECURITY_DESCRIPTOR_MIN_LENGTH);
SetLastError(0xdeadbeef);
ret = IsValidSecurityDescriptor(sd);
ok(!ret, "Unexpected return value %d.\n", ret);
ok(GetLastError() == ERROR_INVALID_SECURITY_DESCR, "Unexpected error %ld.\n", GetLastError());
ret = InitializeSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION);
ok(ret, "Unexpected return value %d, error %ld.\n", ret, GetLastError());
SetLastError(0xdeadbeef);
ret = IsValidSecurityDescriptor(sd);
ok(ret, "Unexpected return value %d.\n", ret);
ok(GetLastError() == 0xdeadbeef, "Unexpected error %ld.\n", GetLastError());
free(sd);
}
START_TEST(security)
{
init();
......@@ -8629,6 +8657,7 @@ START_TEST(security)
test_GetKernelObjectSecurity();
test_elevation();
test_group_as_file_owner();
test_IsValidSecurityDescriptor();
/* Must be the last test, modifies process token */
test_token_security_descriptor();
......
......@@ -3625,6 +3625,29 @@ static void test_RtlInitializeSid(void)
ok(status == STATUS_INVALID_PARAMETER, "Unexpected status %#lx.\n", status);
}
static void test_RtlValidSecurityDescriptor(void)
{
SECURITY_DESCRIPTOR *sd;
NTSTATUS status;
BOOLEAN ret;
ret = RtlValidSecurityDescriptor(NULL);
ok(!ret, "Unexpected return value %d.\n", ret);
sd = calloc(1, SECURITY_DESCRIPTOR_MIN_LENGTH);
ret = RtlValidSecurityDescriptor(sd);
ok(!ret, "Unexpected return value %d.\n", ret);
status = RtlCreateSecurityDescriptor(sd, SECURITY_DESCRIPTOR_REVISION);
ok(!status, "Unexpected return value %#lx.\n", status);
ret = RtlValidSecurityDescriptor(sd);
ok(ret, "Unexpected return value %d.\n", ret);
free(sd);
}
START_TEST(rtl)
{
InitFunctionPtrs();
......@@ -3670,4 +3693,5 @@ START_TEST(rtl)
test_RtlDestroyHeap();
test_RtlFirstFreeAce();
test_RtlInitializeSid();
test_RtlValidSecurityDescriptor();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment