flat assembler
Message board for the users of flat assembler.
Index
> Windows > How do i can link form fasm with mingw? |
Author |
|
revolution 24 May 2012, 09:46
It looks as though you need to link with the Windows API libraries also. kernel32.lib etc.
|
|||
24 May 2012, 09:46 |
|
MinhHung 24 May 2012, 10:02
ld C:\Users\admin\Documents\C-Free\Projects\newinject32\mingw5\main.o C:\Users\admin\Documents\C-Free\Projects\newinject32\mingw5\newinject32.o C:\Users\admin\Documents\C-Free\Projects\newinject32\mingw5\object.OBJ -o C:\Users\admin\Documents\C-Free\Projects\newinject32\mingw5\newinject32.exe "C:\Program Files (x86)\C-Free 5\mingw\lib\libuser32.a"...etc ect...
and in object.obj contain InjectDll --sorry, i cannot post code here |
|||
24 May 2012, 10:02 |
|
MinhHung 24 May 2012, 10:02
in object.asm
extrn 'LoadLibraryW' as LoadLibraryW:dword extrn 'WriteProcessMemory' as WriteProcessMemory:dword extrn 'CreateRemoteThread' as CreateRemoteThread:dword extrn 'Sleep' as Sleep:dword extrn 'VirtualAllocEx' as VirtualAllocEx:dword extrn 'OpenProcess' as OpenProcess:dword public InjectDll as 'InjectDll' |
|||
24 May 2012, 10:02 |
|
MinhHung 24 May 2012, 10:21
sources of object.asm like this:
Code: format MS COFF include 'win32a.inc' extrn 'LoadLibraryW' as LoadLibraryW:dword extrn 'WriteProcessMemory' as WriteProcessMemory:dword extrn 'CreateRemoteThread' as CreateRemoteThread:dword extrn 'Sleep' as Sleep:dword extrn 'VirtualAllocEx' as VirtualAllocEx:dword extrn 'OpenProcess' as OpenProcess:dword public InjectDll as 'InjectDll' PROCESS_CREATE_THREAD = 2h PROCESS_VM_OPERATION = 8h PROCESS_VM_READ = 10h PROCESS_VM_WRITE = 20h PROCESS_QUERY_INFORMATION = 400h MEM_COMMIT = 0x1000 MEM_RESERVE = 0x2000 PAGE_READWRITE = 0x4 PAGE_EXECUTE = 0x10 proc InjectDll Pid,DllName invoke OpenProcess,PROCESS_CREATE_THREAD+PROCESS_VM_OPERATION+PROCESS_VM_READ+PROCESS_VM_WRITE+PROCESS_QUERY_INFORMATION,0,[Pid] test eax,eax je InjectDll_exit invoke VirtualAllocEx,0,0,0,0,0 invoke WriteProcessMemory,0,0,0, 0, NULL invoke CreateRemoteThread,0,0,0,0,0,0,0 InjectDll_exit: ret endp in C Code: extern void InjectDll(DWORD,WCHAR*); i'm really sorry, i cant post my code here, this is law of my group |
|||
24 May 2012, 10:21 |
|
revolution 24 May 2012, 12:02
It could be the underscore thing: extrn '_Sleep' as Sleep:dword
Or perhaps: extrn '_Sleep@4' as Sleep:dword Or some other name mangling. |
|||
24 May 2012, 12:02 |
|
SFeLi 24 May 2012, 16:57
Code: extrn '_LoadLibraryW@4' as LoadLibraryW:dword extrn '_WriteProcessMemory@20' as WriteProcessMemory:dword extrn '_CreateRemoteThread@28' as CreateRemoteThread:dword extrn '_Sleep@4' as Sleep:dword extrn '_VirtualAllocEx@20' as VirtualAllocEx:dword extrn '_OpenProcess@12' as OpenProcess:dword public InjectDll as '_InjectDll@8' ; Link with ld asm.obj whatever.else.o -lkernel32 |
|||
24 May 2012, 16:57 |
|
MinhHung 25 May 2012, 09:38
Thanks...
|
|||
25 May 2012, 09:38 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.