lekt wrote:sbgk wrote:...have tried ntDelayExecution instead of waitforsingleobject, but couldn't get it to work.
have read this link, but i think x64 still use interrupts, not sure better than syscall or not. see in ntdll.dll win10 many "int xxh", code of ntDelayExecution win10:
; Exported entry 310. NtDelayExecution ; Exported entry 1715. ZwDelayExecution
public ZwDelayExecution
ZwDelayExecution proc near
mov eax, 60034h ; NtDelayExecution
mov edx, offset sub_4B2FCA80
call edx ; sub_4B2FCA80
retn 8
ZwDelayExecution endp
sub_4B2FCA80 proc near
mov edx, large fs:30h
mov edx, [edx+254h]
test edx, 2
jz short loc_4B2FCA98
int 2Eh ; DOS 2+ internal - EXECUTE COMMAND
; DS:SI -> counted CR-terminated command string
retn
loc_4B2FCA98:
jmp far ptr 33h:4B2FCA9Fh
sub_4B2FCA80 endp
have not seen syscall. this "jmp far ptr 33h:4B2FCA9Fh" is secret, you need copy data from this address, think 128 bytes is enough, write into file.txt, put into global variable area of you application, disassembler this last file, and can discover what is this.
---------------------------
share to you NtDelayExecution win8/8.1/ws2012/ws2012R2:
;NtDelayExecution(IN BOOLEAN Alertable, IN PLARGE_INTEGER DelayInterval);
lea rdx, [rsp+32] ; i use some valid pointer on stack
xor r10d, r10d ; Alertable=FALSE. If TRUE, execution can break in a result of NtAlertThread call
mov qword ptr [rdx], -xxxh ;Negative value means delay relative to current
mov eax, 32h ;win8/ws2012
;mov eax, 33h ;win8.1/ws2012R2
syscall ;return rax = 0
1 millisecond = 1 million (1,000,000) nanoseconds.
1 nanosecond = 0.000001 milliseconds.
1 nanosecond = 0.000000001 seconds, ie. 1 billionth of 1 second (1 / 1,000,000,000).
be careful with DelayInterval, it's Negative value.
for win10 you may try:
mov eax, 60034h
or use int 2Eh, not sure. or get syscall number by your method.
tried use this function instead of NtWaitForSingleObject in render loop, but difficult determine DelayInterval, sound have sand, need correct calculate for 16/44100, seems 56.69ms for my 256 buffer size. do you know how calculate?