include \masm32\include\masm32rt.inc
.data
txFile db "extracted.exe", 0
bytesWritten dd ?
.code
start:
invoke FindResource, 0, 99, RT_RCDATA
.if eax
xchg eax, ebx ; hRes
push rv(SizeofResource, 0, ebx)
push rv(LoadResource, 0, ebx) ; returns pointer to content in eax
invoke CreateFile, addr txFile, GENERIC_WRITE, 0, 0, CREATE_ALWAYS, 0, 0
xchg eax, esi
pop eax ; pointer to content
pop ecx ; size in bytes
invoke WriteFile, esi, eax, ecx, addr bytesWritten, 0
invoke CloseHandle, esi
invoke WinExec, addr txFile, SW_SHOW
.endif
exit
end start