leecher1337 / ntvdmx64

Run Microsoft Windows NTVDM (DOS) on 64bit Editions
822 stars 81 forks source link

Windows XP x86??? #106

Open pachuco opened 4 years ago

pachuco commented 4 years ago

As crazy as it sounds, I'd like to fool around with this project in windows XP x86. Maybe learn a thing or two and maybe one day make my own NTVDM, with blackjack and hookers. What are reccomendations for building this project for XP x86?

pachuco commented 4 years ago

Adding to previous question, what are differences between various windows versions, of NTVDM. NT4 -> win2k -> XPSP1 -> win2k3

in 2k3 build, I can already see reliance on RtlReleaseRelativeName and RtlDosPathNameToRelativeNtPathName_U, which are missing from XP.

leecher1337 commented 4 years ago

So you mean, you want to do the MONITOR build which is the same as the NTVDM that is shipped with Windows XP and uses V86 mode? Well, I guess, just build the NTVDM from source without my patches or anything from this repository and you are good to go. As it compiled in OpenNT project properly, it should compile for you too.

If you just want to extend the functionality of the original XP NTVDM, I suggest writing VDD extensions instead, as you can add hardware support etc. to NTVDM with it, and if you do it right, they may also work with NTVDMx64 and therefore you can legally share your useful extensions with other users without the necessity for them to build it on their own. Documentation for this can be found in the DDK. VDMsound and SoundFX2000 are good examples for complex VDD extensions, but there are also other samples in NTDDK. Basically depends on what you are trying to do.

From what I recall, after NT4, they added LFN support, support for Terminal Server, Hotpatching support and Soundblaster 1.0 and ADLIB support (even though they had a more basic version of it as VDD in NT4 already as a driver example). Before getting my hands on MINNT source, I tried to implement missing features of newer NTVDM with my own code, which can be found at https://github.com/leecher1337/ntvdmx64/tree/master/ntvdmpatch/updates What a waste of time, I should have looked at MINNT release earlier, but may be interesting for documentation purposes on what I found as a diffrence to NT4 NTVDM. Far East and PC98 support was also added. Ah, and before I forget it: They completely rewrote DPMI support. As they didn't ship for non-x86 CPUs anymore, by doing that, they also eliminated support for non-x86 machines, that's the reason why I am still using NT4 DPMI code and NT4 WOW16 Kernel also in MINNT build (thus, new DPMI interface is completely useless for my purposes).

For other differences, just do a diff on the code yourself to find out :-)

pachuco commented 4 years ago

I would like to change beyond VDDs, and get acquainted with the beast over longer time. Care little about legality. I might pull improvements from here, but I definitely see obstacle in post-NT4 changes, now that you mention. I want to isolate NTVDM from windows(without integration loss), including v86 support(probably doable as a driver).

I think a source diff across NT3.5 -> NT4 -> w2k -> xpsp1 -> win2k3 is a good starting point. But I need pay attention at what source folders are relevant to compare. So far, I can tell there is mvdm folder, shell extension code inside shell32, olethk32, v86 kernel level support.

leecher1337 commented 4 years ago

You can definitely use some bugfixes from this repository, as there are bugs in NTVDM. I also tried to make the patches that way so that MONITOR build should still work with some adaptions (replaced some #ifdef i386 with #ifdef MONITOR, where appropriate). I brutally rewrote some Makefiles to compile for X86 (i.e. by pretending we are on PPC), these should be fixed to distinguish between MONITOR, HAXM and CCPU build, but that shouldn't be much of a problem using build environment variables (like I use CCPU and HAXM environment variables to distiguish the builds and handle the Makefiles accordingly). I didn't do this yet, as I had no need to build MONITOR-build, so it would be a waste of time for me, but pull requests are very welcome!

Your project sounds very intersting to me, pulling out V86 support from the kernel and putting it into a seperate driver (given the fact that this is tightly integrated with the OS kernel, that won't be very easy) might also be helpful for NTVDMx64 (i.e. for improving HAXM build), so I'm looking forward to your work on this.

I'm attaching 2 documents for you that might help you understanding the inner workings of NTVDM: zeronights.pdf ntvdm-workings.pdf

leecher1337 commented 2 years ago

As for implementing V86 on x86-64, these documents may be interesting for you: https://www.mysciencework.com/patent/show/systems-methods-running-legacy-32bit-x86-virtual-machine-64bit-x86-processor-EP1628215A2

You can take some inspirations from this driver and port it to Windows Kernel: https://sourceforge.net/projects/v86-64/

Any progress on your project?

pachuco commented 2 years ago

No, not really.

DracoMan671 commented 2 years ago

looking forward to possible v86 mode on x64

kristibektashi commented 1 year ago

looking forward to possible v86 mode on x64

Same