Release 980517
Sun May 17 16:23:56 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [file/profile.c]
Fix the return value of PROFILE_GetSection
* [misc/crtdll.c]
Do _getdrive, fix _chdrive.
* [misc/commdlg.c]
First cut at ChooseColor[WA].
* [misc/network.c]
Do something sensible for WNetGetDirectoryType16.
Sun May 17 10:21:35 1998 Andreas Mohr <100.30936@germany.net>
* [controls/menu.c]
Fixed disabled sub menus with MF_BYPOSITION that were not disabled.
* [misc/crtdll.c] [relay32/crtdll.spec] [include/winerror.h]
Implemented fscanf, fsetpos, _access, _fpreset (thanks to Uwe Bonnes),
and _ltoa.
* [loader/task.c]
MakeProcInstance: must use CURRENT_DS if hInst == NULL.
* [misc/shell.c]
SHELL_GetResourceTable, InternalExtractIcon: fixed broken .ICO handling
* [windows/winpos.c]
DeferWindowPos: removed "same parent" requirement.
Which doc states that this is required ?
Sat May 16 20:08:11 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [loader/module.c] [loader/ne/module.c]
More NE module cleanups.
* [loader/task.c]
Fixed SwitchStackBack().
Fri May 15 10:04:27 1998 Marcus Meissner <marcus@jet.franken.de>
* [configure.in][inlcude/acconfig.h]
Fixed broken OSS check, added check for working sigaltstack,
fixed broken statfs checks on some linux systems.
* [files/directory.c][loader/pe_image.c][relay32/builtin.c]
[loader/module.c]
Added handling of win32 module pathnames.
* [relay32/wnaspi32.spec]
New file.
* [misc/lzexpand.c]
LZCopy auto-decompresses LZ compressed files, even if they are not
specially flagged. Fixes some InstallShield problems.
* [misc/registry.c]
Some fixes for RegQueryInfoKey (reference program monkey.exe
from Win32 SDK works now better). Probably still has faults.
Fri May 15 08:58:58 1998 Martin Boehme <boehme@informatik.mu-luebeck.de>
* [graphics/mapping.c] [include/dc.h] [include/gdi.h] [objects/dc.c]
Reworked the way world transformations and mapping modes are handled
so that both of these transformations can be computed in a single
step.
* [graphics/painting.c] [graphics/path.c] [include/path.h]
More GDI path support.
* [graphics/x11drv/graphics.c]
Fixed the return value of GRAPH_DrawArc for the zero height /
zero width case to reflect Windows' behaviour.
* [include/windows.h] [relay32/gdi32.spec] [objects/dc.c]
Implemented ModifyWorldTransform and CombineTransform.
Tue May 14 18:03:46 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [controls/commctrl.c][relay32/comctl32.spec]
[controls/*.c][include/*.h]
Implemented InitCommonControlsEx (dll version 4.72 compatible).
InitCommonControls calls ImageCommonControlsEx.
Registering code of the common controls had to be changed
(see XXXX_Register functions).
* [controls/status.c][include/commctrl.h][include/status.h]
Implemented most new features and fixed the look and feel.
* [contols/commctrl.c][include/commctrl.h][relay32/comctl32.spec]
Implemented MenuHelp (incomplete).
* [controls/status.c][controls/progress.c]
Changed allocation strategy for control specific memory.
* [controls/header.c][include/header.h][include/commctrl.h]
First implementation of header control.
* [windows/defwnd.c][windows/syscolors.c]
Fixed default control colors for Win95 look.
* [windows/nonclient.c]
Fixed off by one error for Win95 look. Top border of child windows
should be visible.
* [misc/imagelist.h]
Improved documentation and fixed some bugs.
Thu May 14 15:42:21 1998 Robert Wilhelm <robert@physiol.med.tu-muenchen.de>
* [relay32/crtdll.spec]
Added hypot,j0,j1,jn and ceil.
Wed May 13 19:10:10 1998 Pascal Cuoq <pcuoq@ens-lyon.fr>
* [controls/listbox.c]
Item height is now exactly font height.
Wine listboxes now behave like Windows' when they are
created without WS_VSCROLL but the program subsequently
calls ShowScrollBar or SetScrollInfo.
Wed May 13 18:33:01 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [relay32/relay386.c]
Restore ES also in the non-debug case.
* [windows/event.c]
Bugfix: Blocking TSXNextEvent could deadlock Wine.
* [win32/process.c] [windows/message.c]
Silly stubs for MsgWaitForMultipleObjects / PostThreadMessage
that make some programs run better.
* [windows/winproc.c]
WINPROC_MapMsg32Ato16/16To32A: added WM_NOTIFY.
* [win32/kernel32.c]
Added 16->32 thunking and improved 32->16 thunking functions.
* [tools/build.c]
Added new variant of CallFrom16 stub for use with Win95 thunks.
* [if1632/kernel.spec] [if1632/builtin.c] [win32/kernel32.c]
Added a few undocumented KERNEL functions.
* [loader/ne/module.c] [loader/ne/segment.c]
Call DllEntryPoint for 16-bit DLLs with subsystem >= 4.0.
* [win32/kernel32.spec] [win32/wow32.spec] [win32/ordinals.c]
Use names from the Oct 94 beta release for undoc. functions.
Wed May 13 14:18:26 1998 Matthew Becker <mbecker@glasscity.net>
* [misc/registry.c]
Code cleanup.
* [misc/cpu.c]
Commented out the registry puts temporarily.
* [programs/regtest/*]
New registry testing program.
Tue May 12 22:54:03 1998 Michael Mess <michael@kawo2.rwth-aachen.de>
* [multimedia/audio.c]
ioctl's do not commute in /dev/dsp initialization.
Tue May 12 20:11:42 1998 Karl Garrison <karlos@eznet.net>
* [win32/console.c]
Implemented SetConsoleTextAttribute, FillConsoleOutputCharacter.
Improved cursor positioning.
This allows for text colors in an xterm, rxvt, or console.
Tue May 12 17:57:52 1998 Petter Reinholdtsen <pere@td.org.uit.no>
* [Makefile.in]
Create prefix/{bin|lib} directories if missing during install.
Sun May 10 19:37:51 1998 Jan Willamowius <jan@janhh.shnet.org>
* [multimedia/mmio.c]
Have mmioSetBuffer return success (0), so Corel Draw 4
keeps working. (IO is still unbuffered)
Wed May 6 16:57:55 1998 James Juran <jrj120@psu.edu>
* [Makefile.in] [Make.rules.in]
Changed "make clean" to remove `textedit` backup files (*%)
* [controls/menu.c][graphics/x11drv/xfont.c][include/libres.h]
[loader/main.c][loader/ne/module.c][scheduler/synchro.c]
[win32/time.c][windows/winpos.c][include/windows.h]
Fixed miscellaneous compilation warnings.
* [misc/main.c][miscemu/main.c][include/main.h]
Moved prototypes to new include file main.h, various cleanups.
Tue May 5 21:05:06 1998 Morten Welinder <terra@diku.dk>
* [misc/winsock.c]
Don't refer to __FreeBSD__ when HAVE_STRERROR is meant.
* [misc/debugstr.c]
For debug_dumpstrSend, send strings to stderr.
Tue May 5 21:47:40 1998 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [objects/region.c]
Fix for REGION_RegionOp() if newReg is one of the source regions.
Tue May 5 18:27:32 1998 Jim Peterson <jspeter@roanoke.infi.net>
* [misc/main.c]
Add '-h/-help' option and print WINE_RELEASE_INFO with usage message.
* [misc/spy.c]
Realign trace messages.
Tue May 5 15:46:47 1998 Donnie V. Savage <dsavage@cisco.com>
* [graphics/ddraw.c]
Fixed compile warnings
* [misc/winsock.c]
Warnings should not be errors.
Tue May 5 13:40:42 1998 Jim Peterson <jspeter@roanoke.infi.net>
* [*/*]
Remove many warnings through explicit casts, added #include's,
and corrected printf formats.
Tue May 5 05:18:12 1998 Insomnia (Stea Greene) <insomnia@core.binghamton.edu>
* [graphics/ddraw.c]
Kept unchanged portion of old palette when changing only a few
palette entries. Really should only deallocate the changed cells.
This make StarCraft work almost perfectly (sound overflows still
cause static).
Mon May 4 15:04:57 1998 Alexander V. Lukyanov <lav@long.yar.ru>
* [misc/lstr.c]
FormatMessage: terminate string on %0, undo linefeed strip.
diff --git a/loader/module.c b/loader/module.c
index 63568ee..17f1bb0 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -25,18 +25,11 @@
#include "selectors.h"
#include "stackframe.h"
#include "task.h"
-#include "toolhelp.h"
#include "debug.h"
#include "callback.h"
extern BOOL32 THREAD_InitDone;
-extern HMODULE16 hFirstModule; /* FIXME */
-static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */
-
-static HMODULE32 MODULE_LoadModule(LPCSTR name,BOOL32 force) { return 0; }
-HMODULE32 (*fnBUILTIN_LoadModule)(LPCSTR name,BOOL32 force) = MODULE_LoadModule;
-
/*************************************************************************
* MODULE32_LookupHMODULE
@@ -58,116 +51,6 @@
return NULL;
}
-/***********************************************************************
- * MODULE_GetPtr16
- */
-NE_MODULE *MODULE_GetPtr16( HMODULE16 hModule )
-{
- return (NE_MODULE*)GlobalLock16( GetExePtr(hModule) );
-}
-
-
-/***********************************************************************
- * MODULE_GetPtr32
- */
-NE_MODULE *MODULE_GetPtr32( HMODULE32 hModule )
-{
- return (NE_MODULE*)GlobalLock16( MODULE_HANDLEtoHMODULE16(hModule) );
-}
-
-/***********************************************************************
- * MODULE_HANDLEtoHMODULE16
- */
-HMODULE16
-MODULE_HANDLEtoHMODULE16(HANDLE32 handle) {
- NE_MODULE *pModule;
-
- if (HIWORD(handle))
- {
- WARN(module,"looking up 0x%08x in win16 function!\n",handle);
- /* this is a HMODULE32 */
-
- /* walk the list looking for the correct startaddress */
- pModule = (NE_MODULE *)GlobalLock16( hFirstModule );
- while (pModule)
- {
- if (pModule->module32 == handle) return pModule->self;
- pModule = (NE_MODULE*)GlobalLock16(pModule->next);
- }
- return 0;
- }
- return GetExePtr(handle);
-}
-
-/***********************************************************************
- * MODULE_OpenFile
- */
-int MODULE_OpenFile( HMODULE32 hModule )
-{
- NE_MODULE *pModule;
- DOS_FULL_NAME full_name;
- char *name;
-
- static int cachedfd = -1;
-
- hModule = MODULE_HANDLEtoHMODULE16(hModule);
- TRACE(module, "(%04x) cache: mod=%04x fd=%d\n",
- hModule, hCachedModule, cachedfd );
- if (!(pModule = MODULE_GetPtr32( hModule ))) return -1;
- if (hCachedModule == hModule) return cachedfd;
- close( cachedfd );
- hCachedModule = hModule;
- name = NE_MODULE_NAME( pModule );
- if (!DOSFS_GetFullName( name, TRUE, &full_name ) ||
- (cachedfd = open( full_name.long_name, O_RDONLY )) == -1)
- WARN( module, "Can't open file '%s' for module %04x\n",
- name, hModule );
- TRACE(module, "opened '%s' -> %d\n",
- name, cachedfd );
- return cachedfd;
-}
-
-
-/***********************************************************************
- * MODULE_CreateInstance
- *
- * If lib_only is TRUE, handle the module like a library even if it is a .EXE
- */
-HINSTANCE16 MODULE_CreateInstance( HMODULE16 hModule, HINSTANCE16 *prev,
- BOOL32 lib_only )
-{
- SEGTABLEENTRY *pSegment;
- NE_MODULE *pModule;
- int minsize;
- HINSTANCE16 hNewInstance;
-
- if (!(pModule = MODULE_GetPtr16( hModule ))) return 0;
- if (pModule->dgroup == 0)
- {
- if (prev) *prev = hModule;
- return hModule;
- }
-
- pSegment = NE_SEG_TABLE( pModule ) + pModule->dgroup - 1;
- if (prev) *prev = pSegment->selector;
-
- /* if it's a library, create a new instance only the first time */
- if (pSegment->selector)
- {
- if (pModule->flags & NE_FFLAGS_LIBMODULE) return pSegment->selector;
- if (lib_only) return pSegment->selector;
- }
-
- minsize = pSegment->minsize ? pSegment->minsize : 0x10000;
- if (pModule->ss == pModule->dgroup) minsize += pModule->stack_size;
- minsize += pModule->heap_size;
- hNewInstance = GLOBAL_Alloc( GMEM_ZEROINIT | GMEM_FIXED,
- minsize, hModule, FALSE, FALSE, FALSE );
- if (!hNewInstance) return 0;
- pSegment->selector = hNewInstance;
- return hNewInstance;
-}
-
/***********************************************************************
* MODULE_CreateDummyModule
@@ -312,63 +195,6 @@
}
-/***********************************************************************
- * MODULE_GetModuleName
- */
-LPSTR MODULE_GetModuleName( HMODULE32 hModule )
-{
- NE_MODULE *pModule;
- BYTE *p, len;
- static char buffer[10];
-
- if (!(pModule = MODULE_GetPtr32( hModule ))) return NULL;
- p = (BYTE *)pModule + pModule->name_table;
- len = MIN( *p, 8 );
- memcpy( buffer, p + 1, len );
- buffer[len] = '\0';
- return buffer;
-}
-
-
-/**********************************************************************
- * MODULE_FindModule
- *
- * Find a module from a path name.
- * RETURNS
- * the win16 module handle if found
- * 0 if not
- */
-HMODULE32 MODULE_FindModule16(
- LPCSTR path /* [in] path of the module to be found */
-) {
- HMODULE32 hModule = hFirstModule;
- LPCSTR filename, dotptr, modulepath, modulename;
- BYTE len, *name_table;
-
- if (!(filename = strrchr( path, '\\' ))) filename = path;
- else filename++;
- if ((dotptr = strrchr( filename, '.' )) != NULL)
- len = (BYTE)(dotptr - filename);
- else len = strlen( filename );
-
- while(hModule)
- {
- NE_MODULE *pModule = MODULE_GetPtr16( hModule );
- if (!pModule) break;
- modulepath = NE_MODULE_NAME(pModule);
- if (!(modulename = strrchr( modulepath, '\\' )))
- modulename = modulepath;
- else modulename++;
- if (!lstrcmpi32A( modulename, filename )) return hModule;
-
- name_table = (BYTE *)pModule + pModule->name_table;
- if ((*name_table == len) && !lstrncmpi32A(filename, name_table+1, len))
- return hModule;
- hModule = pModule->next;
- }
- return 0;
-}
-
/**********************************************************************
* MODULE_FindModule32
*
@@ -427,105 +253,6 @@
/**********************************************************************
- * MODULE_CallWEP
- *
- * Call a DLL's WEP, allowing it to shut down.
- * FIXME: we always pass the WEP WEP_FREE_DLL, never WEP_SYSTEM_EXIT
- */
-static BOOL16 MODULE_CallWEP( HMODULE16 hModule )
-{
- FARPROC16 WEP = (FARPROC16)0;
- WORD ordinal = NE_GetOrdinal( hModule, "WEP" );
-
- if (ordinal) WEP = NE_GetEntryPoint( hModule, ordinal );
- if (!WEP)
- {
- WARN(module, "module %04x doesn't have a WEP\n", hModule );
- return FALSE;
- }
- return Callbacks->CallWindowsExitProc( WEP, WEP_FREE_DLL );
-}
-
-
-/**********************************************************************
- * MODULE_FreeModule
- *
- * Remove a module from memory.
- */
-BOOL16 MODULE_FreeModule( HMODULE32 hModule, TDB* pTaskContext )
-{
- HMODULE16 *hPrevModule;
- NE_MODULE *pModule;
- SEGTABLEENTRY *pSegment;
- HMODULE16 *pModRef;
- int i;
-
- if (!(pModule = MODULE_GetPtr32( hModule ))) return FALSE;
- hModule = pModule->self;
-
- if (((INT16)(--pModule->count)) > 0 ) return TRUE;
- else pModule->count = 0;
-
- if (pModule->flags & NE_FFLAGS_BUILTIN)
- return FALSE; /* Can't free built-in module */
-
- if (pModule->flags & NE_FFLAGS_LIBMODULE)
- {
- MODULE_CallWEP( hModule );
-
- /* Free the objects owned by the DLL module */
-
- if( pTaskContext && pTaskContext->userhandler )
- {
- pTaskContext->userhandler( hModule, USIG_DLL_UNLOAD, 0,
- pTaskContext->hInstance,
- pTaskContext->hQueue );
- }
- }
- /* Clear magic number just in case */
-
- pModule->magic = pModule->self = 0;
-
- /* Remove it from the linked list */
-
- hPrevModule = &hFirstModule;
- while (*hPrevModule && (*hPrevModule != hModule))
- {
- hPrevModule = &(MODULE_GetPtr16( *hPrevModule ))->next;
- }
- if (*hPrevModule) *hPrevModule = pModule->next;
-
- /* Free all the segments */
-
- pSegment = NE_SEG_TABLE( pModule );
- for (i = 1; i <= pModule->seg_count; i++, pSegment++)
- {
- GlobalFree16( pSegment->selector );
- }
-
- /* Free the referenced modules */
-
- pModRef = (HMODULE16*)NE_MODULE_TABLE( pModule );
- for (i = 0; i < pModule->modref_count; i++, pModRef++)
- {
- FreeModule16( *pModRef );
- }
-
- /* Free the module storage */
-
- if (pModule->nrname_handle) GlobalFree16( pModule->nrname_handle );
- if (pModule->dlls_to_init) GlobalFree16( pModule->dlls_to_init );
- GlobalFree16( hModule );
-
- /* Remove module from cache */
-
- if (hCachedModule == hModule) hCachedModule = 0;
-
- return TRUE;
-}
-
-
-/**********************************************************************
* MODULE_Load
*
* Implementation of LoadModule().
@@ -534,74 +261,34 @@
* without a preceding length byte).
* If cmd_line is NULL, the module is loaded as a library even if it is a .exe
*/
-HINSTANCE16 MODULE_Load( LPCSTR name, UINT16 uFlags,
+HINSTANCE16 MODULE_Load( LPCSTR name, BOOL32 implicit,
LPCSTR cmd_line, LPCSTR env, UINT32 show_cmd )
{
- HMODULE32 hModule;
+ HMODULE16 hModule;
HINSTANCE16 hInstance, hPrevInstance;
NE_MODULE *pModule;
- OFSTRUCT ofs;
- HFILE32 hFile;
if (__winelib)
{
+ OFSTRUCT ofs;
lstrcpyn32A( ofs.szPathName, name, sizeof(ofs.szPathName) );
if ((hModule = MODULE_CreateDummyModule( &ofs )) < 32) return hModule;
pModule = (NE_MODULE *)GlobalLock16( hModule );
- hInstance = MODULE_CreateInstance( hModule, &hPrevInstance,
- (cmd_line == NULL) );
+ hInstance = NE_CreateInstance( pModule, &hPrevInstance,
+ (cmd_line == NULL) );
}
else
{
- hModule = MODULE_FindModule16( name );
-
- if (!hModule) /* We have to load the module */
- {
- /* Try to load the built-in first if not disabled */
- if ((hModule = fnBUILTIN_LoadModule( name, FALSE )))
- return MODULE_HANDLEtoHMODULE16( hModule );
-
- if ((hFile = OpenFile32( name, &ofs, OF_READ )) == HFILE_ERROR32)
- {
- /* Now try the built-in even if disabled */
- if ((hModule = fnBUILTIN_LoadModule( name, TRUE )))
- {
- WARN(module, "Could not load Windows DLL '%s', using built-in module.\n", name );
- return MODULE_HANDLEtoHMODULE16( hModule );
- }
- return 2; /* File not found */
- }
-
- /* Create the module structure */
-
- hModule = NE_LoadModule( hFile, &ofs, uFlags, cmd_line,
- env, show_cmd );
- if (hModule < 32)
- {
- if ((hModule == 21) && cmd_line)
- hModule = PE_LoadModule( hFile, &ofs, cmd_line,
- env, show_cmd );
- }
-
- if (hModule < 32)
- fprintf( stderr, "LoadModule: can't load '%s', error=%d\n",
- name, hModule );
- _lclose32( hFile );
- return hModule;
- }
- else /* module is already loaded, just create a new data segment if it's a task */
- {
- pModule = MODULE_GetPtr32( hModule );
- hInstance = MODULE_CreateInstance( hModule, &hPrevInstance,
- (cmd_line == NULL) );
- if (hInstance != hPrevInstance) /* not a library */
- NE_LoadSegment( pModule, pModule->dgroup );
- pModule->count++;
- }
- } /* !winelib */
+ hInstance = NE_LoadModule( name, &hPrevInstance, implicit,
+ (cmd_line == NULL) );
+ if ((hInstance == 21) && cmd_line)
+ return PE_LoadModule( name, cmd_line, env, show_cmd );
+ }
/* Create a task for this instance */
+ if (hInstance < 32) return hInstance;
+ pModule = NE_GetPtr( hInstance );
if (cmd_line && !(pModule->flags & NE_FFLAGS_LIBMODULE))
{
PDB32 *pdb;
@@ -622,9 +309,8 @@
*/
HINSTANCE16 LoadModule16( LPCSTR name, LPVOID paramBlock )
{
- LOADPARAMS *params = (LOADPARAMS *)paramBlock;
- LPSTR cmd_line = (LPSTR)PTR_SEG_TO_LIN( params->cmdLine );
- LPSTR new_cmd_line;
+ LOADPARAMS *params;
+ LPSTR cmd_line, new_cmd_line;
UINT16 show_cmd = 0;
LPCVOID env = NULL;
HINSTANCE16 hInstance;
@@ -649,7 +335,7 @@
strcat( new_cmd_line, cmd_line );
if (params->hEnvironment) env = GlobalLock16( params->hEnvironment );
- hInstance = MODULE_Load( name, 0, new_cmd_line, env, show_cmd );
+ hInstance = MODULE_Load( name, FALSE, new_cmd_line, env, show_cmd );
if (params->hEnvironment) GlobalUnlock16( params->hEnvironment );
HeapFree( GetProcessHeap(), 0, new_cmd_line );
return hInstance;
@@ -682,41 +368,12 @@
CloseHandle32(pi.hThread);
#else
- return MODULE_Load( name, 0, params->lpCmdLine, params->lpEnvAddress,
+ return MODULE_Load( name, FALSE, params->lpCmdLine, params->lpEnvAddress,
*((UINT16 *)params->lpCmdShow + 1) );
#endif
}
-/**********************************************************************
- * FreeModule16 (KERNEL.46)
- */
-BOOL16 WINAPI FreeModule16( HMODULE16 hModule )
-{
- NE_MODULE *pModule;
-
- if (!(pModule = MODULE_GetPtr16( hModule ))) return FALSE;
- TRACE(module, "%s count %d\n",
- MODULE_GetModuleName(hModule), pModule->count );
-
- return MODULE_FreeModule( hModule, GlobalLock16(GetCurrentTask()) );
-}
-
-
-/**********************************************************************
- * GetModuleHandle16 (KERNEL.47)
- */
-HMODULE16 WINAPI WIN16_GetModuleHandle( SEGPTR name )
-{
- if (HIWORD(name) == 0) return GetExePtr( (HINSTANCE16)name );
- return MODULE_FindModule16( PTR_SEG_TO_LIN(name) );
-}
-
-HMODULE16 WINAPI GetModuleHandle16( LPCSTR name )
-{
- return MODULE_FindModule16( name );
-}
-
/***********************************************************************
* GetModuleHandle (KERNEL32.237)
*/
@@ -740,52 +397,23 @@
}
-/**********************************************************************
- * GetModuleUsage (KERNEL.48)
- */
-INT16 WINAPI GetModuleUsage( HINSTANCE16 hModule )
-{
- NE_MODULE *pModule;
-
- if (!(pModule = MODULE_GetPtr16( hModule ))) return 0;
- TRACE(module, "(%04x): returning %d\n",
- hModule, pModule->count );
- return pModule->count;
-}
-
-
-/**********************************************************************
- * GetModuleFileName16 (KERNEL.49)
- */
-INT16 WINAPI GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName,
- INT16 nSize )
-{
- NE_MODULE *pModule;
-
- if (!hModule) hModule = GetCurrentTask();
- if (!(pModule = MODULE_GetPtr16( hModule ))) return 0;
- lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), nSize );
- TRACE(module, "%s\n", lpFileName );
- return strlen(lpFileName);
-}
-
-
/***********************************************************************
* GetModuleFileName32A (KERNEL32.235)
- * FIXME FIXME
*/
-DWORD WINAPI GetModuleFileName32A( HMODULE32 hModule, LPSTR lpFileName,
- DWORD size )
-{
- NE_MODULE *pModule;
-
- if (!hModule)
- {
- TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
- hModule = pTask->hInstance;
- }
- if (!(pModule = MODULE_GetPtr32( hModule ))) return 0;
- lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), size );
+DWORD WINAPI GetModuleFileName32A(
+ HMODULE32 hModule, /* [in] module handle (32bit) */
+ LPSTR lpFileName, /* [out] filenamebuffer */
+ DWORD size /* [in] size of filenamebuffer */
+) {
+ WINE_MODREF *wm = MODULE32_LookupHMODULE(PROCESS_Current(),hModule);
+
+ if (!wm) /* can happen on start up or the like */
+ return 0;
+
+ /* FIXME: we should probably get a real long name, but wm->longname
+ * is currently a UNIX filename!
+ */
+ lstrcpyn32A( lpFileName, wm->shortname, size );
TRACE(module, "%s\n", lpFileName );
return strlen(lpFileName);
}
@@ -805,19 +433,6 @@
}
-/**********************************************************************
- * GetModuleName (KERNEL.27)
- */
-BOOL16 WINAPI GetModuleName( HINSTANCE16 hinst, LPSTR buf, INT16 nSize )
-{
- LPSTR name = MODULE_GetModuleName(hinst);
-
- if (!name) return FALSE;
- lstrcpyn32A( buf, name, nSize );
- return TRUE;
-}
-
-
/***********************************************************************
* LoadLibraryEx32W (KERNEL.513)
* FIXME
@@ -882,29 +497,8 @@
*/
BOOL32 WINAPI FreeLibrary32(HINSTANCE32 hLibModule)
{
- TRACE(module,"hLibModule=%08x\n", hLibModule);
- return MODULE_FreeModule(hLibModule,GlobalLock16(GetCurrentTask()) );
-}
-
-
-/***********************************************************************
- * LoadLibrary (KERNEL.95)
- */
-HINSTANCE16 WINAPI LoadLibrary16( LPCSTR libname )
-{
- HINSTANCE16 handle;
-
- TRACE(module, "(%08x) %s\n", (int)libname, libname);
-
- handle = MODULE_Load( libname, 0, NULL, NULL, 0 );
- if (handle == (HINSTANCE16)2) /* file not found */
- {
- char buffer[256];
- lstrcpyn32A( buffer, libname, 252 );
- strcat( buffer, ".dll" );
- handle = MODULE_Load( buffer, 0, NULL, NULL, 0 );
- }
- return handle;
+ WARN(module,"(%08x): stub\n", hLibModule);
+ return TRUE; /* FIXME */
}
@@ -919,15 +513,6 @@
}
-/***********************************************************************
- * FreeLibrary16 (KERNEL.96)
- */
-void WINAPI FreeLibrary16( HINSTANCE16 handle )
-{
- TRACE(module,"%04x\n", handle );
- FreeModule16( handle );
-}
-
/***********************************************************************
* PrivateFreeLibrary (KERNEL32)
@@ -1001,7 +586,7 @@
{
/* Winelib: Use LoadModule() only for the program itself */
if (__winelib) use_load_module = 0;
- handle = MODULE_Load( filename, 0, lpCmdLine, NULL, nCmdShow );
+ handle = MODULE_Load( filename, FALSE, lpCmdLine, NULL, nCmdShow );
if (handle == 2) /* file not found */
{
/* Check that the original file name did not have a suffix */
@@ -1011,7 +596,7 @@
{
p = filename + strlen(filename);
strcpy( p, ".exe" );
- handle = MODULE_Load( filename, 0, lpCmdLine,
+ handle = MODULE_Load( filename, FALSE, lpCmdLine,
NULL, nCmdShow );
*p = '\0'; /* Remove extension */
}
@@ -1094,7 +679,7 @@
* WIN32_GetProcAddress16 (KERNEL32.36)
* Get procaddress in 16bit module from win32... (kernel32 undoc. ordinal func)
*/
-FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE32 hModule, LPSTR name )
+FARPROC16 WINAPI WIN32_GetProcAddress16( HMODULE32 hModule, LPCSTR name )
{
WORD ordinal;
FARPROC16 ret;
@@ -1103,7 +688,12 @@
WARN(module,"hModule may not be 0!\n");
return (FARPROC16)0;
}
- hModule = MODULE_HANDLEtoHMODULE16(hModule);
+ if (HIWORD(hModule))
+ {
+ WARN( module, "hModule is Win32 handle (%08x)\n", hModule );
+ return (FARPROC16)0;
+ }
+ hModule = GetExePtr( hModule );
if (HIWORD(name)) {
ordinal = NE_GetOrdinal( hModule, name );
TRACE(module, "%04x '%s'\n",
@@ -1201,78 +791,3 @@
if (!wm || (wm->type != MODULE32_PE)) return (LPIMAGE_NT_HEADERS)0;
return PE_HEADER(wm->module);
}
-
-
-/**********************************************************************
- * GetExpWinVer (KERNEL.167)
- */
-WORD WINAPI GetExpWinVer( HMODULE16 hModule )
-{
- NE_MODULE *pModule = MODULE_GetPtr16( hModule );
- return pModule ? pModule->expected_version : 0;
-}
-
-
-/**********************************************************************
- * IsSharedSelector (KERNEL.345)
- */
-BOOL16 WINAPI IsSharedSelector( HANDLE16 selector )
-{
- /* Check whether the selector belongs to a DLL */
- NE_MODULE *pModule = MODULE_GetPtr16( selector );
- if (!pModule) return FALSE;
- return (pModule->flags & NE_FFLAGS_LIBMODULE) != 0;
-}
-
-
-/**********************************************************************
- * ModuleFirst (TOOLHELP.59)
- */
-BOOL16 WINAPI ModuleFirst( MODULEENTRY *lpme )
-{
- lpme->wNext = hFirstModule;
- return ModuleNext( lpme );
-}
-
-
-/**********************************************************************
- * ModuleNext (TOOLHELP.60)
- */
-BOOL16 WINAPI ModuleNext( MODULEENTRY *lpme )
-{
- NE_MODULE *pModule;
- char *name;
-
- if (!lpme->wNext) return FALSE;
- if (!(pModule = MODULE_GetPtr16( lpme->wNext ))) return FALSE;
- name = (char *)pModule + pModule->name_table;
- memcpy( lpme->szModule, name + 1, *name );
- lpme->szModule[(BYTE)*name] = '\0';
- lpme->hModule = lpme->wNext;
- lpme->wcUsage = pModule->count;
- strncpy( lpme->szExePath, NE_MODULE_NAME(pModule), MAX_PATH );
- lpme->szExePath[MAX_PATH] = '\0';
- lpme->wNext = pModule->next;
- return TRUE;
-}
-
-
-/**********************************************************************
- * ModuleFindName (TOOLHELP.61)
- */
-BOOL16 WINAPI ModuleFindName( MODULEENTRY *lpme, LPCSTR name )
-{
- lpme->wNext = GetModuleHandle16( name );
- return ModuleNext( lpme );
-}
-
-
-/**********************************************************************
- * ModuleFindHandle (TOOLHELP.62)
- */
-BOOL16 WINAPI ModuleFindHandle( MODULEENTRY *lpme, HMODULE16 hModule )
-{
- hModule = GetExePtr( hModule );
- lpme->wNext = hModule;
- return ModuleNext( lpme );
-}