Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. How to delete exe/dll file from itself?

How to delete exe/dll file from itself?

Scheduled Pinned Locked Moved Visual Basic
questioncsharptutorial
29 Posts 5 Posters 13 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A AndrewPeters

    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

    I Offline
    I Offline
    Iftikhar Ali
    wrote on last edited by
    #16

    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

    1 Reply Last reply
    0
    • I 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

      S Offline
      S Offline
      Steve Pullan
      wrote on last edited by
      #17

      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 :-)

      I 1 Reply Last reply
      0
      • S Steve Pullan

        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 :-)

        I Offline
        I Offline
        Iftikhar Ali
        wrote on last edited by
        #18

        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

        S 1 Reply Last reply
        0
        • I 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

          D Offline
          D Offline
          Dave Kreskowiak
          wrote on last edited by
          #19

          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

          I 1 Reply Last reply
          0
          • I Iftikhar Ali

            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

            D Offline
            D Offline
            Dave Kreskowiak
            wrote on last edited by
            #20

            A right? Maybe. Practical from a developers perspective? Definitly not... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

            I 1 Reply Last reply
            0
            • I Iftikhar Ali

              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

              S Offline
              S Offline
              Steve Pullan
              wrote on last edited by
              #21

              Iftikhar Ali wrote:

              Yeah I know how it works.

              Great!

              Iftikhar Ali wrote:

              But will you please tell me how to make a dll which when load detect whether its legal or not. Tell me

              Uhhh.... you tell me :-) I'm not being a smart-arse here, it's just that YOU are the one who knows the method by which you are authorizing the use of your DLL. I's not up to me to provide this.

              Iftikhar Ali wrote:

              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")

              I'm not sure I understand what you mean. Please elaborate. As for the DLL coding, this is covered in many places and there are a few references on the Code Project articles section as well as Microsoft's MSDN website. ...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 1 Reply Last reply
              0
              • I Iftikhar Ali

                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

                D Offline
                D Offline
                Dave Kreskowiak
                wrote on last edited by
                #22

                And if there is a problem with the users authentication? Boom! Too late to fix it... Better hang up the phone to tech support and reinstall the app...again. This situation is no different than any other IP issue every developer on the planet faces. There is a reason why no other developer on the planet is doing this. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                I 1 Reply Last reply
                0
                • D Dave Kreskowiak

                  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

                  I Offline
                  I Offline
                  Iftikhar Ali
                  wrote on last edited by
                  #23

                  Sorry, but I didn't remember the link and I use two VB.NET forums & MSDN so it is difficult for me to remember. I think it is on MSDN. But its possible. Maybe you don't know it. Iftikhar Ali

                  1 Reply Last reply
                  0
                  • D Dave Kreskowiak

                    A right? Maybe. Practical from a developers perspective? Definitly not... RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                    I Offline
                    I Offline
                    Iftikhar Ali
                    wrote on last edited by
                    #24

                    I don't want anybody (Ofcourse except me) to use my dll. Its clear now. Now tell me what should I do? (With professional look) Iftikhar Ali

                    S 1 Reply Last reply
                    0
                    • D Dave Kreskowiak

                      And if there is a problem with the users authentication? Boom! Too late to fix it... Better hang up the phone to tech support and reinstall the app...again. This situation is no different than any other IP issue every developer on the planet faces. There is a reason why no other developer on the planet is doing this. RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome

                      I Offline
                      I Offline
                      Iftikhar Ali
                      wrote on last edited by
                      #25

                      OK! I stick to this approach of not processing any unauthorised request. Is it OK? Iftikhar Ali

                      1 Reply Last reply
                      0
                      • S Steve Pullan

                        Iftikhar Ali wrote:

                        Yeah I know how it works.

                        Great!

                        Iftikhar Ali wrote:

                        But will you please tell me how to make a dll which when load detect whether its legal or not. Tell me

                        Uhhh.... you tell me :-) I'm not being a smart-arse here, it's just that YOU are the one who knows the method by which you are authorizing the use of your DLL. I's not up to me to provide this.

                        Iftikhar Ali wrote:

                        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")

                        I'm not sure I understand what you mean. Please elaborate. As for the DLL coding, this is covered in many places and there are a few references on the Code Project articles section as well as Microsoft's MSDN website. ...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 Offline
                        I Offline
                        Iftikhar Ali
                        wrote on last edited by
                        #26

                        Steve Pullan wrote:

                        As for the DLL coding, this is covered in many places and there are a few references on the Code Project articles section as well as Microsoft's MSDN website.

                        I will goto MSDN and search there, nonetheless Thanx for all suggestions. Iftikhar Ali

                        1 Reply Last reply
                        0
                        • J Jeeva Jose

                          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 Offline
                          I Offline
                          Iftikhar Ali
                          wrote on last edited by
                          #27

                          How to use kill() in any dll. Give example with coding of any dummy dll. Iftikhar Ali

                          1 Reply Last reply
                          0
                          • I Iftikhar Ali

                            I don't want anybody (Ofcourse except me) to use my dll. Its clear now. Now tell me what should I do? (With professional look) Iftikhar Ali

                            S Offline
                            S Offline
                            Steve Pullan
                            wrote on last edited by
                            #28

                            Iftikhar Ali wrote:

                            I don't want anybody (Ofcourse except me) to use my dll.

                            Just look at how Microsoft (or ANY developer for that matter) has had code pirated over the years. You can only do so much before it becomes too hard and impractical.

                            Iftikhar Ali wrote:

                            Now tell me what should I do?

                            Rather demanding aren't you? Just do what we've been advising you to do and that's do a check when your DLL is loaded and then return nothing from any method/property call. There's nothing difficult about this. Follow the leads we have given you and do some research. If you have a problem with a bit of code you have written, we will certainly have a look and advise what to do, but we will not write it for you.

                            Iftikhar Ali wrote:

                            (With professional look)

                            :cool: ...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 1 Reply Last reply
                            0
                            • S Steve Pullan

                              Iftikhar Ali wrote:

                              I don't want anybody (Ofcourse except me) to use my dll.

                              Just look at how Microsoft (or ANY developer for that matter) has had code pirated over the years. You can only do so much before it becomes too hard and impractical.

                              Iftikhar Ali wrote:

                              Now tell me what should I do?

                              Rather demanding aren't you? Just do what we've been advising you to do and that's do a check when your DLL is loaded and then return nothing from any method/property call. There's nothing difficult about this. Follow the leads we have given you and do some research. If you have a problem with a bit of code you have written, we will certainly have a look and advise what to do, but we will not write it for you.

                              Iftikhar Ali wrote:

                              (With professional look)

                              :cool: ...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 Offline
                              I Offline
                              Iftikhar Ali
                              wrote on last edited by
                              #29

                              Steve Pullan wrote:

                              Just do what we've been advising you to do and that's do a check when your DLL is loaded and then return nothing from any method/property call.

                              OK, I'll stuck with this. I'm only demanding this because I read on MSDN that you can update an exe from within it. Thanx (EVERYBODY) Goodbye Iftikhar Ali

                              1 Reply Last reply
                              0
                              Reply
                              • Reply as topic
                              Log in to reply
                              • Oldest to Newest
                              • Newest to Oldest
                              • Most Votes


                              • Login

                              • Don't have an account? Register

                              • Login or register to search.
                              • First post
                                Last post
                              0
                              • Categories
                              • Recent
                              • Tags
                              • Popular
                              • World
                              • Users
                              • Groups