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
24 #define WIN32_NO_STATUS
29 #include "wow64_private.h"
30 #include "wine/debug.h"
32 WINE_DEFAULT_DEBUG_CHANNEL(wow
);
35 static void put_object_type_info( OBJECT_TYPE_INFORMATION32
*info32
, const OBJECT_TYPE_INFORMATION
*info
)
37 if (info
->TypeName
.Length
)
39 memcpy( info32
+ 1, info
->TypeName
.Buffer
, info
->TypeName
.Length
+ sizeof(WCHAR
) );
40 info32
->TypeName
.Length
= info
->TypeName
.Length
;
41 info32
->TypeName
.MaximumLength
= info
->TypeName
.Length
+ sizeof(WCHAR
);
42 info32
->TypeName
.Buffer
= PtrToUlong( info32
+ 1 );
44 else memset( &info32
->TypeName
, 0, sizeof(info32
->TypeName
) );
45 info32
->TotalNumberOfObjects
= info
->TotalNumberOfObjects
;
46 info32
->TotalNumberOfHandles
= info
->TotalNumberOfHandles
;
47 info32
->TotalPagedPoolUsage
= info
->TotalPagedPoolUsage
;
48 info32
->TotalNonPagedPoolUsage
= info
->TotalNonPagedPoolUsage
;
49 info32
->TotalNamePoolUsage
= info
->TotalNamePoolUsage
;
50 info32
->TotalHandleTableUsage
= info
->TotalHandleTableUsage
;
51 info32
->HighWaterNumberOfObjects
= info
->HighWaterNumberOfObjects
;
52 info32
->HighWaterNumberOfHandles
= info
->HighWaterNumberOfHandles
;
53 info32
->HighWaterPagedPoolUsage
= info
->HighWaterPagedPoolUsage
;
54 info32
->HighWaterNonPagedPoolUsage
= info
->HighWaterNonPagedPoolUsage
;
55 info32
->HighWaterNamePoolUsage
= info
->HighWaterNamePoolUsage
;
56 info32
->HighWaterHandleTableUsage
= info
->HighWaterHandleTableUsage
;
57 info32
->InvalidAttributes
= info
->InvalidAttributes
;
58 info32
->GenericMapping
= info
->GenericMapping
;
59 info32
->ValidAccessMask
= info
->ValidAccessMask
;
60 info32
->SecurityRequired
= info
->SecurityRequired
;
61 info32
->MaintainHandleCount
= info
->MaintainHandleCount
;
62 info32
->TypeIndex
= info
->TypeIndex
;
63 info32
->ReservedByte
= info
->ReservedByte
;
64 info32
->PoolType
= info
->PoolType
;
65 info32
->DefaultPagedPoolCharge
= info
->DefaultPagedPoolCharge
;
66 info32
->DefaultNonPagedPoolCharge
= info
->DefaultNonPagedPoolCharge
;
70 static JOBOBJECT_BASIC_LIMIT_INFORMATION
*job_basic_limit_info_32to64( JOBOBJECT_BASIC_LIMIT_INFORMATION
*out
,
71 const JOBOBJECT_BASIC_LIMIT_INFORMATION32
*in
)
73 out
->PerProcessUserTimeLimit
= in
->PerProcessUserTimeLimit
;
74 out
->PerJobUserTimeLimit
= in
->PerJobUserTimeLimit
;
75 out
->LimitFlags
= in
->LimitFlags
;
76 out
->MinimumWorkingSetSize
= in
->MinimumWorkingSetSize
;
77 out
->MaximumWorkingSetSize
= in
->MaximumWorkingSetSize
;
78 out
->ActiveProcessLimit
= in
->ActiveProcessLimit
;
79 out
->Affinity
= in
->Affinity
;
80 out
->PriorityClass
= in
->PriorityClass
;
81 out
->SchedulingClass
= in
->SchedulingClass
;
86 static void put_job_basic_limit_info( JOBOBJECT_BASIC_LIMIT_INFORMATION32
*info32
,
87 const JOBOBJECT_BASIC_LIMIT_INFORMATION
*info
)
89 info32
->PerProcessUserTimeLimit
= info
->PerProcessUserTimeLimit
;
90 info32
->PerJobUserTimeLimit
= info
->PerJobUserTimeLimit
;
91 info32
->LimitFlags
= info
->LimitFlags
;
92 info32
->MinimumWorkingSetSize
= info
->MinimumWorkingSetSize
;
93 info32
->MaximumWorkingSetSize
= info
->MaximumWorkingSetSize
;
94 info32
->ActiveProcessLimit
= info
->ActiveProcessLimit
;
95 info32
->Affinity
= info
->Affinity
;
96 info32
->PriorityClass
= info
->PriorityClass
;
97 info32
->SchedulingClass
= info
->SchedulingClass
;
101 void put_section_image_info( SECTION_IMAGE_INFORMATION32
*info32
, const SECTION_IMAGE_INFORMATION
*info
)
103 if (info
->Machine
== IMAGE_FILE_MACHINE_AMD64
|| info
->Machine
== IMAGE_FILE_MACHINE_ARM64
)
105 info32
->TransferAddress
= 0x81231234; /* sic */
106 info32
->MaximumStackSize
= 0x100000;
107 info32
->CommittedStackSize
= 0x10000;
111 info32
->TransferAddress
= PtrToUlong( info
->TransferAddress
);
112 info32
->MaximumStackSize
= info
->MaximumStackSize
;
113 info32
->CommittedStackSize
= info
->CommittedStackSize
;
115 info32
->ZeroBits
= info
->ZeroBits
;
116 info32
->SubSystemType
= info
->SubSystemType
;
117 info32
->MinorSubsystemVersion
= info
->MinorSubsystemVersion
;
118 info32
->MajorSubsystemVersion
= info
->MajorSubsystemVersion
;
119 info32
->MajorOperatingSystemVersion
= info
->MajorOperatingSystemVersion
;
120 info32
->MinorOperatingSystemVersion
= info
->MinorOperatingSystemVersion
;
121 info32
->ImageCharacteristics
= info
->ImageCharacteristics
;
122 info32
->DllCharacteristics
= info
->DllCharacteristics
;
123 info32
->Machine
= info
->Machine
;
124 info32
->ImageContainsCode
= info
->ImageContainsCode
;
125 info32
->ImageFlags
= info
->ImageFlags
;
126 info32
->LoaderFlags
= info
->LoaderFlags
;
127 info32
->ImageFileSize
= info
->ImageFileSize
;
128 info32
->CheckSum
= info
->CheckSum
;
132 /**********************************************************************
133 * wow64_NtAcceptConnectPort
135 NTSTATUS WINAPI
wow64_NtAcceptConnectPort( UINT
*args
)
137 ULONG
*handle_ptr
= get_ptr( &args
);
138 ULONG id
= get_ulong( &args
);
139 LPC_MESSAGE
*msg
= get_ptr( &args
);
140 BOOLEAN accept
= get_ulong( &args
);
141 LPC_SECTION_WRITE
*write
= get_ptr( &args
);
142 LPC_SECTION_READ
*read
= get_ptr( &args
);
144 FIXME( "%p %lu %p %u %p %p: stub\n", handle_ptr
, id
, msg
, accept
, write
, read
);
145 return STATUS_NOT_IMPLEMENTED
;
149 /**********************************************************************
150 * wow64_NtCancelTimer
152 NTSTATUS WINAPI
wow64_NtCancelTimer( UINT
*args
)
154 HANDLE handle
= get_handle( &args
);
155 BOOLEAN
*state
= get_ptr( &args
);
157 return NtCancelTimer( handle
, state
);
161 /**********************************************************************
164 NTSTATUS WINAPI
wow64_NtClearEvent( UINT
*args
)
166 HANDLE handle
= get_handle( &args
);
168 return NtClearEvent( handle
);
172 /**********************************************************************
173 * wow64_NtCompareObjects
175 NTSTATUS WINAPI
wow64_NtCompareObjects( UINT
*args
)
177 HANDLE first
= get_handle( &args
);
178 HANDLE second
= get_handle( &args
);
180 return NtCompareObjects( first
, second
);
184 /**********************************************************************
185 * wow64_NtCompleteConnectPort
187 NTSTATUS WINAPI
wow64_NtCompleteConnectPort( UINT
*args
)
189 HANDLE handle
= get_handle( &args
);
191 return NtCompleteConnectPort( handle
);
195 /**********************************************************************
196 * wow64_NtConnectPort
198 NTSTATUS WINAPI
wow64_NtConnectPort( UINT
*args
)
200 ULONG
*handle_ptr
= get_ptr( &args
);
201 UNICODE_STRING32
*name32
= get_ptr( &args
);
202 SECURITY_QUALITY_OF_SERVICE
*qos
= get_ptr( &args
);
203 LPC_SECTION_WRITE
*write
= get_ptr( &args
);
204 LPC_SECTION_READ
*read
= get_ptr( &args
);
205 ULONG
*max_len
= get_ptr( &args
);
206 void *info
= get_ptr( &args
);
207 ULONG
*info_len
= get_ptr( &args
);
209 FIXME( "%p %p %p %p %p %p %p %p: stub\n",
210 handle_ptr
, name32
, qos
, write
, read
, max_len
, info
, info_len
);
211 return STATUS_NOT_IMPLEMENTED
;
215 /**********************************************************************
216 * wow64_NtCreateDebugObject
218 NTSTATUS WINAPI
wow64_NtCreateDebugObject( UINT
*args
)
220 ULONG
*handle_ptr
= get_ptr( &args
);
221 ACCESS_MASK access
= get_ulong( &args
);
222 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
223 ULONG flags
= get_ulong( &args
);
225 struct object_attr64 attr
;
230 status
= NtCreateDebugObject( &handle
, access
, objattr_32to64( &attr
, attr32
), flags
);
231 put_handle( handle_ptr
, handle
);
236 /**********************************************************************
237 * wow64_NtCreateDirectoryObject
239 NTSTATUS WINAPI
wow64_NtCreateDirectoryObject( UINT
*args
)
241 ULONG
*handle_ptr
= get_ptr( &args
);
242 ACCESS_MASK access
= get_ulong( &args
);
243 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
245 struct object_attr64 attr
;
250 status
= NtCreateDirectoryObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
251 put_handle( handle_ptr
, handle
);
256 /**********************************************************************
257 * wow64_NtCreateEvent
259 NTSTATUS WINAPI
wow64_NtCreateEvent( UINT
*args
)
261 ULONG
*handle_ptr
= get_ptr( &args
);
262 ACCESS_MASK access
= get_ulong( &args
);
263 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
264 EVENT_TYPE type
= get_ulong( &args
);
265 BOOLEAN state
= get_ulong( &args
);
267 struct object_attr64 attr
;
272 status
= NtCreateEvent( &handle
, access
, objattr_32to64( &attr
, attr32
), type
, state
);
273 put_handle( handle_ptr
, handle
);
278 /**********************************************************************
279 * wow64_NtCreateIoCompletion
281 NTSTATUS WINAPI
wow64_NtCreateIoCompletion( UINT
*args
)
283 ULONG
*handle_ptr
= get_ptr( &args
);
284 ACCESS_MASK access
= get_ulong( &args
);
285 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
286 ULONG threads
= get_ulong( &args
);
288 struct object_attr64 attr
;
293 status
= NtCreateIoCompletion( &handle
, access
, objattr_32to64( &attr
, attr32
), threads
);
294 put_handle( handle_ptr
, handle
);
299 /**********************************************************************
300 * wow64_NtCreateJobObject
302 NTSTATUS WINAPI
wow64_NtCreateJobObject( UINT
*args
)
304 ULONG
*handle_ptr
= get_ptr( &args
);
305 ACCESS_MASK access
= get_ulong( &args
);
306 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
308 struct object_attr64 attr
;
313 status
= NtCreateJobObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
314 put_handle( handle_ptr
, handle
);
319 /**********************************************************************
320 * wow64_NtCreateKeyedEvent
322 NTSTATUS WINAPI
wow64_NtCreateKeyedEvent( UINT
*args
)
324 ULONG
*handle_ptr
= get_ptr( &args
);
325 ACCESS_MASK access
= get_ulong( &args
);
326 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
327 ULONG flags
= get_ulong( &args
);
329 struct object_attr64 attr
;
334 status
= NtCreateKeyedEvent( &handle
, access
, objattr_32to64( &attr
, attr32
), flags
);
335 put_handle( handle_ptr
, handle
);
340 /**********************************************************************
341 * wow64_NtCreateMutant
343 NTSTATUS WINAPI
wow64_NtCreateMutant( UINT
*args
)
345 ULONG
*handle_ptr
= get_ptr( &args
);
346 ACCESS_MASK access
= get_ulong( &args
);
347 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
348 BOOLEAN owned
= get_ulong( &args
);
350 struct object_attr64 attr
;
355 status
= NtCreateMutant( &handle
, access
, objattr_32to64( &attr
, attr32
), owned
);
356 put_handle( handle_ptr
, handle
);
361 /**********************************************************************
364 NTSTATUS WINAPI
wow64_NtCreatePort( UINT
*args
)
366 ULONG
*handle_ptr
= get_ptr( &args
);
367 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
368 ULONG info_len
= get_ulong( &args
);
369 ULONG data_len
= get_ulong( &args
);
370 ULONG
*reserved
= get_ptr( &args
);
372 struct object_attr64 attr
;
377 status
= NtCreatePort( &handle
, objattr_32to64( &attr
, attr32
), info_len
, data_len
, reserved
);
378 put_handle( handle_ptr
, handle
);
383 /**********************************************************************
384 * wow64_NtCreateSection
386 NTSTATUS WINAPI
wow64_NtCreateSection( UINT
*args
)
388 ULONG
*handle_ptr
= get_ptr( &args
);
389 ACCESS_MASK access
= get_ulong( &args
);
390 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
391 const LARGE_INTEGER
*size
= get_ptr( &args
);
392 ULONG protect
= get_ulong( &args
);
393 ULONG flags
= get_ulong( &args
);
394 HANDLE file
= get_handle( &args
);
396 struct object_attr64 attr
;
401 status
= NtCreateSection( &handle
, access
, objattr_32to64( &attr
, attr32
), size
, protect
, flags
, file
);
402 put_handle( handle_ptr
, handle
);
407 /**********************************************************************
408 * wow64_NtCreateSemaphore
410 NTSTATUS WINAPI
wow64_NtCreateSemaphore( UINT
*args
)
412 ULONG
*handle_ptr
= get_ptr( &args
);
413 ACCESS_MASK access
= get_ulong( &args
);
414 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
415 LONG initial
= get_ulong( &args
);
416 LONG max
= get_ulong( &args
);
418 struct object_attr64 attr
;
423 status
= NtCreateSemaphore( &handle
, access
, objattr_32to64( &attr
, attr32
), initial
, max
);
424 put_handle( handle_ptr
, handle
);
429 /**********************************************************************
430 * wow64_NtCreateSymbolicLinkObject
432 NTSTATUS WINAPI
wow64_NtCreateSymbolicLinkObject( UINT
*args
)
434 ULONG
*handle_ptr
= get_ptr( &args
);
435 ACCESS_MASK access
= get_ulong( &args
);
436 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
437 UNICODE_STRING32
*target32
= get_ptr( &args
);
439 struct object_attr64 attr
;
440 UNICODE_STRING target
;
445 status
= NtCreateSymbolicLinkObject( &handle
, access
, objattr_32to64( &attr
, attr32
),
446 unicode_str_32to64( &target
, target32
));
447 put_handle( handle_ptr
, handle
);
452 /**********************************************************************
453 * wow64_NtCreateTimer
455 NTSTATUS WINAPI
wow64_NtCreateTimer( UINT
*args
)
457 ULONG
*handle_ptr
= get_ptr( &args
);
458 ACCESS_MASK access
= get_ulong( &args
);
459 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
460 TIMER_TYPE type
= get_ulong( &args
);
462 struct object_attr64 attr
;
467 status
= NtCreateTimer( &handle
, access
, objattr_32to64( &attr
, attr32
), type
);
468 put_handle( handle_ptr
, handle
);
473 /**********************************************************************
474 * wow64_NtDebugContinue
476 NTSTATUS WINAPI
wow64_NtDebugContinue( UINT
*args
)
478 HANDLE handle
= get_handle( &args
);
479 CLIENT_ID32
*id32
= get_ptr( &args
);
480 NTSTATUS status
= get_ulong( &args
);
484 return NtDebugContinue( handle
, client_id_32to64( &id
, id32
), status
);
488 /**********************************************************************
489 * wow64_NtDelayExecution
491 NTSTATUS WINAPI
wow64_NtDelayExecution( UINT
*args
)
493 BOOLEAN alertable
= get_ulong( &args
);
494 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
496 return NtDelayExecution( alertable
, timeout
);
500 /**********************************************************************
501 * wow64_NtDuplicateObject
503 NTSTATUS WINAPI
wow64_NtDuplicateObject( UINT
*args
)
505 HANDLE source_process
= get_handle( &args
);
506 HANDLE source_handle
= get_handle( &args
);
507 HANDLE dest_process
= get_handle( &args
);
508 ULONG
*handle_ptr
= get_ptr( &args
);
509 ACCESS_MASK access
= get_ulong( &args
);
510 ULONG attributes
= get_ulong( &args
);
511 ULONG options
= get_ulong( &args
);
516 if (handle_ptr
) *handle_ptr
= 0;
517 status
= NtDuplicateObject( source_process
, source_handle
, dest_process
, &handle
,
518 access
, attributes
, options
);
519 if (handle_ptr
) put_handle( handle_ptr
, handle
);
524 /**********************************************************************
527 NTSTATUS WINAPI
wow64_NtListenPort( UINT
*args
)
529 HANDLE handle
= get_handle( &args
);
530 LPC_MESSAGE
*msg
= get_ptr( &args
);
532 FIXME( "%p %p: stub\n", handle
, msg
);
533 return STATUS_NOT_IMPLEMENTED
;
537 /**********************************************************************
538 * wow64_NtMakeTemporaryObject
540 NTSTATUS WINAPI
wow64_NtMakeTemporaryObject( UINT
*args
)
542 HANDLE handle
= get_handle( &args
);
544 return NtMakeTemporaryObject( handle
);
548 /**********************************************************************
549 * wow64_NtOpenDirectoryObject
551 NTSTATUS WINAPI
wow64_NtOpenDirectoryObject( UINT
*args
)
553 ULONG
*handle_ptr
= get_ptr( &args
);
554 ACCESS_MASK access
= get_ulong( &args
);
555 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
557 struct object_attr64 attr
;
562 status
= NtOpenDirectoryObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
563 put_handle( handle_ptr
, handle
);
568 /**********************************************************************
571 NTSTATUS WINAPI
wow64_NtOpenEvent( UINT
*args
)
573 ULONG
*handle_ptr
= get_ptr( &args
);
574 ACCESS_MASK access
= get_ulong( &args
);
575 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
577 struct object_attr64 attr
;
582 status
= NtOpenEvent( &handle
, access
, objattr_32to64( &attr
, attr32
));
583 put_handle( handle_ptr
, handle
);
588 /**********************************************************************
589 * wow64_NtOpenIoCompletion
591 NTSTATUS WINAPI
wow64_NtOpenIoCompletion( UINT
*args
)
593 ULONG
*handle_ptr
= get_ptr( &args
);
594 ACCESS_MASK access
= get_ulong( &args
);
595 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
597 struct object_attr64 attr
;
602 status
= NtOpenIoCompletion( &handle
, access
, objattr_32to64( &attr
, attr32
));
603 put_handle( handle_ptr
, handle
);
608 /**********************************************************************
609 * wow64_NtOpenJobObject
611 NTSTATUS WINAPI
wow64_NtOpenJobObject( UINT
*args
)
613 ULONG
*handle_ptr
= get_ptr( &args
);
614 ACCESS_MASK access
= get_ulong( &args
);
615 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
617 struct object_attr64 attr
;
622 status
= NtOpenJobObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
623 put_handle( handle_ptr
, handle
);
628 /**********************************************************************
629 * wow64_NtOpenKeyedEvent
631 NTSTATUS WINAPI
wow64_NtOpenKeyedEvent( UINT
*args
)
633 ULONG
*handle_ptr
= get_ptr( &args
);
634 ACCESS_MASK access
= get_ulong( &args
);
635 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
637 struct object_attr64 attr
;
642 status
= NtOpenKeyedEvent( &handle
, access
, objattr_32to64( &attr
, attr32
));
643 put_handle( handle_ptr
, handle
);
648 /**********************************************************************
651 NTSTATUS WINAPI
wow64_NtOpenMutant( UINT
*args
)
653 ULONG
*handle_ptr
= get_ptr( &args
);
654 ACCESS_MASK access
= get_ulong( &args
);
655 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
657 struct object_attr64 attr
;
662 status
= NtOpenMutant( &handle
, access
, objattr_32to64( &attr
, attr32
));
663 put_handle( handle_ptr
, handle
);
668 /**********************************************************************
669 * wow64_NtOpenSection
671 NTSTATUS WINAPI
wow64_NtOpenSection( UINT
*args
)
673 ULONG
*handle_ptr
= get_ptr( &args
);
674 ACCESS_MASK access
= get_ulong( &args
);
675 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
677 struct object_attr64 attr
;
682 status
= NtOpenSection( &handle
, access
, objattr_32to64( &attr
, attr32
));
683 put_handle( handle_ptr
, handle
);
688 /**********************************************************************
689 * wow64_NtOpenSemaphore
691 NTSTATUS WINAPI
wow64_NtOpenSemaphore( UINT
*args
)
693 ULONG
*handle_ptr
= get_ptr( &args
);
694 ACCESS_MASK access
= get_ulong( &args
);
695 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
697 struct object_attr64 attr
;
702 status
= NtOpenSemaphore( &handle
, access
, objattr_32to64( &attr
, attr32
));
703 put_handle( handle_ptr
, handle
);
708 /**********************************************************************
709 * wow64_NtOpenSymbolicLinkObject
711 NTSTATUS WINAPI
wow64_NtOpenSymbolicLinkObject( UINT
*args
)
713 ULONG
*handle_ptr
= get_ptr( &args
);
714 ACCESS_MASK access
= get_ulong( &args
);
715 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
717 struct object_attr64 attr
;
722 status
= NtOpenSymbolicLinkObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
723 put_handle( handle_ptr
, handle
);
728 /**********************************************************************
731 NTSTATUS WINAPI
wow64_NtOpenTimer( UINT
*args
)
733 ULONG
*handle_ptr
= get_ptr( &args
);
734 ACCESS_MASK access
= get_ulong( &args
);
735 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
737 struct object_attr64 attr
;
742 status
= NtOpenTimer( &handle
, access
, objattr_32to64( &attr
, attr32
));
743 put_handle( handle_ptr
, handle
);
748 /**********************************************************************
751 NTSTATUS WINAPI
wow64_NtPulseEvent( UINT
*args
)
753 HANDLE handle
= get_handle( &args
);
754 LONG
*prev_state
= get_ptr( &args
);
756 return NtPulseEvent( handle
, prev_state
);
760 /**********************************************************************
761 * wow64_NtQueryDirectoryObject
763 NTSTATUS WINAPI
wow64_NtQueryDirectoryObject( UINT
*args
)
765 HANDLE handle
= get_handle( &args
);
766 DIRECTORY_BASIC_INFORMATION32
*info32
= get_ptr( &args
);
767 ULONG size32
= get_ulong( &args
);
768 BOOLEAN single_entry
= get_ulong( &args
);
769 BOOLEAN restart
= get_ulong( &args
);
770 ULONG
*context
= get_ptr( &args
);
771 ULONG
*retlen
= get_ptr( &args
);
774 DIRECTORY_BASIC_INFORMATION
*info
;
775 ULONG size
= size32
+ sizeof(*info
) - sizeof(*info32
);
777 if (!single_entry
) FIXME( "not implemented\n" );
778 info
= Wow64AllocateTemp( size
);
779 status
= NtQueryDirectoryObject( handle
, info
, size
, single_entry
, restart
, context
, NULL
);
782 info32
->ObjectName
.Buffer
= PtrToUlong( info32
+ 1 );
783 info32
->ObjectName
.Length
= info
->ObjectName
.Length
;
784 info32
->ObjectName
.MaximumLength
= info
->ObjectName
.MaximumLength
;
785 info32
->ObjectTypeName
.Buffer
= info32
->ObjectName
.Buffer
+ info
->ObjectName
.MaximumLength
;
786 info32
->ObjectTypeName
.Length
= info
->ObjectTypeName
.Length
;
787 info32
->ObjectTypeName
.MaximumLength
= info
->ObjectTypeName
.MaximumLength
;
788 size
= info
->ObjectName
.MaximumLength
+ info
->ObjectTypeName
.MaximumLength
;
789 memcpy( info32
+ 1, info
+ 1, size
);
790 if (retlen
) *retlen
= sizeof(*info32
) + size
;
796 /**********************************************************************
799 NTSTATUS WINAPI
wow64_NtQueryEvent( UINT
*args
)
801 HANDLE handle
= get_handle( &args
);
802 EVENT_INFORMATION_CLASS
class = get_ulong( &args
);
803 void *info
= get_ptr( &args
);
804 ULONG len
= get_ulong( &args
);
805 ULONG
*retlen
= get_ptr( &args
);
807 return NtQueryEvent( handle
, class, info
, len
, retlen
);
811 /**********************************************************************
812 * wow64_NtQueryInformationJobObject
814 NTSTATUS WINAPI
wow64_NtQueryInformationJobObject( UINT
*args
)
816 HANDLE handle
= get_handle( &args
);
817 JOBOBJECTINFOCLASS
class = get_ulong( &args
);
818 void *ptr
= get_ptr( &args
);
819 ULONG len
= get_ulong( &args
);
820 ULONG
*retlen
= get_ptr( &args
);
826 case JobObjectBasicAccountingInformation
: /* JOBOBJECT_BASIC_ACCOUNTING_INFORMATION */
827 return NtQueryInformationJobObject( handle
, class, ptr
, len
, retlen
);
829 case JobObjectBasicLimitInformation
: /* JOBOBJECT_BASIC_LIMIT_INFORMATION */
830 if (len
>= sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION32
))
832 JOBOBJECT_BASIC_LIMIT_INFORMATION32
*info32
= ptr
;
833 JOBOBJECT_BASIC_LIMIT_INFORMATION info
;
835 status
= NtQueryInformationJobObject( handle
, class, &info
, sizeof(info
), NULL
);
836 if (!status
) put_job_basic_limit_info( info32
, &info
);
837 if (retlen
) *retlen
= sizeof(*info32
);
840 else return STATUS_INFO_LENGTH_MISMATCH
;
842 case JobObjectBasicProcessIdList
: /* JOBOBJECT_BASIC_PROCESS_ID_LIST */
843 if (len
>= sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST32
))
845 JOBOBJECT_BASIC_PROCESS_ID_LIST32
*info32
= ptr
;
846 JOBOBJECT_BASIC_PROCESS_ID_LIST
*info
;
847 ULONG i
, count
, size
;
849 count
= (len
- offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST32
, ProcessIdList
)) / sizeof(info32
->ProcessIdList
[0]);
850 size
= offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST
, ProcessIdList
[count
] );
851 info
= Wow64AllocateTemp( size
);
852 status
= NtQueryInformationJobObject( handle
, class, info
, size
, NULL
);
855 info32
->NumberOfAssignedProcesses
= info
->NumberOfAssignedProcesses
;
856 info32
->NumberOfProcessIdsInList
= info
->NumberOfProcessIdsInList
;
857 for (i
= 0; i
< info
->NumberOfProcessIdsInList
; i
++)
858 info32
->ProcessIdList
[i
] = info
->ProcessIdList
[i
];
859 if (retlen
) *retlen
= offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST32
, ProcessIdList
[i
] );
863 else return STATUS_INFO_LENGTH_MISMATCH
;
865 case JobObjectExtendedLimitInformation
: /* JOBOBJECT_EXTENDED_LIMIT_INFORMATION */
866 if (len
>= sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
))
868 JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
*info32
= ptr
;
869 JOBOBJECT_EXTENDED_LIMIT_INFORMATION info
;
871 status
= NtQueryInformationJobObject( handle
, class, &info
, sizeof(info
), NULL
);
874 put_job_basic_limit_info( &info32
->BasicLimitInformation
, &info
.BasicLimitInformation
);
875 info32
->IoInfo
= info
.IoInfo
;
876 info32
->ProcessMemoryLimit
= info
.ProcessMemoryLimit
;
877 info32
->JobMemoryLimit
= info
.JobMemoryLimit
;
878 info32
->PeakProcessMemoryUsed
= info
.PeakProcessMemoryUsed
;
879 info32
->PeakJobMemoryUsed
= info
.PeakJobMemoryUsed
;
881 if (retlen
) *retlen
= sizeof(*info32
);
884 else return STATUS_INFO_LENGTH_MISMATCH
;
887 if (class >= MaxJobObjectInfoClass
) return STATUS_INVALID_PARAMETER
;
888 FIXME( "unsupported class %u\n", class );
889 return STATUS_NOT_IMPLEMENTED
;
894 /**********************************************************************
895 * wow64_NtQueryIoCompletion
897 NTSTATUS WINAPI
wow64_NtQueryIoCompletion( UINT
*args
)
899 HANDLE handle
= get_handle( &args
);
900 IO_COMPLETION_INFORMATION_CLASS
class = get_ulong( &args
);
901 void *info
= get_ptr( &args
);
902 ULONG len
= get_ulong( &args
);
903 ULONG
*retlen
= get_ptr( &args
);
905 return NtQueryIoCompletion( handle
, class, info
, len
, retlen
);
909 /**********************************************************************
910 * wow64_NtQueryMutant
912 NTSTATUS WINAPI
wow64_NtQueryMutant( UINT
*args
)
914 HANDLE handle
= get_handle( &args
);
915 MUTANT_INFORMATION_CLASS
class = get_ulong( &args
);
916 void *info
= get_ptr( &args
);
917 ULONG len
= get_ulong( &args
);
918 ULONG
*retlen
= get_ptr( &args
);
920 return NtQueryMutant( handle
, class, info
, len
, retlen
);
924 /**********************************************************************
925 * wow64_NtQueryObject
927 NTSTATUS WINAPI
wow64_NtQueryObject( UINT
*args
)
929 HANDLE handle
= get_handle( &args
);
930 OBJECT_INFORMATION_CLASS
class = get_ulong( &args
);
931 void *ptr
= get_ptr( &args
);
932 ULONG len
= get_ulong( &args
);
933 ULONG
*retlen
= get_ptr( &args
);
940 case ObjectBasicInformation
: /* OBJECT_BASIC_INFORMATION */
941 case ObjectDataInformation
: /* OBJECT_DATA_INFORMATION */
942 return NtQueryObject( handle
, class, ptr
, len
, retlen
);
944 case ObjectNameInformation
: /* OBJECT_NAME_INFORMATION */
946 ULONG size
= len
+ sizeof(OBJECT_NAME_INFORMATION
) - sizeof(OBJECT_NAME_INFORMATION32
);
947 OBJECT_NAME_INFORMATION32
*info32
= ptr
;
948 OBJECT_NAME_INFORMATION
*info
= Wow64AllocateTemp( size
);
950 if (!(status
= NtQueryObject( handle
, class, info
, size
, &ret_size
)))
952 if (len
>= sizeof(*info32
) + info
->Name
.MaximumLength
)
954 if (info
->Name
.Length
)
956 memcpy( info32
+ 1, info
->Name
.Buffer
, info
->Name
.Length
+ sizeof(WCHAR
) );
957 info32
->Name
.Length
= info
->Name
.Length
;
958 info32
->Name
.MaximumLength
= info
->Name
.Length
+ sizeof(WCHAR
);
959 info32
->Name
.Buffer
= PtrToUlong( info32
+ 1 );
961 else memset( &info32
->Name
, 0, sizeof(info32
->Name
) );
963 else status
= STATUS_INFO_LENGTH_MISMATCH
;
964 if (retlen
) *retlen
= sizeof(*info32
) + info
->Name
.MaximumLength
;
966 else if (status
== STATUS_INFO_LENGTH_MISMATCH
|| status
== STATUS_BUFFER_OVERFLOW
)
968 if (retlen
) *retlen
= ret_size
- sizeof(*info
) + sizeof(*info32
);
973 case ObjectTypeInformation
: /* OBJECT_TYPE_INFORMATION */
975 ULONG_PTR buffer
[(sizeof(OBJECT_TYPE_INFORMATION
) + 64) / sizeof(ULONG_PTR
)];
976 OBJECT_TYPE_INFORMATION
*info
= (OBJECT_TYPE_INFORMATION
*)buffer
;
977 OBJECT_TYPE_INFORMATION32
*info32
= ptr
;
979 if (!(status
= NtQueryObject( handle
, class, info
, sizeof(buffer
), NULL
)))
981 if (len
>= sizeof(*info32
) + info
->TypeName
.MaximumLength
)
982 put_object_type_info( info32
, info
);
984 status
= STATUS_INFO_LENGTH_MISMATCH
;
985 if (retlen
) *retlen
= sizeof(*info32
) + info
->TypeName
.Length
+ sizeof(WCHAR
);
990 case ObjectTypesInformation
: /* OBJECT_TYPES_INFORMATION */
992 OBJECT_TYPES_INFORMATION
*info
, *info32
= ptr
;
993 /* assume at most 32 types, with an average 16-char name */
994 ULONG ret_size
, size
= 32 * (sizeof(OBJECT_TYPE_INFORMATION
) + 16 * sizeof(WCHAR
));
996 info
= Wow64AllocateTemp( size
);
997 if (!(status
= NtQueryObject( handle
, class, info
, size
, &ret_size
)))
999 OBJECT_TYPE_INFORMATION
*type
;
1000 OBJECT_TYPE_INFORMATION32
*type32
;
1001 ULONG align
= TYPE_ALIGNMENT( OBJECT_TYPE_INFORMATION
) - 1;
1002 ULONG align32
= TYPE_ALIGNMENT( OBJECT_TYPE_INFORMATION32
) - 1;
1003 ULONG i
, pos
= (sizeof(*info
) + align
) & ~align
, pos32
= (sizeof(*info32
) + align32
) & ~align32
;
1005 if (pos32
<= len
) info32
->NumberOfTypes
= info
->NumberOfTypes
;
1006 for (i
= 0; i
< info
->NumberOfTypes
; i
++)
1008 type
= (OBJECT_TYPE_INFORMATION
*)((char *)info
+ pos
);
1009 type32
= (OBJECT_TYPE_INFORMATION32
*)((char *)ptr
+ pos32
);
1010 pos
+= sizeof(*type
) + ((type
->TypeName
.MaximumLength
+ align
) & ~align
);
1011 pos32
+= sizeof(*type32
) + ((type
->TypeName
.MaximumLength
+ align32
) & ~align32
);
1012 if (pos32
<= len
) put_object_type_info( type32
, type
);
1014 if (pos32
> len
) status
= STATUS_INFO_LENGTH_MISMATCH
;
1015 if (retlen
) *retlen
= pos32
;
1021 FIXME( "unsupported class %u\n", class );
1022 return STATUS_NOT_IMPLEMENTED
;
1027 /**********************************************************************
1028 * wow64_NtQueryPerformanceCounter
1030 NTSTATUS WINAPI
wow64_NtQueryPerformanceCounter( UINT
*args
)
1032 LARGE_INTEGER
*counter
= get_ptr( &args
);
1033 LARGE_INTEGER
*frequency
= get_ptr( &args
);
1035 return NtQueryPerformanceCounter( counter
, frequency
);
1039 /**********************************************************************
1040 * wow64_NtQuerySection
1042 NTSTATUS WINAPI
wow64_NtQuerySection( UINT
*args
)
1044 HANDLE handle
= get_handle( &args
);
1045 SECTION_INFORMATION_CLASS
class = get_ulong( &args
);
1046 void *ptr
= get_ptr( &args
);
1047 SIZE_T size
= get_ulong( &args
);
1048 ULONG
*ret_ptr
= get_ptr( &args
);
1051 SIZE_T ret_size
= 0;
1055 case SectionBasicInformation
:
1057 SECTION_BASIC_INFORMATION info
;
1058 SECTION_BASIC_INFORMATION32
*info32
= ptr
;
1060 if (size
< sizeof(*info32
)) return STATUS_INFO_LENGTH_MISMATCH
;
1061 if (!(status
= NtQuerySection( handle
, class, &info
, sizeof(info
), &ret_size
)))
1063 info32
->BaseAddress
= PtrToUlong( info
.BaseAddress
);
1064 info32
->Attributes
= info
.Attributes
;
1065 info32
->Size
= info
.Size
;
1066 ret_size
= sizeof(*info32
);
1070 case SectionImageInformation
:
1072 SECTION_IMAGE_INFORMATION info
;
1073 SECTION_IMAGE_INFORMATION32
*info32
= ptr
;
1075 if (size
< sizeof(*info32
)) return STATUS_INFO_LENGTH_MISMATCH
;
1076 if (!(status
= NtQuerySection( handle
, class, &info
, sizeof(info
), &ret_size
)))
1078 put_section_image_info( info32
, &info
);
1079 ret_size
= sizeof(*info32
);
1084 FIXME( "class %u not implemented\n", class );
1085 return STATUS_NOT_IMPLEMENTED
;
1087 put_size( ret_ptr
, ret_size
);
1092 /**********************************************************************
1093 * wow64_NtQuerySemaphore
1095 NTSTATUS WINAPI
wow64_NtQuerySemaphore( UINT
*args
)
1097 HANDLE handle
= get_handle( &args
);
1098 SEMAPHORE_INFORMATION_CLASS
class = get_ulong( &args
);
1099 void *info
= get_ptr( &args
);
1100 ULONG len
= get_ulong( &args
);
1101 ULONG
*retlen
= get_ptr( &args
);
1103 return NtQuerySemaphore( handle
, class, info
, len
, retlen
);
1107 /**********************************************************************
1108 * wow64_NtQuerySymbolicLinkObject
1110 NTSTATUS WINAPI
wow64_NtQuerySymbolicLinkObject( UINT
*args
)
1112 HANDLE handle
= get_handle( &args
);
1113 UNICODE_STRING32
*target32
= get_ptr( &args
);
1114 ULONG
*retlen
= get_ptr( &args
);
1116 UNICODE_STRING target
;
1119 status
= NtQuerySymbolicLinkObject( handle
, unicode_str_32to64( &target
, target32
), retlen
);
1120 if (!status
) target32
->Length
= target
.Length
;
1125 /**********************************************************************
1126 * wow64_NtQueryTimer
1128 NTSTATUS WINAPI
wow64_NtQueryTimer( UINT
*args
)
1130 HANDLE handle
= get_handle( &args
);
1131 TIMER_INFORMATION_CLASS
class = get_ulong( &args
);
1132 void *info
= get_ptr( &args
);
1133 ULONG len
= get_ulong( &args
);
1134 ULONG
*retlen
= get_ptr( &args
);
1136 return NtQueryTimer( handle
, class, info
, len
, retlen
);
1140 /**********************************************************************
1141 * wow64_NtQueryTimerResolution
1143 NTSTATUS WINAPI
wow64_NtQueryTimerResolution( UINT
*args
)
1145 ULONG
*min_res
= get_ptr( &args
);
1146 ULONG
*max_res
= get_ptr( &args
);
1147 ULONG
*current_res
= get_ptr( &args
);
1149 return NtQueryTimerResolution( min_res
, max_res
, current_res
);
1153 /**********************************************************************
1154 * wow64_NtRegisterThreadTerminatePort
1156 NTSTATUS WINAPI
wow64_NtRegisterThreadTerminatePort( UINT
*args
)
1158 HANDLE handle
= get_handle( &args
);
1160 return NtRegisterThreadTerminatePort( handle
);
1164 /**********************************************************************
1165 * wow64_NtReleaseKeyedEvent
1167 NTSTATUS WINAPI
wow64_NtReleaseKeyedEvent( UINT
*args
)
1169 HANDLE handle
= get_handle( &args
);
1170 void *key
= get_ptr( &args
);
1171 BOOLEAN alertable
= get_ulong( &args
);
1172 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1174 return NtReleaseKeyedEvent( handle
, key
, alertable
, timeout
);
1178 /**********************************************************************
1179 * wow64_NtReleaseMutant
1181 NTSTATUS WINAPI
wow64_NtReleaseMutant( UINT
*args
)
1183 HANDLE handle
= get_handle( &args
);
1184 LONG
*prev_count
= get_ptr( &args
);
1186 return NtReleaseMutant( handle
, prev_count
);
1190 /**********************************************************************
1191 * wow64_NtReleaseSemaphore
1193 NTSTATUS WINAPI
wow64_NtReleaseSemaphore( UINT
*args
)
1195 HANDLE handle
= get_handle( &args
);
1196 ULONG count
= get_ulong( &args
);
1197 ULONG
*previous
= get_ptr( &args
);
1199 return NtReleaseSemaphore( handle
, count
, previous
);
1203 /**********************************************************************
1204 * wow64_NtReplyWaitReceivePort
1206 NTSTATUS WINAPI
wow64_NtReplyWaitReceivePort( UINT
*args
)
1208 HANDLE handle
= get_handle( &args
);
1209 ULONG
*id
= get_ptr( &args
);
1210 LPC_MESSAGE
*reply
= get_ptr( &args
);
1211 LPC_MESSAGE
*msg
= get_ptr( &args
);
1213 FIXME( "%p %p %p %p: stub\n", handle
, id
, reply
, msg
);
1214 return STATUS_NOT_IMPLEMENTED
;
1218 /**********************************************************************
1219 * wow64_NtRequestWaitReplyPort
1221 NTSTATUS WINAPI
wow64_NtRequestWaitReplyPort( UINT
*args
)
1223 HANDLE handle
= get_handle( &args
);
1224 LPC_MESSAGE
*msg_in
= get_ptr( &args
);
1225 LPC_MESSAGE
*msg_out
= get_ptr( &args
);
1227 FIXME( "%p %p %p: stub\n", handle
, msg_in
, msg_out
);
1228 return STATUS_NOT_IMPLEMENTED
;
1232 /**********************************************************************
1233 * wow64_NtResetEvent
1235 NTSTATUS WINAPI
wow64_NtResetEvent( UINT
*args
)
1237 HANDLE handle
= get_handle( &args
);
1238 LONG
*prev_state
= get_ptr( &args
);
1240 return NtResetEvent( handle
, prev_state
);
1244 /**********************************************************************
1245 * wow64_NtSecureConnectPort
1247 NTSTATUS WINAPI
wow64_NtSecureConnectPort( UINT
*args
)
1249 ULONG
*handle_ptr
= get_ptr( &args
);
1250 UNICODE_STRING32
*name32
= get_ptr( &args
);
1251 SECURITY_QUALITY_OF_SERVICE
*qos
= get_ptr( &args
);
1252 LPC_SECTION_WRITE
*write
= get_ptr( &args
);
1253 SID
*sid
= get_ptr( &args
);
1254 LPC_SECTION_READ
*read
= get_ptr( &args
);
1255 ULONG
*max_len
= get_ptr( &args
);
1256 void *info
= get_ptr( &args
);
1257 ULONG
*info_len
= get_ptr( &args
);
1259 FIXME( "%p %p %p %p %p %p %p %p %p: stub\n",
1260 handle_ptr
, name32
, qos
, write
, sid
, read
, max_len
, info
, info_len
);
1261 return STATUS_NOT_IMPLEMENTED
;
1265 /**********************************************************************
1268 NTSTATUS WINAPI
wow64_NtSetEvent( UINT
*args
)
1270 HANDLE handle
= get_handle( &args
);
1271 LONG
*prev_state
= get_ptr( &args
);
1273 return NtSetEvent( handle
, prev_state
);
1277 /**********************************************************************
1278 * wow64_NtSetInformationDebugObject
1280 NTSTATUS WINAPI
wow64_NtSetInformationDebugObject( UINT
*args
)
1282 HANDLE handle
= get_handle( &args
);
1283 DEBUGOBJECTINFOCLASS
class = get_ulong( &args
);
1284 void *ptr
= get_ptr( &args
);
1285 ULONG len
= get_ulong( &args
);
1286 ULONG
*retlen
= get_ptr( &args
);
1288 return NtSetInformationDebugObject( handle
, class, ptr
, len
, retlen
);
1292 /**********************************************************************
1293 * wow64_NtSetInformationJobObject
1295 NTSTATUS WINAPI
wow64_NtSetInformationJobObject( UINT
*args
)
1297 HANDLE handle
= get_handle( &args
);
1298 JOBOBJECTINFOCLASS
class = get_ulong( &args
);
1299 void *ptr
= get_ptr( &args
);
1300 ULONG len
= get_ulong( &args
);
1304 case JobObjectBasicLimitInformation
: /* JOBOBJECT_BASIC_LIMIT_INFORMATION */
1305 if (len
== sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION32
))
1307 JOBOBJECT_BASIC_LIMIT_INFORMATION info
;
1309 return NtSetInformationJobObject( handle
, class, job_basic_limit_info_32to64( &info
, ptr
),
1312 else return STATUS_INVALID_PARAMETER
;
1314 case JobObjectBasicUIRestrictions
:
1315 FIXME( "unsupported class JobObjectBasicUIRestrictions\n" );
1316 return STATUS_SUCCESS
;
1318 case JobObjectAssociateCompletionPortInformation
: /* JOBOBJECT_ASSOCIATE_COMPLETION_PORT */
1319 if (len
== sizeof(JOBOBJECT_ASSOCIATE_COMPLETION_PORT32
))
1321 JOBOBJECT_ASSOCIATE_COMPLETION_PORT32
*info32
= ptr
;
1322 JOBOBJECT_ASSOCIATE_COMPLETION_PORT info
;
1324 info
.CompletionKey
= ULongToPtr( info32
->CompletionKey
);
1325 info
.CompletionPort
= LongToHandle( info32
->CompletionPort
);
1326 return NtSetInformationJobObject( handle
, class, &info
, sizeof(info
) );
1328 else return STATUS_INVALID_PARAMETER
;
1330 case JobObjectExtendedLimitInformation
: /* JOBOBJECT_EXTENDED_LIMIT_INFORMATION */
1331 if (len
== sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
))
1333 JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
*info32
= ptr
;
1334 JOBOBJECT_EXTENDED_LIMIT_INFORMATION info
;
1336 info
.IoInfo
= info32
->IoInfo
;
1337 info
.ProcessMemoryLimit
= info32
->ProcessMemoryLimit
;
1338 info
.JobMemoryLimit
= info32
->JobMemoryLimit
;
1339 info
.PeakProcessMemoryUsed
= info32
->PeakProcessMemoryUsed
;
1340 info
.PeakJobMemoryUsed
= info32
->PeakJobMemoryUsed
;
1341 return NtSetInformationJobObject( handle
, class,
1342 job_basic_limit_info_32to64( &info
.BasicLimitInformation
,
1343 &info32
->BasicLimitInformation
),
1346 else return STATUS_INVALID_PARAMETER
;
1349 if (class >= MaxJobObjectInfoClass
) return STATUS_INVALID_PARAMETER
;
1350 FIXME( "unsupported class %u\n", class );
1351 return STATUS_NOT_IMPLEMENTED
;
1356 /**********************************************************************
1357 * wow64_NtSetInformationObject
1359 NTSTATUS WINAPI
wow64_NtSetInformationObject( UINT
*args
)
1361 HANDLE handle
= get_handle( &args
);
1362 OBJECT_INFORMATION_CLASS
class = get_ulong( &args
);
1363 void *ptr
= get_ptr( &args
);
1364 ULONG len
= get_ulong( &args
);
1368 case ObjectDataInformation
: /* OBJECT_DATA_INFORMATION */
1369 return NtSetInformationObject( handle
, class, ptr
, len
);
1372 FIXME( "unsupported class %u\n", class );
1373 return STATUS_NOT_IMPLEMENTED
;
1378 /**********************************************************************
1379 * wow64_NtSetIoCompletion
1381 NTSTATUS WINAPI
wow64_NtSetIoCompletion( UINT
*args
)
1383 HANDLE handle
= get_handle( &args
);
1384 ULONG_PTR key
= get_ulong( &args
);
1385 ULONG_PTR value
= get_ulong( &args
);
1386 NTSTATUS status
= get_ulong( &args
);
1387 SIZE_T count
= get_ulong( &args
);
1389 return NtSetIoCompletion( handle
, key
, value
, status
, count
);
1393 /**********************************************************************
1396 NTSTATUS WINAPI
wow64_NtSetTimer( UINT
*args
)
1398 HANDLE handle
= get_handle( &args
);
1399 LARGE_INTEGER
*when
= get_ptr( &args
);
1400 ULONG apc
= get_ulong( &args
);
1401 ULONG apc_param
= get_ulong( &args
);
1402 BOOLEAN resume
= get_ulong( &args
);
1403 ULONG period
= get_ulong( &args
);
1404 BOOLEAN
*state
= get_ptr( &args
);
1406 return NtSetTimer( handle
, when
, apc_32to64( apc
), apc_param_32to64( apc
, apc_param
),
1407 resume
, period
, state
);
1411 /**********************************************************************
1412 * wow64_NtSetTimerResolution
1414 NTSTATUS WINAPI
wow64_NtSetTimerResolution( UINT
*args
)
1416 ULONG res
= get_ulong( &args
);
1417 BOOLEAN set
= get_ulong( &args
);
1418 ULONG
*current_res
= get_ptr( &args
);
1420 return NtSetTimerResolution( res
, set
, current_res
);
1424 /**********************************************************************
1425 * wow64_NtSignalAndWaitForSingleObject
1427 NTSTATUS WINAPI
wow64_NtSignalAndWaitForSingleObject( UINT
*args
)
1429 HANDLE signal
= get_handle( &args
);
1430 HANDLE wait
= get_handle( &args
);
1431 BOOLEAN alertable
= get_ulong( &args
);
1432 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1434 return NtSignalAndWaitForSingleObject( signal
, wait
, alertable
, timeout
);
1438 /**********************************************************************
1439 * wow64_NtTerminateJobObject
1441 NTSTATUS WINAPI
wow64_NtTerminateJobObject( UINT
*args
)
1443 HANDLE handle
= get_handle( &args
);
1444 NTSTATUS status
= get_ulong( &args
);
1446 return NtTerminateJobObject( handle
, status
);
1450 /**********************************************************************
1453 NTSTATUS WINAPI
wow64_NtTestAlert( UINT
*args
)
1455 return NtTestAlert();
1459 /**********************************************************************
1460 * wow64_NtTraceControl
1462 NTSTATUS WINAPI
wow64_NtTraceControl( UINT
*args
)
1464 ULONG code
= get_ulong( &args
);
1465 void *inbuf
= get_ptr( &args
);
1466 ULONG inbuf_len
= get_ulong( &args
);
1467 void *outbuf
= get_ptr( &args
);
1468 ULONG outbuf_len
= get_ulong( &args
);
1469 ULONG
*size
= get_ptr( &args
);
1471 return NtTraceControl( code
, inbuf
, inbuf_len
, outbuf
, outbuf_len
, size
);
1475 /**********************************************************************
1476 * wow64_NtWaitForAlertByThreadId
1478 NTSTATUS WINAPI
wow64_NtWaitForAlertByThreadId( UINT
*args
)
1480 const void *address
= get_ptr( &args
);
1481 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1483 return NtWaitForAlertByThreadId( address
, timeout
);
1487 /**********************************************************************
1488 * wow64_NtWaitForDebugEvent
1490 NTSTATUS WINAPI
wow64_NtWaitForDebugEvent( UINT
*args
)
1492 HANDLE handle
= get_handle( &args
);
1493 BOOLEAN alertable
= get_ulong( &args
);
1494 LARGE_INTEGER
*timeout
= get_ptr( &args
);
1495 DBGUI_WAIT_STATE_CHANGE32
*state32
= get_ptr( &args
);
1498 DBGUI_WAIT_STATE_CHANGE state
;
1499 NTSTATUS status
= NtWaitForDebugEvent( handle
, alertable
, timeout
, &state
);
1503 state32
->NewState
= state
.NewState
;
1504 state32
->AppClientId
.UniqueProcess
= HandleToULong( state
.AppClientId
.UniqueProcess
);
1505 state32
->AppClientId
.UniqueThread
= HandleToULong( state
.AppClientId
.UniqueThread
);
1506 switch (state
.NewState
)
1508 #define COPY_ULONG(field) state32->StateInfo.field = state.StateInfo.field
1509 #define COPY_PTR(field) state32->StateInfo.field = PtrToUlong( state.StateInfo.field )
1510 case DbgCreateThreadStateChange
:
1511 COPY_PTR( CreateThread
.HandleToThread
);
1512 COPY_PTR( CreateThread
.NewThread
.StartAddress
);
1513 COPY_ULONG( CreateThread
.NewThread
.SubSystemKey
);
1515 case DbgCreateProcessStateChange
:
1516 COPY_PTR( CreateProcessInfo
.HandleToProcess
);
1517 COPY_PTR( CreateProcessInfo
.HandleToThread
);
1518 COPY_PTR( CreateProcessInfo
.NewProcess
.FileHandle
);
1519 COPY_PTR( CreateProcessInfo
.NewProcess
.BaseOfImage
);
1520 COPY_PTR( CreateProcessInfo
.NewProcess
.InitialThread
.StartAddress
);
1521 COPY_ULONG( CreateProcessInfo
.NewProcess
.InitialThread
.SubSystemKey
);
1522 COPY_ULONG( CreateProcessInfo
.NewProcess
.DebugInfoFileOffset
);
1523 COPY_ULONG( CreateProcessInfo
.NewProcess
.DebugInfoSize
);
1525 case DbgExitThreadStateChange
:
1526 case DbgExitProcessStateChange
:
1527 COPY_ULONG( ExitThread
.ExitStatus
);
1529 case DbgExceptionStateChange
:
1530 case DbgBreakpointStateChange
:
1531 case DbgSingleStepStateChange
:
1532 COPY_ULONG( Exception
.FirstChance
);
1533 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionCode
);
1534 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionFlags
);
1535 COPY_ULONG( Exception
.ExceptionRecord
.NumberParameters
);
1536 COPY_PTR( Exception
.ExceptionRecord
.ExceptionRecord
);
1537 COPY_PTR( Exception
.ExceptionRecord
.ExceptionAddress
);
1538 for (i
= 0; i
< state
.StateInfo
.Exception
.ExceptionRecord
.NumberParameters
; i
++)
1539 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionInformation
[i
] );
1541 case DbgLoadDllStateChange
:
1542 COPY_PTR( LoadDll
.FileHandle
);
1543 COPY_PTR( LoadDll
.BaseOfDll
);
1544 COPY_ULONG( LoadDll
.DebugInfoFileOffset
);
1545 COPY_ULONG( LoadDll
.DebugInfoSize
);
1546 COPY_PTR( LoadDll
.NamePointer
);
1548 case DbgUnloadDllStateChange
:
1549 COPY_PTR( UnloadDll
.BaseAddress
);
1561 /**********************************************************************
1562 * wow64_NtWaitForKeyedEvent
1564 NTSTATUS WINAPI
wow64_NtWaitForKeyedEvent( UINT
*args
)
1566 HANDLE handle
= get_handle( &args
);
1567 const void *key
= get_ptr( &args
);
1568 BOOLEAN alertable
= get_ulong( &args
);
1569 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1571 return NtWaitForKeyedEvent( handle
, key
, alertable
, timeout
);
1575 /**********************************************************************
1576 * wow64_NtWaitForMultipleObjects
1578 NTSTATUS WINAPI
wow64_NtWaitForMultipleObjects( UINT
*args
)
1580 DWORD count
= get_ulong( &args
);
1581 LONG
*handles_ptr
= get_ptr( &args
);
1582 BOOLEAN wait_any
= get_ulong( &args
);
1583 BOOLEAN alertable
= get_ulong( &args
);
1584 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1586 HANDLE handles
[MAXIMUM_WAIT_OBJECTS
];
1589 for (i
= 0; i
< count
&& i
< MAXIMUM_WAIT_OBJECTS
; i
++) handles
[i
] = LongToHandle( handles_ptr
[i
] );
1590 return NtWaitForMultipleObjects( count
, handles
, wait_any
, alertable
, timeout
);
1594 /**********************************************************************
1595 * wow64_NtWaitForSingleObject
1597 NTSTATUS WINAPI
wow64_NtWaitForSingleObject( UINT
*args
)
1599 HANDLE handle
= get_handle( &args
);
1600 BOOLEAN alertable
= get_ulong( &args
);
1601 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1603 return NtWaitForSingleObject( handle
, alertable
, timeout
);
1607 /**********************************************************************
1608 * wow64_NtYieldExecution
1610 NTSTATUS WINAPI
wow64_NtYieldExecution( UINT
*args
)
1612 return NtYieldExecution();