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. C / C++ / MFC
  4. Terminating explorer.exe

Terminating explorer.exe

Scheduled Pinned Locked Moved C / C++ / MFC
question
8 Posts 3 Posters 2 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.
  • H Offline
    H Offline
    hxhl95
    wrote on last edited by
    #1

    Hello all, I really must be missing something here, as all my attempts to terminate explorer.exe all end up with it restarting. I am calling TerminateProcess on explorer.exe, and the call IS working. However, explorer.exe just ends up starting up again. But when I terminate explorer.exe from taskmgr, it doesn't restart. Why is this happening? And how can I prevent the restarting? Thanks in advance. :)

    K H 2 Replies Last reply
    0
    • H hxhl95

      Hello all, I really must be missing something here, as all my attempts to terminate explorer.exe all end up with it restarting. I am calling TerminateProcess on explorer.exe, and the call IS working. However, explorer.exe just ends up starting up again. But when I terminate explorer.exe from taskmgr, it doesn't restart. Why is this happening? And how can I prevent the restarting? Thanks in advance. :)

      K Offline
      K Offline
      Kenny McKee
      wrote on last edited by
      #2

      Um...Just for the record, terminating explorer.exe is generally not a good thing. And keeping it from restarting is even worse! explorer.exe is basically the user-interface part of Windows. If it is terminated, it will keep the end user from using the taskbar and desktop icons while ticking him/her off. And if it doesn't restart, the end-user will have to manually start it again. That being said, I will now try and answer your question. Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down. If anyone knows how to keep it from restarting, I highly doubt that they will tell you. Leave explorer.exe to Microsoft.

      Come on! Get down with the sickness! - Disturbed

      H 1 Reply Last reply
      0
      • K Kenny McKee

        Um...Just for the record, terminating explorer.exe is generally not a good thing. And keeping it from restarting is even worse! explorer.exe is basically the user-interface part of Windows. If it is terminated, it will keep the end user from using the taskbar and desktop icons while ticking him/her off. And if it doesn't restart, the end-user will have to manually start it again. That being said, I will now try and answer your question. Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down. If anyone knows how to keep it from restarting, I highly doubt that they will tell you. Leave explorer.exe to Microsoft.

        Come on! Get down with the sickness! - Disturbed

        H Offline
        H Offline
        hxhl95
        wrote on last edited by
        #3

        I know very well what I am doing by terminating explorer.exe, and I can assure you I have a good enough reason to be doing it. ;P

        Kenny McKee wrote:

        Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down.

        How exactly does taskmgr manage to kill explorer?

        K 1 Reply Last reply
        0
        • H hxhl95

          I know very well what I am doing by terminating explorer.exe, and I can assure you I have a good enough reason to be doing it. ;P

          Kenny McKee wrote:

          Windows is programmed to restart explorer.exe when it is terminated by any means other than shutting down.

          How exactly does taskmgr manage to kill explorer?

          K Offline
          K Offline
          Kenny McKee
          wrote on last edited by
          #4

          It appears as though the required functions to do this are part of the OS, and can't be used based on this forum[^]. That is what I gather anyway. I didn't mean to make it appear as though I was insulting your intelligence. I just wanted to be sure that you knew the dangers. :-O

          How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...

          H 1 Reply Last reply
          0
          • H hxhl95

            Hello all, I really must be missing something here, as all my attempts to terminate explorer.exe all end up with it restarting. I am calling TerminateProcess on explorer.exe, and the call IS working. However, explorer.exe just ends up starting up again. But when I terminate explorer.exe from taskmgr, it doesn't restart. Why is this happening? And how can I prevent the restarting? Thanks in advance. :)

            H Offline
            H Offline
            Hamid Taebi
            wrote on last edited by
            #5

            First TerminateProcess is not good way for close a program why? MSDN: All object handles opened by the process are closed. All threads in the process terminate their execution. The state of the process object becomes signaled, satisfying threads waiting for the process to terminate. The states of all threads of the process become signaled, satisfying threads waiting for the threads to terminate. The termination status of the process changes from STILL_ACTIVE to the exit value of the process. Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed.

            Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

            H 1 Reply Last reply
            0
            • H Hamid Taebi

              First TerminateProcess is not good way for close a program why? MSDN: All object handles opened by the process are closed. All threads in the process terminate their execution. The state of the process object becomes signaled, satisfying threads waiting for the process to terminate. The states of all threads of the process become signaled, satisfying threads waiting for the threads to terminate. The termination status of the process changes from STILL_ACTIVE to the exit value of the process. Terminating a process does not necessarily remove the process object from the system. A process object is deleted when the last handle to the process is closed.

              Of one Essence is the human race thus has Creation put the base One Limb impacted is sufficient For all Others to feel the Mace (Saadi )

              H Offline
              H Offline
              hxhl95
              wrote on last edited by
              #6

              Thanks for your reply Hamid. I can assure you that TerminateProcess will be my last resort in attempting to kill explorer ;P The thing is, I don't want to send a WM_CLOSE message to explorer.exe, as that brings up the Windows shutdown prompt. Is there any other way I can exit explorer.exe, excluding "tskill explorer"?

              1 Reply Last reply
              0
              • K Kenny McKee

                It appears as though the required functions to do this are part of the OS, and can't be used based on this forum[^]. That is what I gather anyway. I didn't mean to make it appear as though I was insulting your intelligence. I just wanted to be sure that you knew the dangers. :-O

                How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...

                H Offline
                H Offline
                hxhl95
                wrote on last edited by
                #7

                Oh it's alright. I expected some suspicion anyways :laugh: I read an article a few minutes ago on cleanly shutting down explorer.

                http://jeffcode.blogspot.com/2007/12/how-to-cleanly-start-and-stop.html[^]

                The way to tell Explorer to shut down is to say you want to shutdown the machine, but then cancel in a special way: Start->Shutdown->CTRL+ALT+SHIFT+Cancel

                If I were to monitor explorer.exe, would I be able to see the function calls that do this? EDIT: I don't think I can. explorer just ends itself like any other app. New question: Would it be possible to inject something into explorer and call ExitProcess(0) within the process? Thanks a lot for your help :)

                modified on Monday, March 16, 2009 2:56 PM

                K 1 Reply Last reply
                0
                • H hxhl95

                  Oh it's alright. I expected some suspicion anyways :laugh: I read an article a few minutes ago on cleanly shutting down explorer.

                  http://jeffcode.blogspot.com/2007/12/how-to-cleanly-start-and-stop.html[^]

                  The way to tell Explorer to shut down is to say you want to shutdown the machine, but then cancel in a special way: Start->Shutdown->CTRL+ALT+SHIFT+Cancel

                  If I were to monitor explorer.exe, would I be able to see the function calls that do this? EDIT: I don't think I can. explorer just ends itself like any other app. New question: Would it be possible to inject something into explorer and call ExitProcess(0) within the process? Thanks a lot for your help :)

                  modified on Monday, March 16, 2009 2:56 PM

                  K Offline
                  K Offline
                  Kenny McKee
                  wrote on last edited by
                  #8

                  The forum that I gave you the link to seems to say something about replacing explorer.exe, but I haven't went very in depth with that and it sounds like it might cause quite a few problems.

                  How many bytes of text have I typed in my lifetime??? Man, I wish I kept track...

                  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