flat assembler
Message board for the users of flat assembler.
Index
> Main > load bin direct to code address space and others... |
Author |
|
eet_1024 30 Oct 2003, 21:51
A1:
Yes, Just do a GlobalAlloc, then call or jump to the code. But remember, if it uses API's, you'll have to figure at how to access them. I don't think that part is hard either. Also watch out for absolute jumps. Why do you need to load code? A2: Here is what I use to launch an executable Code: ;******************************************************************************* ; DWORD WaitCmd( Create a New Process and Wait for it to Exit ; lpsz // ASCIIz Command Line ; ); ; Return Value: ; 0 if Successful ; Remarks: ; If CreateProcess or the Called Process fail, WaitCmd will Exit to the System ; CreateProcess must be called with bInheritHandles=True ; About: ; CreateProcess is used by Qcc to invoke the fABIUS tools. Since CreateProcess ; is non-blocking, Qcc must loop while the process is still active. Otherwise ; Qcc will become a multi-treaded application very quickly. ;******************************************************************************* proc WaitCmd, lpsz enter stdcall DispLine, Report.Execute, [lpsz] invoke CreateProcess, 0, [lpsz], 0, 0, True, 0, 0, 0, Process.stin, Process.prin cmp eax, False ; Process Start Ok? jnz .WhileActive ; Yes - Wait for it to return stdcall Croak, Error.Execute, [lpsz] ; No - Fatal Error .WhileActive: invoke GetExitCodeProcess, [Process.prin.hProcess], Process.ExitCode mov eax, [Process.ExitCode] ; Get Status of Process cmp eax, STILL_ACTIVE ; Is it still Active? jz .WhileActive ; Yes - Keep Waiting cmp eax, False ; Did the Process Succeed? jz .Done ; Yes - Return stdcall Dword2Hex, TempPath+2, eax ; Get ASCII of Error Code mov w[TempPath], '0x' mov b[TempPath+10], Null ; TempPath = "0xHeXaDeCa" stdcall DispLine, Error.Process, TempPath ; Tell User What Happened invoke ExitProcess, eax ; Return to System .Done: return Process.stin and Process.prin are uninitialized structures found in kernel32.inc |
|||
30 Oct 2003, 21:51 |
|
HarryTuttle 31 Oct 2003, 11:17
_________________ Microsoft: brings power of yesterday to computers of today. |
|||
31 Oct 2003, 11:17 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.