Click to See Complete Forum and Search --> : [RESOLVED] Embed .dll files inside .exe file
mday2792
May 8th, 2008, 10:53 AM
How would I go about embeding .dll files that are being used by my .exe, inside the .exe file?
mendhak
May 8th, 2008, 02:17 PM
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?
dilettante
May 8th, 2008, 03:39 PM
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.
randem
May 9th, 2008, 03:30 AM
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.
mday2792
May 9th, 2008, 06:45 AM
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.
Hack
May 9th, 2008, 08:12 AM
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.
killer7k
May 9th, 2008, 03:15 PM
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
Kasracer
May 14th, 2008, 10:26 AM
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.
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.
mendhak
May 14th, 2008, 03:02 PM
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.
dilettante
May 15th, 2008, 05:38 AM
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.
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!
mday2792
May 15th, 2008, 06:54 AM
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/mergingassemblies.aspx
Kasracer
May 15th, 2008, 08:33 AM
So far i haven't seen him say this is .net though.
Hence the If ;)
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.
I found this product from Microsoft called ILMerge. It works for what I am looking to do.
http://www.codeproject.com/KB/dotnet/mergingassemblies.aspx
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.
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.