- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
$aCall = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
"ptr", 0, _
"dword", 82, _
"dword", 4096, _ ; MEM_COMMIT
"dword", 64) ; PAGE_EXECUTE_READWRITE
If @error Or Not $aCall[0] Then
Return SetError(6, 0, 0)
EndIf
Local $pRemoteCode = $aCall[0]
; Make structure in reserved space
Local $CodeBuffer = DllStructCreate("byte[82]", $pRemoteCode)
; Allocate global memory with PAGE_READWRITE. This can be done with ByRef-ing too.
$aCall = DllCall("kernel32.dll", "ptr", "VirtualAlloc", _
"ptr", 0, _
"dword", 36, _
"dword", 4096, _ ; MEM_COMMIT
"dword", 4) ; PAGE_READWRITE
If @error Or Not $aCall[0] Then
Return SetError(7, 0, 0)
EndIf
Local $pStrings = $aCall[0]
; Arrange strings in reserved space
Local $tSpace = DllStructCreate("wchar Format[9];wchar Result[9]", $pStrings)
DllStructSetData($tSpace, "Format", "hh:mm:ss")
; Write assembly on the fly
DllStructSetData($CodeBuffer, 1, _
"0x" & _
"68" & SwapEndian(9) & _ ; push output size
"68" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _ ; push pointer to output container
"68" & SwapEndian(DllStructGetPtr($tSpace, "Format")) & _ ; push pointer to format string
"68" & SwapEndian(0) & _ ; push NULL
"68" & SwapEndian(4) & _ ; push TIME_FORCE24HOURFORMAT
"68" & SwapEndian(0) & _ ; push Locale
"B8" & SwapEndian($pGetTimeFormatW) & _ ; mov eax, [$pGetTimeFormatW]
"FFD0" & _ ; call eax
"68" & SwapEndian(DllStructGetPtr($tSpace, "Result")) & _ ; push pointer to the result
"68" & SwapEndian(0) & _ ; push wParam
"68" & SwapEndian(12) & _ ; push WM_SETTEXT
"68" & SwapEndian(GUICtrlGetHandle($hControl)) & _ ; push HANDLE
"B8" & SwapEndian($pSendMessageW) & _ ; mov eax, [$pSendMessageW]
"FFD0" & _ ; call eax
"68" & SwapEndian(491) & _ ; push Milliseconds
"B8" & SwapEndian($pSleep) & _ ; mov eax, [$pSleep]
"FFD0" & _ ; call eax
"E9" & SwapEndian(-81) & _ ; jump back 81 bytes (start address)
"C3" _ ; Ret
)
; Create new thread to execute code in
$aCall = DllCall("kernel32.dll", "ptr", "CreateThread", _
"ptr", 0, _
"dword", 0, _
"ptr", $pRemoteCode, _
"ptr", 0, _
"dword", 0, _
"dword*", 0)
If @error Or Not $aCall[0] Then
Return SetError(8, 0, 0)
EndIf
Local $hThread = $aCall[0]
; Return thread handle
Return $hThread
EndFunc ;==>_ClockThisInAnotherThread
Func SwapEndian($iValue)
Return Hex(BinaryMid($iValue, 1, 4))
EndFunc ;==>SwapEndian
Попытка вызвать CreateThread в однопоточном скриптовом языке.
Код функции написан заранее, в виде опкодов. Гениально.
AntiSpam 07.04.2017 23:36 # −4
3_15dar 07.04.2017 23:56 # −7
3_15dar 08.04.2017 00:01 # −5
guestinio 08.04.2017 00:03 # −5
guestinio 08.04.2017 00:10 # −10
guestinh0 08.04.2017 00:12 # −5
3_15dar 08.04.2017 00:04 # −9
barop 08.04.2017 00:05 # −9
3_15dar 08.04.2017 00:07 # −5
guestinio 08.04.2017 00:13 # −5
guestinio 08.04.2017 00:16 # −9
barop 08.04.2017 00:08 # −9
guestinh0 08.04.2017 00:13 # −9
barop 08.04.2017 00:08 # −10
guestinio 08.04.2017 00:05 # −10
guestinio 08.04.2017 00:09 # −9
guestinio 08.04.2017 00:14 # −9
3_15dar 08.04.2017 00:15 # −5
3_15dar 08.04.2017 00:08 # −5
3_15dar 07.04.2017 23:56 # −7
barop 08.04.2017 00:01 # −5
barop 08.04.2017 00:03 # −10
guestinio 08.04.2017 00:04 # −5
guestinio 08.04.2017 00:04 # −10
barop 08.04.2017 00:09 # −5
3_15dar 08.04.2017 00:13 # −10
barop 08.04.2017 00:01 # −5
barop 08.04.2017 00:02 # −5
3_15dar 08.04.2017 00:05 # −9
barop 08.04.2017 00:05 # −9
guestinh0 08.04.2017 00:06 # −5
3_15dar 08.04.2017 00:07 # −9
guestinh0 08.04.2017 00:08 # −5
3_14-pidar 08.04.2017 00:16 # −4
3_15dar 08.04.2017 00:10 # −9
barop 08.04.2017 00:12 # −10
3_15dar 08.04.2017 00:17 # −5
3_14-pidar 08.04.2017 00:14 # −5
barop 08.04.2017 00:04 # −10
3_15dar 08.04.2017 00:06 # −10
guestinh0 08.04.2017 00:10 # −9
barop 08.04.2017 00:10 # −9
3_15dar 08.04.2017 00:12 # −9
3_15dar 08.04.2017 00:01 # −10
3_15dar 08.04.2017 00:02 # −10
guestinio 08.04.2017 00:08 # −5
guestinio 08.04.2017 00:09 # −10
3_14-pidar 08.04.2017 00:12 # −4
3_15dar 08.04.2017 00:09 # −10
barop 08.04.2017 00:13 # −9
guestinh0 08.04.2017 00:15 # −9
barop 08.04.2017 00:17 # −10
3_15dar 08.04.2017 00:03 # −9
barop 08.04.2017 00:06 # −5
guestinh0 08.04.2017 00:07 # −10
guestinh0 08.04.2017 00:11 # −5
barop 08.04.2017 00:15 # −5
guestinh0 08.04.2017 00:07 # −9
barop 08.04.2017 00:04 # −9
guestinio 08.04.2017 00:06 # −10
barop 08.04.2017 00:07 # −5
guestinio 08.04.2017 00:07 # −10
fajes_rown 08.04.2017 00:07 # −3
guest 08.04.2017 12:51 # −15
fajes_rown 08.04.2017 12:52 # 0