From 1aa2353ca682ab6edeec11726150c1b41e5d4f28 Mon Sep 17 00:00:00 2001 From: Bill Zissimopoulos Date: Fri, 15 Mar 2019 14:04:03 -0700 Subject: [PATCH] tst: winfsp-tests: ea_create_test --- tst/winfsp-tests/ea-test.c | 46 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) diff --git a/tst/winfsp-tests/ea-test.c b/tst/winfsp-tests/ea-test.c index a17cc8e4..9f460733 100644 --- a/tst/winfsp-tests/ea-test.c +++ b/tst/winfsp-tests/ea-test.c @@ -151,6 +151,30 @@ static void ea_check_ea(HANDLE Handle) ASSERT(1 == Context.EaCount[1]); ASSERT(1 == Context.EaCount[2]); + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, &Ea, sizeof Ea, FALSE, 0, 0, 0, FALSE); + ASSERT(STATUS_NO_MORE_EAS == Result); + + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, &Ea, sizeof Ea, TRUE, 0, 0, 0, TRUE); + ASSERT(STATUS_SUCCESS == Result); + Result = FspFileSystemEnumerateEa(0, ea_check_ea_enumerate, &Context, &Ea.V, (ULONG)Iosb.Information); + ASSERT(STATUS_SUCCESS == Result); + ASSERT(1 == Context.Count); + ASSERT(1 == Context.EaCount[0]); + ASSERT(0 == Context.EaCount[1]); + ASSERT(0 == Context.EaCount[2]); + + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, &Ea, sizeof Ea, TRUE, 0, 0, 0, FALSE); + ASSERT(STATUS_SUCCESS == Result); + Result = FspFileSystemEnumerateEa(0, ea_check_ea_enumerate, &Context, &Ea.V, (ULONG)Iosb.Information); + ASSERT(STATUS_SUCCESS == Result); + ASSERT(1 == Context.Count); + ASSERT(0 == Context.EaCount[0]); + ASSERT(1 == Context.EaCount[1]); + ASSERT(0 == Context.EaCount[2]); + memset(&GetEa, 0, sizeof GetEa); GetEa.V.EaNameLength = (UCHAR)strlen("bnameTwo"); lstrcpyA(GetEa.V.EaName, "bnameTwo"); @@ -166,6 +190,12 @@ static void ea_check_ea(HANDLE Handle) ASSERT(1 == Context.EaCount[1]); ASSERT(0 == Context.EaCount[2]); + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, + &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("Aname1") + 1), + FALSE, 0, 0, 0, TRUE); + ASSERT(STATUS_BUFFER_TOO_SMALL == Result); + memset(&Context, 0, sizeof Context); Result = NtQueryEaFile(Handle, &Iosb, &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("Aname1") + 1 + strlen("first")), @@ -190,6 +220,12 @@ static void ea_check_ea(HANDLE Handle) ASSERT(0 == Context.EaCount[1]); ASSERT(0 == Context.EaCount[2]); + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, + &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("bnameTwo") + 1), + FALSE, 0, 0, 0, FALSE); + ASSERT(STATUS_BUFFER_TOO_SMALL == Result); + memset(&Context, 0, sizeof Context); Result = NtQueryEaFile(Handle, &Iosb, &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("bnameTwo") + 1 + strlen("bnameTwo")), @@ -202,6 +238,12 @@ static void ea_check_ea(HANDLE Handle) ASSERT(1 == Context.EaCount[1]); ASSERT(0 == Context.EaCount[2]); + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, + &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("Cn3") + 1), + FALSE, 0, 0, 0, FALSE); + ASSERT(STATUS_BUFFER_TOO_SMALL == Result); + memset(&Context, 0, sizeof Context); Result = NtQueryEaFile(Handle, &Iosb, &Ea, (ULONG)(FIELD_OFFSET(FILE_FULL_EA_INFORMATION, EaName) + strlen("Cn3") + 1 + strlen("third")), @@ -213,6 +255,10 @@ static void ea_check_ea(HANDLE Handle) ASSERT(0 == Context.EaCount[0]); ASSERT(0 == Context.EaCount[1]); ASSERT(1 == Context.EaCount[2]); + + memset(&Context, 0, sizeof Context); + Result = NtQueryEaFile(Handle, &Iosb, &Ea, sizeof Ea, FALSE, 0, 0, 0, FALSE); + ASSERT(STATUS_NO_MORE_EAS == Result); } static void ea_create_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)