Release 951212

Mon Dec 11 19:08:55 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>

	* [misc/lstr.c]
	Replaced wine_strncpy() by a 32-bit version of lstrcpyn(), since
 	they do the same job.

	* [tools/build.c]
	Fixed __attribute__((stdcall)) to make it compile with gcc
	versions under 2.7. Doesn't mean it will run OK though...

Sat Dec 09 13:22:58 1995  Cameron Heide  <heide@ee.ualberta.ca>

	* [include/kernel32.h] [include/winerror.h]
	Added file attribute definitions and more error codes.

	* [win32/error.c]
	Added some rudimentary errno-to-Win32 error conversion
	code.

	* [win32/file.c]
	Added to GetFileInformationByHandle, filled in some known
	error codes, and switched to dprintf_win32.

	* [win32/time.c]
	Added GetLocalTime.

Fri Dec  8 14:37:39 1995  Jim Peterson <jspeter@birch.ee.vt.edu>

	* [controls/combo.c]
	Converted functions of the type LONG _(HWND,WORD,LONG) to the type
	LRESULT _(HWND,WPARAM,LPARAM) where needed.

	* [include/libres.h]
	Restructured libres prototypes to closer match the windows API.

	* [include/windows.h]
	Changed several API prototypes' parameter types from 'short' to INT,
	which is #defined as short in the emulator, but is a normal int in
	WINELIB32.  Also changed SEGPTR from DWORD to void* when WINELIB32.
	(This creates a lot of warnings at library-compile time, but less
	warnings at app-compile time.  I'll remove the warnings soon.)

	* [loader/resource.c]
	Fixed parameter mismatch in call to LIBRES_FindResource().  Changed
	various implementations of the LIBRES_* API functions.

	* [loader/signal.c]
	Deleted local 'i' from win_fault(), since it was unused.

	* [objects/bitblt.c]
	Mirrored changes to include/windows.h mentioned above.

	* [toolkit/hello3.c]
	Changed LoadMenuIndirect() call to LoadMenu() to test the new
	resource registration technique.

	* [toolkit/libres.c]
	Removed definition of 'struct resource' and fixed bugs in the resource
	implementation.  Implemented LIBRES_FindResource.

	* [windows/graphics.c]
	Mirrored changes to include/windows.h mentioned above.

Thu Dec  7 23:15:56 1995     Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [controls/edit.c]
	LOCAL_HeapExists: Changed parameter to HANDLE. For WineLib, return true

	* [controls/listbox.c]
	CreateListBoxStruct: Initialize HeapSel to 0 for WineLib

	* [include/listbox.h]
	change HeapSel from WORD to HANDLE

	* [include/resource.h][rc/winerc.c]
	struct ResourceTable: removed
	struct resource: moved to header file
	autoregister resources if supported by compiler

	* [memory/local.h]
	LOCAL_GetHeap: expect HANDLE rather than WORD
	
	* [toolkit/Makefile.in]
	Add ALLCFLAGS to make hello3

	* [toolkit/heap.c]
	LocalFree, HEAP_Free: handle 0 parameter gracefully

Wed Dec 06 15:34:23 1995  Greg Cooper <cooper@ima-inc.com>

	* [misc/winsocket.c]
	Fixed the msgsnd and msgrcv errors that winsock programs get.

Wed Dec 06 12:47:23 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be>
	
	* [if1632/kernel.spec]
	Fixed _hread and _hwrite return type

	* [if1632/relay32.c] [loader/pe_image.c]
	Hacked loading of PE-dll's in

	* [win32/advapi.c]
	Added stubs for RegCreateKeyEx, RegSetValueEx, RegQueryValueEx

	* [win32/file.c]
	Added stubs for OpenFileMapping, CreateFileMapping, MapViewOfFileEx

	* [win32/process.c]
	Added stubs for CreateMutexA, ReleaseMutex, CreateEventA,
	WaitForSingleObject, DuplicateHandle, GetCurrentProcess
	
Mon Dec 04 13:06:37 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

	* [include/wine.h] [misc/lstr.c]
	Define wine_strncpy(). This function does not pad the buffer with 
	zeroes like GNU strncpy(), which might break some Windows programs
	that pass bogus size arguments.

	* [loader/module.c]: GetModuleFileName(),
	[misc/commdlg.c]: GetFileTitle(),
	[misc/keyboard.c], [misc/lstr.c]: lstrcpyn(),
	[misc/ole2nls.c], [misc/profile.c], [multimedia/mcistring.c],
	[multimedia/mmsystem.c], [objects/font.c]:
	Use wine_strncpy() where strings are returned to Windows programs.
	
	* [objects/metafile.c]
	PlayMetafile(): Clear the handle table before using it.

	* [misc/shell.c] [misc/main.c]
	Rename SHELL_RegCheckForRoot() to SHELL_Init() and call it from main().
	
	* [misc/profile.c]
	load(): Need to handle comments.
	
	* [toolkit/libres.c]
	Make it compile.
	
	* [windows/nonclient.c]
	Use MAKE_SEGPTR macro in two places where a user heap block used
	to be allocated instead.

Sat Dec 02 16:43:43 1995 Ramon Garcia <ramon@ie3.clubs.etsit.upm.es>

	* [windows/winpos.c]
	In function SetWindowPos: do not redraw the parent of
	a window if the specified window is placed on the top.
	This avoids that ShowWindow(hwnd,1) hides hwnd instead
	of showing it.

Sat Dec 02 11:00:00 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu>

	* [windows/scroll.c]
	Now it can scroll children along with the client region of parent 
        window. Tried to optimize update region calculation. 

	* [windows/mdi.c]
	ScrollChildren function, more other features added. Basically
	a rewrite.

	* [windows/winpos.c] [windows/focus.c]
	Reimplemented window activation and focus handling.

	* [windows/nonclient.c]
	Added new flag WIN_NCACTIVATED.

	* [windows/message.c] [loader/task.c]
	Small changes (to maintain linked list of message queues).

Wed Nov 29 15:51:48 1995  Daniel Schepler  <daniel@shep13.wustl.edu>

	* [include/options.h] [misc/main.c] [windows/defwnd.c]
	  [windows/event.c] [windows/nonclient.c] [windows/win.c] [Wine.man]
	Implemented a -managed option to replace the standard Windows
	frame of top-level windows with the window manager's decorations.
	If a top-level window makes its own frame, this will still show
	up, inside the window manager decorations (I believe ctl3dv2.dll
	would do this, although I can't test this).
diff --git a/include/advapi32.h b/include/advapi32.h
new file mode 100644
index 0000000..634c3f4
--- /dev/null
+++ b/include/advapi32.h
@@ -0,0 +1,31 @@
+#ifndef __WINE_ADVAPI32_H
+#define __WINE_ADVAPI32_H
+#include "shell.h"
+#include "kernel32.h"
+#define REGSAM long
+BOOL WINAPI GetUserNameA (char * lpBuffer, DWORD  *nSize);
+WINAPI LONG RegCreateKeyEx(HKEY key,
+                            const char *subkey,
+                            long dontuse,
+                            const char *keyclass,
+                            DWORD options,
+                            REGSAM sam,
+                            SECURITY_ATTRIBUTES *atts,
+                            HKEY *res,
+                            DWORD *disp);
+WINAPI LONG RegSetValueExA (HKEY key,
+                const char *name,
+                DWORD dontuse,
+                DWORD type,
+                const void* data,
+                DWORD len
+                );
+WINAPI LONG RegQueryValueExA(HKEY key,
+                             const char *subkey,
+                             DWORD dontuse,
+                             DWORD *type,
+                             void *ptr,
+                             DWORD *len);
+
+
+#endif  /* __WINE_ADVAPI32_H */
diff --git a/include/dlls.h b/include/dlls.h
index 4b4b606..89c434a 100644
--- a/include/dlls.h
+++ b/include/dlls.h
@@ -12,10 +12,6 @@
 #define MAX_NAME_LENGTH		64
 
 
-#define DLL	0
-#define EXE	1
-
-
 struct dll_table_s
 {
     char *  name;          /* DLL name */
diff --git a/include/handle32.h b/include/handle32.h
index f4e0d9e..e6d07a7 100644
--- a/include/handle32.h
+++ b/include/handle32.h
@@ -41,6 +41,13 @@
 } FILE_OBJECT;
 
 typedef struct {
+    KERNEL_OBJECT	common;
+    FILE_OBJECT	       *file_obj;
+    int			prot;
+    unsigned long	size;
+} FILEMAP_OBJECT;
+
+typedef struct {
     KERNEL_OBJECT       common;
 } SEMAPHORE_OBJECT;
 
@@ -65,6 +72,7 @@
 #define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4)
 #define KERNEL_OBJECT_EVENT     (KERNEL_OBJECT_UNUSED + 5)
 #define KERNEL_OBJECT_REGKEY    (KERNEL_OBJECT_UNUSED + 6)
+#define KERNEL_OBJECT_FILEMAP   (KERNEL_OBJECT_UNUSED + 7)
 
 /* Define the invalid handle value
  */
diff --git a/include/kernel32.h b/include/kernel32.h
index dd38cdc..501e8d8 100644
--- a/include/kernel32.h
+++ b/include/kernel32.h
@@ -106,11 +106,14 @@
 #define STD_OUTPUT_HANDLE       ((DWORD) -11)
 #define STD_ERROR_HANDLE        ((DWORD) -12)
 
-/* The security attributes structure (not filled in yet)
+/* The security attributes structure 
  */
 typedef struct {
-    void *junk;
+    DWORD nLength;
+    void *lpSecurityDescriptor;
+    BOOL bInheritHandle;
 } SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
+
 typedef struct
 {
   int dwLowDateTime;
@@ -131,4 +134,17 @@
   int nFileIndexLow;
 } BY_HANDLE_FILE_INFORMATION ;
 
+/* File attribute flags
+ */
+#define FILE_ATTRIBUTE_ARCHIVE          0x0020
+#define FILE_ATTRIBUTE_COMPRESSED       0x0800
+#define FILE_ATTRIBUTE_DIRECTORY        0x0010
+#define FILE_ATTRIBUTE_HIDDEN           0x0002
+#define FILE_ATTRIBUTE_NORMAL           0x0080
+#define FILE_ATTRIBUTE_READONLY         0x0001
+#define FILE_ATTRIBUTE_SYSTEM           0x0004
+#define FILE_ATTRIBUTE_TEMPORARY        0x0100
+#define FILE_ATTRIBUTE_ATOMIC_WRITE     0x0200
+#define FILE_ATTRIBUTE_XACTION_WRITE    0x0400
+
 #endif  /* __WINE_KERNEL32_H */
diff --git a/include/libres.h b/include/libres.h
index 68ada6f..918f042 100644
--- a/include/libres.h
+++ b/include/libres.h
@@ -4,16 +4,21 @@
 #ifndef __WINE_LIBRES_H
 #define __WINE_LIBRES_H
 
-#include "windows.h"
-
 #ifdef WINELIB
-HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type );
-HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc );
-LPSTR LIBRES_LockResource( HMODULE hModule, HGLOBAL handle );
-BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle );
-INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
-DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc );
-HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
-#endif
+
+#include "windows.h"
+#include "resource.h"
+
+void    LIBRES_RegisterResources(struct resource** Res);
+
+INT     LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
+HGLOBAL LIBRES_AllocResource( HINSTANCE hModule, HRSRC hRsrc, DWORD size );
+HRSRC   LIBRES_FindResource( HINSTANCE hModule, LPCSTR name, LPCSTR type );
+BOOL    LIBRES_FreeResource( HGLOBAL handle );
+HGLOBAL LIBRES_LoadResource( HINSTANCE hModule, HRSRC hRsrc );
+LPVOID  LIBRES_LockResource( HGLOBAL handle );
+DWORD   LIBRES_SizeofResource( HINSTANCE hModule, HRSRC hRsrc );
+
+#endif /* WINELIB */
 
 #endif
diff --git a/include/listbox.h b/include/listbox.h
index 1ca0891..e266b8a 100644
--- a/include/listbox.h
+++ b/include/listbox.h
@@ -34,7 +34,7 @@
 	LPINT   TabStops;
 	HANDLE  hDrawItemStruct;
         BOOL    needMeasure;
-	WORD	HeapSel;
+	HANDLE	HeapSel;
 /*	MDESC   *Heap; */
 } HEADLIST,*LPHEADLIST;
 
diff --git a/include/mdi.h b/include/mdi.h
index d2d1434..e7c2573 100644
--- a/include/mdi.h
+++ b/include/mdi.h
@@ -1,6 +1,7 @@
 /* MDI.H
  *
  * Copyright 1994, Bob Amstadt
+ *           1995  Alex Korobka
  *
  * MDI structure definitions.
  */
@@ -10,29 +11,32 @@
 
 #include "windows.h"
 
-#define MDI_MAXLISTLENGTH	64
+#define MDI_MAXLISTLENGTH	0x40
+
+#define WM_MDICALCCHILDSCROLL   0x10AC /* this is exactly what Windows uses */
+
 extern LRESULT MDIClientWndProc(HWND hwnd, UINT message, 
 				WPARAM wParam, LPARAM lParam); /* mdi.c */
 
-
-typedef struct
+typedef struct tagMDIWCL
 {
-    HLOCAL next, prev;
-    HWND hwnd;
-} MDICHILDINFO;
+  HWND		 	 hChild;
+  struct tagMDIWCL	*prev;
+} MDIWCL;
 
 typedef struct 
 {
-    HMENU  hWindowMenu;
-    HLOCAL infoActiveChildren;
     WORD   nActiveChildren;
-    WORD   idFirstChild;
+    HWND   flagChildMaximized;
     HWND   hwndActiveChild;
+    HMENU  hWindowMenu;
+    WORD   idFirstChild;       /* order is 3.1-like up to this point */
+    WORD   sbStop;
+    WORD   sbRecalc;
     HWND   hwndHitTest;
-    BOOL   flagMenuAltered;
-    BOOL   flagChildMaximized;
     RECT   rectMaximize;
     RECT   rectRestore;
 } MDICLIENTINFO;
 
+
 #endif /* MDI_H */
diff --git a/include/message.h b/include/message.h
index e604a41..8956faf 100644
--- a/include/message.h
+++ b/include/message.h
@@ -70,6 +70,8 @@
 extern void MSG_Synchronize();
 extern BOOL MSG_WaitXEvent( LONG maxWait );
 extern BOOL MSG_CreateSysMsgQueue( int size );
+extern BOOL MSG_DeleteMsgQueue( HANDLE hQueue );
+extern HTASK MSG_GetQueueTask( HANDLE hQueue );
 extern void hardware_event( WORD message, WORD wParam, LONG lParam,
 			    int xPos, int yPos, DWORD time, DWORD extraInfo );
 extern BOOL MSG_GetHardwareMessage( LPMSG msg );
diff --git a/include/msdos.h b/include/msdos.h
index 5ee696a..5964d82 100644
--- a/include/msdos.h
+++ b/include/msdos.h
@@ -16,7 +16,6 @@
 	char search_attribute;
 	long filesize;
 	long filetime;
-        int telldirnum;
         short entnum;           /* Directory entry number */
         struct dosdirent *next;
 };
diff --git a/include/options.h b/include/options.h
index 834713c..7d3bbf1 100644
--- a/include/options.h
+++ b/include/options.h
@@ -34,6 +34,7 @@
     int    enhanced;        /* Start Wine in enhanced mode */
     int    ipc;             /* Use IPC mechanisms */
     WINE_LANGUAGE language; /* Current language */
+    int    managed;	    /* Managed windows */
 };
 
 extern struct options Options;
diff --git a/include/pe_image.h b/include/pe_image.h
index a65c756..b83e651 100644
--- a/include/pe_image.h
+++ b/include/pe_image.h
@@ -25,6 +25,7 @@
     struct mz_header_s *mz_header;
     struct pe_data *pe;
 	OFSTRUCT ofs;
+    unsigned int load_addr;
 };
 
 
@@ -33,6 +34,7 @@
 extern void PE_InitDLL(struct w_files *wpnt);
 extern HINSTANCE PE_LoadImage(struct w_files *wpnt);
 extern void my_wcstombs(char * result, u_short * source, int len);
+extern struct w_files *wine_files;
 
 typedef struct _WIN32_function{
     char *name;
diff --git a/include/peexe.h b/include/peexe.h
index 6f54811..43aa48a 100644
--- a/include/peexe.h
+++ b/include/peexe.h
@@ -167,6 +167,7 @@
   u_long * AddressOfFunctions;
   u_long * AddressOfNames;
   u_short * Address_Of_Name_Ordinals;
+  u_char ModuleName[1];
 };
 
 /*
diff --git a/include/resource.h b/include/resource.h
index d389ce4..26d5897 100644
--- a/include/resource.h
+++ b/include/resource.h
@@ -17,12 +17,19 @@
 extern HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
 extern HGLOBAL NE_LoadResource( HMODULE hModule,  HRSRC hRsrc );
 
-struct ResourceTable
+struct resource
 {
         int id,type;
         char *name;
-        unsigned char* value;
+        unsigned char* bytes;
         unsigned size;
 };
 
+#if defined(__GNUC__) && (__GNUC__ == 2) && (__GNUC_MINOR__ >= 7)
+#define WINE_CONSTRUCTOR  __attribute__((constructor))
+#define HAVE_WINE_CONSTRUCTOR
+#else
+#define WINE_CONSTRUCTOR
+#endif
+
 #endif /* __WINE_RESOURCE_H */
diff --git a/include/shell.h b/include/shell.h
index 5a546ec..652f481 100644
--- a/include/shell.h
+++ b/include/shell.h
@@ -3,6 +3,9 @@
  */
 
 extern INT ShellAbout(HWND hWnd, LPCSTR szApp, LPCSTR szOtherStuff, HICON hIcon);
+extern void SHELL_LoadRegistry();
+extern void SHELL_SaveRegistry();
+extern BOOL SHELL_Init();
 
 #define ERROR_SUCCESS           0L
 #define ERROR_BADDB             1L
@@ -33,15 +36,14 @@
 	struct tagKEYSTRUCT *lpPrevKey;
 	struct tagKEYSTRUCT *lpNextKey;
 	struct tagKEYSTRUCT *lpSubLvl;
-	} KEYSTRUCT;
-typedef KEYSTRUCT *LPKEYSTRUCT;
+} KEYSTRUCT, *LPKEYSTRUCT;
 
-typedef struct tagDROPFILESTRUCT { 	   /* structure for dropped files */ 
+typedef struct { 	   /* structure for dropped files */ 
 	WORD		wSize;
 	POINT		ptMousePos;   
 	BOOL		fInNonClientArea;
 	/* memory block with filenames follows */     
-        } DROPFILESTRUCT,FAR *LPDROPFILESTRUCT; 
+} DROPFILESTRUCT, *LPDROPFILESTRUCT; 
 
 #define SE_ERR_SHARE            26
 #define SE_ERR_ASSOCINCOMPLETE  27
diff --git a/include/win.h b/include/win.h
index 49491a2..f5f7ba1 100644
--- a/include/win.h
+++ b/include/win.h
@@ -43,7 +43,6 @@
     POINT        ptMaxPos;       /* Maximized window position */
     HGLOBAL      hmemTaskQ;      /* Task queue global memory handle */
     HRGN         hrgnUpdate;     /* Update region */
-    HWND         hwndPrevActive; /* Previous active top-level window */
     HWND         hwndLastActive; /* Last active popup hwnd */
     WNDPROC      lpfnWndProc;    /* Window procedure */
     DWORD        dwStyle;        /* Window style (from CreateWindow) */
@@ -68,6 +67,7 @@
 #define WIN_INTERNAL_PAINT      0x10  /* Internal WM_PAINT message pending */
 #define WIN_NO_REDRAW           0x20  /* WM_SETREDRAW called for this window */
 #define WIN_GOT_SIZEMSG         0x40  /* WM_SIZE has been sent to the window */
+#define WIN_NCACTIVATED		0x80  /* last WM_NCACTIVATE was positive */
 
 #define WIN_CLASS_INFO(wndPtr)   (CLASS_FindClassPtr((wndPtr)->hClass)->wc)
 #define WIN_CLASS_STYLE(wndPtr)  (WIN_CLASS_INFO(wndPtr).style)
diff --git a/include/windows.h b/include/windows.h
index 02542d0..e0430aa 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -1428,22 +1428,69 @@
 
 /* Messages */
 
-enum {  WM_NULL, WM_CREATE, WM_DESTROY, WM_MOVE, WM_UNUSED0, WM_SIZE, WM_ACTIVATE,
-	WM_SETFOCUS, WM_KILLFOCUS, WM_SETVISIBLE, WM_ENABLE, WM_SETREDRAW, 
-	WM_SETTEXT, WM_GETTEXT, WM_GETTEXTLENGTH, WM_PAINT, WM_CLOSE, 
-	WM_QUERYENDSESSION, WM_QUIT, WM_QUERYOPEN, WM_ERASEBKGND, 
-	WM_SYSCOLORCHANGE, WM_ENDSESSION, WM_SYSTEMERROR,
-	WM_SHOWWINDOW, WM_CTLCOLOR, WM_WININICHANGE, WM_DEVMODECHANGE,
-	WM_ACTIVATEAPP, WM_FONTCHANGE, WM_TIMECHANGE, WM_CANCELMODE, WM_SETCURSOR,
-	WM_MOUSEACTIVATE, WM_CHILDACTIVATE, WM_QUEUESYNC, WM_GETMINMAXINFO,
-	WM_UNUSED3, WM_PAINTICON, WM_ICONERASEBKGND, WM_NEXTDLGCTL, 
-	WM_UNUSED4, WM_SPOOLERSTATUS, WM_DRAWITEM, WM_MEASUREITEM, 
-	WM_DELETEITEM, WM_VKEYTOITEM,
-	WM_CHARTOITEM, WM_SETFONT, WM_GETFONT };
+#define WM_NULL                 0x0000
+#define WM_CREATE               0x0001
+#define WM_DESTROY              0x0002
+#define WM_MOVE                 0x0003
+#define WM_SIZEWAIT             0x0004
+#define WM_SIZE                 0x0005
+#define WM_ACTIVATE             0x0006
+#define WM_SETFOCUS             0x0007
+#define WM_KILLFOCUS            0x0008
+#define WM_SETVISIBLE           0x0009
+#define WM_ENABLE               0x000a
+#define WM_SETREDRAW            0x000b
+#define WM_SETTEXT              0x000c
+#define WM_GETTEXT              0x000d
+#define WM_GETTEXTLENGTH        0x000e
+#define WM_PAINT                0x000f
+#define WM_CLOSE                0x0010
+#define WM_QUERYENDSESSION      0x0011
+#define WM_QUIT                 0x0012
+#define WM_QUERYOPEN            0x0013
+#define WM_ERASEBKGND           0x0014
+#define WM_SYSCOLORCHANGE       0x0015
+#define WM_ENDSESSION           0x0016
+#define WM_SYSTEMERROR          0x0017
+#define WM_SHOWWINDOW           0x0018
+#define WM_CTLCOLOR             0x0019
+#define WM_WININICHANGE         0x001a
+#define WM_DEVMODECHANGE        0x001b
+#define WM_ACTIVATEAPP          0x001c
+#define WM_FONTCHANGE           0x001d
+#define WM_TIMECHANGE           0x001e
+#define WM_CANCELMODE           0x001f
+#define WM_SETCURSOR            0x0020
+#define WM_MOUSEACTIVATE        0x0021
+#define WM_CHILDACTIVATE        0x0022
+#define WM_QUEUESYNC            0x0023
+#define WM_GETMINMAXINFO        0x0024
 
-#define WM_QUERYDRAGICON    0x0037
+#define WM_PAINTICON            0x0026
+#define WM_ICONERASEBKGND       0x0027
+#define WM_NEXTDLGCTL           0x0028
+#define WM_ALTTABACTIVE         0x0029
+#define WM_SPOOLERSTATUS        0x002a
+#define WM_DRAWITEM             0x002b
+#define WM_MEASUREITEM          0x002c
+#define WM_DELETEITEM           0x002d
+#define WM_VKEYTOITEM           0x002e
+#define WM_CHARTOITEM           0x002f
+#define WM_SETFONT              0x0030
+#define WM_GETFONT              0x0031
+#define WM_SETHOTKEY            0x0032
+#define WM_GETHOTKEY            0x0033
+#define WM_FILESYSCHANGE        0x0034
+#define WM_ISACTIVEICON         0x0035
+#define WM_QUERYPARKICON        0x0036
+#define WM_QUERYDRAGICON        0x0037
+#define WM_QUERYSAVESTATE       0x0038
+#define WM_COMPAREITEM          0x0039
+#define WM_TESTING              0x003a
 
-#define WM_COMPAREITEM	    0x0039
+#define WM_OTHERWINDOWCREATED	0x003c
+#define WM_OTHERWINDOWDESTROYED	0x003d
+#define WM_ACTIVATESHELLWINDOW	0x003e
 
 #define WM_COMPACTING	    0x0041
 
@@ -1461,6 +1508,7 @@
 
 #define WM_GETDLGCODE	    0x0087
 #define WM_SYNCPAINT	    0x0088
+#define WM_SYNCTASK	    0x0089
 
   /* Non-client mouse messages */
 #define WM_NCMOUSEMOVE      0x00a0
@@ -1532,6 +1580,7 @@
 #define WM_PARENTNOTIFY     0x0210
 #define WM_ENTERMENULOOP    0x0211
 #define WM_EXITMENULOOP     0x0212
+#define WM_NEXTMENU	    0x0213
 
 #define WM_MDICREATE	    0x0220
 #define WM_MDIDESTROY	    0x0221
@@ -1943,10 +1992,6 @@
 #define LBN_SETFOCUS        4
 #define LBN_KILLFOCUS       5
 
-/* Listbox notification messages */
-#define WM_VKEYTOITEM       0x002E
-#define WM_CHARTOITEM       0x002F
-
 /* Listbox message return values */
 #define LB_OKAY             0
 #define LB_ERR              (-1)
@@ -2095,8 +2140,6 @@
 #define EN_VSCROLL      0x0602
 
 
-#define WM_DRAWITEM         0x002B
-
 typedef struct
 {
     UINT        CtlType;
@@ -2112,8 +2155,6 @@
 typedef DRAWITEMSTRUCT NEAR* PDRAWITEMSTRUCT;
 typedef DRAWITEMSTRUCT FAR* LPDRAWITEMSTRUCT;
 
-#define WM_MEASUREITEM      0x002C
-
 typedef struct
 {
     UINT        CtlType;
@@ -2126,8 +2167,6 @@
 typedef MEASUREITEMSTRUCT NEAR* PMEASUREITEMSTRUCT;
 typedef MEASUREITEMSTRUCT FAR* LPMEASUREITEMSTRUCT;
 
-#define WM_DELETEITEM       0x002D
-
 typedef struct
 {
     UINT       CtlType;
@@ -2139,8 +2178,6 @@
 typedef DELETEITEMSTRUCT NEAR* PDELETEITEMSTRUCT;
 typedef DELETEITEMSTRUCT FAR* LPDELETEITEMSTRUCT;
 
-#define WM_COMPAREITEM      0x0039
-
 typedef struct
 {
     UINT        CtlType;
@@ -2499,13 +2536,14 @@
 UINT       AnsiUpperBuff(LPSTR,UINT);
 BOOL       AnyPopup(void);
 BOOL       AppendMenu(HMENU,UINT,UINT,LPSTR);
-BOOL       Arc(HDC,int,int,int,int,int,int,int,int);
+BOOL       Arc(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 WORD       ArrangeIconicWindows(HWND);
 HDWP       BeginDeferWindowPos(INT);
 HDC        BeginPaint(HWND,LPPAINTSTRUCT);
-BOOL       BitBlt(HDC,short,short,short,short,HDC,short,short,DWORD);
+BOOL       BitBlt(HDC,INT,INT,INT,INT,HDC,INT,INT,DWORD);
 BOOL       BringWindowToTop(HWND);
 int        BuildCommDCB(LPSTR,DCB*);
+void       CalcChildScroll(HWND,WORD);
 BOOL       CallMsgFilter(SEGPTR,short);
 DWORD      CallNextHookEx(HHOOK,short,WPARAM,LPARAM);
 LONG       CallWindowProc(WNDPROC,HWND,UINT,WPARAM,LPARAM);
@@ -2517,7 +2555,7 @@
 BOOL       CheckMenuItem(HMENU,UINT,UINT);
 void       CheckRadioButton(HWND,WORD,WORD,WORD);
 HWND       ChildWindowFromPoint(HWND,POINT);
-BOOL       Chord(HDC,int,int,int,int,int,int,int,int);
+BOOL       Chord(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 int        ClearCommBreak(int);
 void       ClientToScreen(HWND,LPPOINT);
 void       ClipCursor(LPRECT);
@@ -2600,13 +2638,13 @@
 BOOL       DlgDirSelect(HWND,LPSTR,int);
 BOOL       DlgDirSelectComboBox(HWND,LPSTR,int);
 BOOL       DragDetect(HWND,POINT);
-DWORD      DragObject(HWND, HWND, WORD, WORD, WORD, HCURSOR);
+DWORD      DragObject(HWND, HWND, WORD, HANDLE, WORD, HCURSOR);
 void       DrawFocusRect(HDC,LPRECT);
 BOOL       DrawIcon(HDC,short,short,HICON);
 void       DrawMenuBar(HWND);
 int        DrawText(HDC,LPSTR,int,LPRECT,WORD);
 DWORD      DumpIcon(SEGPTR,WORD*,SEGPTR*,SEGPTR*);
-BOOL       Ellipse(HDC,int,int,int,int);
+BOOL       Ellipse(HDC,INT,INT,INT,INT);
 BOOL       EmptyClipboard(void);
 BOOL       EnableHardwareInput(BOOL);
 BOOL       EnableMenuItem(HMENU,UINT,UINT);
@@ -2640,7 +2678,7 @@
 BOOL       FillRgn(HDC,HRGN,HBRUSH);
 void       FillWindow(HWND,HWND,HDC,HBRUSH);
 ATOM       FindAtom(SEGPTR);
-HANDLE     FindResource(HANDLE,SEGPTR,SEGPTR);
+HRSRC      FindResource(HINSTANCE,SEGPTR,SEGPTR);
 HWND       FindWindow(SEGPTR,LPSTR);
 BOOL       FlashWindow(HWND,BOOL);
 BOOL       FloodFill(HDC,INT,INT,COLORREF);
@@ -2650,7 +2688,7 @@
 void       FreeLibrary(HANDLE);
 BOOL       FreeModule(HANDLE);
 void       FreeProcInstance(FARPROC);
-BOOL       FreeResource(HANDLE);
+BOOL       FreeResource(HGLOBAL);
 WORD       FreeSelector(WORD);
 UINT       GDIRealizePalette(HDC);
 HPALETTE   GDISelectPalette(HDC,HPALETTE);
@@ -2897,7 +2935,7 @@
 HMENU      LoadMenu(HANDLE,SEGPTR);
 HMENU      LoadMenuIndirect(LPSTR);
 HANDLE     LoadModule(LPCSTR,LPVOID);
-HANDLE     LoadResource(HANDLE,HANDLE);
+HGLOBAL    LoadResource(HINSTANCE,HRSRC);
 int        LoadString(HANDLE,WORD,LPSTR,int);
 HANDLE     LocalAlloc(WORD,WORD);
 #ifndef WINELIB32 /* Obsolete in Win32 */
@@ -2915,7 +2953,7 @@
 #endif
 UINT       LocalSize(HLOCAL);
 BOOL       LocalUnlock(HANDLE);
-LPSTR      LockResource(HANDLE);
+LPVOID     LockResource(HGLOBAL);
 HGLOBAL    LockSegment(HGLOBAL);
 HMENU      LookupMenuHandle(HMENU,INT);
 FARPROC    MakeProcInstance(FARPROC,HANDLE);
@@ -2949,7 +2987,7 @@
 BOOL       PaintRgn(HDC,HRGN);
 BOOL       PatBlt(HDC,short,short,short,short,DWORD);
 BOOL       PeekMessage(LPMSG,HWND,WORD,WORD,WORD);
-BOOL       Pie(HDC,int,int,int,int,int,int,int,int);
+BOOL       Pie(HDC,INT,INT,INT,INT,INT,INT,INT,INT);
 BOOL       PlayMetaFile(HDC,HANDLE);
 void       PlayMetaFileRecord(HDC,LPHANDLETABLE,LPMETARECORD,WORD);
 BOOL       PolyPolygon(HDC,LPPOINT,LPINT,WORD);
@@ -2975,7 +3013,7 @@
 UINT       RealizePalette(HDC);
 BOOL       RectInRegion(HRGN,LPRECT);
 BOOL       RectVisible(HDC,LPRECT);
-BOOL       Rectangle(HDC,int,int,int,int);
+BOOL       Rectangle(HDC,INT,INT,INT,INT);
 BOOL       RedrawWindow(HWND,LPRECT,HRGN,UINT);
 ATOM       RegisterClass(LPWNDCLASS);
 WORD       RegisterClipboardFormat(LPCSTR);
@@ -2989,7 +3027,7 @@
 BOOL       ResizePalette(HPALETTE,UINT);
 BOOL       RestoreDC(HDC,short);
 int        RestoreVisRgn(HDC);
-BOOL       RoundRect(HDC,short,short,short,short,short,short);
+BOOL       RoundRect(HDC,INT,INT,INT,INT,INT,INT);
 int        SaveDC(HDC);
 HRGN       SaveVisRgn(HDC);
 DWORD      ScaleViewportExt(HDC,short,short,short,short);
@@ -2997,6 +3035,7 @@
 DWORD      ScaleWindowExt(HDC,short,short,short,short);
 BOOL       ScaleWindowExtEx(HDC,short,short,short,short,LPSIZE);
 void       ScreenToClient(HWND,LPPOINT);
+void       ScrollChildren(HWND,UINT,WPARAM,LPARAM);
 BOOL       ScrollDC(HDC,short,short,LPRECT,LPRECT,HRGN,LPRECT);
 void       ScrollWindow(HWND,short,short,LPRECT,LPRECT);
 int        ScrollWindowEx(HWND,short,short,LPRECT,LPRECT,HRGN,LPRECT,WORD);
@@ -3103,7 +3142,7 @@
 void       ShowOwnedPopups(HWND,BOOL);
 void       ShowScrollBar(HWND,WORD,BOOL);
 BOOL       ShowWindow(HWND,int);
-DWORD      SizeofResource(HANDLE,HRSRC);
+DWORD      SizeofResource(HINSTANCE,HRSRC);
 int        StartSound(void);
 int        StopSound(void);
 BOOL       StretchBlt(HDC,short,short,short,short,HDC,short,short,short,short,DWORD);
@@ -3139,6 +3178,7 @@
 WORD       VkKeyScan(WORD);
 SEGPTR     WIN16_GlobalLock(HGLOBAL);
 SEGPTR     WIN16_LockResource(HANDLE);
+SEGPTR     WIN16_lstrcpyn(SEGPTR,SEGPTR,WORD);
 void       WaitMessage(void);
 int        WaitSoundState(int);
 HANDLE     WinExec(LPSTR,WORD);
@@ -3160,7 +3200,7 @@
 INT        lstrcmp(LPCSTR,LPCSTR);
 INT        lstrcmpi(LPCSTR,LPCSTR);
 SEGPTR     lstrcpy(SEGPTR,SEGPTR);
-SEGPTR     lstrcpyn(SEGPTR,SEGPTR,WORD);
+char *     lstrcpyn(char *,char *,int);
 INT        lstrlen(LPCSTR);
 int        wvsprintf(LPSTR,LPSTR,LPSTR);
 
diff --git a/include/winerror.h b/include/winerror.h
index ec4ba25..67e8d71 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -7,6 +7,21 @@
  */
 #define     ERROR_UNKNOWN               99999
 
+#define     ERROR_FILE_NOT_FOUND        2
+#define     ERROR_TOO_MANY_OPEN_FILES   4
+#define     ERROR_ACCESS_DENIED         5
 #define     ERROR_INVALID_HANDLE        6
+#define     ERROR_BAD_FORMAT            11
+#define     ERROR_OUTOFMEMORY           14
+#define     ERROR_FILE_EXISTS           80
 #define     ERROR_INVALID_PARAMETER     87
+#define     ERROR_BROKEN_PIPE           109
+#define     ERROR_DISK_FULL             112
 #define     ERROR_CALL_NOT_IMPLEMENTED  120
+#define     ERROR_SEEK_ON_DEVICE        132
+#define     ERROR_DIR_NOT_EMPTY         145
+#define     ERROR_BUSY                  170
+#define     ERROR_FILENAME_EXCED_RANGE  206
+#define     ERROR_IO_DEVICE             1117
+#define     ERROR_POSSIBLE_DEADLOCK     1131
+#define     ERROR_BAD_DEVICE            1200
diff --git a/include/winpos.h b/include/winpos.h
index 68edbd8..56cabb7 100644
--- a/include/winpos.h
+++ b/include/winpos.h
@@ -19,8 +19,15 @@
     WINDOWPOS   winPos[1];
 } DWP;
 
+typedef struct
+{
+  HTASK        hWindowTask;
+  HTASK        hTaskSendTo;
+  BOOL         wFlag;
+} ACTIVATESTRUCT, *LPACTIVATESTRUCT;
 
 extern void WINPOS_FindIconPos( HWND hwnd );
+extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus);
 extern HWND WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
 extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
 				   RECT *newWindowRect, RECT *oldWindowRect,
diff --git a/include/wintypes.h b/include/wintypes.h
index eb917b5..0d7689a 100644
--- a/include/wintypes.h
+++ b/include/wintypes.h
@@ -31,6 +31,7 @@
 typedef LONG WPARAM;
 typedef void* HANDLE;
 typedef void* NPVOID;
+typedef void* SEGPTR;
 #define UIFMT "%u"
 #define NPFMT "%p"
 #else
@@ -39,13 +40,13 @@
 typedef UINT WPARAM;
 typedef WORD HANDLE;
 typedef WORD NPVOID;
+typedef DWORD SEGPTR;
 #define UIFMT "%hu"
 #define NPFMT "%04X"
 #endif
 typedef LONG LPARAM;
 typedef LONG LRESULT;
 typedef DWORD HHOOK;
-typedef DWORD SEGPTR;
 typedef char *LPSTR;
 typedef const char *LPCSTR;
 typedef char *NPSTR;