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 %u %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_NtClearPowerRequest
175 NTSTATUS WINAPI
wow64_NtClearPowerRequest( UINT
*args
)
177 HANDLE handle
= get_handle( &args
);
178 POWER_REQUEST_TYPE type
= get_ulong( &args
);
180 return NtClearPowerRequest( handle
, type
);
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_NtCreatePowerRequest
386 NTSTATUS WINAPI
wow64_NtCreatePowerRequest( UINT
*args
)
388 ULONG
*handle_ptr
= get_ptr( &args
);
389 COUNTED_REASON_CONTEXT
*context
= get_ptr( &args
);
391 FIXME( "%p %p: stub\n", handle_ptr
, context
);
392 return STATUS_NOT_IMPLEMENTED
;
396 /**********************************************************************
397 * wow64_NtCreateSection
399 NTSTATUS WINAPI
wow64_NtCreateSection( UINT
*args
)
401 ULONG
*handle_ptr
= get_ptr( &args
);
402 ACCESS_MASK access
= get_ulong( &args
);
403 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
404 const LARGE_INTEGER
*size
= get_ptr( &args
);
405 ULONG protect
= get_ulong( &args
);
406 ULONG flags
= get_ulong( &args
);
407 HANDLE file
= get_handle( &args
);
409 struct object_attr64 attr
;
414 status
= NtCreateSection( &handle
, access
, objattr_32to64( &attr
, attr32
), size
, protect
, flags
, file
);
415 put_handle( handle_ptr
, handle
);
420 /**********************************************************************
421 * wow64_NtCreateSemaphore
423 NTSTATUS WINAPI
wow64_NtCreateSemaphore( UINT
*args
)
425 ULONG
*handle_ptr
= get_ptr( &args
);
426 ACCESS_MASK access
= get_ulong( &args
);
427 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
428 LONG initial
= get_ulong( &args
);
429 LONG max
= get_ulong( &args
);
431 struct object_attr64 attr
;
436 status
= NtCreateSemaphore( &handle
, access
, objattr_32to64( &attr
, attr32
), initial
, max
);
437 put_handle( handle_ptr
, handle
);
442 /**********************************************************************
443 * wow64_NtCreateSymbolicLinkObject
445 NTSTATUS WINAPI
wow64_NtCreateSymbolicLinkObject( UINT
*args
)
447 ULONG
*handle_ptr
= get_ptr( &args
);
448 ACCESS_MASK access
= get_ulong( &args
);
449 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
450 UNICODE_STRING32
*target32
= get_ptr( &args
);
452 struct object_attr64 attr
;
453 UNICODE_STRING target
;
458 status
= NtCreateSymbolicLinkObject( &handle
, access
, objattr_32to64( &attr
, attr32
),
459 unicode_str_32to64( &target
, target32
));
460 put_handle( handle_ptr
, handle
);
465 /**********************************************************************
466 * wow64_NtCreateTimer
468 NTSTATUS WINAPI
wow64_NtCreateTimer( UINT
*args
)
470 ULONG
*handle_ptr
= get_ptr( &args
);
471 ACCESS_MASK access
= get_ulong( &args
);
472 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
473 TIMER_TYPE type
= get_ulong( &args
);
475 struct object_attr64 attr
;
480 status
= NtCreateTimer( &handle
, access
, objattr_32to64( &attr
, attr32
), type
);
481 put_handle( handle_ptr
, handle
);
486 /**********************************************************************
487 * wow64_NtDebugContinue
489 NTSTATUS WINAPI
wow64_NtDebugContinue( UINT
*args
)
491 HANDLE handle
= get_handle( &args
);
492 CLIENT_ID32
*id32
= get_ptr( &args
);
493 NTSTATUS status
= get_ulong( &args
);
497 return NtDebugContinue( handle
, client_id_32to64( &id
, id32
), status
);
501 /**********************************************************************
502 * wow64_NtDelayExecution
504 NTSTATUS WINAPI
wow64_NtDelayExecution( UINT
*args
)
506 BOOLEAN alertable
= get_ulong( &args
);
507 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
509 return NtDelayExecution( alertable
, timeout
);
513 /**********************************************************************
514 * wow64_NtDuplicateObject
516 NTSTATUS WINAPI
wow64_NtDuplicateObject( UINT
*args
)
518 HANDLE source_process
= get_handle( &args
);
519 HANDLE source_handle
= get_handle( &args
);
520 HANDLE dest_process
= get_handle( &args
);
521 ULONG
*handle_ptr
= get_ptr( &args
);
522 ACCESS_MASK access
= get_ulong( &args
);
523 ULONG attributes
= get_ulong( &args
);
524 ULONG options
= get_ulong( &args
);
529 if (handle_ptr
) *handle_ptr
= 0;
530 status
= NtDuplicateObject( source_process
, source_handle
, dest_process
, &handle
,
531 access
, attributes
, options
);
532 if (handle_ptr
) put_handle( handle_ptr
, handle
);
537 /**********************************************************************
540 NTSTATUS WINAPI
wow64_NtListenPort( UINT
*args
)
542 HANDLE handle
= get_handle( &args
);
543 LPC_MESSAGE
*msg
= get_ptr( &args
);
545 FIXME( "%p %p: stub\n", handle
, msg
);
546 return STATUS_NOT_IMPLEMENTED
;
550 /**********************************************************************
551 * wow64_NtMakeTemporaryObject
553 NTSTATUS WINAPI
wow64_NtMakeTemporaryObject( UINT
*args
)
555 HANDLE handle
= get_handle( &args
);
557 return NtMakeTemporaryObject( handle
);
561 /**********************************************************************
562 * wow64_NtOpenDirectoryObject
564 NTSTATUS WINAPI
wow64_NtOpenDirectoryObject( UINT
*args
)
566 ULONG
*handle_ptr
= get_ptr( &args
);
567 ACCESS_MASK access
= get_ulong( &args
);
568 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
570 struct object_attr64 attr
;
575 status
= NtOpenDirectoryObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
576 put_handle( handle_ptr
, handle
);
581 /**********************************************************************
584 NTSTATUS WINAPI
wow64_NtOpenEvent( UINT
*args
)
586 ULONG
*handle_ptr
= get_ptr( &args
);
587 ACCESS_MASK access
= get_ulong( &args
);
588 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
590 struct object_attr64 attr
;
595 status
= NtOpenEvent( &handle
, access
, objattr_32to64( &attr
, attr32
));
596 put_handle( handle_ptr
, handle
);
601 /**********************************************************************
602 * wow64_NtOpenIoCompletion
604 NTSTATUS WINAPI
wow64_NtOpenIoCompletion( UINT
*args
)
606 ULONG
*handle_ptr
= get_ptr( &args
);
607 ACCESS_MASK access
= get_ulong( &args
);
608 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
610 struct object_attr64 attr
;
615 status
= NtOpenIoCompletion( &handle
, access
, objattr_32to64( &attr
, attr32
));
616 put_handle( handle_ptr
, handle
);
621 /**********************************************************************
622 * wow64_NtOpenJobObject
624 NTSTATUS WINAPI
wow64_NtOpenJobObject( UINT
*args
)
626 ULONG
*handle_ptr
= get_ptr( &args
);
627 ACCESS_MASK access
= get_ulong( &args
);
628 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
630 struct object_attr64 attr
;
635 status
= NtOpenJobObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
636 put_handle( handle_ptr
, handle
);
641 /**********************************************************************
642 * wow64_NtOpenKeyedEvent
644 NTSTATUS WINAPI
wow64_NtOpenKeyedEvent( UINT
*args
)
646 ULONG
*handle_ptr
= get_ptr( &args
);
647 ACCESS_MASK access
= get_ulong( &args
);
648 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
650 struct object_attr64 attr
;
655 status
= NtOpenKeyedEvent( &handle
, access
, objattr_32to64( &attr
, attr32
));
656 put_handle( handle_ptr
, handle
);
661 /**********************************************************************
664 NTSTATUS WINAPI
wow64_NtOpenMutant( UINT
*args
)
666 ULONG
*handle_ptr
= get_ptr( &args
);
667 ACCESS_MASK access
= get_ulong( &args
);
668 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
670 struct object_attr64 attr
;
675 status
= NtOpenMutant( &handle
, access
, objattr_32to64( &attr
, attr32
));
676 put_handle( handle_ptr
, handle
);
681 /**********************************************************************
682 * wow64_NtOpenSection
684 NTSTATUS WINAPI
wow64_NtOpenSection( UINT
*args
)
686 ULONG
*handle_ptr
= get_ptr( &args
);
687 ACCESS_MASK access
= get_ulong( &args
);
688 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
690 struct object_attr64 attr
;
695 status
= NtOpenSection( &handle
, access
, objattr_32to64( &attr
, attr32
));
696 put_handle( handle_ptr
, handle
);
701 /**********************************************************************
702 * wow64_NtOpenSemaphore
704 NTSTATUS WINAPI
wow64_NtOpenSemaphore( UINT
*args
)
706 ULONG
*handle_ptr
= get_ptr( &args
);
707 ACCESS_MASK access
= get_ulong( &args
);
708 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
710 struct object_attr64 attr
;
715 status
= NtOpenSemaphore( &handle
, access
, objattr_32to64( &attr
, attr32
));
716 put_handle( handle_ptr
, handle
);
721 /**********************************************************************
722 * wow64_NtOpenSymbolicLinkObject
724 NTSTATUS WINAPI
wow64_NtOpenSymbolicLinkObject( UINT
*args
)
726 ULONG
*handle_ptr
= get_ptr( &args
);
727 ACCESS_MASK access
= get_ulong( &args
);
728 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
730 struct object_attr64 attr
;
735 status
= NtOpenSymbolicLinkObject( &handle
, access
, objattr_32to64( &attr
, attr32
));
736 put_handle( handle_ptr
, handle
);
741 /**********************************************************************
744 NTSTATUS WINAPI
wow64_NtOpenTimer( UINT
*args
)
746 ULONG
*handle_ptr
= get_ptr( &args
);
747 ACCESS_MASK access
= get_ulong( &args
);
748 OBJECT_ATTRIBUTES32
*attr32
= get_ptr( &args
);
750 struct object_attr64 attr
;
755 status
= NtOpenTimer( &handle
, access
, objattr_32to64( &attr
, attr32
));
756 put_handle( handle_ptr
, handle
);
761 /**********************************************************************
764 NTSTATUS WINAPI
wow64_NtPulseEvent( UINT
*args
)
766 HANDLE handle
= get_handle( &args
);
767 LONG
*prev_state
= get_ptr( &args
);
769 return NtPulseEvent( handle
, prev_state
);
773 /**********************************************************************
774 * wow64_NtQueryDirectoryObject
776 NTSTATUS WINAPI
wow64_NtQueryDirectoryObject( UINT
*args
)
778 HANDLE handle
= get_handle( &args
);
779 DIRECTORY_BASIC_INFORMATION32
*info32
= get_ptr( &args
);
780 ULONG size32
= get_ulong( &args
);
781 BOOLEAN single_entry
= get_ulong( &args
);
782 BOOLEAN restart
= get_ulong( &args
);
783 ULONG
*context
= get_ptr( &args
);
784 ULONG
*retlen
= get_ptr( &args
);
787 DIRECTORY_BASIC_INFORMATION
*info
;
788 ULONG size
= size32
+ sizeof(*info
) - sizeof(*info32
);
790 if (!single_entry
) FIXME( "not implemented\n" );
791 info
= Wow64AllocateTemp( size
);
792 status
= NtQueryDirectoryObject( handle
, info
, size
, single_entry
, restart
, context
, NULL
);
795 info32
->ObjectName
.Buffer
= PtrToUlong( info32
+ 1 );
796 info32
->ObjectName
.Length
= info
->ObjectName
.Length
;
797 info32
->ObjectName
.MaximumLength
= info
->ObjectName
.MaximumLength
;
798 info32
->ObjectTypeName
.Buffer
= info32
->ObjectName
.Buffer
+ info
->ObjectName
.MaximumLength
;
799 info32
->ObjectTypeName
.Length
= info
->ObjectTypeName
.Length
;
800 info32
->ObjectTypeName
.MaximumLength
= info
->ObjectTypeName
.MaximumLength
;
801 size
= info
->ObjectName
.MaximumLength
+ info
->ObjectTypeName
.MaximumLength
;
802 memcpy( info32
+ 1, info
+ 1, size
);
803 if (retlen
) *retlen
= sizeof(*info32
) + size
;
809 /**********************************************************************
812 NTSTATUS WINAPI
wow64_NtQueryEvent( UINT
*args
)
814 HANDLE handle
= get_handle( &args
);
815 EVENT_INFORMATION_CLASS
class = get_ulong( &args
);
816 void *info
= get_ptr( &args
);
817 ULONG len
= get_ulong( &args
);
818 ULONG
*retlen
= get_ptr( &args
);
820 return NtQueryEvent( handle
, class, info
, len
, retlen
);
824 /**********************************************************************
825 * wow64_NtQueryInformationJobObject
827 NTSTATUS WINAPI
wow64_NtQueryInformationJobObject( UINT
*args
)
829 HANDLE handle
= get_handle( &args
);
830 JOBOBJECTINFOCLASS
class = get_ulong( &args
);
831 void *ptr
= get_ptr( &args
);
832 ULONG len
= get_ulong( &args
);
833 ULONG
*retlen
= get_ptr( &args
);
839 case JobObjectBasicAccountingInformation
: /* JOBOBJECT_BASIC_ACCOUNTING_INFORMATION */
840 return NtQueryInformationJobObject( handle
, class, ptr
, len
, retlen
);
842 case JobObjectBasicLimitInformation
: /* JOBOBJECT_BASIC_LIMIT_INFORMATION */
843 if (len
>= sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION32
))
845 JOBOBJECT_BASIC_LIMIT_INFORMATION32
*info32
= ptr
;
846 JOBOBJECT_BASIC_LIMIT_INFORMATION info
;
848 status
= NtQueryInformationJobObject( handle
, class, &info
, sizeof(info
), NULL
);
849 if (!status
) put_job_basic_limit_info( info32
, &info
);
850 if (retlen
) *retlen
= sizeof(*info32
);
853 else return STATUS_INFO_LENGTH_MISMATCH
;
855 case JobObjectBasicProcessIdList
: /* JOBOBJECT_BASIC_PROCESS_ID_LIST */
856 if (len
>= sizeof(JOBOBJECT_BASIC_PROCESS_ID_LIST32
))
858 JOBOBJECT_BASIC_PROCESS_ID_LIST32
*info32
= ptr
;
859 JOBOBJECT_BASIC_PROCESS_ID_LIST
*info
;
860 ULONG i
, count
, size
;
862 count
= (len
- offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST32
, ProcessIdList
)) / sizeof(info32
->ProcessIdList
[0]);
863 size
= offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST
, ProcessIdList
[count
] );
864 info
= Wow64AllocateTemp( size
);
865 status
= NtQueryInformationJobObject( handle
, class, info
, size
, NULL
);
868 info32
->NumberOfAssignedProcesses
= info
->NumberOfAssignedProcesses
;
869 info32
->NumberOfProcessIdsInList
= info
->NumberOfProcessIdsInList
;
870 for (i
= 0; i
< info
->NumberOfProcessIdsInList
; i
++)
871 info32
->ProcessIdList
[i
] = info
->ProcessIdList
[i
];
872 if (retlen
) *retlen
= offsetof( JOBOBJECT_BASIC_PROCESS_ID_LIST32
, ProcessIdList
[i
] );
876 else return STATUS_INFO_LENGTH_MISMATCH
;
878 case JobObjectExtendedLimitInformation
: /* JOBOBJECT_EXTENDED_LIMIT_INFORMATION */
879 if (len
>= sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
))
881 JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
*info32
= ptr
;
882 JOBOBJECT_EXTENDED_LIMIT_INFORMATION info
;
884 status
= NtQueryInformationJobObject( handle
, class, &info
, sizeof(info
), NULL
);
887 put_job_basic_limit_info( &info32
->BasicLimitInformation
, &info
.BasicLimitInformation
);
888 info32
->IoInfo
= info
.IoInfo
;
889 info32
->ProcessMemoryLimit
= info
.ProcessMemoryLimit
;
890 info32
->JobMemoryLimit
= info
.JobMemoryLimit
;
891 info32
->PeakProcessMemoryUsed
= info
.PeakProcessMemoryUsed
;
892 info32
->PeakJobMemoryUsed
= info
.PeakJobMemoryUsed
;
894 if (retlen
) *retlen
= sizeof(*info32
);
897 else return STATUS_INFO_LENGTH_MISMATCH
;
900 if (class >= MaxJobObjectInfoClass
) return STATUS_INVALID_PARAMETER
;
901 FIXME( "unsupported class %u\n", class );
902 return STATUS_NOT_IMPLEMENTED
;
907 /**********************************************************************
908 * wow64_NtQueryIoCompletion
910 NTSTATUS WINAPI
wow64_NtQueryIoCompletion( UINT
*args
)
912 HANDLE handle
= get_handle( &args
);
913 IO_COMPLETION_INFORMATION_CLASS
class = get_ulong( &args
);
914 void *info
= get_ptr( &args
);
915 ULONG len
= get_ulong( &args
);
916 ULONG
*retlen
= get_ptr( &args
);
918 return NtQueryIoCompletion( handle
, class, info
, len
, retlen
);
922 /**********************************************************************
923 * wow64_NtQueryMutant
925 NTSTATUS WINAPI
wow64_NtQueryMutant( UINT
*args
)
927 HANDLE handle
= get_handle( &args
);
928 MUTANT_INFORMATION_CLASS
class = get_ulong( &args
);
929 void *info
= get_ptr( &args
);
930 ULONG len
= get_ulong( &args
);
931 ULONG
*retlen
= get_ptr( &args
);
933 return NtQueryMutant( handle
, class, info
, len
, retlen
);
937 /**********************************************************************
938 * wow64_NtQueryObject
940 NTSTATUS WINAPI
wow64_NtQueryObject( UINT
*args
)
942 HANDLE handle
= get_handle( &args
);
943 OBJECT_INFORMATION_CLASS
class = get_ulong( &args
);
944 void *ptr
= get_ptr( &args
);
945 ULONG len
= get_ulong( &args
);
946 ULONG
*retlen
= get_ptr( &args
);
953 case ObjectBasicInformation
: /* OBJECT_BASIC_INFORMATION */
954 case ObjectDataInformation
: /* OBJECT_DATA_INFORMATION */
955 return NtQueryObject( handle
, class, ptr
, len
, retlen
);
957 case ObjectNameInformation
: /* OBJECT_NAME_INFORMATION */
959 ULONG size
= len
+ sizeof(OBJECT_NAME_INFORMATION
) - sizeof(OBJECT_NAME_INFORMATION32
);
960 OBJECT_NAME_INFORMATION32
*info32
= ptr
;
961 OBJECT_NAME_INFORMATION
*info
= Wow64AllocateTemp( size
);
963 if (!(status
= NtQueryObject( handle
, class, info
, size
, &ret_size
)))
965 if (len
>= sizeof(*info32
) + info
->Name
.MaximumLength
)
967 if (info
->Name
.Length
)
969 memcpy( info32
+ 1, info
->Name
.Buffer
, info
->Name
.Length
+ sizeof(WCHAR
) );
970 info32
->Name
.Length
= info
->Name
.Length
;
971 info32
->Name
.MaximumLength
= info
->Name
.Length
+ sizeof(WCHAR
);
972 info32
->Name
.Buffer
= PtrToUlong( info32
+ 1 );
974 else memset( &info32
->Name
, 0, sizeof(info32
->Name
) );
976 else status
= STATUS_INFO_LENGTH_MISMATCH
;
977 if (retlen
) *retlen
= sizeof(*info32
) + info
->Name
.MaximumLength
;
979 else if (status
== STATUS_INFO_LENGTH_MISMATCH
|| status
== STATUS_BUFFER_OVERFLOW
)
981 if (retlen
) *retlen
= ret_size
- sizeof(*info
) + sizeof(*info32
);
986 case ObjectTypeInformation
: /* OBJECT_TYPE_INFORMATION */
988 ULONG_PTR buffer
[(sizeof(OBJECT_TYPE_INFORMATION
) + 64) / sizeof(ULONG_PTR
)];
989 OBJECT_TYPE_INFORMATION
*info
= (OBJECT_TYPE_INFORMATION
*)buffer
;
990 OBJECT_TYPE_INFORMATION32
*info32
= ptr
;
992 if (!(status
= NtQueryObject( handle
, class, info
, sizeof(buffer
), NULL
)))
994 if (len
>= sizeof(*info32
) + info
->TypeName
.MaximumLength
)
995 put_object_type_info( info32
, info
);
997 status
= STATUS_INFO_LENGTH_MISMATCH
;
998 if (retlen
) *retlen
= sizeof(*info32
) + info
->TypeName
.Length
+ sizeof(WCHAR
);
1003 case ObjectTypesInformation
: /* OBJECT_TYPES_INFORMATION */
1005 OBJECT_TYPES_INFORMATION
*info
, *info32
= ptr
;
1006 /* assume at most 32 types, with an average 16-char name */
1007 ULONG ret_size
, size
= 32 * (sizeof(OBJECT_TYPE_INFORMATION
) + 16 * sizeof(WCHAR
));
1009 info
= Wow64AllocateTemp( size
);
1010 if (!(status
= NtQueryObject( handle
, class, info
, size
, &ret_size
)))
1012 OBJECT_TYPE_INFORMATION
*type
;
1013 OBJECT_TYPE_INFORMATION32
*type32
;
1014 ULONG align
= TYPE_ALIGNMENT( OBJECT_TYPE_INFORMATION
) - 1;
1015 ULONG align32
= TYPE_ALIGNMENT( OBJECT_TYPE_INFORMATION32
) - 1;
1016 ULONG i
, pos
= (sizeof(*info
) + align
) & ~align
, pos32
= (sizeof(*info32
) + align32
) & ~align32
;
1018 if (pos32
<= len
) info32
->NumberOfTypes
= info
->NumberOfTypes
;
1019 for (i
= 0; i
< info
->NumberOfTypes
; i
++)
1021 type
= (OBJECT_TYPE_INFORMATION
*)((char *)info
+ pos
);
1022 type32
= (OBJECT_TYPE_INFORMATION32
*)((char *)ptr
+ pos32
);
1023 pos
+= sizeof(*type
) + ((type
->TypeName
.MaximumLength
+ align
) & ~align
);
1024 pos32
+= sizeof(*type32
) + ((type
->TypeName
.MaximumLength
+ align32
) & ~align32
);
1025 if (pos32
<= len
) put_object_type_info( type32
, type
);
1027 if (pos32
> len
) status
= STATUS_INFO_LENGTH_MISMATCH
;
1028 if (retlen
) *retlen
= pos32
;
1034 FIXME( "unsupported class %u\n", class );
1035 return STATUS_NOT_IMPLEMENTED
;
1040 /**********************************************************************
1041 * wow64_NtQueryPerformanceCounter
1043 NTSTATUS WINAPI
wow64_NtQueryPerformanceCounter( UINT
*args
)
1045 LARGE_INTEGER
*counter
= get_ptr( &args
);
1046 LARGE_INTEGER
*frequency
= get_ptr( &args
);
1048 return NtQueryPerformanceCounter( counter
, frequency
);
1052 /**********************************************************************
1053 * wow64_NtQuerySection
1055 NTSTATUS WINAPI
wow64_NtQuerySection( UINT
*args
)
1057 HANDLE handle
= get_handle( &args
);
1058 SECTION_INFORMATION_CLASS
class = get_ulong( &args
);
1059 void *ptr
= get_ptr( &args
);
1060 SIZE_T size
= get_ulong( &args
);
1061 ULONG
*ret_ptr
= get_ptr( &args
);
1064 SIZE_T ret_size
= 0;
1068 case SectionBasicInformation
:
1070 SECTION_BASIC_INFORMATION info
;
1071 SECTION_BASIC_INFORMATION32
*info32
= ptr
;
1073 if (size
< sizeof(*info32
)) return STATUS_INFO_LENGTH_MISMATCH
;
1074 if (!(status
= NtQuerySection( handle
, class, &info
, sizeof(info
), &ret_size
)))
1076 info32
->BaseAddress
= PtrToUlong( info
.BaseAddress
);
1077 info32
->Attributes
= info
.Attributes
;
1078 info32
->Size
= info
.Size
;
1079 ret_size
= sizeof(*info32
);
1083 case SectionImageInformation
:
1085 SECTION_IMAGE_INFORMATION info
;
1086 SECTION_IMAGE_INFORMATION32
*info32
= ptr
;
1088 if (size
< sizeof(*info32
)) return STATUS_INFO_LENGTH_MISMATCH
;
1089 if (!(status
= NtQuerySection( handle
, class, &info
, sizeof(info
), &ret_size
)))
1091 put_section_image_info( info32
, &info
);
1092 ret_size
= sizeof(*info32
);
1097 FIXME( "class %u not implemented\n", class );
1098 return STATUS_NOT_IMPLEMENTED
;
1100 put_size( ret_ptr
, ret_size
);
1105 /**********************************************************************
1106 * wow64_NtQuerySemaphore
1108 NTSTATUS WINAPI
wow64_NtQuerySemaphore( UINT
*args
)
1110 HANDLE handle
= get_handle( &args
);
1111 SEMAPHORE_INFORMATION_CLASS
class = get_ulong( &args
);
1112 void *info
= get_ptr( &args
);
1113 ULONG len
= get_ulong( &args
);
1114 ULONG
*retlen
= get_ptr( &args
);
1116 return NtQuerySemaphore( handle
, class, info
, len
, retlen
);
1120 /**********************************************************************
1121 * wow64_NtQuerySymbolicLinkObject
1123 NTSTATUS WINAPI
wow64_NtQuerySymbolicLinkObject( UINT
*args
)
1125 HANDLE handle
= get_handle( &args
);
1126 UNICODE_STRING32
*target32
= get_ptr( &args
);
1127 ULONG
*retlen
= get_ptr( &args
);
1129 UNICODE_STRING target
;
1132 status
= NtQuerySymbolicLinkObject( handle
, unicode_str_32to64( &target
, target32
), retlen
);
1133 if (!status
) target32
->Length
= target
.Length
;
1138 /**********************************************************************
1139 * wow64_NtQueryTimer
1141 NTSTATUS WINAPI
wow64_NtQueryTimer( UINT
*args
)
1143 HANDLE handle
= get_handle( &args
);
1144 TIMER_INFORMATION_CLASS
class = get_ulong( &args
);
1145 void *info
= get_ptr( &args
);
1146 ULONG len
= get_ulong( &args
);
1147 ULONG
*retlen
= get_ptr( &args
);
1149 return NtQueryTimer( handle
, class, info
, len
, retlen
);
1153 /**********************************************************************
1154 * wow64_NtQueryTimerResolution
1156 NTSTATUS WINAPI
wow64_NtQueryTimerResolution( UINT
*args
)
1158 ULONG
*min_res
= get_ptr( &args
);
1159 ULONG
*max_res
= get_ptr( &args
);
1160 ULONG
*current_res
= get_ptr( &args
);
1162 return NtQueryTimerResolution( min_res
, max_res
, current_res
);
1166 /**********************************************************************
1167 * wow64_NtRegisterThreadTerminatePort
1169 NTSTATUS WINAPI
wow64_NtRegisterThreadTerminatePort( UINT
*args
)
1171 HANDLE handle
= get_handle( &args
);
1173 return NtRegisterThreadTerminatePort( handle
);
1177 /**********************************************************************
1178 * wow64_NtReleaseKeyedEvent
1180 NTSTATUS WINAPI
wow64_NtReleaseKeyedEvent( UINT
*args
)
1182 HANDLE handle
= get_handle( &args
);
1183 void *key
= get_ptr( &args
);
1184 BOOLEAN alertable
= get_ulong( &args
);
1185 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1187 return NtReleaseKeyedEvent( handle
, key
, alertable
, timeout
);
1191 /**********************************************************************
1192 * wow64_NtReleaseMutant
1194 NTSTATUS WINAPI
wow64_NtReleaseMutant( UINT
*args
)
1196 HANDLE handle
= get_handle( &args
);
1197 LONG
*prev_count
= get_ptr( &args
);
1199 return NtReleaseMutant( handle
, prev_count
);
1203 /**********************************************************************
1204 * wow64_NtReleaseSemaphore
1206 NTSTATUS WINAPI
wow64_NtReleaseSemaphore( UINT
*args
)
1208 HANDLE handle
= get_handle( &args
);
1209 ULONG count
= get_ulong( &args
);
1210 ULONG
*previous
= get_ptr( &args
);
1212 return NtReleaseSemaphore( handle
, count
, previous
);
1216 /**********************************************************************
1217 * wow64_NtReplyWaitReceivePort
1219 NTSTATUS WINAPI
wow64_NtReplyWaitReceivePort( UINT
*args
)
1221 HANDLE handle
= get_handle( &args
);
1222 ULONG
*id
= get_ptr( &args
);
1223 LPC_MESSAGE
*reply
= get_ptr( &args
);
1224 LPC_MESSAGE
*msg
= get_ptr( &args
);
1226 FIXME( "%p %p %p %p: stub\n", handle
, id
, reply
, msg
);
1227 return STATUS_NOT_IMPLEMENTED
;
1231 /**********************************************************************
1232 * wow64_NtRequestWaitReplyPort
1234 NTSTATUS WINAPI
wow64_NtRequestWaitReplyPort( UINT
*args
)
1236 HANDLE handle
= get_handle( &args
);
1237 LPC_MESSAGE
*msg_in
= get_ptr( &args
);
1238 LPC_MESSAGE
*msg_out
= get_ptr( &args
);
1240 FIXME( "%p %p %p: stub\n", handle
, msg_in
, msg_out
);
1241 return STATUS_NOT_IMPLEMENTED
;
1245 /**********************************************************************
1246 * wow64_NtResetEvent
1248 NTSTATUS WINAPI
wow64_NtResetEvent( UINT
*args
)
1250 HANDLE handle
= get_handle( &args
);
1251 LONG
*prev_state
= get_ptr( &args
);
1253 return NtResetEvent( handle
, prev_state
);
1257 /**********************************************************************
1258 * wow64_NtSecureConnectPort
1260 NTSTATUS WINAPI
wow64_NtSecureConnectPort( UINT
*args
)
1262 ULONG
*handle_ptr
= get_ptr( &args
);
1263 UNICODE_STRING32
*name32
= get_ptr( &args
);
1264 SECURITY_QUALITY_OF_SERVICE
*qos
= get_ptr( &args
);
1265 LPC_SECTION_WRITE
*write
= get_ptr( &args
);
1266 SID
*sid
= get_ptr( &args
);
1267 LPC_SECTION_READ
*read
= get_ptr( &args
);
1268 ULONG
*max_len
= get_ptr( &args
);
1269 void *info
= get_ptr( &args
);
1270 ULONG
*info_len
= get_ptr( &args
);
1272 FIXME( "%p %p %p %p %p %p %p %p %p: stub\n",
1273 handle_ptr
, name32
, qos
, write
, sid
, read
, max_len
, info
, info_len
);
1274 return STATUS_NOT_IMPLEMENTED
;
1278 /**********************************************************************
1281 NTSTATUS WINAPI
wow64_NtSetEvent( UINT
*args
)
1283 HANDLE handle
= get_handle( &args
);
1284 LONG
*prev_state
= get_ptr( &args
);
1286 return NtSetEvent( handle
, prev_state
);
1290 /**********************************************************************
1291 * wow64_NtSetInformationDebugObject
1293 NTSTATUS WINAPI
wow64_NtSetInformationDebugObject( UINT
*args
)
1295 HANDLE handle
= get_handle( &args
);
1296 DEBUGOBJECTINFOCLASS
class = get_ulong( &args
);
1297 void *ptr
= get_ptr( &args
);
1298 ULONG len
= get_ulong( &args
);
1299 ULONG
*retlen
= get_ptr( &args
);
1301 return NtSetInformationDebugObject( handle
, class, ptr
, len
, retlen
);
1305 /**********************************************************************
1306 * wow64_NtSetInformationJobObject
1308 NTSTATUS WINAPI
wow64_NtSetInformationJobObject( UINT
*args
)
1310 HANDLE handle
= get_handle( &args
);
1311 JOBOBJECTINFOCLASS
class = get_ulong( &args
);
1312 void *ptr
= get_ptr( &args
);
1313 ULONG len
= get_ulong( &args
);
1317 case JobObjectBasicLimitInformation
: /* JOBOBJECT_BASIC_LIMIT_INFORMATION */
1318 if (len
== sizeof(JOBOBJECT_BASIC_LIMIT_INFORMATION32
))
1320 JOBOBJECT_BASIC_LIMIT_INFORMATION info
;
1322 return NtSetInformationJobObject( handle
, class, job_basic_limit_info_32to64( &info
, ptr
),
1325 else return STATUS_INVALID_PARAMETER
;
1327 case JobObjectBasicUIRestrictions
:
1328 FIXME( "unsupported class JobObjectBasicUIRestrictions\n" );
1329 return STATUS_SUCCESS
;
1331 case JobObjectAssociateCompletionPortInformation
: /* JOBOBJECT_ASSOCIATE_COMPLETION_PORT */
1332 if (len
== sizeof(JOBOBJECT_ASSOCIATE_COMPLETION_PORT32
))
1334 JOBOBJECT_ASSOCIATE_COMPLETION_PORT32
*info32
= ptr
;
1335 JOBOBJECT_ASSOCIATE_COMPLETION_PORT info
;
1337 info
.CompletionKey
= ULongToPtr( info32
->CompletionKey
);
1338 info
.CompletionPort
= LongToHandle( info32
->CompletionPort
);
1339 return NtSetInformationJobObject( handle
, class, &info
, sizeof(info
) );
1341 else return STATUS_INVALID_PARAMETER
;
1343 case JobObjectExtendedLimitInformation
: /* JOBOBJECT_EXTENDED_LIMIT_INFORMATION */
1344 if (len
== sizeof(JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
))
1346 JOBOBJECT_EXTENDED_LIMIT_INFORMATION32
*info32
= ptr
;
1347 JOBOBJECT_EXTENDED_LIMIT_INFORMATION info
;
1349 info
.IoInfo
= info32
->IoInfo
;
1350 info
.ProcessMemoryLimit
= info32
->ProcessMemoryLimit
;
1351 info
.JobMemoryLimit
= info32
->JobMemoryLimit
;
1352 info
.PeakProcessMemoryUsed
= info32
->PeakProcessMemoryUsed
;
1353 info
.PeakJobMemoryUsed
= info32
->PeakJobMemoryUsed
;
1354 return NtSetInformationJobObject( handle
, class,
1355 job_basic_limit_info_32to64( &info
.BasicLimitInformation
,
1356 &info32
->BasicLimitInformation
),
1359 else return STATUS_INVALID_PARAMETER
;
1362 if (class >= MaxJobObjectInfoClass
) return STATUS_INVALID_PARAMETER
;
1363 FIXME( "unsupported class %u\n", class );
1364 return STATUS_NOT_IMPLEMENTED
;
1369 /**********************************************************************
1370 * wow64_NtSetInformationObject
1372 NTSTATUS WINAPI
wow64_NtSetInformationObject( UINT
*args
)
1374 HANDLE handle
= get_handle( &args
);
1375 OBJECT_INFORMATION_CLASS
class = get_ulong( &args
);
1376 void *ptr
= get_ptr( &args
);
1377 ULONG len
= get_ulong( &args
);
1381 case ObjectDataInformation
: /* OBJECT_DATA_INFORMATION */
1382 return NtSetInformationObject( handle
, class, ptr
, len
);
1385 FIXME( "unsupported class %u\n", class );
1386 return STATUS_NOT_IMPLEMENTED
;
1391 /**********************************************************************
1392 * wow64_NtSetIoCompletion
1394 NTSTATUS WINAPI
wow64_NtSetIoCompletion( UINT
*args
)
1396 HANDLE handle
= get_handle( &args
);
1397 ULONG_PTR key
= get_ulong( &args
);
1398 ULONG_PTR value
= get_ulong( &args
);
1399 NTSTATUS status
= get_ulong( &args
);
1400 SIZE_T count
= get_ulong( &args
);
1402 return NtSetIoCompletion( handle
, key
, value
, status
, count
);
1406 /**********************************************************************
1407 * wow64_NtSetPowerRequest
1409 NTSTATUS WINAPI
wow64_NtSetPowerRequest( UINT
*args
)
1411 HANDLE handle
= get_handle( &args
);
1412 POWER_REQUEST_TYPE type
= get_ulong( &args
);
1414 return NtSetPowerRequest( handle
, type
);
1418 /**********************************************************************
1421 NTSTATUS WINAPI
wow64_NtSetTimer( UINT
*args
)
1423 HANDLE handle
= get_handle( &args
);
1424 LARGE_INTEGER
*when
= get_ptr( &args
);
1425 ULONG apc
= get_ulong( &args
);
1426 ULONG apc_param
= get_ulong( &args
);
1427 BOOLEAN resume
= get_ulong( &args
);
1428 ULONG period
= get_ulong( &args
);
1429 BOOLEAN
*state
= get_ptr( &args
);
1431 return NtSetTimer( handle
, when
, apc_32to64( apc
), apc_param_32to64( apc
, apc_param
),
1432 resume
, period
, state
);
1436 /**********************************************************************
1437 * wow64_NtSetTimerResolution
1439 NTSTATUS WINAPI
wow64_NtSetTimerResolution( UINT
*args
)
1441 ULONG res
= get_ulong( &args
);
1442 BOOLEAN set
= get_ulong( &args
);
1443 ULONG
*current_res
= get_ptr( &args
);
1445 return NtSetTimerResolution( res
, set
, current_res
);
1449 /**********************************************************************
1450 * wow64_NtSignalAndWaitForSingleObject
1452 NTSTATUS WINAPI
wow64_NtSignalAndWaitForSingleObject( UINT
*args
)
1454 HANDLE signal
= get_handle( &args
);
1455 HANDLE wait
= get_handle( &args
);
1456 BOOLEAN alertable
= get_ulong( &args
);
1457 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1459 return NtSignalAndWaitForSingleObject( signal
, wait
, alertable
, timeout
);
1463 /**********************************************************************
1464 * wow64_NtTerminateJobObject
1466 NTSTATUS WINAPI
wow64_NtTerminateJobObject( UINT
*args
)
1468 HANDLE handle
= get_handle( &args
);
1469 NTSTATUS status
= get_ulong( &args
);
1471 return NtTerminateJobObject( handle
, status
);
1475 /**********************************************************************
1478 NTSTATUS WINAPI
wow64_NtTestAlert( UINT
*args
)
1480 return NtTestAlert();
1484 /**********************************************************************
1485 * wow64_NtWaitForDebugEvent
1487 NTSTATUS WINAPI
wow64_NtWaitForDebugEvent( UINT
*args
)
1489 HANDLE handle
= get_handle( &args
);
1490 BOOLEAN alertable
= get_ulong( &args
);
1491 LARGE_INTEGER
*timeout
= get_ptr( &args
);
1492 DBGUI_WAIT_STATE_CHANGE32
*state32
= get_ptr( &args
);
1495 DBGUI_WAIT_STATE_CHANGE state
;
1496 NTSTATUS status
= NtWaitForDebugEvent( handle
, alertable
, timeout
, &state
);
1500 state32
->NewState
= state
.NewState
;
1501 state32
->AppClientId
.UniqueProcess
= HandleToULong( state
.AppClientId
.UniqueProcess
);
1502 state32
->AppClientId
.UniqueThread
= HandleToULong( state
.AppClientId
.UniqueThread
);
1503 switch (state
.NewState
)
1505 #define COPY_ULONG(field) state32->StateInfo.field = state.StateInfo.field
1506 #define COPY_PTR(field) state32->StateInfo.field = PtrToUlong( state.StateInfo.field )
1507 case DbgCreateThreadStateChange
:
1508 COPY_PTR( CreateThread
.HandleToThread
);
1509 COPY_PTR( CreateThread
.NewThread
.StartAddress
);
1510 COPY_ULONG( CreateThread
.NewThread
.SubSystemKey
);
1512 case DbgCreateProcessStateChange
:
1513 COPY_PTR( CreateProcessInfo
.HandleToProcess
);
1514 COPY_PTR( CreateProcessInfo
.HandleToThread
);
1515 COPY_PTR( CreateProcessInfo
.NewProcess
.FileHandle
);
1516 COPY_PTR( CreateProcessInfo
.NewProcess
.BaseOfImage
);
1517 COPY_PTR( CreateProcessInfo
.NewProcess
.InitialThread
.StartAddress
);
1518 COPY_ULONG( CreateProcessInfo
.NewProcess
.InitialThread
.SubSystemKey
);
1519 COPY_ULONG( CreateProcessInfo
.NewProcess
.DebugInfoFileOffset
);
1520 COPY_ULONG( CreateProcessInfo
.NewProcess
.DebugInfoSize
);
1522 case DbgExitThreadStateChange
:
1523 case DbgExitProcessStateChange
:
1524 COPY_ULONG( ExitThread
.ExitStatus
);
1526 case DbgExceptionStateChange
:
1527 case DbgBreakpointStateChange
:
1528 case DbgSingleStepStateChange
:
1529 COPY_ULONG( Exception
.FirstChance
);
1530 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionCode
);
1531 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionFlags
);
1532 COPY_ULONG( Exception
.ExceptionRecord
.NumberParameters
);
1533 COPY_PTR( Exception
.ExceptionRecord
.ExceptionRecord
);
1534 COPY_PTR( Exception
.ExceptionRecord
.ExceptionAddress
);
1535 for (i
= 0; i
< state
.StateInfo
.Exception
.ExceptionRecord
.NumberParameters
; i
++)
1536 COPY_ULONG( Exception
.ExceptionRecord
.ExceptionInformation
[i
] );
1538 case DbgLoadDllStateChange
:
1539 COPY_PTR( LoadDll
.FileHandle
);
1540 COPY_PTR( LoadDll
.BaseOfDll
);
1541 COPY_ULONG( LoadDll
.DebugInfoFileOffset
);
1542 COPY_ULONG( LoadDll
.DebugInfoSize
);
1543 COPY_PTR( LoadDll
.NamePointer
);
1545 case DbgUnloadDllStateChange
:
1546 COPY_PTR( UnloadDll
.BaseAddress
);
1558 /**********************************************************************
1559 * wow64_NtWaitForKeyedEvent
1561 NTSTATUS WINAPI
wow64_NtWaitForKeyedEvent( UINT
*args
)
1563 HANDLE handle
= get_handle( &args
);
1564 const void *key
= get_ptr( &args
);
1565 BOOLEAN alertable
= get_ulong( &args
);
1566 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1568 return NtWaitForKeyedEvent( handle
, key
, alertable
, timeout
);
1572 /**********************************************************************
1573 * wow64_NtWaitForMultipleObjects
1575 NTSTATUS WINAPI
wow64_NtWaitForMultipleObjects( UINT
*args
)
1577 DWORD count
= get_ulong( &args
);
1578 LONG
*handles_ptr
= get_ptr( &args
);
1579 BOOLEAN wait_any
= get_ulong( &args
);
1580 BOOLEAN alertable
= get_ulong( &args
);
1581 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1583 HANDLE handles
[MAXIMUM_WAIT_OBJECTS
];
1586 for (i
= 0; i
< count
&& i
< MAXIMUM_WAIT_OBJECTS
; i
++) handles
[i
] = LongToHandle( handles_ptr
[i
] );
1587 return NtWaitForMultipleObjects( count
, handles
, wait_any
, alertable
, timeout
);
1591 /**********************************************************************
1592 * wow64_NtWaitForSingleObject
1594 NTSTATUS WINAPI
wow64_NtWaitForSingleObject( UINT
*args
)
1596 HANDLE handle
= get_handle( &args
);
1597 BOOLEAN alertable
= get_ulong( &args
);
1598 const LARGE_INTEGER
*timeout
= get_ptr( &args
);
1600 return NtWaitForSingleObject( handle
, alertable
, timeout
);
1604 /**********************************************************************
1605 * wow64_NtYieldExecution
1607 NTSTATUS WINAPI
wow64_NtYieldExecution( UINT
*args
)
1609 return NtYieldExecution();