kernel32: Move mutex functions to kernelbase.
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
558e48aafd
commit
93a5451152
|
@ -299,10 +299,10 @@
|
||||||
@ stdcall CreateMailslotA(str long long ptr)
|
@ stdcall CreateMailslotA(str long long ptr)
|
||||||
@ stdcall CreateMailslotW(wstr long long ptr)
|
@ stdcall CreateMailslotW(wstr long long ptr)
|
||||||
@ stdcall CreateMemoryResourceNotification(long)
|
@ stdcall CreateMemoryResourceNotification(long)
|
||||||
@ stdcall CreateMutexA(ptr long str)
|
@ stdcall -import CreateMutexA(ptr long str)
|
||||||
@ stdcall CreateMutexExA(ptr str long long)
|
@ stdcall -import CreateMutexExA(ptr str long long)
|
||||||
@ stdcall CreateMutexExW(ptr wstr long long)
|
@ stdcall -import CreateMutexExW(ptr wstr long long)
|
||||||
@ stdcall CreateMutexW(ptr long wstr)
|
@ stdcall -import CreateMutexW(ptr long wstr)
|
||||||
@ stdcall CreateNamedPipeA(str long long long long long long ptr)
|
@ stdcall CreateNamedPipeA(str long long long long long long ptr)
|
||||||
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr)
|
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr)
|
||||||
# @ stub CreateNlsSecurityDescriptor
|
# @ stub CreateNlsSecurityDescriptor
|
||||||
|
@ -1121,7 +1121,7 @@
|
||||||
@ stdcall OpenJobObjectA(long long str)
|
@ stdcall OpenJobObjectA(long long str)
|
||||||
@ stdcall OpenJobObjectW(long long wstr)
|
@ stdcall OpenJobObjectW(long long wstr)
|
||||||
@ stdcall OpenMutexA(long long str)
|
@ stdcall OpenMutexA(long long str)
|
||||||
@ stdcall OpenMutexW(long long wstr)
|
@ stdcall -import OpenMutexW(long long wstr)
|
||||||
# @ stub OpenPrivateNamespaceA
|
# @ stub OpenPrivateNamespaceA
|
||||||
# @ stub OpenPrivateNamespaceW
|
# @ stub OpenPrivateNamespaceW
|
||||||
@ stdcall OpenProcess(long long long)
|
@ stdcall OpenProcess(long long long)
|
||||||
|
@ -1256,7 +1256,7 @@
|
||||||
@ stub RegisterWowExec
|
@ stub RegisterWowExec
|
||||||
@ stdcall ReinitializeCriticalSection(ptr)
|
@ stdcall ReinitializeCriticalSection(ptr)
|
||||||
@ stdcall ReleaseActCtx(ptr)
|
@ stdcall ReleaseActCtx(ptr)
|
||||||
@ stdcall ReleaseMutex(long)
|
@ stdcall -import ReleaseMutex(long)
|
||||||
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion
|
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion
|
||||||
@ stdcall ReleaseSemaphore(long long ptr)
|
@ stdcall ReleaseSemaphore(long long ptr)
|
||||||
@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion
|
@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion
|
||||||
|
|
|
@ -418,66 +418,6 @@ void WINAPI UninitializeCriticalSection( CRITICAL_SECTION *crit )
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* CreateMutexA (KERNEL32.@)
|
|
||||||
*/
|
|
||||||
HANDLE WINAPI DECLSPEC_HOTPATCH 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 DECLSPEC_HOTPATCH 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 DECLSPEC_HOTPATCH CreateMutexExA( SECURITY_ATTRIBUTES *sa, LPCSTR name, DWORD flags, DWORD access )
|
|
||||||
{
|
|
||||||
ANSI_STRING nameA;
|
|
||||||
NTSTATUS status;
|
|
||||||
|
|
||||||
if (!name) return CreateMutexExW( sa, NULL, flags, access );
|
|
||||||
|
|
||||||
RtlInitAnsiString( &nameA, name );
|
|
||||||
status = RtlAnsiStringToUnicodeString( &NtCurrentTeb()->StaticUnicodeString, &nameA, FALSE );
|
|
||||||
if (status != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
SetLastError( ERROR_FILENAME_EXCED_RANGE );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return CreateMutexExW( sa, NtCurrentTeb()->StaticUnicodeString.Buffer, flags, access );
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* CreateMutexExW (KERNEL32.@)
|
|
||||||
*/
|
|
||||||
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexExW( SECURITY_ATTRIBUTES *sa, LPCWSTR name, DWORD flags, DWORD access )
|
|
||||||
{
|
|
||||||
HANDLE ret = 0;
|
|
||||||
UNICODE_STRING nameW;
|
|
||||||
OBJECT_ATTRIBUTES attr;
|
|
||||||
NTSTATUS status;
|
|
||||||
|
|
||||||
get_create_object_attributes( &attr, &nameW, sa, name );
|
|
||||||
|
|
||||||
status = NtCreateMutant( &ret, access, &attr, (flags & CREATE_MUTEX_INITIAL_OWNER) != 0 );
|
|
||||||
if (status == STATUS_OBJECT_NAME_EXISTS)
|
|
||||||
SetLastError( ERROR_ALREADY_EXISTS );
|
|
||||||
else
|
|
||||||
SetLastError( RtlNtStatusToDosError(status) );
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
/***********************************************************************
|
||||||
* OpenMutexA (KERNEL32.@)
|
* OpenMutexA (KERNEL32.@)
|
||||||
*/
|
*/
|
||||||
|
@ -496,45 +436,6 @@ HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexA( DWORD access, BOOL inherit, LPCSTR n
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* OpenMutexW (KERNEL32.@)
|
|
||||||
*/
|
|
||||||
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW( DWORD access, BOOL inherit, LPCWSTR name )
|
|
||||||
{
|
|
||||||
HANDLE ret;
|
|
||||||
UNICODE_STRING nameW;
|
|
||||||
OBJECT_ATTRIBUTES attr;
|
|
||||||
NTSTATUS status;
|
|
||||||
|
|
||||||
if (!is_version_nt()) access = MUTEX_ALL_ACCESS;
|
|
||||||
|
|
||||||
if (!get_open_object_attributes( &attr, &nameW, inherit, name )) return 0;
|
|
||||||
|
|
||||||
status = NtOpenMutant( &ret, access, &attr );
|
|
||||||
if (status != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
SetLastError( RtlNtStatusToDosError(status) );
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/***********************************************************************
|
|
||||||
* ReleaseMutex (KERNEL32.@)
|
|
||||||
*/
|
|
||||||
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex( HANDLE handle )
|
|
||||||
{
|
|
||||||
NTSTATUS status;
|
|
||||||
|
|
||||||
status = NtReleaseMutant(handle, NULL);
|
|
||||||
if (status != STATUS_SUCCESS)
|
|
||||||
{
|
|
||||||
SetLastError( RtlNtStatusToDosError(status) );
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
@ -195,10 +195,10 @@
|
||||||
@ stdcall CreateHardLinkW(wstr wstr ptr) kernel32.CreateHardLinkW
|
@ stdcall CreateHardLinkW(wstr wstr ptr) kernel32.CreateHardLinkW
|
||||||
@ stdcall CreateIoCompletionPort(long long long long) kernel32.CreateIoCompletionPort
|
@ stdcall CreateIoCompletionPort(long long long long) kernel32.CreateIoCompletionPort
|
||||||
@ stdcall CreateMemoryResourceNotification(long) kernel32.CreateMemoryResourceNotification
|
@ stdcall CreateMemoryResourceNotification(long) kernel32.CreateMemoryResourceNotification
|
||||||
@ stdcall CreateMutexA(ptr long str) kernel32.CreateMutexA
|
@ stdcall CreateMutexA(ptr long str)
|
||||||
@ stdcall CreateMutexExA(ptr str long long) kernel32.CreateMutexExA
|
@ stdcall CreateMutexExA(ptr str long long)
|
||||||
@ stdcall CreateMutexExW(ptr wstr long long) kernel32.CreateMutexExW
|
@ stdcall CreateMutexExW(ptr wstr long long)
|
||||||
@ stdcall CreateMutexW(ptr long wstr) kernel32.CreateMutexW
|
@ stdcall CreateMutexW(ptr long wstr)
|
||||||
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr) kernel32.CreateNamedPipeW
|
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr) kernel32.CreateNamedPipeW
|
||||||
@ stdcall CreatePipe(ptr ptr ptr long) kernel32.CreatePipe
|
@ stdcall CreatePipe(ptr ptr ptr long) kernel32.CreatePipe
|
||||||
# @ stub CreatePrivateNamespaceW
|
# @ stub CreatePrivateNamespaceW
|
||||||
|
@ -987,7 +987,7 @@
|
||||||
# @ stub OpenFileMappingFromApp
|
# @ stub OpenFileMappingFromApp
|
||||||
@ stdcall OpenFileMappingW(long long wstr) kernel32.OpenFileMappingW
|
@ stdcall OpenFileMappingW(long long wstr) kernel32.OpenFileMappingW
|
||||||
# @ stub OpenGlobalizationUserSettingsKey
|
# @ stub OpenGlobalizationUserSettingsKey
|
||||||
@ stdcall OpenMutexW(long long wstr) kernel32.OpenMutexW
|
@ stdcall OpenMutexW(long long wstr)
|
||||||
# @ stub OpenPackageInfoByFullName
|
# @ stub OpenPackageInfoByFullName
|
||||||
# @ stub OpenPackageInfoByFullNameForUser
|
# @ stub OpenPackageInfoByFullNameForUser
|
||||||
# @ stub OpenPrivateNamespaceW
|
# @ stub OpenPrivateNamespaceW
|
||||||
|
@ -1324,7 +1324,7 @@
|
||||||
@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr) ntdll.EtwRegisterTraceGuidsW
|
@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr) ntdll.EtwRegisterTraceGuidsW
|
||||||
@ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) kernel32.RegisterWaitForSingleObjectEx
|
@ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) kernel32.RegisterWaitForSingleObjectEx
|
||||||
@ stdcall ReleaseActCtx(ptr) kernel32.ReleaseActCtx
|
@ stdcall ReleaseActCtx(ptr) kernel32.ReleaseActCtx
|
||||||
@ stdcall ReleaseMutex(long) kernel32.ReleaseMutex
|
@ stdcall ReleaseMutex(long)
|
||||||
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) kernel32.ReleaseMutexWhenCallbackReturns
|
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) kernel32.ReleaseMutexWhenCallbackReturns
|
||||||
@ stdcall ReleaseSRWLockExclusive(ptr) kernel32.ReleaseSRWLockExclusive
|
@ stdcall ReleaseSRWLockExclusive(ptr) kernel32.ReleaseSRWLockExclusive
|
||||||
@ stdcall ReleaseSRWLockShared(ptr) kernel32.ReleaseSRWLockShared
|
@ stdcall ReleaseSRWLockShared(ptr) kernel32.ReleaseSRWLockShared
|
||||||
|
|
|
@ -263,3 +263,103 @@ BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent( HANDLE handle )
|
||||||
{
|
{
|
||||||
return set_ntstatus( NtResetEvent( handle, NULL ));
|
return set_ntstatus( NtResetEvent( handle, NULL ));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* Mutexes
|
||||||
|
***********************************************************************/
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CreateMutexA (kernelbase.@)
|
||||||
|
*/
|
||||||
|
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexA( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCSTR name )
|
||||||
|
{
|
||||||
|
return CreateMutexExA( sa, name, owner ? CREATE_MUTEX_INITIAL_OWNER : 0, MUTEX_ALL_ACCESS );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CreateMutexW (kernelbase.@)
|
||||||
|
*/
|
||||||
|
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexW( SECURITY_ATTRIBUTES *sa, BOOL owner, LPCWSTR name )
|
||||||
|
{
|
||||||
|
return CreateMutexExW( sa, name, owner ? CREATE_MUTEX_INITIAL_OWNER : 0, MUTEX_ALL_ACCESS );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CreateMutexExA (kernelbase.@)
|
||||||
|
*/
|
||||||
|
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexExA( SECURITY_ATTRIBUTES *sa, LPCSTR name,
|
||||||
|
DWORD flags, DWORD access )
|
||||||
|
{
|
||||||
|
ANSI_STRING nameA;
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
if (!name) return CreateMutexExW( sa, NULL, flags, access );
|
||||||
|
|
||||||
|
RtlInitAnsiString( &nameA, name );
|
||||||
|
status = RtlAnsiStringToUnicodeString( &NtCurrentTeb()->StaticUnicodeString, &nameA, FALSE );
|
||||||
|
if (status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
SetLastError( ERROR_FILENAME_EXCED_RANGE );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return CreateMutexExW( sa, NtCurrentTeb()->StaticUnicodeString.Buffer, flags, access );
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* CreateMutexExW (kernelbase.@)
|
||||||
|
*/
|
||||||
|
HANDLE WINAPI DECLSPEC_HOTPATCH CreateMutexExW( SECURITY_ATTRIBUTES *sa, LPCWSTR name,
|
||||||
|
DWORD flags, DWORD access )
|
||||||
|
{
|
||||||
|
HANDLE ret = 0;
|
||||||
|
UNICODE_STRING nameW;
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
get_create_object_attributes( &attr, &nameW, sa, name );
|
||||||
|
|
||||||
|
status = NtCreateMutant( &ret, access, &attr, (flags & CREATE_MUTEX_INITIAL_OWNER) != 0 );
|
||||||
|
if (status == STATUS_OBJECT_NAME_EXISTS)
|
||||||
|
SetLastError( ERROR_ALREADY_EXISTS );
|
||||||
|
else
|
||||||
|
SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* OpenMutexW (kernelbase.@)
|
||||||
|
*/
|
||||||
|
HANDLE WINAPI DECLSPEC_HOTPATCH OpenMutexW( DWORD access, BOOL inherit, LPCWSTR name )
|
||||||
|
{
|
||||||
|
HANDLE ret;
|
||||||
|
UNICODE_STRING nameW;
|
||||||
|
OBJECT_ATTRIBUTES attr;
|
||||||
|
NTSTATUS status;
|
||||||
|
|
||||||
|
if (!is_version_nt()) access = MUTEX_ALL_ACCESS;
|
||||||
|
|
||||||
|
if (!get_open_object_attributes( &attr, &nameW, inherit, name )) return 0;
|
||||||
|
|
||||||
|
status = NtOpenMutant( &ret, access, &attr );
|
||||||
|
if (status != STATUS_SUCCESS)
|
||||||
|
{
|
||||||
|
SetLastError( RtlNtStatusToDosError(status) );
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/***********************************************************************
|
||||||
|
* ReleaseMutex (kernelbase.@)
|
||||||
|
*/
|
||||||
|
BOOL WINAPI DECLSPEC_HOTPATCH ReleaseMutex( HANDLE handle )
|
||||||
|
{
|
||||||
|
return set_ntstatus( NtReleaseMutant( handle, NULL ));
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue