Running 32-bit and 64-bit mshta.exe (bypass by default handler)

I would like to be able to run page.hta in the 32-bit and 64-bit versions of mshta.exe.

Create the file c: \ page.hta p>

<body onclick="if(confirm('Close? (onclick)')){self.close();}"> <h1>Test Page</h1> <script type="text/javascript"> var elem = [ "UserAgent="+window.navigator.userAgent, "Platform="+window.navigator.platform ]; var taBegin = "<textarea style='width:100%' rows='"+((elem.length+1)*1.5)+"'>"; var taEnd = "</textarea>"; document.write(taBegin+elem.join("\n")+taEnd); </script> </body> 

Now here is the batch file to load the page differently.

 @echo off rem Launch 32bit c:\Windows\SysWOW64\mshta.exe c:\page.hta rem Launch 64bit c:\Windows\System32\mshta.exe c:\page.hta 

Another interesting thing, try changing the default handler to notepad for .hta files. If you execute the previous commands and start the notepad. It seems that mshta has some logic that only runs .hta through the default handler.

Any command is specified when using the default handler.

+3
source share
2 answers

Perhaps this is a problem with the OS version (?) I can’t say, since your test run is running on my XP x64.

[EDIT] The code I'm running is:

 Rem run32.bat %WinDir%\SysWOW64\mshta.exe c:\page.hta Rem run64.bat %WinDir%\System32\mshta.exe c:\page.hta 

Here is what I get: test screenshot

+1
source

system32 / systemwow64 folders are "virtual" in the sense that their contents are determined by the OS depending on the access application bit - in your case cmd.exe is probably a 64-bit version, so it will always run a 64 bit version of the mshta file. exe

to run the command line in 32 bits see http://astatalk.com/thread/7382/0/How_to_Open_and_Run_32-bit_Command_Prompt_in_x64_Windows/

it can also help to use SysNative instead of system32 and see how mshta.exe works ...

mshata.exe apparently just uses the standard settings for .hta, so it probably doesn't matter if you are starting the 32-bit or 64-bit version of mshta.exe - you can try linking .hta with 32- bit transfer your browser ...

IF you want to get around this, then you can just call the browser (32 bit or 64 bit) directly in your batch file ...

EDIT - as per the comment:

For 64 bit execution you can use "C: \ Program Files \ Internet Explorer \ iexplore.exe" in your batch file and
for 32-bit execution you use "C: \ Program Files (x86) \ Internet Explorer \ iexplore.exe".

Depending on the youd system, you need to open a command shell with the desired bit size - see the link above.

0
source

Source: https://habr.com/ru/post/1346177/


All Articles