mirror of
https://gitlab.winehq.org/wine/wine-staging.git
synced 2024-09-13 09:17:20 -07:00
Added additional tests for behaviour of opening readonly files.
This commit is contained in:
parent
85364f3153
commit
0abc5f4b7b
1
debian/changelog
vendored
1
debian/changelog
vendored
@ -7,6 +7,7 @@ wine-staging (1.7.45) UNRELEASED; urgency=low
|
||||
RegGetValueW.
|
||||
* Added patches for FileRenameInformation support (fixes Wine Staging Bug
|
||||
#296).
|
||||
* Added additional tests for behaviour of opening readonly files.
|
||||
* Removed patch to fix NULL pointer dereference in get_frame_by_name
|
||||
(identical patch accepted upstream).
|
||||
-- Sebastian Lackner <sebastian@fds-team.de> Sun, 31 May 2015 14:46:37 +0200
|
||||
|
@ -2965,18 +2965,20 @@ fi
|
||||
# Patchset server-File_Permissions
|
||||
# |
|
||||
# | Modified files:
|
||||
# | * dlls/advapi32/tests/security.c, server/fd.c
|
||||
# | * dlls/advapi32/tests/security.c, dlls/ntdll/tests/file.c, server/fd.c
|
||||
# |
|
||||
if test "$enable_server_File_Permissions" -eq 1; then
|
||||
patch_apply server-File_Permissions/0001-server-Allow-to-open-files-without-any-permission-bi.patch
|
||||
patch_apply server-File_Permissions/0002-server-When-creating-new-directories-temporarily-giv.patch
|
||||
patch_apply server-File_Permissions/0003-advapi32-tests-Add-tests-for-ACL-inheritance-in-Crea.patch
|
||||
patch_apply server-File_Permissions/0004-advapi32-tests-Add-ACL-inheritance-tests-for-creatin.patch
|
||||
patch_apply server-File_Permissions/0005-ntdll-tests-Added-tests-for-open-behaviour-on-readon.patch
|
||||
(
|
||||
echo '+ { "Sebastian Lackner", "server: Allow to open files without any permission bits.", 2 },';
|
||||
echo '+ { "Sebastian Lackner", "server: When creating new directories temporarily give read-permissions until they are opened.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "advapi32/tests: Add tests for ACL inheritance in CreateDirectoryA.", 1 },';
|
||||
echo '+ { "Sebastian Lackner", "advapi32/tests: Add ACL inheritance tests for creating subdirectories with NtCreateFile.", 1 },';
|
||||
echo '+ { "Qian Hong", "ntdll/tests: Added tests for open behaviour on readonly files.", 1 },';
|
||||
) >> "$patchlist"
|
||||
fi
|
||||
|
||||
|
@ -0,0 +1,108 @@
|
||||
From c7b125afcbf75d7a95c0fcb78c0dadf8f30fd61f Mon Sep 17 00:00:00 2001
|
||||
From: Qian Hong <qhong@codeweavers.com>
|
||||
Date: Fri, 15 May 2015 15:28:17 +0800
|
||||
Subject: ntdll/tests: Added tests for open behaviour on readonly files.
|
||||
|
||||
---
|
||||
dlls/ntdll/tests/file.c | 78 +++++++++++++++++++++++++++++++++++++++++++++++++
|
||||
1 file changed, 78 insertions(+)
|
||||
|
||||
diff --git a/dlls/ntdll/tests/file.c b/dlls/ntdll/tests/file.c
|
||||
index 2df0edc..d365303 100644
|
||||
--- a/dlls/ntdll/tests/file.c
|
||||
+++ b/dlls/ntdll/tests/file.c
|
||||
@@ -2073,6 +2073,83 @@ static void test_NtCreateFile(void)
|
||||
DeleteFileW( path );
|
||||
}
|
||||
|
||||
+static void test_readonly(void)
|
||||
+{
|
||||
+ static const WCHAR fooW[] = {'f','o','o',0};
|
||||
+ NTSTATUS status;
|
||||
+ HANDLE handle;
|
||||
+ WCHAR path[MAX_PATH];
|
||||
+ OBJECT_ATTRIBUTES attr;
|
||||
+ IO_STATUS_BLOCK io;
|
||||
+ UNICODE_STRING nameW;
|
||||
+
|
||||
+ GetTempPathW(MAX_PATH, path);
|
||||
+ GetTempFileNameW(path, fooW, 0, path);
|
||||
+ DeleteFileW(path);
|
||||
+ pRtlDosPathNameToNtPathName_U(path, &nameW, NULL, NULL);
|
||||
+
|
||||
+ attr.Length = sizeof(attr);
|
||||
+ attr.RootDirectory = NULL;
|
||||
+ attr.ObjectName = &nameW;
|
||||
+ attr.Attributes = OBJ_CASE_INSENSITIVE;
|
||||
+ attr.SecurityDescriptor = NULL;
|
||||
+ attr.SecurityQualityOfService = NULL;
|
||||
+
|
||||
+ status = pNtCreateFile(&handle, GENERIC_READ, &attr, &io, NULL, FILE_ATTRIBUTE_READONLY,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_CREATE, 0, NULL, 0);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, GENERIC_WRITE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_ACCESS_DENIED, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, GENERIC_READ, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, FILE_READ_ATTRIBUTES, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, FILE_WRITE_ATTRIBUTES, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ todo_wine ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, DELETE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, READ_CONTROL, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, WRITE_DAC, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, WRITE_OWNER, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle(handle);
|
||||
+
|
||||
+ status = pNtOpenFile(&handle, SYNCHRONIZE, &attr, &io,
|
||||
+ FILE_SHARE_READ|FILE_SHARE_WRITE|FILE_SHARE_DELETE, FILE_OPEN_FOR_BACKUP_INTENT);
|
||||
+ ok(status == STATUS_SUCCESS, "got %#x\n", status);
|
||||
+ CloseHandle( handle );
|
||||
+
|
||||
+ pRtlFreeUnicodeString(&nameW);
|
||||
+ SetFileAttributesW(path, FILE_ATTRIBUTE_ARCHIVE);
|
||||
+ DeleteFileW(path);
|
||||
+}
|
||||
+
|
||||
static void test_read_write(void)
|
||||
{
|
||||
static const char contents[14] = "1234567890abcd";
|
||||
@@ -2823,6 +2900,7 @@ START_TEST(file)
|
||||
|
||||
test_read_write();
|
||||
test_NtCreateFile();
|
||||
+ test_readonly();
|
||||
create_file_test();
|
||||
open_file_test();
|
||||
delete_file_test();
|
||||
--
|
||||
2.4.2
|
||||
|
Loading…
Reference in New Issue
Block a user