flat assembler
Message board for the users of flat assembler.
Index
> Windows > Cannot load DLL written in FASM |
Author |
|
MSWarrior 31 Jan 2011, 11:47
I think that you must have at least one function imported for the DLL to work.
Try to create import section with just one function and see if it works. |
|||
31 Jan 2011, 11:47 |
|
revolution 31 Jan 2011, 11:49
The DLL opens fine with OllyDbg under WinXPSP2. Perhaps something is different/wrong with C++.NET?
|
|||
31 Jan 2011, 11:49 |
|
abc101 31 Jan 2011, 11:55
Quote: I think that you must have at least one function imported for the DLL to work. Well, when I added an API call, everything became OK: Code: format PE DLL entry DllEntryPoint include "win32a.inc" section ".code" code readable executable proc DllEntryPoint hDll:DWORD, reason:DWORD, reserved:DWORD mov eax,TRUE ret endp proc SampleProc invoke GetLastError mov eax, 5 ret endp section ".idata" import readable writable library kernel32,"KERNEL32.DLL",\ user32,"USER32.DLL" include "api\kernel32.inc" include "api\user32.inc" section ".edata" export readable writable export "Example.DLL",\ SampleProc,"SampleProc" section '.reloc' fixups data discardable But this "invoke GetLastError" is senseless and it makes the program slow. |
|||
31 Jan 2011, 11:55 |
|
revolution 31 Jan 2011, 11:59
abc101 wrote: But this "invoke GetLastError" is senseless ... |
|||
31 Jan 2011, 11:59 |
|
abc101 31 Jan 2011, 11:59
Quote: The DLL opens fine with OllyDbg under WinXPSP2. Perhaps something is different/wrong with C++.NET? C++ works correctly. I tried to write the same DLL in MASM and C++ loaded it successfully. |
|||
31 Jan 2011, 11:59 |
|
revolution 31 Jan 2011, 12:00
abc101 wrote: C++ works correctly. I tried to write the same DLL in MASM and C++ loaded it successfully. |
|||
31 Jan 2011, 12:00 |
|
abc101 31 Jan 2011, 12:05
Quote:
There's 2 sections only in the MASM DLL: ".text" and ".rdata". No ".reloc", ".idata" or something else. |
|||
31 Jan 2011, 12:05 |
|
revolution 31 Jan 2011, 12:09
I don't know the reason. But if you are worried about speed problems you can do this:
Code: ;... proc DllEntryPoint hDll:DWORD, reason:DWORD, reserved:DWORD mov eax,TRUE ret invoke GetLastError endp proc SampleProc mov eax, 5 ret endp ;... |
|||
31 Jan 2011, 12:09 |
|
abc101 31 Jan 2011, 12:25
Quote:
It really works. Maybe it's not exactly what I wanted, but thanks anyway. |
|||
31 Jan 2011, 12:25 |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.