NEWS Forum Wiki XDA TV

[Beta] Win86emu: Running x86 apps on WinRT devices

Tip us?

swbf2lord
Senior Member
Thanks Meter 41
Posts: 1,067
Join Date: Dec 2009
Location: South Carolina

DONATE TO ME
Re: [Beta version] Running x86 apps on WinRT devices

So does this mean that older games like Balder's Gate could be played on the Surface?

Sent from my Galaxy Nexus using Tapatalk 2
Current Device(s): Samsung Galaxy S3
Previous Device(s): Samsung Omnia, Motorola Droid 1, Motorola Droid 3, Motorola Droid X2, HTC Rezound, Samsung Galaxy Nexus, Sony Ericsson Xperia Play, Motorola Droid RAZR, HTC Trophy, Samsung Fascinate, Droid RAZR MAXX, HTC 8X, Motorola Droid RAZR HD
Current Tablet(s): Motorola Xoom
Previous Tablet(s): Acer Iconia Tab A100

Quote:
 Originally Posted by TheMuffStuff Trading Phones Is A Disease
 THEBIG360 12th February 2013, 04:49 PM (Last edited by THEBIG360; 12th February 2013 at 05:07 PM.) Member Thanks Meter 3 Posts: 53 Join Date: Jan 2009 Tried pinball and WinRAR, even mplayer and an awful lot more. Nothing at all will install for me. All error related to ASLR issue. I'm sure it will be sorted. On a side note I've just tried this: http://www.engadget.com/2013/02/12/b...ndroid-app-pl/ It runs the extractor then nothing happens, how good would it be if it ran. REPLY
 xsoliman3 12th February 2013, 06:55 PM Member Thanks Meter 32 Posts: 93 Join Date: Jan 2012 Like your x86node naming convention for the redirected registry. A bit like MIcrosoft's wow6432node naming for 32bit registry on 64bit Windows REPLY

mamaich
(Last edited by mamaich; 13th February 2013 at 12:58 AM.)
Recognized Developer - OP
Thanks Meter 212
Posts: 1,150
Join Date: Apr 2004

DONATE TO ME
Quote:
 Originally Posted by GoodDayToDie [*]Since one of the easiest ways to get a full file path is to Shift+Right-Click a filename and select "Copy as Path" (which quotation-wraps the path), it would really help to have quotation marks handled correctly (I know you're working on it).
This is already fixed, I'll post an updated launcher a bit later.
Quote:
 [*]Although the latest launcher is better about providing failure messages, it would still help a lot to have it show something in all failure cases. For example, if a required DLL can't be found, it exits silently right now (ideally, it would mention the specific file needed).
I agree with you, but this would require some internal redesign. The easiest method would be to open the log file automatically on crash, and to set LogLevel=1 by default.
Quote:
 [*]Rather than using the system tray, why not just have the launcher sit in the taskbar? That's a lot more touch-friendly.
Launcher is just a temporary solution. Later there would be automatic detection of x86 apps without a launcher and the programs would be run transparently to end-user. You'd be able to create shortcuts, and so on.
You can place shortcut to a launcher on the desktop. If you run it while it is already running - it would popup its window.
Quote:
 [*]Please implement passing EXE paths as parameters (either to launcher or peloader). This would make it easy to script the launcher, would allow drag-and-drop on the launcher EXE or right-click-> Send To if a shortcut to the launcher was added there, or automatically launching the emulation layer using filetype associations (.exe_x86 or similar) or possibly Image File Execution Options. Might be required MRU lists to work right anyhow.
As far as I remember, image file execution options are applied after the OS checks for the file validity. I'll be using a different method to automate running of x86 EXEs.
You may use the following script to run a program passed as a parameter:
Code:
set EMU_PROGRAM=%1
:loop
"c:\program files\win86emu\peloader.exe" %2 %3 %4 %5 %6 %7 %8 %9
if %errorlevel%==3134193664 goto loop
3134193664 == 0xBAD00000, a restart indicator
Quote:
 [*]Non-ASLR large programs (for example, many installers) can be really hard to start. The thing is, most of those programs are perfectly compatible with ASLR, they just don't know it (it's just a flag in the binary); having an option to force the dynamic base behavior would be good just to see if it will work anyhow.
There would be no problem launching executables that contain relocations information. But most of the old EXEs does not, so I'm using this trick:
Quote:
 [*]Lacking that / as an alternative solution to the ASLR problem, it might work to create a really tiny launcher program that temporarily reserves a bunch of memory at the default load address, then dynamically loads the actual launcher code to help ensure that the launcher code doesn't get loaded into the default space.
This is exactly what I'm doing now. peloader.exe - is a tiny loader that reserves the memory at its start. It determines the program image base and image size and reserves the memory at that address. If the address is already used - it exits complaining about ASLR. Here I abuse ASLR for my own needs - at next program start OS would be using different addresses for its data (environment block and so on), so I usually can reserve needed memory at 1-2 restarts.
There is a bug in peloader. It reserves the memory for the whole EXE file size, including the overlayed data in its end. So self-extracting archives would require too much memory to be loaded successfully.
And just found another bug in it - EXE file relocations info check was turned off for debugging and I've forgot to turn it on. So all EXEs were processed as having no relocs.
I'll fix both bugs in the next update, it should be ready this evening.
...
 The Following User Says Thank You to mamaich For This Useful Post: [ Click to Expand ]

mamaich
(Last edited by mamaich; 13th February 2013 at 01:43 PM.)
Recognized Developer - OP
Thanks Meter 212
Posts: 1,150
Join Date: Apr 2004

DONATE TO ME
Quote:
 Originally Posted by GoodDayToDie I'm really curious how you're going to implement the auto-detection.
The same trick that is used by lots of tools on x86 windows. I'll hook CreateProcessInternalW in every running process except for WinLogon.exe and alike. This is easy - inject my DLL (OpenProcess, VirtualAllocEx, CreateRemoteThread), patch that function in memory, and do my stuff. But I'll patch only the "return error" part of the function - so that normal ARM executables would be run even if my hook would have heavy bugs or my DLL would be unloaded by some paranoid antivirus.
This would have minimal impact on battery life as I'll hook CreateProcessInternalW only when a new process is created. And I don't need to constantly monitor for new processes - WMI would notify me automatically, all other time my code would be sleeping.

Updated the first post with a new build. It supports spaces in file names (such file names should be in quotes). Now there is no console window of peloader.exe (recompiled it as a GUI app). EXE files with relocations and overlays are processed correctly. Launcher now opens log file if emulated EXE does not run. Now default Log level is "Warnings+Errors", so you'll get names of non-present DLLs in log without having to edit registry. And of cause there are some bugfixes in API emulation.
No new emulated WinAPI DLLs added yet, this would be done later, as I'm rewriting a stub generator to simplify their development.
I use relocations only in EXE files compiled for windows 2000 and above (OS == 5.0 in PE header). Some executables targeted for 4.0 have broken relocs - Heroes of Might and Magic 1 as an example.
...
 The Following User Says Thank You to mamaich For This Useful Post: [ Click to Expand ]
 GoodDayToDie 13th February 2013, 07:04 PM (Last edited by GoodDayToDie; 13th February 2013 at 08:27 PM.) Recognized Developer Thanks Meter 2642 Posts: 5,529 Join Date: Jan 2011 Location: Seattle More Info > Ah, I'd forgotten about WMI. My bad. Yeah, that method should work well. Time to see if the improved peloader lets me run some of the files that always failed before... EDIT: Well, they fail differently now. The ASLR problems are gone, as expected. However... MSIMG32.dll appears to be required for all GOG.com installers. DPLAYX.dll required for Total Annihilation. WININET.dll required for Irfanview installer. Tons of installers fail with a popup messagebox "NSIS Error: Error launching installer". Lots of games demand opengl, no surprise. MSVCP80.dll required for FTL. Some programs (such as Baldur's Gate) just fail mysteriously ("... exit code 0" but nothing happened, sometimes exit code 1 or 2 instead for other programs). Many programs (typically installers, sometimes standalone) fail with "The system cannot find the path specified" Running programs over the network using UNC paths (\\servername\share\path\to\file.exe) acts like it will work, but copying locally works better in some cases (i.e it errors sooner over the network). Win8/Windows RT projects: List of desktop apps for hacked RT devices WP8 projects: Native Access WebServer and Libraries WP8 Interop Unlocks Storage Cleanup tool WP7 projects: XapHandler, Root Webserver, OEM Marketplace XAPs, Bookmarklets collection (Find On Page), Interop-unlock hacks. Do not private message me with questions that should have been posted on the forum! Not only are you wasting your time - I'm not going to bother writing an answer to such a question for only one person - but I will probably block you from PMing me in the future as well. REPLY
 samco08 13th February 2013, 09:25 PM Senior Member Thanks Meter 4 Posts: 112 Join Date: Jan 2009 Hello ! I'm not at home...... somebody can try to install FDM ? you're nice.. @= REPLY

mamaich
(Last edited by mamaich; 14th February 2013 at 01:31 PM.)
Recognized Developer - OP
Thanks Meter 212
Posts: 1,150
Join Date: Apr 2004

DONATE TO ME
Quote:
 Originally Posted by samco08 I'm not at home...... somebody can try to install FDM ?
It is better to port free download manager as is is opensource.
FDM may be compatible with some of the future versions, but there would be no internet explorer integration. I'm not going to support all those COM interfaces, at least in the foreseeable future.

I'll pause publishing updates for some time as I'm adding several dozens of new system DLLs to the emulator, and need to make them working before making them public. Ws2_32, msimg32 and other requested DLLs are among them. uTorrent 2.x is working now, though with some problems.
You may see it on the Screenshot
NSIS installers are working too (checked with 7Zip official installer), though they can't create shortcuts as I have not implemented that interface yet.
...
 The Following 3 Users Say Thank You to mamaich For This Useful Post: [ Click to Expand ]
 goodintentions 14th February 2013, 03:56 PM Senior Member Thanks Meter 732 Posts: 2,545 Join Date: Aug 2010  DONATE TO ME My vivotab rt is being delivered today. So, forgive me for my question. Will this allow starcraft (the original) to run? Please don't kill me. Feeling overwhelmed by all these instructions meant for smarties? Well, you're in luck because I've made a Viewsonic G-Tablet For Dummies where all the instructions are dumbed down for dummies. REPLY

 Thread Tools Search this Thread Search this Thread: Advanced Search Display Modes Linear Mode