Jump to content

Start exe as child of explorer.exe


kiboost
 Share

Go to solution Solved by johnmcloud,

Recommended Posts

Hi,

I try to start an exe file (not from me) which need to be a child process of explorer.exe to run fine.

If I use Run or Shellexecute it doesn't work fine.

I found this : http://www.nirsoft.net/utils/run_from_process.html

With running :

$RFPpath = "D:RunFromProcess-x64.exe"

$myFilePath = "pathtomyfile.exe"

ShellExecute($RFPpath, " nomsg explorer.exe "&$myFilePath, "")

Then myfile.exe is a child process of explorer.exe and all works well.

The problem is that it relies on this utility, which I dunno if it will be maintain, stays free, keep compatible with windows in the future, etc etc

So how could I do that with autoit itself ?

Thanks

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

I'm sure the WinAPI or WinAPIEX UDFs provide a function to do what you want.

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Can't you simply do this:

Run('explorer.exe "' & $myFilePath & '"')
; or:
;ShellExecute("explorer.exe", '"' & $myFilePath & '"')

I've tried this but it make myfile.exe child of an explorer.exe, child of svchost.exe, child of services.exe, child of wininit.exe

Not a child of the user main explorer.exe and doesn't work

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

I try to start an exe file (not from me) which need to be a child process of explorer.exe to run fine.

Can you please tell us which program needs to be a child of Explorer.exe and why?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

I've tried this but it make myfile.exe child of an explorer.exe, child of svchost.exe, child of services.exe, child of wininit.exe

Not a child of the user main explorer.exe and doesn't work

Then next time be more precise about what you want. I gave you what you asked for.

See you then :).

♡♡♡

.

eMyvnE

Link to comment
Share on other sites

Can you please tell us which program needs to be a child of Explorer.exe and why?

agreed. I'm curious as well. I've never heard of needing such a thing. If anything you describe what you need as a maulware behavior. Then again the need could be legitimate and I can learn something new.

Link to comment
Share on other sites

Ok no problem and nothing secret there, was not talking about it to not bother you. I must say it's the first time I see such behavior also, and previous version of this software didn't needed this.

It is server.exe, part of Autodesk Backburner. This server.exe start 3dsmax.exe and if server.exe isn't a child process of main explorer.exe 3dsmax.exe has some difficulties to create some files while starting (I guess it ask its parent explorer.exe and don't find it ?). This is for 3dsmax 2014, and 3dsmax2012 (with backburner2012) never had such problems.

The fact is that if I start server.exe with RunFromProcess-x64, all runs fine.

The command that works :

$RFPpath = "D:RunFromProcess-x64.exe"

$startPath = "C:Program Files (x86)AutodeskBackburnerserver.exe"
ShellExecute($RFPpath, " nomsg explorer.exe "&$startPath, "C:Program Files (x86)AutodeskBackburner")

which runs :

D:RunFromProcess-x64.exe nomsg explorer.exe C:Program Files (x86)AutodeskBackburnerserver.exe

You know it all :huggles:

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

Can't you let AutoDesk do the startup thing and then connect to this process and do whatever you need to do?

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2022-02-19 - Version 1.6.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (NEW 2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

this is a really interesting issue which i stumbled a while back: my need was that a setup program - running interactive as administrator - when completed, would launch the installed application as the logged-on user.

i never found a real solution to this - and i'm surprised that the NirSoft guy can do it, because it sounds like a really bad security vulnerability to me - but this is a workaround i can suggest (i confirm it works remotely too):

create a shortcut to the executable you want to be launched as child of explorer.exe (i.e. server.exe)

assign this shortcut with a shortcut key, that is unlikely to be used (e.g. Ctrl+Alt+Shift+F12)

the calling application should NOT launch server.exe directly - instead, it should Send() the shortcut key. the Send() is processed by explorer.exe, and there you go...

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

this is a really interesting issue which i stumbled a while back: my need was that a setup program - running interactive as administrator - when completed, would launch the installed application as the logged-on user.

i never found a real solution to this - and i'm surprised that the NirSoft guy can do it, because it sounds like a really bad security vulnerability to me - but this is a workaround i can suggest (i confirm it works remotely too):

create a shortcut to the executable you want to be launched as child of explorer.exe (i.e. server.exe)

assign this shortcut with a shortcut key, that is unlikely to be used (e.g. Ctrl+Alt+Shift+F12)

the calling application should NOT launch server.exe directly - instead, it should Send() the shortcut key. the Send() is processed by explorer.exe, and there you go...

 

wow nice idea ! Will try that !!

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

hmm this doesn't work.

it start it without any parent process.

Func startServer()
    ConsoleWrite("startServer"&@CR)
    $serverStart = "D:\BB_Server.lnk"
    ShellExecute($serverStart)
EndFunc


HotKeySet("Ctrl+Alt+Shift+F12", "startServer")
Send("Ctrl+Alt+Shift+F12")

About RunFromProcess:

It seems it use traditionnal code injection with kernel32.dll

http://waitfordebug.wordpress.com/2012/02/07/dll-injection-in-python/

But this not 'traditionnal' at for me lol !!

I'm trying with both autoit and python but can't find out how to encode shellcode for a simple winexec command.

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
Share on other sites

for Send() you do not need all that. just manually create the shortcut one time, then use just one line Send().

now use the proper syntax for send() - see the help

Send("+^!{F12}")

Signature - my forum contributions:

Spoiler

UDF:

LFN - support for long file names (over 260 characters)

InputImpose - impose valid characters in an input control

TimeConvert - convert UTC to/from local time and/or reformat the string representation

AMF - accept multiple files from Windows Explorer context menu

DateDuration -  literal description of the difference between given dates

Apps:

Touch - set the "modified" timestamp of a file to current time

Show For Files - tray menu to show/hide files extensions, hidden & system files, and selection checkboxes

SPDiff - Single-Pane Text Diff

 

Link to comment
Share on other sites

This work for me:

;johnmcloud
$HotKey = "^!t" ; CTRL + ALT + T
$FileDir = @DesktopDir & "\Temp_Notepad.lnk" ; Directory of the shortcut
FileCreateShortcut(@WindowsDir & "\notepad.exe", $FileDir, @WindowsDir, "", "", @WindowsDir & "\system32\notepad.exe", $HotKey, "0", @SW_MINIMIZE) ; create a shortcut
Send($HotKey) ; send the combination of key for open the software
WinWait("[CLASS:Notepad]") ; wait for the window
FileDelete($FileDir) ; delete the .lnk

Result:

final.jpg

Edited by johnmcloud
Link to comment
Share on other sites

indeed, this solution works ! nice, really, as I think it will be more reliable in the future than a code injection into explorer.exe

anyway, once I've done, I can't create anymore a new shortcut with ctrl+alt+t

I guess all hotkeys for shortcuts are saved somewhere in the registry, so we should delete this also each time we use this snippet

Win7 pro x64. scripts compiled to x64. - Autoit v3.3.6.1 | Scite 1.79

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...