flat assembler
Message board for the users of flat assembler.

Index > Windows > MSCOFF: A few questions

Author
Thread Post new topic Reply to topic
Thaorius



Joined: 27 Jul 2006
Posts: 42
Thaorius 24 Aug 2009, 06:36
Hi, I'm building a program on which I'm going to have a main source file, a few 3rd party MSCOFF files for which I do not have a source(hence, the need to use MSCOFF + polink) and, since I'm already using MSCOFF, I figured, why not make most the source base like low-level plugins; meaning, I just have a main source file, which includes a 'plugins.inc', file which would simply list all the "plugins" and call an startup function on all of them, this would in turn cause the plugins to register themselves within the application's "managers".

Doubts, following the MSCOFF example on FASM, I've got this bare bones source:
Code:
format MS COFF

include '../../include/win32a.inc'
extrn '__imp__MessageBoxA@16' as MessageBox:dword

section '.text' code readable executable

 public start as "main"

 start:
       invoke MessageBox,0,_message,_caption,0
     ret

section '.data' data readable writeable

 _caption db 'Coff Coff',0
 _message db 'Coffee time!',0    


This, once assembled would be, say, main.obj; and I would link it with:
Code:
polink /SUBSYSTEM:WINDOWS /NODEFAULTLIB /ENTRY:main /RELEASE /OPT:NOWIN98 main.obj kernel32.lib user32.lib    

So, what would be the structure of the other "plugin" .obj files? I mean, same sections and stuff? If so, will all those code and data sections merge in the final executable? I do not want to have an executable bloated with sections all over it ( as a matter of fact, since I'm programming in ASM, I want things to be as small and fast as inhumanly possible). If not, can you post an small example of what the other MSCOFF files would look like?

Thanks for you time.
Post 24 Aug 2009, 06:36
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
revolution
When all else fails, read the source


Joined: 24 Aug 2004
Posts: 20451
Location: In your JS exploiting you and your system
revolution 24 Aug 2009, 07:30
The other "plugins" should all be the same structure. The linker's job is to merge all sections that are named and aligned in similar ways. The linker won't change your optimised code, it will just slot it into the proper place amongst the other code and data.
Post 24 Aug 2009, 07:30
View user's profile Send private message Visit poster's website Reply with quote
Thaorius



Joined: 27 Jul 2006
Posts: 42
Thaorius 24 Aug 2009, 21:30
Great, thanks. I began the testing round, so far so good.
Post 24 Aug 2009, 21:30
View user's profile Send private message Visit poster's website MSN Messenger 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.