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
4b058e6e
Commit
4b058e6e
authored
Mar 12, 2012
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Mar 12, 2012
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: OpenMutex should perform a real access check instead of validating access flags.
This reverts
7b63fa65
.
parent
fa2420d6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
20 additions
and
8 deletions
+20
-8
sync.c
dlls/kernel32/tests/sync.c
+20
-0
mutex.c
server/mutex.c
+0
-8
No files found.
dlls/kernel32/tests/sync.c
View file @
4b058e6e
...
...
@@ -133,12 +133,23 @@ static void test_mutex(void)
int
i
;
DWORD
failed
=
0
;
SetLastError
(
0xdeadbeef
);
hOpened
=
OpenMutex
(
0
,
FALSE
,
"WineTestMutex"
);
ok
(
hOpened
==
NULL
,
"OpenMutex succeeded
\n
"
);
ok
(
GetLastError
()
==
ERROR_FILE_NOT_FOUND
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hCreated
=
CreateMutex
(
NULL
,
FALSE
,
"WineTestMutex"
);
ok
(
hCreated
!=
NULL
,
"CreateMutex failed with error %d
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hOpened
=
OpenMutex
(
0
,
FALSE
,
"WineTestMutex"
);
todo_wine
ok
(
hOpened
==
NULL
,
"OpenMutex succeeded
\n
"
);
todo_wine
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"wrong error %u
\n
"
,
GetLastError
());
SetLastError
(
0xdeadbeef
);
hOpened
=
OpenMutex
(
GENERIC_EXECUTE
,
FALSE
,
"WineTestMutex"
);
ok
(
hOpened
!=
NULL
,
"OpenMutex failed with error %d
\n
"
,
GetLastError
());
wait_ret
=
WaitForSingleObject
(
hOpened
,
INFINITE
);
...
...
@@ -151,6 +162,7 @@ static void test_mutex(void)
ok
(
wait_ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed with error 0x%08x
\n
"
,
wait_ret
);
}
SetLastError
(
0xdeadbeef
);
hOpened
=
OpenMutex
(
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
"WineTestMutex"
);
ok
(
hOpened
!=
NULL
,
"OpenMutex failed with error %d
\n
"
,
GetLastError
());
wait_ret
=
WaitForSingleObject
(
hOpened
,
INFINITE
);
...
...
@@ -159,22 +171,30 @@ static void test_mutex(void)
for
(
i
=
0
;
i
<
32
;
i
++
)
{
SetLastError
(
0xdeadbeef
);
hOpened
=
OpenMutex
(
0x1
<<
i
,
FALSE
,
"WineTestMutex"
);
if
(
hOpened
!=
NULL
)
{
SetLastError
(
0xdeadbeef
);
ret
=
ReleaseMutex
(
hOpened
);
ok
(
ret
,
"ReleaseMutex failed with error %d, access %x
\n
"
,
GetLastError
(),
1
<<
i
);
CloseHandle
(
hOpened
);
}
else
{
if
((
1
<<
i
)
==
ACCESS_SYSTEM_SECURITY
)
todo_wine
ok
(
GetLastError
()
==
ERROR_PRIVILEGE_NOT_HELD
,
"wrong error %u, access %x
\n
"
,
GetLastError
(),
1
<<
i
);
else
todo_wine
ok
(
GetLastError
()
==
ERROR_ACCESS_DENIED
,
"wrong error %u, , access %x
\n
"
,
GetLastError
(),
1
<<
i
);
ReleaseMutex
(
hCreated
);
failed
|=
0x1
<<
i
;
}
}
todo_wine
ok
(
failed
==
0x0de0fffe
,
"open succeeded when it shouldn't: %x
\n
"
,
failed
);
SetLastError
(
0xdeadbeef
);
ret
=
ReleaseMutex
(
hCreated
);
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_NOT_OWNER
),
"ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %d
\n
"
,
GetLastError
());
...
...
server/mutex.c
View file @
4b058e6e
...
...
@@ -238,14 +238,6 @@ DECL_HANDLER(open_mutex)
struct
directory
*
root
=
NULL
;
struct
mutex
*
mutex
;
if
((
req
->
access
&
~
(
GENERIC_READ
|
GENERIC_WRITE
|
GENERIC_EXECUTE
|
GENERIC_ALL
|
MUTEX_ALL_ACCESS
|
STANDARD_RIGHTS_ALL
|
MAXIMUM_ALLOWED
))
||
!
req
->
access
)
{
set_error
(
STATUS_INVALID_PARAMETER
);
return
;
}
get_req_unicode_str
(
&
name
);
if
(
req
->
rootdir
&&
!
(
root
=
get_directory_obj
(
current
->
process
,
req
->
rootdir
,
0
)))
return
;
...
...
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