You are doing plenty of things wrong. But hey, I can read some opcode and mnemonics. Study this:
MsgBox(0, "", MyPathEx())
Func MyPathEx()
; Opcode is 32 bit only
If @AutoItX64 Then Return
; OPCODE:
; 64A130000000 mov eax, dword fs:[0x30]
; 8B4010 mov eax, [eax+0x10]
; 8B403C mov eax, [eax+0x3C]
; C3 ret
Local $OP = "0x64A1300000008B40108B403CC3"
; Bynary len
Local $iCodeSize = BinaryLen($OP)
; Allocate memory
Local $pCodeBuffer = VirtualAlloc(0, $iCodeSize)
; Byte struct at that address
Local $tCodeBuffer = DllStructCreate("byte[" & $iCodeSize & "]", $pCodeBuffer)
; Copy opcode
DllStructSetData($tCodeBuffer, 1, $OP)
; Mark as executable code
Local Const $PAGE_EXECUTE = 16
VirtualProtect($pCodeBuffer, $iCodeSize, $PAGE_EXECUTE)
; Execute the code
Local $aCall = DllCallAddress("wstr", $pCodeBuffer)
; Free allocated
VirtualFree($pCodeBuffer)
; Rerturn the result
Return $aCall[0]
EndFunc
Func VirtualProtect($pAddress, $iSize, $iProtection)
Local $aCall = DllCall("kernel32.dll", "bool", "VirtualProtect", "ptr", $pAddress, "dword_ptr", $iSize, "dword", $iProtection, "dword*", 0)
If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
Return 1
EndFunc
Func VirtualAlloc($pAddress, $iSize, $iAllocationType = 0x1000, $iProtect = 4) ; default is MEM_COMMIT and PAGE_READWRITE
Local $aCall = DllCall("kernel32.dll", "ptr", "VirtualAlloc", "ptr", $pAddress, "dword_ptr", $iSize, "dword", $iAllocationType, "dword", $iProtect)
If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
Return $aCall[0]
EndFunc
Func VirtualFree($pAddress, $iSize = 0, $iFreeType = 0x8000) ; MEM_RELEASE default
Local $aCall = DllCall("kernel32.dll", "bool", "VirtualFree", "ptr", $pAddress, "dword_ptr", $iSize, "dword", $iFreeType)
If @error Or Not $aCall[0] Then Return SetError(1, 0, 0)
Return $aCall[0]
EndFunc
...You will see how to do that, almost correctly.