Release 960405

Fri Apr  5 15:22:55 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/button.c] [controls/static.c]
	Changes to use WND * wherever possible.

	* [debugger/dbg.y] [debugger/debug.l]
	Added 'info module' and 'walk module' commands.

	* [if1632/Makefile.in] [if1632/relay.c] [tools/build.c]
	Added assembly code generation to call from Wine into 32-bit code.
	Changed all 'call32' references in 'callfrom16' to avoid confusion
	with Win32 routines.

	* [include/callback.h]
	Added prototypes for 32-bit callbacks.

	* [loader/module.c] [if1632/relay32.c] [tools/build.c]
	Unified 16- and 32-bit modules. The fake module for 32-bit DLLs is
	now generated by the build program.

	* [include/module.h]
	Added extra info to NE_MODULE for Win32 modules to point to the PE
	module data.

	* [include/pe_image.h] [loader/pe_image.c] [win32/resource.c]
	Removed the wine_files list. The PE data for a module can now be
	accessed with the NE_WIN32_MODULE macro.

	* [loader/signal.c] [miscemu/instr.c]
	Don't start the BIOS timer at startup, but only after an access to
	the 0x40 segment.

	* [memory/local.c]
	Changed LOCAL_Lock() to return a 32-bit pointer.

	* [misc/main.c] [include/dlls.h]
	Some built-in DLLs (like KERNEL) can no longer be disabled from
 	the command-line.
	
Thu Apr  4 19:54:39 1996  Keith Reynolds <keithr@sco.COM>

	* [*/*]
	A lot of small changes to support SCO OpenServer 5.

Thu Apr  4 15:38:13 1996  Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl>

	* [controls/edit.c]
	Fixed GetKeyState() call to use 0x8000 convention.

	* [include/windows.h]
	Added undocumented messages EM_SCROLL and EM_GETTHUMB.

Thu Apr  4 09:52:52 1996  John Harvey <john@division.co.uk>

	* [if1632/except.S]
	Modified code to assemble on unixware.

Wed Apr  3 09:38:26 1996  Juergen Marquardt <marqu@lunar.advantest.de>

	* [objects/font.c]
	Implementation of a second font cache which will be updated
	dynamically.

Mon Apr  1 16:47:40 1996  Robert Pouliot <krynos@qbc.clic.net>

	* [resources/sysres_Cz.rc] [resources/sysres_Da.rc]
	  [resources/sysres_De.rc] [resources/sysres_Eo.rc]
	  [resources/sysres_Es.rc] [resources/sysres_Fi.rc]
	  [resources/sysres_No.rc] [resources/TODO]
	Updated FIND_TEXT and REPLACE_TEXT to work like the English version.
diff --git a/loader/module.c b/loader/module.c
index fce734c..060c286 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -47,7 +47,7 @@
     HMODULE hModule;
     NE_MODULE *pModule;
     SEGTABLEENTRY *pSegTable;
-    struct dll_table_s *table;
+    BUILTIN_DLL *table;
     char dllname[16], *p;
 
     /* Fix the name in case we have a full path and extension */
@@ -71,25 +71,31 @@
 
     dprintf_module( stddeb, "Built-in %s: hmodule=%04x\n",
                     table->name, hModule );
-
-    /* Allocate the code segment */
-
     pModule = (NE_MODULE *)GlobalLock( hModule );
-    pSegTable = NE_SEG_TABLE( pModule );
 
-    pSegTable->selector = GLOBAL_CreateBlock( GMEM_FIXED, table->code_start,
-                                              pSegTable->minsize, hModule,
-                                              TRUE, TRUE, FALSE, NULL );
-    if (!pSegTable->selector) return 0;
-    pSegTable++;
+    if (pModule->flags & NE_FFLAGS_WIN32)
+    {
+        ((NE_WIN32_EXTRAINFO*)(pModule+1))->pe_module = (DWORD)table;
+    }
+    else  /* Win16 module */
+    {
+        /* Allocate the code segment */
 
-    /* Allocate the data segment */
+        pSegTable = NE_SEG_TABLE( pModule );
+        pSegTable->selector = GLOBAL_CreateBlock(GMEM_FIXED, table->code_start,
+                                                 pSegTable->minsize, hModule,
+                                                 TRUE, TRUE, FALSE, NULL );
+        if (!pSegTable->selector) return 0;
+        pSegTable++;
 
-    pSegTable->selector = GLOBAL_Alloc( GMEM_FIXED, pSegTable->minsize,
-                                        hModule, FALSE, FALSE, FALSE );
-    if (!pSegTable->selector) return 0;
-    memcpy( GlobalLock( pSegTable->selector ),
-            table->data_start, pSegTable->minsize );
+        /* Allocate the data segment */
+
+        pSegTable->selector = GLOBAL_Alloc( GMEM_FIXED, pSegTable->minsize,
+                                            hModule, FALSE, FALSE, FALSE );
+        if (!pSegTable->selector) return 0;
+        memcpy( GlobalLock( pSegTable->selector ),
+                table->data_start, pSegTable->minsize );
+    }
 
     pModule->next = hFirstModule;
     hFirstModule = hModule;
@@ -104,13 +110,14 @@
  */
 BOOL MODULE_Init(void)
 {
-    /* For these, built-in modules are always used */
-
 #ifndef WINELIB32
-    if (!MODULE_LoadBuiltin( "KERNEL", TRUE ) ||
-        !MODULE_LoadBuiltin( "GDI", TRUE ) ||
-        !MODULE_LoadBuiltin( "USER", TRUE ) ||
-        !MODULE_LoadBuiltin( "WINPROCS", TRUE )) return FALSE;
+    BUILTIN_DLL *dll;
+
+    /* Load all modules marked as always used */
+
+    for (dll = dll_builtin_table; dll->name; dll++)
+        if (dll->flags & DLL_FLAG_ALWAYS_USED)
+            if (!MODULE_LoadBuiltin(dll->name, TRUE)) return FALSE;
 #endif
     /* Initialize KERNEL.178 (__WINFLAGS) with the correct flags value */
 
@@ -120,9 +127,9 @@
 
 
 /***********************************************************************
- *           MODULE_PrintModule
+ *           MODULE_DumpModule
  */
-void MODULE_PrintModule( HMODULE hmodule )
+void MODULE_DumpModule( HMODULE hmodule )
 {
     int i, ordinal;
     SEGTABLEENTRY *pSeg;
@@ -130,6 +137,12 @@
     WORD *pword;
     NE_MODULE *pModule = (NE_MODULE *)GlobalLock( hmodule );
 
+    if (!pModule || (pModule->magic != NE_SIGNATURE))
+    {
+        fprintf( stderr, "**** %04x is not a module handle\n", hmodule );
+        return;
+    }
+
       /* Dump the module info */
 
     printf( "Module %04x:\n", hmodule );
@@ -142,6 +155,8 @@
     printf( "os_flags=%d swap_area=%d version=%04x\n",
             pModule->os_flags, pModule->min_swap_area,
             pModule->expected_version );
+    if (pModule->flags & NE_FFLAGS_WIN32)
+        printf( "PE module=%08x\n", (unsigned int)NE_WIN32_MODULE(pModule) );
 
       /* Dump the file info */
 
@@ -251,6 +266,31 @@
 
 
 /***********************************************************************
+ *           MODULE_WalkModules
+ *
+ * Walk the module list and print the modules.
+ */
+void MODULE_WalkModules(void)
+{
+    HMODULE hModule = hFirstModule;
+    fprintf( stderr, "Module Flags Name\n" );
+    while (hModule)
+    {
+        NE_MODULE *pModule = (NE_MODULE *)GlobalLock( hModule );
+        if (!pModule || (pModule->magic != NE_SIGNATURE))
+        {
+            fprintf( stderr, "**** Bad module %04x in list\n", hModule );
+            return;
+        }
+        fprintf( stderr, " %04x  %04x  %.*s\n", hModule, pModule->flags,
+                 *((char *)pModule + pModule->name_table),
+                 (char *)pModule + pModule->name_table + 1 );
+        hModule = pModule->next;
+    }
+}
+
+
+/***********************************************************************
  *           MODULE_OpenFile
  */
 int MODULE_OpenFile( HMODULE hModule )
@@ -591,7 +631,7 @@
     }
     else pModule->dlls_to_init = 0;
 
-    if (debugging_module) MODULE_PrintModule( hModule );
+    if (debugging_module) MODULE_DumpModule( hModule );
     pModule->next = hFirstModule;
     hFirstModule = hModule;
     return hModule;