Hi, my app uses some functions from a dll, but I want this app to be created by my app at runtime(don't ask why, just for fun with the createfile,writefile etc APIs).
How can I put the hex data of my dll inside the asm file so that it can be written(as buffer) with the writefile API?
Thanks :D
Posted on 2005-08-16 04:49:51 by falcon1
Check out some app called Bin2Db in your Masm32 folder.
Posted on 2005-08-16 05:45:21 by JimmyClif
Falcon,

You have another option in MASM32 if you have installed the latest service pack, it has a utility that creates a seperate object module from any file you like that you can link into a normal 32 bit executable. The utility is called FDA.EXE and it is in the exampl12 directory in the latest service pack. I have tested it on very large files (many megabytes) and it works fine. It supports long data names and you have the option to set the alignment of the data in the object module as well.

You must still know the file length for write purposes and you use the EXTERNDEF masm synax to make the data visible to your own code.

If I remember correctly its like this,


  EXTERNDEF MyDataFile:DWORD


Where MyDataFile is the name you set with FDA.EXE.
Then you can use OFFSET MyDataFile and it should work corectly.

Regards,

hutch at movsd dot com
Posted on 2005-08-16 06:29:57 by hutch--
...or by your own:
- include the raw data as resource (nice if you want to change the raw data even after the compilation)
- include the raw data in your source, using Dropthis db ... .... i would use some scripting on that...
? add a variable like "DropLength" and then CreateFile, WriteFile, CloseFile, LoadLibrary, GetProcAddress it ... :)

With standalone applications I prefer to have ONE executable, so what I do is I create a separated *.inc file on
each of my libraries, which holds the procedures.

From a technical point of view I think the greatest way would be In-memory execution (is that the name!?), where
you load your library from memory. This way you could add the lib as variable Dropthis / DropLength and directly
load it from there, using two procedures that act similar to LoadLibrary/GetProcAddress but must be applied on
memory instead of a file.  If you are interested in this technique i'll post code...
Dominik
Posted on 2005-08-16 07:43:05 by Dom

Hi, my app uses some functions from a dll, but I want this app to be created by my app at runtime(don't ask why, just for fun with the createfile,writefile etc APIs).
How can I put the hex data of my dll inside the asm file so that it can be written(as buffer) with the writefile API?
Thanks :D


I have wrote a tool for this mabye you can find it useful
http://www.lilljockeprogs.webb.se  the program name is db Tool.
Posted on 2005-08-16 12:36:52 by lilljocke