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?
see here (http://japheth.de/) :
JWASM->2. Commandline Options ->Option -bin: Select Output Format Binary
Hi sys64738,
NASM and YASM can generate bin files, too.
Gunther
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?
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 ?
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
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.
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.