kernel32: Move waitable timer functions to kernelbase.

Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Alexandre Julliard 2019-06-27 16:21:37 +02:00
parent 591266881c
commit 8c63d02d5f
4 changed files with 110 additions and 117 deletions

View File

@ -212,7 +212,7 @@
@ stdcall CancelSynchronousIo(long)
# @ stub CancelThreadpoolIo
@ stdcall CancelTimerQueueTimer(ptr ptr)
@ stdcall CancelWaitableTimer(long)
@ stdcall -import CancelWaitableTimer(long)
@ stdcall ChangeTimerQueueTimer(ptr ptr long long)
# @ stub CheckElevation
# @ stub CheckElevationEnabled
@ -343,8 +343,8 @@
@ 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 -import CreateWaitableTimerExW(ptr wstr long long)
@ stdcall -import CreateWaitableTimerW(ptr long wstr)
# @ stub CtrlRoutine
@ stdcall DeactivateActCtx(long long)
@ stdcall DebugActiveProcess(long)
@ -1133,7 +1133,7 @@
# @ stub OpenThreadToken
@ stdcall -i386 OpenVxDHandle(long)
@ stdcall OpenWaitableTimerA(long long str)
@ stdcall OpenWaitableTimerW(long long wstr)
@ stdcall -import OpenWaitableTimerW(long long wstr)
@ stdcall OutputDebugStringA(str)
@ stdcall OutputDebugStringW(wstr)
@ stdcall PeekConsoleInputA(ptr ptr long ptr)
@ -1474,8 +1474,8 @@
@ stdcall SetVolumeLabelW(wstr wstr)
@ stdcall SetVolumeMountPointA(str str)
@ stdcall SetVolumeMountPointW(wstr wstr)
@ stdcall SetWaitableTimer(long ptr long ptr ptr long)
@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long)
@ stdcall -import SetWaitableTimer(long ptr long ptr ptr long)
@ stdcall -import SetWaitableTimerEx(long ptr long ptr ptr ptr long)
# @ stub SetXStateFeaturesMask
@ stdcall SetupComm(long long long)
@ stub ShowConsoleCursor

View File

@ -645,16 +645,6 @@ HANDLE WINAPI CreateWaitableTimerA( SECURITY_ATTRIBUTES *sa, BOOL manual, LPCSTR
}
/***********************************************************************
* 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.@)
*/
@ -673,28 +663,6 @@ HANDLE WINAPI CreateWaitableTimerExA( SECURITY_ATTRIBUTES *sa, LPCSTR name, DWOR
}
/***********************************************************************
* CreateWaitableTimerExW (KERNEL32.@)
*/
HANDLE WINAPI CreateWaitableTimerExW( SECURITY_ATTRIBUTES *sa, LPCWSTR name, DWORD flags, DWORD access )
{
HANDLE handle;
NTSTATUS status;
UNICODE_STRING nameW;
OBJECT_ATTRIBUTES attr;
get_create_object_attributes( &attr, &nameW, sa, name );
status = NtCreateTimer( &handle, access, &attr,
(flags & CREATE_WAITABLE_TIMER_MANUAL_RESET) ? NotificationTimer : SynchronizationTimer );
if (status == STATUS_OBJECT_NAME_EXISTS)
SetLastError( ERROR_ALREADY_EXISTS );
else
SetLastError( RtlNtStatusToDosError(status) );
return handle;
}
/***********************************************************************
* OpenWaitableTimerA (KERNEL32.@)
*/
@ -713,79 +681,6 @@ HANDLE WINAPI OpenWaitableTimerA( DWORD access, BOOL inherit, LPCSTR name )
}
/***********************************************************************
* OpenWaitableTimerW (KERNEL32.@)
*/
HANDLE WINAPI OpenWaitableTimerW( DWORD access, BOOL inherit, LPCWSTR name )
{
HANDLE handle;
UNICODE_STRING nameW;
OBJECT_ATTRIBUTES attr;
NTSTATUS status;
if (!is_version_nt()) access = TIMER_ALL_ACCESS;
if (!get_open_object_attributes( &attr, &nameW, inherit, name )) return 0;
status = NtOpenTimer(&handle, access, &attr);
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
return handle;
}
/***********************************************************************
* SetWaitableTimer (KERNEL32.@)
*/
BOOL WINAPI SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG period,
PTIMERAPCROUTINE callback, LPVOID arg, BOOL resume )
{
NTSTATUS status = NtSetTimer(handle, when, (PTIMER_APC_ROUTINE)callback,
arg, resume, period, NULL);
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
if (status != STATUS_TIMER_RESUME_IGNORED) return FALSE;
}
return TRUE;
}
/***********************************************************************
* SetWaitableTimerEx (KERNEL32.@)
*/
BOOL WINAPI SetWaitableTimerEx( HANDLE handle, const LARGE_INTEGER *when, LONG period,
PTIMERAPCROUTINE callback, LPVOID arg, REASON_CONTEXT *context, ULONG tolerabledelay )
{
static int once;
if (!once++)
{
FIXME("(%p, %p, %d, %p, %p, %p, %d) semi-stub\n",
handle, when, period, callback, arg, context, tolerabledelay);
}
return SetWaitableTimer(handle, when, period, callback, arg, FALSE);
}
/***********************************************************************
* CancelWaitableTimer (KERNEL32.@)
*/
BOOL WINAPI CancelWaitableTimer( HANDLE handle )
{
NTSTATUS status;
status = NtCancelTimer(handle, NULL);
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
return FALSE;
}
return TRUE;
}
/***********************************************************************
* CreateTimerQueue (KERNEL32.@)
*/

View File

@ -106,7 +106,7 @@
@ stdcall CancelIoEx(long ptr) kernel32.CancelIoEx
@ stdcall CancelSynchronousIo(long) kernel32.CancelSynchronousIo
@ stub CancelThreadpoolIo
@ stdcall CancelWaitableTimer(long) kernel32.CancelWaitableTimer
@ stdcall CancelWaitableTimer(long)
# @ stub CeipIsOptedIn
@ stdcall ChangeTimerQueueTimer(ptr ptr long long) kernel32.ChangeTimerQueueTimer
@ stdcall CharLowerA(str)
@ -231,8 +231,8 @@
@ stdcall CreateThreadpoolWork(ptr ptr ptr) kernel32.CreateThreadpoolWork
@ stdcall CreateTimerQueue() kernel32.CreateTimerQueue
@ stdcall CreateTimerQueueTimer(ptr long ptr ptr long long long) kernel32.CreateTimerQueueTimer
@ stdcall CreateWaitableTimerExW(ptr wstr long long) kernel32.CreateWaitableTimerExW
@ stdcall CreateWaitableTimerW(ptr long wstr) kernel32.CreateWaitableTimerW
@ stdcall CreateWaitableTimerExW(ptr wstr long long)
@ stdcall CreateWaitableTimerW(ptr long wstr)
@ stdcall CreateWellKnownSid(long ptr ptr ptr)
# @ stub CtrlRoutine
# @ stub CveEventWrite
@ -1002,7 +1002,7 @@
# @ stub OpenStateExplicitForUserSidString
@ stdcall OpenThread(long long long) kernel32.OpenThread
@ stdcall OpenThreadToken(long long long ptr)
@ stdcall OpenWaitableTimerW(long long wstr) kernel32.OpenWaitableTimerW
@ stdcall OpenWaitableTimerW(long long wstr)
@ stdcall OutputDebugStringA(str) kernel32.OutputDebugStringA
@ stdcall OutputDebugStringW(wstr) kernel32.OutputDebugStringW
# @ stub OverrideRoamingDataModificationTimesInRange
@ -1504,8 +1504,8 @@
@ stdcall SetTokenInformation(long long ptr long)
@ stdcall SetUnhandledExceptionFilter(ptr) kernel32.SetUnhandledExceptionFilter
@ stdcall SetUserGeoID(long) kernel32.SetUserGeoID
@ stdcall SetWaitableTimer(long ptr long ptr ptr long) kernel32.SetWaitableTimer
@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long) kernel32.SetWaitableTimerEx
@ stdcall SetWaitableTimer(long ptr long ptr ptr long)
@ stdcall SetWaitableTimerEx(long ptr long ptr ptr ptr long)
# @ stub SetXStateFeaturesMask
@ stdcall SetupComm(long long long) kernel32.SetupComm
# @ stub SharedLocalIsEnabled

View File

@ -433,3 +433,101 @@ BOOL WINAPI DECLSPEC_HOTPATCH ReleaseSemaphore( HANDLE handle, LONG count, LONG
{
return set_ntstatus( NtReleaseSemaphore( handle, count, (PULONG)previous ));
}
/***********************************************************************
* Waitable timers
***********************************************************************/
/***********************************************************************
* CreateWaitableTimerW (kernelbase.@)
*/
HANDLE WINAPI DECLSPEC_HOTPATCH CreateWaitableTimerW( SECURITY_ATTRIBUTES *sa, BOOL manual, LPCWSTR name )
{
return CreateWaitableTimerExW( sa, name, manual ? CREATE_WAITABLE_TIMER_MANUAL_RESET : 0,
TIMER_ALL_ACCESS );
}
/***********************************************************************
* CreateWaitableTimerExW (kernelbase.@)
*/
HANDLE WINAPI DECLSPEC_HOTPATCH CreateWaitableTimerExW( SECURITY_ATTRIBUTES *sa, LPCWSTR name,
DWORD flags, DWORD access )
{
HANDLE handle;
NTSTATUS status;
UNICODE_STRING nameW;
OBJECT_ATTRIBUTES attr;
get_create_object_attributes( &attr, &nameW, sa, name );
status = NtCreateTimer( &handle, access, &attr,
(flags & CREATE_WAITABLE_TIMER_MANUAL_RESET) ? NotificationTimer : SynchronizationTimer );
if (status == STATUS_OBJECT_NAME_EXISTS)
SetLastError( ERROR_ALREADY_EXISTS );
else
SetLastError( RtlNtStatusToDosError(status) );
return handle;
}
/***********************************************************************
* OpenWaitableTimerW (kernelbase.@)
*/
HANDLE WINAPI DECLSPEC_HOTPATCH OpenWaitableTimerW( DWORD access, BOOL inherit, LPCWSTR name )
{
HANDLE handle;
UNICODE_STRING nameW;
OBJECT_ATTRIBUTES attr;
NTSTATUS status;
if (!is_version_nt()) access = TIMER_ALL_ACCESS;
if (!get_open_object_attributes( &attr, &nameW, inherit, name )) return 0;
status = NtOpenTimer( &handle, access, &attr );
if (status != STATUS_SUCCESS)
{
SetLastError( RtlNtStatusToDosError(status) );
return 0;
}
return handle;
}
/***********************************************************************
* SetWaitableTimer (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetWaitableTimer( HANDLE handle, const LARGE_INTEGER *when, LONG period,
PTIMERAPCROUTINE callback, LPVOID arg, BOOL resume )
{
NTSTATUS status = NtSetTimer( handle, when, (PTIMER_APC_ROUTINE)callback,
arg, resume, period, NULL );
return set_ntstatus( status ) || status == STATUS_TIMER_RESUME_IGNORED;
}
/***********************************************************************
* SetWaitableTimerEx (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH SetWaitableTimerEx( HANDLE handle, const LARGE_INTEGER *when, LONG period,
PTIMERAPCROUTINE callback, LPVOID arg,
REASON_CONTEXT *context, ULONG tolerabledelay )
{
static int once;
if (!once++) FIXME( "(%p, %p, %d, %p, %p, %p, %d) semi-stub\n",
handle, when, period, callback, arg, context, tolerabledelay );
return SetWaitableTimer( handle, when, period, callback, arg, FALSE );
}
/***********************************************************************
* CancelWaitableTimer (kernelbase.@)
*/
BOOL WINAPI DECLSPEC_HOTPATCH CancelWaitableTimer( HANDLE handle )
{
return set_ntstatus( NtCancelTimer( handle, NULL ));
}