flat assembler
Message board for the users of flat assembler.

Index > Macroinstructions > Use "library" several times

Author
Thread Post new topic Reply to topic
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 07 Nov 2011, 20:42
Hi!

Is there a way to make library macro work well, if it is used several times?

======

Here's what I actually want to do.

I would like to put all the commonly used imports into separate file, like this:

Code:
library kernel32, 'kernel32.dll',\
gdi32, 'gdi32.dll',\
user32, 'user32.dll'

include 'api\kernel32.inc'
include 'api\gdi32.inc'
include 'api\user32.inc'
    


Then I would like to write a program, which uses some other DLLs like this:

Code:
format PE GUI 4.0
...
include 'MyImportIncludes.inc'

library OtherLib, 'OtherLib.dll'
include 'OtherLib.inc'
    


Is there a way to do this?

Thanks.
Post 07 Nov 2011, 20:42
View user's profile Send private message Visit poster's website Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20430
Location: In your JS exploiting you and your system
revolution 07 Nov 2011, 20:45
Search the board for LibraryOnce.
Post 07 Nov 2011, 20:45
View user's profile Send private message Visit poster's website Reply with quote
DimonSoft



Joined: 03 Mar 2010
Posts: 1228
Location: Belarus
DimonSoft 08 Nov 2011, 09:47
revolution wrote:
Search the board for LibraryOnce.

Thanks for you reply, but this doesn't seem to be the thing I need. Alas, libraryonce has the same problem as original library.

Code:
; ...Some source code here...

section '.idata' import data readable writeable

libraryonce kernel32, 'kernel32.dll', 'api\kernel232.inc'
libraryonce myDLL, 'myDLL.dll', 'myapi\mydll.inc'

  put_library_table
  put_import_lookups
  put_library_names
  put_import_names

; ...Rest of the source code...
    


So, it compiles well, but when you look at the executable, you'll see that the import section contains items only for the first libraryonce macro. And when an application tries to invoke some function from myDLL.dll, there's a wrong address and the application crashes.

I'm not good at FASM macros, but it seems it should work, shouldn't it? Are there any additional dependencies I have to keep in mind?
Post 08 Nov 2011, 09:47
View user's profile Send private message Visit poster's website Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2024, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.