Release 960712

Fri Jul 12 17:43:05 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [controls/scroll.c]
	Use Win32 heap functions to allocate scroll-bar info structure.

	* [debugger/dbg.y] [debugger/registers.c]
	Added support for FS and GS segment registers.
	Check that segment registers value are OK before returning from
	the signal handler.

	* [tools/build.c] [if1632/relay.c] [loader/builtin.c]
	Changed relay debugging for Win32 function: the relay code now
	passes the entry point address instead of the function name.

	* [tools/build.c] [miscemu/*.c]
	Added support for data entry points in Win32 DLLs.
	Added 'cdecl' function type for Win32.
	For 'register' function, the relay code now passes a pointer to
	the SIGCONTEXT structure.
	
	* [include/registers.h] [include/wine.h]
	Moved SIGCONTEXT structure definition in registers.h.

	* [loader/pe_image.c]
	Don't die at once if some Win32 entry points cannot be found, but
	set them to NULL, just like we do for Win16. This allows some
	programs to go further before crashing.

	* [loader/task.c] [loader/main.c]
	Moved global initializations from InitTask() to MAIN_Init(), as
	they no longer need a task context with the new SEGPTR heap functions.

	* [memory/string.c]
	Added lstrcpynAtoW and lstrcpynWtoA; not real API functions, but
 	very convenient.

	* [windows/graphics.c]
	Partially implemented DrawEdge().

	* [windows/timer.c] [windows/caret.c]
	Implemented Win32 timer handling. Updated caret management to use
	Win32 timers (avoids having to use a Win16 callback).

	* [windows/win.c]
	Prevent programs from setting some style bits with
	SetWindowLong(). This should fix some BadMatch crashes.
	Link new windows at the end of the linked list.

	* [windows/winpos.c]
	Don't try to activate a child window in ShowWindow().

	* [windows/winproc.c]
	Added a 32->32 thunk to support Ansi-Unicode translation.

Wed Jul 10 22:11:12 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/directory.c]
	Additional (undocumented) return value for GetTempDrive() added.

	* [files/dos_fs.c] [files/file.c] [include/windows.h]
	GetTempFileName32* added.
	GetShortPathName* added.

	* [memory/string.c]
	Win16 lstrcpy() can get NULL ptrs as argument and survive.

	* [misc/lzexpand.c]
	LZOpenFile(): also try opening with compressed filename if normal
 	open fails.

	* [misc/ole2nls.c] [misc/lstr.c] [include/windows.h]
	Char* added.
	CompareString* added.

Sun Jul  7 01:22:14 1996  Jukka Iivonen <iivonen@cc.helsinki.fi>

	* [objects/font.c] [if1632/gdi32.spec]
	CreateFontIndirect32A and CreateFontIndirect32W added.

	* [misc/ole2nls.c]
	GetUserDefaultLCID return values updated for new languages.
	Finnish support added for GetLocaleInfoA.

	* [object/palette] [gdi32.spec]
	RealizePalette32 and SelectPalette32 added.
	
Sat Jul  6 17:27:30 1996  Ronan Waide  <root@waider.ie>

	* [misc/shell.c]
	Fixup for SHELL_FindExecutable so that File->Run from progman
	works once more. Still needs some more fixups - grep for FIXME in
	this file.
diff --git a/files/directory.c b/files/directory.c
index 285468e..10fcf64 100644
--- a/files/directory.c
+++ b/files/directory.c
@@ -248,10 +248,24 @@
  */
 BYTE GetTempDrive( BYTE ignored )
 {
+    /* FIXME: apparently Windows does something with the ignored byte */
     return DIR_TempDosDir[0];
 }
 
 
+UINT32 WIN16_GetTempDrive( BYTE ignored )
+{
+    /* A closer look at krnl386.exe shows what the SDK doesn't mention:
+     *
+     * returns:
+     *	 AL: driveletter
+     *   AH: ':'		- yes, some kernel code even does stosw with
+     *                            the returned AX.
+     *   DX: 1 for success
+     */
+    return MAKELONG( GetTempDrive(ignored) | (':' << 8), 1 );
+}
+
 /***********************************************************************
  *           GetWindowsDirectory   (KERNEL.134)
  */
diff --git a/files/dos_fs.c b/files/dos_fs.c
index 6e3efd8..e2086ec 100644
--- a/files/dos_fs.c
+++ b/files/dos_fs.c
@@ -24,6 +24,8 @@
 #include "msdos.h"
 #include "stddebug.h"
 #include "debug.h"
+#include "xmalloc.h"
+#include "string32.h"
 
 /* Chars we don't want to see in DOS file names */
 #define INVALID_DOS_CHARS  "*?<>|\"+=,;[] \345"
@@ -716,3 +718,32 @@
     dir = NULL;
     return 0;  /* End of directory */
 }
+
+
+/***********************************************************************
+ *           GetShortPathNameA   (KERNEL32.271)
+ */
+DWORD GetShortPathName32A( LPCSTR longpath, LPSTR shortpath, DWORD shortlen )
+{
+    LPCSTR dostruename;
+
+    dprintf_dosfs( stddeb, "GetShortPathName32A(%s,%p,%ld)\n",
+                   longpath, shortpath, shortlen );
+
+    dostruename = DOSFS_GetDosTrueName( longpath, 0 );
+    lstrcpyn32A( shortpath, dostruename, shortlen );
+    return strlen(dostruename);
+}
+
+
+/***********************************************************************
+ *           GetShortPathNameW   (KERNEL32.272)
+ */
+DWORD GetShortPathName32W( LPCWSTR longpath, LPWSTR shortpath, DWORD shortlen )
+{
+    LPSTR longpatha = STRING32_DupUniToAnsi( longpath );
+    LPCSTR dostruename = DOSFS_GetDosTrueName( longpatha, 0 );
+    free( longpatha );
+    lstrcpynAtoW( shortpath, dostruename, shortlen );
+    return strlen(dostruename);
+}
diff --git a/files/drive.c b/files/drive.c
index b57267b..fb15297 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -11,7 +11,7 @@
 #include <sys/types.h>
 #include <sys/stat.h>
 
-#if defined(__linux__) || defined(sun)
+#if defined(__linux__) || defined(sun) || defined(hpux)
 #include <sys/vfs.h>
 #endif
 #if defined(__NetBSD__) || defined(__FreeBSD__)
diff --git a/files/file.c b/files/file.c
index e324d3f..3264c08 100644
--- a/files/file.c
+++ b/files/file.c
@@ -526,13 +526,12 @@
 
 
 /***********************************************************************
- *           GetTempFileName   (KERNEL.97)
+ *           GetTempFileName16   (KERNEL.97)
  */
-INT GetTempFileName( BYTE drive, LPCSTR prefix, UINT unique, LPSTR buffer )
+UINT16 GetTempFileName16( BYTE drive, LPCSTR prefix, UINT16 unique,
+                          LPSTR buffer )
 {
-    int i;
-    UINT num = unique ? (unique & 0xffff) : time(NULL) & 0xffff;
-    char *p;
+    char temppath[144];
 
     if ((drive & TF_FORCEDRIVE) &&
         !DRIVE_IsValid( toupper(drive & ~TF_FORCEDRIVE) - 'A' ))
@@ -543,15 +542,28 @@
     }
 
     if (drive & TF_FORCEDRIVE)
-    {
-        sprintf( buffer, "%c:", drive & ~TF_FORCEDRIVE );
-    }
+        sprintf(temppath,"%c:", drive & ~TF_FORCEDRIVE );
     else
     {
-        GetTempPath32A( 132, buffer );  /* buffer must be at least 144 */
-        strcat( buffer, "\\" );
+        GetTempPath32A( 132, temppath );
+        strcat( temppath, "\\" );
     }
+    return (UINT16)GetTempFileName32A( temppath, prefix, unique, buffer );
+}
 
+
+/***********************************************************************
+ *           GetTempFileName32A   (KERNEL32.290)
+ */
+UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
+                           LPSTR buffer)
+{
+    LPSTR p;
+    int i;
+    UINT32 num = unique ? (unique & 0xffff) : time(NULL) & 0xffff;
+
+    if (!path) return 0;
+    strcpy( buffer, path );
     p = buffer + strlen(buffer);
     *p++ = '~';
     for (i = 3; (i > 0) && (*prefix); i--) *p++ = *prefix++;
@@ -587,9 +599,30 @@
 
 
 /***********************************************************************
- *           OpenFile   (KERNEL.74)
+ *           GetTempFileName32W   (KERNEL32.291)
  */
-HFILE OpenFile( LPCSTR name, OFSTRUCT *ofs, UINT mode )
+UINT32 GetTempFileName32W( LPCWSTR path, LPCWSTR prefix, UINT32 unique,
+                           LPWSTR buffer )
+{
+    LPSTR   patha,prefixa;
+    char    buffera[144];
+    UINT32  ret;
+
+    if (!path) return 0;
+    patha	= STRING32_DupUniToAnsi(path);
+    prefixa	= STRING32_DupUniToAnsi(prefix);
+    ret 	= GetTempFileName32A( patha, prefixa, unique, buffera );
+    STRING32_AnsiToUni( buffer, buffera );
+    free(patha);
+    free(prefixa);
+    return ret;
+}
+
+
+/***********************************************************************
+ *           OpenFile   (KERNEL.74) (KERNEL32.396)
+ */
+HFILE OpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode )
 {
     DOS_FILE *file;
     HFILE hFileRet;
@@ -771,7 +804,7 @@
 
 
 /***********************************************************************
- *           _lclose   (KERNEL.81)
+ *           _lclose   (KERNEL.81) (KERNEL32.592)
  */
 HFILE _lclose( HFILE hFile )
 {
@@ -795,9 +828,9 @@
 
 
 /***********************************************************************
- *           _lcreat   (KERNEL.83)
+ *           _lcreat   (KERNEL.83) (KERNEL32.593)
  */
-HFILE _lcreat( LPCSTR path, INT attr )
+HFILE _lcreat( LPCSTR path, INT32 attr )
 {
     DOS_FILE *file;
     HFILE handle;
@@ -856,9 +889,9 @@
 
 
 /***********************************************************************
- *           _lopen   (KERNEL.85)
+ *           _lopen   (KERNEL.85) (KERNEL32.595)
  */
-HFILE _lopen( LPCSTR path, INT mode )
+HFILE _lopen( LPCSTR path, INT32 mode )
 {
     DOS_FILE *file;
     int unixMode;