Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
58233b47
Commit
58233b47
authored
Aug 20, 2018
by
Jacek Caban
Committed by
Alexandre Julliard
Aug 21, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
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
>
parent
8712db6f
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
6 deletions
+49
-6
security.c
dlls/advapi32/tests/security.c
+0
-4
file.c
dlls/kernel32/file.c
+2
-2
pipe.c
dlls/kernel32/tests/pipe.c
+5
-0
pipe.c
dlls/ntdll/tests/pipe.c
+42
-0
No files found.
dlls/advapi32/tests/security.c
View file @
58233b47
...
...
@@ -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
);
...
...
dlls/kernel32/file.c
View file @
58233b47
...
...
@@ -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
)
{
...
...
dlls/kernel32/tests/pipe.c
View file @
58233b47
...
...
@@ -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
"
);
...
...
dlls/ntdll/tests/pipe.c
View file @
58233b47
...
...
@@ -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
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment