Release 960705

Fri Jul  5 16:27:43 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/desktop.c]
	Use Windows file I/O routines to load the desktop bitmap.

	* [files/file.c]
	Implemented RemoveDirectory* and DeleteFile*.

	* [include/wine.h]
	Added SIGCONTEXT typedef to replace #define sigcontext_struct.

	* [loader/task.c]
	Fixed initial breakpoint setting for Win32 tasks.

	* [misc/wsprintf.c]
	Ignore Unicode formats for wsprintf16().

	* [objects/font.c]
	Implemented Win32 version of GetTextMetrics.

	* [windows/winproc.c] [windows/win.c] [windows/class.c]
	  [windows/dialog.c]
	Modified windows procedures to use thunks, to ensure that the
	procedure can be called directly from the Windows program.

	* [windows/win.c]
	Added function WIN_BuildWinArray() to make it easier to enumerate
	windows. Implemented Win32 version of EnumWindows() and friends.

Fri Jul  5 11:56:22 1996  Andreas Kirschbaum <ank@rbg.informatik.th-darmstadt.de>

	* [controls/button.c] [windows/win.c]
	Operator precedence fixes.

	* [controls/edit.c]
	Implemented ES_PASSWORD, ES_LOWERCASE and ES_UPPERCASE styles.
	Fixed word wrap with long words.

	* [debugger/debug.l]
	New alias "where" for command "backtrace".

	* [if1632/gdi.spec]
	Corrected parameter of ExtTextOut.

	* [loader/module.c]
	Corrected printing of table of modules.

	* [misc/spy.c]
	Removed superfluous \n in message name.

	* [windows/message.c]
	Declared MSG_SendMessage as static.
	Changed parameter of DirectedYield() from queue handle to task handle.
	Removed warning mesages for argument of printf.

	* [windows/nonclient.c]
	Added the flag DT_NOPREFIX when drawing window titles.

	* [windows/win.c]
	WIN_WalkWindows now prints the invalid window handle.
	Added a warning if Get-/SetWindowWord/-Long gets an invalid offset.

	* [windows/winproc.c]
	Allows creating dialog windows with NULL as dialog function.

Wed Jul  3 09:26:41 1996  Andrew Lewycky <plewycky@oise.utoronto.ca>

	* [windows/event.c]
	EVENT_key: Fixes to VK_ code generation for space bar and
	punctuation.

	* [files/file.c]
	GetTempFileName: first character in temporary name is "~".

	* [memory/heap.c]
	HEAP_MakeInUseBlockFree now frees the whole subheap if possible.

	* [objects/text.c]
	ExtTextOut16(): handle NULL lpRect and ETO_OPAQUE.

	* [misc/driver.c]
	Removed some bugs and reformatted. Actually loads drivers now.

	* [include/callback.h]
	Added CallDriverProc() and CallWindowsExitProc().

	* [loader/module.c]
	MODULE_CallWEP(): new function.

	* [misc/lzexpand.c]
	LZSeek(): return new pointer, not old one.

	* [misc/ver.c]
	find_ne_resource(): fixed dependence on LZSeek() bug.
	GetFileResource(): initialize reslen before using it.

	* [windows/class.c]
	SetClassWord(): add missing else.

	* [objects/font.c]
	lpFontList is now MAX_FONTS+1. It used to overwrite the array.
	InitFontList: allocate one huge array of structures.
	FONT_MatchFont: uppercase the face name.

Thu Jun 27 12:41:40 1996  Bruce Milner <bruce@genetics.utah.edu>

	* [memory/heap.c]
	Fixed a typo in HeapReAlloc().

Tue Jun 25 22:22:03 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/directory.c] [files/drive.c] [if1632/kernel.spec]
	  [if1632/kernel32.spec] [if1632/shell.spec] [include/windows.h]
	GetTempPath* added
	GetDriveType* fixed, updated to NewNameStandard.
	GetCurrentDirectory* fixed (needs to prepend X:\).

	* [controls/listbox.c]
	Missing NULL check added.

	* [if1632/winmm.spec] [loader/builtin.c]
	winmm.dll (32bit mmsystem equivalent) specs added.

	* [memory/string.c] [if1632/kernel32.spec] [include/windows.h]
	Rtl{Move,Zero,Fill}Memory added.

	* [misc/registry.c]
	Some NULL ptr dereference bugs fixed.

	* [multimedia/mcicda.c][multimedia/mcistring.c][multimedia/mmsystem.c]
	Check for NULL ptr.
	Fill mciOpenDrv when mixing mciOpen and mciSendString("open ..").
	Aliasing should work for all MCI devices.

	* [windows/win.c]
	Allow passing invalid window handles to CloseWindow().

Tue Jun 25 20:02:15 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [files/directory.c] [if1632/kernel32.spec]
	GetSystemDirectory32A and GetSystemDirectory32W added.

	* [misc/main.c] [if1632/kernel32.spec]
	Beep and SetEnvironmentVariable32W added.
diff --git a/loader/task.c b/loader/task.c
index 48bf3ee..43c7d87 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -22,6 +22,8 @@
 #include "module.h"
 #include "neexe.h"
 #include "options.h"
+#include "peexe.h"
+#include "pe_image.h"
 #include "queue.h"
 #include "toolhelp.h"
 #include "stddebug.h"
@@ -116,7 +118,7 @@
         winpathlen += len + 1;
     }
     if (!winpathlen) winpathlen = 1;
-    sysdirlen  = GetSystemDirectory( NULL, 0 ) + 1;
+    sysdirlen  = GetSystemDirectory32A( NULL, 0 ) + 1;
     initial_size = 5 + winpathlen +           /* PATH=xxxx */
                    1 +                        /* BYTE 0 at end */
                    sizeof(WORD) +             /* WORD 1 */
@@ -176,7 +178,7 @@
     *p++ = '\0';
     PUT_WORD( p, 1 );
     p += sizeof(WORD);
-    GetSystemDirectory( p, sysdirlen );
+    GetSystemDirectory32A( p, sysdirlen );
     strcat( p, "\\" );
     strcat( p, program_name );
 
@@ -554,9 +556,19 @@
 
     if (Options.debug)
     {
-        DBG_ADDR addr = { pSegTable[pModule->cs-1].selector, pModule->ip };
-        fprintf( stderr, "Task '%s': ", name );
-        DEBUG_AddBreakpoint( &addr );
+        if (pModule->flags & NE_FFLAGS_WIN32)
+        {
+            DBG_ADDR addr = { 0, pModule->pe_module->load_addr + 
+                              pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint };
+            fprintf( stderr, "Win32 task '%s': ", name );
+            DEBUG_AddBreakpoint( &addr );
+        }
+        else
+        {
+            DBG_ADDR addr = { pSegTable[pModule->cs-1].selector, pModule->ip };
+            fprintf( stderr, "Win16 task '%s': ", name );
+            DEBUG_AddBreakpoint( &addr );
+        }
     }
 #endif
 
@@ -584,7 +596,7 @@
 
     /* Free the task module */
 
-    FreeModule( pTask->hModule );
+    FreeModule16( pTask->hModule );
 
     /* Close all open files of this task */
 
@@ -619,6 +631,7 @@
     extern void EXEC_ExitWindows( int retCode );
 
     TDB* pTask = (TDB*) GlobalLock16( hCurrentTask );
+    if (!pTask) EXEC_ExitWindows(0);  /* No current task yet */
 
     /* Perform USER cleanup */
 
@@ -753,7 +766,7 @@
 #ifdef WINELIB
 void InitTask(void)
 #else
-void InitTask( struct sigcontext_struct context )
+void InitTask( SIGCONTEXT context )
 #endif
 {
     static int firstTask = 1;
@@ -959,12 +972,12 @@
 
 
 /***********************************************************************
- *           MakeProcInstance  (KERNEL.51)
+ *           MakeProcInstance16  (KERNEL.51)
  */
-FARPROC MakeProcInstance( FARPROC func, HANDLE hInstance )
+FARPROC16 MakeProcInstance16( FARPROC16 func, HANDLE16 hInstance )
 {
-#ifdef WINELIB32
-    return func; /* func can be called directly in Win32 */
+#ifdef WINELIB
+    return func; /* func can be called directly in Winelib */
 #else
     BYTE *thunk;
     SEGPTR thunkaddr;
@@ -987,11 +1000,11 @@
 
 
 /***********************************************************************
- *           FreeProcInstance  (KERNEL.52)
+ *           FreeProcInstance16  (KERNEL.52)
  */
-void FreeProcInstance( FARPROC func )
+void FreeProcInstance16( FARPROC16 func )
 {
-#ifndef WINELIB32
+#ifndef WINELIB
     dprintf_task( stddeb, "FreeProcInstance(%08lx)\n", (DWORD)func );
     TASK_FreeThunk( hCurrentTask, (SEGPTR)func );
 #endif
@@ -1060,7 +1073,7 @@
  *           GetTaskQueueDS  (KERNEL.118)
  */
 #ifndef WINELIB
-void GetTaskQueueDS( struct sigcontext_struct context )
+void GetTaskQueueDS( SIGCONTEXT context )
 {
     DS_reg(&context) = GlobalHandleToSel( GetTaskQueue(0) );
 }
@@ -1071,7 +1084,7 @@
  *           GetTaskQueueES  (KERNEL.119)
  */
 #ifndef WINELIB
-void GetTaskQueueES( struct sigcontext_struct context )
+void GetTaskQueueES( SIGCONTEXT context )
 {
     ES_reg(&context) = GlobalHandleToSel( GetTaskQueue(0) );
 }
@@ -1081,7 +1094,7 @@
 /***********************************************************************
  *           GetCurrentTask   (KERNEL.36)
  */
-HTASK GetCurrentTask(void)
+HTASK16 GetCurrentTask(void)
 {
     return hCurrentTask;
 }
@@ -1223,7 +1236,7 @@
 /***********************************************************************
  *           TaskFirst   (TOOLHELP.63)
  */
-BOOL TaskFirst( TASKENTRY *lpte )
+BOOL16 TaskFirst( TASKENTRY *lpte )
 {
     lpte->hNext = hFirstTask;
     return TaskNext( lpte );
@@ -1233,7 +1246,7 @@
 /***********************************************************************
  *           TaskNext   (TOOLHELP.64)
  */
-BOOL TaskNext( TASKENTRY *lpte )
+BOOL16 TaskNext( TASKENTRY *lpte )
 {
     TDB *pTask;
     INSTANCEDATA *pInstData;
@@ -1265,7 +1278,7 @@
 /***********************************************************************
  *           TaskFindHandle   (TOOLHELP.65)
  */
-BOOL TaskFindHandle( TASKENTRY *lpte, HTASK hTask )
+BOOL16 TaskFindHandle( TASKENTRY *lpte, HTASK16 hTask )
 {
     lpte->hNext = hTask;
     return TaskNext( lpte );