Microsoft C KnowledgeBase articles online

PC Mag, January 1989

It’s weird I was discussing putting this online in a more human readable format, and then  Jeff Parsons over at the incredible full system emulation in javascript site, just did it.

As you may or not be aware of, Microsoft hit it big as a computer languages company, before they added operating systems into it’s portfolio.  And for some weird reason after the whole OS/2 divorce thing, someone decided that everything that had been painfully learned in the earlier eras should just be expunged from history.  Which is a real shame to anyone interested in Basic, Fortran, Pascal, C and MASM.  Years ago I had gone through the steps of extracting the text the only way I could figure out easily, by writing a simple TSR that would dump the contents of the text video buffer, and write it to a file, then press the page down key, and keep repeating the process. The end result being that I had then dumped the MSPL aka the Microsoft Programmer’s Library.  I had put the text into an archive, aptly named Microsoft_Programmers_Library.7z, and pretty much used grep whenever I wanted any information, and left it at that..

It’s really cool to see it slowly transitioning to more useful information.  You can read Jeff’s article Corporations Are Crappy Archivists about his quest for seemingly simple information about ancient Microsoft mice, and the archive of KB’s for Microsoft C.

One thing that is annoying is that information on CD from the late 1980’s seems to be darned near impossible to find.  I know that each generation of machines until about 2005 was exponentially larger than the previous one (post 2007 we hit the iThing world, along with most machines being ‘good enough’ for day to day usage).  I know this ad may seem insane, but Microsoft really was trying to push people to CD distributions.  As we all know that internet thing didn’t quite tickle their fancy.    Did they ever put resources like this online?  Like on BIX or Compuserve?  It seems like an ideal resource.  But I was a kid, and didn’t have that kind of money.

Awesome CD-ROM collection and drive, starting at a mere $899!

So in the interest of a bad idea, here is MSPL, aka qemu/curses in action.

Oh my god, what I have I done!?

Well as an addendum I thought it’d be cool to put MSPL online, via shellinabox.  First off I needed a 5MB MS-DOS disk, basically enough MS-DOS too boot up, run smartdrive, idle and the CD-ROM driver, along with the minimal MSPL install.  And to button it up, I added a from the autoexec, so when you exit it’ll reboot the VM.  Great.

The reboot command was input via debug, as it’ll let you assemble code directly.  Although it isn’t a MACRO assembler, so you have to know exactly what you are doing.

(return on a line by itself)

And with that saved, now I have to setup Qemu.  Since I’m taking the shellinabox approach that means I need something text mode, and I was thinking this was light weight. Qemu has a curses output so that’ll work.  I set it up to use qcow2 and a backing store image so that way every forked user doesn’t eat 5MB of disk space, it’s more like 100kb.

set -m
mkdir /tmp/$PID
cd /tmp/$PID
qemu-img create -f qcow2 -b /usr/local/mspl/MSPL.qcow2 MSPL.qcow2
qemu-system-i386 -m 4 -cpu 486 -hda MSPL.qcow2 -cdrom /usr/local/mspl/Microsoft-Programers-Library-v1.3.iso -curses -no-reboot
cd /tmp
rm -rf /tmp/$PID

Then to tie it into shell in a box, it’ll just need the flag:

-s /mspl:nobody:nogroup:/:/usr/local/bin/

and this will run it as nobody, and kick off the above bash script.  Now that’s great and all, but what about stale/abandoned sessions?  I wrote this quick script to clean them up.


FIND=”find /tmp -type d -regextype sed -regex ‘.*/[0-9]*’ -mmin +30 | sed ‘s/\/tmp\///’>/tmp/kill_out.txt”
eval $FIND
while read process; do

KILL=”kill -9 ${process}”
eval $KILL
RMDIR=”rm -rf /tmp/${process}”
eval $RMDIR

done < /tmp/kill_out.txt
rm -rf /tmp/kill_out.txt

So it’ll find numerical directories that are at least 30 minutes old, kill them and remove their directory.  Probably very dangerous to run, but it’s isolated so Im not too worried.  Then just have root add that script to it’s crontab, and run it every minute, and it’ll kill the old stuff hanging around.

I’ll add a video later on how to use MSPL via this setup.  And maybe I’ll rig something to have RDP access as well, depending on how I’m feeling.

Reading .toast image files

Well I put out a cry for help all over the place, looking for Darwin 0.3

And much to my amazement, when I woke up, I not only got a reply but a link to a toast image.  Great, what is toast?  Well simply put toast is a format made popular by then Adaptec Toast.  Obviously the sane thing to do is to find Toast, install it, and mount the disk image inside of a Macintosh.

Adaptec toast 4.0

But, honestly, where is the fun in that?

Instead let’s have Cockatrice III do it!  Now I never did get around to writing proper CD-ROM emulation, nor integrating it, but that doesn’t matter!  Instead I’m going to rely on Daemon tools Lite, to do all the heavy lifting.  DTL will create a virtual SCSI adapter, add in a SCSI CD-ROM device, and mount the image.  Needless to say, I’m on Windows and that is where that part of the adventure ends, as Windows 10 cannot read HFS.

Now back to Cockatrice!

All I had to do was assign the SCSI 6 position to the mounted drive letter, and I’m set!  Just add this to the CockatriceIII_Prefs file:

scsi6 \\.\e:

And now I can mount the image from within Cockatrice III

Darwin 0.3 toast mounted

And there we go, now I can copy the files of just like having a real Mac.


More CDROM madness.

Well I found that one of the things that was preventing me from booting up this “Solaris 1.1.2” AKA SunOS 4.1.4 CD is that Qemu on Win32 using raw devices has issues with all these slices and whatnot.

Slices you say?

Yeah, back in the ISO9660 Rock Ridge days, CD-ROMS were basically given a common format for the “LCD” of the day. In that case MS-DOS. Naturally people like Unix vendors were not to keen on that, as they wanted file attributes, long file names, symbolic links etc… So a *LOT* of people started to split up their CD’s into partitions like hard disks, and slap down actual filesystems on the disks. NeXT just used one giant partition on the CD-ROM, but their exe format let them ‘bind’ all the CISC machines onto one CD, and all the RISC machines on another. Meanwhile SUN decided to make all these ‘boot’ partitions for various machines, a miniroot, then an I9660 partition for basic tar files of the OS…

Like this:

2,998,272 DEBUGGING
4,161,536 DEMO
3,219,456 GAMES
1,826,816 GRAPHICS
999,424 INSTALL
1,073,152 NETWORKING
925,696 RFS
327,680 SECURITY
1,409,024 SHLIB_CUSTOM
4,104,192 SYSTEM_V
729,088 TEXT
49,152 TLI
7,872,512 USER_DIAG
29,638,656 USR
622,592 UUCP
6,103,040 VERSATEC

Which is kind of funny seeing how some BSD derived OS’s still keep some of these package names alive.

Anyways, the problem is that I tried to use \\.\d: for the cdrom, and booting didn’t work at all. I even tried reading an ISO from the CD, but all it ended up doing was skipping to the ISO9660 part, and dumping that, ignoring the slices, giving me this:

243,599,360 sol14.iso

So after googling around, trying to at least find a way to back up this CD (it was a souvenir from Japan!) I found someone mentioning to backup their Solaris CD, they had to use the “readcd” program.

Well, I’d never explored that much with the cdrtools, but behold there is a readcd program that’ll dump an entire CD out!

So running it with –scan-bus to find your CD drive…

readcd -scanbus
0,0,0 0) *
0,1,0 1) ‘HL-DT-ST’ ‘BDDVDRW GBC-H20L’ ‘1.B8’ Removable CD-ROM
0,2,0 2) *

We can go on to dump a full image of the CD.

readcd -dev=0,1,0 f=sunos.iso

Which now gives us a much larger ISO image…

329,605,120 sunos.iso

Sadly it crashes on bootup… But on Win32 it’s a lot better then not reading *ANYTHING* at all!

ok boot disk1:d -vs
Boot device: /iommu/sbus/espdma@5,8400000/esp@5,8800000/sd@1,0:d File and args: -vs
Boot Release 4.1.4 (sun4m) #2: Fri Oct 14 11:07:52 PDT 1994
Copyright (c) 1983-1990, Sun Microsystems, Inc.
Boot: Romvec version 3.
root on /iommu@0,10000000/sbus@0,10001000/espdma@5,8400000/esp@5,8800000/sd@1,0:d fstype 4.2
Boot: vmunix
.Size: 868352…………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………………+2319136+75288 bytes


I should also add that Qemu’s CDROM (like 99% in the world) are fixed block, while SUN (and other vendors) had these CD ROM’s that could change block size… So in Qemu you have to use the DISK driver vs the CDROM driver….

ie use -hdb sunos.iso instead of -cdrom sunos.iso