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
24 #define WIN32_NO_STATUS
29 #include "wow64_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(wow
);
35 /**********************************************************************
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
;
54 status
= NtCreateKey( &handle
, access
, objattr_32to64( &attr
, attr32
), index
,
55 unicode_str_32to64( &class, class32
), options
, dispos
);
56 put_handle( handle_ptr
, handle
);
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
;
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
);
88 /**********************************************************************
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
);
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 /**********************************************************************
148 NTSTATUS WINAPI
wow64_NtFlushKey( UINT
*args
)
150 HANDLE handle
= get_handle( &args
);
152 return NtFlushKey( handle
);
156 /**********************************************************************
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 /**********************************************************************
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
);
184 /**********************************************************************
187 NTSTATUS WINAPI
wow64_NtLoadKeyEx( UINT
*args
)
189 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
190 OBJECT_ATTRIBUTES32
*file32
= get_ptr( &args
);
191 ULONG flags
= get_ulong( &args
);
192 HANDLE trustkey
= get_handle( &args
);
193 HANDLE event
= get_handle( &args
);
194 ACCESS_MASK desired_access
= get_ulong( &args
);
195 HANDLE
*rootkey
= get_ptr( &args
);
196 IO_STATUS_BLOCK32
*io32
= get_ptr( &args
);
198 struct object_attr64 attr
, file
;
202 status
= NtLoadKeyEx( objattr_32to64( &attr
, attr32
), objattr_32to64( &file
, file32
), flags
,
203 trustkey
, event
, desired_access
, rootkey
, iosb_32to64( &io
, io32
) );
204 put_iosb( io32
, &io
);
209 /**********************************************************************
210 * wow64_NtNotifyChangeKey
212 NTSTATUS WINAPI
wow64_NtNotifyChangeKey( UINT
*args
)
214 HANDLE handle
= get_handle( &args
);
215 HANDLE event
= get_handle( &args
);
216 ULONG apc
= get_ulong( &args
);
217 ULONG apc_param
= get_ulong( &args
);
218 IO_STATUS_BLOCK32
*io32
= get_ptr( &args
);
219 ULONG filter
= get_ulong( &args
);
220 BOOLEAN subtree
= get_ulong( &args
);
221 void *buffer
= get_ptr( &args
);
222 ULONG len
= get_ulong( &args
);
223 BOOLEAN async
= get_ulong( &args
);
228 status
= NtNotifyChangeKey( handle
, event
, apc_32to64( apc
), apc_param_32to64( apc
, apc_param
),
229 iosb_32to64( &io
, io32
), filter
, subtree
, buffer
, len
, async
);
230 put_iosb( io32
, &io
);
235 /**********************************************************************
236 * wow64_NtNotifyChangeMultipleKeys
238 NTSTATUS WINAPI
wow64_NtNotifyChangeMultipleKeys( UINT
*args
)
240 HANDLE handle
= get_handle( &args
);
241 ULONG count
= get_ulong( &args
);
242 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
243 HANDLE event
= get_handle( &args
);
244 ULONG apc
= get_ulong( &args
);
245 ULONG apc_param
= get_ulong( &args
);
246 IO_STATUS_BLOCK32
*io32
= get_ptr( &args
);
247 ULONG filter
= get_ulong( &args
);
248 BOOLEAN subtree
= get_ulong( &args
);
249 void *buffer
= get_ptr( &args
);
250 ULONG len
= get_ulong( &args
);
251 BOOLEAN async
= get_ulong( &args
);
253 struct object_attr64 attr
;
257 status
= NtNotifyChangeMultipleKeys( handle
, count
, objattr_32to64( &attr
, attr32
), event
,
258 apc_32to64( apc
), apc_param_32to64( apc
, apc_param
),
259 iosb_32to64( &io
, io32
), filter
, subtree
, buffer
, len
, async
);
260 put_iosb( io32
, &io
);
265 /**********************************************************************
268 NTSTATUS WINAPI
wow64_NtOpenKey( UINT
*args
)
270 ULONG
*handle_ptr
= get_ptr( &args
);
271 ACCESS_MASK access
= get_ulong( &args
);
272 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
274 struct object_attr64 attr
;
279 status
= NtOpenKey( &handle
, access
, objattr_32to64( &attr
, attr32
));
280 put_handle( handle_ptr
, handle
);
285 /**********************************************************************
288 NTSTATUS WINAPI
wow64_NtOpenKeyEx( UINT
*args
)
290 ULONG
*handle_ptr
= get_ptr( &args
);
291 ACCESS_MASK access
= get_ulong( &args
);
292 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
293 ULONG options
= get_ulong( &args
);
295 struct object_attr64 attr
;
300 status
= NtOpenKeyEx( &handle
, access
, objattr_32to64( &attr
, attr32
), options
);
301 put_handle( handle_ptr
, handle
);
306 /**********************************************************************
307 * wow64_NtOpenKeyTransacted
309 NTSTATUS WINAPI
wow64_NtOpenKeyTransacted( UINT
*args
)
311 ULONG
*handle_ptr
= get_ptr( &args
);
312 ACCESS_MASK access
= get_ulong( &args
);
313 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
314 HANDLE transaction
= get_handle( &args
);
316 struct object_attr64 attr
;
321 status
= NtOpenKeyTransacted( &handle
, access
, objattr_32to64( &attr
, attr32
), transaction
);
322 put_handle( handle_ptr
, handle
);
327 /**********************************************************************
328 * wow64_NtOpenKeyTransactedEx
330 NTSTATUS WINAPI
wow64_NtOpenKeyTransactedEx( UINT
*args
)
332 ULONG
*handle_ptr
= get_ptr( &args
);
333 ACCESS_MASK access
= get_ulong( &args
);
334 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
335 ULONG options
= get_ulong( &args
);
336 HANDLE transaction
= get_handle( &args
);
338 struct object_attr64 attr
;
343 status
= NtOpenKeyTransactedEx( &handle
, access
, objattr_32to64( &attr
, attr32
), options
, transaction
);
344 put_handle( handle_ptr
, handle
);
349 /**********************************************************************
352 NTSTATUS WINAPI
wow64_NtQueryKey( UINT
*args
)
354 HANDLE handle
= get_handle( &args
);
355 KEY_INFORMATION_CLASS
class = get_ulong( &args
);
356 void *info
= get_ptr( &args
);
357 ULONG len
= get_ulong( &args
);
358 ULONG
*retlen
= get_ptr( &args
);
360 return NtQueryKey( handle
, class, info
, len
, retlen
);
364 /**********************************************************************
365 * wow64_NtQueryMultipleValueKey
367 NTSTATUS WINAPI
wow64_NtQueryMultipleValueKey( UINT
*args
)
369 HANDLE handle
= get_handle( &args
);
370 KEY_MULTIPLE_VALUE_INFORMATION
*info
= get_ptr( &args
);
371 ULONG count
= get_ulong( &args
);
372 void *ptr
= get_ptr( &args
);
373 ULONG len
= get_ulong( &args
);
374 ULONG
*retlen
= get_ptr( &args
);
376 FIXME( "%p %p %lu %p %lu %p: stub\n", handle
, info
, count
, ptr
, len
, retlen
);
377 return STATUS_SUCCESS
;
381 /**********************************************************************
382 * wow64_NtQueryValueKey
384 NTSTATUS WINAPI
wow64_NtQueryValueKey( UINT
*args
)
386 HANDLE handle
= get_handle( &args
);
387 UNICODE_STRING32
*str32
= get_ptr( &args
);
388 KEY_VALUE_INFORMATION_CLASS
class = get_ulong( &args
);
389 void *ptr
= get_ptr( &args
);
390 ULONG len
= get_ulong( &args
);
391 ULONG
*retlen
= get_ptr( &args
);
395 return NtQueryValueKey( handle
, unicode_str_32to64( &str
, str32
), class, ptr
, len
, retlen
);
399 /**********************************************************************
402 NTSTATUS WINAPI
wow64_NtRenameKey( UINT
*args
)
404 HANDLE handle
= get_handle( &args
);
405 UNICODE_STRING32
*str32
= get_ptr( &args
);
409 return NtRenameKey( handle
, unicode_str_32to64( &str
, str32
));
413 /**********************************************************************
416 NTSTATUS WINAPI
wow64_NtReplaceKey( UINT
*args
)
418 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
419 HANDLE handle
= get_handle( &args
);
420 OBJECT_ATTRIBUTES32
*replace32
= get_ptr( &args
);
422 struct object_attr64 attr
, replace
;
424 return NtReplaceKey( objattr_32to64( &attr
, attr32
), handle
, objattr_32to64( &replace
, replace32
));
428 /**********************************************************************
431 NTSTATUS WINAPI
wow64_NtRestoreKey( UINT
*args
)
433 HANDLE key
= get_handle( &args
);
434 HANDLE file
= get_handle( &args
);
435 ULONG flags
= get_ulong( &args
);
437 return NtRestoreKey( key
, file
, flags
);
441 /**********************************************************************
444 NTSTATUS WINAPI
wow64_NtSaveKey( UINT
*args
)
446 HANDLE key
= get_handle( &args
);
447 HANDLE file
= get_handle( &args
);
449 return NtSaveKey( key
, file
);
453 /**********************************************************************
454 * wow64_NtSetInformationKey
456 NTSTATUS WINAPI
wow64_NtSetInformationKey( UINT
*args
)
458 HANDLE handle
= get_handle( &args
);
459 int class = get_ulong( &args
);
460 void *info
= get_ptr( &args
);
461 ULONG len
= get_ulong( &args
);
463 return NtSetInformationKey( handle
, class, info
, len
);
467 /**********************************************************************
468 * wow64_NtSetValueKey
470 NTSTATUS WINAPI
wow64_NtSetValueKey( UINT
*args
)
472 HANDLE handle
= get_handle( &args
);
473 const UNICODE_STRING32
*str32
= get_ptr( &args
);
474 ULONG index
= get_ulong( &args
);
475 ULONG type
= get_ulong( &args
);
476 const void *data
= get_ptr( &args
);
477 ULONG count
= get_ulong( &args
);
481 return NtSetValueKey( handle
, unicode_str_32to64( &str
, str32
), index
, type
, data
, count
);
485 /**********************************************************************
488 NTSTATUS WINAPI
wow64_NtUnloadKey( UINT
*args
)
490 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
492 struct object_attr64 attr
;
494 return NtUnloadKey( objattr_32to64( &attr
, attr32
));