Does ReactOS NTVDM work in Windows?

Here you can discuss ReactOS related topics.

Moderator: Moderator Team

MugenFighter
Posts: 333
Joined: Tue Feb 24, 2015 6:03 pm

Does ReactOS NTVDM work in Windows?

Post by MugenFighter » Sat Oct 03, 2015 8:18 pm

Kind of a stupid question, but will ReactOS's NTVDM work in Windows without messing up Window's code?
I'm a MugenFighter, but not the one you are thinking about. I'm actually MugenFighterTube. Now don't ask about MugenFighter's characters.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Sat Oct 03, 2015 9:26 pm

Yes it works; it's how I actually do most of my NTVDM development. Just copy elsewhere/rename the original windows' ntvdm.exe (be careful that in system32\dllcache you need also to do the same, otherwise windows will detect that a system file was "deleted"/modified and will try to restore it). Then drop in system32 the ReactOS ntvdm.exe.

EDIT: Works correctly on Windows 2k/2k3. For Windows 7+, see my answer in the next post.
Last edited by hbelusca on Sun Oct 04, 2015 1:48 am, edited 1 time in total.

cordata
Posts: 3
Joined: Wed Jun 24, 2015 4:46 am

Re: Does ReactOS NTVDM work in Windows?

Post by cordata » Sat Oct 03, 2015 10:39 pm

If it works in Windows 7 and above then this could be a great way to get some excitement going about ReactOS.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Sun Oct 04, 2015 1:47 am

cordata wrote:If it works in Windows 7 and above then this could be a great way to get some excitement going about ReactOS.
Sadly it doesn't work in what I would call "OS-integrated" mode (aka. when you double-click a DOS app, ntvdm opens and starts your app) starting Windows 7+ in x64/... (non-x86) editions, because the code needed to start ntvdm when a DOS app is started, is removed in those windows editions. This code is however present in x86 editions so you may test it there. In case you have win7+ x64 the only way to use ntvdm is to recompile it in "standalone" mode. You then can launch a dos app by doing: "ntvdm.exe your_dos_app.exe".

Also, in Windows 7 and above (I haven't tested it in Vista because I don't have Vista, but I guess it could be the same), an (artificial?) regression is present, which forbids you to use console graphics screen-buffers (allowing you to have graphics inside the console). For Microsoft people it's not a "problem" since they allow you to only use ntvdm with text-mode apps, and if you try starting a DOS app which wants graphics you are greeted with a message saying graphics mode is not supported. A workaround for us would be to open a separate window and do the graphics stuff there, but atm. we haven't implemented it (we only use the console graphics screen-buffers functionality).

MugenFighter
Posts: 333
Joined: Tue Feb 24, 2015 6:03 pm

Re: Does ReactOS NTVDM work in Windows?

Post by MugenFighter » Sun Oct 04, 2015 4:54 pm

hbelusca wrote:
cordata wrote:If it works in Windows 7 and above then this could be a great way to get some excitement going about ReactOS.
Sadly it doesn't work in what I would call "OS-integrated" mode (aka. when you double-click a DOS app, ntvdm opens and starts your app) starting Windows 7+ in x64/... (non-x86) editions, because the code needed to start ntvdm when a DOS app is started, is removed in those windows editions. This code is however present in x86 editions so you may test it there. In case you have win7+ x64 the only way to use ntvdm is to recompile it in "standalone" mode. You then can launch a dos app by doing: "ntvdm.exe your_dos_app.exe".

Also, in Windows 7 and above (I haven't tested it in Vista because I don't have Vista, but I guess it could be the same), an (artificial?) regression is present, which forbids you to use console graphics screen-buffers (allowing you to have graphics inside the console). For Microsoft people it's not a "problem" since they allow you to only use ntvdm with text-mode apps, and if you try starting a DOS app which wants graphics you are greeted with a message saying graphics mode is not supported. A workaround for us would be to open a separate window and do the graphics stuff there, but atm. we haven't implemented it (we only use the console graphics screen-buffers functionality).
Would it make a difference if you used ReactOS's console to open the ntvdm in Windows?
I'm a MugenFighter, but not the one you are thinking about. I'm actually MugenFighterTube. Now don't ask about MugenFighter's characters.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Sun Oct 04, 2015 5:52 pm

MugenFighter wrote:Would it make a difference if you used ReactOS's console to open the ntvdm in Windows?
Your question therefore becomes: "Does ReactOS console work in Windows?" .

The console I'm talking about is the console subsystem, meaning, the module in ReactOS/Windows which creates for you text-mode windows and draws the text in them, implements the console APIs, etc... (On the contrary, text-mode aka. console applications, for example the command-line cmd.exe, other text-mode utilities like ping.exe ... and NTVDM itself, use those APIs to output their text on the screen). While our console subsystem is compatible with Windows 2k3, it is not compatible at all with Windows 7+, because MS changed all of its architecture (first changes in Windows 7, then other changes starting Windows 8).

So, the answer to the modified question is: "Yes the ReactOS console work in Windows 2k3; no it doesn't in Windows 7+".

MugenFighter
Posts: 333
Joined: Tue Feb 24, 2015 6:03 pm

Re: Does ReactOS NTVDM work in Windows?

Post by MugenFighter » Wed Oct 21, 2015 8:59 pm

hbelusca wrote:
MugenFighter wrote:Would it make a difference if you used ReactOS's console to open the ntvdm in Windows?
Your question therefore becomes: "Does ReactOS console work in Windows?" .

The console I'm talking about is the console subsystem, meaning, the module in ReactOS/Windows which creates for you text-mode windows and draws the text in them, implements the console APIs, etc... (On the contrary, text-mode aka. console applications, for example the command-line cmd.exe, other text-mode utilities like ping.exe ... and NTVDM itself, use those APIs to output their text on the screen). While our console subsystem is compatible with Windows 2k3, it is not compatible at all with Windows 7+, because MS changed all of its architecture (first changes in Windows 7, then other changes starting Windows 8).

So, the answer to the modified question is: "Yes the ReactOS console work in Windows 2k3; no it doesn't in Windows 7+".
Sorry to revive a kind of old topic, but can you get this stuff to work in XP? I'm really sorry if that is a stupid question.
I'm a MugenFighter, but not the one you are thinking about. I'm actually MugenFighterTube. Now don't ask about MugenFighter's characters.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Wed Oct 21, 2015 9:03 pm

MugenFighter wrote:
hbelusca wrote:[...]So, the answer to the modified question is: "Yes the ReactOS console work in Windows 2k3; no it doesn't in Windows 7+".
Sorry to revive a kind of old topic, but can you get this stuff to work in XP? I'm really sorry if that is a stupid question.
Yes, it works on XP and 2k3 (it can work on 2k either, if you recompile it with something disabled; it doesn't work on NT4-. And it doesn't work on 7+ as described in my previous post).

justincase
Posts: 440
Joined: Sat Nov 15, 2008 4:13 pm

Re: Does ReactOS NTVDM work in Windows?

Post by justincase » Wed Oct 21, 2015 9:17 pm

hbelusca wrote:it can work on 2k either, if you recompile it with something disabled
How can I compile it to support running on Win2K? (and what does it lose by doing so?)
I reserve the right to ignore any portion of any post if I deem it not constructive or likely to cause the discussion to degenerate.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Wed Oct 21, 2015 11:22 pm

You need to enable the #define WIN2K_COMPLIANT there:
http://svn.reactos.org/svn/reactos/trun ... markup#l54
At the moment, you don't lose anything (more precisely the #define is used just for an alternative code path when computing the needed size of some temporary buffer for displaying error messages...).

justincase
Posts: 440
Joined: Sat Nov 15, 2008 4:13 pm

Re: Does ReactOS NTVDM work in Windows?

Post by justincase » Wed Oct 21, 2015 11:55 pm

hbelusca wrote:You need to enable the #define WIN2K_COMPLIANT...
Ah, I see a few lines up, that's where I'd enable "#define STANDALONE" too.
Thanks.

If you don't lose anything by compiling it with #define WIN2K_COMPLIANT enabled, why isn't it enabled by default? I suppose I'm asking "What's the benefit of the non-Win2K-compliant code path?"
I reserve the right to ignore any portion of any post if I deem it not constructive or likely to cause the discussion to degenerate.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Thu Oct 22, 2015 12:46 am

justincase wrote:If you don't lose anything by compiling it with #define WIN2K_COMPLIANT enabled, why isn't it enabled by default? I suppose I'm asking "What's the benefit of the non-Win2K-compliant code path?"
Search through the code where I use it ;)

justincase
Posts: 440
Joined: Sat Nov 15, 2008 4:13 pm

Re: Does ReactOS NTVDM work in Windows?

Post by justincase » Thu Oct 22, 2015 1:08 am

justincase wrote:What's the benefit of the non-Win2K-compliant code path?
hbelusca wrote:Search through the code where I use it ;)
OK... I'm not sure exactly what's going on between the Buffer, StaticBuffer, an Auxiliary Buffer (if needed), and the message length, but ... If I had to guess, it looks like memory optimizations, so... does it use less memory because the StaticBuffer is smaller? or does the the use of a StaticBuffer make it faster? ... or ... is it a bit of both?

I'm ... just a bit confused.
I reserve the right to ignore any portion of any post if I deem it not constructive or likely to cause the discussion to degenerate.

hbelusca
Developer
Posts: 1151
Joined: Sat Dec 26, 2009 10:36 pm
Location: Zagreb, Croatia

Re: Does ReactOS NTVDM work in Windows?

Post by hbelusca » Thu Oct 22, 2015 1:51 pm

justincase wrote:OK... I'm not sure exactly what's going on between the Buffer, StaticBuffer, an Auxiliary Buffer (if needed), and the message length, but ... If I had to guess, it looks like memory optimizations, so... does it use less memory because the StaticBuffer is smaller? or does the the use of a StaticBuffer make it faster? ... or ... is it a bit of both?

I'm ... just a bit confused.
Yes this is memory optimization. More exactly, I use a function (_vscwprintf) from the CRT in order to retrieve the full length of the formatted message to be displayed (if it is too long, I allocate a new buffer, otherwise I use a small static one, of 256 characters). However, in Win2k, there is no _vscwprintf function (in other words, if I run the NTVDM compiled as it is, on win2k, I would get a Windows error saying that the export "_vscwprintf" doesn't exist). So, to have a similar functionality as what is used in the NTVDM which works on XP/2k3/ReactOS, i.e. to get a big enough buffer for the formatted message, you would certainly do some kind of black magic, or alternatively (and this is what I do with the #define WIN2K_COMPLIANT enabled) use a static buffer of large-enough hardcoded size (2048 characters) for the messages, and hope NTVDM will not have to print longer messages.

justincase
Posts: 440
Joined: Sat Nov 15, 2008 4:13 pm

Re: Does ReactOS NTVDM work in Windows?

Post by justincase » Thu Oct 22, 2015 9:18 pm

OK, sweet.
Thanks for the explanation.

I guess I have one more question though: Did you develop it in the Win2K friendly way, then do the optimisations to make it better in later versions of Windows/ReactOS, or did you develop it with using _vscwprintf, then decide to add support for Win2K?

I'm curious as to whether you develop on/for Win2K, or if you don't (normally), but think it worth adding such ... I guess this is a workaround? ... to be able to support it.
I reserve the right to ignore any portion of any post if I deem it not constructive or likely to cause the discussion to degenerate.

Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 3 guests