Release 970824

Sat Aug 23 00:05:23 1997  Andreas Mohr <100.30936@germany.net>

	* [if1632/kernel.spec] [if1632/mmsystem.spec]
	Added some stubs.

	* [include/neexe.h] [loader/module.c]
	Added warning for OS/2 executables.

	* [multimedia/midi.c]
	Shortened MIDIOUT driver version string to be less than 31 chars.

	* [objects/gdiobj.c]
	Fixed DeleteObject32() to react properly when called with stock object.

Fri Aug 22 18:03:26 1997  Dimitrie O. Paun <dimi@cs.toronto.edu>

	* [controls/updown.c] [include/updown.h]
	First attempt at implementiong the UpDown class.

	* [controls/widgets.c]
	Added the UpDown class to be initialized by InitCommonControls().

Wed Aug 20 18:01:33 1997  Doug Ridgway <ridgway@routh.UCSD.EDU>

	* [graphics/*] [objects/*] [include/gdi.h]
	Made all GDI objects (except DCs) moveable.

Mon Aug 18 03:25:30 1997  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [windows/event.c] [misc/winsock.c] [misc/winsock_dns.c]
	Removed IPC communication to speed up winsock services
	(tested only with 16-bit netscape 3.03).

	* [graphics/x11drv/xfont.c] [documentation/fonts]
	Miscellaneous improvements. Updated docs.

Sun Aug 17 20:39:55 1997  Ingo Schneider <schneidi@informatik.tu-muenchen.de>

	* [misc/comm.c]
	A couple of bug fixes.

Sun Aug 17 19:29:22 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [debugger/dbg.y]
	Display next instruction after stepi/nexti.

	* [if1632/relay.c] [include/callback.h] [tools/build.c]
	Replaced CallTo32_LargeStack with the CALL_LARGE_STACK macro for
	better Winelib support.

	* [include/sigcontext.h]
	Renamed to sig_context.h to avoid conflicts with libc.

	* [*/*]
	All API functions are now prefixed with WINAPI in prevision of
	future Winelib integration.

	* [loader/signal.c] [memory/ldt.c]
	Fixed assembly code to be -fPIC compatible.

Thu Aug 14 14:38:15 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [if1632/crtdll.spec][win32/except.c]
	_global_unwind, _local_unwind stub added.

	* [objects/dib.c]	
	Don't read memory you don't even need for the target bitmap (fixes
	one 'lazy' program).

	* [if1632/relay.c][if1632/thunk.c][if1632/kernel32.spec]
	  [win32/ordinals.c][memory/selector.c][memory/global.c]
	  [include/callback.h]
	Added/moved some more win95 ordinal stuff. Implemented QT_Thunk
	(not 100% correct yet) and some friends.

	* [loader/pe_image.c]
	Add possibility to break at the DLL entrypoint.

	* [controls/static.c][misc/commdlg.c][scheduler/thread.c]
	Misc bugfixes and additions.

	* [misc/registry.c]
	The registry seems to be case-preserving but case-insensitive.

	* [memory/global.c]	
	Adapted to new /proc/meminfo format.

	* [objects/font.c][graphics/x11drv/xfont.c]
	FONT_SelectObject and GetTextMetrics* get passed ranges in logical
 	and not device points (thanks to Marion Reyzl for pointing this
 	out).

	* [windows/caret.c]
	Use the windows own DC if present (The caret coordinates are
	logical coordinates based on it). Fixes another AMIPRO problem.

Wed Aug  6 18:22:22 1997  Morten Welinder  <terra@diku.dk>

	* [controls/menu.c]
	General clean-up and Win32 work: split item_flags into fType and
	fState; split item_id into wID and hSubMenu.  Improved
	debug-printing.  Implemented InsertMenuItem32[AW],
	SetMenuDefaultItem32, and SetMenuItemInfo32[AW].  Fixed
	GetMenuItemInfo32[AW].

	* [if1632/user32.spec]
	Define above new functions.

	* [include/windows.h]
	Define MF_DEFAULT and MF_RIGHTJUSTIFY.  Prototype above functions.

	* [include/menu.h]
	Don't prototype now-static MENU_InitSysMenuPopup.

	* [include/comm.h]
	Reduce MAX_PORTS to 9 (which the profile code can handle).

Tue Aug  5 20:16:22 1997  Victor Schneider <vischne@ibm.net>

	* [library/winestub.c] [libtest/expand.c]
	These patches let people porting Windows apps compile them using
	the same conventions regarding global _argc and _argv as those on
	Windows C/C++ compilers.
diff --git a/loader/module.c b/loader/module.c
index bd12830..a41ce37 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -265,7 +265,7 @@
  *           MODULE_AllocateSegment (WPROCS.26)
  */
 
-DWORD MODULE_AllocateSegment(WORD wFlags, WORD wSize, WORD wElem)
+DWORD WINAPI MODULE_AllocateSegment(WORD wFlags, WORD wSize, WORD wElem)
 {
     WORD size = wSize << wElem;
     HANDLE16 hMem = GlobalAlloc16( MODULE_Ne2MemFlags(wFlags), size);
@@ -478,6 +478,10 @@
     if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21;  /* win32 exe */
     if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11;  /* invalid exe */
 
+    if (ne_header.ne_magic == IMAGE_OS2_SIGNATURE_LX) {
+      fprintf(stderr, "Sorry, this is an OS/2 linear executable (LX) file !\n");
+      return (HMODULE16)11;
+    }
     /* We now have a valid NE header */
 
     size = sizeof(NE_MODULE) +
@@ -805,6 +809,15 @@
 
 
 /***********************************************************************
+ *           EntryAddrProc   (WPROCS.27)
+ */
+FARPROC16 WINAPI EntryAddrProc( HMODULE16 hModule, WORD ordinal )
+{
+    return MODULE_GetEntryPoint( hModule, ordinal );
+}
+
+
+/***********************************************************************
  *           MODULE_SetEntryPoint
  *
  * Change the value of an entry point. Use with caution!
@@ -1286,7 +1299,7 @@
 /**********************************************************************
  *	    FreeModule16    (KERNEL.46)
  */
-BOOL16 FreeModule16( HMODULE16 hModule )
+BOOL16 WINAPI FreeModule16( HMODULE16 hModule )
 {
     NE_MODULE *pModule;
 
@@ -1303,13 +1316,13 @@
 /**********************************************************************
  *	    GetModuleHandle16    (KERNEL.47)
  */
-HMODULE16 WIN16_GetModuleHandle( SEGPTR name )
+HMODULE16 WINAPI WIN16_GetModuleHandle( SEGPTR name )
 {
     if (HIWORD(name) == 0) return GetExePtr( (HINSTANCE16)name );
     return MODULE_FindModule( PTR_SEG_TO_LIN(name) );
 }
 
-HMODULE16 GetModuleHandle16( LPCSTR name )
+HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
 {
     return MODULE_FindModule( name );
 }
@@ -1318,7 +1331,7 @@
 /**********************************************************************
  *	    GetModuleUsage    (KERNEL.48)
  */
-INT16 GetModuleUsage( HINSTANCE16 hModule )
+INT16 WINAPI GetModuleUsage( HINSTANCE16 hModule )
 {
     NE_MODULE *pModule;
 
@@ -1333,7 +1346,8 @@
 /**********************************************************************
  *	    GetModuleFileName16    (KERNEL.49)
  */
-INT16 GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName, INT16 nSize )
+INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
+                                  INT16 nSize )
 {
     NE_MODULE *pModule;
 
@@ -1349,7 +1363,8 @@
 /***********************************************************************
  *              GetModuleFileName32A      (KERNEL32.235)
  */
-DWORD GetModuleFileName32A( HMODULE32 hModule, LPSTR lpFileName, DWORD size )
+DWORD WINAPI GetModuleFileName32A( HMODULE32 hModule, LPSTR lpFileName,
+                                   DWORD size )
 {                   
     NE_MODULE *pModule;
            
@@ -1369,7 +1384,8 @@
 /***********************************************************************
  *              GetModuleFileName32W      (KERNEL32.236)
  */
-DWORD GetModuleFileName32W( HMODULE32 hModule, LPWSTR lpFileName, DWORD size )
+DWORD WINAPI GetModuleFileName32W( HMODULE32 hModule, LPWSTR lpFileName,
+                                   DWORD size )
 {
     LPSTR fnA = (char*)HeapAlloc( GetProcessHeap(), 0, size );
     DWORD res = GetModuleFileName32A( hModule, fnA, size );
@@ -1382,7 +1398,7 @@
 /**********************************************************************
  *	    GetModuleName    (KERNEL.27)
  */
-BOOL16 GetModuleName( HINSTANCE16 hinst, LPSTR buf, INT16 nSize )
+BOOL16 WINAPI GetModuleName( HINSTANCE16 hinst, LPSTR buf, INT16 nSize )
 {
     LPSTR name = MODULE_GetModuleName(hinst);
 
@@ -1395,7 +1411,8 @@
 /***********************************************************************
  *           LoadLibraryEx32W   (KERNEL.513)
  */
-HINSTANCE16 LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf, DWORD flags )
+HINSTANCE16 WINAPI LoadLibraryEx32W16( LPCSTR libname, HANDLE16 hf,
+                                       DWORD flags )
 {
     fprintf(stderr,"LoadLibraryEx32W(%s,%d,%08lx)\n",libname,hf,flags);
     if (!flags && !hf)
@@ -1406,7 +1423,7 @@
 /***********************************************************************
  *           LoadLibrary   (KERNEL.95)
  */
-HINSTANCE16 LoadLibrary16( LPCSTR libname )
+HINSTANCE16 WINAPI LoadLibrary16( LPCSTR libname )
 {
     HINSTANCE16 handle;
 
@@ -1436,7 +1453,7 @@
 /***********************************************************************
  *           FreeLibrary16   (KERNEL.96)
  */
-void FreeLibrary16( HINSTANCE16 handle )
+void WINAPI FreeLibrary16( HINSTANCE16 handle )
 {
     dprintf_module( stddeb,"FreeLibrary: %04x\n", handle );
     FreeModule16( handle );
@@ -1446,7 +1463,7 @@
 /***********************************************************************
  *           WinExec16   (KERNEL.166)
  */
-HINSTANCE16 WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
+HINSTANCE16 WINAPI WinExec16( LPCSTR lpCmdLine, UINT16 nCmdShow )
 {
     return WinExec32( lpCmdLine, nCmdShow );
 }
@@ -1455,7 +1472,7 @@
 /***********************************************************************
  *           WinExec32   (KERNEL32.566)
  */
-HINSTANCE32 WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
+HINSTANCE32 WINAPI WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
 {
     LOADPARAMS params;
     HGLOBAL16 cmdShowHandle, cmdLineHandle;
@@ -1581,7 +1598,7 @@
 		    argptr = argv;
 		    if (iconic) *argptr++ = "-iconic";
 		    *argptr++ = unixfilename;
-		    p = cmdline;
+		    p = cmdline + 1;
 		    while (1)
 		    {
 			while (*p && (*p == ' ' || *p == '\t')) *p++ = '\0';
@@ -1628,7 +1645,7 @@
  *           WIN32_GetProcAddress16   (KERNEL32.36)
  * Get procaddress in 16bit module from win32... (kernel32 undoc. ordinal func)
  */
-FARPROC16 WIN32_GetProcAddress16( HMODULE16 hModule, LPSTR name )
+FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE16 hModule, LPSTR name )
 {
     WORD	ordinal;
     FARPROC16	ret;
@@ -1656,7 +1673,7 @@
 /***********************************************************************
  *           GetProcAddress16   (KERNEL.50)
  */
-FARPROC16 GetProcAddress16( HMODULE16 hModule, SEGPTR name )
+FARPROC16 WINAPI GetProcAddress16( HMODULE16 hModule, SEGPTR name )
 {
     WORD ordinal;
     FARPROC16 ret;
@@ -1688,7 +1705,7 @@
 /***********************************************************************
  *           GetProcAddress32   (KERNEL32.257)
  */
-FARPROC32 GetProcAddress32( HMODULE32 hModule, LPCSTR function )
+FARPROC32 WINAPI GetProcAddress32( HMODULE32 hModule, LPCSTR function )
 {
 #ifndef WINELIB
     NE_MODULE *pModule;
@@ -1713,8 +1730,7 @@
 /***********************************************************************
  *           RtlImageNtHeaders   (NTDLL)
  */
-LPIMAGE_NT_HEADERS
-RtlImageNtHeader(HMODULE32 hModule)
+LPIMAGE_NT_HEADERS WINAPI RtlImageNtHeader(HMODULE32 hModule)
 {
 #ifndef WINELIB
     NE_MODULE *pModule;
@@ -1734,7 +1750,7 @@
 /**********************************************************************
  *	    GetExpWinVer    (KERNEL.167)
  */
-WORD GetExpWinVer( HMODULE16 hModule )
+WORD WINAPI GetExpWinVer( HMODULE16 hModule )
 {
     NE_MODULE *pModule = MODULE_GetPtr( hModule );
     return pModule ? pModule->expected_version : 0;
@@ -1744,7 +1760,7 @@
 /**********************************************************************
  *	    IsSharedSelector    (KERNEL.345)
  */
-BOOL16 IsSharedSelector( HANDLE16 selector )
+BOOL16 WINAPI IsSharedSelector( HANDLE16 selector )
 {
     /* Check whether the selector belongs to a DLL */
     NE_MODULE *pModule = MODULE_GetPtr( GetExePtr( selector ));
@@ -1756,7 +1772,7 @@
 /**********************************************************************
  *	    ModuleFirst    (TOOLHELP.59)
  */
-BOOL16 ModuleFirst( MODULEENTRY *lpme )
+BOOL16 WINAPI ModuleFirst( MODULEENTRY *lpme )
 {
     lpme->wNext = hFirstModule;
     return ModuleNext( lpme );
@@ -1766,7 +1782,7 @@
 /**********************************************************************
  *	    ModuleNext    (TOOLHELP.60)
  */
-BOOL16 ModuleNext( MODULEENTRY *lpme )
+BOOL16 WINAPI ModuleNext( MODULEENTRY *lpme )
 {
     NE_MODULE *pModule;
 
@@ -1787,7 +1803,7 @@
 /**********************************************************************
  *	    ModuleFindName    (TOOLHELP.61)
  */
-BOOL16 ModuleFindName( MODULEENTRY *lpme, LPCSTR name )
+BOOL16 WINAPI ModuleFindName( MODULEENTRY *lpme, LPCSTR name )
 {
     lpme->wNext = GetModuleHandle16( name );
     return ModuleNext( lpme );
@@ -1797,7 +1813,7 @@
 /**********************************************************************
  *	    ModuleFindHandle    (TOOLHELP.62)
  */
-BOOL16 ModuleFindHandle( MODULEENTRY *lpme, HMODULE16 hModule )
+BOOL16 WINAPI ModuleFindHandle( MODULEENTRY *lpme, HMODULE16 hModule )
 {
     hModule = GetExePtr( hModule );  /* In case we were passed an hInstance */
     lpme->wNext = hModule;