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
6a971e84
Commit
6a971e84
authored
Jan 20, 2021
by
Daniel Lehman
Committed by
Alexandre Julliard
Jan 21, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
ntdll: Check event type on creation.
Signed-off-by:
Daniel Lehman
<
dlehman25@gmail.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
c0ce8337
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
15 deletions
+36
-15
om.c
dlls/ntdll/tests/om.c
+35
-15
sync.c
dlls/ntdll/unix/sync.c
+1
-0
No files found.
dlls/ntdll/tests/om.c
View file @
6a971e84
...
...
@@ -26,7 +26,7 @@
#include "stdlib.h"
static
VOID
(
WINAPI
*
pRtlInitUnicodeString
)(
PUNICODE_STRING
,
LPCWSTR
);
static
NTSTATUS
(
WINAPI
*
pNtCreateEvent
)
(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
,
BOOLEAN
,
BOOLEAN
);
static
NTSTATUS
(
WINAPI
*
pNtCreateEvent
)
(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
,
EVENT_TYPE
,
BOOLEAN
);
static
NTSTATUS
(
WINAPI
*
pNtOpenEvent
)
(
PHANDLE
,
ACCESS_MASK
,
const
POBJECT_ATTRIBUTES
);
static
NTSTATUS
(
WINAPI
*
pNtPulseEvent
)
(
HANDLE
,
PLONG
);
static
NTSTATUS
(
WINAPI
*
pNtQueryEvent
)
(
HANDLE
,
EVENT_INFORMATION_CLASS
,
PVOID
,
ULONG
,
PULONG
);
...
...
@@ -92,12 +92,12 @@ static void test_case_sensitive (void)
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Mutant(%08x)
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_OBJECT_TYPE_MISMATCH
/* Vista+ */
,
"got %#x
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
L"
\\
BaseNamedObjects
\\
Test"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
STATUS_SUCCESS
,
"Failed to create Event(%08x)
\n
"
,
status
);
pRtlInitUnicodeString
(
&
str
,
L"
\\
BaseNamedObjects
\\
TEst"
);
...
...
@@ -113,7 +113,7 @@ static void test_case_sensitive (void)
status
=
pNtCreateMutant
(
&
Mutant
,
GENERIC_ALL
,
&
attr
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_OBJECT_TYPE_MISMATCH
/* Vista+ */
,
"got %#x
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
,
"NtCreateEvent should have failed with STATUS_OBJECT_NAME_COLLISION got(%08x)
\n
"
,
status
);
...
...
@@ -292,7 +292,7 @@ static void test_name_collisions(void)
h
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
ok
(
h
!=
0
,
"CreateEventA failed got ret=%p (%d)
\n
"
,
h
,
GetLastError
());
status
=
pNtCreateEvent
(
&
h1
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
h1
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_EXISTS
&&
h1
!=
NULL
,
"NtCreateEvent should have succeeded with STATUS_OBJECT_NAME_EXISTS got(%08x)
\n
"
,
status
);
h2
=
CreateEventA
(
NULL
,
FALSE
,
FALSE
,
"om.c-test"
);
...
...
@@ -370,7 +370,7 @@ static void test_all_kernel_objects( UINT line, OBJECT_ATTRIBUTES *attr,
ok
(
status2
==
open_expect
,
"%u: NtOpenSemaphore failed %x
\n
"
,
line
,
status2
);
if
(
!
status
)
pNtClose
(
ret
);
if
(
!
status2
)
pNtClose
(
ret2
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
attr
,
1
,
0
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
attr
,
SynchronizationEvent
,
0
);
ok
(
status
==
create_expect
,
"%u: NtCreateEvent failed %x
\n
"
,
line
,
status
);
status2
=
pNtOpenEvent
(
&
ret2
,
GENERIC_ALL
,
attr
);
ok
(
status2
==
open_expect
,
"%u: NtOpenEvent failed %x
\n
"
,
line
,
status2
);
...
...
@@ -462,7 +462,7 @@ static void test_name_limits(void)
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
||
status
==
STATUS_INVALID_HANDLE
/* < 7 */
,
"%u: NtOpenSemaphore failed %x
\n
"
,
str
.
Length
,
status
);
pNtClose
(
ret
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
&
attr2
,
1
,
0
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
&
attr2
,
SynchronizationEvent
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"%u: NtCreateEvent failed %x
\n
"
,
str
.
Length
,
status
);
attr3
.
RootDirectory
=
ret
;
status
=
pNtOpenEvent
(
&
ret2
,
GENERIC_ALL
,
&
attr
);
...
...
@@ -581,7 +581,7 @@ static void test_name_limits(void)
pNtClose
(
ret
);
status
=
pNtOpenSemaphore
(
&
ret
,
GENERIC_ALL
,
NULL
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NULL: NtOpenSemaphore failed %x
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
NULL
,
1
,
0
);
status
=
pNtCreateEvent
(
&
ret
,
GENERIC_ALL
,
NULL
,
SynchronizationEvent
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"NULL: NtCreateEvent failed %x
\n
"
,
status
);
pNtClose
(
ret
);
status
=
pNtOpenEvent
(
&
ret
,
GENERIC_ALL
,
NULL
);
...
...
@@ -934,7 +934,7 @@ static void test_directory(void)
RtlInitUnicodeString
(
&
str
,
L"om.c-event"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
dir1
,
NULL
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
1
,
0
);
status
=
pNtCreateEvent
(
&
h
,
GENERIC_ALL
,
&
attr
,
SynchronizationEvent
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"NtCreateEvent failed %x
\n
"
,
status
);
status
=
pNtOpenEvent
(
&
h2
,
GENERIC_ALL
,
&
attr
);
ok
(
status
==
STATUS_SUCCESS
,
"NtOpenEvent failed %x
\n
"
,
status
);
...
...
@@ -1570,7 +1570,7 @@ static void test_type_mismatch(void)
attr
.
SecurityDescriptor
=
NULL
;
attr
.
SecurityQualityOfService
=
NULL
;
res
=
pNtCreateEvent
(
&
h
,
0
,
&
attr
,
0
,
0
);
res
=
pNtCreateEvent
(
&
h
,
0
,
&
attr
,
NotificationEvent
,
0
);
ok
(
!
res
,
"can't create event: %x
\n
"
,
res
);
res
=
pNtReleaseSemaphore
(
h
,
30
,
NULL
);
...
...
@@ -1592,16 +1592,29 @@ static void test_event(void)
pRtlInitUnicodeString
(
&
str
,
L"
\\
BaseNamedObjects
\\
testEvent"
);
InitializeObjectAttributes
(
&
attr
,
&
str
,
0
,
0
,
NULL
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
1
,
0
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
2
,
0
);
ok
(
status
==
STATUS_INVALID_PARAMETER
,
"NtCreateEvent failed %08x
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"NtCreateEvent failed %08x
\n
"
,
status
);
memset
(
&
info
,
0xcc
,
sizeof
(
info
));
status
=
pNtQueryEvent
(
Event
,
EventBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryEvent failed %08x
\n
"
,
status
);
ok
(
info
.
EventType
==
NotificationEvent
&&
info
.
EventState
==
0
,
"NtQueryEvent failed, expected 0 0, got %d %d
\n
"
,
info
.
EventType
,
info
.
EventState
);
pNtClose
(
Event
);
status
=
pNtCreateEvent
(
&
Event
,
GENERIC_ALL
,
&
attr
,
SynchronizationEvent
,
0
);
ok
(
status
==
STATUS_SUCCESS
,
"NtCreateEvent failed %08x
\n
"
,
status
);
status
=
pNtPulseEvent
(
Event
,
&
prev_state
);
ok
(
status
==
STATUS_SUCCESS
,
"NtPulseEvent failed %08x
\n
"
,
status
);
ok
(
!
prev_state
,
"prev_state = %x
\n
"
,
prev_state
);
memset
(
&
info
,
0xcc
,
sizeof
(
info
));
status
=
pNtQueryEvent
(
Event
,
EventBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryEvent failed %08x
\n
"
,
status
);
ok
(
info
.
EventType
==
1
&&
info
.
EventState
==
0
,
ok
(
info
.
EventType
==
SynchronizationEvent
&&
info
.
EventState
==
0
,
"NtQueryEvent failed, expected 1 0, got %d %d
\n
"
,
info
.
EventType
,
info
.
EventState
);
status
=
pNtOpenEvent
(
&
Event2
,
GENERIC_ALL
,
&
attr
);
...
...
@@ -1610,15 +1623,22 @@ static void test_event(void)
pNtClose
(
Event
);
Event
=
Event2
;
memset
(
&
info
,
0xcc
,
sizeof
(
info
));
status
=
pNtQueryEvent
(
Event
,
EventBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryEvent failed %08x
\n
"
,
status
);
ok
(
info
.
EventType
==
1
&&
info
.
EventState
==
0
,
ok
(
info
.
EventType
==
SynchronizationEvent
&&
info
.
EventState
==
0
,
"NtQueryEvent failed, expected 1 0, got %d %d
\n
"
,
info
.
EventType
,
info
.
EventState
);
status
=
pNtSetEvent
(
Event
,
&
prev_state
);
ok
(
status
==
STATUS_SUCCESS
,
"NtSetEvent failed: %08x
\n
"
,
status
);
ok
(
!
prev_state
,
"prev_state = %x
\n
"
,
prev_state
);
memset
(
&
info
,
0xcc
,
sizeof
(
info
));
status
=
pNtQueryEvent
(
Event
,
EventBasicInformation
,
&
info
,
sizeof
(
info
),
NULL
);
ok
(
status
==
STATUS_SUCCESS
,
"NtQueryEvent failed %08x
\n
"
,
status
);
ok
(
info
.
EventType
==
SynchronizationEvent
&&
info
.
EventState
==
1
,
"NtQueryEvent failed, expected 1 1, got %d %d
\n
"
,
info
.
EventType
,
info
.
EventState
);
status
=
pNtSetEvent
(
Event
,
&
prev_state
);
ok
(
status
==
STATUS_SUCCESS
,
"NtSetEvent failed: %08x
\n
"
,
status
);
ok
(
prev_state
==
1
,
"prev_state = %x
\n
"
,
prev_state
);
...
...
@@ -1824,13 +1844,13 @@ static void test_keyed_events(void)
status
=
pNtPulseEvent
(
handle
,
NULL
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"NtPulseEvent %x
\n
"
,
status
);
status
=
pNtCreateEvent
(
&
event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
event
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
STATUS_OBJECT_NAME_COLLISION
||
status
==
STATUS_OBJECT_TYPE_MISMATCH
/* 7+ */
,
"CreateEvent %x
\n
"
,
status
);
NtClose
(
handle
);
status
=
pNtCreateEvent
(
&
event
,
GENERIC_ALL
,
&
attr
,
FALSE
,
FALSE
);
status
=
pNtCreateEvent
(
&
event
,
GENERIC_ALL
,
&
attr
,
NotificationEvent
,
FALSE
);
ok
(
status
==
0
,
"CreateEvent %x
\n
"
,
status
);
status
=
pNtWaitForKeyedEvent
(
event
,
(
void
*
)
8
,
0
,
&
timeout
);
ok
(
status
==
STATUS_OBJECT_TYPE_MISMATCH
,
"NtWaitForKeyedEvent %x
\n
"
,
status
);
...
...
dlls/ntdll/unix/sync.c
View file @
6a971e84
...
...
@@ -427,6 +427,7 @@ NTSTATUS WINAPI NtCreateEvent( HANDLE *handle, ACCESS_MASK access, const OBJECT_
data_size_t
len
;
struct
object_attributes
*
objattr
;
if
(
type
!=
NotificationEvent
&&
type
!=
SynchronizationEvent
)
return
STATUS_INVALID_PARAMETER
;
if
((
ret
=
alloc_object_attributes
(
attr
,
&
objattr
,
&
len
)))
return
ret
;
SERVER_START_REQ
(
create_event
)
...
...
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