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
7b63fa65
Commit
7b63fa65
authored
Sep 14, 2011
by
Bernhard Loos
Committed by
Alexandre Julliard
Sep 23, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
server: Certain access flags are illegal for OpenMutex.
parent
97e621bd
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
8 deletions
+47
-8
sync.c
dlls/kernel32/tests/sync.c
+39
-8
mutex.c
server/mutex.c
+8
-0
No files found.
dlls/kernel32/tests/sync.c
View file @
7b63fa65
...
@@ -128,20 +128,51 @@ static void test_mutex(void)
...
@@ -128,20 +128,51 @@ static void test_mutex(void)
BOOL
ret
;
BOOL
ret
;
HANDLE
hCreated
;
HANDLE
hCreated
;
HANDLE
hOpened
;
HANDLE
hOpened
;
int
i
;
DWORD
failed
=
0
;
hCreated
=
CreateMutex
(
NULL
,
FALSE
,
"WineTestMutex"
);
hCreated
=
CreateMutex
(
NULL
,
FALSE
,
"WineTestMutex"
);
ok
(
hCreated
!=
NULL
,
"CreateMutex failed with error %d
\n
"
,
GetLastError
());
ok
(
hCreated
!=
NULL
,
"CreateMutex failed with error %d
\n
"
,
GetLastError
());
wait_ret
=
WaitForSingleObject
(
hCreated
,
INFINITE
);
ok
(
wait_ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed with error 0x%08x
\n
"
,
wait_ret
);
/* yes, opening with just READ_CONTROL access allows us to successfully
hOpened
=
OpenMutex
(
0
,
FALSE
,
"WineTestMutex"
);
* call ReleaseMutex */
ok
(
hOpened
==
NULL
,
"OpenMutex succeded
\n
"
);
hOpened
=
OpenMutex
(
READ_CONTROL
,
FALSE
,
"WineTestMutex"
);
hOpened
=
OpenMutex
(
GENERIC_EXECUTE
,
FALSE
,
"WineTestMutex"
);
ok
(
hOpened
!=
NULL
,
"OpenMutex failed with error %d
\n
"
,
GetLastError
());
wait_ret
=
WaitForSingleObject
(
hOpened
,
INFINITE
);
todo_wine
ok
(
wait_ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed with error %d
\n
"
,
GetLastError
());
CloseHandle
(
hOpened
);
for
(
i
=
0
;
i
<
31
;
i
++
)
{
wait_ret
=
WaitForSingleObject
(
hCreated
,
INFINITE
);
ok
(
wait_ret
==
WAIT_OBJECT_0
,
"WaitForSingleObject failed with error 0x%08x
\n
"
,
wait_ret
);
}
hOpened
=
OpenMutex
(
GENERIC_READ
|
GENERIC_WRITE
,
FALSE
,
"WineTestMutex"
);
ok
(
hOpened
!=
NULL
,
"OpenMutex failed with error %d
\n
"
,
GetLastError
());
ok
(
hOpened
!=
NULL
,
"OpenMutex failed with error %d
\n
"
,
GetLastError
());
ret
=
ReleaseMutex
(
hOpened
);
wait_ret
=
WaitForSingleObject
(
hOpened
,
INFINITE
);
todo_wine
ok
(
ret
,
"ReleaseMutex failed with error %d
\n
"
,
GetLastError
());
todo_wine
ok
(
wait_ret
==
WAIT_FAILED
,
"WaitForSingleObject succeeded
\n
"
);
CloseHandle
(
hOpened
);
for
(
i
=
0
;
i
<
32
;
i
++
)
{
hOpened
=
OpenMutex
(
0x1
<<
i
,
FALSE
,
"WineTestMutex"
);
ReleaseMutex
(
hCreated
);
if
(
hOpened
!=
NULL
)
{
CloseHandle
(
hOpened
);
}
else
{
failed
|=
0x1
<<
i
;
}
}
ok
(
failed
==
0x0de0fffe
,
"open succeded when it shouldn't: %x
\n
"
,
failed
);
ret
=
ReleaseMutex
(
hCreated
);
ret
=
ReleaseMutex
(
hCreated
);
todo_wine
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_NOT_OWNER
),
ok
(
!
ret
&&
(
GetLastError
()
==
ERROR_NOT_OWNER
),
"ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %d
\n
"
,
GetLastError
());
"ReleaseMutex should have failed with ERROR_NOT_OWNER instead of %d
\n
"
,
GetLastError
());
/* test case sensitivity */
/* test case sensitivity */
...
...
server/mutex.c
View file @
7b63fa65
...
@@ -238,6 +238,14 @@ DECL_HANDLER(open_mutex)
...
@@ -238,6 +238,14 @@ DECL_HANDLER(open_mutex)
struct
directory
*
root
=
NULL
;
struct
directory
*
root
=
NULL
;
struct
mutex
*
mutex
;
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
);
get_req_unicode_str
(
&
name
);
if
(
req
->
rootdir
&&
!
(
root
=
get_directory_obj
(
current
->
process
,
req
->
rootdir
,
0
)))
if
(
req
->
rootdir
&&
!
(
root
=
get_directory_obj
(
current
->
process
,
req
->
rootdir
,
0
)))
return
;
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