kernel32: Always create file with FILE_READ_ATTRIBUTES access in CreateFile.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
8712db6f55
commit
58233b47e0
|
@ -5620,7 +5620,6 @@ static void test_file_security(HANDLE token)
|
|||
ok(file != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
|
||||
|
||||
access = get_obj_access(file);
|
||||
todo_wine
|
||||
ok(access == (FILE_READ_ATTRIBUTES | SYNCHRONIZE), "expected FILE_READ_ATTRIBUTES | SYNCHRONIZE, got %#x\n", access);
|
||||
|
||||
bytes = 0xdeadbeef;
|
||||
|
@ -5637,7 +5636,6 @@ todo_wine
|
|||
ok(file != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
|
||||
|
||||
access = get_obj_access(file);
|
||||
todo_wine
|
||||
ok(access == (FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES), "expected FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES, got %#x\n", access);
|
||||
|
||||
bytes = 0xdeadbeef;
|
||||
|
@ -5678,7 +5676,6 @@ todo_wine
|
|||
ok(file != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
|
||||
|
||||
access = get_obj_access(file);
|
||||
todo_wine
|
||||
ok(access == (FILE_READ_ATTRIBUTES | SYNCHRONIZE), "expected FILE_READ_ATTRIBUTES | SYNCHRONIZE, got %#x\n", access);
|
||||
|
||||
CloseHandle(file);
|
||||
|
@ -5688,7 +5685,6 @@ todo_wine
|
|||
ok(file != INVALID_HANDLE_VALUE, "CreateFile error %d\n", GetLastError());
|
||||
|
||||
access = get_obj_access(file);
|
||||
todo_wine
|
||||
ok(access == (FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES), "expected FILE_GENERIC_WRITE | FILE_READ_ATTRIBUTES, got %#x\n", access);
|
||||
|
||||
CloseHandle(file);
|
||||
|
|
|
@ -1582,8 +1582,8 @@ HANDLE WINAPI CreateFileW( LPCWSTR filename, DWORD access, DWORD sharing,
|
|||
|
||||
if (sa && sa->bInheritHandle) attr.Attributes |= OBJ_INHERIT;
|
||||
|
||||
status = NtCreateFile( &ret, access | SYNCHRONIZE, &attr, &io, NULL, attributes,
|
||||
sharing, nt_disposition[creation - CREATE_NEW],
|
||||
status = NtCreateFile( &ret, access | SYNCHRONIZE | FILE_READ_ATTRIBUTES, &attr, &io,
|
||||
NULL, attributes, sharing, nt_disposition[creation - CREATE_NEW],
|
||||
options, NULL, 0 );
|
||||
if (status)
|
||||
{
|
||||
|
|
|
@ -666,6 +666,11 @@ static void test_CreateNamedPipe(int pipemode)
|
|||
test_file_access(hnp, SYNCHRONIZE | READ_CONTROL | FILE_WRITE_ATTRIBUTES
|
||||
| FILE_WRITE_PROPERTIES | FILE_APPEND_DATA | FILE_WRITE_DATA);
|
||||
|
||||
hFile = CreateFileA(PIPENAME, 0, 0, NULL, OPEN_EXISTING, 0, 0);
|
||||
ok(hFile != INVALID_HANDLE_VALUE, "CreateFile failed: %u\n", GetLastError());
|
||||
test_file_access(hFile, SYNCHRONIZE | FILE_READ_ATTRIBUTES);
|
||||
CloseHandle(hFile);
|
||||
|
||||
CloseHandle(hnp);
|
||||
|
||||
if (winetest_debug > 1) trace("test_CreateNamedPipe returning\n");
|
||||
|
|
|
@ -113,6 +113,20 @@ static inline BOOL is_signaled( HANDLE obj )
|
|||
return WaitForSingleObject( obj, 0 ) == WAIT_OBJECT_0;
|
||||
}
|
||||
|
||||
#define test_file_access(a,b) _test_file_access(__LINE__,a,b)
|
||||
static void _test_file_access(unsigned line, HANDLE handle, DWORD expected_access)
|
||||
{
|
||||
FILE_ACCESS_INFORMATION info;
|
||||
IO_STATUS_BLOCK io;
|
||||
NTSTATUS status;
|
||||
|
||||
memset(&info, 0x11, sizeof(info));
|
||||
status = NtQueryInformationFile(handle, &io, &info, sizeof(info), FileAccessInformation);
|
||||
ok_(__FILE__,line)(status == STATUS_SUCCESS, "expected STATUS_SUCCESS, got %08x\n", status);
|
||||
ok_(__FILE__,line)(info.AccessFlags == expected_access, "got access %08x expected %08x\n",
|
||||
info.AccessFlags, expected_access);
|
||||
}
|
||||
|
||||
static const WCHAR testpipe[] = { '\\', '\\', '.', '\\', 'p', 'i', 'p', 'e', '\\',
|
||||
't', 'e', 's', 't', 'p', 'i', 'p', 'e', 0 };
|
||||
static const WCHAR testpipe_nt[] = { '\\', '?', '?', '\\', 'p', 'i', 'p', 'e', '\\',
|
||||
|
@ -562,6 +576,7 @@ static void _check_pipe_handle_state(int line, HANDLE handle, ULONG read, ULONG
|
|||
|
||||
static void test_filepipeinfo(void)
|
||||
{
|
||||
FILE_PIPE_LOCAL_INFORMATION local_info;
|
||||
IO_STATUS_BLOCK iosb;
|
||||
OBJECT_ATTRIBUTES attr;
|
||||
UNICODE_STRING name;
|
||||
|
@ -726,6 +741,33 @@ static void test_filepipeinfo(void)
|
|||
check_pipe_handle_state(hServer, 1, 0);
|
||||
|
||||
CloseHandle(hServer);
|
||||
|
||||
res = pNtCreateNamedPipeFile(&hServer,
|
||||
FILE_READ_DATA | FILE_READ_ATTRIBUTES | FILE_WRITE_ATTRIBUTES | SYNCHRONIZE,
|
||||
&attr, &iosb, FILE_SHARE_READ | FILE_SHARE_WRITE, FILE_CREATE,
|
||||
0, 1, 1, 0, 0xFFFFFFFF, 500, 500, &timeout);
|
||||
ok(!res, "NtCreateNamedPipeFile returned %x\n", res);
|
||||
|
||||
res = NtCreateFile(&hClient, SYNCHRONIZE, &attr, &iosb, NULL, 0,
|
||||
FILE_SHARE_READ|FILE_SHARE_WRITE, FILE_OPEN, 0, NULL, 0 );
|
||||
ok(!res, "NtCreateFile returned %x\n", res);
|
||||
|
||||
test_file_access(hClient, SYNCHRONIZE);
|
||||
|
||||
res = pNtQueryInformationFile(hClient, &iosb, &local_info, sizeof(local_info),
|
||||
FilePipeLocalInformation);
|
||||
todo_wine
|
||||
ok(res == STATUS_ACCESS_DENIED,
|
||||
"NtQueryInformationFile(FilePipeLocalInformation) returned: %x\n", res);
|
||||
|
||||
res = pNtQueryInformationFile(hClient, &iosb, &local_info, sizeof(local_info),
|
||||
FilePipeInformation);
|
||||
todo_wine
|
||||
ok(res == STATUS_ACCESS_DENIED,
|
||||
"NtQueryInformationFile(FilePipeInformation) returned: %x\n", res);
|
||||
|
||||
CloseHandle(hClient);
|
||||
CloseHandle(hServer);
|
||||
}
|
||||
|
||||
static void WINAPI apc( void *arg, IO_STATUS_BLOCK *iosb, ULONG reserved )
|
||||
|
|
Loading…
Reference in New Issue