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
93a54511
Commit
93a54511
authored
Jun 27, 2019
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
kernel32: Move mutex functions to kernelbase.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
558e48aa
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
112 additions
and
111 deletions
+112
-111
kernel32.spec
dlls/kernel32/kernel32.spec
+6
-6
sync.c
dlls/kernel32/sync.c
+0
-99
kernelbase.spec
dlls/kernelbase/kernelbase.spec
+6
-6
sync.c
dlls/kernelbase/sync.c
+100
-0
No files found.
dlls/kernel32/kernel32.spec
View file @
93a54511
...
...
@@ -299,10 +299,10 @@
@ stdcall CreateMailslotA(str long long ptr)
@ stdcall CreateMailslotW(wstr long long ptr)
@ stdcall CreateMemoryResourceNotification(long)
@ stdcall CreateMutexA(ptr long str)
@ stdcall CreateMutexExA(ptr str long long)
@ stdcall CreateMutexExW(ptr wstr long long)
@ stdcall CreateMutexW(ptr long wstr)
@ stdcall
-import
CreateMutexA(ptr long str)
@ stdcall
-import
CreateMutexExA(ptr str long long)
@ stdcall
-import
CreateMutexExW(ptr wstr long long)
@ stdcall
-import
CreateMutexW(ptr long wstr)
@ stdcall CreateNamedPipeA(str long long long long long long ptr)
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr)
# @ stub CreateNlsSecurityDescriptor
...
...
@@ -1121,7 +1121,7 @@
@ stdcall OpenJobObjectA(long long str)
@ stdcall OpenJobObjectW(long long wstr)
@ stdcall OpenMutexA(long long str)
@ stdcall OpenMutexW(long long wstr)
@ stdcall
-import
OpenMutexW(long long wstr)
# @ stub OpenPrivateNamespaceA
# @ stub OpenPrivateNamespaceW
@ stdcall OpenProcess(long long long)
...
...
@@ -1256,7 +1256,7 @@
@ stub RegisterWowExec
@ stdcall ReinitializeCriticalSection(ptr)
@ stdcall ReleaseActCtx(ptr)
@ stdcall ReleaseMutex(long)
@ stdcall
-import
ReleaseMutex(long)
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) ntdll.TpCallbackReleaseMutexOnCompletion
@ stdcall ReleaseSemaphore(long long ptr)
@ stdcall ReleaseSemaphoreWhenCallbackReturns(ptr long long) ntdll.TpCallbackReleaseSemaphoreOnCompletion
...
...
dlls/kernel32/sync.c
View file @
93a54511
...
...
@@ -419,66 +419,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.@)
*/
HANDLE
WINAPI
DECLSPEC_HOTPATCH
OpenMutexA
(
DWORD
access
,
BOOL
inherit
,
LPCSTR
name
)
...
...
@@ -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
;
}
/*
...
...
dlls/kernelbase/kernelbase.spec
View file @
93a54511
...
...
@@ -195,10 +195,10 @@
@ stdcall CreateHardLinkW(wstr wstr ptr) kernel32.CreateHardLinkW
@ stdcall CreateIoCompletionPort(long long long long) kernel32.CreateIoCompletionPort
@ stdcall CreateMemoryResourceNotification(long) kernel32.CreateMemoryResourceNotification
@ stdcall CreateMutexA(ptr long str)
kernel32.CreateMutexA
@ stdcall CreateMutexExA(ptr str long long)
kernel32.CreateMutexExA
@ stdcall CreateMutexExW(ptr wstr long long)
kernel32.CreateMutexExW
@ stdcall CreateMutexW(ptr long wstr)
kernel32.CreateMutexW
@ stdcall CreateMutexA(ptr long str)
@ stdcall CreateMutexExA(ptr str long long)
@ stdcall CreateMutexExW(ptr wstr long long)
@ stdcall CreateMutexW(ptr long wstr)
@ stdcall CreateNamedPipeW(wstr long long long long long long ptr) kernel32.CreateNamedPipeW
@ stdcall CreatePipe(ptr ptr ptr long) kernel32.CreatePipe
# @ stub CreatePrivateNamespaceW
...
...
@@ -987,7 +987,7 @@
# @ stub OpenFileMappingFromApp
@ stdcall OpenFileMappingW(long long wstr) kernel32.OpenFileMappingW
# @ stub OpenGlobalizationUserSettingsKey
@ stdcall OpenMutexW(long long wstr)
kernel32.OpenMutexW
@ stdcall OpenMutexW(long long wstr)
# @ stub OpenPackageInfoByFullName
# @ stub OpenPackageInfoByFullNameForUser
# @ stub OpenPrivateNamespaceW
...
...
@@ -1324,7 +1324,7 @@
@ stdcall RegisterTraceGuidsW(ptr ptr ptr long ptr wstr wstr ptr) ntdll.EtwRegisterTraceGuidsW
@ stdcall RegisterWaitForSingleObjectEx(long ptr ptr long long) kernel32.RegisterWaitForSingleObjectEx
@ stdcall ReleaseActCtx(ptr) kernel32.ReleaseActCtx
@ stdcall ReleaseMutex(long)
kernel32.ReleaseMutex
@ stdcall ReleaseMutex(long)
@ stdcall ReleaseMutexWhenCallbackReturns(ptr long) kernel32.ReleaseMutexWhenCallbackReturns
@ stdcall ReleaseSRWLockExclusive(ptr) kernel32.ReleaseSRWLockExclusive
@ stdcall ReleaseSRWLockShared(ptr) kernel32.ReleaseSRWLockShared
...
...
dlls/kernelbase/sync.c
View file @
93a54511
...
...
@@ -263,3 +263,103 @@ BOOL WINAPI DECLSPEC_HOTPATCH ResetEvent( HANDLE handle )
{
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
));
}
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