Release 980927

Sun Sep 27 14:25:38 1998  Petter Reinholdtsen <pere@td.org.uit.no>

	* [files/drive.c]
	Make sure GetDriveType32A() handles param NULL.  Added some
	doc on function.

Sun Sep 27 14:07:26 1998  Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>

	* [controls/edit.c] [windows/win.c]
	Don't call SetWindowLong() in EDIT_WM_NCREATE.
	Fix SetWindowLong(GWL_[EX]STYLE) to work for 16bit windows. Remove
	UpdateWindow() call. 

Sun Sep 27 13:41:22 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [scheduler/*.c] [server/event.c] [server/mutex.c]
	  [server/semaphore.c]
	Implemented server-side synchronisation objects.

Sun Sep 27 01:13:35 1998  Alex Priem <alexp@sci.kun.nl>

	* [dlls/comctl32/treeview.c] [include/treeview.h] [include/comctl.h]
	Treeview implementation.

	* [dlls/comctl32/trackbar.c] [include/trackbar.h] 
	Trackbar implementation.

Sat Sep 26 20:49:13 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [if1632/thunk.c] [tools/build.c] [win32/kernel32.c]
	Bugfix: several problems with flat thunks fixed.

	* [memory/selector.c]
	Bugfix: IsBad...Ptr16 didn't work for limit_in_pages segments.

	* [scheduler/thread.c]
	Bugfix: CreateThread: Allow id parameter == NULL.

	* [objects/gdiobj.c]
	Bugfix: IsGDIObject: Return correct object type for stock objects.

	* [msdos/dpmi.c]
	Bugfix: fixed typo in INT_DoRealModeInt.

	* [msdos/int21.c]
	Bugfix: int21 READ *must* use WIN16_hread, not _hread16.

	* [if1632/kernel.spec] [if1632/dummy.c] [if1632/thunk.c]
	  [loader/ne/module.c] [scheduler/event.c] [scheduler/synchro.c]
	  [scheduler/thread.c] [win32/kernel32.c] [win32/ordinals.c]
	Added names/stubs for all undocumented KERNEL routines (Win95).
	Added the following undoc. 16-bit equivalents to Win32 routines:
	KERNEL.441-443,449-453,456-462,471-476,479-486,488.
	Added stubs for some other KERNEL routines.

	* [memory/heap.c] [memory/global.c] [include/global.h]
	Implemented Local32... 32-bit local heap routines (KERNEL.208-215, 229).

	* [miscemu/instr.c] [loader/module.c] [include/module.h]
	Implemented __GP fault handling and HasGPHandler (KERNEL.338).

	* [misc/error.c]
	Implemented LogParamErrorRegs (KERNEL.327).

	* [loader/task.c] [include/windows.h]
	Implemented GetCodeInfo (KERNEL.104).

	* [loader/task.c] [scheduler/thread.c] [include/thread.h]
	Implemented [GS]etThreadQueue and [GS]etFastQueue (KERNEL.463/4, 624/5).

	* [if1632/gdi.spec] [objects/dc.c] [objects/dib.c]
	  [objects/bitmap.c] [include/windows.h]
	Bugfix: fixed wrong parameter for CreateDIBSection16.
	Added [GS]etDIBColorTable16, stub for GetBoundsRect16.
	Partially implemented BITMAP_GetObject16 for DIBs.

	* [if1632/gdi.spec] [relay32/gdi32.spec] [objects/palette.c]
	Added some GDI stubs.

	* [if1632/Makefile.in] [if1632/display.spec] [if1632/mouse.spec]
	  [if1632/keyboard.spec] [if1632/builtin.c] [windows/keyboard.c]
	Added some stubs for Win16 drivers: KEYBOARD, MOUSE, DISPLAY.

	* [if1632/wprocs.spec] [msdos/vxd.c]
	Added some stubs for VxDs: VMM, ConfigMG, TimerAPI.

	* [msdos/int2f.c]
	Added some stubs for real-mode network drivers.

Sat Sep 26 18:18:18 1998  Marcus Meissner <marcus@jet.franken.de>

	* [configure.in]
	Merged in some more of the FreeBSD ports/emulators/wine patches. 
	(Maintainer(s) of this port: You can just submit these
	patches to Alexandre directly.)

	 * [loader/pe_image.c]
	Check filesize of image against size derived from header
	to spot truncated executeables without crashing.

	* [files/directory.c]
	Set envvar "COMSPEC". One win32(!!) program crashes without it.

	* [multimedia/mmio.c]
	Added mmioSetInfo32.

	* [include/file.h]
	Return STD_ERROR_HANDLE for AUX and PRT dos handles.

	* [loader/module.c]
	Handle executeables with spaces in their names a bit better in
	CreateProcess.

	* [relay32/msvfw32.spec][if1632/msvideo.spec][multimedia/msvideo.c][include/vfw.h]
	Started on MS Video support (can load Win32 ICMs).

	* [tools/testrun]
	A bit smarter use of ps.

	* [memory/virtual.c]
	Report PAGE_GUARDed pages as PAGE_PROTECTED (AutoCAD LT R17 fails
	without that check (since Win95 doesn't know about PAGE_GUARD)).

Sat Sep 26 15:04:05 1998  Ove Kaaven <ovek@arcticnet.no>

	* [include/miscemu.h] [if1632/builtin.c] [loader/task.c]
	  [miscemu/instr.c] [msdos/dpmi.c] [msdos/int21.c]
	  [msdos/interrupts.c] [windows/user.c]
	INT_[S|G]etHandler was renamed to INT_[S|G]etPMHandler.
	Added handlers to deal with real-mode interrupts; DOS
	programs are now able to hook real-mode interrupts.

	* [loader/dos/module.c] [msdos/dosmem.c] [msdos/int21.c]
	Moved real-mode interrupt table initialization to
	msdos/dosmem.c, and made new V86 tasks get a full copy
	of the existing "system memory" instead of almost empty
	space. Misc fixes.

	* [include/dosexe.h] [loader/dos/module.c] [msdos/dpmi.c]
	  [msdos/int2f.c]
	First shot at letting DOS programs start up DPMI (but DPMI
	is still disabled for DOS programs, for pkunzip's sake).

	* [include/debugger.h] [debugger/break.c] [debugger/dbg.y]
	  [debugger/registers.c] [debugger/memory.c] [debugger/info.c]
	  [loader/dos/dosvm.c]
	First shot at making Wine's debugger work for DOS programs.
	The -debug flag works, as do "nexti" and "stepi".

Sat Sep 26 13:13:13 1998  Juergen Schmied <juergen.schmied@metronet.de>

	* [dlls/shell32/dataobject.c]
	New classes IEnumFORMATETC implemented, IDataObject stubs.
	
	* [dlls/shell32/*.*][relay32/shell32.spec]
	Bugfixes.
	New: ICM_InsertItem(), ILCreateFromPath().
	Implemented: ILCloneFirst().
	Stubs: ILIsEqual(), ILFindChild(), SHLogILFromFSIL(),
	  PathMatchSpec(), PathIsExe().
	Changed: ILGetSize(), _ILIsDesktop(), PathCombine().

	* [include/shlobj.h]
	New SHLGUID's
	New structures: DVTARGETDEVICE32, STGMEDIUM32, FORMATETC32,
	CLIPFORMAT32.
	New interfaces: IEnumFORMATETC, IDataObject, ICommDlgBrowser
	IDockingWindowFrame, IServiceProvider.

	* [dlls/shell32/folders.c]
	Stubs for IShellLink.

	* [loader/resource.c]
	Small fixes.

	* [misc/crtdll.c][relay32/crtdll.spec]
	New __dllonexit().

	* [windows/message.c]
	SendNotifyMessageA, SendMessageCallBack32A half implemented.

	* [controls/edit.c]
	EDIT_WM_SetText set EF_UPDATE flag not for ES_MULTILINE.

	* [files/file.c]
	Handling of fileposition fixed.

Fri Sep 25 18:13:30 1998  Patrik Stridvall <ps@leissner.se>

	* [include/windows.h] [include/wintypes.h]
	  [ole/ole2nls.h] [relay32/kernel32.spec]
	Implemented EnumDateFormats and EnumTimeFormats.
	Only adds US English support.

	* [Makefile.in] [configure.in] 
	  [dlls/Makefile.in] [dlls/psapi/Makefile.in] 
	  [dlls/psapi/psapi_main.c] 
	New files to implement stubs for PSAPI.DLL (NT only).

	* [relay32/Makefile.in] [relay32/builtin32.c] 
	  [relay32/psapi.spec]
	New spec file for PSAPI.DLL (NT only).

	* [scheduler/handle.c]
	HANDLE_GetObjPtr should only interpret the pseudo handles as the
	current thread or the current process if a thread or a process is
	requested.

	* [include/winversion.h] [misc/version.c]
	Adds the global function VERSION_GetVersion() so functions can
	have different behavior depending on the -winver flag.

	* [include/oledlg.h] [ole/oledlg.c]
	Minor fixes. 

	* [windows/winproc.c]
	Minor changes.

	* [include/imm.h] [misc/imm.c]
	Now returns correct values under both Windows 95 and NT 4.0.

Thu Sep 24 22:11:44 1998  Kristian Nielsen  <kristian.nielsen@risoe.dk>

	* [configure.in] [include/acconfig.h] [include/thread.h]
	  [scheduler/sysdeps.c]
	Autoconfig test for non-reentrant libc.

Wed Sep 23 19:52:12 1998  Matthew Becker <mbecker@glasscity.net>

	* [*/*.c]
	Miscellaneous documentation updates and debugging output 
	standardizations.

	* [objects/clipping.c]
	Added ExtSelectClipRgn.

Wed Sep 23 00:03:28 EDT 1998  Pete Ratzlaff <pratzlaff@cfa.harvard.edu>

	* [include/windows.h] [if1632/user.spec] [relay32/user32.spec]
	  [windows/keyboard.c]
	Added, marginally implemented, GetKeyboardLayoutName().
	Only returns US English keyboard name.

Tue Sep 22 16:32:41 1998  Marcel Baur <mbaur@iiic.ethz.ch>

	* [programs/control/*]
	New Winelib application.

Mon Sep 21 00:29:18 1998  Peter Hunnisett <hunnise@nortel.ca>

	* [include/dplay.h][multimedia/dplay.c][ole/compobj.c]
	Added all DirectPlayLobby interfaces and enhanced DirectPlay
	and DirectPlayLobby support. Still not all that much. Useful
	enough if you just need to start a program, don't try any
	real dplay/lobby stuff.

	* [documentation/status/directplay]
	Added a very little bit.

	* [graphics/ddraw.c]
	- Call to SetWindowLong32A wasn't working because there was no
	  memory set aside when the window class was registered.
	- Fixed some xlib reference counting and change the behaviour
	  of DirectDrawSurface3_SetPalette to mimic observed behaviour
	  (palette is associated will all backbuffers)
	- Also stored all palette colour fields and spit back our saved
	  colour fields rather than query X for them.
	- Added plenty of AddRef and Release traces.
	- Added Xlib support for using -desktop option.
	- Fixed Xlib message handling. Messages weren't being passed to
	  the application. Fixes mouse movements in some xlib DDraw games.
	- Added a few stubs.

	* [windows/win.c][include/winerror.h]
	Fixed up some error handling in WIN_SetWindowLong. SetLastError
	wasn't being used. Could cause problems with 0 return codes.
	Added new error in winerror (1400).

	* [AUTHORS] [include/authors.h]
	Added myself as a Wine author.

Sun Sep 20 21:22:44 1998  Alexander Larsson  <alla@lysator.liu.se>

	* [loader/module.c]
	Changed GetModuleFileName32A so that is returns the
	long version of the filename. Note that just the name
	is long, not the directories.

Sat Sep 19 20:05:30 1998 Per Ångström <pang@mind.nu> 

	* [controls/menu.c]
	Made a couple of fixes to make life easier for applications that alter
	their menus at runtime.

	* [windows/defdlg.c]
	Removed the cast of the return value from dialog procedures to a 16-bit
	bool. The return value needs to retain all its 32 bits, since it is not 
	always a bool, such as when responding to the WM_NCHITTEST message.

Fri Sep 18 11:30:38 1998  Sergey Turchanov <turchanov@usa.net>

	* [loader/resource.c]
	Fixed very funny bug (though gravely affecting further excecution)
	with FindResource[Ex]32 functions.

	* [include/multimon.h] [windows/multimon.c] [relay32/user32.spec]
	  [include/windows.h] [windows/sysmetrics.c]
	Default implementation for Multimonitor API.

	* [include/windows.h] [windows/winpos.c]
	Fixed incorrect declaration (and behaviour) of GetWindowRect32.

Wed Sep 16 10:21:15 1998  Gerard Patel <G.Patel@Wanadoo.fr>

	* [controls/edit.c]
	Fixed EDIT_EM_GetLine to use correctly length of lines.

Tue Sep 15 20:40:16 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [misc/tweak.c][include/tweak.h][controls/menu.c]
	Replaced the tweak graphic routines by calls to DrawEdge32().

	* [misc/tweak.c][include/tweak.h][documentation/win95look]
	  [wine.ini][*/*]
	Changed "look and feel" selection. Allows Win3.1, Win95 and
	Win98 (no GUI code implemented) look and feel.

	* [dlls/comctl32/header.c][include/header.h][include/commctrl.h]
	Started callback item support and did some minor improvements.

	* [dlls/comctl32/imagelist.c]
	Fixed bug in transparent image display.
	ImageList_GetIcon is still buggy :-(

	* [dlls/comctl32/toolbar.c]
	Fixed button drawing (partial hack).

	* [dlls/comctl32/commctrl.c]
	Fixed MenuHelp().

	* [controls/button.c]
	Added 3d effect for groupbox.

	* [windows/msgbox.c]
	Added font support for message boxes.

	* [windows/nonclient.c]
	Fixed window moving bug.

	* [dlls/comctl32/*.c]
	Various improvements.

	* [dlls/comctl32/listview.c][dlls/comctl32/rebar.c]
	  [include/commctrl.h]
	More messages.

	* [windows/syscolor.c][include/windows.h]
	Introduced new Win98 system colors.

Tue Sep 15 18:29:45 1998 Wesley Filardo <eightknots@aol.com>

	* [files/profile.c]
	Added support in PROFILE_LoadWineIni for -config option

	* [misc/main.c] [include/options.h]
	Added -config option.

Tue Sep 15 18:22:26 1998  Petter Reinholdtsen <pere@td.org.uit.no>

	* [documentation/Makefile.in]
	Make sure directory exists before installing into it.

Tue Sep 15 01:47:33 1998  Pablo Saratxaga <pablo.sarachaga@ping.be>

	* [ole/nls/*] [ole/ole2nls.c] [include/winnls.h]
	Fixed a few errors and completed some NLS files.

Mon Sep 14 01:23:45 1998  Joseph Pranevich <knight@baltimore.wwaves.com>

	* [include/miscemu.h] [msdos/interrupts.c]
	Removed a compilation warning, added INT 25 to the list of interrupts
	callable from DOS applications, added a debug message when unsupported
	interrupts are used.

Sun Sep 13 19:55:22 1998  Lawson Whitney <lawson_whitney@juno.com>

	* [if1632/relay.c]
	CallProcEx32W should not reverse arguments.

Sun Aug 17 21:18:12 1998  Eric Pouech  <eric.pouech@lemel.fr>

	* [multimedia/midi.c] [multimedia/init.c] [multimedia/mmsys.c] 
	  [include/multimedia.h] [include/mmsystem.h] 
	  [multimedia/Makefile.in] [multimedia/midipatch.c]
	  [if1632/multimedia.spec]
	Made MIDI input and output functional on OSS capable systems.

	* [multimedia/timer.c]
	Changes to trigger callbacks at the accurate pace even when
	fake timers are used.
diff --git a/misc/Makefile.in b/misc/Makefile.in
index bc5f783..2ab8f54 100644
--- a/misc/Makefile.in
+++ b/misc/Makefile.in
@@ -6,7 +6,6 @@
 MODULE    = misc
 
 C_SRCS = \
-	aspi.c \
 	callback.c \
 	comm.c \
 	commdlg.c \
diff --git a/misc/aspi.c b/misc/aspi.c
deleted file mode 100644
index e4592a9..0000000
--- a/misc/aspi.c
+++ /dev/null
@@ -1,516 +0,0 @@
-#include <stdlib.h>
-#include <sys/types.h>
-#include <sys/stat.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <ldt.h>
-#include <memory.h>
-#include <unistd.h>
-#include <callback.h>
-#include "windows.h"
-#include "aspi.h"
-#include "options.h"
-#include "heap.h"
-#include "debug.h"
-#include "selectors.h"
-#include "module.h"
-#include "miscemu.h"
-
-
-/* FIXME!
- * 1) Residual byte length reporting not handled
- * 2) Make this code re-entrant for multithreading
- * 3) Only linux supported so far
- */
-
-#ifdef linux
-
-/* This is a duplicate of the sg_header from /usr/src/linux/include/scsi/sg.h
- * kernel 2.0.30
- * This will probably break at some point, but for those who don't have
- * kernels installed, I think this should still work.
- *
- */
-
-struct sg_header
- {
-  int pack_len;    /* length of incoming packet <4096 (including header) */
-  int reply_len;   /* maximum length <4096 of expected reply */
-  int pack_id;     /* id number of packet */
-  int result;      /* 0==ok, otherwise refer to errno codes */
-  unsigned int twelve_byte:1; /* Force 12 byte command length for group 6 & 7 commands  */
-  unsigned int other_flags:31;			/* for future use */
-  unsigned char sense_buffer[16]; /* used only by reads */
-  /* command follows then data for command */
- };
-
-#define SCSI_OFF sizeof(struct sg_header)
-#endif
-
-#define ASPI_POSTING(prb) (prb->SRB_Flags & 0x1)
-
-#define HOST_TO_TARGET(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x2)
-#define TARGET_TO_HOST(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x1)
-#define NO_DATA_TRANSFERED(prb) (((prb->SRB_Flags>>3) & 0x3) == 0x3)
-
-#define SRB_ENABLE_RESIDUAL_COUNT 0x4
-
-#define INQUIRY_VENDOR		8
-
-#define MUSTEK_SCSI_AREA_AND_WINDOWS 0x04
-#define MUSTEK_SCSI_READ_SCANNED_DATA 0x08
-#define MUSTEK_SCSI_GET_IMAGE_STATUS 0x0f
-#define MUSTEK_SCSI_ADF_AND_BACKTRACE 0x10
-#define MUSTEK_SCSI_CCD_DISTANCE 0x11
-#define MUSTEK_SCSI_START_STOP 0x1b
-
-#define CMD_TEST_UNIT_READY 0x00
-#define CMD_REQUEST_SENSE 0x03
-#define CMD_INQUIRY 0x12
-
-/* scanner commands - just for debug */
-#define CMD_SCAN_GET_DATA_BUFFER_STATUS 0x34
-#define CMD_SCAN_GET_WINDOW 0x25
-#define CMD_SCAN_OBJECT_POSITION 0x31
-#define CMD_SCAN_READ 0x28
-#define CMD_SCAN_RELEASE_UNIT 0x17
-#define CMD_SCAN_RESERVE_UNIT 0x16
-#define CMD_SCAN_SCAN 0x1b
-#define CMD_SCAN_SEND 0x2a
-#define CMD_SCAN_CHANGE_DEFINITION 0x40
-
-#define INQURIY_CMDLEN 6
-#define INQURIY_REPLY_LEN 96
-#define INQUIRY_VENDOR 8
-
-#define SENSE_BUFFER(prb) (&prb->CDBByte[prb->SRB_CDBLen])
-
-
-/* Just a container for seeing what devices are open */
-struct ASPI_DEVICE_INFO {
-    struct ASPI_DEVICE_INFO *	next;
-    int				fd;
-    int				hostId;
-    int				target;
-    int				lun;
-};
-
-typedef struct ASPI_DEVICE_INFO ASPI_DEVICE_INFO;
-static ASPI_DEVICE_INFO *ASPI_open_devices = NULL;
-
-static BOOL16 DOSASPI = FALSE;
-
-#ifdef linux
-static int
-ASPI_OpenDevice16(SRB_ExecSCSICmd16 *prb)
-{
-    int	fd;
-    char	idstr[20];
-    char	device_str[50];
-    ASPI_DEVICE_INFO *curr;
-
-    /* search list of devices to see if we've opened it already.
-     * There is not an explicit open/close in ASPI land, so hopefully
-     * keeping a device open won't be a problem.
-     */
-
-    for (curr = ASPI_open_devices; curr; curr = curr->next) {
-	if (curr->hostId == prb->SRB_HaId &&
-	    curr->target == prb->SRB_Target &&
-	    curr->lun == prb->SRB_Lun) {
-	    return curr->fd;
-	}
-    }
-
-    /* device wasn't cached, go ahead and open it */
-    sprintf(idstr, "scsi c%1dt%1dd%1d", prb->SRB_HaId, prb->SRB_Target, prb->SRB_Lun);
-
-    if (!PROFILE_GetWineIniString(idstr, "Device", "", device_str, sizeof(device_str))) {
-	TRACE(aspi, "Trying to open unlisted scsi device %s\n", idstr);
-	return -1;
-    }
-
-    TRACE(aspi, "Opening device %s=%s\n", idstr, device_str);
-
-    fd = open(device_str, O_RDWR);
-    if (fd == -1) {
-	int save_error = errno;
-	WARN(aspi, "Error opening device errno=%d\n", save_error);
-	return -1;
-    }
-
-    /* device is now open */
-    curr = HeapAlloc( SystemHeap, 0, sizeof(ASPI_DEVICE_INFO) );
-    curr->fd = fd;
-    curr->hostId = prb->SRB_HaId;
-    curr->target = prb->SRB_Target;
-    curr->lun = prb->SRB_Lun;
-
-    /* insert new record at beginning of open device list */
-    curr->next = ASPI_open_devices;
-    ASPI_open_devices = curr;
-    return fd;
-}
-
-
-static void
-ASPI_DebugPrintCmd16(SRB_ExecSCSICmd16 *prb)
-{
-  BYTE	cmd;
-  int	i;
-  BYTE *cdb;
-  BYTE *lpBuf;
-  dbg_decl_str(aspi, 512);
-
-  if ((DOSASPI) && (prb->SRB_BufPointer)) /* translate real mode address */
-    lpBuf = (BYTE *)DOSMEM_MapRealToLinear((UINT32)prb->SRB_BufPointer);
-  else
-    lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer);
-
-  switch (prb->CDBByte[0]) {
-  case CMD_INQUIRY:
-    TRACE(aspi, "{\n");
-    TRACE(aspi, "\tEVPD: %d\n", prb->CDBByte[1] & 1);
-    TRACE(aspi, "\tLUN: %d\n", (prb->CDBByte[1] & 0xc) >> 1);
-    TRACE(aspi, "\tPAGE CODE: %d\n", prb->CDBByte[2]);
-    TRACE(aspi, "\tALLOCATION LENGTH: %d\n", prb->CDBByte[4]);
-    TRACE(aspi, "\tCONTROL: %d\n", prb->CDBByte[5]);
-    TRACE(aspi, "}\n");
-    break;
-  case CMD_SCAN_SCAN:
-    TRACE(aspi, "Transfer Length: %d\n", prb->CDBByte[4]);
-    break;
-  }
-
-  TRACE(aspi, "Host Adapter: %d\n", prb->SRB_HaId);
-  TRACE(aspi, "Flags: %d\n", prb->SRB_Flags);
-  if (TARGET_TO_HOST(prb)) {
-    TRACE(aspi, "\tData transfer: Target to host. Length checked.\n");
-  }
-  else if (HOST_TO_TARGET(prb)) {
-    TRACE(aspi, "\tData transfer: Host to target. Length checked.\n");
-  }
-  else if (NO_DATA_TRANSFERED(prb)) {
-    TRACE(aspi, "\tData transfer: none\n");
-  }
-  else {
-    WARN(aspi, "\tTransfer by scsi cmd. Length not checked\n");
-  }
-
-  TRACE(aspi, "\tResidual byte length reporting %s\n", prb->SRB_Flags & 0x4 ? "enabled" : "disabled");
-  TRACE(aspi, "\tLinking %s\n", prb->SRB_Flags & 0x2 ? "enabled" : "disabled");
-  TRACE(aspi, "\tPosting %s\n", prb->SRB_Flags & 0x1 ? "enabled" : "disabled");
-  TRACE(aspi, "Target: %d\n", prb->SRB_Target);
-  TRACE(aspi, "Lun: %d\n", prb->SRB_Lun);
-  TRACE(aspi, "BufLen: %ld\n", prb->SRB_BufLen);
-  TRACE(aspi, "SenseLen: %d\n", prb->SRB_SenseLen);
-  TRACE(aspi, "BufPtr: %lx (%p)\n", prb->SRB_BufPointer, lpBuf);
-  TRACE(aspi, "LinkPointer %lx\n", prb->SRB_Rsvd1);
-  TRACE(aspi, "CDB Length: %d\n", prb->SRB_CDBLen);
-  TRACE(aspi, "POST Proc: %lx\n", (DWORD) prb->SRB_PostProc);
-  cdb = &prb->CDBByte[0];
-  cmd = prb->CDBByte[0];
-  for (i = 0; i < prb->SRB_CDBLen; i++) {
-    if (i != 0) dsprintf(aspi, ",");
-    dsprintf(aspi, "%02x", *cdb++);
-  }
-  TRACE(aspi, "CDB buffer[%s]\n", dbg_str(aspi));
-}
-
-static void
-PrintSenseArea16(SRB_ExecSCSICmd16 *prb)
-{
-  int	i;
-  BYTE *cdb;
-  dbg_decl_str(aspi, 512);
-
-  cdb = &prb->CDBByte[0];
-  for (i = 0; i < prb->SRB_SenseLen; i++) {
-    if (i) dsprintf(aspi, ",");
-    dsprintf(aspi, "%02x", *cdb++);
-  }
-  TRACE(aspi, "SenseArea[%s]\n", dbg_str(aspi));
-}
-
-static void
-ASPI_DebugPrintResult16(SRB_ExecSCSICmd16 *prb)
-{
-  BYTE *lpBuf;
-
-  if ((DOSASPI) && (prb->SRB_BufPointer)) /* translate real mode address */
-    lpBuf = (BYTE *)DOSMEM_MapRealToLinear((UINT32)prb->SRB_BufPointer);
-  else
-    lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer);
-
-  switch (prb->CDBByte[0]) {
-  case CMD_INQUIRY:
-    TRACE(aspi, "Vendor: %s\n", lpBuf + INQUIRY_VENDOR);
-    break;
-  case CMD_TEST_UNIT_READY:
-    PrintSenseArea16(prb);
-    break;
-  }
-}
-
-static WORD
-ASPI_ExecScsiCmd16(SRB_ExecSCSICmd16 *prb, SEGPTR segptr_prb)
-{
-  struct sg_header *sg_hd, *sg_reply_hdr;
-  int	status;
-  BYTE *lpBuf;
-  int	in_len, out_len;
-  int	error_code = 0;
-  int	fd;
-
-  ASPI_DebugPrintCmd16(prb);
-
-  fd = ASPI_OpenDevice16(prb);
-  if (fd == -1) {
-      WARN(aspi, "ASPI_ExecScsiCmd16 failed: could not open device.\n");
-      prb->SRB_Status = SS_ERR;
-      return SS_ERR;
-  }
-
-  sg_hd = NULL;
-  sg_reply_hdr = NULL;
-
-  prb->SRB_Status = SS_PENDING;
-  if ((DOSASPI) && (prb->SRB_BufPointer)) /* translate real mode address */
-    lpBuf = (BYTE *)DOSMEM_MapRealToLinear((UINT32)prb->SRB_BufPointer);
-  else
-    lpBuf = PTR_SEG_TO_LIN(prb->SRB_BufPointer);
-
-  if (!prb->SRB_CDBLen) {
-      WARN(aspi, "ASPI_ExecScsiCmd16 failed: prb->SRB_CDBLen = 0.\n");
-      prb->SRB_Status = SS_ERR;
-      return SS_ERR;
-  }
-
-  /* build up sg_header + scsi cmd */
-  if (HOST_TO_TARGET(prb)) {
-    /* send header, command, and then data */
-    in_len = SCSI_OFF + prb->SRB_CDBLen + prb->SRB_BufLen;
-    sg_hd = (struct sg_header *) malloc(in_len);
-    memset(sg_hd, 0, SCSI_OFF);
-    memcpy(sg_hd + 1, &prb->CDBByte[0], prb->SRB_CDBLen);
-    if (prb->SRB_BufLen) {
-      memcpy(((BYTE *) sg_hd) + SCSI_OFF + prb->SRB_CDBLen, lpBuf, prb->SRB_BufLen);
-    }
-  }
-  else {
-    /* send header and command - no data */
-    in_len = SCSI_OFF + prb->SRB_CDBLen;
-    sg_hd = (struct sg_header *) malloc(in_len);
-    memset(sg_hd, 0, SCSI_OFF);
-    memcpy(sg_hd + 1, &prb->CDBByte[0], prb->SRB_CDBLen);
-  }
-
-  if (TARGET_TO_HOST(prb)) {
-    out_len = SCSI_OFF + prb->SRB_BufLen;
-    sg_reply_hdr = (struct sg_header *) malloc(out_len);
-    memset(sg_reply_hdr, 0, SCSI_OFF);
-    sg_hd->reply_len = out_len;
-  }
-  else {
-    out_len = SCSI_OFF;
-    sg_reply_hdr = (struct sg_header *) malloc(out_len);
-    memset(sg_reply_hdr, 0, SCSI_OFF);
-    sg_hd->reply_len = out_len;
-  }
-
-  status = write(fd, sg_hd, in_len);
-  if (status < 0 || status != in_len) {
-      int myerror = errno;
-
-    WARN(aspi, "Not enough bytes written to scsi device bytes=%d .. %d\n", in_len, status);
-    if (status < 0) {
-	if (myerror == ENOMEM) {
-	    MSG("ASPI: Linux generic scsi driver\n  You probably need to re-compile your kernel with a larger SG_BIG_BUFF value (sg.h)\n  Suggest 130560\n");
-	}
-	WARN(aspi, "errno: = %d\n", myerror);
-    }
-    goto error_exit;
-  }
-
-  status = read(fd, sg_reply_hdr, out_len);
-  if (status < 0 || status != out_len) {
-    WARN(aspi, "not enough bytes read from scsi device%d\n", status);
-    goto error_exit;
-  }
-
-  if (sg_reply_hdr->result != 0) {
-    error_code = sg_reply_hdr->result;
-    WARN(aspi, "reply header error (%d)\n", sg_reply_hdr->result);
-    goto error_exit;
-  }
-
-  if (TARGET_TO_HOST(prb) && prb->SRB_BufLen) {
-    memcpy(lpBuf, sg_reply_hdr + 1, prb->SRB_BufLen);
-  }
-
-  /* copy in sense buffer to amount that is available in client */
-  if (prb->SRB_SenseLen) {
-    int sense_len = prb->SRB_SenseLen;
-    if (prb->SRB_SenseLen > 16)
-      sense_len = 16;
-    memcpy(SENSE_BUFFER(prb), &sg_reply_hdr->sense_buffer[0], sense_len);
-  }
-
-
-  prb->SRB_Status = SS_COMP;
-  prb->SRB_HaStat = HASTAT_OK;
-  prb->SRB_TargStat = STATUS_GOOD;
-
-  /* now do  posting */
-
-  if (ASPI_POSTING(prb) && prb->SRB_PostProc) {
-    TRACE(aspi, "Post Routine (%lx) called\n", (DWORD) prb->SRB_PostProc);
-    Callbacks->CallASPIPostProc(prb->SRB_PostProc, segptr_prb);
-  }
-
-  free(sg_reply_hdr);
-  free(sg_hd);
-  ASPI_DebugPrintResult16(prb);
-  return SS_COMP;
-  
-error_exit:
-  if (error_code == EBUSY) {
-      prb->SRB_Status = SS_ASPI_IS_BUSY;
-      TRACE(aspi, "Device busy\n");
-  }
-  else {
-      WARN(aspi, "ASPI_GenericHandleScsiCmd failed\n");
-      prb->SRB_Status = SS_ERR;
-  }
-
-  /* I'm not sure exactly error codes work here
-   * We probably should set prb->SRB_TargStat, SRB_HaStat ?
-   */
-  WARN(aspi, "ASPI_GenericHandleScsiCmd: error_exit\n");
-  free(sg_reply_hdr);
-  free(sg_hd);
-  return prb->SRB_Status;
-}
-#endif
-
-/***********************************************************************
- *             GetASPISupportInfo16   (WINASPI.1)
- */
-
-WORD WINAPI GetASPISupportInfo16()
-{
-#ifdef linux
-    TRACE(aspi, "GETASPISupportInfo\n");
-    /* high byte SS_COMP - low byte number of host adapters.
-     * FIXME!!! The number of host adapters is incorrect.
-     * I'm not sure how to determine this under linux etc.
-     */
-    return ((SS_COMP << 8) | 0x1);
-#else
-    return ((SS_COMP << 8) | 0x0);
-#endif
-}
-
-/***********************************************************************
- *             SendASPICommand16   (WINASPI.2)
- */
-
-WORD WINAPI SendASPICommand16(SEGPTR segptr_srb)
-{
-#ifdef linux
-  LPSRB16 lpSRB = PTR_SEG_TO_LIN(segptr_srb);
-
-  switch (lpSRB->common.SRB_cmd) {
-  case SC_HA_INQUIRY:
-    lpSRB->inquiry.SRB_Status = 0x1;           /* completed successfully */
-    lpSRB->inquiry.SRB_HaId = 1;               /* bogus value */
-    lpSRB->inquiry.HA_Count = 1;               /* not always */
-    lpSRB->inquiry.HA_SCSI_ID = 7;             /* not always ID 7 */
-    strcat(lpSRB->inquiry.HA_ManagerId, "Wine ASPI"); /* max 15 chars */
-    lpSRB->inquiry.SRB_55AASignature = 0x55aa; /* correct ??? */
-    lpSRB->inquiry.SRB_ExtBufferSize = 0x2000; /* bogus value */
-    FIXME(aspi, "ASPI: Partially implemented SC_HA_INQUIRY\n");
-    break;
-  case SC_GET_DEV_TYPE:
-    FIXME(aspi, "Not implemented SC_GET_DEV_TYPE\n");
-    break;
-  case SC_EXEC_SCSI_CMD:
-    return ASPI_ExecScsiCmd16(&lpSRB->cmd, segptr_srb);
-    break;
-  case SC_RESET_DEV:
-    FIXME(aspi, "Not implemented SC_RESET_DEV\n");
-    break;
-  default:
-    WARN(aspi, "Unknown command %d\n", lpSRB->common.SRB_cmd);
-  }
-  return SS_INVALID_SRB;
-#else
-  return SS_INVALID_SRB;
-#endif
-}
-
-/***********************************************************************
- *             GetASPIDLLVersion   (WINASPI.4)
- */
-
-DWORD WINAPI GetASPIDLLVersion()
-{
-#ifdef linux
-	return (DWORD)2;
-#else
-	return (DWORD)0;
-#endif
-}
-
-
-void WINAPI ASPI_DOS_func(DWORD srb)
-{
-       LPSRB16 lpSRB = (LPSRB16)DOSMEM_MapRealToLinear(srb);
-       SEGPTR spSRB = MapLS(lpSRB);
-
-       TRACE(aspi, "DOSASPI: function #%d\n", lpSRB->common.SRB_cmd);
-       DOSASPI = TRUE;
-       SendASPICommand16(spSRB);
-       DOSASPI = FALSE;
-       UnMapLS(spSRB);
-}
-
-
-/* returns a real mode call address to ASPI_DOS_func() */
-void ASPI_DOS_HandleInt(CONTEXT *context)
-{
-#ifdef linux
-       FARPROC16 DOS_func;
-       DWORD dos;
-       LPBYTE dosptr;
-
-       DOS_func = MODULE_GetWndProcEntry16("ASPI_DOS_func");
-       dos = GlobalDOSAlloc(5);
-       dosptr = (BYTE *)PTR_SEG_OFF_TO_LIN(LOWORD(dos), 0);
-       *dosptr++ = 0xea; /* ljmp */
-       *(FARPROC16 *)dosptr = DOS_func;
-
-       *(DWORD *)PTR_SEG_OFF_TO_LIN(DS_reg(context), DX_reg(context))
-               = MAKELONG(0, HIWORD(dos)); /* real mode address */
-       RESET_CFLAG(context);
-       AX_reg(context) = CX_reg(context);
-#else
-       SET_CFLAG(context);
-#endif
-}
-
-/*******************************************************************
- *     GetASPI32SupportInfo		[WNASPI32.0]
- *
- * Checks if the ASPI subsystem is initialized correctly.
- *
- * RETURNS
- *    HIWORD: 0.
- *    HIBYTE of LOWORD: status (SS_COMP or SS_FAILED_INIT)
- *    LOBYTE of LOWORD: # of host adapters.  
- */
-DWORD WINAPI GetASPI32SupportInfo()
-{
-    return (SS_COMP << 8) | 1; /* FIXME: get # of host adapters installed */
-}
-
diff --git a/misc/commdlg.c b/misc/commdlg.c
index 007f473..cd31a46 100644
--- a/misc/commdlg.c
+++ b/misc/commdlg.c
@@ -1448,7 +1448,7 @@
  */
 BOOL32 WINAPI PrintDlg32A( LPPRINTDLG32A printdlg )
 {
-    FIXME(commdlg, "empty stub\n" );
+    FIXME(commdlg, "(%p): stub\n",printdlg);
     /* Altough returning FALSE is theoricaly the right thing
      * most programs check for a printer at startup, and if
      * none is found popup PrintDlg32A(), if it fails the program
diff --git a/misc/crtdll.c b/misc/crtdll.c
index 85e99de..62eda7d 100644
--- a/misc/crtdll.c
+++ b/misc/crtdll.c
@@ -161,7 +161,7 @@
  */
 INT32 __cdecl CRTDLL__findnext(DWORD hand,struct find_t* x2)
 {
-  FIXME(crtdll, ":(%d,%p): stub\n",hand,x2);
+  FIXME(crtdll, ":(%ld,%p): stub\n",hand,x2);
   SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
   return FALSE;
 }
@@ -1929,3 +1929,9 @@
 	}
 	return 0;
 }
+/*********************************************************************
+ *                  __dllonexit           (CRTDLL.25)
+ */
+VOID __cdecl CRTDLL__dllonexit ()
+{	FIXME(crtdll,"stub\n");
+ }
diff --git a/misc/ddeml.c b/misc/ddeml.c
index 069b1fc..9916ae1 100644
--- a/misc/ddeml.c
+++ b/misc/ddeml.c
@@ -55,11 +55,14 @@
 UINT32 WINAPI DdeInitialize32W( LPDWORD pidInst, PFNCALLBACK32 pfnCallback,
                                 DWORD afCmd, DWORD ulRes )
 {
-    FIXME(ddeml, "(%p,%p,%ld,%ld): stub\n",pidInst,pfnCallback,afCmd,ulRes);
+    FIXME(ddeml, "(%p,%p,0x%lx,%ld): stub\n",pidInst,pfnCallback,afCmd,ulRes);
 
     if(pidInst)
       *pidInst = 0;
 
+    if( ulRes )
+        ERR(dde, "Reserved value not zero?  What does this mean?\n");
+
     return DMLERR_NO_ERROR;
 }
 
@@ -184,7 +187,8 @@
 HCONV WINAPI DdeConnect32( DWORD idInst, HSZ hszService, HSZ hszTopic,
                            LPCONVCONTEXT32 pCC )
 {
-    FIXME( ddeml, "(...): stub\n");
+    FIXME(ddeml, "(0x%lx,%ld,%ld,%p): stub\n",idInst,hszService,hszTopic,
+          pCC);
     return 0;
 }
 
@@ -202,16 +206,19 @@
  */
 BOOL16 WINAPI DdeSetUserHandle( HCONV hConv, DWORD id, DWORD hUser )
 {
-    FIXME( ddeml, "empty stub\n" );
+    FIXME( ddeml, "(%ld,%ld,%ld): stub\n",hConv,id, hUser );
     return 0;
 }
 
 /*****************************************************************
  *            DdeCreateDataHandle (DDEML.14)
  */
-HDDEDATA WINAPI DdeCreateDataHandle( DWORD idInst, LPBYTE pSrc, DWORD cb, DWORD cbOff, HSZ hszItem, UINT16 wFmt, UINT16 afCmd )
+HDDEDATA WINAPI DdeCreateDataHandle( DWORD idInst, LPBYTE pSrc, DWORD cb, 
+                                     DWORD cbOff, HSZ hszItem, UINT16 wFmt, 
+                                     UINT16 afCmd )
 {
-    FIXME( ddeml, "empty stub\n" );
+    FIXME( ddeml, "(%ld,%p,%ld,%ld,%ld,%d,%d): stub\n",idInst,pSrc,cb,cbOff,
+           hszItem, wFmt, afCmd );
     return 0;
 }
 
diff --git a/misc/error.c b/misc/error.c
index 4f32d0b..248fd2f 100644
--- a/misc/error.c
+++ b/misc/error.c
@@ -8,6 +8,7 @@
 #include <string.h>
 
 #include "windows.h"
+#include "stackframe.h"
 #include "debug.h"
 
 #define ErrorString(manifest) { manifest, # manifest }
@@ -153,3 +154,34 @@
 	 */
 	MSG("(%s, %p, %p)\n", GetParamErrorString(uErr), lpfn, lpvParam);
 }
+
+/***********************************************************************
+*	LogParamErrorRegs (KERNEL.327)
+*/
+void WINAPI LogParamErrorRegs( CONTEXT *context )
+{
+	UINT16 uErr = BX_reg( context );
+        FARPROC16 lpfn = (FARPROC16)PTR_SEG_OFF_TO_SEGPTR( CS_reg(context),
+                                                           EIP_reg(context) );
+        LPVOID lpvParam = (LPVOID)MAKELONG( AX_reg( context ), 
+                                            CX_reg( context ) );
+	
+	LogParamError( uErr, lpfn, lpvParam );
+
+	if (!(uErr & ERR_WARNING))
+	{
+		/* Abort current procedure: Unwind stack frame and jump
+		   to error handler (location at [bp-2]) */
+
+		WORD *stack = PTR_SEG_OFF_TO_LIN( SS_reg( context ), 
+						  BP_reg( context ));
+		SP_reg( context ) = BP_reg( context ) - 2;
+		BP_reg( context ) = stack[0] & 0xfffe;
+
+		IP_reg( context ) = stack[-1];
+
+		EAX_reg( context ) = ECX_reg( context ) = EDX_reg( context ) = 0;
+		ES_reg( context) = 0;
+	}
+}
+
diff --git a/misc/imm.c b/misc/imm.c
index 579477d..9c20ae3 100644
--- a/misc/imm.c
+++ b/misc/imm.c
@@ -5,532 +5,712 @@
  */
 
 #include "windows.h"
+#include "winerror.h"
 #include "wintypes.h"
+#include "debug.h"
+#include "winversion.h"
 #include "imm.h"
 
 /***********************************************************************
  *           ImmAssociateContext32 (IMM32.1)
  */
-
 HIMC32 WINAPI ImmAssociateContext32(HWND32 hWnd, HIMC32 hIMC)
 {
-	return NULL;
+  FIXME(imm, "(0x%08x, 0x%08x): stub\n",hWnd,hIMC);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmConfigureIME32A (IMM32.2)
  */
-
-BOOL32 WINAPI ImmConfigureIME32A(HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData)
+BOOL32 WINAPI ImmConfigureIME32A(
+  HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, 0x%08x, %ld, %p): stub\n",
+    hKL, hWnd, dwMode, lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmConfigureIME32W (IMM32.3)
  */
-
-BOOL32 WINAPI ImmConfigureIME32W(HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData)
+BOOL32 WINAPI ImmConfigureIME32W(
+  HKL32 hKL, HWND32 hWnd, DWORD dwMode, LPVOID lpData)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, 0x%08x, %ld, %p): stub\n",
+    hKL, hWnd, dwMode, lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmCreateContext32 (IMM32.4)
  */
-
 HIMC32 WINAPI ImmCreateContext32()
 {
-	return NULL;
+  FIXME(imm, "(): stub\n");
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmDestroyContext32 (IMM32.7)
  */
-
 BOOL32 WINAPI ImmDestroyContext32(HIMC32 hIMC)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x): stub\n",hIMC);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
-
 /***********************************************************************
  *           ImmEnumRegisterWord32A (IMM32.10)
  */
-
 UINT32 WINAPI ImmEnumRegisterWord32A(
-    HKL32 hKL, REGISTERWORDENUMPROCA lpfnEnumProc, 
-	LPCSTR lpszReading, DWORD dwStyle, 
-	LPCSTR lpszRegister, LPVOID lpData)
+  HKL32 hKL, REGISTERWORDENUMPROCA lpfnEnumProc,
+  LPCSTR lpszReading, DWORD dwStyle,
+  LPCSTR lpszRegister, LPVOID lpData)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %p, %s, %ld, %s, %p): stub\n",
+    hKL, lpfnEnumProc, 
+    debugstr_a(lpszReading), dwStyle,
+    debugstr_a(lpszRegister), lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmEnumRegisterWord32W (IMM32.11)
  */
-
 UINT32 WINAPI ImmEnumRegisterWord32W(
-    HKL32 hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
-	LPCWSTR lpszReading, DWORD dwStyle, 
-	LPCWSTR lpszRegister, LPVOID lpData)
+  HKL32 hKL, REGISTERWORDENUMPROCW lpfnEnumProc,
+  LPCWSTR lpszReading, DWORD dwStyle,
+  LPCWSTR lpszRegister, LPVOID lpData)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %p, %s, %ld, %s, %p): stub\n",
+    hKL, lpfnEnumProc, 
+    debugstr_w(lpszReading), dwStyle,
+    debugstr_w(lpszRegister), lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmEscape32A (IMM32.12)
  */
-
-LRESULT WINAPI ImmEscape32A(HKL32 hKL, HIMC32 hIMC, UINT32 uEscape, LPVOID lpData)
+LRESULT WINAPI ImmEscape32A(
+  HKL32 hKL, HIMC32 hIMC, 
+  UINT32 uEscape, LPVOID lpData)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, 0x%08x, %d, %p): stub\n",
+    hKL, hIMC, uEscape, lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmEscape32W (IMM32.13)
  */
-
-LRESULT WINAPI ImmEscape32W(HKL32 hKL, HIMC32 hIMC, UINT32 uEscape, LPVOID lpData)
+LRESULT WINAPI ImmEscape32W(
+  HKL32 hKL, HIMC32 hIMC,
+  UINT32 uEscape, LPVOID lpData)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, 0x%08x, %d, %p): stub\n",
+    hKL, hIMC, uEscape, lpData
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetCandidateList32A (IMM32.15)
  */
-
-DWORD WINAPI ImmGetCandidateList32A(HIMC32 hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen)
+DWORD WINAPI ImmGetCandidateList32A(
+  HIMC32 hIMC, DWORD deIndex, 
+  LPCANDIDATELIST lpCandList, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld): stub\n",
+    hIMC, deIndex,
+    lpCandList, dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetCandidateListCount32A (IMM32.16)
  */
-
-DWORD WINAPI ImmGetCandidateListCount32A(HIMC32 hIMC, LPDWORD lpdwListCount)
+DWORD WINAPI ImmGetCandidateListCount32A(
+  HIMC32 hIMC, LPDWORD lpdwListCount)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpdwListCount);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetCandidateListCount32W (IMM32.17)
  */
-
-DWORD WINAPI ImmGetCandidateListCount32W(HIMC32 hIMC, LPDWORD lpdwListCount)
+DWORD WINAPI ImmGetCandidateListCount32W(
+  HIMC32 hIMC, LPDWORD lpdwListCount)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpdwListCount);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetCandidateList32W (IMM32.18)
  */
-
-DWORD WINAPI ImmGetCandidateList32W(HIMC32 hIMC, DWORD deIndex, LPCANDIDATELIST lpCandList, DWORD dwBufLen)
+DWORD WINAPI ImmGetCandidateList32W(
+  HIMC32 hIMC, DWORD deIndex, 
+  LPCANDIDATELIST lpCandList, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld): stub\n",
+    hIMC, deIndex,
+    lpCandList, dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetCandidateWindow32 (IMM32.19)
  */
-
-BOOL32 WINAPI ImmGetCandidateWindow32(HIMC32 hIMC, DWORD dwBufLen, LPCANDIDATEFORM lpCandidate)
+BOOL32 WINAPI ImmGetCandidateWindow32(
+  HIMC32 hIMC, DWORD dwBufLen, LPCANDIDATEFORM lpCandidate)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld, %p): stub\n", hIMC, dwBufLen, lpCandidate);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetCompositionFont32A (IMM32.20)
  */
-
 BOOL32 WINAPI ImmGetCompositionFont32A(HIMC32 hIMC, LPLOGFONT32A lplf)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lplf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetCompositionFont32W (IMM32.21)
  */
-
 BOOL32 WINAPI ImmGetCompositionFont32W(HIMC32 hIMC, LPLOGFONT32W lplf)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lplf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetCompositionString32A (IMM32.22)
  */
-
-LONG WINAPI ImmGetCompositionString32A(HIMC32 hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
+LONG WINAPI ImmGetCompositionString32A(
+  HIMC32 hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld): stub\n",
+    hIMC, dwIndex, lpBuf, dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  switch(VERSION_GetVersion())
+    {
+    default:
+      FIXME(imm, "%s not supported",VERSION_GetVersionName());
+    case WIN95:
+      return 0xffffffff;
+    case NT40:
+      return 0;
+    }
 }
 
 /***********************************************************************
  *           ImmGetCompositionString32W (IMM32.23)
  */
-
-LONG WINAPI ImmGetCompositionString32W(HIMC32 hIMC, DWORD dwIndex, LPVOID lpBuf, DWORD dwBufLen)
+LONG WINAPI ImmGetCompositionString32W(
+  HIMC32 hIMC, DWORD dwIndex, 
+  LPVOID lpBuf, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld): stub\n",
+    hIMC, dwIndex, lpBuf, dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  switch(VERSION_GetVersion())
+    {
+    default:
+      FIXME(imm, "%s not supported",VERSION_GetVersionName());
+    case WIN95:
+      return 0xffffffff;
+    case NT40:
+      return 0;
+    }
 }
 
 /***********************************************************************
  *           ImmGetCompositionWindow32 (IMM32.24)
  */
-
 BOOL32 WINAPI ImmGetCompositionWindow32(HIMC32 hIMC, LPCOMPOSITIONFORM lpCompForm)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpCompForm);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetContext32 (IMM32.25)
  */
-
 HIMC32 WINAPI ImmGetContext32(HWND32 hWnd)
 {
-	return NULL;
+  FIXME(imm, "(0x%08x): stub\n", hWnd);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmGetConversionList32A (IMM32.26)
  */
-
 DWORD WINAPI ImmGetConversionList32A(
-	HKL32 hKL, HIMC32 hIMC,
-	LPCSTR pSrc, LPCANDIDATELIST lpDst,
-	DWORD dwBufLen, UINT32 uFlag)
+  HKL32 hKL, HIMC32 hIMC,
+  LPCSTR pSrc, LPCANDIDATELIST lpDst,
+  DWORD dwBufLen, UINT32 uFlag)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, 0x%08x, %s, %p, %ld, %d): stub\n",
+    hKL, hIMC, debugstr_a(pSrc), lpDst, dwBufLen, uFlag
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetConversionList32W (IMM32.27)
  */
-
 DWORD WINAPI ImmGetConversionList32W(
-	HKL32 hKL, HIMC32 hIMC,
-	LPCWSTR pSrc, LPCANDIDATELIST lpDst,
-	DWORD dwBufLen, UINT32 uFlag)
+  HKL32 hKL, HIMC32 hIMC,
+  LPCWSTR pSrc, LPCANDIDATELIST lpDst,
+  DWORD dwBufLen, UINT32 uFlag)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, 0x%08x, %s, %p, %ld, %d): stub\n",
+    hKL, hIMC, debugstr_w(pSrc), lpDst, dwBufLen, uFlag
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetConversionStatus32 (IMM32.28)
  */
-
 BOOL32 WINAPI ImmGetConversionStatus32(
-	HIMC32 hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
+  HIMC32 hIMC, LPDWORD lpfdwConversion, LPDWORD lpfdwSentence)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p, %p): stub\n",
+    hIMC, lpfdwConversion, lpfdwSentence
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetDefaultIMEWnd32 (IMM32.29)
  */
-
 HWND32 WINAPI ImmGetDefaultIMEWnd32(HWND32 hWnd)
 {
-	return NULL;
+  FIXME(imm, "(0x%08x): stub\n", hWnd);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmGetDescription32A (IMM32.30)
  */
-
-UINT32 WINAPI ImmGetDescription32A(HKL32 hKL, LPSTR lpszDescription, UINT32 uBufLen)
+UINT32 WINAPI ImmGetDescription32A(
+  HKL32 hKL, LPSTR lpszDescription, UINT32 uBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %s, %d): stub\n",
+    hKL, debugstr_a(lpszDescription), uBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetDescription32W (IMM32.31)
  */
-
 UINT32 WINAPI ImmGetDescription32W(HKL32 hKL, LPWSTR lpszDescription, UINT32 uBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %s, %d): stub\n",
+    hKL, debugstr_w(lpszDescription), uBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetGuideLine32A (IMM32.32)
  */
-
-DWORD WINAPI ImmGetGuideLine32A(HIMC32 hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
+DWORD WINAPI ImmGetGuideLine32A(
+  HIMC32 hIMC, DWORD dwIndex, LPSTR lpBuf, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %s, %ld): stub\n",
+    hIMC, dwIndex, debugstr_a(lpBuf), dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetGuideLine32W (IMM32.33)
  */
-
 DWORD WINAPI ImmGetGuideLine32W(HIMC32 hIMC, DWORD dwIndex, LPWSTR lpBuf, DWORD dwBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld, %s, %ld): stub\n",
+    hIMC, dwIndex, debugstr_w(lpBuf), dwBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetIMEFileName32A (IMM32.38)
  */
-
-UINT32 WINAPI ImmGetIMEFileName32A(HKL32 hKL, LPSTR lpszFileName, UINT32 uBufLen)
+UINT32 WINAPI ImmGetIMEFileName32A(
+  HKL32 hKL, LPSTR lpszFileName, UINT32 uBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %s, %d): stub\n",
+    hKL, debugstr_a(lpszFileName), uBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetIMEFileName32W (IMM32.39)
  */
-
-UINT32 WINAPI ImmGetIMEFileName32W(HKL32 hKL, LPWSTR lpszFileName, UINT32 uBufLen)
+UINT32 WINAPI ImmGetIMEFileName32W(
+  HKL32 hKL, LPWSTR lpszFileName, UINT32 uBufLen)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %s, %d): stub\n",
+    hKL, debugstr_w(lpszFileName), uBufLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetOpenStatus32 (IMM32.40)
  */
-
 BOOL32 WINAPI ImmGetOpenStatus32(HIMC32 hIMC)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x): stub\n", hIMC);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetProperty32 (IMM32.41)
  */
-
 DWORD WINAPI ImmGetProperty32(HKL32 hKL, DWORD fdwIndex)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %ld): stub\n", hKL, fdwIndex);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetRegisterWordStyle32A (IMM32.42)
  */
-
-UINT32 WINAPI ImmGetRegisterWordStyle32A(HKL32 hKL, UINT32 nItem, LPSTYLEBUFA lpStyleBuf)
+UINT32 WINAPI ImmGetRegisterWordStyle32A(
+  HKL32 hKL, UINT32 nItem, LPSTYLEBUFA lpStyleBuf)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %d, %p): stub\n", hKL, nItem, lpStyleBuf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetRegisterWordStyle32W (IMM32.43)
  */
-
-UINT32 WINAPI ImmGetRegisterWordStyle32W(HKL32 hKL, UINT32 nItem, LPSTYLEBUFW lpStyleBuf)
+UINT32 WINAPI ImmGetRegisterWordStyle32W(
+  HKL32 hKL, UINT32 nItem, LPSTYLEBUFW lpStyleBuf)
 {
-	return 0;
+  FIXME(imm, "(0x%08x, %d, %p): stub\n", hKL, nItem, lpStyleBuf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return 0;
 }
 
 /***********************************************************************
  *           ImmGetStatusWindowPos32 (IMM32.44)
  */
-
 BOOL32 WINAPI ImmGetStatusWindowPos32(HIMC32 hIMC, LPPOINT32 lpptPos)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpptPos);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmGetVirtualKey32 (IMM32.45)
  */
-
 UINT32 WINAPI ImmGetVirtualKey32(HWND32 hWnd)
 {
-	return 0;
+  FIXME(imm, "(0x%08x): stub\n", hWnd);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  switch(VERSION_GetVersion())
+    {
+    default:
+      FIXME(imm, "%s not supported", VERSION_GetVersionName());
+    case WIN95:
+      return VK_PROCESSKEY;
+    case NT40:
+      return 0;
+    }
 }
 
 /***********************************************************************
  *           ImmInstallIME32A (IMM32.46)
  */
-
-HKL32 WINAPI ImmInstallIME32A(LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
+HKL32 WINAPI ImmInstallIME32A(
+  LPCSTR lpszIMEFileName, LPCSTR lpszLayoutText)
 {
-	return NULL;
+  FIXME(imm, "(%s, %s): stub\n",
+    debugstr_a(lpszIMEFileName), debugstr_a(lpszLayoutText)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmInstallIME32W (IMM32.47)
  */
-
-HKL32 WINAPI ImmInstallIME32W(LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
+HKL32 WINAPI ImmInstallIME32W(
+  LPCWSTR lpszIMEFileName, LPCWSTR lpszLayoutText)
 {
-	return NULL;
+  FIXME(imm, "(%s, %s): stub\n",
+    debugstr_w(lpszIMEFileName), debugstr_w(lpszLayoutText)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return NULL;
 }
 
 /***********************************************************************
  *           ImmIsIME32 (IMM32.48)
  */
-
 BOOL32 WINAPI ImmIsIME32(HKL32 hKL)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x): stub\n", hKL);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmIsUIMessage32A (IMM32.49)
  */
-
-BOOL32 WINAPI ImmIsUIMessage32A(HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
+BOOL32 WINAPI ImmIsUIMessage32A(
+  HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %d, %d, %ld): stub\n",
+    hWndIME, msg, wParam, lParam
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmIsUIMessage32W (IMM32.50)
  */
-
-BOOL32 WINAPI ImmIsUIMessage32W(HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
+BOOL32 WINAPI ImmIsUIMessage32W(
+  HWND32 hWndIME, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %d, %d, %ld): stub\n",
+    hWndIME, msg, wParam, lParam
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmNotifyIME32 (IMM32.53)
  */
-
-BOOL32 WINAPI ImmNotifyIME32(HIMC32 hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
+BOOL32 WINAPI ImmNotifyIME32(
+  HIMC32 hIMC, DWORD dwAction, DWORD dwIndex, DWORD dwValue)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld, %ld, %ld): stub\n",
+    hIMC, dwAction, dwIndex, dwValue
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmRegisterWord32A (IMM32.55)
  */
-
-BOOL32 WINAPI ImmRegisterWord32A(HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister)
+BOOL32 WINAPI ImmRegisterWord32A(
+  HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszRegister)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %s, %ld, %s): stub\n",
+    hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszRegister)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmRegisterWord32W (IMM32.56)
  */
-
-BOOL32 WINAPI ImmRegisterWord32W(HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
+BOOL32 WINAPI ImmRegisterWord32W(
+  HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszRegister)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %s, %ld, %s): stub\n",
+    hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszRegister)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmReleaseContext32 (IMM32.57)
  */
-
 BOOL32 WINAPI ImmReleaseContext32(HWND32 hWnd, HIMC32 hIMC)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, 0x%08x): stub\n", hWnd, hIMC);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCandidateWindow32 (IMM32.58)
  */
-
-BOOL32 WINAPI ImmSetCandidateWindow32 (HIMC32 hIMC, LPCANDIDATEFORM lpCandidate)
+BOOL32 WINAPI ImmSetCandidateWindow32(
+  HIMC32 hIMC, LPCANDIDATEFORM lpCandidate)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpCandidate);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCompositionFont32A (IMM32.59)
  */
-
 BOOL32 WINAPI ImmSetCompositionFont32A(HIMC32 hIMC, LPLOGFONT32A lplf)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lplf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCompositionFont32W (IMM32.60)
  */
-
 BOOL32 WINAPI ImmSetCompositionFont32W(HIMC32 hIMC, LPLOGFONT32W lplf)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lplf);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCompositionString32A (IMM32.61)
  */
-
 BOOL32 WINAPI ImmSetCompositionString32A(
-	HIMC32 hIMC, DWORD dwIndex, 
-	LPCVOID lpComp, DWORD dwCompLen, 
-	LPCVOID lpRead, DWORD dwReadLen)
+  HIMC32 hIMC, DWORD dwIndex, 
+  LPCVOID lpComp, DWORD dwCompLen, 
+  LPCVOID lpRead, DWORD dwReadLen)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld, %p, %ld): stub\n",
+    hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCompositionString32W (IMM32.62)
  */
-
 BOOL32 WINAPI ImmSetCompositionString32W(
 	HIMC32 hIMC, DWORD dwIndex,
 	LPCVOID lpComp, DWORD dwCompLen,
 	LPCVOID lpRead, DWORD dwReadLen)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld, %p, %ld, %p, %ld): stub\n",
+    hIMC, dwIndex, lpComp, dwCompLen, lpRead, dwReadLen
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetCompositionWindow32 (IMM32.63)
  */
-
-BOOL32 WINAPI ImmSetCompositionWindow32(HIMC32 hIMC, LPCOMPOSITIONFORM lpCompForm)
+BOOL32 WINAPI ImmSetCompositionWindow32(
+  HIMC32 hIMC, LPCOMPOSITIONFORM lpCompForm)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpCompForm);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetConversionStatus32 (IMM32.64)
  */
-
-BOOL32 WINAPI ImmSetConversionStatus32(HIMC32 hIMC, DWORD fdwConversion, DWORD fdwSentence)
+BOOL32 WINAPI ImmSetConversionStatus32(
+  HIMC32 hIMC, DWORD fdwConversion, DWORD fdwSentence)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld, %ld): stub\n",
+    hIMC, fdwConversion, fdwSentence
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetOpenStatus32 (IMM32.66)
  */
-
 BOOL32 WINAPI ImmSetOpenStatus32(HIMC32 hIMC, BOOL32 fOpen)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %d): stub\n", hIMC, fOpen);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmSetStatusWindowPos32 (IMM32.67)
  */
-
 BOOL32 WINAPI ImmSetStatusWindowPos32(HIMC32 hIMC, LPPOINT32 lpptPos)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %p): stub\n", hIMC, lpptPos);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
-
 /***********************************************************************
  *           ImmSimulateHotKey32 (IMM32.69)
  */
-
 BOOL32 WINAPI ImmSimulateHotKey32(HWND32 hWnd, DWORD dwHotKeyID)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %ld): stub\n", hWnd, dwHotKeyID);
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
  *           ImmUnregisterWord32A (IMM32.72)
  */
-
-BOOL32 WINAPI ImmUnregisterWord32A(HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister)
+BOOL32 WINAPI ImmUnregisterWord32A(
+  HKL32 hKL, LPCSTR lpszReading, DWORD dwStyle, LPCSTR lpszUnregister)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %s, %ld, %s): stub\n",
+    hKL, debugstr_a(lpszReading), dwStyle, debugstr_a(lpszUnregister)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
 
 /***********************************************************************
@@ -539,8 +719,12 @@
  *     I haven't been able to find the ordinal for this function,
  *     This means it can't be called from outside the DLL.
  */
-
-BOOL32 WINAPI ImmUnregisterWord32W(HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister)
+BOOL32 WINAPI ImmUnregisterWord32W(
+  HKL32 hKL, LPCWSTR lpszReading, DWORD dwStyle, LPCWSTR lpszUnregister)
 {
-	return FALSE;
+  FIXME(imm, "(0x%08x, %s, %ld, %s): stub\n",
+    hKL, debugstr_w(lpszReading), dwStyle, debugstr_w(lpszUnregister)
+  );
+  SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
+  return FALSE;
 }
diff --git a/misc/lstr.c b/misc/lstr.c
index b2b4ae0..c121ad4 100644
--- a/misc/lstr.c
+++ b/misc/lstr.c
@@ -668,7 +668,7 @@
 	if (nSize && talloced<nSize) {
 		target = (char*)HeapReAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,target,nSize);
 	}
-    TRACE(resource,"-- %s\n",target);
+    TRACE(resource,"-- %s\n",debugstr_a(target));
 	if (dwFlags & FORMAT_MESSAGE_ALLOCATE_BUFFER) {
 		/* nSize is the MINIMUM size */
 		*((LPVOID*)lpBuffer) = (LPVOID)LocalAlloc32(GMEM_ZEROINIT,talloced);
diff --git a/misc/main.c b/misc/main.c
index 0925f5d..830f984 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -33,24 +33,32 @@
 #include "xmalloc.h"
 #include "version.h"
 
+/* when adding new languages look at ole/ole2nls.c 
+ * for proper iso name and Windows code (add 0x0400 
+ * to the code listed there)
+ */
 const WINE_LANGUAGE_DEF Languages[] =
 {
     {"En",0x0409},	/* LANG_En */
     {"Es",0x040A},	/* LANG_Es */
     {"De",0x0407},	/* LANG_De */
     {"No",0x0414},	/* LANG_No */
-    {"Fr",0x0400},	/* LANG_Fr */
+    {"Fr",0x040C},	/* LANG_Fr */
     {"Fi",0x040B},	/* LANG_Fi */
     {"Da",0x0406},	/* LANG_Da */
-    {"Cz",0x0405},	/* LANG_Cz */
-    {"Eo",0x0425},	/* LANG_Eo */
+    {"Cs",0x0405},	/* LANG_Cs */
+    {"Eo",0x048f},	/* LANG_Eo */
     {"It",0x0410},	/* LANG_It */
     {"Ko",0x0412},	/* LANG_Ko */
-    {"Hu",0x0436},	/* LANG_Hu */
+    {"Hu",0x040e},	/* LANG_Hu */
     {"Pl",0x0415},	/* LANG_Pl */
-    {"Po",0x0416},	/* LANG_Po */
-    {"Sw",0x0417},	/* LANG_Sw */
-    {"Ca",0x0426},	/* LANG_Ca */
+    {"Pt",0x0416},	/* LANG_Pt */
+    {"Sv",0x041d},	/* LANG_Sv */
+    {"Ca",0x0403},	/* LANG_Ca */
+/* for compatibility whith non-iso names previously used */
+    {"Sw",0x041d},      /* LANG_Sv */
+    {"Cz",0x0405},      /* LANG_Cs */
+    {"Po",0x0416},      /* LANG_Pt */
     {NULL,0}
 };
 
@@ -86,7 +94,8 @@
     LANG_En,
 #endif
     FALSE,          /* Managed windows */
-    FALSE           /* Perfect graphics */
+    FALSE,          /* Perfect graphics */
+    NULL            /* Alternate config file name */
 };
 
 
@@ -109,7 +118,8 @@
     { "-failreadonly",  ".failreadonly",    XrmoptionNoArg,  (caddr_t)"on" },
     { "-mode",          ".mode",            XrmoptionSepArg, (caddr_t)NULL },
     { "-managed",       ".managed",         XrmoptionNoArg,  (caddr_t)"off"},
-    { "-winver",        ".winver",          XrmoptionSepArg, (caddr_t)NULL }
+    { "-winver",        ".winver",          XrmoptionSepArg, (caddr_t)NULL },
+    { "-config",        ".config",          XrmoptionSepArg, (caddr_t)NULL }
 };
 
 #define NB_OPTIONS  (sizeof(optionsTable) / sizeof(optionsTable[0]))
@@ -120,6 +130,7 @@
   "\n" \
   "Options:\n" \
   "    -backingstore   Turn on backing store\n" \
+  "    -config name    Specify config file to use\n" \
   "    -debug          Enter debugger before starting application\n" \
   "    -debugmsg name  Turn debugging-messages on or off\n" \
   "    -depth n        Change the depth to use for multiple-depth screens\n" \
@@ -130,7 +141,7 @@
   "    -fixedmap       Use a \"standard\" color map\n" \
   "    -help           Show this help message\n" \
   "    -iconic         Start as an icon\n" \
-  "    -language xx    Set the language (one of En,Es,De,No,Fr,Fi,Da,Cz,Eo,It,Ko,\n                    Hu,Pl,Po,Sw,Ca)\n" \
+  "    -language xx    Set the language (one of Ca,Cs,Da,De,En,Eo,Es,Fi,Fr,Hu,It,\n                    Ko,No,Pl,Pt,Sv)\n" \
   "    -managed        Allow the window manager to manage created windows\n" \
   "    -mode mode      Start Wine in a particular mode (standard or enhanced)\n" \
   "    -name name      Set the application name\n" \
@@ -502,6 +513,8 @@
 
       if (MAIN_GetResource( db, ".winver", &value))
           VERSION_ParseVersion( (char*)value.addr );
+      if (MAIN_GetResource( db, ".config", &value))
+         Options.configFileName = xstrdup((char *)value.addr);
 }
 
 
@@ -1189,6 +1202,6 @@
 */
 FARPROC16 WINAPI FileCDR(FARPROC16 x)
 {
-	FIXME(file,"(%8x): stub\n", (int) x);
+	FIXME(file,"(0x%8x): stub\n", (int) x);
 	return (FARPROC16)TRUE;
 }
diff --git a/misc/ntdll.c b/misc/ntdll.c
index 48188aa..5c91328 100644
--- a/misc/ntdll.c
+++ b/misc/ntdll.c
@@ -624,7 +624,7 @@
  */
 DWORD WINAPI NtQueryObject( DWORD x1, DWORD x2 ,DWORD x3, DWORD x4, DWORD x5 )
 {
-    FIXME(ntdll,"(%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5);
+    FIXME(ntdll,"(0x%lx,%lx,%lx,%lx,%lx): stub\n",x1,x2,x3,x4,x5);
     return 0;
 }
 
diff --git a/misc/printdrv.c b/misc/printdrv.c
index a2146e5..bb9e2d1 100644
--- a/misc/printdrv.c
+++ b/misc/printdrv.c
@@ -237,11 +237,12 @@
 BOOL32 WINAPI OpenPrinter32A(LPSTR lpPrinterName,HANDLE32 *phPrinter,
 			     LPPRINTER_DEFAULTS32A pDefault)
 {
-    FIXME(print,"(%s,%p,%p):stub.\n",
-	    lpPrinterName, phPrinter, pDefault);
+    FIXME(print,"(%s,%p,%p):stub\n",debugstr_a(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,
@@ -264,7 +265,8 @@
 BOOL32 WINAPI
 DeletePrinterDriver32A (LPSTR pName, LPSTR pEnvironment, LPSTR pDriverName)
 {
-    FIXME(print, "(%s,%s,%s):stub!\n", pName, pEnvironment, pDriverName);
+    FIXME(print,"(%s,%s,%s):stub\n",debugstr_a(pName),debugstr_a(pEnvironment),
+          debugstr_a(pDriverName));
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
 }
@@ -273,7 +275,8 @@
 BOOL32 WINAPI
 DeleteMonitor32A (LPSTR pName, LPSTR pEnvironment, LPSTR pMonitorName)
 {
-    FIXME(print, "(%s,%s,%s):stub!\n", pName, pEnvironment, pMonitorName);
+    FIXME(print,"(%s,%s,%s):stub\n",debugstr_a(pName),debugstr_a(pEnvironment),
+          debugstr_a(pMonitorName));
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
 }
@@ -282,7 +285,8 @@
 BOOL32 WINAPI
 DeletePort32A (LPSTR pName, HWND32 hWnd, LPSTR pPortName)
 {
-    FIXME(print, "(%s,0x%08x,%s):stub!\n", pName, hWnd, pPortName);
+    FIXME(print,"(%s,0x%08x,%s):stub\n",debugstr_a(pName),hWnd,
+          debugstr_a(pPortName));
     SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
     return FALSE;
 }
diff --git a/misc/registry.c b/misc/registry.c
index b0b81a8..67ac246 100644
--- a/misc/registry.c
+++ b/misc/registry.c
@@ -23,6 +23,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <errno.h>
+#include <sys/errno.h>
 #include <sys/types.h>
 #include <sys/fcntl.h>
 #include <sys/stat.h>
diff --git a/misc/tweak.c b/misc/tweak.c
index 952e141..9ce44e0 100644
--- a/misc/tweak.c
+++ b/misc/tweak.c
@@ -21,102 +21,22 @@
  *   Revision history
  *        03-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
  *             Original implementation.
- *
  *        05-Aug-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
  *             Removed some unused code.
+ *        22-Sep-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ *             Removed more unused code.
  *
  *****************************************************************************/
 
-#include <malloc.h>
-#include "ts_xlib.h"
 #include <string.h>
-#include "dc.h"
-#include "debug.h"
-#include "graphics.h"
-#include "options.h"
-#include "stackframe.h"
-#include "tweak.h"
 #include "windows.h"
-
-
-/* Parameters for controls/menu.c */
-extern UINT32  MENU_BarItemTopNudge;
-extern UINT32  MENU_BarItemLeftNudge;
-extern UINT32  MENU_ItemTopNudge;
-extern UINT32  MENU_ItemLeftNudge;
-extern UINT32  MENU_HighlightTopNudge;
-extern UINT32  MENU_HighlightLeftNudge;
-extern UINT32  MENU_HighlightBottomNudge;
-extern UINT32  MENU_HighlightRightNudge;
-
+#include "tweak.h"
+#include "options.h"
+#include "debug.h"
 
 /* General options */
-#if defined(WIN_95_LOOK)
-int  TWEAK_Win95Look = 1;
-#else
-int  TWEAK_Win95Look = 0;
-#endif
 
-int  TWEAK_WineInitialized = 0;
-
-
-/******************************************************************************
- *
- *   int  TWEAK_MenuInit()
- * 
- *   Initializes the Win95 tweaks to the menu code.  See controls/menu.c.
- *   Return value indicates success (non-zero) or failure.
- *
- *   Revision history
- *        06-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *
- *****************************************************************************/
-
-static int  TWEAK_MenuInit()
-{
-    MENU_BarItemTopNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemTopNudge", 0);
-    MENU_BarItemLeftNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuBarItemLeftNudge", 0);
-    MENU_ItemTopNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemTopNudge", 0);
-    MENU_ItemLeftNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuItemLeftNudge", 0);
-    MENU_HighlightTopNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightTopNudge", 0);
-    MENU_HighlightLeftNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightLeftNudge", 0);
-    MENU_HighlightBottomNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightBottomNudge", 0);
-    MENU_HighlightRightNudge =
-	PROFILE_GetWineIniInt("Tweak.Layout", "MenuHighlightRightNudge", 0);
-
-    return 1;
-}
-
-
-/******************************************************************************
- *
- *   int  TWEAK_VarInit()
- *
- *   Initializes the miscellaneous variables which are used in the tweak
- *   routines.  Return value is non-zero on success.
- *
- *   Revision history
- *        07-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *
- *****************************************************************************/
-
-static int  TWEAK_VarInit()
-{
-    TWEAK_Win95Look = PROFILE_GetWineIniBool("Tweak.Layout", "Win95Look", 0);
-
-    TRACE(tweak, "Using %s look and feel.\n",
-		 TWEAK_Win95Look ? "Win95" : "Win3.1");
-    return 1;
-}
+WINE_LOOK TWEAK_WineLook = WIN31_LOOK;
 
 
 /******************************************************************************
@@ -129,13 +49,50 @@
  *   Revision history
  *        05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
  *             Original implementation.
+ *        22-Sep-1998 Eric Kohl (ekohl@abo.rhein-zeitung.de)
+ *             Removed unused code and added Win98 option.
  *
  *****************************************************************************/
 
-int  TWEAK_Init()
+int TWEAK_Init (void)
 {
-    TWEAK_VarInit();
-    TWEAK_MenuInit();
+    char szIniString[80];
+
+    PROFILE_GetWineIniString ("Tweak.Layout", "Win95Look", "TestString",
+			      szIniString, 80);
+    if (strncmp (szIniString, "TestString", 10)) {
+	if (PROFILE_GetWineIniBool ("Tweak.Layout", "Win95Look", 0)) {
+	    TWEAK_WineLook = WIN95_LOOK;
+	    TRACE (tweak, "Using Win95 look and feel.\n");
+	}
+	else {
+	    TWEAK_WineLook = WIN31_LOOK;
+	    TRACE (tweak, "Using Win3.1 look and feel.\n");
+	}
+	ERR (tweak,
+	     "Replace \"Win95Look\" by \"WineLook\" in your \"wine.ini\"!\n");
+    }
+
+    PROFILE_GetWineIniString ("Tweak.Layout", "WineLook", "Win31",
+			      szIniString, 80);
+
+    if (!strncasecmp (szIniString, "Win31", 5)) {
+	TWEAK_WineLook = WIN31_LOOK;
+	TRACE (tweak, "Using Win3.1 look and feel.\n");
+    }
+    else if (!strncasecmp (szIniString, "Win95", 5)) {
+	TWEAK_WineLook = WIN95_LOOK;
+	TRACE (tweak, "Using Win95 look and feel.\n");
+    }
+    else if (!strncasecmp (szIniString, "Win98", 5)) {
+	TWEAK_WineLook = WIN98_LOOK;
+	TRACE (tweak, "Using Win98 look and feel.\n");
+    }
+    else {
+	TWEAK_WineLook = WIN31_LOOK;
+	TRACE (tweak, "Using Win3.1 look and feel.\n");
+    }
+
     return 1;
 }
 
@@ -156,247 +113,3 @@
 {
     return 1;
 }
-
-
-/******************************************************************************
- *
- *     Tweak graphic subsystem.
- *
- *****************************************************************************/
-
-/******************************************************************************
- *
- *   void  TWEAK_DrawReliefRect95(
- *      HDC32  hdc,               // Device context on which to draw
- *      RECT32 const  *rect )     // Rectangle to use
- *
- *   Draws the double-bordered Win95-style relief rectangle.
- *
- *   Bugs
- *        There are some checks missing from this function.  Perhaps the
- *        SelectObject32 calls should be examined?  Hasn't failed on me (yet).
- *
- *        Should I really be calling X functions directly from here?  It is
- *        an optimization, but should I be optimizing alpha code?  Probably
- *        not.
- *
- *   Revision history
- *        08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *
- *****************************************************************************/
-
-void  TWEAK_DrawReliefRect95(
-    HDC32  hdc,
-    RECT32 const  *rect )
-{
-    DC  *dc;
-    HPEN32  prevpen;
-
-    if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
-
-	/* Draw the top/left lines first */
-	prevpen = SelectObject32(hdc, GetSysColorPen32(COLOR_3DLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
-		  rect->right - 1, rect->top);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
-		  rect->left, rect->bottom - 1);
-
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DHIGHLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->top + 1, rect->right - 2, rect->top + 1);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->top + 1, rect->left + 1, rect->bottom - 2);
-
-
-	/* Now the bottom/right lines */
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DDKSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left,
-		  rect->bottom - 1, rect->right - 1, rect->bottom - 1);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 1,
-		  rect->top, rect->right - 1, rect->bottom - 1);
-
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->bottom - 2, rect->right - 2, rect->bottom - 2);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 2,
-		  rect->top + 1, rect->right - 2, rect->bottom - 2);
-	
-	SelectObject32(hdc, prevpen);
-    }
-
-    return;
-}
-
-
-/******************************************************************************
- *
- *   void  TWEAK_DrawRevReliefRect95(
- *      HDC32  hdc,               // Device context on which to draw
- *      RECT32 const  *rect )     // Rectangle to use
- *
- *   Draws the double-bordered Win95-style relief rectangle.
- *
- *   Bugs
- *        There are some checks missing from this function.  Perhaps the
- *        SelectObject32 calls should be examined?  Hasn't failed on me (yet).
- *
- *        Should I really be calling X functions directly from here?  It is
- *        an optimization, but should I be optimizing alpha code?  Probably
- *        not.
- *
- *   Revision history
- *        08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *
- *****************************************************************************/
-
-void  TWEAK_DrawRevReliefRect95(
-    HDC32  hdc,
-    RECT32 const  *rect )
-{
-    DC  *dc;
-    HPEN32  prevpen;
-
-    if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
-
-	/* Draw the top/left lines first */
-	prevpen = SelectObject32(hdc, GetSysColorPen32(COLOR_3DSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
-		  rect->right - 1, rect->top);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left, rect->top,
-		  rect->left, rect->bottom - 1);
-
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DDKSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->top + 1, rect->right - 2, rect->top + 1);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->top + 1, rect->left + 1, rect->bottom - 2);
-
-
-	/* Now the bottom/right lines */
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DHIGHLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left,
-		  rect->bottom - 1, rect->right - 1, rect->bottom - 1);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 1,
-		  rect->top, rect->right - 1, rect->bottom - 1);
-
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->left + 1,
-		  rect->bottom - 2, rect->right - 2, rect->bottom - 2);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, rect->right - 2,
-		  rect->top + 1, rect->right - 2, rect->bottom - 2);
-	
-	SelectObject32(hdc, prevpen);
-    }
-
-    return;
-}
-
-
-
-/******************************************************************************
- *
- *   void  TWEAK_DrawMenuSeparatorHoriz95(
- *      HDC32  hdc,               // Device context on which to draw
- *      UINT32  xc1,              // Left x-coordinate
- *      UINT32  yc,               // Y-coordinate of the LOWER line
- *      UINT32  xc2 )             // Right x-coordinate
- *
- *   Draws a horizontal menu separator bar Win 95 style.
- *
- *   Bugs
- *        Same as those for DrawReliefRect95.
- *
- *   Revision history
- *        08-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *        11-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Changed name from DrawMenuSeparator95
- *
- *****************************************************************************/
-
-void  TWEAK_DrawMenuSeparatorHoriz95(
-    HDC32  hdc,
-    UINT32  xc1,
-    UINT32  yc,
-    UINT32  xc2 )
-{
-    DC  *dc;
-    HPEN32  prevpen;
-
-    if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
-
-	/* Draw the top line */
-	prevpen = SelectObject32(hdc, GetSysColorPen32(COLOR_3DSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc - 1, xc2,
-		  yc - 1);
-
-	/* And the bottom line */
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DHIGHLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc1, yc, xc2, yc);
-
-	SelectObject32(hdc, prevpen);
-    }
-
-    return;
-}
-
-
-/******************************************************************************
- *
- *   void  TWEAK_DrawMenuSeparatorVert95(
- *      HDC32  hdc,               // Device context on which to draw
- *      UINT32  xc,               // X-coordinate of the RIGHT line
- *      UINT32  yc1,              // top Y-coordinate
- *      UINT32  yc2 )             // bottom Y-coordinate
- *
- *   Draws a vertical menu separator bar Win 95 style.
- *
- *   Bugs
- *        Same as those for DrawReliefRect95.
- *
- *   Revision history
- *        11-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
- *             Original implementation.
- *
- *****************************************************************************/
-
-void  TWEAK_DrawMenuSeparatorVert95(
-    HDC32  hdc,
-    UINT32  xc,
-    UINT32  yc1,
-    UINT32  yc2 )
-{
-    DC  *dc;
-    HPEN32  prevpen;
-
-    if((dc = (DC *)GDI_GetObjPtr(hdc, DC_MAGIC))) {
-
-	/* Draw the top line */
-	prevpen = SelectObject32(hdc, GetSysColorPen32(COLOR_3DSHADOW));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc, yc1, xc,
-		  yc2);
-
-	/* And the bottom line */
-	SelectObject32(hdc, GetSysColorPen32(COLOR_3DHIGHLIGHT));
-	DC_SetupGCForPen(dc);
-	TSXDrawLine(display, dc->u.x.drawable, dc->u.x.gc, xc + 1, yc1, xc + 1,
-		  yc2);
-
-	SelectObject32(hdc, prevpen);
-    }
-
-    return;
-}
diff --git a/misc/version.c b/misc/version.c
index 181588f..45c1486 100644
--- a/misc/version.c
+++ b/misc/version.c
@@ -3,6 +3,7 @@
  *
  * Copyright 1997 Alexandre Julliard
  * Copyright 1997 Marcus Meissner
+ * Copyright 1998 Patrik Stridvall
  */
 
 #include <string.h>
@@ -12,15 +13,7 @@
 #include "options.h"
 #include "debug.h"
 #include "ole.h"
-
-typedef enum
-{
-    WIN31, /* Windows 3.1 */
-    WIN95, /* Windows 95 */
-    NT351, /* Windows NT 3.51 */
-    NT40,  /* Windows NT 4.0 */
-    NB_VERSIONS
-} VERSION;
+#include "winversion.h"
 
 typedef struct
 {
@@ -31,7 +24,7 @@
 
 
 /* FIXME: compare values below with original and fix */
-static const VERSION_DATA VersionData[NB_VERSIONS] =
+static const VERSION_DATA VersionData[NB_WINDOWS_VERSIONS] =
 {
     /* WIN31 */
     {
@@ -71,7 +64,7 @@
     }
 };
 
-static const char *VersionNames[NB_VERSIONS] =
+static const char *VersionNames[NB_WINDOWS_VERSIONS] =
 {
     "win31",
     "win95",
@@ -81,7 +74,7 @@
 
 /* the current version has not been autodetected but forced via cmdline */
 static BOOL32 versionForced = FALSE;
-static VERSION defaultVersion = WIN31;
+static WINDOWS_VERSION defaultVersion = WIN31;
 
 
 /**********************************************************************
@@ -90,27 +83,27 @@
 void VERSION_ParseVersion( char *arg )
 {
     int i;
-    for (i = 0; i < NB_VERSIONS; i++)
+    for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
     {
         if (!strcmp( VersionNames[i], arg ))
         {
-            defaultVersion = (VERSION)i;
+            defaultVersion = (WINDOWS_VERSION)i;
             versionForced = TRUE;
             return;
         }
     }
     MSG("Invalid winver value '%s' specified.\n", arg );
     MSG("Valid versions are:" );
-    for (i = 0; i < NB_VERSIONS; i++)
+    for (i = 0; i < NB_WINDOWS_VERSIONS; i++)
         MSG(" '%s'%c", VersionNames[i],
-	    (i == NB_VERSIONS - 1) ? '\n' : ',' );
+	    (i == NB_WINDOWS_VERSIONS - 1) ? '\n' : ',' );
 }
 
 
 /**********************************************************************
- *         VERSION_get_version
+ *         VERSION_GetVersion
  */
-static VERSION VERSION_GetVersion(void)
+WINDOWS_VERSION VERSION_GetVersion(void)
 {
     LPIMAGE_NT_HEADERS peheader;	
 
@@ -143,12 +136,34 @@
 }
 
 
+/**********************************************************************
+ *         VERSION_GetVersionName
+ */
+char *VERSION_GetVersionName()
+{
+  WINDOWS_VERSION ver = VERSION_GetVersion();
+  switch(ver)
+    {
+    case WIN31:
+      return "Windows 3.1";
+    case WIN95:  
+      return "Windows 95";
+    case NT351:
+      return "Windows NT 3.51";
+    case NT40:
+      return "Windows NT 4.0";
+    default:
+      FIXME(ver,"Windows version %d not named",ver);
+      return "Windows <Unknown>";
+    }
+}
+
 /***********************************************************************
  *         GetVersion16   (KERNEL.3)
  */
 LONG WINAPI GetVersion16(void)
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
     return VersionData[ver].getVersion16;
 }
 
@@ -158,7 +173,7 @@
  */
 LONG WINAPI GetVersion32(void)
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
     return VersionData[ver].getVersion32;
 }
 
@@ -168,7 +183,7 @@
  */
 BOOL16 WINAPI GetVersionEx16(OSVERSIONINFO16 *v)
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
     if (v->dwOSVersionInfoSize != sizeof(OSVERSIONINFO16))
     {
         WARN(ver,"wrong OSVERSIONINFO size from app");
@@ -188,7 +203,7 @@
  */
 BOOL32 WINAPI GetVersionEx32A(OSVERSIONINFO32A *v)
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
     if (v->dwOSVersionInfoSize != sizeof(OSVERSIONINFO32A))
     {
         WARN(ver,"wrong OSVERSIONINFO size from app");
@@ -208,7 +223,8 @@
  */
 BOOL32 WINAPI GetVersionEx32W(OSVERSIONINFO32W *v)
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
+
     if (v->dwOSVersionInfoSize!=sizeof(OSVERSIONINFO32W))
     {
         WARN(ver,"wrong OSVERSIONINFO size from app");
@@ -319,7 +335,7 @@
 void WINAPI DiagOutput(LPCSTR str)
 {
         /* FIXME */
-	DPRINTF("DIAGOUTPUT:%s\n",str);
+	DPRINTF("DIAGOUTPUT:%s\n", debugstr_a(str));
 }
 
 /***********************************************************************
@@ -327,7 +343,7 @@
  */
 UINT32 WINAPI OaBuildVersion()
 {
-    VERSION ver = VERSION_GetVersion();
+    WINDOWS_VERSION ver = VERSION_GetVersion();
 
     switch(VersionData[ver].getVersion32)
     {
diff --git a/misc/winsock.c b/misc/winsock.c
index b328794..0fb8a1a 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -41,6 +41,7 @@
 #include <ctype.h>
 #include <fcntl.h>
 #include <errno.h>
+#include <sys/errno.h>
 #include <netdb.h>
 #include <unistd.h>