C # console applications are all 16 bit?

I was reading about NTVDM.exe when I create a quick test console application and it crashed on friends machine complaining about this EXE.

As I understand it, all DOS cmd windows (including C # console applications) work as 16-bit, not 32-bit.

It's true? Does this mean that all my office application console apps run as 16-bit and cannot use most of the 32-bit ones?

How about Windows services? I believe we wrote this as a console application and then started it as a windows service?

thank

+1


source to share


9 replies


Any .NET application compiled for x86 will be 32-bit



C # console applications do not run in "real" dos - they run in a 32-bit or 64-bit environment - depending on your OS and .NET framework.

+10


source


As I understand it, all DOS cmd windows (Including C # console applications) executed as 16 bit not 32 bit.

It's true?

No, absolutely not.



You can run DOS applications under Windows and they are 16-bit, but the fact that they look a little console-based is just a coincidence.

There are no 16-bit .NET applications and whether the application is in console mode or not, it doesn't matter if it is 16 or 32 bit.

+6


source


MS-DOS applications run like 16-bit applications under ntvdm.

"Windows Console" Applications are not DOS applications and run as a native Windows process (where a bit in the PE header of the EXE file identifies it as a console application, so Windows can create / prepare a Windows console for the application if it doesn't already exist, for example, launching the Console Application from CMD or PowerShell will reuse the already created console window, while double-clicking the EXE in Explorer will create a new console window for the application.)

CMD! = DOS

Windows Console! = DOS

In addition, there is the full Windows Console API that has been present in Windows since at least Windows 2000 (NT5), if not before (although probably only NT3 / 4).

+4


source


.NET Console Application. (or any other .NET application) will work like any target hardware JIT'ed on. So for x86 it will be 32 bits.

+2


source


As I understand it, all DOS cmd windows (including C # console applications) work as 16-bit, not 32-bit.

You are wrong. All cmd.exe files are 32 or 64 bit, depending on the architecture.

DOS died along with Windows ME almost ten years ago.

+2


source


I am not aware of any .NET VM implementation capable of running in 16-bit mode. The runtime of Microsoft .NET and Mono is only 32/64 bit. I don't know about the other smaller ones, but I would be surprised if they could work in 16-bit mode.

Also, cmd.exe runs in 32-bit mode because cmd.exe is a 32-bit Windows application. On the other hand, command.com runs in 16-bit mode.

In fact, console applications are far from 16-bit. This is simply not true, it was not even true before Windows, as x86 protected mode is 32 bits, so any DOS game or application running in data transfer mode is 32 bits.

In .NET, your UI type (or lack of UI as in Windows Services) does not affect the application word length. By default, .NET executables are platform independent and run as a 32-bit or 64-bit application depending on the type of .NET Framework, kernel, and so on. Host machines. Although they can be compiled directly to 64-bit too.

+1


source


There is nothing special about the exe console; it's just a PE file. This way, regardless of the console vs winform exe vs windows service, it just runs in whatever mode it has compiled.

Visual Studio etc. will never generate 16 bit exe. x86 vs x64 is more interesting; -p

Your friend may not have .NET installed (or only 1.1).

0


source


Even in DOS ".EXE" can be 16-bit or 32-bit (with appropriate encoding or DOS extension library).

0


source


NTVDM.EXE is a DOS emulator that supports running 16-bit files .COM

and .EXE

in an environment where they can assume that the processor is 16 bits and that DOS system calls are available. Its only connection with commands is that DOS text modes use the console window to provide a text mode VGA screen emulation.

As noted, there is no .NET VM available that can run under DOS. However, it might be interesting to start with the Mono project sources and create one that runs FreeDOS ... just to scare your friends; -)

0


source







All Articles