Index: rostests/kmtests/kernel32/FileAttributes_user.c =================================================================== --- rostests/kmtests/kernel32/FileAttributes_user.c (revision 75846) +++ rostests/kmtests/kernel32/FileAttributes_user.c (working copy) @@ -2,7 +2,8 @@ * PROJECT: ReactOS kernel-mode tests * LICENSE: LGPLv2.1+ - See COPYING.LIB in the top level directory * PURPOSE: Test for GetFileAttributes/SetFileAttributes - * PROGRAMMER: Thomas Faber + * PROGRAMMERS: Thomas Faber + * Katayama Hirofumi MZ */ #include @@ -53,6 +54,41 @@ Attributes = GetFileAttributesW(FileName); ok_eq_hex(Attributes, 0); + /* Set read-only and directory attribute */ + KmtSendUlongToDriver(IOCTL_EXPECT_SET_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_READONLY); + Ret = SetFileAttributesW(FileName, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_DIRECTORY); + ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError()); + + /* Set normal and directory attribute */ + KmtSendUlongToDriver(IOCTL_EXPECT_SET_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL); + Ret = SetFileAttributesW(FileName, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError()); + + /* Set directory attribute */ + KmtSendUlongToDriver(IOCTL_EXPECT_SET_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL); + Ret = SetFileAttributesW(FileName, FILE_ATTRIBUTE_DIRECTORY); + ok(Ret == TRUE, "SetFileAttributesW returned %d, error %lu\n", Ret, GetLastError()); + + /* Query read-only and directory attribute */ + KmtSendUlongToDriver(IOCTL_RETURN_QUERY_ATTRIBUTES, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_DIRECTORY); + Attributes = GetFileAttributesW(FileName); + ok_eq_hex(Attributes, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_DIRECTORY); + + /* Query read-only + normal + directory attribute */ + KmtSendUlongToDriver(IOCTL_RETURN_QUERY_ATTRIBUTES, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + Attributes = GetFileAttributesW(FileName); + ok_eq_hex(Attributes, FILE_ATTRIBUTE_READONLY | FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + + /* Query normal and directory attribute */ + KmtSendUlongToDriver(IOCTL_RETURN_QUERY_ATTRIBUTES, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + Attributes = GetFileAttributesW(FileName); + ok_eq_hex(Attributes, FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY); + + /* Query directory attribute */ + KmtSendUlongToDriver(IOCTL_RETURN_QUERY_ATTRIBUTES, FILE_ATTRIBUTE_DIRECTORY); + Attributes = GetFileAttributesW(FileName); + ok_eq_hex(Attributes, FILE_ATTRIBUTE_DIRECTORY); + KmtCloseDriver(); KmtUnloadDriver(); }