diff -ur wine971130-clean/controls/edit.c wine971130/controls/edit.c
--- wine971130-clean/controls/edit.c	Sun Nov 30 09:41:30 1997
+++ wine971130/controls/edit.c	Mon Dec  1 22:47:44 1997
@@ -3494,7 +3494,7 @@
 	e = EDIT_CharFromPos(wnd, es, x, y, &after_wrap);
 	EDIT_EM_SetSel(wnd, es, (keys & MK_SHIFT) ? es->selection_start : e, e, after_wrap);
 	EDIT_EM_ScrollCaret(wnd, es);
-	es->region_posx = es->region_posx = 0;
+	es->region_posx = es->region_posy = 0;
 	SetTimer32(wnd->hwndSelf, 0, 100, NULL);
 	return 0;
 }
diff -ur wine971130-clean/files/dos_fs.c wine971130/files/dos_fs.c
--- wine971130-clean/files/dos_fs.c	Sun Nov 30 09:41:32 1997
+++ wine971130/files/dos_fs.c	Mon Dec  1 22:47:44 1997
@@ -373,15 +373,15 @@
 #ifdef VFAT_IOCTL_READDIR_BOTH
     if (dir->fd != -1)
     {
-        if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) == -1)
-            return FALSE;
-        if (!dir->dirent[0].d_reclen) return FALSE;
-        if (!DOSFS_ToDosFCBFormat( dir->dirent[0].d_name, dir->short_name ))
-            dir->short_name[0] = '\0';
-        *short_name = dir->short_name;
-        if (dir->dirent[1].d_name[0]) *long_name = dir->dirent[1].d_name;
-        else *long_name = dir->dirent[0].d_name;
-        return TRUE;
+        if (ioctl( dir->fd, VFAT_IOCTL_READDIR_BOTH, (long)dir->dirent ) != -1) {
+	    if (!dir->dirent[0].d_reclen) return FALSE;
+	    if (!DOSFS_ToDosFCBFormat( dir->dirent[0].d_name, dir->short_name ))
+		dir->short_name[0] = '\0';
+	    *short_name = dir->short_name;
+	    if (dir->dirent[1].d_name[0]) *long_name = dir->dirent[1].d_name;
+	    else *long_name = dir->dirent[0].d_name;
+	    return TRUE;
+	}
     }
 #endif  /* VFAT_IOCTL_READDIR_BOTH */
 
@@ -518,8 +518,8 @@
 
     if (!(dir = DOSFS_OpenDir( path )))
     {
-        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir\n",
-                       path, name );
+        dprintf_dosfs( stddeb, "DOSFS_FindUnixName(%s,%s): can't open dir: %s\n",
+                       path, name, strerror(errno) );
         return FALSE;
     }
 
diff -ur wine971130-clean/files/profile.c wine971130/files/profile.c
--- wine971130-clean/files/profile.c	Sun Oct 12 09:16:00 1997
+++ wine971130/files/profile.c	Mon Dec  1 22:47:44 1997
@@ -1021,6 +1021,27 @@
     return res;
 }
 
+/***********************************************************************
+ *           WritePrivateProfileSection32A   (KERNEL32)
+ */
+BOOL32 WINAPI WritePrivateProfileSection32A( LPCSTR section, 
+                                            LPCSTR string, LPCSTR filename )
+{
+    char *p =(char*)string;
+
+    fprintf( stdnimp,"WritePrivateProfileSection32A empty stup\n");
+    if (debugging_profile) {
+      fprintf(stddeb,"file(%s) => [%s]\n", filename,section);
+      while (*(p+1)) {
+	fprintf(stddeb,"%s\n",p);
+        p += strlen(p);
+	p += 1;
+      }
+    }
+    
+    return FALSE;
+}
+
 
 /***********************************************************************
  *           WriteOutProfiles   (KERNEL.315)
diff -ur wine971130-clean/graphics/x11drv/pen.c wine971130/graphics/x11drv/pen.c
--- wine971130-clean/graphics/x11drv/pen.c	Sun Feb  2 10:57:47 1997
+++ wine971130/graphics/x11drv/pen.c	Mon Dec  1 22:47:44 1997
@@ -13,6 +13,7 @@
 static const char PEN_dot[]        = { 1,1 };      /* --  --  --  --  --  -- */
 static const char PEN_dashdot[]    = { 4,3,2,3 };  /* ----   --   ----   --  */
 static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ----  --  --  ----  */
+static const char PEN_alternate[]  = { 1,1 };      /* FIXME */
 
 /***********************************************************************
  *           PEN_SelectObject
@@ -22,12 +23,15 @@
     HPEN32 prevHandle = dc->w.hPen;
 
     dc->w.hPen = hpen;
-    dc->u.x.pen.style = pen->logpen.lopnStyle;
+    dc->u.x.pen.style = pen->logpen.lopnStyle & PS_ALL_STYLES;
+    dc->u.x.pen.endcap = pen->logpen.lopnStyle & PS_ALL_ENDCAPS;
+    dc->u.x.pen.linejoin = pen->logpen.lopnStyle & PS_ALL_LINEJOINS;
+
     dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->vportExtX / dc->wndExtX;
     if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
     if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0;  /* Faster */
     dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );    
-    switch(pen->logpen.lopnStyle)
+    switch(pen->logpen.lopnStyle & PS_ALL_STYLES)
     {
       case PS_DASH:
 	dc->u.x.pen.dashes = (char *)PEN_dash;
@@ -44,6 +48,14 @@
       case PS_DASHDOTDOT:
 	dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
 	dc->u.x.pen.dash_len = 6;
+	break;
+      case PS_ALTERNATE:
+	/* FIXME: should be alternating _pixels_ that are set */
+	dc->u.x.pen.dashes = (char *)PEN_alternate;
+	dc->u.x.pen.dash_len = 2;
+	break;
+      case PS_USERSTYLE:
+	/* FIXME */
 	break;
     }
     
diff -ur wine971130-clean/if1632/gdi32.spec wine971130/if1632/gdi32.spec
--- wine971130-clean/if1632/gdi32.spec	Sun Nov 30 09:41:35 1997
+++ wine971130/if1632/gdi32.spec	Mon Dec  1 22:47:44 1997
@@ -97,7 +97,7 @@
  90 stdcall EqualRgn(long long) EqualRgn32
  91 stdcall Escape(long long long ptr ptr) Escape32
  92 stdcall ExcludeClipRect(long long long long long) ExcludeClipRect32
- 93 stub ExtCreatePen
+ 93 stdcall ExtCreatePen(long long ptr long ptr) ExtCreatePen32
  94 stub ExtCreateRegion
  95 stdcall ExtEscape(long long long ptr long ptr) ExtEscape32
  96 stdcall ExtFloodFill(long long long long long) ExtFloodFill32
diff -ur wine971130-clean/if1632/kernel32.spec wine971130/if1632/kernel32.spec
--- wine971130-clean/if1632/kernel32.spec	Sun Nov 30 09:41:35 1997
+++ wine971130/if1632/kernel32.spec	Mon Dec  1 22:47:44 1997
@@ -728,7 +728,7 @@
 737 stdcall WriteConsoleW(long ptr long ptr ptr) WriteConsole32W
 738 stdcall WriteFile(long ptr long ptr ptr) WriteFile
 739 stub WriteFileEx
-740 stub WritePrivateProfileSectionA
+740 stdcall WritePrivateProfileSectionA(str str str) WritePrivateProfileSection32A
 741 stub WritePrivateProfileSectionW
 742 stdcall WritePrivateProfileStringA(str str str str) WritePrivateProfileString32A
 743 stdcall WritePrivateProfileStringW(wstr wstr wstr wstr) WritePrivateProfileString32W
diff -ur wine971130-clean/if1632/winmm.spec wine971130/if1632/winmm.spec
--- wine971130-clean/if1632/winmm.spec	Sat Nov  1 11:06:23 1997
+++ wine971130/if1632/winmm.spec	Mon Dec  1 22:47:44 1997
@@ -15,7 +15,7 @@
  14 stub GetDriverModuleHandle
  15 stdcall OpenDriver(ptr ptr long) OpenDriver
  16 stub OpenDriverA
- 17 stub PlaySound
+ 17 stdcall PlaySound(ptr long long) PlaySound32A
  18 stdcall PlaySoundW(ptr long long) PlaySound32W
  19 stub SendDriverMessage
  20 stdcall auxGetDevCapsA(long ptr long) auxGetDevCaps32A
diff -ur wine971130-clean/if1632/winspool.spec wine971130/if1632/winspool.spec
--- wine971130-clean/if1632/winspool.spec	Sun Nov 30 09:41:39 1997
+++ wine971130/if1632/winspool.spec	Mon Dec  1 22:47:44 1997
@@ -96,7 +96,7 @@
 193 stub GetPrinterDriverW
 194 stub GetPrinterW
 195 stub InitializeDll
-196 stub OpenPrinterA
+196 stdcall OpenPrinterA(str ptr ptr) OpenPrinter32A
 197 stub OpenPrinterW
 198 stub PlayGdiScriptOnPrinterIC
 199 stub PrinterMessageBoxA
diff -ur wine971130-clean/include/debugger.h wine971130/include/debugger.h
--- wine971130-clean/include/debugger.h	Sun Nov 30 09:41:40 1997
+++ wine971130/include/debugger.h	Mon Dec  1 22:47:44 1997
@@ -96,13 +96,13 @@
 
 #define DBG_CHECK_READ_PTR(addr,len) \
     (!DEBUG_IsBadReadPtr((addr),(len)) || \
-     (fprintf(stderr,"*** Invalid address "), \
+     (fprintf(stderr,"*** Invalid read address (%s:%d) ", __FILE__, __LINE__), \
       DEBUG_PrintAddress((addr),dbg_mode, FALSE), \
       fprintf(stderr,"\n"),0))
 
 #define DBG_CHECK_WRITE_PTR(addr,len) \
     (!DEBUG_IsBadWritePtr((addr),(len)) || \
-     (fprintf(stderr,"*** Invalid address "), \
+     (fprintf(stderr,"*** Invalid write address (%s:%d) ", __FILE__, __LINE__), \
       DEBUG_PrintAddress(addr,dbg_mode, FALSE), \
       fprintf(stderr,"\n"),0))
 
diff -ur wine971130-clean/include/pen.h wine971130/include/pen.h
--- wine971130-clean/include/pen.h	Sun Feb  2 10:57:50 1997
+++ wine971130/include/pen.h	Mon Dec  1 22:47:44 1997
@@ -9,6 +9,13 @@
 
 #include "gdi.h"
 
+#define PS_ALL_TYPES     (PS_GEOMETRIC|PS_COSMETIC)
+#define PS_ALL_STYLES    (PS_ALTERNATE|PS_SOLID|PS_DASH|PS_DOT|\
+			  PS_DASHDOT|PS_DASHDOTDOT|PS_NULL|PS_USERSTYLE|\
+			  PS_INSIDEFRAME)
+#define PS_ALL_ENDCAPS   (PS_ENDCAP_ROUND|PS_ENDCAP_SQUARE|PS_ENDCAP_FLAT)
+#define PS_ALL_LINEJOINS (PS_JOIN_BEVEL|PS_JOIN_MITER|PS_JOIN_ROUND)
+
   /* GDI logical pen object */
 typedef struct
 {
diff -ur wine971130-clean/include/windows.h wine971130/include/windows.h
--- wine971130-clean/include/windows.h	Sun Nov 30 09:41:44 1997
+++ wine971130/include/windows.h	Mon Dec  1 22:47:44 1997
@@ -1591,13 +1591,26 @@
 DECL_WINELIB_TYPE(LOGPEN);
 DECL_WINELIB_TYPE(LPLOGPEN);
 
-#define PS_SOLID	  0
-#define PS_DASH           1
-#define PS_DOT            2
-#define PS_DASHDOT        3
-#define PS_DASHDOTDOT     4
-#define PS_NULL 	  5
-#define PS_INSIDEFRAME 	  6
+#define PS_COSMETIC       0x00000000
+#define PS_GEOMETRIC      0x00010000
+
+#define PS_SOLID	  0x00000000
+#define PS_DASH           0x00000001
+#define PS_DOT            0x00000002
+#define PS_DASHDOT        0x00000003
+#define PS_DASHDOTDOT     0x00000004
+#define PS_NULL 	  0x00000005
+#define PS_INSIDEFRAME 	  0x00000006
+#define PS_USERSTYLE      0x00000007
+#define PS_ALTERNATE      0x00000008
+
+#define PS_ENDCAP_ROUND   0x00000000
+#define PS_ENDCAP_SQUARE  0x00000100
+#define PS_ENDCAP_FLAT    0x00000200
+
+#define PS_JOIN_ROUND     0x00000000
+#define PS_JOIN_BEVEL     0x00001000
+#define PS_JOIN_MITER     0x00002000
 
   /* Regions */
 
@@ -4875,6 +4888,20 @@
 DECL_WINELIB_TYPE_AW(DEVMODE);
 DECL_WINELIB_TYPE_AW(LPDEVMODE);
 
+typedef struct _PRINTER_DEFAULTS32A {
+    LPSTR        pDatatype;
+    LPDEVMODE32A pDevMode;
+    ACCESS_MASK  DesiredAccess;
+} PRINTER_DEFAULTS32A, *LPPRINTER_DEFAULTS32A;
+
+typedef struct _PRINTER_DEFAULTS32W {
+    LPWSTR       pDatatype;
+    LPDEVMODE32W pDevMode;
+    ACCESS_MASK  DesiredAccess;
+} PRINTER_DEFAULTS32W, *LPPRINTER_DEFAULTS32W;
+
+DECL_WINELIB_TYPE_AW(PRINTER_DEFAULTSA);
+
 typedef struct _SYSTEM_POWER_STATUS
 {
   BOOL16  ACLineStatus;
@@ -6360,6 +6387,8 @@
 BOOL16      WINAPI ExitWindows16(DWORD,UINT16);
 #define     ExitWindows32(a,b) ExitWindowsEx(EWX_LOGOFF,0xffffffff)
 #define     ExitWindows WINELIB_NAME(ExitWindows)
+HPEN32      WINAPI ExtCreatePen32(DWORD,DWORD,const LOGBRUSH32 *,DWORD,LPDWORD);
+#define     ExtCreatePen WINELIB_NAME(ExtCreatePen)
 BOOL16      WINAPI ExtFloodFill16(HDC16,INT16,INT16,COLORREF,UINT16);
 BOOL32      WINAPI ExtFloodFill32(HDC32,INT32,INT32,COLORREF,UINT32);
 #define     ExtFloodFill WINELIB_NAME(ExtFloodFill)
@@ -6563,6 +6592,8 @@
 INT16       WINAPI GetDeviceCaps16(HDC16,INT16);
 INT32       WINAPI GetDeviceCaps32(HDC32,INT32);
 #define     GetDeviceCaps WINELIB_NAME(GetDeviceCaps)
+UINT32      WINAPI GetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD *);
+#define     GetDIBColorTable WINELIB_NAME(GetDIBColorTable)
 INT16       WINAPI GetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPSTR,LPBITMAPINFO,UINT16);
 INT32       WINAPI GetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPSTR,LPBITMAPINFO,UINT32);
 #define     GetDIBits WINELIB_NAME(GetDIBits)
@@ -7542,6 +7573,8 @@
 BOOL16      WINAPI SetDeskWallPaper16(LPCSTR);
 BOOL32      WINAPI SetDeskWallPaper32(LPCSTR);
 #define     SetDeskWallPaper WINELIB_NAME(SetDeskWallPaper)
+UINT32      WINAPI SetDIBColorTable32(HDC32,UINT32,UINT32,RGBQUAD *);
+#define     SetDIBColorTable WINELIB_NAME(SetDIBColorTable)
 INT16       WINAPI SetDIBits16(HDC16,HBITMAP16,UINT16,UINT16,LPCVOID,const BITMAPINFO*,UINT16);
 INT32       WINAPI SetDIBits32(HDC32,HBITMAP32,UINT32,UINT32,LPCVOID,const BITMAPINFO*,UINT32);
 #define     SetDIBits WINELIB_NAME(SetDIBits)
diff -ur wine971130-clean/include/winerror.h wine971130/include/winerror.h
--- wine971130-clean/include/winerror.h	Sun Nov 30 09:41:44 1997
+++ wine971130/include/winerror.h	Mon Dec  1 22:28:37 1997
@@ -28,6 +28,7 @@
 #define ERROR_BROKEN_PIPE           109
 #define ERROR_DISK_FULL             112
 #define ERROR_CALL_NOT_IMPLEMENTED  120
+#define ERROR_INSUFFICIENT_BUFFER   122
 #define ERROR_SEEK_ON_DEVICE        132
 #define ERROR_DIR_NOT_EMPTY         145
 #define ERROR_BUSY                  170
@@ -35,6 +36,7 @@
 #define ERROR_FILENAME_EXCED_RANGE  206
 #define ERROR_MORE_DATA             234
 #define ERROR_NO_MORE_ITEMS         259
+#define ERROR_INVALID_ADDRESS       487
 #define ERROR_IO_DEVICE             1117
 #define ERROR_POSSIBLE_DEADLOCK     1131
 #define ERROR_BAD_DEVICE            1200
diff -ur wine971130-clean/include/x11drv.h wine971130/include/x11drv.h
--- wine971130-clean/include/x11drv.h	Mon Jun 16 10:36:02 1997
+++ wine971130/include/x11drv.h	Mon Dec  1 22:47:51 1997
@@ -14,6 +14,8 @@
 typedef struct
 {
     int          style;
+    int          endcap;
+    int          linejoin;
     int          pixel;
     int          width;
     char *       dashes;
diff -ur wine971130-clean/loader/pe_image.c wine971130/loader/pe_image.c
--- wine971130-clean/loader/pe_image.c	Sun Nov 30 09:41:45 1997
+++ wine971130/loader/pe_image.c	Mon Dec  1 22:47:51 1997
@@ -522,6 +522,11 @@
 	load_addr = (DWORD)VirtualAlloc( (void*)load_addr, vma_size,
                                          MEM_RESERVE | MEM_COMMIT,
                                          PAGE_EXECUTE_READWRITE );
+	if (load_addr == 0) {
+		load_addr = (DWORD)VirtualAlloc( NULL, vma_size,
+						 MEM_RESERVE | MEM_COMMIT,
+						 PAGE_EXECUTE_READWRITE );
+	}
 	pem->module = (HMODULE32)load_addr;
 
 	dprintf_win32(stddeb, "Load addr is really %lx, range %x\n",
diff -ur wine971130-clean/memory/virtual.c wine971130/memory/virtual.c
--- wine971130-clean/memory/virtual.c	Sun Nov 30 09:41:47 1997
+++ wine971130/memory/virtual.c	Mon Dec  1 22:47:51 1997
@@ -190,7 +190,9 @@
 
     /* Create the view structure */
 
-    size >>= page_shift;
+    if (size == 0) return NULL;
+    size = 1 + ((base + size - 1) >> page_shift) - (base >> page_shift);
+
     if (!(view = (FILE_VIEW *)malloc( sizeof(*view) + size - 1 ))) return NULL;
     view->base    = base;
     view->size    = size << page_shift;
@@ -475,6 +477,11 @@
             SetLastError( ERROR_OUTOFMEMORY );
             return NULL;
         }
+	if (base && ptr != base) {
+	    FILE_munmap( (LPVOID)ptr, 0, view_size );
+	    SetLastError( ERROR_INVALID_ADDRESS );
+	    return NULL;
+	}
         if (!base)
         {
             /* Release the extra memory while keeping the range */
diff -ur wine971130-clean/misc/printdrv.c wine971130/misc/printdrv.c
--- wine971130-clean/misc/printdrv.c	Sun Nov 30 09:41:50 1997
+++ wine971130/misc/printdrv.c	Mon Dec  1 22:47:51 1997
@@ -89,6 +89,14 @@
     return 1;
 }
 
+BOOL32 WINAPI OpenPrinter32A(LPSTR lpPrinterName,HANDLE32 *phPrinter,
+			     LPPRINTER_DEFAULTS32A pDefault)
+{
+    fprintf(stderr,"OpenPrinter32A(%s,%p,%p), stub\n",
+	    lpPrinterName, phPrinter, pDefault);
+    SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+    return FALSE;
+}
 BOOL32  WINAPI EnumPrinters32A(DWORD dwType, LPSTR lpszName,
 			       DWORD dwLevel, LPBYTE lpbPrinters,
 			       DWORD cbBuf, LPDWORD lpdwNeeded,
diff -ur wine971130-clean/objects/dc.c wine971130/objects/dc.c
--- wine971130-clean/objects/dc.c	Sat Nov  1 11:06:36 1997
+++ wine971130/objects/dc.c	Mon Dec  1 22:47:51 1997
@@ -349,8 +349,32 @@
     }
     else val.line_style = LineSolid;
     val.line_width = dc->u.x.pen.width;
-    val.cap_style  = (val.line_width <= 1) ? CapNotLast : CapRound;
-    val.join_style = JoinMiter;
+    if (val.line_width <= 1) {
+	val.cap_style = CapNotLast;
+    } else {
+	switch (dc->u.x.pen.endcap)
+	{
+	case PS_ENDCAP_SQUARE:
+	    val.cap_style = CapProjecting;
+	    break;
+	case PS_ENDCAP_FLAT:
+	    val.cap_style = CapButt;
+	    break;
+	case PS_ENDCAP_ROUND:
+	default:
+	    val.cap_style = CapRound;
+	}
+    }
+    switch (dc->u.x.pen.linejoin)
+    {
+    case PS_JOIN_BEVEL:
+	val.join_style = JoinBevel;
+    case PS_JOIN_MITER:
+	val.join_style = JoinMiter;
+    case PS_JOIN_ROUND:
+    default:
+	val.join_style = JoinRound;
+    }
     XChangeGC( display, dc->u.x.gc, 
 	       GCFunction | GCForeground | GCBackground | GCLineWidth |
 	       GCLineStyle | GCCapStyle | GCJoinStyle | GCFillStyle, &val );
diff -ur wine971130-clean/objects/dib.c wine971130/objects/dib.c
--- wine971130-clean/objects/dib.c	Sun Nov 30 09:41:54 1997
+++ wine971130/objects/dib.c	Mon Dec  1 22:47:51 1997
@@ -291,6 +291,7 @@
 	    srcbits += linebytes;
 	}
     } else {
+	lines = -lines;
 	for (h = 0; h < lines; h++) {
 	    DIB_SetImageBits_1_Line(dstwidth, colors, bmpImage, h, srcbits);
 	    srcbits += linebytes;
@@ -327,6 +328,7 @@
 	    bits	 = srcbits;
 	}
     } else {
+	lines = -lines;
 	for (h = 0; h < lines; h++) {
 	    for (i = dstwidth/2, x = 0; i > 0; i--) {
 		BYTE pix = *bits++;
@@ -731,6 +733,7 @@
 	    bits = (srcbits += linebytes);
 	}
     } else {
+	lines = -lines;
 	for (h = 0; h < lines; h++) {
 	    for (x = 0; x < dstwidth; x++, bits += 4) {
 		XPutPixel( bmpImage, x, h,
diff -ur wine971130-clean/objects/gdiobj.c wine971130/objects/gdiobj.c
--- wine971130-clean/objects/gdiobj.c	Sun Nov 16 09:32:05 1997
+++ wine971130/objects/gdiobj.c	Mon Dec  1 22:47:51 1997
@@ -442,6 +442,7 @@
 	  result = FONT_GetObject32A( (FONTOBJ *)ptr, count, buffer );
 	  break;
       case PALETTE_MAGIC:
+      default:
           fprintf( stderr, "GetObject32: magic %04x not implemented\n",
                    ptr->wMagic );
           break;
diff -ur wine971130-clean/objects/metafile.c wine971130/objects/metafile.c
--- wine971130-clean/objects/metafile.c	Sat Nov  1 11:06:37 1997
+++ wine971130/objects/metafile.c	Mon Dec  1 22:47:51 1997
@@ -650,6 +650,8 @@
             dxx = (LPINT16)(sot+(((s1+1)>>1)*2));	   
           else 
 	  {
+	   dprintf_metafile(stddeb,"EXTTEXTOUT: %s  len: %ld\n",
+             sot,mr->rdSize);
            fprintf(stderr,
 	     "Please report: PlayMetaFile/ExtTextOut len=%ld slen=%d rdSize=%ld opt=%04x\n",
 		   len,s1,mr->rdSize,mr->rdParam[3]);
diff -ur wine971130-clean/objects/pen.c wine971130/objects/pen.c
--- wine971130-clean/objects/pen.c	Sun Aug 24 08:49:06 1997
+++ wine971130/objects/pen.c	Mon Dec  1 22:47:51 1997
@@ -73,6 +73,32 @@
     return hpen;
 }
 
+/***********************************************************************
+ *           ExtCreatePen    (GDI32.93)
+ *
+ * FIXME: PS_USERSTYLE not handled
+ */
+
+HPEN32 WINAPI ExtCreatePen32( DWORD style, DWORD width,
+			      const LOGBRUSH32 * brush, DWORD style_count,
+			      LPDWORD style_bits )
+{
+    LOGPEN32 logpen;
+
+    if ((style & PS_ALL_STYLES) == PS_USERSTYLE) {
+	fprintf(stderr, "ExtCreatePen32: PS_USERSTYLE not handled\n");
+    }
+    if ((style & PS_ALL_TYPES) == PS_GEOMETRIC) {
+	if (brush->lbHatch) {
+	    fprintf(stderr, "ExtCreatePen32: Hatches not implemented\n");
+	}
+    }
+    logpen.lopnStyle = style &~ (PS_ALL_TYPES);
+    logpen.lopnWidth.x = (style & PS_GEOMETRIC) ? width : 1;
+    logpen.lopnWidth.y = 0;
+    logpen.lopnColor = brush->lbColor;
+    return CreatePenIndirect32( &logpen );
+}
 
 /***********************************************************************
  *           PEN_GetObject16
diff -ur wine971130-clean/objects/text.c wine971130/objects/text.c
--- wine971130-clean/objects/text.c	Sun Nov 30 09:41:54 1997
+++ wine971130/objects/text.c	Mon Dec  1 22:47:51 1997
@@ -655,8 +655,10 @@
 INT32 WINAPI GetTextCharsetInfo(HDC32 hdc,LPCHARSETINFO csi,DWORD flags)
 {
     fprintf(stdnimp,"GetTextCharsetInfo(0x%x,%p,%08lx), stub!\n",hdc,csi,flags);
-    csi->ciCharset = DEFAULT_CHARSET;
-    csi->ciACP = GetACP();
+    if (csi) {
+	csi->ciCharset = DEFAULT_CHARSET;
+	csi->ciACP = GetACP();
+    }
     /* ... fill fontstruct too ... */
     return DEFAULT_CHARSET;
 }
diff -ur wine971130-clean/scheduler/process.c wine971130/scheduler/process.c
--- wine971130-clean/scheduler/process.c	Sun Nov 30 09:41:58 1997
+++ wine971130/scheduler/process.c	Mon Dec  1 22:47:51 1997
@@ -658,6 +658,7 @@
 				ret = GetEnvironmentVariable32A(x,d,cursize-(d-xdst));
 				if (ret) {
 					d+=strlen(d);
+					s=end;
 				} else {
 					CHECK_FREE(strlen(x)+2);
 					*d++='%';
@@ -667,9 +668,9 @@
 				}
 				HeapFree(heap,0,x);
 			} else
-				*d=*s;
+				*d++=*s;
 
-			s++;d++;
+			s++;
 		} else {
 			CHECK_FREE(1);
 			*d++=*s++;
diff -ur wine971130-clean/win32/code_page.c wine971130/win32/code_page.c
--- wine971130-clean/win32/code_page.c	Sun Nov 16 09:32:12 1997
+++ wine971130/win32/code_page.c	Mon Dec  1 22:47:51 1997
@@ -85,54 +85,82 @@
 /***********************************************************************
  *              MultiByteToWideChar                (KERNEL32.392)
  */
-int WINAPI MultiByteToWideChar(UINT32 page, DWORD flags, char *src, int srclen,
+int WINAPI MultiByteToWideChar(UINT32 page, DWORD flags,
+			       const char *src, int srclen,
                                WCHAR *dst, int dstlen)
 {
+    int ret;
+
     if (srclen == -1)
-   	 srclen = lstrlen32A(src)+1;
+	srclen = lstrlen32A(src)+1;
     if (!dstlen || !dst)
-         return srclen;
+	return srclen;
 
-    lstrcpynAtoW(dst,src,srclen); /* FIXME */
-    return srclen-1;
+    ret = srclen;
+    while (srclen > 0 && dstlen > 0) {
+	*dst = (WCHAR)(unsigned char)*src;
+	if (!*src)
+	    return ret;
+	dst++;    src++;
+	dstlen--; srclen--;
+    }
+    if (dstlen == 0) {
+	SetLastError(ERROR_INSUFFICIENT_BUFFER);
+	return 0;
+    }
+    return ret;
 }
 
 int WINAPI WideCharToMultiByte(UINT32 page, DWORD flags, WCHAR *src, int srclen,
                                char *dst, int dstlen, char* defchar, BOOL32 *used)
 {
-	int count = 0;
-	int dont_copy= (dstlen==0);
-	if(page!=GetACP() && page!=CP_OEMCP && page!=CP_ACP)
-		fprintf(stdnimp,"Conversion in CP %d not supported\n",page);
+    int count = 0;
+    int eos = 0;
+    int dont_copy= (dstlen==0);
+    if (page!=GetACP() && page!=CP_OEMCP && page!=CP_ACP)
+	fprintf(stdnimp,"Conversion in CP %d not supported\n",page);
 #if 0
-	if(flags)
-		fprintf(stdnimp,"WideCharToMultiByte flags %lx not supported\n",flags);
+    if (flags)
+	fprintf(stdnimp,"WideCharToMultiByte flags %lx not supported\n",flags);
 #endif
-	if(used)
-		*used=0;
-	while(srclen && (dont_copy || dstlen))
-	{
-		if(!dont_copy){
-			if(*src<256)
-				*dst = *src;
-			else
-			{
-				/* FIXME: Is this correct ?*/
-				if(flags & WC_DEFAULTCHAR){
-					*dst = defchar ? *defchar : '?';
-					if(used)*used=1;
-				}
-			}
-			dstlen--;
-			dst++;
-		}
-		count++;
-		if(!*src)
-			break;
-		if(srclen!=-1)srclen--;
-		src++;
+    if(used)
+	*used=0;
+    if (srclen == -1)
+	srclen = lstrlen32W(src)+1;
+    while(srclen && (dont_copy || dstlen))
+    {
+	if(!dont_copy){
+	    if(*src<256)
+		*dst = *src;
+	    else
+	    {
+		/* ??? The WC_DEFAULTCHAR flag only gets used in
+		 * combination with the WC_COMPOSITECHECK flag or at
+		 * least this is what it seems from using the function
+		 * on NT4.0 in combination with reading the documentation.
+		 */
+		*dst = defchar ? *defchar : '?';
+		if(used)*used=1;
+	    }
+	    dstlen--;
+	    dst++;
 	}
+	count++;
+	srclen--;
+	if(!*src) {
+	    eos = 1;
+	    break;
+	}
+	src++;
+    }
+    if (dont_copy)
 	return count;
+
+    if (!eos && srclen > 0) {
+	SetLastError(ERROR_INSUFFICIENT_BUFFER);
+	return 0;
+    }
+    return count;
 }
 
 
diff -ur wine971130-clean/win32/environment.c wine971130/win32/environment.c
--- wine971130-clean/win32/environment.c	Sun Oct 12 09:16:15 1997
+++ wine971130/win32/environment.c	Mon Dec  1 22:47:51 1997
@@ -29,9 +29,9 @@
  */
 LPCWSTR WINAPI GetCommandLine32W(void)
 {
-    static WCHAR buffer[256];
+    static WCHAR buffer[1024];
 
-    lstrcpynAtoW(buffer,GetCommandLine32A(),256);
+    lstrcpynAtoW(buffer,GetCommandLine32A(),1024);
     return buffer;
 }
 
diff -ur wine971130-clean/windows/message.c wine971130/windows/message.c
--- wine971130-clean/windows/message.c	Sun Nov 30 09:42:01 1997
+++ wine971130/windows/message.c	Mon Dec  1 22:47:51 1997
@@ -1136,7 +1136,7 @@
     WND **list, **ppWnd;
     LRESULT ret;
 
-    if (hwnd == HWND_BROADCAST)
+    if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST)
     {
         if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
             return TRUE;
@@ -1187,7 +1187,7 @@
     WND **list, **ppWnd;
     LRESULT ret;
 
-    if (hwnd == HWND_BROADCAST)
+    if (hwnd == HWND_BROADCAST || hwnd == HWND_TOPMOST)
     {
         if (!(list = WIN_BuildWinArray( WIN_GetDesktop(), 0, NULL )))
             return TRUE;
