Category : OS/2 Files
Archive   : RUNDLL.ZIP
Filename : LOCAL.H

Output of file : LOCAL.H contained in archive : RUNDLL.ZIP
local.h -- miscellaneous definitions

typedef unsigned short WORD;
typedef unsigned short BOOL;
typedef char far *ASCIIZ;
typedef unsigned long ULONG;
typedef double FLOAT;
typedef WORD (far *FN)();
typedef ASCIIZ (far *STRFN)();
typedef char (far *BYTEFN)();
typedef WORD (far *WORDFN)();
typedef ULONG (far *LONGFN)();
typedef FLOAT (far pascal *FLOATFN)();

#define FP_SEG(p) ((WORD) ((ULONG) (p) >> 16))
#define FP_OFF(p) ((WORD) (p))

#define isdigit(c) ((c) >= '0' && (c) <= '9')

#ifndef NEAR
#define NEAR near
#define PASCAL pascal
#define VOID void

#define LOCAL static

Example 1: Expressive functions

WORD alias = loadmodule("ALIAS");
PFN listsyn = (PFN) getprocaddr(module, "LIST_SYN");
if (listsyn)


PFN listsyn;
if (listsyn = (PFN) procaddr("ALIAS", "LIST_SYN"))

Example 2: Assembly language equivalent

PUSH "Goodbye"
PUSH "_printf"
CALL loadmodule
; loadmodule consumed "CRTLIB"
; and produced handle to crtlib
CALL getprocaddr
; getprocaddr consumed crtlib-handle and "_printf"
; and produced pointer to printf on top of stack
; "Goodbye" is still on stack
CALL [top of stack]
POP retval from _printf

Example 3: Legal calls to the interpreter

calldll viocalls VIOWRTTTY "hello world" 11 0
calldll doscalls DosBeep 2000 300
calldll doscalls 50 2000 300 ; DOSBEEP
calldll doscalls DosMkDir \foobar 0L
calldll doscalls DosRmDir \foobar 0L
calldll pmwin WINQUERYACTIVEWINDOW 1L 0 %lu
calldll crtlib _printf "goodbye world: %lu" 666L
calldll crtlib SQRT -1.0 %f
calldll crtlib _toupper 'b' %c
calldll jpilib FIO$Exists 12 CALLDLL.EXE

Example 4: Arguments already on the stack

switch (retval_typ)
case typ_string: printf(mask, ((STRFN) f)()); break;
case typ_word: printf(mask, f()); break;

Example 5: Associating ASCIIZ names with function pointers

"", 0,
"DosGetProcAddr", DosGetProcAddr,
"DosGetPrty", DosGetPrty,
} ;

  3 Responses to “Category : OS/2 Files
Archive   : RUNDLL.ZIP
Filename : LOCAL.H

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: