[Beta] Win86emu: Running x86 apps on WinRT devices

Search This thread

SixSixSevenSeven

Senior Member
Dec 26, 2012
1,617
318
Trying to run Slender x86, it say that i miss Opengl32.dll
What can i do?

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

Would it be possible to support The Sims 1/2 in the future?

HTML:
[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

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)
 

mamaich

Retired Recognized Developer
Apr 29, 2004
1,150
228
mamaich-eng.blogspot.ru
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.

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.
 
  • Like
Reactions: dousi96

mamaich

Retired Recognized Developer
Apr 29, 2004
1,150
228
mamaich-eng.blogspot.ru
Regarding the speed.
I think on making my own x86 CPU emulation core instead of using DosBox and Bochs. That core would be optimized only for 32 bit x86 code, linear memory, no PF and AF CPU flags (they are not used in windows apps, only small subset of FPU flag testing functions are using them), for other flags - I'd try to use native CPU flags as much as possible. The translation process would be using all of the CPU cores you have to pregenerate needed code before its execution. I may store the generated code in some intermediate form on disk so that it may be more heavily optimized later when the program is not running. The engine would support self-modifying code, but the speed would be optimized for programs that don't modify themselves. This would give a good speed, much faster than the dynamic DosBox core.

The work on that engine would not start earlier than at the end of this year. Currently I'm working on the WinAPI - the stability and completeness are the first goals.
 
Last edited:

SixSixSevenSeven

Senior Member
Dec 26, 2012
1,617
318
Yeah, but I'm wondering if it'd be possible with future, more optimised builds. Surely 90MHz isn't the highest that it's physically possible to go?

As said in the post before yours it can probably be improved a little. 90MHz, not amazing but it is a considerable improvement on not being able to run x86 at all.



Mamaich. Keep up the excellent work. If you can complete a more optimised core then thats great. If not then you have already done an excellent service to the community.
 

lebow

Member
Mar 7, 2012
33
3
Support Thread

Is their a thread that shows compatibility of apps/games with your emulator? does age of empires currently work at all?
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
@mamaich: That is fantastic. For myself, I'd usually recommend using the Clang C/C++ parser for this kind of thing; it's much better documented and easier to extend than GCC, and also has a very clear compilation pipeline that makes it easy to pull out the specific layer of the process that you want to use and pipe it into another codebase. TCC (Tiny C Compiler, originally by Fabrice Bellard*) is another possibility, though I don't know if it supports all the calling convention "keywords" used in MSVC sources correctly (which you would obviously need). It's smaller than Clang though, which may make using it for a specialized purpose easier.

As for writing your own DynRec engine, that would be an incredible project - one which I would truly love to see, and which I would strongly recommend that you open-source for collaborative development - but I'm glad to see you've got a good plan for compatibility first. While gaming would be (already is, actually - I love HoMM3 as well) a great acheivement, most of the programs that I want to run are simply small utilities that were never open-sourced, or possibly even some that are too much hassle to port. With those, perf is much less of an issue. Maybe I'm in the minority, there, though. Regarding the project itself, self-modifying code or even anything using JIT compilation sounds very tricky (offsets constantly changing due to different instruction sizes, probably needing to use copy-on-write for modifying code and then recompiling the written instructions and fixing the offsets) but it occurs to me that one of the huge improvements it could give is to take advantage of the processor-specific optimizations already present on the Tegra 3 (and any other chips you target). Even with a nominally RISC ISA (like ARM), some instructions will be more expensive than others and using more efficiently selected instructions may improve speed over straight transliteration of the x86 code.

* himself an excellent hacker who once wrote a full x86 emulator using JavaScript and hosted a website that allowed running Linux in the browser. It even works on RT (or my WP7 phone, for that matter) but It's uselessly slow for this purpose. http://bellard.org

@SixSixSevenSeven: Please don't take the "90 MHz" statement as gospel. For one thing, it's an incredibly rough approximation based largely on numbers pulled from my ass. For another, that was based on "will it run SC?" not "what is the actual emulated speed?" so while it's a reasonable statement that "it will probably be possible to run SC even if not quickly, and the requirements for AoE are about the same", it's probably not accurate to say "the emulated CPU runs at this speed."

Also, CPU clock speeds only tell a portion fo the story. As I mentioned above, some instructions are faster than others, and this largely depends on the CPU being used. The Core iN series of Intel CPUs often run at a lower clock rate, per core, than most Pentium 4 chips did. However, they are far, far faster than the P4 at real-world operations, because the P4 architecture ("netburst") was very poorly optimized for certain operations, such as branching; if it "guessed" wrongly at the outcome of an "if" statement, it had to throw away potentially dozens of clock cylces of work to refill the pipeline with the other branch's instructions. Since the performance of win86emu isn't going to exactly duplicate any Intel or AMD CPU, you can't really make a statement of "it runs at the speed of an X CPU at Y MHz" even if we had a proper way to measure that.

Speaking of which, though, it may be good to get some additional benchmarking tools to run. 7Z uses a fairly simple set of instructions, and while it's interesting as a data point, it's not an ideal indicator of how fast many other types of program (games, audio decoders, OpenGL emulation in software, any kind of AI, anything heavy on floating-point, anything that makes a bunch of system calls through the win86emu stub DLLs, etc.) will run.
 

Mr. Argent

Senior Member
Dec 25, 2010
65
6
Elmhurst, IL
z097UII.png

We've got SkiFree! What more could you possibly want? :p
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Win86emu supports 16-bit software? Or was there a 32-bit SkiFree version somewhere? You can be sure as hell the original 1991 version wasn't 32-bit, and I remember playing it on DOS-based Windows without Win32s.

EDIT: Never mind, I didn't know about the 32-bit version. I don't expect mamaich has re-implemented the whole NTVDM.
 
Last edited:

bartekxyz

Senior Member
Aug 15, 2011
56
50
Win86emu supports 16-bit software? Or was there a 32-bit SkiFree version somewhere? You can be sure as hell the original 1991 version wasn't 32-bit, and I remember playing it on DOS-based Windows without Win32s.

Sure there is 32-bit version. Guy who coded Ski Free in 1991 found source code in 2005 and recompiled it for 32-bit systems.
 

-obiwan-

Member
Dec 13, 2011
29
4
Support for Sonos Desktop Controller and Spotify

Hi there, fantastic work! Would it be possible to Support Sonos Desktop Controller and/or Spotify Windows Client in the future?

Thanks,
OW
 

Hzj_jie

Member
Sep 10, 2008
5
2
really a cool project, a minor suggestion, would you please consider to add a command line parameter support, so we can add a shortcut in start menu, say 'Launcher.exe abc_x86.exe'?
 

Gavisann

Senior Member
Jun 28, 2011
230
31
I tried running Microsoft Math and I get the error that mcoree.dll was not found. Anyway I can fix this? Thanks.
 

Joevisco

Member
Oct 1, 2010
42
4
Running BlueStacks

Would this allow us to run bluestacks on our rt devices? So bummed that they only released it for Windows 8 and not RT.
 

gregpxc

Member
Aug 25, 2011
19
0
I would love bluestacks, but it's so buggy on it's own at this point. I have been playing with ps1, N64, and GBA emulators but I am not as good at this as I thought. I did install Win2000 in VirtualBox to pull out the DLLs and even with all of them most things error out,
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Just for the hell of it, I tried installing Firefox 1.08. I wouldn't bother reporting except some weird stuff happened:
1. Running the installing through win86emu started a self-extractor program that ran extremely slowly and at max CPU usage, after around a minute it had yet to show a single bar of progress. Extracting using 7z took only a few seconds for the whole thing.
2. Running the extracted installer "worked" except that the installer program tossed up an error MessageBox: "File not found: install.ini". After that it exited (errorcode 0). This is weird because install.ini is definitely present in the extraction folder, and can be opened successfully. I tried copying it to the win86emu folder or even the system32 folder, just in case; no dice. Whatever the reason might be, the installer apparently can't open that file.
 

gregpxc

Member
Aug 25, 2011
19
0
Just for the hell of it, I tried installing Firefox 1.08. I wouldn't bother reporting except some weird stuff happened:
1. Running the installing through win86emu started a self-extractor program that ran extremely slowly and at max CPU usage, after around a minute it had yet to show a single bar of progress. Extracting using 7z took only a few seconds for the whole thing.
2. Running the extracted installer "worked" except that the installer program tossed up an error MessageBox: "File not found: install.ini". After that it exited (errorcode 0). This is weird because install.ini is definitely present in the extraction folder, and can be opened successfully. I tried copying it to the win86emu folder or even the system32 folder, just in case; no dice. Whatever the reason might be, the installer apparently can't open that file.

Too weird. I was just working on this! Download FF 2.0.0.11 and extract the initial .exe file. Then run the setup.exe in the extracted folder. You actually get the splash screen but when clicking the "Next" button, nothing happens. I am going to try and run FF 4.0 and see if that behaves differently... or at all.

Quick Edit: After downloading FF 4.0 I found an actual Firefox.exe file, which means no installer to worry about. Could this work? right now my error is:

Code:
[003CA8CF]W: 06310000-06317000 : E:\4.0_FirefoxSetup4.0\core\plc4.dll
[003CA8DE]W: 064D0000-064D7000 : E:\4.0_FirefoxSetup4.0\core\plds4.dll
[003CA8FD]W: 067D0000-067F1000 : E:\4.0_FirefoxSetup4.0\core\ssl3.dll
[003CA91D]W: 064E0000-064E6000 : E:\4.0_FirefoxSetup4.0\core\mozalloc.dll
[003CA93C]W: 06800000-06825000 : C:\Program Files\win86emu\System32\USER32.86.dll
[003CA96B]W: 06830000-0684D000 : C:\Program Files\win86emu\System32\GDI32.86.dll
[003CA98A]E: Import GetCharWidthI not found in C:\Program Files\win86emu\System32\GDI32.86.dll
[003CA99A]W: 06850000-06867000 : C:\Program Files\win86emu\System32\SHELL32.86.dll
[003CA9B9]W: 06870000-0688B000 : C:\Program Files\win86emu\System32\ole32.86.dll
[003CA9D8]W: 06890000-068A4000 : C:\Program Files\win86emu\System32\VERSION.86.dll
[003CA9F7]E: PeLdr can't open file: WINSPOOL.DRV
[003CA9F7]E: Import dll WINSPOOL.DRV not found
[003CA9F7]E: Import dll xul.dll not found
[003CAA07]E: Error loading program: 1168

I am going to try and dig through my Win2000 install for the missing DLLs and .DRV file
 
Last edited:

lr89stang

Member
Oct 4, 2009
18
6
VirtualClone

Great Job.
Is it possible to run a virtual drive.
Software in question: Virtual CloneDrive
 

Top Liked Posts

  • There are no posts matching your filters.
  • 96
    The project is abandoned.

    As I no longer own a Windows RT device and I'm not willing to use Windows RT anymore, unless Microsoft would make it more open (at least to run your own desktop apps) - I've decided to stop working on this project.

    As usual I'm publishing complete sources of this tool. Feel free to use them in your own projects or to continue developing this one - only leave my copyrights somewhere.
    Don't ask me how to build the sources or to explain anything in them. Figure that out yourself.

    The project is abandoned. Sorry.

    I'm presenting a tool that allows running a set of x86 Windows applications on Windows RT (ARM) tablets. Its goal is to support all apps except for those that:
    - require much CPU power,
    - use complex features that were cut out from WinRT like D3D9 extensions or OpenGL,
    - require drivers or specific services,
    - make heavy use of COM interfaces,
    - use undocumented windows internals,
    - apps that use .NET framework,
    - x86 Metro apps,
    - 16 or 64 bit Windows programs,
    - buggy apps that require special workarounds.

    The tool is currently on a beta stage, so don't expect much from it. It is far from being complete, but at least it runs something.

    Current version: 0.061
    Just a minor update. The project is not dead, I just had no time to continue the development.
    Attached the fixed ntdll.nt.dll that works under Windows RT 8.1 (Microsoft removed some NTDLL exports, so I had to add more stubs). This fix is not needed on RT 8.0.
    To install it: extract the attached 0.061-ntdll.nt.dll.zip to c:\x86node\windows\SystemNT\ overwriting the existing file.
    Autostarting x86 programs does not work on RT 8.1 ("can't install CreateProcessInternal hook"). I'll look on this later.
    Don't ask on jailbreaking the 8.1 beta in this thread - there is a good progress on it, more info would be on release (in october or when WZOR would leak the RTM).

    Current version: 0.06
    Seems that archive is too big to be attached, so I've uploaded it to google drive and here
    Installation: extract the archive on your unlocked Windows RT device, run the MSI file and follow the instructions.
    Note: Uninstall the previous version before installing a new one.
    List of compatible apps is in this post: http://xdaforums.com/showthread.php?p=40924456

    Trademarks
    Windows is a registered trademark of Microsoft Corporation. ReactOS is a registered trademark or a trademark of ReactOS Foundation. All other trademarks are the property of their respective owners.

    Disclaimer
    This software is provided "as is". Use it on your own risk. I make no warranties as to performance, merchantability, fitness for a particular purpose, or any other warranties whether expressed or implied. No oral or electronic communication with me shall create a warranty of any kind. Under no circumstances should I be liable for direct, indirect, special, incidental, or consequential damages resulting from the use, misuse, or inability to use this software, even if I has been advised of the possibility of such damages.
    I'm trying my best to make the software working, but I can't guarantee that it is free from defects.

    All beta versions of this tool would be freeware. You may freely use it for your own, embed it into your tool, but you can't use it commercially without my confirmation. You can disassemble, analyze or modify this tool for yourself - later I'll provide SDK and document its internals. The only thing that is prohibited is changing embedded copyright notices. I reserve the right of making the project commercial, but this does not mean that this would ever happen.

    This software contains unmodified binaries from the ReactOS project: a registry editor, cmd.exe, ole32.dll to name the few. Those binaries are left unmodified and are covered by LGPL license. Future versions may contain redistributable binaries provided by Microsoft and/or other companies.

    Some more information may be found in my blog. If you want to support development - use the link or press the button on the left side of the post.
    11
    Changes:
    15 may 2013: DInput and DInput8 changes for Fallout2 keyboard compatibility.
    12 may 2013: A minor update. Fallout 2 now works, tested on Russian version from 1C.
    01 may 2013: Added the ability to automatically launch x86 applications. Added the shell32 interfaces - so that installers now work (at least NSIS and InstallShield installers are known to be working).
    05 apr 2013: Fixed a few bugs.
    04 apr 2013: Uploaded a new build after a long delay. Now emulator supports 256-color modes. But due to a limitation on an updated Nvidia driver - 640x480 and 800x600 display modes are no longer supported on Windows RT. You'll see the black lines to the right and bottom of the screen if the program tries to set such mode.
    25 feb 2013: The tool now outputs its version to log. Now one x86 program may launch another - so some of the installers and, for example, 7Z GUI frontend can now run under emulation. Added ~80 DLLs. Some of them are stubs (like D3D9.DLL), others are mostly untested. I have not done all that I've planned for this build, publishing it just as an update to show that the work is going on. Do not expect it to run much more than the previous build.
    13 feb 2013: more informative errors from launcher. Emulator now supports program paths with spaces. EXE files with relocations are now processed correctly. Some bugfixes in kernel32 and advapi32.
    11 feb 2013: fixed a typo in winmm.dll emulation, now pinball has sound. Also updated the launcher.
    10 feb 2013: now the program reached the beta stage.

    Known problems
    No D3D and most of COM interfaces. Lots of programs would crash, don't run or have different issues.

    Notes:
    The program keeps its settings in the HKCU\Software\x86node\Settings registry key. Supported REG_SZ (string) values are:
    DosboxCore: "dynamic", "simple" or "normal". Dynamic is the default as it is the fastest, but the most buggy core.
    LogFile: path to the log file. If not present - log file is %temp%\win86emu.log
    Supported REG_DWORD values:
    LogLevel: 0=no log (default), 4=max logging
    added 13 feb 2013: now default log level is 2: warnings+errors, so you don't need to edit registry

    There are several compatibility hacks that may be useful. Compatibility settings are stored in HKCU\Software\x86node\Compatibility\[filename.exe] key. "filename.exe" - a name of the emulated EXE file without path. All values are DWORD:
    SetProcessAffinityMask = bitmask. Specify which CPUs to use for running a program, read SetProcessAffinityMask description in MSDN. 0 or unset == run on all cores.
    NoRaiseException = 1. RaiseException would just return. Now exceptions are emulated correctly, so this hack is no longer needed.
    UseDirectRegistry = 1. Do not redirect emulated registry keys to HKCU\Software\x86node. Be careful when using it.
    MaxProcessorFeaturePresent = max processor feature number that is "supported". See the IsProcessorFeaturePresent function in MSDN. All requests for the value above specified would return 0. Default: 0 (IsProcessorFeaturePresent always returns 0).
    SimulateAdminRights = 1. Lie to installers that call OpenSCManager function to determine that it is running as administrator, allowing these programs to run without elevation. Redirect the "common start menu" and similar folders to the per-user folders.
    You can fake the OS version to a running program. Default XP SP3:
    OSVersionLo=dword:00000001
    OSVersionHi=dword:00000005
    OSVersionBuild=dword:00000a28
    OSServicepackLo=dword:00000000
    OSServicepackHi=dword:00000003

    Some information on the project internals may appear in my blog: http://mamaich-eng.blogspot.ru, but this thread on XDA would be the main discussion place.
    3
    Sorry for the long delay.

    AOE is already working in my private build. But there are some issues I have to resolve before publishing it.
    3
    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.
    3
    heh, is this a port of the app you showed off back in the CE days? -awesome getting that ported over
    Not exactly a port, it is a clean remake based on the old ideas.
    Would you mind giving a technical explanation?
    The idea is very simple:
    - a PE file loader (load files, process relocs, run TLS callbacks in an emulation mode). Support import loops (DLL A imports B while B imports A), ordinals, etc.
    - a set of wrapper x86 DLLs (kernel32_stub.dll and so on) that "look like" the corresponding Win API functions for an emulated program:
    Code:
    #define DEFINE_FUNC1(name)      \
    static const ModuleDef str_##name={DLL_NAME,#name};     \
    EXTERN_C DW STUB_EXPORT stub_##name(DW p1)              \
    {       \
            DW *p=&p1;      \
            __asm { mov eax,p }     \
            __asm { jmp f1 }        \
            __asm { mov eax,offset str_##name }     \
    f1:     __asm { in eax,0xe5 }   \
            __asm { mov p,eax }     \
            return (DW)p;   \
    }
    .....
    #define DEFINE_FUNC3(name)      \
    static const ModuleDef str_##name={DLL_NAME,#name};     \
    EXTERN_C DW STUB_EXPORT stub_##name(DW p1,DW p2,DW p3)          \
    {       \
            DW *p=&p1;      \
            __asm { mov eax,p }     \
            __asm { jmp f1 }        \
            __asm { mov eax,offset str_##name }     \
    f1:     __asm { in eax,0xe5 }   \
            __asm { mov p,eax }     \
            return (DW)p;   \
    }
    ....
    DEFINE_FUNC1(AddAtomA)
    DEFINE_FUNC1(AddAtomW)
    DEFINE_FUNC7(CreateFileA) -- number in macro == number of parameters to a __stdcall WinAPI function. 
    Compiler automatically generates "ret N*4" at the end of such function. 
    I've decided to use such c+asm approach instead of making a tiny assebler stub, 
    as I can easily implement some of such functions in C directly in a stub DLL plus it 
    simplifies debugging. And the functions have a usual C prologue/epilogue, so that 
    the emulated program may even patch them in runtime, for example for hooks.
    ...
    - a 32-bit x86 emulation engine (currently 2 engines: from bochs and from dosbox, planning on adding my own) that intercepts the command "in eax,0xe5", determines which API is needed by a program and passes it to a handler.
    - native (arm) API handler DLLs (kernel32_yact.dll and so on). They are mostly autogenerated too:
    Code:
    #define DEFINE_FUNC1(name) 	\
    EXTERN_C DW STUB_IMPORT name(DW);	\                     -- this behaves like a function prototype to compiler
    EXTERN_C DW STUB_EXPORT yact_##name(DW *R)		\     -- R - pointer to the x86 stack 
    {	\
      DW r=name(p1);	\         // call the func passing it paramers from the emulated stack, p1==R[0], p2==R[1] and so on
      LEAVE(1);		\         // empty macro, as the stack is unwinded in x86 stub DLL now
      return r;		\
    }
    ...
    #define DEFINE_FUNC3(name) 	\
    EXTERN_C DW STUB_IMPORT name(DW,DW,DW);	\
    EXTERN_C DW STUB_EXPORT yact_##name(DW *R)		\
    {	\
      DW r=name(p1,p2,p3);	\
      LEAVE(3);		\
      return r;		\
    }
    ...
    DEFINE_FUNC1(AddAtomA)
    DEFINE_FUNC1(AddAtomW)
    DEFINE_FUNC7(CreateFileA)  // as you see - implementation part is identical to an x86 stub, so I can use the same stub-generator tool
    Some of the functions require complex emulation due to their absence in ARM or due to the callbacks to x86 code:
    Code:
    static DWORD WINAPI ThreadProc(
      LPVOID lpParameter	// [0] == orig func, [1] == orig param
    )
    {
    	__EXCEPTION_REGISTRATION_RECORD R;
    	DWORD *Parm=(DWORD*)lpParameter;
    	DWORD *TEB=(DWORD*)PeLdrGetCurrentTeb();
    	R.Next=(__EXCEPTION_REGISTRATION_RECORD*)-1;
    	R.Handler=(void*)CbReturnToHost();
    	TEB[0]=(DWORD)&R;	// in case of unhandled exception - just return 
    	PeLdrNotifyNewThread(NULL,DLL_THREAD_ATTACH);
    
    	DWORD Ret=EmuExecute(Parm[0],1,Parm[1]); // 1 == number of parameters to the emulated function
    	delete Parm;
    	return Ret;
    }
    
    EXTERN_C DW STUB_EXPORT yact_CreateThread(DW *R)
    {	
    	DWORD* Parm=new DWORD[2];
    	Parm[0]=p3;                               // TODO: no out-of-memory checking for now
    	Parm[1]=p4;
    	DWORD StackSize=p2;
    	if(StackSize)
    		StackSize+=1024*1024;      // I reserve some space for my own needs (debugging)
    	else
    		StackSize=2*1024*1024;     // TODO: I don't support autogrow stacks, so reserve 2 Mb
    
    	DWORD t=(DWORD)CreateThread((LPSECURITY_ATTRIBUTES)p1,StackSize,ThreadProc,Parm,p5,(LPDWORD)p6);
    	LEAVE(6);		
    	return t;
    }
    Some of the COM interfaces are already implemented, for example DirectDraw and DirectSound, though not heavily debugged. On a desktop emulator build I can already run "Heroes of might and magic 3" and old WinRAR, but there are several RT-specific OS limitations I need to bypass before making them run on ARM. Current work in progress is: overcoming the RT limitations, manually implementing the API functions that callback to a program code (like CreateThread, RegisterClassA and so on), adding stubs for other system DLLs/COM objects.
    Manually thrown SEH exceptions are fully supported, but access violation, int3 and similar OS-generated exceptions would cause program to crash. Some of the TEB fields (TLS and the fields required by the Borland compilers) are implemented too.

    I don't make pointer translation in an emulated code nor make parameter checks passed to API. As a side-effect - the emulated program may trash the emulator in memory, but this greatly increases speed.
    Most of the x86 EXE files don't contain relocations section and need to be loaded on the specific addresses (typically 0x400000). This is not a problem on a desktop, as I can rebase my emulator's EXE to any address I need, and free the corresponding RAM addrs for emulated program, but on ARM - this is a main problem. So currently only EXEs with relocs are supported for emulation, but there are ways to overcome this problem. And some EXEs produced by old Borland compilers contain "broken" relocs, this is a small problem too.