How to delete exe/dll file from itself?
-
I have developed a class and built dll (Dynamic Link Library). I have a mechanism in this dll to detect whether the user (programmer) of this dll is authorised to use this dll in his own programs or not. Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime (Complicated, deleting itself). Please tell me how can I delete this dll in VB.NET 2003. Thanx Iftikhar Ali http://www.itajtech.net.tc
-
I have developed a class and built dll (Dynamic Link Library). I have a mechanism in this dll to detect whether the user (programmer) of this dll is authorised to use this dll in his own programs or not. Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime (Complicated, deleting itself). Please tell me how can I delete this dll in VB.NET 2003. Thanx Iftikhar Ali http://www.itajtech.net.tc
The method is very easy to delete the file.What is ur real purpose. That time I can help u. u can use the file delete method ( Please use this function kill() ) Continue...
-
I have developed a class and built dll (Dynamic Link Library). I have a mechanism in this dll to detect whether the user (programmer) of this dll is authorised to use this dll in his own programs or not. Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime (Complicated, deleting itself). Please tell me how can I delete this dll in VB.NET 2003. Thanx Iftikhar Ali http://www.itajtech.net.tc
Iftikhar Ali wrote:
Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime
A better method would simply be to not process any requests for methods/properties on your class. Self-destructing is not a very friendly way to do things, besides, your DLL will be in use and cannot be deleted. All locks must first be released. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)
-
I have developed a class and built dll (Dynamic Link Library). I have a mechanism in this dll to detect whether the user (programmer) of this dll is authorised to use this dll in his own programs or not. Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime (Complicated, deleting itself). Please tell me how can I delete this dll in VB.NET 2003. Thanx Iftikhar Ali http://www.itajtech.net.tc
You can't delete the .DLL while it's loaded into a process, period. There's no way around this. If your code was it's own .EXE, that's a different story, but a .DLL has no chance of deleting itself. Since you already have the mechanism to determine if the user is authorized, it's simple. On each of your method calls, or just the very important ones, run your check or check a flag that your authorization code sets, and return nothing if that check fails. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
You can't delete the .DLL while it's loaded into a process, period. There's no way around this. If your code was it's own .EXE, that's a different story, but a .DLL has no chance of deleting itself. Since you already have the mechanism to determine if the user is authorized, it's simple. On each of your method calls, or just the very important ones, run your check or check a flag that your authorization code sets, and return nothing if that check fails. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
If you load the dll from another assembly into its own AppDomain, you can turn Shadow Copying on. Shadow copying copies the dll to a temp directory. This would obfuscate the location of the DLL once you've self-destructed, but you'd still have the DLL floating around in the temp dir.
-
If you load the dll from another assembly into its own AppDomain, you can turn Shadow Copying on. Shadow copying copies the dll to a temp directory. This would obfuscate the location of the DLL once you've self-destructed, but you'd still have the DLL floating around in the temp dir.
Yep, that's true, and I think the point of his "security feature" is to remove all traces of the .DLL, so that wouldn't work for him. Why on earth you would want to do something like this "feature" is beyond me... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Yep, that's true, and I think the point of his "security feature" is to remove all traces of the .DLL, so that wouldn't work for him. Why on earth you would want to do something like this "feature" is beyond me... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Look at codesecurity, obfuscation and authenticating to a server. Probably the best way to keep your users from continuing to use your DLL is by generating a key that is generated from machine specific (BIOS) values, having them send it to you, and then you sending a 'public key' back. The other way is to authenticate every call to your server, but this would only work well for DLLs that already talk to networks outside its own. Ultimately, unless you are writing code that unlocks the keys of the universe, you're best off obfuscating your code and using simple time countdown techniques. :) Andrew
-
Look at codesecurity, obfuscation and authenticating to a server. Probably the best way to keep your users from continuing to use your DLL is by generating a key that is generated from machine specific (BIOS) values, having them send it to you, and then you sending a 'public key' back. The other way is to authenticate every call to your server, but this would only work well for DLLs that already talk to networks outside its own. Ultimately, unless you are writing code that unlocks the keys of the universe, you're best off obfuscating your code and using simple time countdown techniques. :) Andrew
Don't tell me! Tell the OP! He's the one that wants to do this, not me! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Don't tell me! Tell the OP! He's the one that wants to do this, not me! RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
You need to get your OP to start reading this forum and get him to realize that you can't put together ghastly hacks like this. Your users will resent you (see Sony's fiasco with its copy protection trojan) and developers will not respect you. This is something that many technology managers fail to think about, the code that they represent. Many of them seem to think that all of their problems are outside of the code. Andrew Peters
-
The method is very easy to delete the file.What is ur real purpose. That time I can help u. u can use the file delete method ( Please use this function kill() ) Continue...
My purpose is: If the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime. I have developed a program whose core functionality is in this dll. Now anybody can use this dll to make a software like mine, I want to restrict anybody (except me) to use this file. Now tell me what you think of my situation? Please tell me with coding. Iftikhar Ali
-
Iftikhar Ali wrote:
Now if the user is not authorised to use this dll, i want to delete this dll from the code within this dll in runtime
A better method would simply be to not process any requests for methods/properties on your class. Self-destructing is not a very friendly way to do things, besides, your DLL will be in use and cannot be deleted. All locks must first be released. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)
As far as I know somebody post an article of Update exe from within the code of same exe. So I think it is possible, but I'm at present on the same side as you suggested, ie. not to process any information. [Give reply with code PLEASE!] Iftikhar
-
You can't delete the .DLL while it's loaded into a process, period. There's no way around this. If your code was it's own .EXE, that's a different story, but a .DLL has no chance of deleting itself. Since you already have the mechanism to determine if the user is authorized, it's simple. On each of your method calls, or just the very important ones, run your check or check a flag that your authorization code sets, and return nothing if that check fails. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Dave Kreskowiak wrote:
You can't delete the .DLL while it's loaded into a process, period. There's no way around this.
As far as I know somebody post an article of Update exe from within the code of same exe. So I think it is possible. Iftikhar Ali
-
If you load the dll from another assembly into its own AppDomain, you can turn Shadow Copying on. Shadow copying copies the dll to a temp directory. This would obfuscate the location of the DLL once you've self-destructed, but you'd still have the DLL floating around in the temp dir.
Please tell me this in detail (Since I'm not CHEETAH in VB.NET) with coding. I think after going through your process, the best way is that delete (empty) temp files folder. Is this possible? Iftikhar Ali
-
Yep, that's true, and I think the point of his "security feature" is to remove all traces of the .DLL, so that wouldn't work for him. Why on earth you would want to do something like this "feature" is beyond me... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
Just to make my dll more secure and destroying the software (its base) of that illegal user. What you think? I think its a right of every programmer. Iftikhar Ali
-
Look at codesecurity, obfuscation and authenticating to a server. Probably the best way to keep your users from continuing to use your DLL is by generating a key that is generated from machine specific (BIOS) values, having them send it to you, and then you sending a 'public key' back. The other way is to authenticate every call to your server, but this would only work well for DLLs that already talk to networks outside its own. Ultimately, unless you are writing code that unlocks the keys of the universe, you're best off obfuscating your code and using simple time countdown techniques. :) Andrew
AndrewPeters wrote:
Look at codesecurity, obfuscation and authenticating to a server. Probably the best way to keep your users from continuing to use your DLL is by generating a key that is generated from machine specific (BIOS) values, having them send it to you, and then you sending a 'public key' back.
Tell me about this in detail, PLEASE! with coding.
AndrewPeters wrote:
Ultimately, unless you are writing code that unlocks the keys of the universe, you're best off obfuscating your code and using simple time countdown techniques.
Whats countdown techniques, please tell me in detail. Iftikhar Ali
-
You need to get your OP to start reading this forum and get him to realize that you can't put together ghastly hacks like this. Your users will resent you (see Sony's fiasco with its copy protection trojan) and developers will not respect you. This is something that many technology managers fail to think about, the code that they represent. Many of them seem to think that all of their problems are outside of the code. Andrew Peters
Yeah I know that. But from deep within my heart, I think why any unauthorised programmer can make the same program like mine with my dll. I want destroy the very basis of that illegal program by deleting my own dll. I have no intention of selling or giving that dll, so the matter of "developers will not respect me" is over right here. Iftikhar Ali
-
As far as I know somebody post an article of Update exe from within the code of same exe. So I think it is possible, but I'm at present on the same side as you suggested, ie. not to process any information. [Give reply with code PLEASE!] Iftikhar
Iftikhar Ali wrote:
I'm at present on the same side as you suggested, ie. not to process any information.
Excellent decision!
Iftikhar Ali wrote:
[Give reply with code PLEASE!]
This is very simple. You should be able to work this out on your own. Just detect whether or not the caller is authorized either on each method/property call or a global variable set during such detection at DLL load time and accept or deny the action accordingly. Dave K. has already stated this in a separate reply to your original post. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)
-
Iftikhar Ali wrote:
I'm at present on the same side as you suggested, ie. not to process any information.
Excellent decision!
Iftikhar Ali wrote:
[Give reply with code PLEASE!]
This is very simple. You should be able to work this out on your own. Just detect whether or not the caller is authorized either on each method/property call or a global variable set during such detection at DLL load time and accept or deny the action accordingly. Dave K. has already stated this in a separate reply to your original post. ...Steve "Give a man a fish and you've fed him for a day. Teach him how to fish and you've fed him for life." (Translation: I'll show you the way, but not write the code for you.) I read that somewhere once :-)
Yeah I know how it works. But will you please tell me how to make a dll which when load detect whether its legal or not. Tell me Dim myClass1 as new myClass(???) how can i get some string or anything right when my class is initialize as above, in place of ??? like this Dim myClass1 as new myClass("XYZ") Thanx Iftikhar Ali
-
Dave Kreskowiak wrote:
You can't delete the .DLL while it's loaded into a process, period. There's no way around this.
As far as I know somebody post an article of Update exe from within the code of same exe. So I think it is possible. Iftikhar Ali
Supply the link to article. I think you're mis-understanding what it says, because you cannot overwrit a file that is locked by another process, or your own process for that matter. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
Just to make my dll more secure and destroying the software (its base) of that illegal user. What you think? I think its a right of every programmer. Iftikhar Ali
A right? Maybe. Practical from a developers perspective? Definitly not... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome