Release 960309

Fri Mar  8 19:07:18 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure.in]
	Quote '[' and ']' in the test program for the strength-reduce
	bug. This should work much better...

	* [files/file.c]
	Augmented DOS_FILE structure. Most internal functions now return a
	DOS_FILE* instead of a Unix handle.
	Added a local file array to replace the PDB list upon startup, to
	allow using file I/O functions before the first task is created.
	Added FILE_SetDateTime() and FILE_Sync() functions.
	
	* [loader/module.c]
	Use the DOS file I/O functions in MODULE_LoadExeHeader().

	* [objects/bitblt.c]
	Use visible region instead of GC clip region to clip source
	area. This fixes the card drawing bug in freecell.

	* [objects/region.c]
	Fixed CombineRgn() to allow src and dest regions to be the same.

Fri Mar  8 16:32:23 1996  Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl>

	* [controls/EDIT.TODO]
	Updated so it reflects the current status.

	* [controls/edit.c]
	Implemented internal EDIT_WordBreakProc().
	Implemented ES_READONLY.
	Implemented WM_LBUTTONDBLCLK to select whole words.
	Fixed a lot of types in the function definitions.

Wed Mar  6 19:55:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [debugger/info.c]
	Added "walk window" command to walk window list. 

	* [windows/mdi.c]
	Added proper(?) WM_MDISETMENU message handling.

Wed Mar  6 09:27:12 1996  Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [if1632/callback.c][if1632/relay32.c]
	RELAY32_CallWindowProcConvStruct: new function.

	* [win32/struct32.c][win32/Makefile.in][win32/param.c][win32/user32.c]
	struct32.c: new file. Moved all structure conversions into that file
	PARAM32_POINT32to16,MSG16to32,USER32_RECT32to16: 
	renamed to STRUCT32_POINT32to16, ...
	WIN32_POINT,WIN32_MSG,WIN32_RECT,WIN32_PAINTSTRUCT: renamed to
	POINT32, ...
	New conversion functions for NCCALCSIZE_PARAMS, WINDOWPOS,
 	CREATESTRUCT.

	* [include/windows.h][misc/exec.c]
	WINHELP, MULTIKEYHELP, HELPWININFO: new structures
	WinHelp: Reimplemented. Thanks to Peter Balch
 	(100710.2566@compuserve.com) for his valuable research.

	* [win32/winprocs.c]
	WIN32_CallWindowProcTo16: new function, call in
 	USER32_DefWindowProcA,...

Mon Mar  4 23:22:40 1996  Jim Peterson <jspeter@birch.ee.vt.edu>

	* [include/wintypes.h]
	Added "#define __export".

	* [objects/bitblt.c]
	Put in a few hacks to make bitblt-ing work when upside-down and/or
	mirrored.  BITBLT_StretchImage should really be checked over
	thoroughly.

	* [programs/progman/main.c]
	Added "#include <resource.h>" for definition of HAVE_WINE_CONSTRUCTOR.

	* [rc/parser.h] [rc/parser.l] [rc/parser.y] [rc/winerc.c]
	Eliminated shift/reduce conflict in style definition.
	Added crude error message support: "stdin:%d: parse error before '%s'".
	Implemented string table support to the best of my ability (it works
	with LoadString() calls).

	* [windows/nonclient.c]
	Fixed bug in NC_DoSizeMove() that made system menu pop up when title
	bar of non-iconized window was clicked (checked for iconization).

Mon Mar 04 20:55:19 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [if1632/lzexpand.spec] [if1632/relay.c]
	  [include/lzexpand.h][misc/lzexpand.c]
	LZEXPAND.DLL added.

Sun Mar 03 18:10:22 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/win.c]
	Prevent usage of invalid HWNDs in WIN_EnumChildWin(),
	this prevents too early termination of EnumChildWindows().
diff --git a/loader/module.c b/loader/module.c
index f9dd6fe..a18f1da 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -411,7 +411,7 @@
 /***********************************************************************
  *           MODULE_LoadExeHeader
  */
-HMODULE MODULE_LoadExeHeader( int fd, OFSTRUCT *ofs )
+HMODULE MODULE_LoadExeHeader( HFILE hFile, OFSTRUCT *ofs )
 {
     struct mz_header_s mz_header;
     struct ne_header_s ne_header;
@@ -427,15 +427,15 @@
        ((fastload && ((offset) >= fastload_offset) && \
          ((offset)+(size) <= fastload_offset+fastload_length)) ? \
         (memcpy( buffer, fastload+(offset)-fastload_offset, (size) ), TRUE) : \
-        (lseek( fd, mz_header.ne_offset+(offset), SEEK_SET), \
-         read( fd, (buffer), (size) ) == (size)))
+        (_llseek( hFile, mz_header.ne_offset+(offset), SEEK_SET), \
+         FILE_Read( hFile, (buffer), (size) ) == (size)))
 
-    lseek( fd, 0, SEEK_SET );
-    if ((read( fd, &mz_header, sizeof(mz_header) ) != sizeof(mz_header)) ||
+    _llseek( hFile, 0, SEEK_SET );
+    if ((FILE_Read(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
         (mz_header.mz_magic != MZ_SIGNATURE)) return (HMODULE)11;  /* invalid exe */
 
-    lseek( fd, mz_header.ne_offset, SEEK_SET );
-    if (read( fd, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
+    _llseek( hFile, mz_header.ne_offset, SEEK_SET );
+    if (FILE_Read( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
         return (HMODULE)11;  /* invalid exe */
 
     if (ne_header.ne_magic == PE_SIGNATURE) return (HMODULE)21;  /* win32 exe */
@@ -477,8 +477,8 @@
                         fastload_offset, fastload_length );
         if ((fastload = (char *)malloc( fastload_length )) != NULL)
         {
-            lseek( fd, mz_header.ne_offset + fastload_offset, SEEK_SET );
-            if (read( fd, fastload, fastload_length ) != fastload_length)
+            _llseek( hFile, mz_header.ne_offset + fastload_offset, SEEK_SET );
+            if (FILE_Read( hFile, fastload, fastload_length ) != fastload_length)
             {
                 free( fastload );
                 fastload = NULL;
@@ -572,8 +572,8 @@
                                                hModule, FALSE, FALSE, FALSE );
         if (!pModule->nrname_handle) return (HMODULE)11;  /* invalid exe */
         buffer = GlobalLock( pModule->nrname_handle );
-        lseek( fd, ne_header.nrname_tab_offset, SEEK_SET );
-        if (read( fd, buffer, ne_header.nrname_tab_length )
+        _llseek( hFile, ne_header.nrname_tab_offset, SEEK_SET );
+        if (FILE_Read( hFile, buffer, ne_header.nrname_tab_length )
               != ne_header.nrname_tab_length) return (HMODULE)11;  /* invalid exe */
     }
     else pModule->nrname_handle = 0;
@@ -925,7 +925,8 @@
     LOADPARAMS *params = (LOADPARAMS *)paramBlock;
 #ifndef WINELIB
     WORD *pModRef, *pDLLs;
-    int i, fd;
+    HFILE hFile;
+    int i;
 
     hModule = MODULE_FindModule( name );
 
@@ -936,7 +937,7 @@
         /* Try to load the built-in first if not disabled */
         if ((hModule = MODULE_LoadBuiltin( name, FALSE ))) return hModule;
 
-        if ((fd = FILE_OpenFile( name, &ofs, OF_READ )) == -1)
+        if ((hFile = OpenFile( name, &ofs, OF_READ )) == HFILE_ERROR)
         {
             /* Now try the built-in even if disabled */
             if ((hModule = MODULE_LoadBuiltin( name, TRUE )))
@@ -949,17 +950,20 @@
 
           /* Create the module structure */
 
-        hModule = MODULE_LoadExeHeader( fd, &ofs );
+        hModule = MODULE_LoadExeHeader( hFile, &ofs );
         if (hModule < 32)
         {
+            /* FIXME: Hack because PE_LoadModule is recursive */
+            int fd = dup( FILE_GetUnixHandle(hFile) );
+            _lclose( hFile );
             if (hModule == 21) hModule = PE_LoadModule( fd, &ofs, paramBlock );
-            close(fd);
+            close( fd );
             if (hModule < 32)
                 fprintf( stderr, "LoadModule: can't load '%s', error=%d\n",
                          name, hModule );
             return hModule;
         }
-        close( fd );
+        _lclose( hFile );
         pModule = (NE_MODULE *)GlobalLock( hModule );
 
           /* Allocate the segments for this module */
@@ -1017,6 +1021,7 @@
 
 	if (pModule->flags & NE_FFLAGS_SELFLOAD)
 	{
+                int fd;
 		/* Handle self loading modules */
 		SEGTABLEENTRY * pSegTable = (SEGTABLEENTRY *) NE_SEG_TABLE(pModule);
 		SELFLOADHEADER *selfloadheader;
@@ -1069,6 +1074,8 @@
 		  IF1632_Stack32_base = WIN16_GlobalLock(hInitialStack32);
 
 		}
+                /* FIXME: we probably need a DOS handle here */
+                fd = MODULE_OpenFile( hModule );
 		CallTo16_word_ww (selfloadheader->BootApp,
 			pModule->self_loading_sel, hModule, fd);
 		/* some BootApp procs overwrite the selector of dgroup */