News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Creating a bin file without anyexecutable header

Started by sys64738, January 11, 2014, 02:25:32 AM

Previous topic - Next topic

sys64738

I want to write some function which I would like to include in some other code. So for this I would like to load the code directly to memory and jump there. Writing that code in a position independent manner is not the problem, but can I assemble such a file that contains only the code and what I put in there, and not any PE header?

I'm thinking of something similar to plain old COM files (I know that COM has org 0100h) but the idea is the same).

If this is not possible, do you have any suggestions how to extract the code to a bin file?

GoneFishing

see here :
JWASM->2. Commandline Options ->Option -bin: Select Output Format Binary

Gunther

Hi sys64738,

NASM and YASM can generate bin files, too.

Gunther
You have to know the facts before you can distort them.

sys64738

Thanks! So from these answers I gather, that this is not possible from MASM itself? I don't really want to install yet another assembler just for this, so what would be an alternative? Write some wrapper that simply dumps itself (or the data) to some file?

dedndave

JwAsm is free and nearly 100% compatible with masm

but, what you are trying to do is a bit fishy
why not write a DLL and load/call/unload, like the system was designed ?

Gunther

Dave,

Quote from: dedndave on January 11, 2014, 04:56:51 AM
but, what you are trying to do is a bit fishy

no it isn't. Binary files are valuable by porting code from one platform to another, for example. There's nothing wrong with that kind of files.

Gunther
You have to know the facts before you can distort them.

Tedd

Generating plain binary files can be useful..

Generating plain binary chunks with the express purpose of injecting that code into another process is a bit fishy.. and also against the rules.
Potato2

sys64738

I never said that I want to inject it into another process. I just want to create such files because I'm experimenting with it, and I wanted to know if there is some way to create such a file via the assembler.