diff --git a/rtl/ntapi.pas b/rtl/ntapi.pas index b1ae07ad..07f71853 100644 --- a/rtl/ntapi.pas +++ b/rtl/ntapi.pas @@ -261,6 +261,10 @@ const FILE_PIPE_QUEUE_OPERATION =$00000000; FILE_PIPE_COMPLETE_OPERATION=$00000001; + //UserApcOption + QUEUE_USER_APC_FLAGS_NONE =0; + QUEUE_USER_APC_FLAGS_SPECIAL_USER_APC=1; + type PIO_STATUS_BLOCK=^IO_STATUS_BLOCK; IO_STATUS_BLOCK=packed record @@ -439,6 +443,11 @@ type IoStatusBlock:PIO_STATUS_BLOCK; Reserved:ULONG); stdcall; + PPS_APC_ROUTINE=procedure(ApcArgument1 :Pointer; + ApcArgument2 :Pointer; + ApcArgument3 :Pointer; + ContextRecord:PCONTEXT); stdcall; + PMUTANT_BASIC_INFORMATION=^MUTANT_BASIC_INFORMATION; MUTANT_BASIC_INFORMATION=packed record CurrentCount :LONG; @@ -608,8 +617,26 @@ function NtQueueApcThread( ApcReserved :ULONG ):DWORD; stdcall; external 'ntdll'; +function NtQueueApcThreadEx( + ThreadHandle :THandle; + UserApcOption:QWORD; //QUEUE_USER_APC_FLAGS_SPECIAL_USER_APC + ApcRoutine :Pointer; //PPS_APC_ROUTINE + ApcArgument1 :Pointer; + ApcArgument2 :Pointer; + ApcArgument3 :Pointer + ):DWORD; stdcall; external 'ntdll'; + function NtYieldExecution():DWORD; stdcall; external 'ntdll'; +function NtWaitForAlertByThreadId( + Address:Pointer; + Timeout:PLARGE_INTEGER + ):DWORD; stdcall; external 'ntdll'; + +function NtAlertThreadByThreadId( + ThreadId:THandle + ):DWORD; stdcall; external 'ntdll'; + function NtDelayExecution( Alertable :Boolean; DelayInterval:PLARGE_INTEGER diff --git a/sys/kern/kern_mtx.pas b/sys/kern/kern_mtx.pas index 7d82ffc6..c00d0efd 100644 --- a/sys/kern/kern_mtx.pas +++ b/sys/kern/kern_mtx.pas @@ -134,7 +134,7 @@ end; function mtx_owned(var m:mtx):Boolean; inline; begin - Result:=m.c.OwningThread=GetCurrentThreadId; + Result:=m.c.OwningThread=ThreadID; end; procedure mtx_assert(var m:mtx); //inline;