Stop Microsoft

All Things Microsoft => Microsoft Software => Topic started by: anphanax on 27 July 2004, 13:50

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: anphanax on 27 July 2004, 13:50
Microsoft Windows has been able to utilize protected mode since a special version was released, called today as "Windows 286" (at least what i've seen) and was based off of Windows 2.0.

If you think i'm wrong, try writing a windows application using DOS interrupts (21h, in particular) and see how far you get... WINDOWS 95 AND ABOVE ARE NOT MS-DOS. The interfaces designed for programming applications for these operating systems are not the same, therefore the Kernels aren't. 9x may have invoked MS-DOS for whatever reason, but it's most likely that the 9x kernel was more than just a wrapper for MS-DOS.

Proof of a different interface:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/lfn_0het.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/lfn_0het.asp)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/fat32ovr_0085.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/win9x/fat32ovr_0085.asp)
These functions do not match MS-DOS functions (link below).
http://www.clipx.net/ng/interrupts_and_ports/ng51318.php (http://www.clipx.net/ng/interrupts_and_ports/ng51318.php)

Documented kernel console functions.
(This is here so people will quit thinking Windows Console applications and MS-DOS applications are the same thing. MS-DOS applications don't invoke Windows API [you know what I mean here...].)
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getconsolewindow.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/getconsolewindow.asp)

EDIT:
I made this post because I saw a lot of people claiming they were the same kernel. There could be a strong relationship between MS-DOS and Windows 9x that i'm unaware of, but even so, the API is different, MS Windows multi-tasks, and does.. other things.. that MS-DOS "can't".

[ July 27, 2004: Message edited by: anphanax ]

[ July 27, 2004: Message edited by: anphanax ]

[ July 29, 2004: Message edited by: anphanax ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 27 July 2004, 17:46
Windows 95 to ME (WinDOS) does use a DOS boot loader I don't know about the kernel though. I know Windows does call DOS the DOS 21h API and this is part of the kernel, it uses DOS kernel.

Despite the fact that MS will do it's best to convince you otherwise. When you call a Windows file IO function all the data is buffered back to DOS and the CPU is switched real mode, Int 21h is called and DOS does it's business, the CPU is then switched back to protected mode and the data is buffered back to your program. This is all very sneaky I must admit.

Try saving or opening a file named CON PRN or NUL in a windows program running under WinDOS and watch it crash.

Some DOS extenders include Win32 API emulation as a part of the package:

HX DOS Extender (http://www.japheth.de/DPMI.html)

And even better: WDOSX  (http://michael.tippach.bei.t-online.de/wdosx/#overview)

Thus enabling you to run a Win32 console app under plain old DOS. Win32 has a built in DPMI that calls the DOS int 21h API.

The old virus checker I used under Win95 (forgotten the name) had both Windows and DOS parts, but it would still work even if you uninstalled the Windows part. The screen would go red and warn me a file I using in Windows was infected. The Windows part wouldn't work with out the DOS part, if you removed it from config.sys file when Windows booted it would say that it wasn't in memory.

DOS was in the heart of Win95 to WinME.

As far as I'm aware WinDOS doesn
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: hm_murdock on 27 July 2004, 18:09
dude, he just posted facts to support his claim, and you just say "nope, it had DOS so it had a DOS kernel"

bullshit

A Corvette with a Mopar starter is not a Dodge.

Did you know that you can make Linux boot from the DOS command line? it was a common practice about a decade ago, back when HDs were still small, for a lot of people to install distros like Slackware on a DOS partition and then start it with a DOS command. You can do the same with BeOS, or, really, any OS. Once you get its kernel in memory, it takes over. This is what Windows 9x did. DOS booted the machine, then loaded the Windows kernel. The difference is that 9x simply did not unload the DOS kernel from memory if memory serves.

If you start Linux or Be from DOS, does that mean that they're "using a DOS kernel"? No.

Stop going around flaming people because they're right.

edit: Thank you Anphanax, BTW.

[ July 27, 2004: Message edited by: JimmyJames: GenSTEP Founder ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 27 July 2004, 18:41
quote:
Originally posted by JimmyJames: GenSTEP Founder:
dude, he just posted facts to support his claim



As have I!
You have obviously not bothered to read them.

 
quote:
Originally posted by JimmyJames: GenSTEP Founder:

 and you just say "nope, it had DOS so it had a DOS kernel"



That would explain the reason for the "strange behaviour" of my old Virus scanner!

And the fact you can get DOS extenders that can run Win32 console programs under plain DOS without Windows!

WDOSX is truly magic you put in a program compiled for Win32 colsole and it spits out a DOS program!

 
quote:
Originally posted by JimmyJames: GenSTEP Founder:

xxxxxxxx

A Corvette with a Mopar starter is not a Dodge.

Did you know that you can make Linux boot from the DOS command line? it was a common practice about a decade ago, back when HDs were still small, for a lot of people to install distros like Slackware on a DOS partition and then start it with a DOS command. You can do the same with BeOS, or, really, any OS. Once you get its kernel in memory, it takes over. This is what Windows 9x did. DOS booted the machine, then loaded the Windows kernel. The difference is that 9x simply did not unload the DOS kernel from memory if memory serves.

If you start Linux or Be from DOS, does that mean that they're "using a DOS kernel"? No.



I can see your point, you can boot Windows from Linux but it doesn't mean you're using a Linux kernel even if you did still leave it in memory.

 
quote:
Originally posted by JimmyJames: GenSTEP Founder:

Stop going around flaming people



I wasn't "flaming" anyone, you're the one who started "flaming"

 
quote:
Originally posted by JimmyJames: GenSTEP Founder:

 because they're right.

edit: Thank you Anphanax, BTW.



Whatever.

Oh and by the way...
Jimmy, I always read your posts, in future if you have not read a post properly, then just don't reply to it.

[ July 27, 2004: Message edited by: Aloone ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 27 July 2004, 19:49
No one can prove this either way with out looking at the Windows source code.

Windows might just use DOS as a boot loader.

Windows might still secretly call DOS interrupts.

The CON\CON exploit (http://seclists.org/lists/bugtraq/2000/Mar/0086.html)  might be evidence of Windows calling DOS, or it could be just an example of very bad error handling or even both.

Windows definitely does leave DOS in memory because if you installed DOS drivers in the config.sys and autoexec.bat they were still available in a dos box.

I beleve that Win95B and below did call int 21h. I don't know about 98+ though.

We might be able to prove this by hooking int 21h before Windows boots, but for all we know Windows could just restore it, and even if Windows does, it dosn't mean that it uses it.

[ July 27, 2004: Message edited by: Aloone ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: anphanax on 27 July 2004, 20:22
The con, aux, nul, prn, lpt1-lpt3 thing exists in NT as well. If you don't believe me, open cmd.exe and try opening CON in EDIT. It caused the "DOS" window to hang.

It could be that those are just some special named pipes and are kept for compatibility, and for batch files ("nul" is nice when you don't want things to be displayed). I base that belief off of the information I found here:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createnamedpipe.asp (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ipc/base/createnamedpipe.asp)

[ July 27, 2004: Message edited by: anphanax ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 27 July 2004, 22:44
This behaviour seems to be very inconsistent.

EDIT.EXE
Reading CON causes it to crash, and saving just  causes an error, it doesn't crash.

QBASIC.EXE /EDIT
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: WMD on 27 July 2004, 23:39
The Windows kernel had "protected mode," but it was the fakest protected mode in existence.  Also, if you loaded 16-bit drivers for anything, the DOS kernel kept control of that stuff - hence, why MS didn't want you to use them in 9x.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: mobrien_12 on 28 July 2004, 05:40
quote:
Originally posted by anphanax:
Windows 9x only used Microsoft DOS as a bootloader.

EDIT:
I didn't make this post to attack anyone in general, or to defend Microsoft Windows. I made this because I believe people saying that MS-DOS and Windows are basically the same thing kernel-wise is factually incorrect, and if anything, that hurts them in an argument against the product.




Saying that the kernels are basically the same thing is not the opposite of saying that DOS is only a bootloader.  

The Caldera vs. Microsoft lawsuit (the "DR-DOS" lawsuit) many years ago revealed that, while the two kernels are different, the win95 kernel did make calls to the DOS kernel.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 28 July 2004, 14:45
That makes sense to me, WinDOS didn't have a DOS kernel but it called the DOS kernel for certain things like file IO. This would explain the behaviour of my old virus scanner.

I wonder if WinDOS will boot from FreeDOS or even DOSEMU under Linux.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: WMD on 29 July 2004, 12:21
quote:
Originally posted by Aloone:
I wonder if WinDOS will boot from FreeDOS or even DOSEMU under Linux.


I've seen people get similar things working...like loading WinDOS 95 (btw, I like that name  :D ) from MS-DOS 6.x.  No idea about FreeDOS, and DOSEMU in Linux is just a FreeDOS kernel anyway.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Aloone_Jonez on 29 July 2004, 16:14
I've heard many other programs used their own mini OS kernel rather than DOS. DOOM didn't use the DOS keyboard drivers and the buit in DPMI handled memory management and disk swapping, I think it used the mouse driver loaded in the autoexec.bat though. Virtual 3D pool didn't even use the mouse driver it had it's own!

I think all programs (including WinDOS) called DOS for file IO.

Can anyone else think of any DOS software that hardly used the DOS kernel?

[ July 29, 2004: Message edited by: Aloone ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: anphanax on 30 July 2004, 01:14
Actually, I was wrong when I said MS-DOS is only used as a bootloader, because it's likely there are calls to DOS.

I base that belief off of some behavior in NT.
WriteFile(...) in Kernel32 Invokes
NtWriteFile(...) in NtDll Invokes
Int 2Eh to switch OS modes (From user to native kernel) and then NTOSKRNL.EXE ends up doing the work.

It's more than possible the 9x kernel ended up invoking DOS interrupts to do it's work for it. That might explain some oddities (e.g. Trying Typing "Krnl386 Con" in command.com, and watch as errors start occuring in Kernel32.dll for no apparent reason [Explorer.exe, Msgsvr32.exe, etc]).

I guess one could argue:
9x Kernel <-> IO.SYS
NT Kernel <-> NTOSKRNL.EXE (there are multiple versions of this file with slightly different names e.g. NTKRNLPA.EXE)

UPDATE:
The reason I associated the shell /w the kernel, is because in MS-DOS, they sort-of complement each other. There's a special interrupt reserved for passing commands to command.com. That doesn't make it the kernel though, so I fixed this post. But complemeting, and being the same thing, are of course, different, so this post has been fixed.

[ August 11, 2004: Message edited by: anphanax ]

Title: MS-DOS/9x Kernel Inaccuracy.
Post by: hm_murdock on 1 August 2004, 02:35
9x kernel would be io.sys

command.com is just a command interpreter, like BASH
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: billy_z on 6 August 2004, 13:30
okay... seems like those claim win9x do not have DOS never learn assembly language.

Window3.0/3.1/95/98/ME all uses DOS kernel.

I write program under DOS and windows9x.  If I load something in memory in DOS first(a TSR), and boot into windows9x, it is still there!! I still can call interrupt from the DOS program!

And, calling any interrupt (21h) is not the "windows way".  In win32 document, it did not mention anything about interrupt.  everything is wraped in API.  

if you load something in DOS and boot into lunix, will you be able to call it??

those try to confuse bootloader and kernel sure do not have any idea what they talking about.... In fact, a boot loader has a mini-kernel that handles IO and memory.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Orethrius on 6 August 2004, 13:34
(http://forumspam.articblue.nl/post_related/misc/images/0064.gif)
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: billy_z on 6 August 2004, 13:40
If you load Linux or Be from DOS, Linux/Be will be completely independent after they boot up.  You will not be able to access program in the DOS memory.

If you boot Win9X from DOS, it still depend on DOS, and program load in DOS is still accessable.

In the Linux case, because the linux kernel re-located program memory and get control over interrupts, the DOS kernel is no longer effective.

But win9x kernel still utilize DOS interupts and memory.  IMHO win9x is a BIG protect mode application under DOS.  

Anything crashes DOS will crash win9x.
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: Orethrius on 6 August 2004, 13:44
There we go, I was hoping you would say that so I could stop thinking that you thought Linux runs under DOS.   :D
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: mobrien_12 on 9 August 2004, 12:19
quote:
Originally posted by Aloone:
I wonder if WinDOS will boot from FreeDOS or even DOSEMU under Linux.


No and no.  

If I remember correctly, Caldera got Win95 to work with DR-DOS.  However, Windows 3.1 won't work with FreeDOS by itself.  People have gotten WinOS2 running under DOSEMU (that information is available on the DOSEMU website).
Title: MS-DOS/9x Kernel Inaccuracy.
Post by: anphanax on 11 August 2004, 12:37
Since you've taken the time to try and help me, i'll take the time to try and help you. Let's see how I can do that. I hope my comments are useful to you, Billy.

   
quote:
okay... seems like those claim win9x do not have DOS never learn assembly language.

Well, first off, you don't need to understand anything about Windows to write in assembly. Did you know that UNIX, MS-DOS, CP/M and other operating systems can have programs written in assembly? Yep, that's right, it's not tied down to Windows like Visual Basic is.

   
quote:
if you load something in DOS and boot into lunix, will you be able to call it??

Load something into DOS, and then boot Lunix? The answer is possibly yes, through the magic of device drivers and virtual 8088 technology, that has existed in intel chips at least since 386, although I wouldn't be shocked if the 286 had it as well, since after all, it did provide a protected mode. I wouldn't recommend the 8088 approach though, as it didn't work well for Windows 9x     (http://tongue.gif)    .

   
quote:
And, calling any interrupt (21h) is not the "windows way". In win32 document, it did not mention anything about interrupt. everything is wraped in API.

Don't you mean the GUI/CUI way? Native applications and device drivers can and sometimes have to utilize interrupts. I would tell you to pull out your favorite hex editor or dissassembler to prove this, but Microsoft would get mad at you, and we can't have that (although if you happen to search, I wont tell anyone :Z). The interrupts exist for a reason, although you do have a good point. Most programmers for the Microsoft Windows platform never have a real "need" to use interrupts, and some are unable to (at least, directly).

   
quote:
those try to confuse bootloader and kernel sure do not have any idea what they talking about.... In fact, a boot loader has a mini-kernel that handles IO and memory.

I'm not sure what your point is here, since your second sentence doesn't seem to support your first. But i'll address them both for you     (http://smile.gif)    . You are correct. A bootloader is more-or-less something that loads the "primary" operating system(s) a user will interact with (via something magical called a shell). But, it is possible for a kernel to be a bootloader, and you seem to support this conclusion with your second sentence. I would recommend researching Exokernels. Here's a link for you. It may not explain 100%, but it's worth a read if you're interested: <http://en.wikipedia.org/wiki/Kernel_%28computer_science%29>.

EDIT:
Here's another URL you might enjoy.
<http://en.wikipedia.org/wiki/Bootloader>

I read both of those links I posted, BTW.    (http://smile.gif)  

Just a future note, it's not nice to assume that just because a particular comment I made was incorrect, that everything I have said was. Just because I wasn't sure how a CLOSED SOURCE operating system worked, doesn't mean I need a lecture on what a kernel is. Thanks for your effort though. In the future, I will make sure I do more research when making posts like this, instead of relying on sources that are questionable in their correctness (that also means, being careful about making careless assumptions).

[ August 11, 2004: Message edited by: anphanax ]

[ August 11, 2004: Message edited by: anphanax ]