Working with the Microsoft Programmer’s Library

OS/2 Programmers Ref

Well recently I did manage to get some GREAT books on OS/2, going back to the Microsoft days.. And they contain a lot of information, which was actually quite substantial.

Although there is the impression after the fact that Microsoft really wasn’t that dedicated to OS/2 the wealth of information in these books seem to be otherwise..

Anyways there is four volumes in the set, 1-3 going over version 1.1, and volume 4 with the 1.2 release of OS/2.

As luck would have it, someone gave me a lead on an ISO that contained not only these, but all of the programming documentation of the time on a CD.  No doubt this was the predecessor to the excellent MSDN.

There of course, is just one catch.  It uses the .hlp files, but not from Windows 3.00 its something much earlier and the only way to view the files is with an MS-DOS program.

Glorious MS-DOS interface

I even tried it on OS/2 hoping it was a family api program (like so many of the era were) but no luck.  I was then hoping maybe I could just ‘print’ the files to a virtual printer, and spool the whole job.  BUT YOU CANT PRINT.

So I then wondered if I could put together a TSR that would scrape the screen, append it to a file, and just keep hitting page down.   A few hours of cobbling together some example programs, and remembering to compile with the LARGE memory model (FAR pointers! remember those?)  I could then finally unleash the TSR through the program and extract some of the texts.

For those wondering how to do this kind of thing from MS-DOS here is the source.  While I wanted to use Scott’s program, there was the one drawback that almost everything grabs printscreen now so doing a REAL printscreen that hits interrupt 5 seems like it’d actually require a physical PC in MS-DOS.  And my current ‘retro’ PC has no ethernet so I wasn’t going to go that route.

So there is a lot of hacks with this, you can’t even uninstall it, just reboot …. but this hooks the clock, gives you about a minute to go where you want to go, then it saves a portion of the screen to a file, waits a few seconds and hits pagedown, and repeats….

<tt>// Written by Scott Hall of the U. of Missouri - Columbia, USA.
// This program will redirect your print screen button so that
// it goes to a file.  The file name is at the beginning of the
// start() function.  It can easily be modified to print screens
// that are larger than 80x25.</tt>

#include <stdio.h>
#include <fcntl.h>
#include <io.h>
#include <dos.h>

#ifdef __cplusplus
#define __CPPARGS …
#define __CPPARGS

char far *scr=(char far*)0xb0008000L;
//#define VIDMEM 0xB8000000L                      // or 0xb0000000 for mono
#define VIDMEM 0Xb0008000L
#define INTR 0x1c

int busy=0;                                     // mutual exclusion (MUTEX)
void interrupt (*oldhandler)(__CPPARGS);
char far *old_dta;
char fname[9];

void interrupt int_5();
void tsr(unsigned size);                        // standard tsr bios call
void write_char(int x, int y, char ch, int attrib);
void write_string(int x, int y, char *str, int attrib);

//void main(void);
void start(void);
void interrupt handler(__CPPARGS);

int main(int argc, char*argv[])

printf (“installing\n”);
return 0;

void tsr(unsigned size)                 // standard tsr bios call
{                                       // you can also use keep()
union REGS r;

r.h.ah = 49;                            // function 0x31 = 0;
r.x.dx = size;
int86(0x21,&r, &r);                     // last line executed
}                                       // never get to this line

unsigned char j=0;
unsigned int tcount;
unsigned int dcount=0;

//void interrupt int_5()                  // print screen button starts here
void interrupt handler(__CPPARGS)

char far *p;
union REGS r;
struct SREGS s;



busy = !busy;                   // mutex around tsr

r.h.ah=0x5;;    //pagedown?;
int86x(0x16,&r, &r, &s);

busy = !busy;

void write_char(int x, int y, char ch, int attrib)
{                                       // displays 1 character at (x,y)
char far *v;

v = (char far *) VIDMEM;
v += y*160 + x*2;
*v++ = ch;
*v = attrib;

void write_string(int x, int y, char *str, int attrib)
{                                       // writes string str at (x,y)
for( ; *str; str++,x++)
write_char(x, y, *str, attrib);

int firsttime=0;        //need to skip 3 lines after the first time we
//page down.

void start(void)
int fd,x,y;
char cr=0x0D, lf=0x0A;

setdta((char far *)MK_FP(_psp,0x80));

//if((fd =_open(“c:\\temp\\log.txt”,O_WRONLY))<0) // open the file
//        if((fd =_creat(“c:\\temp\\log.txt”,_A_NORMAL))<0) // try to make new
//                write_string(1,1,”OOPS–write error1″,0x8F);

if((fd =_open(fname,O_WRONLY))<0) // open the file
if((fd =_creat(fname,_A_NORMAL))<0) // try to make new
write_string(1,1,”OOPS–write error1″,0x8F);

lseek (fd,0,SEEK_END);                          // jump to end of file

//for(y=0;y<25;y++)                               // grab lines 0 to 24
//for(x=0;x<80;x++)                       // grab rows 0 through 79
for(x=1;x<79;x++)                       //cut the bars from msl

if(_write(fd,(char far *)(VIDMEM+160*y+2*x),1)==-1)
write_string(1,2,”OOPS–write error2″,0x8F);

if(_write (fd,&cr,1)==-1)               // put a cr and lf at end
write_string(1,3,”OOPS–write error3″,0x8F); // of line

if(_write (fd,&lf,1)==-1)
write_string(1,4,”OOPS–write error4″,0x8F);

_close(fd);                                     // close the file


Hopefully this will help someone in the distant future, maybe it’ll just serve as a warning on how not to build stuff … lol

Oh and I used Borland C++ 3.1, but compiled this as C for the LARGE memory model.


This entry was posted in microsoft, MS-DOS, OS/2 by neozeed. Bookmark the permalink.

About neozeed

What is there to tell? I've loved UNIX like things since I was first exposed to QNX in highschool (we had the Unisys ICONS!), and spent the better time of my teenage years trying to get my own UNIX... I should have bought Coherent in retrospect.. Anyways latched onto Linux in 1992, and then got some old BSD admin books and have been hooked on the VAX BSD & other big/ancient things since...!

6 thoughts on “Working with the Microsoft Programmer’s Library

  1. “As luck would have it, someone gave me a lead on an ISO that contained not only these, but all of the programming documentation of the time on a CD.”

    You are making us curious. Would you be willing to share this lead on an ISO with us? The larger the number of people that have this ISO, the smaller the chances that it will be irretrievably lost forever. I am speaking on behalf of the coming generations, not necessarily about us, the present generation.

    • I would be most interested in this ISO as well. For safe-keeping purposes, of course. And my personal study.


  2. I think “qemu-system-i386 -nographic -device sga -serial telnet:localhost:6666,server”
    and putty logging feature will do, without much programming. 😉

    • but then you’ve got to hit page down a bazillion times!! would that even log right?? its not like typing a text file, its like using ms word 5 or wp 4/5 …

Leave a Reply

Your email address will not be published.

Notify me of followup comments via e-mail. You can also subscribe without commenting.