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
c1d2d86b
Commit
c1d2d86b
authored
Nov 11, 2008
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Implemented the Ex variants of CreateEvent/Mutex/Semaphore/WaitableTimer.
parent
b740819e
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
23 deletions
+134
-23
kernel32.spec
dlls/kernel32/kernel32.spec
+8
-0
sync.c
dlls/kernel32/sync.c
+108
-23
winbase.h
include/winbase.h
+18
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
c1d2d86b
...
...
@@ -217,6 +217,8 @@
@ stdcall CreateDirectoryExW(wstr wstr ptr)
@ stdcall CreateDirectoryW(wstr ptr)
@ stdcall CreateEventA(ptr long long str)
@ stdcall CreateEventExA(ptr str long long)
@ stdcall CreateEventExW(ptr wstr long long)
@ stdcall CreateEventW(ptr long long wstr)
@ stdcall CreateFiber(long ptr ptr)
@ stdcall CreateFiberEx(long long long ptr ptr)
...
...
@@ -235,6 +237,8 @@
@ stdcall CreateMailslotW(ptr long long ptr)
# @ stub CreateMemoryResourceNotification
@ stdcall CreateMutexA(ptr long str)
@ stdcall CreateMutexExA(ptr str long long)
@ stdcall CreateMutexExW(ptr wstr long long)
@ stdcall CreateMutexW(ptr long wstr)
@ stdcall CreateNamedPipeA(str long long long long long long ptr)
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr)
...
...
@@ -247,6 +251,8 @@
@ stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr)
@ stdcall CreateRemoteThread(long ptr long ptr long long ptr)
@ stdcall CreateSemaphoreA(ptr long long str)
@ stdcall CreateSemaphoreExA(ptr long long str long long)
@ stdcall CreateSemaphoreExW(ptr long long wstr long long)
@ stdcall CreateSemaphoreW(ptr long long wstr)
@ stdcall CreateSocketHandle()
@ stdcall CreateTapePartition(long long long long)
...
...
@@ -256,6 +262,8 @@
@ stdcall CreateToolhelp32Snapshot(long long)
@ stub CreateVirtualBuffer
@ stdcall CreateWaitableTimerA(ptr long str)
@ stdcall CreateWaitableTimerExA(ptr str long long)
@ stdcall CreateWaitableTimerExW(ptr wstr long long)
@ stdcall CreateWaitableTimerW(ptr long wstr)
@ stdcall DeactivateActCtx(long ptr)
@ stdcall DebugActiveProcess(long)
...
...
dlls/kernel32/sync.c
View file @
c1d2d86b
...
...
@@ -458,24 +458,50 @@ void WINAPI UninitializeCriticalSection( CRITICAL_SECTION *crit )
HANDLE
WINAPI
CreateEventA
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual_reset
,
BOOL
initial_state
,
LPCSTR
name
)
{
DWORD
flags
=
0
;
if
(
manual_reset
)
flags
|=
CREATE_EVENT_MANUAL_RESET
;
if
(
initial_state
)
flags
|=
CREATE_EVENT_INITIAL_SET
;
return
CreateEventExA
(
sa
,
name
,
flags
,
EVENT_ALL_ACCESS
);
}
/***********************************************************************
* CreateEventW (KERNEL32.@)
*/
HANDLE
WINAPI
CreateEventW
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual_reset
,
BOOL
initial_state
,
LPCWSTR
name
)
{
DWORD
flags
=
0
;
if
(
manual_reset
)
flags
|=
CREATE_EVENT_MANUAL_RESET
;
if
(
initial_state
)
flags
|=
CREATE_EVENT_INITIAL_SET
;
return
CreateEventExW
(
sa
,
name
,
flags
,
EVENT_ALL_ACCESS
);
}
/***********************************************************************
* CreateEventExA (KERNEL32.@)
*/
HANDLE
WINAPI
CreateEventExA
(
SECURITY_ATTRIBUTES
*
sa
,
LPCSTR
name
,
DWORD
flags
,
DWORD
access
)
{
WCHAR
buffer
[
MAX_PATH
];
if
(
!
name
)
return
CreateEvent
W
(
sa
,
manual_reset
,
initial_state
,
NULL
);
if
(
!
name
)
return
CreateEvent
ExW
(
sa
,
NULL
,
flags
,
access
);
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
buffer
,
MAX_PATH
))
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
0
;
}
return
CreateEvent
W
(
sa
,
manual_reset
,
initial_state
,
buffer
);
return
CreateEvent
ExW
(
sa
,
buffer
,
flags
,
access
);
}
/***********************************************************************
* CreateEventW (KERNEL32.@)
* CreateEvent
Ex
W (KERNEL32.@)
*/
HANDLE
WINAPI
CreateEventW
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual_reset
,
BOOL
initial_state
,
LPCWSTR
name
)
HANDLE
WINAPI
CreateEventExW
(
SECURITY_ATTRIBUTES
*
sa
,
LPCWSTR
name
,
DWORD
flags
,
DWORD
access
)
{
HANDLE
ret
;
UNICODE_STRING
nameW
;
...
...
@@ -505,7 +531,8 @@ HANDLE WINAPI CreateEventW( SECURITY_ATTRIBUTES *sa, BOOL manual_reset,
attr
.
RootDirectory
=
get_BaseNamedObjects_handle
();
}
status
=
NtCreateEvent
(
&
ret
,
EVENT_ALL_ACCESS
,
&
attr
,
manual_reset
,
initial_state
);
status
=
NtCreateEvent
(
&
ret
,
access
,
&
attr
,
(
flags
&
CREATE_EVENT_MANUAL_RESET
)
!=
0
,
(
flags
&
CREATE_EVENT_INITIAL_SET
)
!=
0
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
...
...
@@ -668,23 +695,41 @@ VOID WINAPI VWin32_EventSet(HANDLE event)
*/
HANDLE
WINAPI
CreateMutexA
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
owner
,
LPCSTR
name
)
{
return
CreateMutexExA
(
sa
,
name
,
owner
?
CREATE_MUTEX_INITIAL_OWNER
:
0
,
MUTEX_ALL_ACCESS
);
}
/***********************************************************************
* CreateMutexW (KERNEL32.@)
*/
HANDLE
WINAPI
CreateMutexW
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
owner
,
LPCWSTR
name
)
{
return
CreateMutexExW
(
sa
,
name
,
owner
?
CREATE_MUTEX_INITIAL_OWNER
:
0
,
MUTEX_ALL_ACCESS
);
}
/***********************************************************************
* CreateMutexExA (KERNEL32.@)
*/
HANDLE
WINAPI
CreateMutexExA
(
SECURITY_ATTRIBUTES
*
sa
,
LPCSTR
name
,
DWORD
flags
,
DWORD
access
)
{
WCHAR
buffer
[
MAX_PATH
];
if
(
!
name
)
return
CreateMutex
W
(
sa
,
owner
,
NULL
);
if
(
!
name
)
return
CreateMutex
ExW
(
sa
,
NULL
,
flags
,
access
);
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
buffer
,
MAX_PATH
))
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
0
;
}
return
CreateMutex
W
(
sa
,
owner
,
buffer
);
return
CreateMutex
ExW
(
sa
,
buffer
,
flags
,
access
);
}
/***********************************************************************
* CreateMutexW (KERNEL32.@)
* CreateMutex
Ex
W (KERNEL32.@)
*/
HANDLE
WINAPI
CreateMutex
W
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
owner
,
LPCWSTR
name
)
HANDLE
WINAPI
CreateMutex
ExW
(
SECURITY_ATTRIBUTES
*
sa
,
LPCWSTR
name
,
DWORD
flags
,
DWORD
access
)
{
HANDLE
ret
;
UNICODE_STRING
nameW
;
...
...
@@ -704,7 +749,7 @@ HANDLE WINAPI CreateMutexW( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCWSTR name )
attr
.
RootDirectory
=
get_BaseNamedObjects_handle
();
}
status
=
NtCreateMutant
(
&
ret
,
MUTEX_ALL_ACCESS
,
&
attr
,
owner
);
status
=
NtCreateMutant
(
&
ret
,
access
,
&
attr
,
(
flags
&
CREATE_MUTEX_INITIAL_OWNER
)
!=
0
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
...
...
@@ -793,24 +838,44 @@ BOOL WINAPI ReleaseMutex( HANDLE handle )
*/
HANDLE
WINAPI
CreateSemaphoreA
(
SECURITY_ATTRIBUTES
*
sa
,
LONG
initial
,
LONG
max
,
LPCSTR
name
)
{
return
CreateSemaphoreExA
(
sa
,
initial
,
max
,
name
,
0
,
SEMAPHORE_ALL_ACCESS
);
}
/***********************************************************************
* CreateSemaphoreW (KERNEL32.@)
*/
HANDLE
WINAPI
CreateSemaphoreW
(
SECURITY_ATTRIBUTES
*
sa
,
LONG
initial
,
LONG
max
,
LPCWSTR
name
)
{
return
CreateSemaphoreExW
(
sa
,
initial
,
max
,
name
,
0
,
SEMAPHORE_ALL_ACCESS
);
}
/***********************************************************************
* CreateSemaphoreExA (KERNEL32.@)
*/
HANDLE
WINAPI
CreateSemaphoreExA
(
SECURITY_ATTRIBUTES
*
sa
,
LONG
initial
,
LONG
max
,
LPCSTR
name
,
DWORD
flags
,
DWORD
access
)
{
WCHAR
buffer
[
MAX_PATH
];
if
(
!
name
)
return
CreateSemaphore
W
(
sa
,
initial
,
max
,
NULL
);
if
(
!
name
)
return
CreateSemaphore
ExW
(
sa
,
initial
,
max
,
NULL
,
flags
,
access
);
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
buffer
,
MAX_PATH
))
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
0
;
}
return
CreateSemaphore
W
(
sa
,
initial
,
max
,
buffer
);
return
CreateSemaphore
ExW
(
sa
,
initial
,
max
,
buffer
,
flags
,
access
);
}
/***********************************************************************
* CreateSemaphoreW (KERNEL32.@)
* CreateSemaphore
Ex
W (KERNEL32.@)
*/
HANDLE
WINAPI
CreateSemaphore
W
(
SECURITY_ATTRIBUTES
*
sa
,
LONG
initial
,
LONG
max
,
LPCWSTR
name
)
HANDLE
WINAPI
CreateSemaphore
ExW
(
SECURITY_ATTRIBUTES
*
sa
,
LONG
initial
,
LONG
max
,
LPCWSTR
name
,
DWORD
flags
,
DWORD
access
)
{
HANDLE
ret
;
UNICODE_STRING
nameW
;
...
...
@@ -830,7 +895,7 @@ HANDLE WINAPI CreateSemaphoreW( SECURITY_ATTRIBUTES *sa, LONG initial,
attr
.
RootDirectory
=
get_BaseNamedObjects_handle
();
}
status
=
NtCreateSemaphore
(
&
ret
,
SEMAPHORE_ALL_ACCESS
,
&
attr
,
initial
,
max
);
status
=
NtCreateSemaphore
(
&
ret
,
access
,
&
attr
,
initial
,
max
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
...
...
@@ -1076,23 +1141,43 @@ BOOL WINAPI IsProcessInJob( HANDLE process, HANDLE job, PBOOL result )
*/
HANDLE
WINAPI
CreateWaitableTimerA
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual
,
LPCSTR
name
)
{
return
CreateWaitableTimerExA
(
sa
,
name
,
manual
?
CREATE_WAITABLE_TIMER_MANUAL_RESET
:
0
,
TIMER_ALL_ACCESS
);
}
/***********************************************************************
* CreateWaitableTimerW (KERNEL32.@)
*/
HANDLE
WINAPI
CreateWaitableTimerW
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual
,
LPCWSTR
name
)
{
return
CreateWaitableTimerExW
(
sa
,
name
,
manual
?
CREATE_WAITABLE_TIMER_MANUAL_RESET
:
0
,
TIMER_ALL_ACCESS
);
}
/***********************************************************************
* CreateWaitableTimerExA (KERNEL32.@)
*/
HANDLE
WINAPI
CreateWaitableTimerExA
(
SECURITY_ATTRIBUTES
*
sa
,
LPCSTR
name
,
DWORD
flags
,
DWORD
access
)
{
WCHAR
buffer
[
MAX_PATH
];
if
(
!
name
)
return
CreateWaitableTimer
W
(
sa
,
manual
,
NULL
);
if
(
!
name
)
return
CreateWaitableTimer
ExW
(
sa
,
NULL
,
flags
,
access
);
if
(
!
MultiByteToWideChar
(
CP_ACP
,
0
,
name
,
-
1
,
buffer
,
MAX_PATH
))
{
SetLastError
(
ERROR_FILENAME_EXCED_RANGE
);
return
0
;
}
return
CreateWaitableTimer
W
(
sa
,
manual
,
buffer
);
return
CreateWaitableTimer
ExW
(
sa
,
buffer
,
flags
,
access
);
}
/***********************************************************************
* CreateWaitableTimerW (KERNEL32.@)
* CreateWaitableTimer
Ex
W (KERNEL32.@)
*/
HANDLE
WINAPI
CreateWaitableTimer
W
(
SECURITY_ATTRIBUTES
*
sa
,
BOOL
manual
,
LPCWSTR
name
)
HANDLE
WINAPI
CreateWaitableTimer
ExW
(
SECURITY_ATTRIBUTES
*
sa
,
LPCWSTR
name
,
DWORD
flags
,
DWORD
access
)
{
HANDLE
handle
;
NTSTATUS
status
;
...
...
@@ -1112,8 +1197,8 @@ HANDLE WINAPI CreateWaitableTimerW( SECURITY_ATTRIBUTES *sa, BOOL manual, LPCWST
attr
.
RootDirectory
=
get_BaseNamedObjects_handle
();
}
status
=
NtCreateTimer
(
&
handle
,
TIMER_ALL_ACCESS
,
&
attr
,
manual
?
NotificationTimer
:
SynchronizationTimer
);
status
=
NtCreateTimer
(
&
handle
,
access
,
&
attr
,
(
flags
&
CREATE_WAITABLE_TIMER_MANUAL_RESET
)
?
NotificationTimer
:
SynchronizationTimer
);
if
(
status
==
STATUS_OBJECT_NAME_EXISTS
)
SetLastError
(
ERROR_ALREADY_EXISTS
);
else
...
...
include/winbase.h
View file @
c1d2d86b
...
...
@@ -827,6 +827,12 @@ typedef DWORD (CALLBACK *LPPROGRESS_ROUTINE)(LARGE_INTEGER, LARGE_INTEGER, LARGE
LARGE_INTEGER
,
DWORD
,
DWORD
,
HANDLE
,
HANDLE
,
LPVOID
);
#define CREATE_EVENT_MANUAL_RESET 1
#define CREATE_EVENT_INITIAL_SET 2
#define CREATE_MUTEX_INITIAL_OWNER 1
#define CREATE_WAITABLE_TIMER_MANUAL_RESET 1
#define WAIT_FAILED 0xffffffff
#define WAIT_OBJECT_0 0
...
...
@@ -1351,6 +1357,9 @@ WINBASEAPI BOOL WINAPI CreateDirectoryExW(LPCWSTR,LPCWSTR,LPSECURITY_ATTR
WINBASEAPI
HANDLE
WINAPI
CreateEventA
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
BOOL
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateEventW
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
BOOL
,
LPCWSTR
);
#define CreateEvent WINELIB_NAME_AW(CreateEvent)
WINBASEAPI
HANDLE
WINAPI
CreateEventExA
(
SECURITY_ATTRIBUTES
*
,
LPCSTR
,
DWORD
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateEventExW
(
SECURITY_ATTRIBUTES
*
,
LPCWSTR
,
DWORD
,
DWORD
);
#define CreateEventEx WINELIB_NAME_AW(CreateEventEx)
WINBASEAPI
LPVOID
WINAPI
CreateFiber
(
SIZE_T
,
LPFIBER_START_ROUTINE
,
LPVOID
);
WINBASEAPI
LPVOID
WINAPI
CreateFiberEx
(
SIZE_T
,
SIZE_T
,
DWORD
,
LPFIBER_START_ROUTINE
,
LPVOID
);
WINBASEAPI
HANDLE
WINAPI
CreateFileA
(
LPCSTR
,
DWORD
,
DWORD
,
LPSECURITY_ATTRIBUTES
,
DWORD
,
DWORD
,
HANDLE
);
...
...
@@ -1369,6 +1378,9 @@ WINBASEAPI HANDLE WINAPI CreateMailslotW(LPCWSTR,DWORD,DWORD,LPSECURITY_ATT
WINBASEAPI
HANDLE
WINAPI
CreateMutexA
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateMutexW
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
LPCWSTR
);
#define CreateMutex WINELIB_NAME_AW(CreateMutex)
WINBASEAPI
HANDLE
WINAPI
CreateMutexExA
(
SECURITY_ATTRIBUTES
*
,
LPCSTR
,
DWORD
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateMutexExW
(
SECURITY_ATTRIBUTES
*
,
LPCWSTR
,
DWORD
,
DWORD
);
#define CreateMutexEx WINELIB_NAME_AW(CreateMutexEx)
WINBASEAPI
HANDLE
WINAPI
CreateNamedPipeA
(
LPCSTR
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
LPSECURITY_ATTRIBUTES
);
WINBASEAPI
HANDLE
WINAPI
CreateNamedPipeW
(
LPCWSTR
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
DWORD
,
LPSECURITY_ATTRIBUTES
);
#define CreateNamedPipe WINELIB_NAME_AW(CreateNamedPipe)
...
...
@@ -1385,6 +1397,9 @@ WINADVAPI BOOL WINAPI CreateRestrictedToken(HANDLE,DWORD,DWORD,PSID_AND_
WINBASEAPI
HANDLE
WINAPI
CreateSemaphoreA
(
LPSECURITY_ATTRIBUTES
,
LONG
,
LONG
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateSemaphoreW
(
LPSECURITY_ATTRIBUTES
,
LONG
,
LONG
,
LPCWSTR
);
#define CreateSemaphore WINELIB_NAME_AW(CreateSemaphore)
WINBASEAPI
HANDLE
WINAPI
CreateSemaphoreExA
(
SECURITY_ATTRIBUTES
*
,
LONG
,
LONG
,
LPCSTR
,
DWORD
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateSemaphoreExW
(
SECURITY_ATTRIBUTES
*
,
LONG
,
LONG
,
LPCWSTR
,
DWORD
,
DWORD
);
#define CreateSemaphoreEx WINELIB_NAME_AW(CreateSemaphoreEx)
WINBASEAPI
DWORD
WINAPI
CreateTapePartition
(
HANDLE
,
DWORD
,
DWORD
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateThread
(
LPSECURITY_ATTRIBUTES
,
SIZE_T
,
LPTHREAD_START_ROUTINE
,
LPVOID
,
DWORD
,
LPDWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateTimerQueue
(
void
);
...
...
@@ -1392,6 +1407,9 @@ WINBASEAPI BOOL WINAPI CreateTimerQueueTimer(PHANDLE,HANDLE,WAITORTIMERCA
WINBASEAPI
HANDLE
WINAPI
CreateWaitableTimerA
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
LPCSTR
);
WINBASEAPI
HANDLE
WINAPI
CreateWaitableTimerW
(
LPSECURITY_ATTRIBUTES
,
BOOL
,
LPCWSTR
);
#define CreateWaitableTimer WINELIB_NAME_AW(CreateWaitableTimer)
WINBASEAPI
HANDLE
WINAPI
CreateWaitableTimerExA
(
SECURITY_ATTRIBUTES
*
,
LPCSTR
,
DWORD
,
DWORD
);
WINBASEAPI
HANDLE
WINAPI
CreateWaitableTimerExW
(
SECURITY_ATTRIBUTES
*
,
LPCWSTR
,
DWORD
,
DWORD
);
#define CreateWaitableTimerEx WINELIB_NAME_AW(CreateWaitableTimerEx)
WINADVAPI
BOOL
WINAPI
CreateWellKnownSid
(
WELL_KNOWN_SID_TYPE
,
PSID
,
PSID
,
DWORD
*
);
WINBASEAPI
BOOL
WINAPI
DeactivateActCtx
(
DWORD
,
ULONG_PTR
);
WINBASEAPI
BOOL
WINAPI
DebugActiveProcess
(
DWORD
);
...
...
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