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
fee65e46
Commit
fee65e46
authored
Jan 26, 2000
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't crash when ObjectAttributes is NULL.
parent
eafa3910
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
78 additions
and
109 deletions
+78
-109
sync.c
dlls/ntdll/sync.c
+78
-109
No files found.
dlls/ntdll/sync.c
View file @
fee65e46
...
@@ -17,15 +17,15 @@
...
@@ -17,15 +17,15 @@
DEFAULT_DEBUG_CHANNEL
(
ntdll
);
DEFAULT_DEBUG_CHANNEL
(
ntdll
);
/* copy a key name into the request buffer */
/* copy a key name into the request buffer */
static
inline
NTSTATUS
copy_nameU
(
LPWSTR
Dest
,
PUNICODE_STRING
Name
)
static
inline
NTSTATUS
copy_nameU
(
LPWSTR
Dest
,
const
OBJECT_ATTRIBUTES
*
attr
)
{
{
if
(
Name
->
Buffer
)
if
(
attr
&&
attr
->
ObjectName
&&
attr
->
Object
Name
->
Buffer
)
{
{
if
((
Name
->
Length
)
>
MAX_PATH
)
return
STATUS_BUFFER_OVERFLOW
;
if
((
attr
->
Object
Name
->
Length
)
>
MAX_PATH
)
return
STATUS_BUFFER_OVERFLOW
;
lstrcpyW
(
Dest
,
Name
->
Buffer
);
lstrcpyW
(
Dest
,
attr
->
Object
Name
->
Buffer
);
}
}
else
Dest
[
0
]
=
0
;
else
Dest
[
0
]
=
0
;
return
STATUS_SUCCESS
;
return
STATUS_SUCCESS
;
}
}
/*
/*
...
@@ -42,48 +42,38 @@ NTSTATUS WINAPI NtCreateSemaphore(
...
@@ -42,48 +42,38 @@ NTSTATUS WINAPI NtCreateSemaphore(
IN
ULONG
InitialCount
,
IN
ULONG
InitialCount
,
IN
ULONG
MaximumCount
)
IN
ULONG
MaximumCount
)
{
{
struct
create_semaphore_request
*
req
=
get_req_buffer
();
struct
create_semaphore_request
*
req
=
get_req_buffer
();
HRESULT
ret
;
NTSTATUS
ret
;
FIXME
(
"(%p,0x%08lx,%p,0x%08lx,0x%08lx) stub!
\n
"
,
if
((
MaximumCount
<=
0
)
||
(
InitialCount
<
0
)
||
(
InitialCount
>
MaximumCount
))
SemaphoreHandle
,
DesiredAccess
,
ObjectAttributes
,
InitialCount
,
MaximumCount
);
return
STATUS_INVALID_PARAMETER
;
dump_ObjectAttributes
(
ObjectAttributes
);
*
SemaphoreHandle
=
0
;
if
((
MaximumCount
<=
0
)
||
(
InitialCount
<
0
)
||
(
InitialCount
>
MaximumCount
))
req
->
initial
=
InitialCount
;
return
STATUS_INVALID_PARAMETER
;
req
->
max
=
MaximumCount
;
req
->
inherit
=
ObjectAttributes
&&
(
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
);
*
SemaphoreHandle
=
0
;
if
(
!
(
ret
=
copy_nameU
(
req
->
name
,
ObjectAttributes
))
&&
req
->
initial
=
InitialCount
;
!
(
ret
=
server_call_noerr
(
REQ_CREATE_SEMAPHORE
)))
*
SemaphoreHandle
=
req
->
handle
;
req
->
max
=
MaximumCount
;
return
ret
;
req
->
inherit
=
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
;
copy_nameU
(
req
->
name
,
ObjectAttributes
->
ObjectName
);
if
(
!
(
ret
=
server_call_noerr
(
REQ_CREATE_SEMAPHORE
)))
*
SemaphoreHandle
=
req
->
handle
;
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
* NtOpenSemaphore
* NtOpenSemaphore
*
* FIXME
*/
*/
NTSTATUS
WINAPI
NtOpenSemaphore
(
NTSTATUS
WINAPI
NtOpenSemaphore
(
IN
HANDLE
SemaphoreHandle
,
OUT
P
HANDLE
SemaphoreHandle
,
IN
ACCESS_MASK
DesiredAcces
,
IN
ACCESS_MASK
DesiredAcces
,
IN
POBJECT_ATTRIBUTES
ObjectAttributes
)
IN
POBJECT_ATTRIBUTES
ObjectAttributes
)
{
{
struct
open_semaphore_request
*
req
=
get_req_buffer
();
struct
open_semaphore_request
*
req
=
get_req_buffer
();
HRESULT
ret
;
NTSTATUS
ret
;
FIXME
(
"(0x%08x,0x%08lx,%p) stub!
\n
"
,
*
SemaphoreHandle
=
0
;
SemaphoreHandle
,
DesiredAcces
,
ObjectAttributes
);
req
->
access
=
DesiredAcces
;
dump_ObjectAttributes
(
ObjectAttributes
);
req
->
inherit
=
ObjectAttributes
&&
(
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
);
if
(
!
(
ret
=
copy_nameU
(
req
->
name
,
ObjectAttributes
))
&&
req
->
access
=
DesiredAcces
;
!
(
ret
=
server_call_noerr
(
REQ_OPEN_SEMAPHORE
)))
*
SemaphoreHandle
=
req
->
handle
;
req
->
inherit
=
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
;
return
ret
;
copy_nameU
(
req
->
name
,
ObjectAttributes
->
ObjectName
);
if
((
ret
=
server_call_noerr
(
REQ_OPEN_SEMAPHORE
))
!=
STATUS_SUCCESS
)
return
-
1
;
return
req
->
handle
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -108,21 +98,18 @@ NTSTATUS WINAPI NtReleaseSemaphore(
...
@@ -108,21 +98,18 @@ NTSTATUS WINAPI NtReleaseSemaphore(
IN
ULONG
ReleaseCount
,
IN
ULONG
ReleaseCount
,
IN
PULONG
PreviousCount
)
IN
PULONG
PreviousCount
)
{
{
struct
release_semaphore_request
*
req
=
get_req_buffer
();
struct
release_semaphore_request
*
req
=
get_req_buffer
();
HRESULT
ret
;
NTSTATUS
ret
;
FIXME
(
"(0x%08x,0x%08lx,%p,) stub!
\n
"
,
if
(
ReleaseCount
<
0
)
return
STATUS_INVALID_PARAMETER
;
SemaphoreHandle
,
ReleaseCount
,
PreviousCount
);
req
->
handle
=
SemaphoreHandle
;
if
(
ReleaseCount
<
0
)
return
STATUS_INVALID_PARAMETER
;
req
->
count
=
ReleaseCount
;
if
(
!
(
ret
=
server_call_noerr
(
REQ_RELEASE_SEMAPHORE
)))
req
->
handle
=
SemaphoreHandle
;
{
req
->
count
=
ReleaseCount
;
if
(
PreviousCount
)
*
PreviousCount
=
req
->
prev_count
;
if
(
!
(
ret
=
server_call_noerr
(
REQ_RELEASE_SEMAPHORE
)))
}
{
return
ret
;
if
(
PreviousCount
)
*
PreviousCount
=
req
->
prev_count
;
}
return
ret
;
}
}
/*
/*
...
@@ -139,20 +126,16 @@ NTSTATUS WINAPI NtCreateEvent(
...
@@ -139,20 +126,16 @@ NTSTATUS WINAPI NtCreateEvent(
IN
BOOLEAN
ManualReset
,
IN
BOOLEAN
ManualReset
,
IN
BOOLEAN
InitialState
)
IN
BOOLEAN
InitialState
)
{
{
struct
create_event_request
*
req
=
get_req_buffer
();
struct
create_event_request
*
req
=
get_req_buffer
();
HRESULT
ret
;
NTSTATUS
ret
;
FIXME
(
"(%p,0x%08lx,%p,%08x,%08x): empty stub
\n
"
,
*
EventHandle
=
0
;
EventHandle
,
DesiredAccess
,
ObjectAttributes
,
ManualReset
,
InitialState
);
req
->
manual_reset
=
ManualReset
;
dump_ObjectAttributes
(
ObjectAttributes
);
req
->
initial_state
=
InitialState
;
req
->
inherit
=
ObjectAttributes
&&
(
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
);
*
EventHandle
=
0
;
if
(
!
(
ret
=
copy_nameU
(
req
->
name
,
ObjectAttributes
))
&&
req
->
manual_reset
=
ManualReset
;
!
(
ret
=
server_call_noerr
(
REQ_CREATE_EVENT
)))
*
EventHandle
=
req
->
handle
;
req
->
initial_state
=
InitialState
;
return
ret
;
req
->
inherit
=
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
;
copy_nameU
(
req
->
name
,
ObjectAttributes
->
ObjectName
);
if
(
!
(
ret
=
server_call_noerr
(
REQ_CREATE_EVENT
)))
*
EventHandle
=
req
->
handle
;
return
ret
;
}
}
/******************************************************************************
/******************************************************************************
...
@@ -163,36 +146,17 @@ NTSTATUS WINAPI NtOpenEvent(
...
@@ -163,36 +146,17 @@ NTSTATUS WINAPI NtOpenEvent(
IN
ACCESS_MASK
DesiredAccess
,
IN
ACCESS_MASK
DesiredAccess
,
IN
POBJECT_ATTRIBUTES
ObjectAttributes
)
IN
POBJECT_ATTRIBUTES
ObjectAttributes
)
{
{
struct
open_event_request
*
req
=
get_req_buffer
();
struct
open_event_request
*
req
=
get_req_buffer
();
HRESULT
ret
;
NTSTATUS
ret
;
FIXME
(
"(%p,0x%08lx,%p),stub!
\n
"
,
*
EventHandle
=
0
;
EventHandle
,
DesiredAccess
,
ObjectAttributes
);
req
->
access
=
DesiredAccess
;
dump_ObjectAttributes
(
ObjectAttributes
);
req
->
inherit
=
ObjectAttributes
&&
(
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
);
if
(
!
(
ret
=
copy_nameU
(
req
->
name
,
ObjectAttributes
))
&&
*
EventHandle
=
0
;
!
(
ret
=
server_call_noerr
(
REQ_OPEN_EVENT
)))
*
EventHandle
=
req
->
handle
;
req
->
access
=
DesiredAccess
;
return
ret
;
req
->
inherit
=
ObjectAttributes
->
Attributes
&
OBJ_INHERIT
;
copy_nameU
(
req
->
name
,
ObjectAttributes
->
ObjectName
);
if
(
!
(
ret
=
server_call_noerr
(
REQ_OPEN_EVENT
)))
*
EventHandle
=
req
->
handle
;
return
ret
;
}
}
/***********************************************************************
* EVENT_Operation
*
* Execute an event operation (set,reset,pulse).
*/
static
NTSTATUS
EVENT_Operation
(
HANDLE
handle
,
PULONG
NumberOfThreadsReleased
,
enum
event_op
op
)
{
struct
event_op_request
*
req
=
get_req_buffer
();
req
->
handle
=
handle
;
req
->
op
=
op
;
return
server_call_noerr
(
REQ_EVENT_OP
);
}
/******************************************************************************
/******************************************************************************
* NtSetEvent
* NtSetEvent
...
@@ -201,9 +165,11 @@ NTSTATUS WINAPI NtSetEvent(
...
@@ -201,9 +165,11 @@ NTSTATUS WINAPI NtSetEvent(
IN
HANDLE
EventHandle
,
IN
HANDLE
EventHandle
,
PULONG
NumberOfThreadsReleased
)
PULONG
NumberOfThreadsReleased
)
{
{
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
NumberOfThreadsReleased
);
struct
event_op_request
*
req
=
get_req_buffer
();
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
NumberOfThreadsReleased
);
return
EVENT_Operation
(
EventHandle
,
NumberOfThreadsReleased
,
SET_EVENT
);
req
->
handle
=
EventHandle
;
req
->
op
=
SET_EVENT
;
return
server_call_noerr
(
REQ_EVENT_OP
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -213,9 +179,11 @@ NTSTATUS WINAPI NtResetEvent(
...
@@ -213,9 +179,11 @@ NTSTATUS WINAPI NtResetEvent(
IN
HANDLE
EventHandle
,
IN
HANDLE
EventHandle
,
PULONG
NumberOfThreadsReleased
)
PULONG
NumberOfThreadsReleased
)
{
{
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
NumberOfThreadsReleased
);
struct
event_op_request
*
req
=
get_req_buffer
();
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
NumberOfThreadsReleased
);
return
EVENT_Operation
(
EventHandle
,
NumberOfThreadsReleased
,
RESET_EVENT
);
req
->
handle
=
EventHandle
;
req
->
op
=
RESET_EVENT
;
return
server_call_noerr
(
REQ_EVENT_OP
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -227,8 +195,7 @@ NTSTATUS WINAPI NtResetEvent(
...
@@ -227,8 +195,7 @@ NTSTATUS WINAPI NtResetEvent(
NTSTATUS
WINAPI
NtClearEvent
(
NTSTATUS
WINAPI
NtClearEvent
(
IN
HANDLE
EventHandle
)
IN
HANDLE
EventHandle
)
{
{
FIXME
(
"(0x%08x)
\n
"
,
EventHandle
);
return
NtResetEvent
(
EventHandle
,
NULL
);
return
EVENT_Operation
(
EventHandle
,
NULL
,
RESET_EVENT
);
}
}
/******************************************************************************
/******************************************************************************
...
@@ -241,9 +208,11 @@ NTSTATUS WINAPI NtPulseEvent(
...
@@ -241,9 +208,11 @@ NTSTATUS WINAPI NtPulseEvent(
IN
HANDLE
EventHandle
,
IN
HANDLE
EventHandle
,
IN
PULONG
PulseCount
)
IN
PULONG
PulseCount
)
{
{
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
PulseCount
);
struct
event_op_request
*
req
=
get_req_buffer
();
FIXME
(
"(0x%08x,%p)
\n
"
,
EventHandle
,
PulseCount
);
return
EVENT_Operation
(
EventHandle
,
NULL
,
PULSE_EVENT
);
req
->
handle
=
EventHandle
;
req
->
op
=
PULSE_EVENT
;
return
server_call_noerr
(
REQ_EVENT_OP
);
}
}
/******************************************************************************
/******************************************************************************
...
...
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