Jump to content
Sign in to follow this  
Swift

how to close explorer.exe

Recommended Posts

Swift

Any Ideas Anyone?

Because: I am making a script...which explorer.exe needs to be closed...but make a script to do

Processclose("explorer.exe")

and 2 seconds later...it reloads itself...I must stop it from doing that!

Heres my script! This Will Run on Startup once I set it too.! I stole manadars boot menu and edited it! so now its a really cool boot uper!

#include <A2D.au3>;Include the A2D header
#include <GUIConstants.au3>
Dim $sWidth = 720
Dim $sHeight = 400

Dim $sTitle="Old-Style Boot Menu", $sHomepage = "Esc Exits Boot Menu"
Dim $sMenuOptions[5] = ["Load Desktop","Restart","Shutdown","About","Close Boot Menu"]
Dim $sSelected = 0

$hWnd = GUICreate("Bootup Menu", $sWidth, $sHeight,-1,-1,$WS_POPUP)
GUISetState()
_A2DStartup("a2d.dll")

;Create the device.. with error checking.
if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf

GUIRegisterMsg(0x001C, "_ToggleHotkeys"); Register the keys to toggle when something activates or deactives the app..; WM_ACTIVATEAPP = 0x001C
_ToggleHotkeys(); Initialise the hotkeys this way

$sTitleFont = _A2DCreateFont(20,11,600,False,"MS Sans Serif")
$sOptionFont = _A2DCreateFont(20,11,450,False,"MS Sans Serif")
WinSetOnTop($hWnd,"",1)

While GUIGetMsg() <> -3
    _A2DClear(0xFF0000A8);Clear the screen to blue. (AARRGGBB)
    _A2DBeginScene()
        _A2DDrawLine(10,15,$sWidth-10,15,0xFFA8A8A8); Top Line
        _A2DDrawLine(10,48,$sWidth-10,48,0xFFA8A8A8); Line below title
        _A2DDrawLine(10,$sHeight-15,$sWidth-10,$sHeight-15,0xFFA8A8A8); Bottom line
        
        _A2DDrawLine(10,15,10,$sHeight-14,0xFFA8A8A8); Left lines
        _A2DDrawLine(9,15,9,$sHeight-14,0xFFA8A8A8); Left lines
        
        _A2DDrawText($sTitleFont, $sTitle, 20,22, 300, 33, 0xFFFFFF57)
        _A2DDrawText($sTitleFont, $sHomepage, 485,22, 300, 33, 0xFFFFFF57) 
        
        For $i = 0 to UBound($sMenuOptions)-1
            If $i = $sSelected Then
                _A2DDrawRectangle(20,55+($i*18),$sWidth-40,20,0xFFA8A8A8)
                _A2DDrawText($sOptionFont, $sMenuOptions[$i], 20,55+($i*18), 300, 33, 0xFF000000)
            Else
                _A2DDrawText($sOptionFont, $sMenuOptions[$i], 20,55+($i*18), 300, 33, 0xFFA8A8A8)
            EndIf
        Next
        
        _A2DDrawLine($sWidth-10,15,$sWidth-10,$sHeight-14,0xFFA8A8A8); Right lines
        _A2DDrawLine($sWidth-9,15,$sWidth-9,$sHeight-14,0xFFA8A8A8); Right lines
        
    _A2DEndScene()
    _A2DPresentScene()
WEnd

_A2DReleaseDevice()
_A2DShutdown("a2d.dll")

Func _ToggleHotkeys($lHwnd = 0, $lMsg = 0, $wParam = 0, $lParam = 0)
    If WinActive($hWnd) Then
        HotKeySet("{UP}", "_Up")
        HotKeySet("{DOWN}", "_Down")
        HotKeySet("{ENTER}", "_Select")
    Else
        HotKeySet("{UP}")
        HotKeySet("{DOWN}")
        HotKeySet("{ENTER}")
    EndIf
EndFunc

Func _Up()
    If $sSelected > 0 Then
        $sSelected -= 1
    EndIf
EndFunc

Func _Down()
    If $sSelected < UBound($sMenuOptions)-1 Then
        $sSelected += 1
    EndIf
EndFunc

Func _Select()
    WinSetOnTop($hWnd,"",0)
    If $sSelected = 0 Then checkifdesktopisactive()
    If $sSelected = 1 Then Shutdown(2)
    If $sSelected = 2 Then Shutdown(9)
    If $sSelected = 3 Then MsgBox(0, "About", "Simple Boot Menu By Manadar!")
    If $sSelected = 4 Then Exit
EndFunc


Func checkifdesktopisactive()
    If ProcessExists("explorer.exe") Then MsgBox(0, "Desktop", "Your Desktop Is Already Loaded!")
If Not ProcessExists("explorer.exe") Then Run("explorer.exe")
EndFunc

be aware to run this script you will need some .dll's

Edited by Swift

Share this post


Link to post
Share on other sites
jvanegmond

After talking to Swift a few times, I can ensure anyone reading this topic that this is not for malicious intent. He intends to create something that runs before explorer, and the program will boot explorer.exe afterwards.

Share this post


Link to post
Share on other sites
Sardith

Registry:

HKLM\Software\Microsoft\Windows NT\Currentversion\Winlogon

You can changed the "Shell" parameter.

If you change the shell parameter, it should load another .exe in place of explorer.exe at startup.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Swift

I Am Truely Scared Of The Registry :P:D

Share this post


Link to post
Share on other sites
Sardith

Well, I can give it a try for you.

So it isn't a leap into the dark.

I'm out of other ideas.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
jvanegmond

yay

:P test it out!

I'm pretty sure it works. I have used shell replacements before.

Just change it to the file you want, and you're good to go. :D

Share this post


Link to post
Share on other sites
Sardith

_ProcessSuspend("explorer.exe")


Func _ProcessSuspend($process)
$processid = ProcessExists($process)
If $processid Then
    $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtSuspendProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
    If IsArray($i_sucess) Then
        Return 1
    Else
        SetError(1)
        Return 0
    Endif
Else
    SetError(2)
    Return 0
Endif
EndFunc

Func _ProcessResume($process)
$processid = ProcessExists($process)
If $processid Then
    $ai_Handle = DllCall("kernel32.dll", 'int', 'OpenProcess', 'int', 0x1f0fff, 'int', False, 'int', $processid)
    $i_sucess = DllCall("ntdll.dll","int","NtResumeProcess","int",$ai_Handle[0])
    DllCall('kernel32.dll', 'ptr', 'CloseHandle', 'ptr', $ai_Handle)
    If IsArray($i_sucess) Then
        Return 1
    Else
        SetError(1)
        Return 0
    Endif
Else
    SetError(2)
    Return 0
Endif
EndFunc

That will pause explorer from doing anything. You do however, have to use _processresume. It will take a few seconds for explorer to catch up, not sure what the long-term would be. The only direct method I can 'think' of is the registry. It performs how I explained.


[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Share this post


Link to post
Share on other sites
Swift

Hmmm...ok...The file needs to be in C:\WINDOWS right?

Edit: well...im tring this...so...wish me luck!

If I dont post back in 5 minutes. Something has went wrong.

Edited by Swift

Share this post


Link to post
Share on other sites
Swift

Hmm...well It sorta worked...but I guess since there is NOTHING running...it couldnt open a .dll or something..because it gave me the error that it couldnt load some thing...

this is the error message i got

if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf

Share this post


Link to post
Share on other sites
seandisanti

Hmm...well It sorta worked...but I guess since there is NOTHING running...it couldnt open a .dll or something..because it gave me the error that it couldnt load some thing...

this is the error message i got

if (_A2DFailed(_A2DCreateDevice($hWnd, $sWidth, $sHeight, $A2DFORMAT_A8R8G8B8))) Then
    MsgBox(0, "Error", "An error occurred while created the A2D Device!")
    _A2DShutdown("a2d.dll")
    Exit
EndIf
Right, if your script is meant to run on windows, but you're loading it in place of windows, it doesn't have a valid runtime environment and the API's that autoit interacts with are at that point non-existent... AutoIT is not the language to use to write something to be loaded as a shell as it depends on the operating system which you're stopping.

Share this post


Link to post
Share on other sites
seandisanti

I see...thanks..

Glad to help.

Share this post


Link to post
Share on other sites
Joscpe

You could do this:

;Hide
WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_HIDE)
;Show
WinSetState("[CLASS:Shell_TrayWnd]", "", @SW_SHOW)

-Joscpe

Share this post


Link to post
Share on other sites
radienergos

xmmm

run(@comspec&" /c taskkill /f /im explorer.exe")

Share this post


Link to post
Share on other sites
CWorks

run this reg file and notepad will run at next reboot

halting the shell until notepad is closed :)

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce]
"notepad"="notepad.exe"

Share this post


Link to post
Share on other sites
Swift

1 Problem :) It wont work unless the shell is running :)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.