|
-
May 8th, 2008, 10:53 AM
#1
Thread Starter
Addicted Member
[RESOLVED] Embed .dll files inside .exe file
How would I go about embeding .dll files that are being used by my .exe, inside the .exe file?
-
May 8th, 2008, 02:17 PM
#2
Re: Embed .dll files inside .exe file
You can add it to your project as an embedded resource, but this will mean that whenever the application is run, it will need to extract the DLL then dynamically load it and set the references required for it to run. Why would you want to do this?
-
May 8th, 2008, 03:39 PM
#3
Re: Embed .dll files inside .exe file
The other possible interpretation is static linking of .LIBs rather than .DLLs but VB6 doesn't support this and I'd think VB.Net is even less likely to.
There are various "pack and run" schemes out there but most people don't use them. You'd usually create some sort of installer package, even if it is little more than a self-extracting archive.
-
May 9th, 2008, 03:30 AM
#4
Re: Embed .dll files inside .exe file
That is one of the worst schemes that one can do, especially if one doesn't understand the installation process. You can overwrite good dll's with possible bad ones (out of date) as well as appearing with virus like activity. You may not install everything that is needed (more than highly likely, you won't install everything that is needed).
Just create a complete installation package and be done with it without attempting to use smoke and mirrors.
-
May 9th, 2008, 06:45 AM
#5
Thread Starter
Addicted Member
Re: Embed .dll files inside .exe file
mendhak, I am looking to do this because I am working on a code security project and didn't want someone who had Visual Studio on their machine to be able to set a reference to a .dll and use it.
If the .dlls were embedded, they would be able to do this.
-
May 9th, 2008, 08:12 AM
#6
Re: Embed .dll files inside .exe file
Simply because someone can set a reference to a DLL it doesn't mean they can use it.
In order to use it, they would have to know what it does, how it does it, and what is required in their code to utilize the code compiled in the DLL
For that, they would either need access to the source code, which the compiled DLL isn't going to give them or brib the programmer.
-
May 9th, 2008, 03:15 PM
#7
Fanatic Member
Re: Embed .dll files inside .exe file
i have asked this question before found a software called ElMerge they say that he do this things but doesnt work for me
i still search also for something about it
-
May 14th, 2008, 10:26 AM
#8
Re: Embed .dll files inside .exe file
 Originally Posted by mday2792
mendhak, I am looking to do this because I am working on a code security project and didn't want someone who had Visual Studio on their machine to be able to set a reference to a .dll and use it.
If the .dlls were embedded, they would be able to do this.
I've got news for you. If this was developed in .Net then you can reference an executable in any project as if it were a DLL. Not only that but it's insanely easy to extract data from an executable (especially if it's a resource).
What's in the DLL you don't want others referencing? It sounds like you're trying to do security through obscurity which is not security at all.
You can take a look at signing your assembilies if this is .Net which helps to prevent tampering but not usage.
 Originally Posted by Hack
Simply because someone can set a reference to a DLL it doesn't mean they can use it.
In order to use it, they would have to know what it does, how it does it, and what is required in their code to utilize the code compiled in the DLL
For that, they would either need access to the source code, which the compiled DLL isn't going to give them or brib the programmer.
If it's written in .Net then you can set a reference to any DLL, see it's methods either through reflector or intellisense and use them as per how they're made (i.e. you can tell a funciton returns a string so you test it out to see what it does).
If it's a COM Object then you can easily transverse those as well. I believe there are also applications to get exposed methods, properties, etc from native DLLs as well.
DLLs are very easy to hook into which is why they're a Dynamically Linked Library. What the OP wants to do is NOT what a DLL is meant to do.
Last edited by Kasracer; May 14th, 2008 at 10:30 AM.
-
May 14th, 2008, 03:02 PM
#9
Re: Embed .dll files inside .exe file
 Originally Posted by mday2792
mendhak, I am looking to do this because I am working on a code security project and didn't want someone who had Visual Studio on their machine to be able to set a reference to a .dll and use it.
If the .dlls were embedded, they would be able to do this.
That's not true. Anyone with Reflector and sufficient time and patience can look at it, understand that there's an assembly embedded in there somewhere and extract it, then use it. Your code will always be visible, which is why there are products to obfuscate code out there. They can make the code not-easy-for-human readable so that it's a little more difficult to understand the code, but not entirely impossible.
-
May 15th, 2008, 05:38 AM
#10
Re: Embed .dll files inside .exe file
 Originally Posted by kasracer
I've got news for you. If this was developed in .Net then you can reference an executable in any project as if it were a DLL. Not only that but it's insanely easy to extract data from an executable (especially if it's a resource).
So far i haven't seen him say this is .net though.
 Originally Posted by kasracer
DLLs are very easy to hook into which is why they're a Dynamically Linked Library. What the OP wants to do is NOT what a DLL is meant to do.
Which is why I mentioned static libraries, but this isn't a trivial matter when programming in VB6, let alone .Net!
-
May 15th, 2008, 06:54 AM
#11
Thread Starter
Addicted Member
Re: Embed .dll files inside .exe file
FYI - This is .NET
I found this product from Microsoft called ILMerge. It works for what I am looking to do.
http://www.codeproject.com/KB/dotnet...ssemblies.aspx
-
May 15th, 2008, 08:33 AM
#12
Re: Embed .dll files inside .exe file
 Originally Posted by dilettante
So far i haven't seen him say this is .net though.
Hence the If 
 Originally Posted by dilettante
Which is why I mentioned static libraries, but this isn't a trivial matter when programming in VB6, let alone .Net!
Static libraries are a great solution but only for native languages such as C or C++. Is there a way to use a static library and built it into a VB6 application? I know it's not possible in .Net but I wasn't sure about VB6.
 Originally Posted by mday2792
That only works if you have the source code since you can't use a typical assembly.
So if you already have the source code why are you not just compiling it into the exe yourself?
Also, it doesn't quite do what you wanted as once everything is merged into an executable, anyone can still reference your exe and use any public classes, methods, etc.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|