yashsingh1/xdaforums huggingface dataset:
[Windows RT Development and Hacking] mamaich:
"Error in the emulated program" means that there is a problem with a program you are trying to execute and emulator can't even start running it.

Here are the reasons: emulated EXE cannot be found or somehow is inaccessible (for example due to NTFS permissions), there is error in the file format (not x86 PE), loader can't find peldr.nt.dll (broken installation), or loader can't reserve memory. In the last case the peloader.exe would be relaunched 100 times and you'll see that it writes the line "Failed to reserve memory (0x%08x, %d) due to ASLR, please rerun the application". Normally it needs 1-3 peloader.exe restarts depending on the size of a program.

I've attached an updated launcher.exe that provides exact reason of the error. Replace the old one and try again.

One more note. If you don't specify log file name in registry - the log would be created in %temp% and there would be 2 log files. One for launcher and the second for the actual emulator.

edited: attached the file to the first post. Also fixed the no sound problem in pinball and some other programs.
[Windows RT Development and Hacking] WizardCM:
Edit: actually, after closing the launcher in the notification area and re-running it, I get "Can't open emulated EXE file."

Edit2: Could it be spaces in the location of the exe? Going to test in a moment...

Edit2: Yep, that was the issue. New issue now though:

HOMM3:

Though _HD3_.dll does exist.

AOE2:

edit4:

These are the four dll's it requested before finally crashing

And here's a log file: http://txt.wizrd.tk/yact_0014dc.log

Hope it helps, it's almost 3am here. I'm heading to bed.
[Windows RT Development and Hacking] l27_0_0_1:
Strange, after I installed this program, my tablet became very buggy: screen resolution is dropping periodically to 1024x768, metro IE crashes, sudden freezes with black screen, even after reboot(without launching jailbreak, even). I realize, that its very improbable that it is your app, that causes this, but since yesterday, it was the only thing that changed. Also, nothing seems to run, keep getting infinite command prompts opening and then error, or the error alone. Will try logging and reinstalling.
[Windows RT Development and Hacking] mamaich:
You are right - spaces and quotes in the EXE file name are not supported - I'll fix that.

This means that _HD3_.dll can't be loaded due to PSAPI.DLL not found. There is a mistake in the error message, it should be "import dll xxx or some of its dependencies not found".

You may try to get psapi.dll from NT4 or 2K, but I don't think that it would work as it probably would depend on the not implemented kernel functions. I'll check that myself.

HD mod 2.98 is working.

I'll try to run AOE myself, would post the progress here.
[Windows RT Development and Hacking] mamaich:
Yes, it cannot be my app as it just can't run without jailbreak. And even after a jailbreak it does not make any changes in OS at all even in RAM.

Theoretically it is possible that some of the emulated apps may break something in the host OS registry - but registry redirection should prevent that from happening.
[Windows RT Development and Hacking] mamaich:
Try simple and old programs first. More modern ones may require the DLLs I have not implemented yet.

Regarding AOE and similar old games. Most of them require 256-color mode that is not supported on RT. After adding the missing DLLs, I'll need to emulate that mode manually, the work is in progress, but unfinished yet.
[Windows RT Development and Hacking] l27_0_0_1:
So anyway, reinstalled the app, created a loglevel setting, tried running some programs that I miss from x86. Halite: requires msimg32.dll and probably some other ones, tried adding it to win86emu\system32, got errors("Import GdiTransparentBlt not found in" and some other GDI-related stuff) and another dll missing - WS2_32.dll. uTorrent: Can't open emulated .exe, no logs created.

old build of foobar2000:

XnView: MSVFW32.dll not found.

mplayer: WS2_32.dll, avformat-53.dll not found

It would be great if you'd have ported WS2_32.dll and msimg32.dll. And thanks for the contribution to the winrt development, if you get this thing working, it would be super-awesome.
[Windows RT Development and Hacking] mamaich:
XnView and media player - they use OS codecs that are not present on RT. Ir is theoretically possible to use them through emulation - but speed would be too slow.

Regarding other apps - I'll test them, thank you for the list.
[Windows RT Development and Hacking] l27_0_0_1:
xnview, mplayer and foobar2000 are on the list just because there's no decent alternative to them, I still couldn't find the store app that handles .gif files well, for example. Also, tried launching leaked beta build of half-life, but it requires opengl which is, as I've read in other thread, is very improbable to run well enough.
[Windows RT Development and Hacking] netham45:
Half-life has a software renderer too, though it may still require OGL libs for some reason.
[Windows RT Development and Hacking] GoodDayToDie:
New version is great! However, a few things that I noticed, no particular order:

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).

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).

Similarly, it would be good to have it say something like "Can't open EXE file: File not found" or "Can't open EXE file: Access denied" or similar, based on the errors received.

Rather than using the system tray, why not just have the launcher sit in the taskbar? That's a lot more touch-friendly.

Taking that point further: jump lists! Recent EXEs, pinned EXEs, etc. I think you could actually just do it using the recently used file list functionality already found in Windows. This would make it a lot easier to launch programs.

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.

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.

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.

Required DLL that I found a few programs complaining about: wininet.dll. I tried copying it from syswow64 on my Win8 box, but that didn't work; an older version might perhaps.

Stretch goal: OpenGL compatibility layer by translating to DirectX (sort of like what Wine does to run D3D code on *nix). This would obviously be a huge project, but it would be very cool...
[Windows RT Development and Hacking] WizardCM:
Alright, so following your mention of HD mod 2.98 working, I started with a fresh setup of HOMM3 Complete, patched it, and tried running it. A few times it wouldn't launch at all, and peloader.exe would stop responding and close, but I was able to get it to actually launch twice. However, those two times the game window closed after the 3DO logo, with the peloader.exe still open (which I then had to close myself).

Here's the log file from one such launch: http://txt.wizrd.tk/yact_000f1c.log
[Windows RT Development and Hacking] GoodDayToDie:
Disabling ShowIntro (in the registry, under the emulated HKLM) let me get past that. Alternatively, run the un-color-patched version; it looks awful and runs slowly, but once you sit through the into once you can skip it in future bit hitting Esc during the "3DO" video.
[Windows RT Development and Hacking] WizardCM:
Yep, with that fix and a few relaunches (from the instant crashing) it works perfectly. I'd rather not do one where I need to skip it because I have no ESC key and don't want to be time limited.

Now the only thing limiting gameplay is the lag in map view. Would there be a way to lower the quality or something, or does it simply need more work?
[Windows RT Development and Hacking] THEBIG360:
Every time I try to install anything I get and error:

Failed to deserve memory file is two big or something wrong with application.

That's pretty much every app even WinRAR, any ideas?
[Windows RT Development and Hacking] samco08:
thank you for your work but ..

same error here with "Foxit reader portable 5"

say:

Can't reserve momory (file is too big or invalid format)

some help ?
[Windows RT Development and Hacking] GoodDayToDie:
Rebooting will change the ASLR-caused memory layouts, which are the cause of this error and might be fixed with a reboot. It's pretty random though; there's no guarantee. Sometimes it will work if you just try enough, other times it won't work at all.
[Windows RT Development and Hacking] wy328:
this is really cool!!
[Windows RT Development and Hacking] swbf2lord:
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?
[Windows RT Development and Hacking] THEBIG360:
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/bluestacks-brings-official-surface-pro-optimized-android-app-pl/

It runs the extractor then nothing happens, how good would it be if it ran.
[Windows RT Development and Hacking] xsoliman3:
Like your x86node naming convention for the redirected registry.

A bit like MIcrosoft's wow6432node naming for 32bit registry on 64bit Windows
[Windows RT Development and Hacking] mamaich:
This is already fixed, I'll post an updated launcher a bit later.

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.

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.

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:

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

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:

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.
[Windows RT Development and Hacking] GoodDayToDie:
Great! Thanks for the update.

Agreed on the option of just opening the log by default. It would also be somewhat nice to have an option to control the program's behavior from the UI, rather than manual registry editing, but as you say it's a temporary work-around.

I'm really curious how you're going to implement the auto-detection. The only thing that comes to mind is to use the debugger to hook CreateProcess (and possibly ShellExecute, but I think that calls CreateProcess anyhow) and add a bit of code that checks the architecture flag of the PE, loading the emulation layer if it's x86. That would be per-process, though; it would work for (example) explorer.exe, but not if I used explorer to start a CMD window. Of course, you could have a long-running process or Windows Service that would apply the hook automatically to new processes, but that's a pretty ugly way to do it and would impact battery life. Other options include modifying the system libraries (not a great plan, expectially since that means those libs cant be used at all without jailbreak), modifying the program loader in the kernel (would require kernel debugger or kernel-mode driver, which we don't have), or... not sure. Setting the loader as the default handler for all EXE files (and then simply invoking CreateProcess on ARM ones) doesn't work, for multiple reasons. Maybe something involving the system event logs? Anyhow, this would obviously be the ideal behavior.

Bleh, IFEO doesn't work for this. The architecture check is performed before the IFEO check. Lamesauce. A kludgy work-around would be to change the arch characteristic in the binary and *then* use IFEO...

Yeah, files without relocs are going to be a problem. It might save some time/hassle on those which aren't /FIXED but aren't /DYNAMICBASE either, though. Of course, that doesn't help if the check for relocs isn't used... ;) I should have been surprised how many programs I tested that were acting like they were /FIXED, but having seen professionally the kinds of compiler flags used by all too many programs, I wasn't...

Reserving only space for the .text and .data sections will certainly help dramatically, especially for programs with a huge amount of resources. Massive statically-linked programs might still be a problem but should be rare.

Looking forward to trying it out!
[Windows RT Development and Hacking] mamaich:
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.
[Windows RT Development and Hacking] GoodDayToDie:
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).
[Windows RT Development and Hacking] samco08:
Hello !

I'm not at home...... somebody can try to install FDM ?

you're nice..

@=
[Windows RT Development and Hacking] mamaich:
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.
[Windows RT Development and Hacking] goodintentions:
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.
[Windows RT Development and Hacking] danthekilla:
As far as I can tell yes, but not yet and maybe not ever at the speeds required to play properly. Lots of dlls would need implementing etc...
[Windows RT Development and Hacking] goodintentions:
Well, then there's hope. I understand that this is a work in progress.
[Windows RT Development and Hacking] GoodDayToDie:
I'll be honest, SC is on my list as well. The current version doesn't support it though, so I can't say.

The minimum requirements are ludicously low: Pentium chip, 90 MHz. That's actually within reach for the x86 dynamic recompiler; we *might* already be there.

The bigger problem is the legacy compatibility. SC is better than a lot of other games from its era becuase it was actually written to support running on NT (most games from 98 - yes, SC has been out for 15 years now - only ran on 9x) but it still uses a ton of APIs that have been deprecated over the years. It's quite likely that RT doesn't provide at least one of its dependencies. Hell, ever since WIndows 2000, it's had occasional problems with graphics weirding out; Vista and later have freeze problems due to a bug in the compatibility layer used for supporting the ancient DirectX version SC is written for. If you look at Task Manager while it's running, you'll see there's also a program called CompatibiltyLayer.exe (or similar) running as well; RT almost certainly doesn't have that.

I remain hopeful, though. I don't expect this to run Supreme Commander or EVE Online (at least not playably), but Total Annihilation and StarCraft are possible.
[Windows RT Development and Hacking] THEBIG360:
Can someone please tell me an app which will install, wouldn't mined seeing it working. I cannot get anything to run, just get errors like posted one page back.
[Windows RT Development and Hacking] goodintentions:
Please help. I accidentally chose ie when it asked for which type of file to run. In android I can wipe out default. Don't know what to do with windows.
[Windows RT Development and Hacking] francesco.piccia:
Trying to run Slender x86, it say that i miss Opengl32.dll

What can i do?
[Windows RT Development and Hacking] netham45:
There is no OpenGL support, as a search would have told you.
[Windows RT Development and Hacking] GoodDayToDie:
In an effort to curtail the sudden deluge of "what can I run?/Why can't I run.../It doesn't work!" posts on here (which I admit I may have contributed to), it may help to start up a second thread for win86emu app compatibility. Leave this thread for development and bug reports. Use the other thread to list compatible apps and help people solve incompatibilities, and to give people a place they can request support for certain DLLs or entire apps.

I could create this thread if you wish, although the "ported apps" thread already takes up a noticeable amount of time what with testing things.
[Windows RT Development and Hacking] WizardCM:
Would it be possible to support The Sims 1/2 in the future?

[092DF098]W: 051B0000-05201000 : D:\The Sims 1\IMM32.dll
[092DF0A7]E: Import User32InitializeImmEntryTable not found in C:\Program Files\win86emu\System32\USER32.86.dll
[092DF0A7]E: Import WCSToMBEx not found in C:\Program Files\win86emu\System32\USER32.86.dll
[092DF0D6]W: 05210000-05214000 : D:\The Sims 1\API-MS-Win-Core-LocalRegistry-L1-1-0.dll
[092DF0E6]E: PeLdr can't open file: API-MS-Win-Security-Base-L1-1-0.dll
[092DF0E6]E: Import dll API-MS-Win-Security-Base-L1-1-0.dll not found
[092DF0E6]E: Import dll IMM32.dll not found
[092DF0F6]E: Error loading program: 1168
[092DF0F6] Logger unloaded
[Windows RT Development and Hacking] THEBIG360:
That would be great if you could mate.
[Windows RT Development and Hacking] SixSixSevenSeven:
Its quite simple really. Slender uses OpenGL. Windows RT does not support OpenGL or OpenGL ES. I believe in the porting apps thread someone mentioned a theoretical workaround to have software OpenGL but that would be incredibly slow.

---------- Post added at 10:54 AM ---------- Previous post was at 10:50 AM ----------

Ignore those errors for now. There is a greater issue.

The effective speed of this emulator is only about 90MHz. Far far below what sims requires (and slender as mentioned above actually). Would probably take ages to get to the main menu, wont ever be playable. Hell, the first sims wasnt very playable on my old 800MHz machine (although it did only have an ancient fastvoodoo GPU)
[Windows RT Development and Hacking] SixSixSevenSeven:
Too demanding. Requires a 500MHz CPU. This has been estimated at 90 I think someone said.
[Windows RT Development and Hacking] mamaich:
It is a good idea to open the thread where to post not only the list of working apps, but also the instructions on getting them running. I was planning to open such thread later, when the list of the supported apps would become too big to fit into the first post here.

The next public build would be delayed for about a week or two, as I have to make an additional tool. I'm trying to automate the generation of wrapper DLLs using header files from windows SDK, and now looking for a good C++ parser. Or for a good database of WinAPI functions with all parameters. Or maybe I'll parse the web site of http://www.pinvoke.net. Or maybe I'll get my hands on the AST generated by LLVM clang compiler, or maybe something else. I thought about using PDB files, but I can't get function args as all type information is striped from them.