wow64: Add thunks for the mutant syscalls.
[wine.git] / dlls / wow64 / sync.c
blob2ca7764c3cd83f991c7224c9b7f7a5995dcb13be
1 /*
2 * WoW64 synchronization objects and functions
4 * Copyright 2021 Alexandre Julliard
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
21 #include <stdarg.h>
23 #include "ntstatus.h"
24 #define WIN32_NO_STATUS
25 #include "windef.h"
26 #include "winbase.h"
27 #include "winnt.h"
28 #include "winternl.h"
29 #include "wow64_private.h"
32 /**********************************************************************
33 * wow64_NtClearEvent
35 NTSTATUS WINAPI wow64_NtClearEvent( UINT *args )
37 HANDLE handle = get_handle( &args );
39 return NtClearEvent( handle );
43 /**********************************************************************
44 * wow64_NtCreateEvent
46 NTSTATUS WINAPI wow64_NtCreateEvent( UINT *args )
48 ULONG *handle_ptr = get_ptr( &args );
49 ACCESS_MASK access = get_ulong( &args );
50 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
51 EVENT_TYPE type = get_ulong( &args );
52 BOOLEAN state = get_ulong( &args );
54 struct object_attr64 attr;
55 HANDLE handle = 0;
56 NTSTATUS status;
58 *handle_ptr = 0;
59 status = NtCreateEvent( &handle, access, objattr_32to64( &attr, attr32 ), type, state );
60 put_handle( handle_ptr, handle );
61 return status;
65 /**********************************************************************
66 * wow64_NtCreateMutant
68 NTSTATUS WINAPI wow64_NtCreateMutant( UINT *args )
70 ULONG *handle_ptr = get_ptr( &args );
71 ACCESS_MASK access = get_ulong( &args );
72 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
73 BOOLEAN owned = get_ulong( &args );
75 struct object_attr64 attr;
76 HANDLE handle = 0;
77 NTSTATUS status;
79 *handle_ptr = 0;
80 status = NtCreateMutant( &handle, access, objattr_32to64( &attr, attr32 ), owned );
81 put_handle( handle_ptr, handle );
82 return status;
86 /**********************************************************************
87 * wow64_NtOpenEvent
89 NTSTATUS WINAPI wow64_NtOpenEvent( UINT *args )
91 ULONG *handle_ptr = get_ptr( &args );
92 ACCESS_MASK access = get_ulong( &args );
93 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
95 struct object_attr64 attr;
96 HANDLE handle = 0;
97 NTSTATUS status;
99 *handle_ptr = 0;
100 status = NtOpenEvent( &handle, access, objattr_32to64( &attr, attr32 ));
101 put_handle( handle_ptr, handle );
102 return status;
106 /**********************************************************************
107 * wow64_NtOpenMutant
109 NTSTATUS WINAPI wow64_NtOpenMutant( UINT *args )
111 ULONG *handle_ptr = get_ptr( &args );
112 ACCESS_MASK access = get_ulong( &args );
113 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
115 struct object_attr64 attr;
116 HANDLE handle = 0;
117 NTSTATUS status;
119 *handle_ptr = 0;
120 status = NtOpenMutant( &handle, access, objattr_32to64( &attr, attr32 ));
121 put_handle( handle_ptr, handle );
122 return status;
126 /**********************************************************************
127 * wow64_NtPulseEvent
129 NTSTATUS WINAPI wow64_NtPulseEvent( UINT *args )
131 HANDLE handle = get_handle( &args );
132 LONG *prev_state = get_ptr( &args );
134 return NtPulseEvent( handle, prev_state );
138 /**********************************************************************
139 * wow64_NtQueryEvent
141 NTSTATUS WINAPI wow64_NtQueryEvent( UINT *args )
143 HANDLE handle = get_handle( &args );
144 EVENT_INFORMATION_CLASS class = get_ulong( &args );
145 void *info = get_ptr( &args );
146 ULONG len = get_ulong( &args );
147 ULONG *retlen = get_ptr( &args );
149 return NtQueryEvent( handle, class, info, len, retlen );
153 /**********************************************************************
154 * wow64_NtQueryMutant
156 NTSTATUS WINAPI wow64_NtQueryMutant( UINT *args )
158 HANDLE handle = get_handle( &args );
159 MUTANT_INFORMATION_CLASS class = get_ulong( &args );
160 void *info = get_ptr( &args );
161 ULONG len = get_ulong( &args );
162 ULONG *retlen = get_ptr( &args );
164 return NtQueryMutant( handle, class, info, len, retlen );
168 /**********************************************************************
169 * wow64_NtReleaseMutant
171 NTSTATUS WINAPI wow64_NtReleaseMutant( UINT *args )
173 HANDLE handle = get_handle( &args );
174 LONG *prev_count = get_ptr( &args );
176 return NtReleaseMutant( handle, prev_count );
180 /**********************************************************************
181 * wow64_NtResetEvent
183 NTSTATUS WINAPI wow64_NtResetEvent( UINT *args )
185 HANDLE handle = get_handle( &args );
186 LONG *prev_state = get_ptr( &args );
188 return NtResetEvent( handle, prev_state );
192 /**********************************************************************
193 * wow64_NtSetEvent
195 NTSTATUS WINAPI wow64_NtSetEvent( UINT *args )
197 HANDLE handle = get_handle( &args );
198 LONG *prev_state = get_ptr( &args );
200 return NtSetEvent( handle, prev_state );