Release 960623

Wed Jun 19 14:49:27 1996  Marcus Meissner <msmeissn@faui45.informatik.uni-erlangen.de>

	* [files/drive.c] 
	GetFreeDiskSpace*, GetVolumeInformation* added.

	* [files/file.c]
	FlushFileBuffers, CreateDirectory* added.

	* [include/winbase.h] [include/windows.h]
	Prototypes, defines added and fixes.

	* [if1632/kernel32.spec] [include/resource32.h]
	  [win32/cursoricon32.c] [win32/resource.c] [windows/dialog.c]
	Fixes to resource handling.

	* [if1632/kernel.spec] [if1632/kernel32.spec] [if1632/user32.spec]
	Specs for implemented functions added
	Some thunks to functions which are same as win16 equivalents.

	* [loader/task.c]
	GetAppCompatFlags() added.

	* [misc/registry.c]
	One missing else added, small hack to RegQueryValue16().

	* [win32/file.c]
	GetFileAttributesA() fixed (was using DOS path as UNIX path).

Tue Jun 18 21:00:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [loader/ne_resource.c]
	Fixed FreeResource() return value.

	* [objects/text.c]
	Fixed a bug in ExtTextOut() that was causing overlapped characters
	in WinWord.

	* [windows/winpos.c]
	SWP_FRAMECHANGED for top-level windows now invalidates client
	area as clock.exe wants.

Tue Jun 18 11:30:22 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [controls/listbox.c]
	Mini bugfix: 'revival' of missing scrollbar in listboxes.

Mon Jun 17 20:27:41 1996  Robert Pouliot <krynos@clic.net>

	* [resources/sysres_Fr.rc] [resources/TODO]
	Made changes for Choose_Font dialog.
diff --git a/ANNOUNCE b/ANNOUNCE
index 9196873..76dac67 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,12 +1,12 @@
-This is release 960616 of Wine, the MS Windows emulator.  This is still a
+This is release 960623 of Wine, the MS Windows emulator.  This is still a
 developer's only release.  There are many bugs and many unimplemented API
 features.  Most applications still do not work correctly.
 
 Patches should be submitted to "julliard@lrc.epfl.ch".  Please don't
 forget to include a ChangeLog entry.
 
-WHAT'S NEW with Wine-960616: (see ChangeLog for details)
-	- Inter-task messaging begins to work.
+WHAT'S NEW with Wine-960623: (see ChangeLog for details)
+	- More Win32 code.
 	- Lots of bug fixes.
 
 See the README file in the distribution for installation instructions.
@@ -15,10 +15,10 @@
 the release is available at the ftp sites.  The sources will be available
 from the following locations:
 
-    sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960616.tar.gz
-    tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960616.tar.gz
-    ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960616.tar.gz
-    aris.com:/pub/linux/ALPHA/Wine/development/Wine-960616.tar.gz
+    sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960623.tar.gz
+    tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960623.tar.gz
+    ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960623.tar.gz
+    aris.com:/pub/linux/ALPHA/Wine/development/Wine-960623.tar.gz
 
 It should also be available from any site that mirrors tsx-11 or sunsite.
 
diff --git a/ChangeLog b/ChangeLog
index 855adb2..e94ed93 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,56 @@
 ----------------------------------------------------------------------
+Wed Jun 19 14:49:27 1996  Marcus Meissner <msmeissn@faui45.informatik.uni-erlangen.de>
+
+	* [files/drive.c] 
+	GetFreeDiskSpace*, GetVolumeInformation* added.
+
+	* [files/file.c]
+	FlushFileBuffers, CreateDirectory* added.
+
+	* [include/winbase.h] [include/windows.h]
+	Prototypes, defines added and fixes.
+
+	* [if1632/kernel32.spec] [include/resource32.h]
+	  [win32/cursoricon32.c] [win32/resource.c] [windows/dialog.c]
+	Fixes to resource handling.
+
+	* [if1632/kernel.spec] [if1632/kernel32.spec] [if1632/user32.spec]
+	Specs for implemented functions added
+	Some thunks to functions which are same as win16 equivalents.
+
+	* [loader/task.c]
+	GetAppCompatFlags() added.
+
+	* [misc/registry.c]
+	One missing else added, small hack to RegQueryValue16().
+
+	* [win32/file.c]
+	GetFileAttributesA() fixed (was using DOS path as UNIX path).
+
+Tue Jun 18 21:00:00 1996  Alex Korobka <alex@phm30.pharm.sunysb.edu>
+
+	* [loader/ne_resource.c]
+	Fixed FreeResource() return value.
+
+	* [objects/text.c]
+	Fixed a bug in ExtTextOut() that was causing overlapped characters
+	in WinWord.
+
+	* [windows/winpos.c]
+	SWP_FRAMECHANGED for top-level windows now invalidates client
+	area as clock.exe wants.
+
+Tue Jun 18 11:30:22 1996  Albrecht Kleine  <kleine@ak.sax.de>
+
+	* [controls/listbox.c]
+	Mini bugfix: 'revival' of missing scrollbar in listboxes.
+
+Mon Jun 17 20:27:41 1996  Robert Pouliot <krynos@clic.net>
+
+	* [resources/sysres_Fr.rc] [resources/TODO]
+	Made changes for Choose_Font dialog.
+
+----------------------------------------------------------------------
 Sun Jun 16 16:51:31 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>
 
 	* [memory/heap.c]
diff --git a/controls/listbox.c b/controls/listbox.c
index da7d1f0..b6f1f79 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -174,11 +174,9 @@
 
 void ListBoxUpdateWindow(HWND hwnd, LPHEADLIST lphl, BOOL repaint)
 {
-  WND *wndPtr = WIN_FindWndPtr(hwnd);
-
-  if (wndPtr->dwStyle & WS_VSCROLL)
+  if (lphl->dwStyle & WS_VSCROLL)
     SetScrollRange(hwnd, SB_VERT, 0, ListMaxFirstVisible(lphl), TRUE);
-  if ((wndPtr->dwStyle & WS_HSCROLL) && (lphl->ItemsPerColumn != 0))
+  if ((lphl->dwStyle & WS_HSCROLL) && (lphl->ItemsPerColumn != 0))
     SetScrollRange(hwnd, SB_HORZ, 1, lphl->ItemsVisible /
 		   lphl->ItemsPerColumn + 1, TRUE);
 
diff --git a/files/drive.c b/files/drive.c
index 8813696..f886bda 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -24,6 +24,7 @@
 #endif
 
 #include "windows.h"
+#include "winbase.h"
 #include "dos_fs.h"
 #include "drive.h"
 #include "file.h"
@@ -31,6 +32,7 @@
 #include "options.h"
 #include "task.h"
 #include "xmalloc.h"
+#include "string32.h"
 #include "stddebug.h"
 #include "debug.h"
 
@@ -428,7 +430,7 @@
 /***********************************************************************
  *           DRIVE_GetFreeSpace
  */
-int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available )
+static int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available )
 {
     struct statfs info;
 
@@ -460,6 +462,69 @@
 
 
 /***********************************************************************
+ *           GetDiskFreeSpace16   (KERNEL.422)
+ */
+BOOL16 GetDiskFreeSpace16( LPCSTR root, LPDWORD cluster_sectors,
+                           LPDWORD sector_bytes, LPDWORD free_clusters,
+                           LPDWORD total_clusters )
+{
+    return GetDiskFreeSpace32A( root, cluster_sectors, sector_bytes,
+                                free_clusters, total_clusters );
+}
+
+
+/***********************************************************************
+ *           GetDiskFreeSpaceA   (KERNEL32.206)
+ */
+BOOL32 GetDiskFreeSpace32A( LPCSTR root, LPDWORD cluster_sectors,
+                            LPDWORD sector_bytes, LPDWORD free_clusters,
+                            LPDWORD total_clusters )
+{
+    int	drive;
+    DWORD size,available;
+
+    if (!root) drive = DRIVE_GetCurrentDrive();
+    else
+    {
+        if ((root[1] != ':') || (root[2] != '\\'))
+        {
+            fprintf( stderr, "GetDiskFreeSpaceA: invalid root '%s'\n", root );
+            return FALSE;
+        }
+        drive = toupper(root[0]) - 'A';
+    }
+    if (!DRIVE_GetFreeSpace(drive, &size, &available)) return FALSE;
+
+    *sector_bytes    = 512;
+    size            /= 512;
+    available       /= 512;
+    *cluster_sectors = 1;
+    while (*cluster_sectors * 65530 < size) *cluster_sectors *= 2;
+    *free_clusters   = available/ *cluster_sectors;
+    *total_clusters  = size/ *cluster_sectors;
+    return TRUE;
+}
+
+
+/***********************************************************************
+ *           GetDiskFreeSpaceW   (KERNEL32.207)
+ */
+BOOL32 GetDiskFreeSpace32W( LPCWSTR root, LPDWORD cluster_sectors,
+                            LPDWORD sector_bytes, LPDWORD free_clusters,
+                            LPDWORD total_clusters )
+{
+    LPSTR xroot;
+    BOOL ret;
+
+    xroot = STRING32_DupUniToAnsi(root);
+    ret = GetDiskFreeSpace32A( xroot,cluster_sectors, sector_bytes,
+                               free_clusters, total_clusters );
+    free( xroot );
+    return ret;
+}
+
+
+/***********************************************************************
  *           GetDriveType   (KERNEL.136)
  */
 WORD GetDriveType( INT drive )
@@ -501,7 +566,7 @@
 
 
 /***********************************************************************
- *           GetCurrentDirectory   (KERNEL.411)
+ *           GetCurrentDirectory   (KERNEL.411) (KERNEL32.196)
  */
 UINT32 GetCurrentDirectory( UINT32 buflen, LPSTR buf )
 {
@@ -589,3 +654,63 @@
         if (DRIVE_IsValid(drive)) ret |= (1 << drive);
     return ret;
 }
+
+
+/***********************************************************************
+ *           GetVolumeInformation32A   (KERNEL32.309)
+ */
+BOOL32 GetVolumeInformation32A( LPCSTR root, LPSTR label, DWORD label_len,
+                                DWORD *serial, DWORD *filename_len,
+                                DWORD *flags, LPSTR fsname, DWORD fsname_len )
+{
+    int drive;
+
+    /* FIXME, SetLastErrors missing */
+
+    if (!root) drive = DRIVE_GetCurrentDrive();
+    else
+    {
+        if ((root[1] != ':') || (root[2] != '\\'))
+        {
+            fprintf( stderr, "GetVolumeInformation: invalid root '%s'\n",root);
+            return FALSE;
+        }
+        drive = toupper(root[0]) - 'A';
+    }
+    if (!DRIVE_IsValid( drive )) return FALSE;
+    if (label) lstrcpyn32A( label, DOSDrives[drive].label, label_len );
+    if (serial) *serial = DOSDrives[drive].serial;
+
+    /* Set the filesystem information */
+    /* Note: we only emulate a FAT fs at the present */
+
+    if (filename_len) *filename_len = 12;
+    if (flags) *flags = 0;
+    if (fsname) lstrcpyn32A( fsname, "FAT", fsname_len );
+    return TRUE;
+}
+
+
+/***********************************************************************
+ *           GetVolumeInformation32W   (KERNEL32.310)
+ */
+BOOL32 GetVolumeInformation32W( LPCWSTR root, LPWSTR label, DWORD label_len,
+                                DWORD *serial, DWORD *filename_len,
+                                DWORD *flags, LPWSTR fsname, DWORD fsname_len)
+{
+    LPSTR xroot    = STRING32_DupUniToAnsi(root);
+    LPSTR xvolname = (char*)xmalloc( label_len );
+    LPSTR xfsname  = (char*)xmalloc( fsname_len );
+    BOOL32 ret = GetVolumeInformation32A( xroot, xvolname, label_len, serial,
+                                          filename_len, flags, xfsname,
+                                          fsname_len );
+    if (ret)
+    {
+        STRING32_AnsiToUni( label, xvolname );
+        STRING32_AnsiToUni( fsname, xfsname );
+    }
+    free(xroot);
+    free(xvolname);
+    free(xfsname);
+    return ret;
+}
diff --git a/files/file.c b/files/file.c
index 9662636..390b6de 100644
--- a/files/file.c
+++ b/files/file.c
@@ -26,6 +26,7 @@
 #include "options.h"
 #include "ldt.h"
 #include "task.h"
+#include "string32.h"
 #include "stddebug.h"
 #include "debug.h"
 #include "xmalloc.h"
@@ -484,45 +485,6 @@
 
 
 /***********************************************************************
- *           FILE_Sync
- */
-int FILE_Sync( HFILE hFile )
-{
-    DOS_FILE *file;
-
-    if (!(file = FILE_GetFile( hFile ))) return 0;
-    if (fsync( file->unix_handle ) != -1) return 1;
-    FILE_SetDosError();
-    return 0;
-}
-
-
-/***********************************************************************
- *           FILE_MakeDir
- */
-int FILE_MakeDir( LPCSTR path )
-{
-    const char *unixName;
-
-    dprintf_file(stddeb, "FILE_MakeDir: '%s'\n", path );
-
-    if ((unixName = DOSFS_IsDevice( path )) != NULL)
-    {
-        dprintf_file(stddeb, "FILE_MakeDir: device '%s'!\n", unixName);
-        DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
-        return 0;
-    }
-    if (!(unixName = DOSFS_GetUnixFileName( path, FALSE ))) return 0;
-    if ((mkdir( unixName, 0777 ) == -1) && (errno != EEXIST))
-    {
-        FILE_SetDosError();
-        return 0;
-    }
-    return 1;
-}
-
-
-/***********************************************************************
  *           FILE_RemoveDir
  */
 int FILE_RemoveDir( LPCSTR path )
@@ -1100,3 +1062,64 @@
     }
     return pdb->nbFiles;
 }
+
+
+/***********************************************************************
+ *           FlushFileBuffers   (KERNEL32.133)
+ */
+BOOL32 FlushFileBuffers( HFILE hFile )
+{
+    DOS_FILE *file;
+
+    dprintf_file( stddeb, "FlushFileBuffers(%d)\n", hFile );
+    if (!(file = FILE_GetFile( hFile ))) return FALSE;
+    if (fsync( file->unix_handle ) != -1) return TRUE;
+    FILE_SetDosError();
+    return FALSE;
+}
+
+
+/***********************************************************************
+ *           CreateDirectory16   (KERNEL.144)
+ */
+BOOL16 CreateDirectory16( LPCSTR path, LPVOID dummy )
+{
+    dprintf_file( stddeb,"CreateDirectory16(%s,%p)\n", path, dummy );
+    return (BOOL16)CreateDirectory32A( path, NULL );
+}
+
+
+/***********************************************************************
+ *           CreateDirectory32A   (KERNEL32.39)
+ */
+BOOL32 CreateDirectory32A( LPCSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
+{
+    const char *unixName;
+
+    dprintf_file( stddeb, "CreateDirectory32A(%s,%p)\n", path, lpsecattribs );
+    if ((unixName = DOSFS_IsDevice( path )) != NULL)
+    {
+        dprintf_file(stddeb, "CreateDirectory: device '%s'!\n", unixName);
+        DOS_ERROR( ER_AccessDenied, EC_AccessDenied, SA_Abort, EL_Disk );
+        return FALSE;
+    }
+    if (!(unixName = DOSFS_GetUnixFileName( path, FALSE ))) return 0;
+    if ((mkdir( unixName, 0777 ) == -1) && (errno != EEXIST))
+    {
+        FILE_SetDosError();
+        return FALSE;
+    }
+    return TRUE;
+}
+
+
+/***********************************************************************
+ *           CreateDirectory32W   (KERNEL32.42)
+ */
+BOOL32 CreateDirectory32W( LPCWSTR path, LPSECURITY_ATTRIBUTES lpsecattribs )
+{
+    LPSTR xpath = STRING32_DupUniToAnsi(path);
+    BOOL32 ret = CreateDirectory32A(xpath,lpsecattribs);
+    free(xpath);
+    return ret;
+}
diff --git a/if1632/kernel.spec b/if1632/kernel.spec
index 00fbace..9ff222e 100644
--- a/if1632/kernel.spec
+++ b/if1632/kernel.spec
@@ -142,7 +142,7 @@
 141 stub InitTask1
 142 stub GetProfileSectionNames
 143 stub GetPrivateProfileSectionNames
-144 stub CreateDirectory
+144 pascal16 CreateDirectory(ptr ptr) CreateDirectory16
 145 stub RemoveDirectory
 146 stub DeleteFile
 147 stub SetLastError
@@ -261,7 +261,7 @@
 #351 BUNNY_351
 352 pascal   lstrcatn(segptr segptr word) lstrcatn16
 353 pascal   lstrcpyn(segptr segptr word) lstrcpyn16
-354 stub GetAppCompatFlags
+354 pascal   GetAppCompatFlags(word) GetAppCompatFlags
 355 pascal16 GetWinDebugInfo(ptr word) GetWinDebugInfo
 356 pascal16 SetWinDebugInfo(ptr) SetWinDebugInfo
 360 stub OpenFileEx
@@ -281,7 +281,7 @@
 419 stub GetProfileSection
 420 stub GetFileAttributes
 421 stub SetFileAttributes
-422 stub GetDiskFreeSpace
+422 pascal16 GetDiskFreeSpace(ptr ptr ptr ptr ptr) GetDiskFreeSpace16 
 432 stub FileTimeToLocalFileTime
 450 pascal16 KERNEL_450() stub_KERNEL_450
 491 stub RegisterServiceProcess
diff --git a/if1632/kernel32.spec b/if1632/kernel32.spec
index 50982f9..5a3b4b2 100644
--- a/if1632/kernel32.spec
+++ b/if1632/kernel32.spec
@@ -41,10 +41,10 @@
 0036 stub CopyFileA
 0037 stub CopyFileW
 0038 stub CreateConsoleScreenBuffer
-0039 stub CreateDirectoryA
+0039 stdcall CreateDirectoryA(ptr ptr) CreateDirectory32A
 0040 stub CreateDirectoryExA
 0041 stub CreateDirectoryExW
-0042 stub CreateDirectoryW
+0042 stdcall CreateDirectoryW(ptr ptr) CreateDirectory32W
 0043 	stdcall CreateEventA(ptr long long ptr) CreateEventA
 0044 stub CreateEventW
 0045   stdcall CreateFileA(ptr long long ptr long long long) CreateFileA
@@ -130,12 +130,12 @@
 0125 stub FindNextChangeNotification
 0126 stub FindNextFileA
 0127 stub FindNextFileW
-0128 stdcall FindResourceA(long ptr ptr) FindResource32
+0128 stdcall FindResourceA(long ptr ptr) FindResource32A
 0129 stub FindResourceExA
 0130 stub FindResourceExW
-0131 stub FindResourceW
+0131 stdcall FindResourceW(long ptr ptr) FindResource32W
 0132 stub FlushConsoleInputBuffer
-0133 stub FlushFileBuffers
+0133 stdcall FlushFileBuffers(long) FlushFileBuffers
 0134 stub FlushInstructionCache
 0135 stub FlushViewOfFile
 0136 stub FoldStringA
@@ -198,7 +198,7 @@
 0193 stub GetCurrencyFormatA
 0194 stub GetCurrencyFormatW
 0195 stub GetCurrentConsoleFont
-0196 stub GetCurrentDirectoryA
+0196 	stdcall GetCurrentDirectoryA(ptr ptr) GetCurrentDirectory
 0197 stub GetCurrentDirectoryW
 0198 	stdcall GetCurrentProcess() GetCurrentProcess
 0199 stdcall GetCurrentProcessId() GetCurrentThreadId
@@ -208,8 +208,8 @@
 0203 stub GetDateFormatW
 0204 stub GetDefaultCommConfigA
 0205 stub GetDefaultCommConfigW
-0206 stub GetDiskFreeSpaceA
-0207 stub GetDiskFreeSpaceW
+0206 	stdcall GetDiskFreeSpaceA(ptr ptr ptr ptr ptr) GetDiskFreeSpace32A
+0207 	stdcall GetDiskFreeSpaceW(ptr ptr ptr ptr ptr) GetDiskFreeSpace32W
 0208 stdcall GetDriveTypeA(ptr) GetDriveType32A
 0209 stub GetDriveTypeW
 0210	stdcall GetEnvironmentStrings()	GetEnvironmentStrings
@@ -311,8 +311,8 @@
 0306 stdcall GetVersion() GetVersion32
 0307 stdcall GetVersionExA(ptr) GetVersionEx32A
 0308 stdcall GetVersionExW(ptr) GetVersionEx32W
-0309 stub GetVolumeInformationA
-0310 stub GetVolumeInformationW
+0309 stdcall GetVolumeInformationA(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32A
+0310 stdcall GetVolumeInformationW(ptr ptr long ptr ptr ptr ptr long) GetVolumeInformation32W
 0311 stdcall GetWindowsDirectoryA(ptr long) GetWindowsDirectory
 0312 stub GetWindowsDirectoryW
 0313 stdcall GlobalAddAtomA(ptr) GlobalAddAtom32A
@@ -386,7 +386,7 @@
 0381 stdcall LocalUnlock(long) LocalUnlock32
 0382 stub LockFile
 0383 stub LockFileEx
-0384 stub LockResource
+0384 stdcall LockResource(long) LockResource32
 0385 stub MapViewOfFile
 0386 	stdcall MapViewOfFileEx(long long long long long long) MapViewOfFileEx
 0387 stub MoveFileA
@@ -481,7 +481,7 @@
 0476 stub SetConsoleTitleA
 0477 stub SetConsoleTitleW
 0478 stub SetConsoleWindowInfo
-0479 stub SetCurrentDirectoryA
+0479 stdcall SetCurrentDirectoryA(ptr) SetCurrentDirectory
 0480 stub SetCurrentDirectoryW
 0481 stub SetDefaultCommConfigA
 0482 stub SetDefaultCommConfigW
@@ -524,7 +524,7 @@
 0519 stub SetVolumeLabelW
 0520 stub SetupComm
 0521 stub ShowConsoleCursor
-0522 stub SizeofResource
+0522 stdcall SizeofResource(long long) SizeofResource
 0523 	stdcall Sleep(long) Sleep
 0524 stub SleepEx
 0525 stub SuspendThread
@@ -633,7 +633,7 @@
 0627 stub HeapUsage
 0628 stub IsDebuggerPresent
 0629 stub PostQueuedCompletionStatus
-0630    stdcall SetSystemPowerState(byte byte) SetSystemPowerState
+0630    stdcall SetSystemPowerState(long long) SetSystemPowerState
 0631 stub WritePrivateProfileStructA
 0632 stub WritePrivateProfileStructW
 0633 stub MakeCriticalSectionGlobal
diff --git a/if1632/lz32.spec b/if1632/lz32.spec
index 6b4b0d4..2caac4e 100644
--- a/if1632/lz32.spec
+++ b/if1632/lz32.spec
@@ -1,15 +1,15 @@
 name	lz32
 type	win32
 
-0 stdcall LZCopy(word word) LZCopy
-1 stdcall LZOpenFileA(ptr ptr word) LZOpenFile32A
-2 stdcall LZInit(word) LZInit
-3 stdcall LZSeek(word long word) LZSeek
-4 stdcall LZRead(word ptr long) LZRead32
-5 stdcall LZClose(word) LZClose
+0 stdcall LZCopy(long long) LZCopy
+1 stdcall LZOpenFileA(ptr ptr long) LZOpenFile32A
+2 stdcall LZInit(long) LZInit
+3 stdcall LZSeek(long long long) LZSeek
+4 stdcall LZRead(long ptr long) LZRead32
+5 stdcall LZClose(long) LZClose
 6 stdcall LZStart() LZStart
-7 stdcall CopyLZFile(word word) CopyLZFile
+7 stdcall CopyLZFile(long long) CopyLZFile
 8 stdcall LZDone() LZDone
 9 stdcall GetExpandedNameA(ptr ptr) GetExpandedName32A
-10 stdcall LZOpenFileW(ptr ptr word) LZOpenFile32W
+10 stdcall LZOpenFileW(ptr ptr long) LZOpenFile32W
 11 stdcall GetExpandedNameW(ptr ptr) GetExpandedName32W
diff --git a/if1632/shell32.spec b/if1632/shell32.spec
index 8abcf95..1f836b7 100644
--- a/if1632/shell32.spec
+++ b/if1632/shell32.spec
@@ -84,9 +84,9 @@
 0079 stub SheSetCurDrive
 0080 stub SheShortenPathA
 0081 stub SheShortenPathW
-0082 stdcall ShellAboutA(word ptr ptr word) ShellAbout
+0082 stdcall ShellAboutA(long ptr ptr long) ShellAbout
 0083 stub ShellAboutW
-0084 stdcall ShellExecuteA(word ptr ptr ptr ptr s_word) ShellExecute
+0084 stdcall ShellExecuteA(long ptr ptr ptr ptr long) ShellExecute
 0085 stub ShellExecuteEx
 0086 stub ShellExecuteExA
 0087 stub ShellExecuteExW
diff --git a/if1632/user32.spec b/if1632/user32.spec
index 6681bff..3580e6e 100644
--- a/if1632/user32.spec
+++ b/if1632/user32.spec
@@ -138,7 +138,7 @@
 0131 stub DestroyCursor
 0132 stub DestroyIcon
 0133 stub DestroyMenu
-0134 stub DestroyWindow
+0134 stdcall DestroyWindow(long) DestroyWindow
 0135 stdcall DialogBoxIndirectParamA(long ptr long ptr long) DialogBoxIndirectParam32A
 0136 stub DialogBoxIndirectParamAorW
 0137 stdcall DialogBoxIndirectParamW(long ptr long ptr long) DialogBoxIndirectParam32W
@@ -209,7 +209,7 @@
 0202 stdcall FrameRect(long ptr long) FrameRect32
 0203 stub FreeDDElParam
 0204 stdcall GetActiveWindow() GetActiveWindow
-0205 stub GetAppCompatFlags
+0205 stdcall GetAppCompatFlags(long) GetAppCompatFlags
 0206 stub GetAsyncKeyState
 0207 stub GetCapture
 0208 stub GetCaretBlinkTime
@@ -523,7 +523,7 @@
 0516 stdcall SetWindowLongA(long long long) SetWindowLong32A
 0517 stdcall SetWindowLongW(long long long) SetWindowLong32W
 0518 stdcall SetWindowPlacement(long ptr) SetWindowPlacement32
-0519 stub SetWindowPos
+0519 stdcall SetWindowPos(long long long long long long long) SetWindowPos
 0520 stub SetWindowStationUser
 0521 stdcall SetWindowTextA(long ptr) SetWindowText32A
 0522 stdcall SetWindowTextW(long ptr) SetWindowText32W
diff --git a/if1632/version.spec b/if1632/version.spec
index 3d8ec38..bd3dc79 100644
--- a/if1632/version.spec
+++ b/if1632/version.spec
@@ -6,12 +6,12 @@
 2 stdcall GetFileVersionInfoSizeW(ptr ptr) GetFileVersionInfoSize32W
 3 stdcall GetFileVersionInfoW(ptr long long ptr) GetFileVersionInfo32W
 #4 stub VerFThk_ThunkData32
-5 stdcall VerFindFileA(word ptr ptr ptr ptr ptr ptr ptr) VerFindFile32A
-6 stdcall VerFindFileW(word ptr ptr ptr ptr ptr ptr ptr) VerFindFile32W
-7 stdcall VerInstallFileA(word ptr ptr ptr ptr ptr ptr ptr) VerInstallFile32A
-8 stdcall VerInstallFileW(word ptr ptr ptr ptr ptr ptr ptr) VerInstallFile32W
-9 stdcall VerLanguageNameA(word ptr word) VerLanguageName32A
-10 stdcall VerLanguageNameW(word ptr word) VerLanguageName32W
-11 stdcall VerQueryValueA(segptr ptr ptr ptr) VerQueryValue32A
-12 stdcall VerQueryValueW(segptr ptr ptr ptr) VerQueryValue32W
+5 stdcall VerFindFileA(long ptr ptr ptr ptr ptr ptr ptr) VerFindFile32A
+6 stdcall VerFindFileW(long ptr ptr ptr ptr ptr ptr ptr) VerFindFile32W
+7 stdcall VerInstallFileA(long ptr ptr ptr ptr ptr ptr ptr) VerInstallFile32A
+8 stdcall VerInstallFileW(long ptr ptr ptr ptr ptr ptr ptr) VerInstallFile32W
+9 stdcall VerLanguageNameA(long ptr long) VerLanguageName32A
+10 stdcall VerLanguageNameW(long ptr long) VerLanguageName32W
+11 stdcall VerQueryValueA(ptr ptr ptr ptr) VerQueryValue32A
+12 stdcall VerQueryValueW(ptr ptr ptr ptr) VerQueryValue32W
 #13 stub VerThkSL_ThunkData32
diff --git a/include/drive.h b/include/drive.h
index b386b85..0f3e836 100644
--- a/include/drive.h
+++ b/include/drive.h
@@ -35,6 +35,5 @@
 extern int DRIVE_Chdir( int drive, const char *path );
 extern int DRIVE_Disable( int drive  );
 extern int DRIVE_Enable( int drive  );
-extern int DRIVE_GetFreeSpace( int drive, DWORD *size, DWORD *available );
 
 #endif  /* __WINE_DRIVE_H */
diff --git a/include/file.h b/include/file.h
index 8b9de03..82f7b80 100644
--- a/include/file.h
+++ b/include/file.h
@@ -18,9 +18,7 @@
 extern int FILE_SetDateTime( HFILE hFile, WORD date, WORD time );
 extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
                        WORD *pdate, WORD *ptime );
-extern int FILE_Sync( HFILE hFile );
 extern int FILE_Unlink( LPCSTR path );
-extern int FILE_MakeDir( LPCSTR path );
 extern int FILE_RemoveDir( LPCSTR path );
 extern HFILE FILE_Dup( HFILE hFile );
 extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 );
diff --git a/include/resource32.h b/include/resource32.h
index c47d50e..81d97d6 100644
--- a/include/resource32.h
+++ b/include/resource32.h
@@ -10,7 +10,8 @@
 
 #include <stddef.h>
 
-HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type );
+HANDLE32 FindResource32A( HINSTANCE hModule, LPCSTR name, LPCSTR type );
+HANDLE32 FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type );
 HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc );
 LPVOID LockResource32( HANDLE32 handle );
 BOOL FreeResource32( HANDLE32 handle );
diff --git a/include/winbase.h b/include/winbase.h
index 6775098..1a5317d 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -39,6 +39,15 @@
 #define MEM_MAPPED              0x00040000
 #define MEM_TOP_DOWN            0x00100000
 
+#define FILE_CASE_SENSITIVE_SEARCH      0x00000001
+#define FILE_CASE_PRESERVED_NAMES       0x00000002
+#define FILE_UNICODE_ON_DISK            0x00000004
+#define FILE_PERSISTENT_ACLS            0x00000008
+
+#define FS_CASE_SENSITIVE               FILE_CASE_SENSITIVE_SEARCH
+#define FS_CASE_IS_PRESERVED            FILE_CASE_PRESERVED_NAMES
+#define FS_UNICODE_STORED_ON_DISK       FILE_UNICODE_ON_DISK
+
 struct _EXCEPTION_POINTERS;
 
 typedef LONG (TOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *);
diff --git a/include/windows.h b/include/windows.h
index d60ce19..41d242b 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -3161,6 +3161,7 @@
 
 /* Declarations for functions that exist only in Win32 */
 
+BOOL32     FlushFileBuffers(HFILE);
 DWORD      GetLogicalDrives(void);
 
 /* Declarations for functions that are the same in Win16 and Win32 */
@@ -3170,6 +3171,7 @@
 HBITMAP16  CreateDiscardableBitmap(HDC32,INT32,INT32);
 BOOL16     EndDialog(HWND32,INT32);
 INT16      ExcludeUpdateRgn(HDC32,HWND32);
+DWORD      GetAppCompatFlags(HTASK32);
 LONG       GetBitmapBits(HBITMAP32,LONG,LPVOID);
 WORD       GetClassWord(HWND32,INT32);
 INT16      GetUpdateRgn(HWND32,HRGN32,BOOL32);
@@ -3239,6 +3241,10 @@
 HWND32     CreateDialogParam32A(HINSTANCE32,LPCSTR,HWND32,DLGPROC32,LPARAM);
 HWND32     CreateDialogParam32W(HINSTANCE32,LPCWSTR,HWND32,DLGPROC32,LPARAM);
 #define    CreateDialogParam WINELIB_NAME_AW(CreateDialogParam)
+BOOL16     CreateDirectory16(LPCSTR,LPVOID);
+BOOL32     CreateDirectory32A(LPCSTR,LPSECURITY_ATTRIBUTES);
+BOOL32     CreateDirectory32W(LPCWSTR,LPSECURITY_ATTRIBUTES);
+#define    CreateDirectory WINELIB_NAME_AW(CreateDirectory)
 HRGN16     CreateEllipticRgnIndirect16(const RECT16 *);
 HRGN32     CreateEllipticRgnIndirect32(const RECT32 *);
 #define    CreateEllipticRgnIndirect WINELIB_NAME(CreateEllipticRgnIndirect)
@@ -3379,6 +3385,10 @@
 void       GetCursorPos16(LPPOINT16);
 void       GetCursorPos32(LPPOINT32);
 #define    GetCursorPos WINELIB_NAME(GetCursorPos)
+BOOL16     GetDiskFreeSpace16(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
+BOOL32     GetDiskFreeSpace32A(LPCSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
+BOOL32     GetDiskFreeSpace32W(LPCWSTR,LPDWORD,LPDWORD,LPDWORD,LPDWORD);
+#define    GetDiskFreeSpace WINELIB_NAME_AW(GetDiskFreeSpace)
 INT16      GetDlgItemText16(HWND16,INT16,SEGPTR,UINT16);
 INT32      GetDlgItemText32A(HWND32,INT32,LPSTR,UINT32);
 INT32      GetDlgItemText32W(HWND32,INT32,LPWSTR,UINT32);
@@ -3388,7 +3398,7 @@
 #define    GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos)
 UINT32     GetLogicalDriveStrings32A(UINT32,LPSTR);
 UINT32     GetLogicalDriveStrings32W(UINT32,LPWSTR);
-#define    GetLogicalDriveStrings WINELIB_NAME(GetLogicalDriveStrings)
+#define    GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings)
 INT16      GetObject16(HANDLE16,INT16,LPVOID);
 INT32      GetObject32A(HANDLE32,INT32,LPVOID);
 INT32      GetObject32W(HANDLE32,INT32,LPVOID);
@@ -3409,6 +3419,9 @@
 BOOL16     GetViewportOrgEx16(HDC16,LPPOINT16);
 BOOL32     GetViewportOrgEx32(HDC32,LPPOINT32);
 #define    GetViewportOrgEx WINELIB_NAME(GetViewportOrgEx)
+BOOL32     GetVolumeInformation32A(LPCSTR,LPSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPSTR,DWORD);
+BOOL32     GetVolumeInformation32W(LPCWSTR,LPWSTR,DWORD,LPDWORD,LPDWORD,LPDWORD,LPWSTR,DWORD);
+#define    GetVolumeInformation WINELIB_NAME_AW(GetVolumeInformation)
 BOOL16     GetWindowExtEx16(HDC16,LPPOINT16);
 BOOL32     GetWindowExtEx32(HDC32,LPPOINT32);
 #define    GetWindowExtEx WINELIB_NAME(GetWindowExtEx)
diff --git a/loader/ne_resource.c b/loader/ne_resource.c
index fc3081b..289e346 100644
--- a/loader/ne_resource.c
+++ b/loader/ne_resource.c
@@ -325,7 +325,7 @@
     WORD count;
 
     NE_MODULE *pModule = MODULE_GetPtr( hModule );
-    if (!pModule || !pModule->res_table) return FALSE;
+    if (!pModule || !pModule->res_table) return handle;
     pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
     while (pTypeInfo->type_id)
     {
@@ -340,13 +340,13 @@
                     GlobalFree16( pNameInfo->handle );
                     pNameInfo->handle = 0;
                 }
-                return TRUE;
+                return 0;
             }
             pNameInfo++;
         }
         pTypeInfo = (NE_TYPEINFO *)pNameInfo;
     }
     fprintf( stderr, "FreeResource: %04x %04x not found!\n", hModule, handle );
-    return FALSE;
+    return handle;
 }
 #endif /* WINELIB */
diff --git a/loader/task.c b/loader/task.c
index b422d76..48bf3ee 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -1270,3 +1270,17 @@
     lpte->hNext = hTask;
     return TaskNext( lpte );
 }
+
+
+/***********************************************************************
+ *           GetAppCompatFlags   (KERNEL.354) (USER32.205)
+ */
+DWORD GetAppCompatFlags( HTASK32 hTask )
+{
+    TDB *pTask;
+
+    if (!hTask) hTask = GetCurrentTask();
+    if (!(pTask=(TDB *)GlobalLock16( (HTASK16)hTask ))) return 0;
+    if (GlobalSize16(hTask) < sizeof(TDB)) return 0;
+    return pTask->compat_flags;
+}
diff --git a/misc/registry.c b/misc/registry.c
index 11fcf67..de792a1 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -435,7 +435,7 @@
 			strcpy(buf,"yes");
 		RegCloseKey(hkey);
 	}
-	if (strcasecmp(buf,"yes"))
+	if (lstrcmpi32A(buf,"yes"))
 		all=1;
 	pwd=getpwuid(getuid());
 	if (pwd!=NULL && pwd->pw_dir!=NULL) {
@@ -1695,8 +1695,9 @@
 	LPKEYSTRUCT	lpkey;
 	int		i;
 
-	dprintf_reg(stddeb,"RegQueryValueEx32W(%x,%s,%p,%p,%p,%p)\n",
-		hkey,W2C(lpszValueName,0),lpdwReserved,lpdwType,lpbData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValueEx32W(%x,%s,%p,%p,%p,%ld)\n",
+		hkey,W2C(lpszValueName,0),lpdwReserved,lpdwType,lpbData,
+		lpcbData?*lpcbData:0
 	);
 
 	lpkey	= lookup_hkey(hkey);
@@ -1749,8 +1750,9 @@
 	HKEY	xhkey;
 	DWORD	ret,lpdwType;
 
-	dprintf_reg(stddeb,"RegQueryValue32W(%x,%s,%p,%p)\n->",
-		hkey,W2C(lpszSubKey,0),lpszData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValue32W(%x,%s,%p,%ld)\n->",
+		hkey,W2C(lpszSubKey,0),lpszData,
+		lpcbData?*lpcbData:0
 	);
 
 	/* only open subkey, if we really do descend */
@@ -1789,8 +1791,9 @@
 	DWORD	ret,myxlen;
 	DWORD	*mylen;
 
-	dprintf_reg(stddeb,"RegQueryValueEx32A(%x,%s,%p,%p,%p,%p)\n->",
-		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValueEx32A(%x,%s,%p,%p,%p,%ld)\n->",
+		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
+		lpcbData?*lpcbData:0
 	);
 	if (lpbData) {
 		/* double buffer */
@@ -1802,7 +1805,7 @@
 		if (lpcbData) {
 			myxlen	= *lpcbData*2;
 			mylen	= &myxlen;
-		}
+		} else
 			mylen	= NULL;
 	}
 	if (lpszValueName)
@@ -1855,8 +1858,9 @@
 	LPBYTE	lpbData,
 	LPDWORD	lpcbData
 ) {
-	dprintf_reg(stddeb,"RegQueryValueEx16(%x,%s,%p,%p,%p,%p)\n",
-		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValueEx16(%x,%s,%p,%p,%p,%ld)\n",
+		hkey,lpszValueName,lpdwReserved,lpdwType,lpbData,
+		lpcbData?*lpcbData:0
 	);
 	return RegQueryValueEx32A(
 		hkey,
@@ -1878,8 +1882,9 @@
 	HKEY	xhkey;
 	DWORD	ret,lpdwType;
 
-	dprintf_reg(stddeb,"RegQueryValue32A(%x,%s,%p,%p)\n",
-		hkey,lpszSubKey,lpszData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValue32A(%x,%s,%p,%ld)\n",
+		hkey,lpszSubKey,lpszData,
+		lpcbData?*lpcbData:0
 	);
 
 	/* only open subkey, if we really do descend */
@@ -1911,9 +1916,15 @@
 	LPSTR	lpszData,
 	LPDWORD	lpcbData
 ) {
-	dprintf_reg(stddeb,"RegQueryValue16(%x,%s,%p,%p)\n",
-		hkey,lpszSubKey,lpszData,lpcbData
+	dprintf_reg(stddeb,"RegQueryValue16(%x,%s,%p,%ld)\n",
+		hkey,lpszSubKey,lpszData,lpcbData?*lpcbData:0
 	);
+	/* HACK: the 16bit RegQueryValue doesn't handle selectorblocks
+	 *       anyway, so we just mask out the high 16 bit.
+	 *       (this (not so much incidently;) hopefully fixes Aldus FH4)
+	 */
+	if (lpcbData)
+		*lpcbData &= 0xFFFF;
 	return RegQueryValue32A(hkey,lpszSubKey,lpszData,lpcbData);
 }
 
diff --git a/miscemu/int21.c b/miscemu/int21.c
index b698d2c..030881b 100644
--- a/miscemu/int21.c
+++ b/miscemu/int21.c
@@ -136,18 +136,16 @@
 
 static int INT21_GetFreeDiskSpace(struct sigcontext_struct *context)
 {
-    DWORD size, available;
-    int drive = DOS_GET_DRIVE( DL_reg(context) );
+    DWORD cluster_sectors, sector_bytes, free_clusters, total_clusters;
+    char root[] = "A:\\";
 
-    if (!DRIVE_GetFreeSpace(drive, &size, &available)) return 0;
-
-    CX_reg(context) = 512;  /* bytes per sector */
-    size /= 512;
-    available /= 512;
-    AX_reg(context) = 1;  /* sectors per cluster */
-    while (AX_reg(context) * 65530 < size) AX_reg(context) *= 2;
-    BX_reg(context) = available / AX_reg(context);  /* free clusters */
-    DX_reg(context) = size / AX_reg(context);  /* total clusters */
+    *root += DOS_GET_DRIVE( DL_reg(context) );
+    if (!GetDiskFreeSpace32A( root, &cluster_sectors, &sector_bytes,
+                              &free_clusters, &total_clusters )) return 0;
+    AX_reg(context) = cluster_sectors;
+    BX_reg(context) = free_clusters;
+    CX_reg(context) = sector_bytes;
+    DX_reg(context) = total_clusters;
     return 1;
 }
 
@@ -1129,8 +1127,8 @@
         break;
 
     case 0x39: /* "MKDIR" - CREATE SUBDIRECTORY */
-        if (!FILE_MakeDir( PTR_SEG_OFF_TO_LIN( DS_reg(&context),
-                                               DX_reg(&context) )))
+        if (!CreateDirectory32A( PTR_SEG_OFF_TO_LIN( DS_reg(&context),
+                                                     DX_reg(&context) ), NULL))
         {
             AX_reg(&context) = DOS_ExtendedError;
             SET_CFLAG(&context);
@@ -1550,7 +1548,7 @@
 
     case 0x68: /* "FFLUSH" - COMMIT FILE */
     case 0x6a: /* COMMIT FILE */
-        if (!FILE_Sync( BX_reg(&context) ))
+        if (!FlushFileBuffers( BX_reg(&context) ))
         {
             AX_reg(&context) = DOS_ExtendedError;
             SET_CFLAG(&context);
diff --git a/objects/font.c b/objects/font.c
index 5cde975..a259011 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -112,7 +112,7 @@
   int i;
 
   for(i = 0; lpLogFontList[i] != NULL; i++)
-    if( !strcasecmp(winFaceName, lpLogFontList[i]->lfFaceName) )
+    if( !lstrcmpi32A(winFaceName, lpLogFontList[i]->lfFaceName) )
     {
 	strcpy(x11fam,"*-");
 	return strcat(x11fam,winFaceName);
@@ -1120,8 +1120,15 @@
 /*************************************************************************
  *             GetKerningPairs      [GDI.332]
  */
-int GetKerningPairs(HDC hDC,int cBufLen,LPKERNINGPAIR16 lpKerningPairs)
+int GetKerningPairs(HDC hDC,int cPairs,LPKERNINGPAIR16 lpKerningPairs)
 {
-	/* Wine fonts are ugly and don't support kerning :) */
-	return 0;
+    /* This has to be dealt with when proper font handling is in place 
+     *
+     * At this time kerning is ignored (set to 0)
+     */
+
+    int i;
+    fprintf(stdnimp,"GetKerningPairs: almost empty stub!\n");
+    for (i = 0; i < cPairs; i++) lpKerningPairs[i].iKernAmount = 0;
+    return 0;
 }
diff --git a/objects/text.c b/objects/text.c
index a9a67d3..d6ee0eb 100644
--- a/objects/text.c
+++ b/objects/text.c
@@ -380,8 +380,19 @@
       /* Compute text starting position */
 
     XTextExtents( font, str, count, &dir, &ascent, &descent, &info );
-    info.width += count*dc->w.charExtra + dc->w.breakExtra*dc->w.breakCount;
-    if (lpDx) for (i = 0; i < count; i++) info.width += lpDx[i];
+
+    if (lpDx) /* have explicit character cell x offsets */
+    {
+	/* sum lpDx array and add the width of last character */
+
+        info.width = XTextWidth( font, str + count - 1, 1) + dc->w.charExtra;
+        if (str[count-1] == (char)dc->u.x.font.metrics.tmBreakChar)
+            info.width += dc->w.breakExtra;
+
+        for (i = 0; i < count; i++) info.width += lpDx[i];
+    }
+    else
+       info.width += count*dc->w.charExtra + dc->w.breakExtra*dc->w.breakCount;
 
     switch( dc->w.textAlign & (TA_LEFT | TA_RIGHT | TA_CENTER) )
     {
@@ -443,7 +454,7 @@
         }
     }
     
-      /* Draw the text */
+    /* Draw the text (count > 0 verified) */
 
     XSetForeground( display, dc->u.x.gc, dc->w.textPixel );
     if (!dc->w.charExtra && !dc->w.breakExtra && !lpDx)
@@ -454,30 +465,42 @@
     else  /* Now the fun begins... */
     {
         XTextItem *items, *pitem;
+	int delta;
 
-        items = xmalloc( count * sizeof(XTextItem) );
-        for (i = 0, pitem = items; i < count; i++, pitem++)
+	/* allocate max items */
+
+        pitem = items = xmalloc( count * sizeof(XTextItem) );
+        delta = i = 0;
+        while (i < count)
         {
+	    /* initialize text item with accumulated delta */
+
             pitem->chars  = (char *)str + i;
-            pitem->nchars = 1;
+	    pitem->delta  = delta; 
+            pitem->nchars = 0;
             pitem->font   = None;
-            if (i == 0)
+            delta = 0;
+
+	    /* stuff characters into the same XTextItem until new delta 
+	     * becomes  non-zero */
+
+	    do
             {
-                pitem->delta = 0;
-                continue;  /* First iteration -> no delta */
-            }
-            pitem->delta = dc->w.charExtra;
-            if (str[i] == (char)dc->u.x.font.metrics.tmBreakChar)
-                pitem->delta += dc->w.breakExtra;
-            if (lpDx)
-            {
-                INT16 width;
-                GetCharWidth( hdc, str[i], str[i], &width );
-                pitem->delta += lpDx[i-1] - width;
-            }
+                if (lpDx) delta += lpDx[i] - XTextWidth( font, str + i, 1);
+                else
+                {
+                    delta += dc->w.charExtra;
+                    if (str[i] == (char)dc->u.x.font.metrics.tmBreakChar)
+                        delta += dc->w.breakExtra;
+                }
+                pitem->nchars++;
+            } 
+	    while ((++i < count) && !delta);
+            pitem++;
         }
+
         XDrawText( display, dc->u.x.drawable, dc->u.x.gc,
-                   dc->w.DCOrgX + x, dc->w.DCOrgY + y, items, count );
+                   dc->w.DCOrgX + x, dc->w.DCOrgY + y, items, pitem - items );
         free( items );
     }
 
diff --git a/resources/TODO b/resources/TODO
index b46b36f..641d539 100644
--- a/resources/TODO
+++ b/resources/TODO
@@ -64,6 +64,7 @@
 * German
 * Finnish
 * Italian
+* French
 .....
 
 Thank you.
diff --git a/resources/sysres_Fr.rc b/resources/sysres_Fr.rc
index 13843e1..a8801dc 100644
--- a/resources/sysres_Fr.rc
+++ b/resources/sysres_Fr.rc
@@ -132,16 +132,32 @@
  COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
 }
 
-
-CHOOSE_FONT DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
+CHOOSE_FONT DIALOG DISCARDABLE  13, 54, 264, 147
 STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
 CAPTION "Polices"
 FONT 8, "Helv"
 {
- LTEXT "&Police:", 1088, 6, 6, 40, 9
- LTEXT "", 1089, 60, 6, 150, 9
- DEFPUSHBUTTON "OK", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Annuler", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
+    LTEXT           "&Police:",1088 ,6,3,40,9
+    COMBOBOX        1136 ,6,13,94,54,  CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
+                    CBS_AUTOHSCROLL | CBS_SORT | WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
+    LTEXT           "St&yle de police:",1089 ,108,3,44,9
+    COMBOBOX        1137,108,13,64,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
+                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE
+    LTEXT           "&Taille:",1090,179,3,30,9
+    COMBOBOX        1138,179,13,32,54, CBS_OWNERDRAWFIXED | CBS_HASSTRINGS | CBS_DISABLENOSCROLL |
+                    WS_VSCROLL | WS_TABSTOP | CBS_SIMPLE | CBS_SORT
+    DEFPUSHBUTTON   "OK",IDOK,218,6,40,14,WS_GROUP
+    PUSHBUTTON      "Annuler",IDCANCEL,218,23,40,14,WS_GROUP
+    PUSHBUTTON      "A&ppliquer", 1026,218,40,40,14,WS_GROUP
+    PUSHBUTTON      "&Aide" , 1038,218,57,40,14,WS_GROUP
+    GROUPBOX        "Effets",1072,6,72,84,34,WS_GROUP
+    CHECKBOX        "&Barré", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
+    CHECKBOX        "&Souligné", 1041, 10,94,50,10, BS_AUTOCHECKBOX
+    LTEXT           "&Couleur:", 1091 ,6,110,30,9
+    COMBOBOX        1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
+                    CBS_AUTOHSCROLL |  WS_BORDER | WS_VSCROLL | WS_TABSTOP
+    GROUPBOX        "Exemple",1073,98,72,160,49,WS_GROUP
+    CTEXT           "AaBbYyZz",1093,104,81,149,37,SS_NOPREFIX | WS_VISIBLE
 }
 
 CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
@@ -171,8 +187,8 @@
  CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
  DEFPUSHBUTTON "Ok",  1,  4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
  PUSHBUTTON "Annuler", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
- PUSHBUTTON "Aide", 1038,100,166, 44, 14
- PUSHBUTTON "&Ajouter couleur personnalisées", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP 
+ PUSHBUTTON "&Aide", 1038,100,166, 44, 14
+ PUSHBUTTON "A&jouter couleur personnalisées", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP 
  PUSHBUTTON "&Definir couleurs personnalisées >>", 719/*1025*/,   4, 150, 142, 14, WS_GROUP | WS_TABSTOP
  PUSHBUTTON  "&i",713,300,200,4,14   /* just a dummy:  'i' is  like  &i in "sol&id" */
 }
diff --git a/tools/build.c b/tools/build.c
index b64c9af..a60ed33 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -287,7 +287,26 @@
     ORDDEF *odp;
     ORDFUNCDEF *fdp;
     int i;
-    
+
+    switch(SpecType)
+    {
+    case SPEC_WIN16:
+        if (type == TYPE_STDCALL)
+        {
+            fprintf( stderr, "%d: 'stdcall' not supported for Win16\n", Line );
+            exit(1);
+        }
+        break;
+    case SPEC_WIN32:
+        if ((type == TYPE_PASCAL) || (type == TYPE_PASCAL_16))
+        {
+            fprintf( stderr, "%d: 'pascal' not supported for Win32\n", Line );
+            exit(1);
+        }
+        break;
+    default:
+        break;
+    }
     odp = &OrdinalDefinitions[ordinal];
     strcpy(odp->export_name, GetToken());
     odp->type = type;
@@ -301,25 +320,39 @@
 	exit(1);
     }
 
-    for (i = 0; i < 16; i++)
+    for (i = 0; i < sizeof(fdp->arg_types)-1; i++)
     {
 	token = GetToken();
 	if (*token == ')')
 	    break;
 
-	if (!strcmp(token, "byte") || !strcmp(token, "word"))
+        if (!strcmp(token, "byte") || !strcmp(token, "word"))
             fdp->arg_types[i] = 'w';
-	else if (!strcmp(token, "s_byte") || !strcmp(token, "s_word"))
+        else if (!strcmp(token, "s_byte") || !strcmp(token, "s_word"))
             fdp->arg_types[i] = 's';
-	else if (!strcmp(token, "long") || !strcmp(token, "segptr"))
+        else if (!strcmp(token, "long") || !strcmp(token, "segptr"))
             fdp->arg_types[i] = 'l';
-	else if (!strcmp(token, "ptr"))
+        else if (!strcmp(token, "ptr"))
             fdp->arg_types[i] = 'p';
-	else
-	{
-	    fprintf(stderr, "%d: Unknown variable type '%s'\n", Line, token);
-	    exit(1);
-	}
+        else
+        {
+            fprintf(stderr, "%d: Unknown variable type '%s'\n", Line, token);
+            exit(1);
+        }
+        if (SpecType == SPEC_WIN32)
+        {
+            if (strcmp(token, "long") && strcmp(token, "ptr"))
+            {
+                fprintf( stderr, "%d: Type '%s' not supported for Win32\n",
+                         Line, token );
+                exit(1);
+            }
+        }
+    }
+    if (*token != ')')
+    {
+        fprintf( stderr, "%d: Too many arguments\n", Line );
+        exit(1);
     }
     fdp->arg_types[i] = '\0';
 
@@ -424,33 +457,28 @@
 
     if (strcmp(token, "byte") == 0)
 	return ParseVariable(ordinal, TYPE_BYTE);
-    else if (strcmp(token, "word") == 0)
+    if (strcmp(token, "word") == 0)
 	return ParseVariable(ordinal, TYPE_WORD);
-    else if (strcmp(token, "long") == 0)
+    if (strcmp(token, "long") == 0)
 	return ParseVariable(ordinal, TYPE_LONG);
-    else if (strcmp(token, "p") == 0)
+    if (strcmp(token, "pascal") == 0)
 	return ParseExportFunction(ordinal, TYPE_PASCAL);
-    else if (strcmp(token, "pascal") == 0)
-	return ParseExportFunction(ordinal, TYPE_PASCAL);
-    else if (strcmp(token, "pascal16") == 0)
+    if (strcmp(token, "pascal16") == 0)
 	return ParseExportFunction(ordinal, TYPE_PASCAL_16);
-    else if (strcmp(token, "register") == 0)
+    if (strcmp(token, "register") == 0)
         return ParseExportFunction(ordinal, TYPE_REGISTER);
-    else if (strcmp(token, "stdcall") == 0)
+    if (strcmp(token, "stdcall") == 0)
         return ParseExportFunction(ordinal, TYPE_STDCALL);
-    else if (strcmp(token, "equate") == 0)
+    if (strcmp(token, "equate") == 0)
 	return ParseEquate(ordinal);
-    else if (strcmp(token, "return") == 0)
+    if (strcmp(token, "return") == 0)
 	return ParseReturn(ordinal);
-    else if (strcmp(token, "stub") == 0)
+    if (strcmp(token, "stub") == 0)
 	return ParseStub(ordinal);
-    else
-    {
-	fprintf(stderr, 
-		"%d: Expected type after ordinal, found '%s' instead\n",
-		Line, token);
-	exit(1);
-    }
+    fprintf(stderr, 
+            "%d: Expected type after ordinal, found '%s' instead\n",
+            Line, token);
+    exit(1);
 }
 
 static int ParseTopLevel(void)
diff --git a/win32/cursoricon32.c b/win32/cursoricon32.c
index 709f8e7..e09b635 100644
--- a/win32/cursoricon32.c
+++ b/win32/cursoricon32.c
@@ -243,7 +243,7 @@
     CURSORICONDIR32 *dir;
     CURSORICONDIRENTRY32 *entry = NULL;
 
-    if (!(hRsrc = FindResource32( hInstance, name,
+    if (!(hRsrc = FindResource32W( hInstance, name,
                 (LPCWSTR)(fCursor ? RT_GROUP_CURSOR : RT_GROUP_ICON) )))
         return FALSE;
     if (!(hMem = LoadResource32( hInstance, hRsrc ))) return FALSE;
@@ -439,7 +439,7 @@
 
     /* Load the resource */
 
-    if (!(hRsrc = FindResource32( hInstance,
+    if (!(hRsrc = FindResource32W( hInstance,
                       (LPWSTR) (DWORD) dirEntry.icon.wResId,
                       (LPWSTR) (fCursor ? RT_CURSOR : RT_ICON )))) return 0;
     if (!(handle = LoadResource32( hInstance, hRsrc ))) return 0;
diff --git a/win32/file.c b/win32/file.c
index ed65650..5e5ad28 100644
--- a/win32/file.c
+++ b/win32/file.c
@@ -482,17 +482,21 @@
 DWORD GetFileAttributesA(LPCSTR lpFileName)
 {
 	struct stat buf;
-	DWORD res=0;
-	if(stat(lpFileName,&buf)==-1)
-	{
+	DWORD	res=0;
+	char	*fn;
+
+	dprintf_win32(stddeb,"GetFileAttributesA(%s)\n",lpFileName);
+	fn=DOSFS_GetUnixFileName(lpFileName,FALSE);
+	/* fn points to a static buffer, don't free it */
+	if(stat(fn,&buf)==-1) {
 		SetLastError(ErrnoToLastError(errno));
-		return 0;
+		return 0xFFFFFFFF;
 	}
-    if(buf.st_mode & S_IFREG)
-        res |= FILE_ATTRIBUTE_NORMAL;
-    if(buf.st_mode & S_IFDIR)
-        res |= FILE_ATTRIBUTE_DIRECTORY;
-    if((buf.st_mode & S_IWRITE) == 0)
-        res |= FILE_ATTRIBUTE_READONLY;
+	if(buf.st_mode & S_IFREG)
+		res |= FILE_ATTRIBUTE_NORMAL;
+	if(buf.st_mode & S_IFDIR)
+		res |= FILE_ATTRIBUTE_DIRECTORY;
+	if((buf.st_mode & S_IWRITE) == 0)
+		res |= FILE_ATTRIBUTE_READONLY;
 	return res;
 }
diff --git a/win32/resource.c b/win32/resource.c
index 3252379..0bd6f4d 100644
--- a/win32/resource.c
+++ b/win32/resource.c
@@ -30,23 +30,21 @@
 
 int language = 0x0409;
 
-#if 0
-#define PrintId(name) \
+#define PrintIdA(name) \
     if (HIWORD((DWORD)name)) \
         dprintf_resource( stddeb, "'%s'", name); \
     else \
         dprintf_resource( stddeb, "#%04x", LOWORD(name)); 
-#else
+#define PrintIdW(name)
 #define PrintId(name)
-#endif
 
 /**********************************************************************
- *	    GetResDirEntry
+ *	    GetResDirEntryW
  *
  *	Helper function - goes down one level of PE resource tree
  *
  */
-PIMAGE_RESOURCE_DIRECTORY GetResDirEntry(PIMAGE_RESOURCE_DIRECTORY resdirptr,
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(PIMAGE_RESOURCE_DIRECTORY resdirptr,
 					 LPCWSTR name,
 					 DWORD root)
 {
@@ -88,9 +86,56 @@
 }
 
 /**********************************************************************
- *	    FindResource    (KERNEL.60)
+ *	    GetResDirEntryA
+ *
+ *	Helper function - goes down one level of PE resource tree
+ *
  */
-HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
+PIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(PIMAGE_RESOURCE_DIRECTORY resdirptr,
+					 LPCSTR name,
+					 DWORD root)
+{
+	LPWSTR				xname;
+	PIMAGE_RESOURCE_DIRECTORY	ret;
+
+	if (HIWORD((DWORD)name))
+		xname	= STRING32_DupAnsiToUni(name);
+	else
+		xname	= (LPWSTR)name;
+
+	ret=GetResDirEntryW(resdirptr,xname,root);
+	if (HIWORD((DWORD)name))
+		free(xname);
+	return ret;
+}
+
+/**********************************************************************
+ *	    FindResourceA    (KERNEL32.128)
+ */
+HANDLE32 FindResource32A( HINSTANCE hModule, LPCSTR name, LPCSTR type ) {
+	LPWSTR		xname,xtype;
+	HANDLE32	ret;
+
+	if (HIWORD((DWORD)name))
+		xname = STRING32_DupAnsiToUni(name);
+	else
+		xname = (LPWSTR)name;
+	if (HIWORD((DWORD)type))
+		xtype = STRING32_DupAnsiToUni(type);
+	else
+		xtype = (LPWSTR)type;
+	ret=FindResource32W(hModule,xname,xtype);
+	if (HIWORD((DWORD)name))
+		free(xname);
+	if (HIWORD((DWORD)type))
+		free(xtype);
+	return ret;
+}
+
+/**********************************************************************
+ *	    FindResourceW    (KERNEL32.131)
+ */
+HANDLE32 FindResource32W( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
 {
 #ifndef WINELIB
     PE_MODULE *pe;
@@ -99,6 +144,10 @@
     DWORD root;
 	HANDLE32 result;
 
+    /* Sometimes we get passed hModule = 0x00000000. FIXME: is GetTaskDS()
+     * ok?
+     */
+    if (!hModule) hModule = GetTaskDS();
     hModule = GetExePtr( hModule );  /* In case we were passed an hInstance */
     dprintf_resource(stddeb, "FindResource: module=%08x type=", hModule );
     PrintId( type );
@@ -111,14 +160,14 @@
 
     resdirptr = (PIMAGE_RESOURCE_DIRECTORY) pe->pe_resource;
     root = (DWORD) resdirptr;
-    if ((resdirptr = GetResDirEntry(resdirptr, type, root)) == NULL)
+    if ((resdirptr = GetResDirEntryW(resdirptr, type, root)) == NULL)
 	return 0;
-    if ((resdirptr = GetResDirEntry(resdirptr, name, root)) == NULL)
+    if ((resdirptr = GetResDirEntryW(resdirptr, name, root)) == NULL)
 	return 0;
-    result = GetResDirEntry(resdirptr, (LPCWSTR)language, root);
+    result = (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)language, root);
 	/* Try LANG_NEUTRAL, too */
     if(!result)
-        return GetResDirEntry(resdirptr, (LPCWSTR)0, root);
+        return (HANDLE32)GetResDirEntryW(resdirptr, (LPCWSTR)0, root);
     return result;
     
 #else
@@ -128,7 +177,7 @@
 
 
 /**********************************************************************
- *	    LoadResource    (KERNEL.61)
+ *	    LoadResource    (KERNEL32.370)
  */
 HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
 {
@@ -136,6 +185,7 @@
     NE_MODULE *pModule;
     PE_MODULE *pe;
 
+    if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
     hModule = GetExePtr( hModule );  /* In case we were passed an hInstance */
     dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
                      hModule, hRsrc );
@@ -275,7 +325,7 @@
     dprintf_resource(stddeb, "LoadString: instance = %04x, id = %04x, buffer = %08x, "
 	   "length = %d\n", instance, (int)resource_id, (int) buffer, buflen);
 
-    hrsrc = FindResource32( instance, (LPCWSTR)((resource_id>>4)+1), 
+    hrsrc = FindResource32W( instance, (LPCWSTR)((resource_id>>4)+1), 
 		(LPCWSTR)RT_STRING );
     if (!hrsrc) return 0;
     hmem = LoadResource32( instance, hrsrc );
@@ -351,7 +401,7 @@
         return OBM_LoadBitmap( LOWORD((int)name) );
     }
 
-    if (!(hRsrc = FindResource32( instance, name, 
+    if (!(hRsrc = FindResource32W( instance, name, 
 		(LPWSTR)RT_BITMAP ))) return 0;
     if (!(handle = LoadResource32( instance, hRsrc ))) return 0;
 
@@ -387,7 +437,7 @@
 HMENU WIN32_LoadMenuW(HANDLE instance, LPCWSTR name)
 {
 	HANDLE32 hrsrc;
-	hrsrc=FindResource32(instance,name,(LPWSTR)RT_MENU);
+	hrsrc=FindResource32W(instance,name,(LPWSTR)RT_MENU);
 	if(!hrsrc)return 0;
         return LoadMenuIndirect32W( LoadResource32(instance, hrsrc) );
 }
diff --git a/windows/dialog.c b/windows/dialog.c
index 8d4c82b..b7aa611 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -663,7 +663,7 @@
 HWND32 CreateDialogParam32W( HINSTANCE32 hInst, LPCWSTR name,
                              HWND32 owner, DLGPROC32 dlgProc, LPARAM param )
 {
-    HANDLE32 hrsrc = FindResource32( hInst, name, (LPWSTR)RT_DIALOG );
+    HANDLE32 hrsrc = FindResource32W( hInst, name, (LPWSTR)RT_DIALOG );
     if (!hrsrc) return 0;
     return CreateDialogIndirectParam32W( hInst, LoadResource32( hInst, hrsrc ),
                                          owner, dlgProc, param );
diff --git a/windows/winpos.c b/windows/winpos.c
index b1f1de3..e2c3ff7 100644
--- a/windows/winpos.c
+++ b/windows/winpos.c
@@ -1600,7 +1600,7 @@
 	    (oldClientRect.top - oldWindowRect.top !=
 	     newClientRect.top - newWindowRect.top) )
 
-	    RedrawWindow32( wndPtr->hwndSelf, NULL, 0,
+	    RedrawWindow32( wndPtr->hwndSelf, NULL, 0, RDW_INVALIDATE |
                             RDW_ALLCHILDREN | RDW_FRAME | RDW_ERASE );
 	else
 	    if( winpos.flags & SWP_FRAMECHANGED )