include: Add transact.idl to oledb.idl.
[wine.git] / dlls / wow64 / registry.c
blobe89c65c4c5ec17155b476376bbe0e9c60ff70e54
1 /*
2 * WoW64 registry 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"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(wow);
35 /**********************************************************************
36 * wow64_NtCreateKey
38 NTSTATUS WINAPI wow64_NtCreateKey( UINT *args )
40 ULONG *handle_ptr = get_ptr( &args );
41 ACCESS_MASK access = get_ulong( &args );
42 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
43 ULONG index = get_ulong( &args );
44 UNICODE_STRING32 *class32 = get_ptr( &args );
45 ULONG options = get_ulong( &args );
46 ULONG *dispos = get_ptr( &args );
48 struct object_attr64 attr;
49 UNICODE_STRING class;
50 HANDLE handle = 0;
51 NTSTATUS status;
53 *handle_ptr = 0;
54 status = NtCreateKey( &handle, access, objattr_32to64( &attr, attr32 ), index,
55 unicode_str_32to64( &class, class32 ), options, dispos );
56 put_handle( handle_ptr, handle );
57 return status;
61 /**********************************************************************
62 * wow64_NtCreateKeyTransacted
64 NTSTATUS WINAPI wow64_NtCreateKeyTransacted( UINT *args )
66 ULONG *handle_ptr = get_ptr( &args );
67 ACCESS_MASK access = get_ulong( &args );
68 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
69 ULONG index = get_ulong( &args );
70 UNICODE_STRING32 *class32 = get_ptr( &args );
71 ULONG options = get_ulong( &args );
72 HANDLE transacted = get_handle( &args );
73 ULONG *dispos = get_ptr( &args );
75 struct object_attr64 attr;
76 UNICODE_STRING class;
77 HANDLE handle = 0;
78 NTSTATUS status;
80 *handle_ptr = 0;
81 status = NtCreateKeyTransacted( &handle, access, objattr_32to64( &attr, attr32 ), index,
82 unicode_str_32to64( &class, class32 ), options, transacted, dispos );
83 put_handle( handle_ptr, handle );
84 return status;
88 /**********************************************************************
89 * wow64_NtDeleteKey
91 NTSTATUS WINAPI wow64_NtDeleteKey( UINT *args )
93 HANDLE handle = get_handle( &args );
95 return NtDeleteKey( handle );
99 /**********************************************************************
100 * wow64_NtDeleteValueKey
102 NTSTATUS WINAPI wow64_NtDeleteValueKey( UINT *args )
104 HANDLE handle = get_handle( &args );
105 UNICODE_STRING32 *str32 = get_ptr( &args );
107 UNICODE_STRING str;
109 return NtDeleteValueKey( handle, unicode_str_32to64( &str, str32 ));
113 /**********************************************************************
114 * wow64_NtEnumerateKey
116 NTSTATUS WINAPI wow64_NtEnumerateKey( UINT *args )
118 HANDLE handle = get_handle( &args );
119 ULONG index = get_ulong( &args );
120 KEY_INFORMATION_CLASS class = get_ulong( &args );
121 void *ptr = get_ptr( &args );
122 ULONG len = get_ulong( &args );
123 ULONG *retlen = get_ptr( &args );
125 return NtEnumerateKey( handle, index, class, ptr, len, retlen );
129 /**********************************************************************
130 * wow64_NtEnumerateValueKey
132 NTSTATUS WINAPI wow64_NtEnumerateValueKey( UINT *args )
134 HANDLE handle = get_handle( &args );
135 ULONG index = get_ulong( &args );
136 KEY_VALUE_INFORMATION_CLASS class = get_ulong( &args );
137 void *ptr = get_ptr( &args );
138 ULONG len = get_ulong( &args );
139 ULONG *retlen = get_ptr( &args );
141 return NtEnumerateValueKey( handle, index, class, ptr, len, retlen );
145 /**********************************************************************
146 * wow64_NtFlushKey
148 NTSTATUS WINAPI wow64_NtFlushKey( UINT *args )
150 HANDLE handle = get_handle( &args );
152 return NtFlushKey( handle );
156 /**********************************************************************
157 * wow64_NtLoadKey
159 NTSTATUS WINAPI wow64_NtLoadKey( UINT *args )
161 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
162 OBJECT_ATTRIBUTES32 *file32 = get_ptr( &args );
164 struct object_attr64 attr, file;
166 return NtLoadKey( objattr_32to64( &attr, attr32 ), objattr_32to64( &file, file32 ));
170 /**********************************************************************
171 * wow64_NtLoadKey2
173 NTSTATUS WINAPI wow64_NtLoadKey2( UINT *args )
175 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
176 OBJECT_ATTRIBUTES32 *file32 = get_ptr( &args );
177 ULONG flags = get_ulong( &args );
179 struct object_attr64 attr, file;
181 return NtLoadKey2( objattr_32to64( &attr, attr32 ), objattr_32to64( &file, file32 ), flags );
185 /**********************************************************************
186 * wow64_NtNotifyChangeKey
188 NTSTATUS WINAPI wow64_NtNotifyChangeKey( UINT *args )
190 HANDLE handle = get_handle( &args );
191 HANDLE event = get_handle( &args );
192 ULONG apc = get_ulong( &args );
193 ULONG apc_param = get_ulong( &args );
194 IO_STATUS_BLOCK32 *io32 = get_ptr( &args );
195 ULONG filter = get_ulong( &args );
196 BOOLEAN subtree = get_ulong( &args );
197 void *buffer = get_ptr( &args );
198 ULONG len = get_ulong( &args );
199 BOOLEAN async = get_ulong( &args );
201 IO_STATUS_BLOCK io;
202 NTSTATUS status;
204 status = NtNotifyChangeKey( handle, event, apc_32to64( apc ), apc_param_32to64( apc, apc_param ),
205 iosb_32to64( &io, io32 ), filter, subtree, buffer, len, async );
206 put_iosb( io32, &io );
207 return status;
211 /**********************************************************************
212 * wow64_NtNotifyChangeMultipleKeys
214 NTSTATUS WINAPI wow64_NtNotifyChangeMultipleKeys( UINT *args )
216 HANDLE handle = get_handle( &args );
217 ULONG count = get_ulong( &args );
218 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
219 HANDLE event = get_handle( &args );
220 ULONG apc = get_ulong( &args );
221 ULONG apc_param = get_ulong( &args );
222 IO_STATUS_BLOCK32 *io32 = get_ptr( &args );
223 ULONG filter = get_ulong( &args );
224 BOOLEAN subtree = get_ulong( &args );
225 void *buffer = get_ptr( &args );
226 ULONG len = get_ulong( &args );
227 BOOLEAN async = get_ulong( &args );
229 struct object_attr64 attr;
230 IO_STATUS_BLOCK io;
231 NTSTATUS status;
233 status = NtNotifyChangeMultipleKeys( handle, count, objattr_32to64( &attr, attr32 ), event,
234 apc_32to64( apc ), apc_param_32to64( apc, apc_param ),
235 iosb_32to64( &io, io32 ), filter, subtree, buffer, len, async );
236 put_iosb( io32, &io );
237 return status;
241 /**********************************************************************
242 * wow64_NtOpenKey
244 NTSTATUS WINAPI wow64_NtOpenKey( UINT *args )
246 ULONG *handle_ptr = get_ptr( &args );
247 ACCESS_MASK access = get_ulong( &args );
248 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
250 struct object_attr64 attr;
251 HANDLE handle = 0;
252 NTSTATUS status;
254 *handle_ptr = 0;
255 status = NtOpenKey( &handle, access, objattr_32to64( &attr, attr32 ));
256 put_handle( handle_ptr, handle );
257 return status;
261 /**********************************************************************
262 * wow64_NtOpenKeyEx
264 NTSTATUS WINAPI wow64_NtOpenKeyEx( UINT *args )
266 ULONG *handle_ptr = get_ptr( &args );
267 ACCESS_MASK access = get_ulong( &args );
268 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
269 ULONG options = get_ulong( &args );
271 struct object_attr64 attr;
272 HANDLE handle = 0;
273 NTSTATUS status;
275 *handle_ptr = 0;
276 status = NtOpenKeyEx( &handle, access, objattr_32to64( &attr, attr32 ), options );
277 put_handle( handle_ptr, handle );
278 return status;
282 /**********************************************************************
283 * wow64_NtOpenKeyTransacted
285 NTSTATUS WINAPI wow64_NtOpenKeyTransacted( UINT *args )
287 ULONG *handle_ptr = get_ptr( &args );
288 ACCESS_MASK access = get_ulong( &args );
289 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
290 HANDLE transaction = get_handle( &args );
292 struct object_attr64 attr;
293 HANDLE handle = 0;
294 NTSTATUS status;
296 *handle_ptr = 0;
297 status = NtOpenKeyTransacted( &handle, access, objattr_32to64( &attr, attr32 ), transaction );
298 put_handle( handle_ptr, handle );
299 return status;
303 /**********************************************************************
304 * wow64_NtOpenKeyTransactedEx
306 NTSTATUS WINAPI wow64_NtOpenKeyTransactedEx( UINT *args )
308 ULONG *handle_ptr = get_ptr( &args );
309 ACCESS_MASK access = get_ulong( &args );
310 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
311 ULONG options = get_ulong( &args );
312 HANDLE transaction = get_handle( &args );
314 struct object_attr64 attr;
315 HANDLE handle = 0;
316 NTSTATUS status;
318 *handle_ptr = 0;
319 status = NtOpenKeyTransactedEx( &handle, access, objattr_32to64( &attr, attr32 ), options, transaction );
320 put_handle( handle_ptr, handle );
321 return status;
325 /**********************************************************************
326 * wow64_NtQueryKey
328 NTSTATUS WINAPI wow64_NtQueryKey( UINT *args )
330 HANDLE handle = get_handle( &args );
331 KEY_INFORMATION_CLASS class = get_ulong( &args );
332 void *info = get_ptr( &args );
333 ULONG len = get_ulong( &args );
334 ULONG *retlen = get_ptr( &args );
336 return NtQueryKey( handle, class, info, len, retlen );
340 /**********************************************************************
341 * wow64_NtQueryMultipleValueKey
343 NTSTATUS WINAPI wow64_NtQueryMultipleValueKey( UINT *args )
345 HANDLE handle = get_handle( &args );
346 KEY_MULTIPLE_VALUE_INFORMATION *info = get_ptr( &args );
347 ULONG count = get_ulong( &args );
348 void *ptr = get_ptr( &args );
349 ULONG len = get_ulong( &args );
350 ULONG *retlen = get_ptr( &args );
352 FIXME( "%p %p %u %p %u %p: stub\n", handle, info, count, ptr, len, retlen );
353 return STATUS_SUCCESS;
357 /**********************************************************************
358 * wow64_NtQueryValueKey
360 NTSTATUS WINAPI wow64_NtQueryValueKey( UINT *args )
362 HANDLE handle = get_handle( &args );
363 UNICODE_STRING32 *str32 = get_ptr( &args );
364 KEY_VALUE_INFORMATION_CLASS class = get_ulong( &args );
365 void *ptr = get_ptr( &args );
366 ULONG len = get_ulong( &args );
367 ULONG *retlen = get_ptr( &args );
369 UNICODE_STRING str;
371 return NtQueryValueKey( handle, unicode_str_32to64( &str, str32 ), class, ptr, len, retlen );
375 /**********************************************************************
376 * wow64_NtRenameKey
378 NTSTATUS WINAPI wow64_NtRenameKey( UINT *args )
380 HANDLE handle = get_handle( &args );
381 UNICODE_STRING32 *str32 = get_ptr( &args );
383 UNICODE_STRING str;
385 return NtRenameKey( handle, unicode_str_32to64( &str, str32 ));
389 /**********************************************************************
390 * wow64_NtReplaceKey
392 NTSTATUS WINAPI wow64_NtReplaceKey( UINT *args )
394 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
395 HANDLE handle = get_handle( &args );
396 OBJECT_ATTRIBUTES32 *replace32 = get_ptr( &args );
398 struct object_attr64 attr, replace;
400 return NtReplaceKey( objattr_32to64( &attr, attr32 ), handle, objattr_32to64( &replace, replace32 ));
404 /**********************************************************************
405 * wow64_NtRestoreKey
407 NTSTATUS WINAPI wow64_NtRestoreKey( UINT *args )
409 HANDLE key = get_handle( &args );
410 HANDLE file = get_handle( &args );
411 ULONG flags = get_ulong( &args );
413 return NtRestoreKey( key, file, flags );
417 /**********************************************************************
418 * wow64_NtSaveKey
420 NTSTATUS WINAPI wow64_NtSaveKey( UINT *args )
422 HANDLE key = get_handle( &args );
423 HANDLE file = get_handle( &args );
425 return NtSaveKey( key, file );
429 /**********************************************************************
430 * wow64_NtSetInformationKey
432 NTSTATUS WINAPI wow64_NtSetInformationKey( UINT *args )
434 HANDLE handle = get_handle( &args );
435 int class = get_ulong( &args );
436 void *info = get_ptr( &args );
437 ULONG len = get_ulong( &args );
439 return NtSetInformationKey( handle, class, info, len );
443 /**********************************************************************
444 * wow64_NtSetValueKey
446 NTSTATUS WINAPI wow64_NtSetValueKey( UINT *args )
448 HANDLE handle = get_handle( &args );
449 const UNICODE_STRING32 *str32 = get_ptr( &args );
450 ULONG index = get_ulong( &args );
451 ULONG type = get_ulong( &args );
452 const void *data = get_ptr( &args );
453 ULONG count = get_ulong( &args );
455 UNICODE_STRING str;
457 return NtSetValueKey( handle, unicode_str_32to64( &str, str32 ), index, type, data, count );
461 /**********************************************************************
462 * wow64_NtUnloadKey
464 NTSTATUS WINAPI wow64_NtUnloadKey( UINT *args )
466 OBJECT_ATTRIBUTES32 *attr32 = get_ptr( &args );
468 struct object_attr64 attr;
470 return NtUnloadKey( objattr_32to64( &attr, attr32 ));