Does anyone know how to combine a dll and an exe and also how to access the procedures in the dll after doing so..
Posted on 2005-12-23 11:06:19 by lone_samurai5
Quite strange idea, but...

1) you can store the DLL inside the exe and extract it at runtime (save->load->use->uload->delete)
2) knowing the base of the data segment you can manually relocate the references inside the DLL, but that must be a nightmare to do :P

BTW: what's the use of it?
Posted on 2005-12-23 11:39:51 by ti_mo_n
What at just you want to do ?

Because to use a dll with MASMv8.0 it is all simple...(one uses LoadLibrary...see
Folder EXAMPLE1\DLL of MASM8.zip)

To put export function in an EXE it works well with GoAsm....

With GoAsm in asm file it is sufficient to add a line
EXPORT NAmeOfFunct

Then to compile like an EXE...

----
Gerard
Posted on 2005-12-23 11:42:16 by gerard
Yeah i guess its a strange thing to do, but i was jus wondering how i can do somethin like that.. To tell u the truth i really can't think of much use for it.. Guess i'm jus a lil curious bout strange stuff.. :P


1) you can store the DLL inside the exe and extract it at runtime (save->load->use->uload->delete)
2) knowing the base of the data segment you can manually relocate the references inside the DLL, but that must be a nightmare to do Tongue

Thanx, I'll try doin that now.. bout the 2nd point :shock:, any chance that someone has some code showin how somethin like this can be done

Gerard, I don't think u understood my question.. :|
Posted on 2005-12-23 13:03:43 by lone_samurai5
I gonna to repeat me...

With GoAsm one can export Function in an EXE file...

It is sufficient to put this line ....at the beginning of asm file....

and to complile this asm file like a normal EXE file...

File.asm

Posted on 2005-12-23 13:12:57 by gerard
Well this is what i first did, I added this to the rc file,
RCDATA DISCARDABLE "hver.dll", the dll was part of the exe. But i don't know how to use the procedures from the dll in the exe.. Any ideas???
Posted on 2005-12-23 13:32:46 by lone_samurai5
No you don't need to import the dll into resource file with GoAsm....

WITH GOASM IT IS AL  SIMPLE

When you have your Function in your EXE you have to use the following API...

LoadLibrary....and GetPrpcAddress....like you will do with a DLL...

-----
Gerard
Posted on 2005-12-23 13:37:27 by gerard
Gerard i know i can do it that way, but i wanna try doin it this way, if its possible. Oh and don't ask me why..? :P
Posted on 2005-12-23 13:52:34 by lone_samurai5
lone_samurai5,

I guess you want to have your dll mapped and initialized in the context of other process?
If so there is one way more - use hooks. You can map not only a dll but an exe also!!!
Posted on 2005-12-23 14:24:03 by k3Eahn
I guess it's called static linking, don't know much about it, but have one task for future: integrate SciLexer.dll (scintilla) into my exe file. Hope someone will be faster than me and figure this mystery out...(specifically how can this be done with masm32)...If static linking means integrate every library (including user..kernel..gdi..) into binary file, there have to be a way to integrate only one
Posted on 2005-12-23 14:32:25 by ramguru
K3eahn, How do u use hooks to map dlls or exe's? Can u temme a lil bout it or if u have some code can u post it?
Posted on 2005-12-23 14:42:45 by lone_samurai5
lone_samurai5,

You can embed DLLs to your executables :

http://www.asmcommunity.net/board/index.php?topic=22308.0
Posted on 2005-12-23 15:40:46 by Vortex
ramguru, k3Eahn, lone_samurai5:

Static linking is something different from running a DLL from inside an EXE, and this is different from mapping something in the context of other processes :P So either I don't understand something, or you guys misunderstand each other :mrgreen:

static linking is putting a binary code to an exe like an ordinary procedure. actually that's what linker does when it links different .obj files.

dynamic linking is when a dll is loaded into process' address space and its references are 'resolved' so they point to proper places (in data, for example).

if you have a binary dll inside your exe, you have to move it at some location and fix its references (a.k.a 'you have to relocate it'). then, when you jump to 1 of its functions, it will behave as desired. it's a difficult thing to do, because you have to know DLL's structure and know how to fix the references inside it. Normally you do such things when you write OSes.

Vortex: that's exactly what lone_samurai5 needs ;) (if I understood everything correctly that is :mrgreen: )
Posted on 2005-12-23 15:46:09 by ti_mo_n
All I was saying is just that I don't know much about it and hope that someone will show us the right way. Thanks Vortex, I was playing with your code earlier but I didn't realized its main purpose. Now I certainly use it!
Posted on 2005-12-23 16:16:49 by ramguru
ramguru, if there isn't a static version of scintilla, it shouldn't be too hard to recompile it for static linkage...



K3eahn, How do u use hooks to map dlls or exe's? Can u temme a lil bout it or if u have some code can u post it?

So, why do you need it? :)
Posted on 2005-12-23 16:42:27 by f0dder
f0dder, please be nice and explain what should I do :)
from scintilla doc:
;--------
Static linking

On Windows, Scintilla is normally used as a dynamic library as a .DLL file. If you want to link Scintilla directly into your application .EXE or .DLL file, then the STATIC_BUILD preprocessor symbol should be defined and Scintilla_RegisterClasses called. STATIC_BUILD prevents compiling the DllMain function which will conflict with any DllMain defined in your code. Scintilla_RegisterClasses takes the HINSTANCE of your application and ensures that the "Scintilla" window class is registered....blabla
;--------
I'm able to recompile scintilla (have MinGW etc.), I've even changed one lexer to suit my wishes. But the prob is what does it mean static linking, do I have to point an exe for dll to be linked into, or does it mean only that I'm able to include scintilla.h in other C++ like project..I'm totally new here
Posted on 2005-12-23 16:56:38 by ramguru

lone_samurai5,

You can embed DLLs to your executables :

http://www.asmcommunity.net/board/index.php?topic=22308.0

Thanx just what i was looking for... :D


So, why do you need it? :)

I'd tell u, but then i would have to kill u :P
Posted on 2005-12-24 00:24:31 by lone_samurai5