flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
AsmGuru62 06 Dec 2011, 21:09
In FASM EXAMPLES folder (if I recall) there must be code sample for building a DLL.
|
|||
![]() |
|
Overflowz 06 Dec 2011, 21:51
Simple DLL with exports only.
Code: format PE GUI 4.0 DLL include 'WIN32AX.INC' section '.text' code readable executable myfunction1: some code here. ret myfunction2: another code here. ret section '.edata' export data readable export '',myfunction1,'myfunction1',\ myfunction2,'myfunction2' section '.reloc' fixups data readable discardable This DLL will have 2 exports with names myfunction1 and myfunction2. Simple right ? ![]() |
|||
![]() |
|
Crinan 06 Dec 2011, 22:28
Overflowz, thanks. That's a start anyway! I'll try to use it somehow.
Amsguru62, I've already looked at the examples but cannot find anthing on this subject. |
|||
![]() |
|
AsmGuru62 07 Dec 2011, 15:09
Strange... this is what I got in my FASM EXAMPLES folder:
Code: ; --- THIS IS DLL CODE ITSELF --- ; ; DLL creation example ; format PE GUI 4.0 DLL entry DllEntryPoint include 'win32a.inc' section '.text' code readable executable proc DllEntryPoint hinstDLL,fdwReason,lpvReserved mov eax,TRUE ret endp ; VOID ShowErrorMessage(HWND hWnd,DWORD dwError); proc ShowErrorMessage hWnd,dwError local lpBuffer:DWORD lea eax,[lpBuffer] invoke FormatMessage,FORMAT_MESSAGE_ALLOCATE_BUFFER+FORMAT_MESSAGE_FROM_SYSTEM,0,[dwError],LANG_NEUTRAL,eax,0,0 invoke MessageBox,[hWnd],[lpBuffer],NULL,MB_ICONERROR+MB_OK invoke LocalFree,[lpBuffer] ret endp ; VOID ShowLastError(HWND hWnd); proc ShowLastError hWnd invoke GetLastError stdcall ShowErrorMessage,[hWnd],eax ret endp section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ user,'USER32.DLL' import kernel,\ GetLastError,'GetLastError',\ SetLastError,'SetLastError',\ FormatMessage,'FormatMessageA',\ LocalFree,'LocalFree' import user,\ MessageBox,'MessageBoxA' section '.edata' export data readable export 'ERRORMSG.DLL',\ ShowErrorMessage,'ShowErrorMessage',\ ShowLastError,'ShowLastError' section '.reloc' fixups data discardable And this is an example of an EXE which uses this DLL: Code: format PE GUI 4.0 entry start include 'win32a.inc' section '.text' code readable executable start: invoke ShowLastError,HWND_DESKTOP invoke ExitProcess,0 section '.idata' import data readable writeable library kernel,'KERNEL32.DLL',\ errormsg,'ERRORMSG.DLL' import kernel,\ ExitProcess,'ExitProcess' import errormsg,\ ShowLastError,'ShowLastError' |
|||
![]() |
|
Crinan 07 Dec 2011, 19:34
Oops, my mistake!
I was looking in flatassembler.net/examples, and didn't think of looking in fasm examples. How stupid is that? (No reply required) |
|||
![]() |
|
DOS386 12 Dec 2011, 02:02
> How stupid is that?
I don't know. > No reply required http://board.flatassembler.net/topic.php?t=11170 "DeLL HeLL" |
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2023, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.