Release 971130

Sat Nov 29 12:35:26 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [if1632/builtin.c]
	Build a complete PE header for builtin Win32 modules.

	* [loader/pe_image.c] [loader/module.c]
	HMODULE32 now points to the loading address of the module. There
	is no longer a separate PE_MODULE structure.

Fri Nov 28 11:21:47 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [ole/*][configure.in][Makefile.in][include/interfaces.h]
	  [if1632/olesvr32.spec][if1632/olecli32.spec]
	New directory, moved OLE stuff there.
	new .spec files for olecli32,olesvr32, some stubs added.

	* [misc/shell.c]
	Added support for extracting icons from PE dlls.

	* [misc/shellord.c][if1632/shell32.spec]
	Added a huge heap of ordinal only exported shell functions
	(will work only in Win95).

	* [loader/task.c]
	Hack to make MakeProcInstance16 work in all cases (mplayer.exe).

	* [win32/string32.c][include/string32.h]
	Obsolete, removed.

	* [windows/keyboard.c]
	Added *RegisterHotkey.

	* [objects/font.c][objects/text.c]
	Added GetFontLanguageInfo, GetTextCharsetInfo.

Wed Nov 26 18:10:40 1997  Uwe Bonnes  <bon@elektron.ikp.physik.tu-darmstadt.de>

	* [misc/network.c]
	In WNetGetConnection16 return the Drive label and not the DOS-Cwd.
	Makes Wordview 6 start on a network connected machine.

	* [controls/status.c]
	Catch a Null pointer in SW_SetText.

	* [files/dos_fs.c]
 	Add NT5 functions GetLongPathName32.

	* [files/file.c]
	Make GetTempFileName16 accept drive 0 (Current Drive) too.
	Handle more errors and be more verbose in FILE_SetDosError, fix
	an error in DeleteFile32W

	* [memory/virtual.c]
	Implement FlushViewOfFile.

	* [misc/crtdll]
	Implement _rotl and splitpath and add a stub for 
	_abnormal_termination.

	* [misc/printdrv.c]
	Stub for EnumPrinters32A.

	* [win32/newfns]
	Add Stub for QueryPerformanceFrequency, change return value
	for QueryPerformanceCounter.
 	Add stub for DeviceIoControl.

Tue Nov 25 15:55:01 1997 Martin Boehme <boehme@informatik.mu-luebeck.de>

	* [controls/combo.c] [controls/edit.c] [windows/defwnd.c]
	  [windows/winpos.c] [windows/win.c]
	Removed WIN_NO_REDRAW flag.

Tue Nov 25 13:20:35 1997  Douglas Ridgway <ridgway@taiga.v-wave.com>

	* [graphics/x11drv/bitblt.c]
	Fixed memory leak in BITBLT_GetDstArea.

Sun Nov 23 14:05:23 1997  Andreas Mohr <100.30936@germany.net>

	* [files/directory.c]
	Export windows system directory to environment.

	* [if1632/Makefile.in] [if1632/builtin.c] [if1632/w32skrnl.spec]
	  [if1632/win32s16.spec] [misc/w32scomb.c] [misc/w32skrnl.c]
	Added Win32s DLLs W32SKRNL and WIN32S16.

	* [if1632/kernel32.spec] [loader/module.c]
	Added misc functions for Win32s.

	* [if1632/kernel.spec] [loader/task.c]
	Added DefineHandleTable().

	* [scheduler/process.c]
	Fixed SetEnvironmentVariable32A() to avoid heap corruption.

Sat Nov 22 14:11:42 1997  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [windows/painting.c]
	Fix leak in BeginPaint16() for CS_PARENTDC windows where the
	update region was not properly released.

Thu Nov 20 03:55:29 1997  Gordon Chaffee <chaffee@CS.Berkeley.EDU>

	* [loader/pe_image.c]
	Implemented forwarded DLL functions.

	* [objects/dib.c]
	Added support for 16- and 32-bit mode DIBs.
	Support negative bitmap heights.

	* [win32/process.c]
	Added stub for CreateProcess32W.

	* [win32/security.c] [include/ntdll.h]
	Added stubs for LookupAccountSid32A/W.

	* [scheduler/process.c]
	Use the size specified in the PE header for the process heap.

Mon Nov 17 00:53:35 1997  Len White <phreak@cgocable.net>

	* [msdos/int3d.c]
	New file. Stubs for int3d.

Sun Nov 16 12:30:00 PST 1997  Jason Schonberg  <schon@mti.sgi.com>

	* [include/aspi.h]
	Changed comment style from C++ to C.
diff --git a/if1632/Makefile.in b/if1632/Makefile.in
index 2469274..63fb303 100644
--- a/if1632/Makefile.in
+++ b/if1632/Makefile.in
@@ -31,7 +31,9 @@
 	ole2prox.spec \
 	ole32.spec \
 	olecli.spec \
+	olecli32.spec \
 	olesvr.spec \
+	olesvr32.spec \
 	shell.spec \
 	shell32.spec \
 	sound.spec \
@@ -43,7 +45,9 @@
 	user32.spec \
 	ver.spec \
 	version.spec \
+	w32skrnl.spec \
 	w32sys.spec \
+	win32s16.spec \
 	win87em.spec \
 	winaspi.spec \
 	wing.spec \
diff --git a/if1632/advapi32.spec b/if1632/advapi32.spec
index d72abaa..a53a955 100644
--- a/if1632/advapi32.spec
+++ b/if1632/advapi32.spec
@@ -87,8 +87,8 @@
 0083 stub LogonUserW
 0084 stub LookupAccountNameA
 0085 stub LookupAccountNameW
-0086 stub LookupAccountSidA
-0087 stub LookupAccountSidW
+0086 stdcall LookupAccountSidA(ptr ptr ptr ptr ptr ptr ptr) LookupAccountSid32A
+0087 stdcall LookupAccountSidW(ptr ptr ptr ptr ptr ptr ptr) LookupAccountSid32W
 0088 stub LookupPrivilegeDisplayNameA
 0089 stub LookupPrivilegeDisplayNameW
 0090 stub LookupPrivilegeNameA
diff --git a/if1632/builtin.c b/if1632/builtin.c
index d21f294..f514004 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -16,6 +16,7 @@
 #include "neexe.h"
 #include "stackframe.h"
 #include "user.h"
+#include "process.h"
 #include "stddebug.h"
 #include "debug.h"
 
@@ -101,6 +102,7 @@
 extern const DLL_DESCRIPTOR LZEXPAND_Descriptor;
 extern const DLL_DESCRIPTOR VER_Descriptor;
 extern const DLL_DESCRIPTOR W32SYS_Descriptor;
+extern const DLL_DESCRIPTOR WIN32S16_Descriptor;
 extern const DLL_DESCRIPTOR WING_Descriptor;
 extern const DLL_DESCRIPTOR WINASPI_Descriptor;
 
@@ -110,15 +112,18 @@
 extern const DLL_DESCRIPTOR COMCTL32_Descriptor;
 extern const DLL_DESCRIPTOR COMDLG32_Descriptor;
 extern const DLL_DESCRIPTOR CRTDLL_Descriptor;
-extern const DLL_DESCRIPTOR OLE32_Descriptor;
 extern const DLL_DESCRIPTOR GDI32_Descriptor;
 extern const DLL_DESCRIPTOR KERNEL32_Descriptor;
 extern const DLL_DESCRIPTOR LZ32_Descriptor;
 extern const DLL_DESCRIPTOR MPR_Descriptor;
 extern const DLL_DESCRIPTOR NTDLL_Descriptor;
+extern const DLL_DESCRIPTOR OLE32_Descriptor;
+extern const DLL_DESCRIPTOR OLECLI32_Descriptor;
+extern const DLL_DESCRIPTOR OLESVR32_Descriptor;
 extern const DLL_DESCRIPTOR SHELL32_Descriptor;
 extern const DLL_DESCRIPTOR USER32_Descriptor;
 extern const DLL_DESCRIPTOR VERSION_Descriptor;
+extern const DLL_DESCRIPTOR W32SKRNL_Descriptor;
 extern const DLL_DESCRIPTOR WINMM_Descriptor;
 extern const DLL_DESCRIPTOR WINSPOOL_Descriptor;
 extern const DLL_DESCRIPTOR WSOCK32_Descriptor;
@@ -156,6 +161,7 @@
     { &LZEXPAND_Descriptor, NULL, 0 },
     { &VER_Descriptor,      NULL, 0 },
     { &W32SYS_Descriptor,   NULL, 0 },
+    { &WIN32S16_Descriptor, NULL, 0 },
     { &WING_Descriptor,     NULL, 0 },
     { &WINASPI_Descriptor,  NULL, 0 },
     /* Win32 DLLs */
@@ -163,15 +169,18 @@
     { &COMCTL32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
     { &COMDLG32_Descriptor, NULL, DLL_FLAG_WIN32 },
     { &CRTDLL_Descriptor,   NULL, DLL_FLAG_WIN32 },
-    { &OLE32_Descriptor,    NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
     { &GDI32_Descriptor,    NULL, DLL_FLAG_WIN32 },
-    { &KERNEL32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_ALWAYS_USED },
+    { &KERNEL32_Descriptor, NULL, DLL_FLAG_WIN32 },
     { &LZ32_Descriptor,     NULL, DLL_FLAG_WIN32 },
-    { &MPR_Descriptor,      NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
+    { &MPR_Descriptor,      NULL, DLL_FLAG_WIN32 },
     { &NTDLL_Descriptor,    NULL, DLL_FLAG_WIN32 },
+    { &OLE32_Descriptor,    NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
+    { &OLECLI32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
+    { &OLESVR32_Descriptor, NULL, DLL_FLAG_WIN32 | DLL_FLAG_NOT_USED },
     { &SHELL32_Descriptor,  NULL, DLL_FLAG_WIN32 },
     { &USER32_Descriptor,   NULL, DLL_FLAG_WIN32 },
     { &VERSION_Descriptor,  NULL, DLL_FLAG_WIN32 },
+    { &W32SKRNL_Descriptor, NULL, DLL_FLAG_WIN32 },
     { &WINMM_Descriptor,    NULL, DLL_FLAG_WIN32 },
     { &WINSPOOL_Descriptor, NULL, DLL_FLAG_WIN32 },
     { &WSOCK32_Descriptor,  NULL, DLL_FLAG_WIN32 },
@@ -182,46 +191,6 @@
   /* Ordinal number for interrupt 0 handler in WPROCS.DLL */
 #define FIRST_INTERRUPT_ORDINAL 100
 
-/***********************************************************************
- *           BUILTIN_BuildDebugEntryPoints
- *
- * Build the table of relay-debugging entry points for a Win32 DLL.
- */
-static void BUILTIN_BuildDebugEntryPoints( BUILTIN_DLL *dll )
-{
-    int i;
-    DEBUG_ENTRY_POINT *entry;
-    extern void RELAY_CallFrom32();
-
-    assert( !dll->dbg_funcs );
-    assert( dll->flags & DLL_FLAG_WIN32 );
-    dll->dbg_funcs = HeapAlloc( SystemHeap, 0,
-                      dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT) );
-    entry = dll->dbg_funcs;
-    for (i = 0; i < dll->descr->win32.nb_funcs; i++, entry++)
-    {
-        BYTE args = dll->descr->win32.args[i];
-        entry->call = 0xe8;  /* call */
-        switch(args)
-        {
-        case 0xfe:  /* register func */
-            entry->callfrom32 = (DWORD)dll->descr->win32.functions[i] -
-                                (DWORD)&entry->ret;
-            entry->ret        = 0x90;  /* nop */
-            entry->args       = 0;
-            break;
-        case 0xff:  /* stub */
-            entry->args = 0xffff;
-            break;
-        default:  /* normal function (stdcall or cdecl) */
-            entry->callfrom32 = (DWORD)RELAY_CallFrom32 - (DWORD)&entry->ret;
-            entry->ret        = (args & 0x80) ? 0xc3 : 0xc2; /* ret / ret $n */
-            entry->args       = (args & 0x7f) * sizeof(int);
-            break;
-        }
-    }
-}
-
 
 /***********************************************************************
  *           BUILTIN_DoLoadModule16
@@ -279,20 +248,179 @@
  * Load a built-in Win32 module. Helper function for BUILTIN_LoadModule
  * and BUILTIN_Init.
  */
-static HMODULE16 BUILTIN_DoLoadModule32( BUILTIN_DLL *table )
+static HMODULE32 BUILTIN_DoLoadModule32( BUILTIN_DLL *dll )
 {
+    extern void RELAY_CallFrom32();
+
     HMODULE16 hModule;
     NE_MODULE *pModule;
     OFSTRUCT ofs;
+    IMAGE_DATA_DIRECTORY *dir;
+    IMAGE_DOS_HEADER *dos;
+    IMAGE_NT_HEADERS *nt;
+    IMAGE_SECTION_HEADER *sec;
+    IMAGE_EXPORT_DIRECTORY *exp;
+    LPVOID *funcs;
+    LPSTR *names;
+    DEBUG_ENTRY_POINT *entry;
+    PE_MODREF *pem;
+    INT32 i, size;
+    BYTE *addr;
 
-    sprintf( ofs.szPathName, "%s.DLL", table->descr->name );
+    /* Allocate the module */
+
+    size = (sizeof(IMAGE_DOS_HEADER)
+            + sizeof(IMAGE_NT_HEADERS)
+            + 2 * sizeof(IMAGE_SECTION_HEADER)
+            + sizeof(IMAGE_EXPORT_DIRECTORY)
+            + dll->descr->win32.nb_funcs * sizeof(LPVOID)
+            + dll->descr->win32.nb_names * sizeof(LPSTR));
+    if (debugging_relay)
+        size += dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT);
+    addr  = VirtualAlloc( NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE );
+    if (!addr) return 0;
+    dos   = (IMAGE_DOS_HEADER *)addr;
+    nt    = (IMAGE_NT_HEADERS *)(dos + 1);
+    sec   = (IMAGE_SECTION_HEADER *)(nt + 1);
+    exp   = (IMAGE_EXPORT_DIRECTORY *)(sec + 2);
+    funcs = (LPVOID *)(exp + 1);
+    names = (LPSTR *)(funcs + dll->descr->win32.nb_funcs);
+    entry = (DEBUG_ENTRY_POINT *)(names + dll->descr->win32.nb_names);
+
+    /* Build the DOS and NT headers */
+
+    dos->e_magic  = IMAGE_DOS_SIGNATURE;
+    dos->e_lfanew = sizeof(*dos);
+
+    nt->Signature                       = IMAGE_NT_SIGNATURE;
+    nt->FileHeader.Machine              = IMAGE_FILE_MACHINE_I386;
+    nt->FileHeader.NumberOfSections     = 2;  /* exports + code */
+    nt->FileHeader.SizeOfOptionalHeader = sizeof(nt->OptionalHeader);
+    nt->FileHeader.Characteristics      = IMAGE_FILE_DLL;
+
+    nt->OptionalHeader.Magic = IMAGE_NT_OPTIONAL_HDR_MAGIC;
+    nt->OptionalHeader.SizeOfCode                  = 0x1000;
+    nt->OptionalHeader.SizeOfInitializedData       = 0;
+    nt->OptionalHeader.SizeOfUninitializedData     = 0;
+    nt->OptionalHeader.ImageBase                   = (DWORD)addr;
+    nt->OptionalHeader.SectionAlignment            = 0x1000;
+    nt->OptionalHeader.FileAlignment               = 0x1000;
+    nt->OptionalHeader.MajorOperatingSystemVersion = 1;
+    nt->OptionalHeader.MinorOperatingSystemVersion = 0;
+    nt->OptionalHeader.MajorSubsystemVersion       = 4;
+    nt->OptionalHeader.MinorSubsystemVersion       = 0;
+    nt->OptionalHeader.SizeOfImage                 = size;
+    nt->OptionalHeader.SizeOfHeaders               = (BYTE *)exp - addr;
+    nt->OptionalHeader.NumberOfRvaAndSizes = IMAGE_NUMBEROF_DIRECTORY_ENTRIES;
+
+    /* Build the export directory */
+
+    dir = &nt->OptionalHeader.DataDirectory[IMAGE_FILE_EXPORT_DIRECTORY];
+    dir->VirtualAddress = (BYTE *)exp - addr;
+    dir->Size = sizeof(*exp)
+                + dll->descr->win32.nb_funcs * sizeof(LPVOID)
+                + dll->descr->win32.nb_names * sizeof(LPSTR);
+
+    /* Build the exports section */
+
+    strcpy( sec->Name, ".edata" );
+    sec->Misc.VirtualSize = dir->Size;
+    sec->VirtualAddress   = (BYTE *)exp - addr;
+    sec->SizeOfRawData    = dir->Size;
+    sec->PointerToRawData = (BYTE *)exp - addr;
+    sec->Characteristics  = (IMAGE_SCN_CNT_INITIALIZED_DATA |
+                             IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ |
+                             IMAGE_SCN_MEM_WRITE);
+
+    /* Build the code section */
+
+    sec++;
+    strcpy( sec->Name, ".code" );
+    if (debugging_relay)
+        sec->SizeOfRawData = dll->descr->win32.nb_funcs * sizeof(DEBUG_ENTRY_POINT);
+    else
+        sec->SizeOfRawData = 1;
+    sec->Misc.VirtualSize = sec->SizeOfRawData;
+    sec->VirtualAddress   = (BYTE *)entry - addr;
+    sec->PointerToRawData = (BYTE *)entry - addr;
+    sec->Characteristics  = (IMAGE_SCN_CNT_INITIALIZED_DATA |
+                             IMAGE_SCN_MEM_EXECUTE | IMAGE_SCN_MEM_READ);
+
+    /* Build the exports section data */
+
+    exp->Name                  = (BYTE *)dll->descr->name - addr;  /*??*/
+    exp->Base                  = dll->descr->win32.base;
+    exp->NumberOfFunctions     = dll->descr->win32.nb_funcs;
+    exp->NumberOfNames         = dll->descr->win32.nb_names;
+    exp->AddressOfFunctions    = (LPDWORD *)((BYTE *)funcs - addr);
+    exp->AddressOfNames        = (LPDWORD *)((BYTE *)names - addr);
+    exp->AddressOfNameOrdinals = (LPWORD *)((BYTE *)dll->descr->win32.ordinals - addr);
+
+    /* Build the funcs table */
+
+    if (debugging_relay)
+    {
+        dll->dbg_funcs = entry;
+        for (i = 0; i < dll->descr->win32.nb_funcs; i++, funcs++, entry++)
+        {
+            BYTE args = dll->descr->win32.args[i];
+            entry->call = 0xe8;  /* call */
+            switch(args)
+            {
+            case 0xfe:  /* register func */
+                entry->callfrom32 = (DWORD)dll->descr->win32.functions[i] -
+                                    (DWORD)&entry->ret;
+                entry->ret        = 0x90;  /* nop */
+                entry->args       = 0;
+                *funcs = (LPVOID)((BYTE *)entry - addr);
+                break;
+            case 0xff:  /* stub or extern */
+                if (dll->descr->win32.functions[i])
+                    *funcs = (LPVOID)((BYTE *)dll->descr->win32.functions[i]
+                                              - addr);
+                break;
+            default:  /* normal function (stdcall or cdecl) */
+                entry->callfrom32 = (DWORD)RELAY_CallFrom32 -
+                                    (DWORD)&entry->ret;
+                entry->ret        = (args & 0x80) ? 0xc3 : 0xc2; /*ret/ret $n*/
+                entry->args       = (args & 0x7f) * sizeof(int);
+                *funcs = (LPVOID)((BYTE *)entry - addr);
+                break;
+            }
+        }
+    }
+    else
+    {
+        for (i = 0; i < dll->descr->win32.nb_funcs; i++, funcs++)
+            if (dll->descr->win32.functions[i])
+                *funcs = (LPVOID)((BYTE *)dll->descr->win32.functions[i]
+                                           - addr);
+    }
+
+    /* Build the names table */
+
+    for (i = 0; i < exp->NumberOfNames; i++, names++)
+        if (dll->descr->win32.names[i])
+            *names = (LPSTR)((BYTE *)dll->descr->win32.names[i] - addr);
+
+    /* Create a modref */
+
+    pem = (PE_MODREF *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
+                                  sizeof(*pem) );
+    pem->module = (HMODULE32)addr;
+    pem->pe_export = exp;
+    pem->next = pCurrentProcess->modref_list;
+    pCurrentProcess->modref_list = pem;
+
+    /* Create a Win16 dummy module */
+
+    sprintf( ofs.szPathName, "%s.DLL", dll->descr->name );
     hModule = MODULE_CreateDummyModule( &ofs );
     pModule = (NE_MODULE *)GlobalLock16( hModule );
-    pModule->pe_module = (PE_MODULE *)table;
     pModule->flags = NE_FFLAGS_SINGLEDATA | NE_FFLAGS_BUILTIN |
-        NE_FFLAGS_LIBMODULE | NE_FFLAGS_WIN32;
-    if (debugging_relay) BUILTIN_BuildDebugEntryPoints( table );
-    return hModule;
+                     NE_FFLAGS_LIBMODULE | NE_FFLAGS_WIN32;
+    pModule->module32 = (HMODULE32)addr;
+    return pModule->module32;
 }
 
 
@@ -358,7 +486,7 @@
  * Load a built-in module. If the 'force' parameter is FALSE, we only
  * load the module if it has not been disabled via the -dll option.
  */
-HMODULE16 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
+HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
 {
     BUILTIN_DLL *table;
     char dllname[16], *p;
@@ -484,56 +612,14 @@
     /* Now find the function */
 
     ordinal = ((DWORD)relay-(DWORD)dll->dbg_funcs) / sizeof(DEBUG_ENTRY_POINT);
-    ordinal += descr->base;
     for (i = 0; i < descr->nb_names; i++)
         if (descr->ordinals[i] == ordinal) break;
     assert( i < descr->nb_names );
 
-    sprintf( buffer, "%s.%d: %s", descr->name, ordinal, descr->names[i] );
-    *typemask = descr->argtypes[ordinal - descr->base];
-    return (FARPROC32)descr->functions[ordinal - descr->base];
-}
-
-
-/***********************************************************************
- *           BUILTIN_GetProcAddress32
- *
- * Implementation of GetProcAddress() for built-in Win32 modules.
- * FIXME: this should be unified with the real GetProcAddress32().
- */
-FARPROC32 BUILTIN_GetProcAddress32( NE_MODULE *pModule, LPCSTR function )
-{
-    BUILTIN_DLL *dll = (BUILTIN_DLL *)pModule->pe_module;
-    const WIN32_DESCRIPTOR *info = &dll->descr->win32;
-    WORD ordinal = 0;
-
-    if (!dll) return NULL;
-
-    if (HIWORD(function))  /* Find function by name */
-    {
-        int i;
-
-        dprintf_module( stddeb, "Looking for function %s in %s\n",
-                        function, dll->descr->name );
-        for (i = 0; i < info->nb_names; i++)
-            if (!strcmp( function, info->names[i] ))
-            {
-                ordinal = info->ordinals[i];
-                break;
-            }
-        if (i >= info->nb_names) return NULL;  /* not found */
-    }
-    else  /* Find function by ordinal */
-    {
-        ordinal = LOWORD(function);
-        dprintf_module( stddeb, "Looking for ordinal %d in %s\n",
-                        ordinal, dll->descr->name );
-        if ((ordinal < info->base) || (ordinal >= info->base + info->nb_funcs))
-            return NULL;  /* not found */
-    }
-    if (dll->dbg_funcs && (dll->dbg_funcs[ordinal-info->base].args != 0xffff))
-        return (FARPROC32)&dll->dbg_funcs[ordinal - info->base];
-    return (FARPROC32)info->functions[ordinal - info->base];
+    sprintf( buffer, "%s.%d: %s", descr->name, ordinal + descr->base,
+             descr->names[i] );
+    *typemask = descr->argtypes[ordinal];
+    return (FARPROC32)descr->functions[ordinal];
 }
 
 
diff --git a/if1632/crtdll.spec b/if1632/crtdll.spec
index c0b8f3c..91b4e2d 100644
--- a/if1632/crtdll.spec
+++ b/if1632/crtdll.spec
@@ -37,7 +37,7 @@
  33 stub __threadhandle
  34 stub __threadid
  35 stub __toascii
- 36 stub _abnormal_termination
+ 36 cdecl _abnormal_termination() CRTDLL__abnormal_termination
  37 stub _access
  38 extern _acmdln_dll CRTDLL_acmdln_dll
  39 stub _aexit_rtn_dll
@@ -260,7 +260,7 @@
 256 stub _read
 257 stub _rmdir
 258 stub _rmtmp
-259 stub _rotl
+259 cdecl _rotl (long long) CRTDLL__rotl
 260 stub _rotr
 261 stub _scalb
 262 stub _searchenv
@@ -280,7 +280,7 @@
 276 stub _spawnve
 277 stub _spawnvp
 278 stub _spawnvpe
-279 stub _splitpath
+279 cdecl _splitpath (ptr ptr ptr ptr ptr) CRTDLL__splitpath
 280 cdecl _stat (ptr ptr) CRTDLL__stat
 281 stub _statusfp
 282 cdecl _strcmpi(ptr ptr) CRTDLL__strcmpi
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 07848fc..f792059 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -385,7 +385,7 @@
 613 pascal16 EnumFontFamiliesEx(word ptr segptr long long) THUNK_EnumFontFamiliesEx16
 614 stub AddLpkToGDI
 615 stub GetCharacterPlacement
-616 stub GetFontLanguageInfo
+616 pascal GetFontLanguageInfo(word) GetFontLanguageInfo16
 650 stub BuildInverseTableDIB
 701 stub GDITHKCONNECTIONDATALS
 702 stub FT_GDIFTHKTHKCONNECTIONDATA
diff --git a/if1632/gdi32.spec b/if1632/gdi32.spec
index e339598..686cfcf 100644
--- a/if1632/gdi32.spec
+++ b/if1632/gdi32.spec
@@ -173,7 +173,7 @@
 166 stub GetCurrentObject
 167 stdcall GetCurrentPositionEx(long ptr) GetCurrentPositionEx32
 168 stdcall GetDCOrgEx(long ptr) GetDCOrgEx
-169 stub GetDIBColorTable
+169 stdcall GetDIBColorTable(long long long ptr) GetDIBColorTable32
 170 stdcall GetDIBits(long long long long ptr ptr long) GetDIBits32
 171 stdcall GetDeviceCaps(long long) GetDeviceCaps32
 172 stub GetDeviceGammaRamp
@@ -186,7 +186,7 @@
 179 stub GetEnhMetaFilePaletteEntries
 180 stub GetEnhMetaFileW
 181 stub GetFontData
-182 stub GetFontLanguageInfo
+182 stdcall GetFontLanguageInfo(long) GetFontLanguageInfo32
 183 stub GetFontResourceInfo
 184 stub GetFontResourceInfoW
 185 stub GetGlyphOutline
@@ -315,7 +315,7 @@
 308 stdcall SetBrushOrgEx(long long long ptr) SetBrushOrgEx
 309 stub SetColorAdjustment
 310 stub SetColorSpace
-311 stub SetDIBColorTable
+311 stdcall SetDIBColorTable(long long long ptr) SetDIBColorTable32
 312 stdcall SetDIBits(long long long long ptr ptr long) SetDIBits32
 313 stdcall SetDIBitsToDevice(long long long long long long long long long
                                ptr ptr long) SetDIBitsToDevice32
@@ -389,7 +389,7 @@
 378 stub GdiWinWatchGetClipList
 379 stub GdiWinWatchOpen
 380 stub GetGlyphOutlineWow
-381 stub GetTextCharsetInfo
+381 stdcall GetTextCharsetInfo(long ptr long) GetTextCharsetInfo
 382 stdcall TranslateCharsetInfo(ptr ptr long) TranslateCharSetInfo
 383 stub UpdateICMRegKeyA
 384 stub UpdateICMRegKeyW
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index 98f1934..c7fa8da 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -30,7 +30,7 @@
 26  pascal16 GlobalFreeAll(word) GlobalFreeAll
 27  pascal16 GetModuleName(word ptr word) GetModuleName
 28  stub GlobalMasterHandle
-29  pascal16 Yield() Yield
+29  pascal16 Yield() Yield16
 30  pascal16 WaitEvent(word) WaitEvent
 31  pascal16 PostEvent(word) PostEvent
 32  pascal16 SetPriority(word s_word) SetPriority
@@ -91,7 +91,7 @@
 91  register InitTask() InitTask
 92  pascal   GetTempDrive(word) WIN16_GetTempDrive
 93  pascal16 GetCodeHandle(segptr) GetCodeHandle
-94  stub DefineHandleTable
+94  pascal16 DefineHandleTable(word) DefineHandleTable16
 95  pascal16 LoadLibrary(str) LoadLibrary16
 96  pascal16 FreeLibrary(word) FreeLibrary16
 97  pascal16 GetTempFileName(word str word ptr) GetTempFileName16
@@ -103,7 +103,7 @@
 103 register NetBIOSCall() NetBIOSCall
 104 stub GetCodeInfo
 105 pascal16 GetExeVersion() GetExeVersion
-106 pascal SetSwapAreaSize(word) SetSwapAreaSize
+106 pascal SetSwapAreaSize(word) SetSwapAreaSize16
 107 pascal16 SetErrorMode(word) SetErrorMode16
 108 pascal16 SwitchStackTo(word word word) SwitchStackTo
 109 register SwitchStackBack(word word word) SwitchStackBack
@@ -232,6 +232,7 @@
 233 stub RegUnloadKey
 234 stub RegSaveKey
 235 stub InvalidateNlsCache
+236 stub GetProductName
 237 stub KERNEL_237
 262 stub KERNEL_262
 263 stub KERNEL_263
@@ -280,6 +281,7 @@
 359 pascal KERNEL_359(long) _KERNEL_359
 360 stub OpenFileEx
 #361 PIGLET_361
+365 stub KERNEL_365
 403 pascal16 FarSetOwner(word word) FarSetOwner
 404 pascal16 FarGetOwner(word) FarGetOwner
 406 stub WritePrivateProfileStruct
@@ -312,6 +314,7 @@
 471 stub KERNEL_471
 472 register KERNEL_472() _KERNEL_472
 473 stub KERNEL_473
+475 stub KERNEL_475
 482 stub KERNEL_482
 485 stub KERNEL_485
 491 stub RegisterServiceProcess
@@ -327,11 +330,21 @@
 518 stub CallProcEx32W
 519 stub KERNEL_519
 522 stub KERNEL_522
+523 stub KERNEL_523
 525 stub KERNEL_525
+531 stub KERNEL_531
+532 stub KERNEL_532
+540 stub KERNEL_540
+541 stub KERNEL_541
+544 stub KERNEL_544
 600 stub KERNEL_600
 601 stub KERNEL_601
 604 stub KERNEL_604
 605 stub KERNEL_605
+606 stub KERNEL_606
+607 stub KERNEL_607
+608 stub KERNEL_608
+611 stub KERNEL_611
 612 stub KERNEL_612
 613 stub KERNEL_613
 614 stub KERNEL_614
@@ -339,6 +352,6 @@
 621 stub KERNEL_621
 627 stub IsBadFlatReadWritePtr
 630 stub KERNEL_630
-631 pascal FUNC004(word word long) FUNC004	# shell hook
-651 stub KERNEL_651
+631 pascal FUNC004(word word long) FUNC004	#C16ThkSl01?
+651 stub KERNEL_651				#ThunkConnect16?
 700 pascal KERNEL_700() stub_KERNEL_700
diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec
index c0b0b1c..4de6ca3 100644
--- a/if1632/kernel32.spec
+++ b/if1632/kernel32.spec
@@ -160,7 +160,7 @@
 169 stub CreateNamedPipeW
 170 stub CreatePipe
 171 stdcall CreateProcessA(str str ptr ptr long long ptr str ptr ptr) CreateProcess32A
-172 stub CreateProcessW
+172 stdcall CreateProcessW(wstr wstr ptr ptr long long ptr wstr ptr ptr) CreateProcess32W
 173 stub CreateRemoteThread
 174 stdcall CreateSemaphoreA(ptr long long str) CreateSemaphore32A
 175 stdcall CreateSemaphoreW(ptr long long wstr) CreateSemaphore32W
@@ -176,7 +176,7 @@
 185 stdcall DeleteCriticalSection(ptr)	DeleteCriticalSection
 186 stdcall DeleteFileA(str) DeleteFile32A
 187 stdcall DeleteFileW(wstr) DeleteFile32W
-188 stub DeviceIoControl
+188 stdcall DeviceIoControl(long long ptr long ptr long ptr ptr) DeviceIoControl
 189 stdcall DisableThreadLibraryCalls(long) DisableThreadLibraryCalls
 190 stub DisconnectNamedPipe
 191 stdcall DosDateTimeToFileTime(long long ptr) DosDateTimeToFileTime
@@ -250,7 +250,7 @@
 259 stdcall FlushConsoleInputBuffer(long) FlushConsoleInputBuffer
 260 stdcall FlushFileBuffers(long) FlushFileBuffers
 261 stub FlushInstructionCache
-262 stub FlushViewOfFile
+262 stdcall FlushViewOfFile(ptr long) FlushViewOfFile
 263 stub FoldStringA
 264 stub FoldStringW
 265 stdcall FormatMessageA(long ptr long long ptr long ptr) FormatMessage32A
@@ -362,7 +362,7 @@
 371 stub GetPrivateProfileStructW
 372 stdcall GetProcAddress(long str) GetProcAddress32
 373 stdcall GetProcessAffinityMask(long ptr ptr) GetProcessAffinityMask
-374 stub GetProcessFlags
+374 stdcall GetProcessFlags(long) GetProcessFlags
 375 stdcall GetProcessHeap() GetProcessHeap
 376 stub GetProcessHeaps
 377 stub GetProcessShutdownParameters
@@ -531,7 +531,7 @@
 540 stdcall OpenFileMappingW(long long wstr) OpenFileMapping32W
 541 stdcall OpenMutexA(long long str) OpenMutex32A
 542 stdcall OpenMutexW(long long wstr) OpenMutex32W
-543 stub OpenProcess
+543 stdcall OpenProcess(long long long) OpenProcess32
 544 stub OpenProfileUserMapping
 545 stdcall OpenSemaphoreA(long long str) OpenSemaphore32A
 546 stdcall OpenSemaphoreW(long long wstr) OpenSemaphore32W
@@ -553,7 +553,7 @@
 562 stub QueryNumberOfEventLogRecords
 563 stub QueryOldestEventLogRecord
 564 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter
-565 stub QueryPerformanceFrequency
+565 stdcall QueryPerformanceFrequency(ptr) QueryPerformanceFrequency
 566 stub QueueUserAPC
 567 register RaiseException() EXC_RaiseException
 568 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A
@@ -843,3 +843,56 @@
 853 stub VirtualBufferExceptionHandler
 854 stub WriteConsoleInputVDMA
 855 stub WriteConsoleInputVDMW
+
+# NT 4.0 additions
+856 stub CancelIo
+857 stub CancelWaitableTimer
+858 stub CopyFileExA
+859 stub CopyFileExW
+860 stub CreateFiber
+861 stub CreateWaitableTimerA
+862 stub CreateWaitableTimerW
+863 stub DeleteFiber
+864 stub DuplicateConsoleHandle
+865 stub FindFirstFileExA
+866 stub FindFirstFileExW
+867 stub GetConsoleInputExeNameA
+868 stub GetConsoleInputExeNameW
+869 stub GetConsoleKeyboardLayoutNameA
+870 stub GetConsoleKeyboardLayoutNameW
+871 stub GetDiskFreeSpaceExA
+873 stub GetDiskFreeSpaceExW
+874 stub GetFileAttributesExA
+875 stub GetFileAttributesExW
+876 stub GetProcessPriorityBoost
+877 stub GetThreadPriorityBoost
+878 stub InterlockedCompareExchange
+879 stub InterlockedExchangeAdd
+880 stub IsProcessorFeaturePresent
+881 stub OpenWaitableTimerA
+882 stub OpenWaitableTimerW
+883 stub ReadConsoleInputExA
+884 stub ReadConsoleInputExW
+885 stub ReadDirectoryChangesW
+886 stub ReadFileScatter
+887 stub SetConsoleIcon
+888 stub SetConsoleInputExeNameA
+889 stub SetConsoleInputExeNameW
+890 stub SetProcessAffinityMask
+891 stub SetProcessPriorityBoost
+892 stub SetThreadIdealProcessor
+893 stub SetThreadPriorityBoost
+894 stub SetWaitableTimer
+895 stub SignalObjectAndWait
+896 stub SwitchToFiber
+897 stub SwitchToThread
+898 stub TryEnterCriticalSection
+899 stub VirtualAllocEx
+900 stub VirtualFreeEx
+901 stub WriteFileGather
+
+1346 stdcall PrivateLoadLibrary(str) PrivateLoadLibrary
+1545 stdcall PrivateFreeLibrary(long) PrivateFreeLibrary
+
+#1599 wrong ordinal (249 in Win32s's W32SCOMB.DLL) !
+1599 stdcall Get16DLLAddress(long str) Get16DLLAddress
diff --git a/if1632/mpr.spec b/if1632/mpr.spec
index ade7cba..c1977b4 100644
--- a/if1632/mpr.spec
+++ b/if1632/mpr.spec
@@ -58,7 +58,7 @@
 0077 stub WNetGetNetworkInformationW
 0078 stub WNetGetProviderNameA
 0079 stub WNetGetProviderNameW
-0080 stub WNetGetResourceInformationA
+0080 stdcall WNetGetResourceInformationA(ptr ptr ptr ptr) WNetGetResourceInformation32A
 0081 stub WNetGetResourceInformationW
 0082 stub WNetGetResourceParentA
 0083 stub WNetGetResourceParentW
@@ -70,7 +70,7 @@
 0089 stub WNetLogoffW
 0090 stub WNetLogonA
 0091 stub WNetLogonW
-0092 stub WNetOpenEnumA
+0092 stdcall WNetOpenEnumA(long long ptr ptr) WNetOpenEnum32A
 0093 stub WNetOpenEnumW
 0094 stub WNetRemoveCachedPassword
 0095 stub WNetRestoreConnectionA
diff --git a/if1632/ntdll.spec b/if1632/ntdll.spec
index b8fd7f5..4295ecc 100644
--- a/if1632/ntdll.spec
+++ b/if1632/ntdll.spec
@@ -951,3 +951,23 @@
 948 stub wcstol
 949 cdecl wcstombs(ptr ptr long) CRTDLL_wcstombs
 950 stub wcstoul
+
+# NT 4 additions
+951 stub NtAddAtom
+952 stub NtDeleteAtom
+953 stub NtFindAtom
+954 stub NtQueryFullAttributesFile
+955 stub NtQueueApcThread
+956 stub NtReadFileScatter
+957 stub NtSignalAndWaitForSingleObject
+958 stub NtWriteFileGather
+959 stub NtYieldExecution
+960 stub RtlAddAtomToAtomTable
+961 stub RtlAllocateHandle
+962 stub RtlCreateAtomTable
+963 stub RtlDeleteAtomFromAtomTable
+964 stub RtlFreeHandle
+965 stub RtlInitializeHandleTable
+966 stub RtlIsValidHandle
+967 stub RtlLookupAtomInAtomTable
+968 stub RtlQueryAtomInAtomTable
diff --git a/if1632/ole32.spec b/if1632/ole32.spec
index 300d3ee..18cec80 100644
--- a/if1632/ole32.spec
+++ b/if1632/ole32.spec
@@ -38,7 +38,7 @@
  35 stub CoQueryReleaseObject
  36 stub CoRegisterClassObject
  37 stub CoRegisterMallocSpy
- 38 stub CoRegisterMessageFilter
+ 38 stdcall CoRegisterMessageFilter(ptr ptr) CoRegisterMessageFilter
  39 stub CoReleaseMarshalData
  40 stub CoRevokeClassObject
  41 stub CoRevokeMallocSpy
diff --git a/if1632/olecli.spec b/if1632/olecli.spec
index 291db7f..65c77a4 100644
--- a/if1632/olecli.spec
+++ b/if1632/olecli.spec
@@ -40,9 +40,9 @@
 38 stub OLECREATEFROMFILE
 39 stub OLECREATELINKFROMFILE
 40 stub OLERELEASE
-41  pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc
-42  pascal OleRevokeClientDoc(long) OleRevokeClientDoc
-43  pascal OleRenameClientDoc(long ptr) OleRenameClientDoc
+41  pascal OleRegisterClientDoc(ptr ptr long ptr) OleRegisterClientDoc16
+42  pascal OleRevokeClientDoc(long) OleRevokeClientDoc16
+43  pascal OleRenameClientDoc(long ptr) OleRenameClientDoc16
 44 stub OLEREVERTCLIENTDOC
 45 stub OLESAVEDCLIENTDOC
 46 stub OLERENAME
diff --git a/if1632/olecli32.spec b/if1632/olecli32.spec
new file mode 100644
index 0000000..2034bba
--- /dev/null
+++ b/if1632/olecli32.spec
@@ -0,0 +1,59 @@
+name olecli32
+type win32
+
+   1 stub WEP
+   2 stub OleDelete
+   3 stub OleSaveToStream
+   4 stub OleLoadFromStream
+   6 stub OleClone
+   7 stub OleCopyFromLink
+   8 stub OleEqual
+   9 stdcall OleQueryLinkFromClip(str long long) OleQueryLinkFromClip32
+  10 stdcall OleQueryCreateFromClip(str long long) OleQueryCreateFromClip32
+  11 stdcall OleCreateLinkFromClip(str long ptr str long long) OleCreateLinkFromClip32
+  12 stdcall OleCreateFromClip(str ptr long str ptr long long) OleCreateFromClip32
+  13 stub OleCopyToClipboard
+  14 stdcall OleQueryType(ptr ptr) OleQueryType32
+  15 stdcall OleSetHostNames(ptr str str) OleSetHostNames32
+  16 stub OleSetTargetDevice
+  17 stub OleSetBounds
+  18 stub OleQueryBounds
+  19 stub OleDraw
+  20 stub OleQueryOpen
+  21 stub OleActivate
+  22 stub OleUpdate
+  23 stub OleReconnect
+  24 stub OleGetLinkUpdateOptions
+  25 stub OleSetLinkUpdateOptions
+  26 stub OleEnumFormats
+  27 stub OleClose
+  28 stub OleGetData
+  29 stub OleSetData
+  30 stub OleQueryProtocol
+  31 stub OleQueryOutOfDate
+  32 stub OleObjectConvert
+  33 stub OleCreateFromTemplate
+  34 stub OleCreate
+  35 stub OleQueryReleaseStatus
+  36 stub OleQueryReleaseError
+  37 stub OleQueryReleaseMethod
+  38 stub OleCreateFromFile
+  39 stub OleCreateLinkFromFile
+  40 stub OleRelease
+  41 stdcall OleRegisterClientDoc(str str long ptr) OleRegisterClientDoc32
+  42 stdcall OleRevokeClientDoc(long) OleRevokeClientDoc32
+  43 stdcall OleRenameClientDoc(long str) OleRenameClientDoc32
+  44 stub OleRevertClientDoc
+  45 stub OleSavedClientDoc
+  46 stub OleRename
+  47 stub OleEnumObjects
+  48 stub OleQueryName
+  49 stub OleSetColorScheme
+  50 stub OleRequestData
+  54 stub OleLockServer
+  55 stub OleUnlockServer
+  56 stub OleQuerySize
+  57 stub OleExecute
+  58 stub OleCreateInvisible
+  59 stub OleQueryClientVersion
+  60 stub OleIsDcMeta
diff --git a/if1632/olesvr.spec b/if1632/olesvr.spec
index 3eac977..074c538 100644
--- a/if1632/olesvr.spec
+++ b/if1632/olesvr.spec
@@ -2,12 +2,12 @@
 type	win16
 
 #1 WEP
-2  pascal OleRegisterServer(str ptr ptr word word) OleRegisterServer
+2  pascal OleRegisterServer(str ptr ptr word word) OleRegisterServer16
 3  pascal OleRevokeServer(long) OleRevokeServer
-4  pascal OleBlockServer(long) OleBlockServer
-5  pascal OleUnblockServer(long ptr) OleUnblockServer
-6  pascal OleRegisterServerDoc(long str ptr ptr) OleRegisterServerDoc
-7  pascal OleRevokeServerDoc(long) OleRevokeServerDoc
+4  pascal OleBlockServer(long) OleBlockServer16
+5  pascal OleUnblockServer(long ptr) OleUnblockServer16
+6  pascal OleRegisterServerDoc(long str ptr ptr) OleRegisterServerDoc16
+7  pascal OleRevokeServerDoc(long) OleRevokeServerDoc16
 8 stub OLERENAMESERVERDOC
 9 stub OLEREVERTSERVERDOC
 10 stub OLESAVEDSERVERDOC
diff --git a/if1632/olesvr32.spec b/if1632/olesvr32.spec
new file mode 100644
index 0000000..99726dd
--- /dev/null
+++ b/if1632/olesvr32.spec
@@ -0,0 +1,15 @@
+name	olesvr32
+type	win32
+
+ 1 stub WEP
+ 2 stdcall OleRegisterServer(str ptr ptr long long) OleRegisterServer32
+ 3 stub OleRevokeServer
+ 4 stdcall OleBlockServer(long) OleBlockServer32
+ 5 stdcall OleUnblockServer(long ptr) OleUnblockServer32
+ 6 stdcall OleRegisterServerDoc(ptr str ptr ptr) OleRegisterServerDoc32
+ 7 stdcall OleRevokeServerDoc(long) OleRevokeServerDoc32
+ 8 stdcall OleRenameServerDoc(long str) OleRenameServerDoc32
+ 9 stub OleRevertServerDoc
+10 stub OleSavedServerDoc
+11 stub OleRevokeObject
+12 stub OleQueryServerVersion
diff --git a/if1632/shell.spec b/if1632/shell.spec
index 00ec20e..2d9b130 100644
--- a/if1632/shell.spec
+++ b/if1632/shell.spec
@@ -17,7 +17,7 @@
  22 pascal16 ShellAbout(word ptr ptr word) ShellAbout16
  33 pascal16 AboutDlgProc(word word word long) AboutDlgProc16
  34 pascal16 ExtractIcon(word str s_word) ExtractIcon16
- 36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon
+ 36 pascal16 ExtractAssociatedIcon(word ptr ptr) ExtractAssociatedIcon16
  37 pascal   DoEnvironmentSubst(ptr word) DoEnvironmentSubst
  38 pascal   FindEnvironmentString(ptr) FindEnvironmentString
  39 pascal16 InternalExtractIcon(word ptr s_word word) InternalExtractIcon
diff --git a/if1632/shell32.spec b/if1632/shell32.spec
index 04d1ab7..9867e60 100644
--- a/if1632/shell32.spec
+++ b/if1632/shell32.spec
@@ -7,51 +7,182 @@
 
    2 stub SHELL32_2
    3 stub CheckEscapesA
+   4 stub SHELL32_4
+   5 stub SHELL32_5
    6 stub CheckEscapesW
    7 stdcall CommandLineToArgvW(ptr ptr) CommandLineToArgvW
    8 stub Control_FillCache_RunDLL
   12 stdcall Control_RunDLL(long long long long) Control_RunDLL
   14 stdcall DllGetClassObject(long long ptr) SHELL32_DllGetClassObject
+  15 stub SHELL32_15
+  16 stdcall SHELL32_16(ptr) SHELL32_16
+  17 stub SHELL32_17
+  18 stdcall SHELL32_18(ptr) SHELL32_18
+  19 stub SHELL32_19
+  20 stub SHELL32_20
+  21 stub SHELL32_21
   22 stub DoEnvironmentSubstA
+  23 stub SHELL32_23
+  24 stub SHELL32_24
+  25 stdcall SHELL32_25(ptr ptr) SHELL32_25
+  26 stub SHELL32_26
+  27 stub SHELL32_27
+  28 stub SHELL32_28
+  29 stdcall SHELL32_29(str) SHELL32_29
+  30 stub SHELL32_30
+  31 stub SHELL32_31
+  32 stdcall SHELL32_32(str) SHELL32_32
   33 stub SHELL32_33
-  34 stub SHELL32_34
-  35 stub SHELL32_35
+  34 stdcall SHELL32_34(str) SHELL32_34
+  35 stdcall SHELL32_35(str) SHELL32_35
+  36 stdcall SHELL32_36(str str) SHELL32_36
+  37 stdcall SHELL32_37(ptr str str) SHELL32_37
   38 stub DoEnvironmentSubstW
+  39 stub SHELL32_39
+  40 stub SHELL32_40
   41 stdcall DragAcceptFiles(long long) DragAcceptFiles
   42 stub DragFinish
+  43 stub SHELL32_43
   44 stub DragQueryFile
+  45 stdcall SHELL32_45(str) SHELL32_45
   46 stub SHELL32_46
   47 stub SHELL32_47
   48 stub SHELL32_48
   49 stub SHELL32_49
   50 stub DragQueryFileA
+  51 stub SHELL32_51
+  52 stdcall SHELL32_52(str) SHELL32_52
   53 stub DragQueryFileAorW
   54 stub DragQueryFileW
+  55 stub SHELL32_55
   56 stub SHELL32_56
   57 stub SHELL32_57
   58 stub SHELL32_58
-  62 stub SHELL32_62
+  59 stub SHELL32_59
+  60 stub SHELL32_60
+  61 stub SHELL32_61
+  62 stdcall SHELL32_62(long long long long) SHELL32_62
   63 stub SHELL32_63
   64 stub SHELL32_64
   65 stub SHELL32_65
+  66 stub SHELL32_66
+  67 stub SHELL32_67
+  68 stub SHELL32_68
+  69 stub SHELL32_69
+  70 stub SHELL32_70
+  71 stdcall SHELL32_71(ptr ptr) SHELL32_71
+  72 stdcall SHELL32_72(ptr ptr long) SHELL32_72
+  73 stub SHELL32_73
+  74 stub SHELL32_74
+  75 stub SHELL32_75
   76 stub DragQueryPoint
+  77 stdcall SHELL32_77(long long long) SHELL32_77
+  78 stub SHELL32_78
+  79 stdcall SHELL32_79(str ptr) SHELL32_79
   80 stub DuplicateIcon
+  81 stub SHELL32_81
   82 stub ExtractAssociatedIconA
+  83 stub SHELL32_83
+  84 stub SHELL32_84
+  85 stub SHELL32_85
+  86 stub SHELL32_86
+  87 stub SHELL32_87
+  88 stub SHELL32_88
+  89 stub SHELL32_89
+  90 stub SHELL32_90
+  91 stub SHELL32_91
+  92 stub SHELL32_92
+  93 stub SHELL32_93
+  94 stub SHELL32_94
+  95 stub SHELL32_95
+  96 stub SHELL32_96
+  97 stub SHELL32_97
+  98 stub SHELL32_98
+  99 stub SHELL32_99
+ 100 stdcall SHELL32_100(long) SHELL32_100
  101 stub ExtractAssociatedIconExA
+ 102 stdcall SHELL32_102(ptr ptr long ptr ptr) SHELL32_102
+ 103 stub SHELL32_103
+ 104 stub SHELL32_104
+ 105 stub SHELL32_105
+ 106 stub SHELL32_106
+ 107 stub SHELL32_107
+ 108 stub SHELL32_108
+ 109 stub SHELL32_109
+ 110 stub SHELL32_110
+ 111 stub SHELL32_111
+ 112 stub SHELL32_112
+ 113 stub SHELL32_113
+ 114 stub SHELL32_114
+ 115 stub SHELL32_115
+ 116 stub SHELL32_116
+ 117 stub SHELL32_117
+ 118 stub SHELL32_118
+ 119 stdcall SHELL32_119(ptr) SHELL32_119
+ 120 stub SHELL32_120
+ 121 stub SHELL32_121
+ 122 stub SHELL32_122
+ 123 stub SHELL32_123
  124 stub ExtractAssociatedIconExW
  125 stub ExtractAssociatedIconW
- 133 stdcall ExtractIconA(long ptr long) ExtractIcon32A
+ 126 stub SHELL32_126
+ 127 stub SHELL32_127
+ 128 stdcall DllGetClassObject(long long ptr) SHELL32_DllGetClassObject
+ 129 stub SHELL32_129
+ 130 stub SHELL32_130
+ 131 stub SHELL32_131
+ 132 stub SHELL32_132
+ 133 stdcall ExtractIconA(long str long) ExtractIcon32A
+ 134 stub SHELL32_134
  135 stub ExtractIconEx
+ 136 stub SHELL32_136
+ 137 stub SHELL32_137
  138 stub ExtractIconExA
+ 139 stub SHELL32_139
+ 140 stub SHELL32_140
+ 141 stub SHELL32_141
+ 142 stub SHELL32_142
+ 143 stub SHELL32_143
+ 144 stub SHELL32_144
+ 145 stub SHELL32_145
+ 146 stub SHELL32_146
+ 147 stub SHELL32_147
  148 stub ExtractIconResInfoA
+ 149 stub SHELL32_149
  150 stub ExtractIconResInfoW
+ 151 stub SHELL32_151
+ 152 stdcall SHELL32_152(ptr) SHELL32_152
+ 153 stub SHELL32_153
+ 154 stub SHELL32_154
+ 155 stdcall SHELL32_155(ptr) SHELL32_155
  156 stub SHELL32_156
  157 stub SHELL32_157
  158 stub SHELL32_158
  159 stub SHELL32_159
  160 stub SHELL32_160
- 180 stub ExtractIconW
+ 161 stub SHELL32_161
+ 162 stub SHELL32_162
+ 163 stub SHELL32_163
+ 164 stub SHELL32_164
+ 165 stdcall SHELL32_165(long long) SHELL32_165
+ 166 stub SHELL32_166
+ 167 stub SHELL32_167
+ 168 stub SHELL32_168
+ 169 stub SHELL32_169
+ 170 stub SHELL32_170
+ 171 stub SHELL32_171
+ 172 stub SHELL32_172
+ 173 stub SHELL32_173
+ 174 stub SHELL32_174
+ 175 stdcall SHELL32_175(long long long long) SHELL32_175
+ 176 stub SHELL32_176
+ 177 stub SHELL32_177
+ 178 stub SHELL32_178
+ 179 stub SHELL32_179
+ 180 stdcall ExtractIconW(long wstr long) ExtractIcon32W
+ 181 stdcall SHELL32_181(long long) SHELL32_181
  182 stub ExtractVersionResource16W
+ 183 cdecl SHELL32_183(long long long long long long) SHELL32_183
  184 stub SHELL32_184
  185 stub SHELL32_185
  186 stdcall FindExecutableA(ptr ptr ptr) FindExecutable32A
@@ -63,11 +194,19 @@
  192 stub PrintersGetCommand_RunDLL
  193 stub RealShellExecuteA
  194 stub RealShellExecuteExA
+ 195 stdcall SHELL32_195(ptr) SHELL32_195
+ 196 stdcall SHELL32_196(long) SHELL32_196
+ 197 stub SHELL32_197
+ 198 stub SHELL32_198
+ 199 stub SHELL32_199
+ 200 stub SHELL32_200
+ 201 stub SHELL32_201
+ 202 stub SHELL32_202
  203 stub RealShellExecuteExW
  204 stub RealShellExecuteW
  205 stub RegenerateUserEnvironment
  206 stub SHAddToRecentDocs
- 207 stub SHAppBarMessage
+ 207 stdcall SHAppBarMessage(long ptr) SHAppBarMessage32
  208 stub SHBrowseForFolder
  209 stub SHBrowseForFolderA
  210 stub SHChangeNotify
@@ -76,7 +215,7 @@
  213 stub SHFormatDrive
  214 stub SHFreeNameMappings
  215 stub SHGetDataFromIDListA
- 216 stub SHGetDesktopFolder
+ 216 stdcall SHGetDesktopFolder(ptr) SHGetDesktopFolder
  217 stdcall SHGetFileInfo(ptr long ptr long long) SHGetFileInfo32A
  218 stdcall SHGetFileInfoA(ptr long ptr long long) SHGetFileInfo32A
  219 stub SHGetInstanceExplorer
@@ -113,6 +252,10 @@
  250 stub Shell_NotifyIconA
  251 stub Shl1632_ThunkData32
  252 stub Shl3216_ThunkData32
+ 505 stub SHELL32_505
+ 507 stub SHELL32_507
+ 510 stub SHELL32_510
+ 511 stub SHELL32_511
 1025 stub ExtractIconExW # proper ordinal unknown
 1030 stub FindExeDlgProc # proper ordinal unknown
 1043 stub RegisterShellHook # proper ordinal unknown
diff --git a/if1632/user.spec b/if1632/user.spec
index 521deb9..fef3bfc 100644
--- a/if1632/user.spec
+++ b/if1632/user.spec
@@ -52,7 +52,7 @@
 48  pascal16 IsChild(word word) IsChild16
 49  pascal16 IsWindowVisible(word) IsWindowVisible16
 50  pascal16 FindWindow(segstr str) FindWindow16
-#51 BEAR51
+51  stub BEAR51 # IsTwoByteCharPrefix
 52  pascal16 AnyPopup() AnyPopup16
 53  pascal16 DestroyWindow(word) DestroyWindow16
 54  pascal16 EnumWindows(segptr long) THUNK_EnumWindows16
@@ -87,6 +87,7 @@
 83  pascal16 FrameRect(word ptr word) FrameRect16
 84  pascal16 DrawIcon(word s_word s_word word) DrawIcon16
 85  pascal16 DrawText(word str s_word ptr word) DrawText16
+86  stub BEAR86 # IconSize
 87  pascal16 DialogBox(word segstr word segptr) DialogBox16
 88  pascal16 EndDialog(word s_word) EndDialog16
 89  pascal16 CreateDialog(word segstr word segptr) CreateDialog16
@@ -217,7 +218,7 @@
 213 pascal16 BuildCommDCB(ptr ptr) BuildCommDCB16
 214 pascal   EscapeCommFunction(word word) EscapeCommFunction16
 215 pascal16 FlushComm(word word) FlushComm
-#216 USERSEEUSERDO
+216 stub USERSEEUSERDO
 217 pascal16 LookupMenuHandle(word s_word) LookupMenuHandle
 218 pascal16 DialogBoxIndirect(word word word segptr) DialogBoxIndirect16
 219 pascal16 CreateDialogIndirect(word ptr word segptr) CreateDialogIndirect16
@@ -431,6 +432,7 @@
 492 pascal16 USER_492() stub_USER_492
 496 pascal16 USER_496() stub_USER_496
 499 pascal16 WNetErrorText(word ptr word) WNetErrorText
+500 stub FARCALLNETDRIVER 			# Undocumented Windows
 501 pascal16 WNetOpenJob(ptr ptr word ptr)  WNetOpenJob
 502 pascal16 WNetCloseJob(word ptr ptr) WNetCloseJob
 503 pascal16 WNetAbortJob(ptr word) WNetAbortJob
@@ -534,3 +536,4 @@
 920 pascal16 USER_920() stub_USER_920
 922 pascal16 USER_922() stub_USER_922
 923 pascal16 USER_923() stub_USER_923
+924 stub UsrMpr_ThunkData16
diff --git a/if1632/user32.spec b/if1632/user32.spec
index 91782b6..f0f98be 100644
--- a/if1632/user32.spec
+++ b/if1632/user32.spec
@@ -12,7 +12,7 @@
   9 stdcall BeginDeferWindowPos(long) BeginDeferWindowPos32
  10 stdcall BeginPaint(long ptr) BeginPaint32
  11 stdcall BringWindowToTop(long) BringWindowToTop32
- 12 stub BroadcastSystemMessage
+ 12 stdcall BroadcastSystemMessage(long ptr long long long) BroadcastSystemMessage
  13 stub CalcChildScroll
  14 stub CallMsgFilter
  15 stdcall CallMsgFilterA(ptr long) CallMsgFilter32A
@@ -285,7 +285,7 @@
 280 stub GetProcessWindowStation
 281 stdcall GetPropA(long ptr) GetProp32A
 282 stdcall GetPropW(long ptr) GetProp32W
-283 stub GetQueueStatus
+283 stdcall GetQueueStatus(long) GetQueueStatus32
 284 stdcall GetScrollInfo(long long ptr) GetScrollInfo32
 285 stdcall GetScrollPos(long long) GetScrollPos32
 286 stdcall GetScrollRange(long long ptr ptr) GetScrollRange32
@@ -381,7 +381,7 @@
 376 stdcall LoadStringW(long long ptr long) LoadString32W
 377 stub LockWindowStation
 378 stdcall LockWindowUpdate(long) LockWindowUpdate32
-379 stdcall LookupIconIdFromDirectory(ptr long) LookupIconIdFromDirectory
+379 stdcall LookupIconIdFromDirectory(ptr long) LookupIconIdFromDirectory32
 380 stdcall LookupIconIdFromDirectoryEx(ptr long long long long) LookupIconIdFromDirectoryEx32
 381 stub MBToWCSEx
 382 stdcall MapDialogRect(long ptr) MapDialogRect32
@@ -435,7 +435,7 @@
 430 stdcall RegisterClassW(ptr) RegisterClass32W
 431 stdcall RegisterClipboardFormatA(str) RegisterClipboardFormat32A
 432 stdcall RegisterClipboardFormatW(wstr) RegisterClipboardFormat32W
-433 stub RegisterHotKey
+433 stdcall RegisterHotKey(long long long long) RegisterHotKey
 434 stub RegisterLogonProcess
 435 stub RegisterSystemThread
 436 stub RegisterTasklist
@@ -506,7 +506,7 @@
 501 stdcall SetScrollInfo(long long ptr long) SetScrollInfo32
 502 stdcall SetScrollPos(long long long long) SetScrollPos32
 503 stdcall SetScrollRange(long long long long long) SetScrollRange32
-504 stub SetShellWindow
+504 stdcall SetShellWindow(long) SetShellWindow32
 505 stdcall SetSysColors(long ptr ptr) SetSysColors32
 506 stub SetSysColorsTemp
 507 stub SetSystemCursor
@@ -567,7 +567,7 @@
 562 stub UnpackDDElParam
 563 stdcall UnregisterClassA(str long) UnregisterClass32A
 564 stdcall UnregisterClassW(wstr long) UnregisterClass32W
-565 stub UnregisterHotKey
+565 stdcall UnregisterHotKey(long long) UnregisterHotKey
 566 stub UpdatePerUserSystemParameters
 567 stdcall UpdateWindow(long) UpdateWindow32
 568 stub UserClientDllInitialize
@@ -602,6 +602,10 @@
 596 stub RegisterServicesProcess
 597 stub SetWindowRgn
 598 stub ToUnicodeEx
-599 stub DrawCaptionTempA
+599 stdcall DrawCaptionTempA(long long ptr long long str long) DrawCaptionTemp32A
 600 stub RegisterNetworkCapabilities
 601 stub WNDPROC_CALLBACK
+602 stub DrawCaptionTempW
+603 stub IsHungAppWindow
+604 stub ChangeDisplaySettingsA
+605 stub ChangeDisplaySettingsW
diff --git a/if1632/w32skrnl.spec b/if1632/w32skrnl.spec
new file mode 100644
index 0000000..fd02cde
--- /dev/null
+++ b/if1632/w32skrnl.spec
@@ -0,0 +1,139 @@
+name	w32skrnl
+type	win32
+
+1 stub _kSetEnvironmentVariable@8
+2 stub _SzFromImte@4
+3 stdcall GetCurrentTask32() GetCurrentTask
+4 stub _DebugPrintf
+5 stub _NtCloseSection@8
+6 stub _AllocKernelHeap@8
+7 stub _SelToFlat
+8 stub _kGetExeVersion@4
+9 stub _ResizeKernelHeap@12
+10 stub _DbgBackTo32
+11 stub _kGethInstance@0
+12 stub SelOffsetToLinear
+13 stub DebugPrintf
+14 stdcall _kGetWin32sDirectory@0() GetWin32sDirectory
+15 stub _sprintf
+16 stub _KIsDBCSLeadByte@4
+17 stub W32S_BackTo32
+18 stub _KGetDbgFlags32
+19 stub SelToFlat
+20 stub _FreeKernelHeap@4
+21 stub WIN32SYSDLL
+#22
+23 stub _KSilentException@4
+24 stub _NtCreateSection@28
+#25 stub _W32sError32@12
+26 stub _NtOpenSection@12
+27 stub _NtDupSection@4
+28 stub _GetSelModName@20
+29 stub _FGetDscr@8
+30 stdcall _RtlNtStatusToDosError@4(long) RtlNtStatusToDosError #FIXME: not sure
+31 stub _NtFlushVirtualMemory@16
+32 stub _snprintf
+33 stub _NtUnmapViewOfSection@8
+
+#34-149
+
+153 stub _PvAllocVirtMem@16
+154 stub SetVirtMemProcess
+155 stub _FFreeVirtMem@12
+156 stub _FSetVirtProtect@16
+157 stub _QueryVirtMem@8
+158 stub _FLockVirtMem@8
+159 stub _FUnlockVirtMem@8
+
+#160-170
+
+171 stub _HHeapCreateHeap@12
+#172
+173 stub _FHeapDestroy@4
+174 stub _PvAllocHeapMem@12
+175 stub _PvResizeHeapMem@16
+176 stub _FFreeHeapMem@8
+
+#177-196
+
+197 stub _PpdbGetProcess@0
+198 stub _ErcGetError@0
+199 stub _SetError@4
+
+#200-223
+
+224 stub _CbSearchPath@24
+225 stub _CbSearchBinPath@16
+
+#226-230
+
+231 stub _FFindEnvVar@8
+
+#232-251
+
+252 stub _SzFileFromImte@4
+253 stub _ImteFromFileSz@4
+254 stub _ImteFromSz@4
+255 stub _FGetProcAddr@12
+256 stub _KLoadLibrary@8
+257 stub _KFreeLibrary@4
+
+#258-271
+
+272 stub _lmaUserBase
+
+#273-325
+
+326 stub _KrnOutputDebugString@4
+
+#327-359
+
+360 stub _RtlRaiseException
+361 stub _RtlUnwind
+362 stub _RtlUnwind4
+
+#363-401
+
+402 stub _DfhCreateFile@12
+403 stub _FCloseFile@4
+404 stub _CbWriteFile@12
+405 stub _LfoSetFilePos@12
+406 stub _CbReadFile@12
+
+#407-499
+
+500 stub _SelOffsetToLinear@4
+501 stub _ImteFromHModule@4
+502 stub _HModuleFromImte@4
+503 stub _ExitPEApp
+#504 stdcall _GetThunkBuff@0() _GetThunkBuff
+505 stub _Dos3Call@0
+506 stub _GetPEInstanceData@0
+507 stub _GetThreadTask@4
+508 stub _BaseAddrFromImte@4
+509 stub _GetTaskId@12
+510 stub _KGetProcessDebugPort@4
+511 stub _W32S_BackTo32
+512 stub _KReadProcessMemory32@20
+513 stub _KWriteProcessMemory32@20
+514 stub _KGetThreadContext32@8
+515 stub _KSetThreadContext32@8
+516 stub _KQueryPerformanceCounter@8
+#517
+518 stub _KGetExitCodeThread32@8
+519 stub _KGetExitCodeProcess32@8
+520 stub _KGetTaskPpdb32@4
+521 stub _KGetThreadPtdb32@4
+
+#522-599
+
+600 stub _GetCurProcFIOData@0
+601 stub _KUseObject32@4
+602 stub _KUnuseObject32@4
+603 stub _KErcGetError32@0
+604 stub _KCreateProcessHeap@4
+605 stub _KGetSystemInfo@8
+606 stub _KGlobalMemStat@4
+607 stub _GetHandleFromAddr@4
+608 stub _TlsNullSlot@4
+609 stub _FWorkingSetSize@8
diff --git a/if1632/win32s16.spec b/if1632/win32s16.spec
new file mode 100644
index 0000000..2457c88
--- /dev/null
+++ b/if1632/win32s16.spec
@@ -0,0 +1,58 @@
+name	win32s16
+type	win16
+
+1 stub WEP
+2 stub BOOTTASK
+3 stub CREATEPROCESS
+4 stub WAITFORDEBUGEVENT
+5 pascal CONTINUEDEBUGEVENT(long long long) ContinueDebugEvent
+6 pascal READPROCESSMEMORY(long ptr ptr long ptr) ReadProcessMemory
+7 stub WRITEPROCESSMEMORY
+8 stub GETTHREADCONTEXT
+9 stub SETTHREADCONTEXT
+10 pascal GETLASTERROR() GetLastError
+11 pascal CLOSEHANDLE(long) CloseHandle
+12 stub ALLOCCLBKTO32BDLL
+13 pascal GETEXITCODETHREAD(long ptr) GetExitCodeThread
+14 stub GETEXITCODEPROCESS
+15 stub OPENPROCESS
+16 stub OPENTHREAD
+17 stub GETTHREADSELECTORENTRY
+18 pascal VIRTUALQUERYEX(long ptr ptr long) VirtualQueryEx
+19 pascal VIRTUALPROTECTEX(long ptr long long ptr) VirtualProtectEx
+20 stub KGETTASKPPDB
+21 stub KGETTHREADPTDB
+22 stub FREECALLBACK
+23 stub RELEASECSALIAS
+24 stub EXCHANGEPFN32INSTUB
+25 stub SELCBCS
+26 stub DESTROYPEHEADER
+27 stub SELCBDS
+28 stub GETCSALIAS
+29 stub SELFLATCODE
+30 stub HUNITOANSIDBCS
+31 stub ALLOCUTPROC32
+32 stub FLATDATA
+33 stub CODEDATA
+34 stub MYGLOBALFREE
+35 stub FREE32BDLLCBENTRIES
+36 stub SETFS
+37 stub PELOADRESOURCEHANDLER
+38 stub CHECKDEBUG
+39 stub REMOVEH32FROMWIN32S
+40 stub RMEMCPY
+41 stub INITRESLOADER
+42 stub FREESELECTOROFFSET
+43 stub STACKLINEARTOSEGMENTED
+44 stub GETMODULEFILENAME32S
+45 stub FAPILOG16
+46 stub ALLOCCALLBACK
+47 stub LINEARTOHUGESELECTOROFFSET
+48 stub UTSELECTOROFFSETTOLINEAR
+49 stub UTLINEARTOSELECTOROFFSET
+50 stub SELFOREIGNTIB
+51 stub MYGLOBALREALLOC
+52 stub CREATEPEHEADER
+53 stub FINDGLOBALHANDLE
+
+#54-289 exist, but function names blanked out
diff --git a/if1632/winspool.spec b/if1632/winspool.spec
index cafda74..f5bd31a 100644
--- a/if1632/winspool.spec
+++ b/if1632/winspool.spec
@@ -74,7 +74,7 @@
 171 stub EnumPrintProcessorsW
 172 stub EnumPrinterDriversA
 173 stub EnumPrinterDriversW
-174 stub EnumPrintersA
+174 stdcall EnumPrintersA(long ptr long ptr long ptr ptr) EnumPrinters32A
 175 stub EnumPrintersW
 176 stub ExtDeviceMode
 177 stub FindClosePrinterChangeNotification
diff --git a/if1632/wprocs.spec b/if1632/wprocs.spec
index f73a118..61ce5f3 100644
--- a/if1632/wprocs.spec
+++ b/if1632/wprocs.spec
@@ -78,7 +78,7 @@
 158 register INT_Int3aHandler(word) BUILTIN_DefaultIntHandler
 159 register INT_Int3bHandler(word) BUILTIN_DefaultIntHandler
 160 register INT_Int3cHandler(word) BUILTIN_DefaultIntHandler
-161 register INT_Int3dHandler(word) BUILTIN_DefaultIntHandler
+161 register INT_Int3dHandler(word) INT_Int3dHandler
 162 register INT_Int3eHandler(word) BUILTIN_DefaultIntHandler
 163 register INT_Int3fHandler(word) BUILTIN_DefaultIntHandler
 164 register INT_Int40Handler(word) BUILTIN_DefaultIntHandler