wine-wine/dlls/kernel32/module.c

866 lines
25 KiB
C
Raw Normal View History

Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
/*
* Modules
*
* Copyright 1995 Alexandre Julliard
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
*/
#include "config.h"
2002-08-28 23:42:34 +00:00
#include "wine/port.h"
Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
#include <fcntl.h>
#include <stdarg.h>
2003-11-27 00:59:36 +00:00
#include <stdio.h>
Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#ifdef HAVE_UNISTD_H
# include <unistd.h>
#endif
2005-11-28 16:32:54 +00:00
#include "ntstatus.h"
#define WIN32_NO_STATUS
Release 980822 Sat Aug 22 17:46:19 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [include/dosexe.h] [include/module.h] [include/pe_image.h] [include/process.h] [include/windows.h] [loader/dos/module.c] [loader/module.c] [loader/ne/module.c] [loader/pe_image.c] [scheduler/process.c] [win32/process.c] Partially implemented CreateProcess32. * [win32/device.c] [relay32/kernel32.spec] [scheduler/k32obj.c] [misc/registry.c] [win32/file.c] Partially implemented VxDCall (VMM registry services). * [files/dos_fs.c] DOSFS_FindNext made thread-safe. * [include/sig_context.h] [include/syslevel.h] [loader/signal.c] [scheduler/syslevel.c] [tools/build.c] Replaced CALLTO16_Current_fs by SYSLEVEL_Win16CurrentTeb. * [win32/kernel32.c] Bugfix: QT_Thunk/FT_Thunk should return 'long' in DX:AX, not EAX. * [if1632/relay.c] [relay32/builtin32.c] [windows/msgbox.c] [msdos/int20.c] [msdos/int21.c] Use ExitProcess instead of TASK_KillCurrentTask. * [include/task.h] [include/thread.h] [loader/task.c] [scheduler/thread.c] [include/queue.h] [windows/message.c] [windows/queue.c] [windows/win.c] Prevent Win32 threads from entering the TASK_Reschedule loop. (Note: Win32 messaging still doesn't work correctly; this patch is just preventing the system from crashing when Win32 threads call messaging functions. Messages will probably still get lost.) * [scheduler/critsection.c] Deactivated the use of SEM_UNDO for the SYSTEM_LOCK semaphore; for some reason, this leads to problems after threads terminate... Sat Aug 22 15:00:00 1998 Jrgen Schmied <juergen.schmied@metronet.de> * [include/authors.h] New file, includes all names of the developer (former shell.c) * [Makefile.in][configure][configure.in][dlls/Makefile.in] [dlls/shell32/Makefile.in][shres.rc] Created dlls/shell32 and moved the shell32 stuff in it. Started to create internal resources. * [dlls/shell32/*] Split the shell32 implementation into smaller files. New classes: IContextMenu, IExtractIcon, IShellView. Implemented Shell_GetImageList(). shell32 links to comctl32 now dynamically so it can use internal/external implementations. * [documentation/internal-dll] [documentation/shell32] New, could anybody do a spellcheck? * [include/commctrl.h] Many new LV constants, structures, functions. * [controls/comctl32undoc.c] Rewrote the DSA* functions. * [windows/winpos.c] SetShellWindow32, GetShellWindow32. Sat Aug 22 14:02:15 1998 Alexander Lukyanov <lav@long.yar.ru> * [loader/resource.c] Mark last accelerator as such in LoadAccelerators32W. * [relay32/shell32.spec] [misc/shell.c] Add stubs for SHGetSpecialFolderPath[AW]. Sat Aug 22 02:07:42 1998 Adrian Harvey <adrian@select.com.au> * [include/file.h] [file/file.c] [msdos/int21.c] [msdos/vxd.c] [misc/lzexpand.c] [win32/kernel32.c] [documentation/filehandles] Fixed file handle handling. Created universal HFILE16 to HFILE32 translation macro from msdos/int21 code by Ove Kaaven. Used macro in all Win16 functions so that win32 handles are translated to avoid DOS/Win16 stdxx handles. Removed handle translation from int21.c where Win16 functions are called. Changed remaining calls to use new macro names. Documented filehandle handling and differences between win 16 & 32. Fri Aug 21 20:32:49 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [server/process.c] [server/thread.c] Implemented object wait queues and synchronization. Fri Aug 21 18:40:02 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk> * [graphics/psdrv/*] DEVMODE dmPaper{Width|Length} fields are in 0.1mm. Select a 100 pixel default font in CreateDC. Thu Aug 20 22:47:39 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [objects/bitmap.c] Handle bits=32 in SetBitmapBits32 and GetBitmapBits32. * [msdos/int21.c] Add handling of Int21 0A and 37. * [misc/commdlg.c] Use MapHModuleLS and MapHModuleSL when translating HINSTANCE16 to HINSTANCE32 and vice versa. * [win32/file.c] CreateFile32A: Abort if filename == NULL. Thu Aug 20 12:28:31 1998 Marcus Meissner <marcus@jet.franken.de> * [*/*] Lots of missing prototypes added, some parameter types adapted to match SDK. * [debugger/stabs.c] Don't loop forever if we don't find wine or one of the libxxx.so. * [loader/ne/module.c] Implemented MapHModuleLS,MapHModuleSL,MapHinstLS,MapHinstSL. * [misc/network.c] Implemented WNetGetUser32A. * [misc/shellord.c] Implemented ILRemoveLastID. * [multimedia/dsound.c] Fixed StarCraft memory leak. * [graphics/ddraw.c] Removed some unnecessary simple relaying functions, tried polishing up the Xlib implementation (still doesn't work), temp. removed Xshm code (to be remerged with working Xlib code). Tue Aug 18 22:29:17 1998 Ove Kaaven <ovek@arcticnet.no> * [multimedia/mmio.c] [multimedia/mmsystem.c] Fixed most mmio bugs, fully implementing mmioSetBuffer buffering, ability to read memory files, and the sndPlaySound() SND_MEMORY flag. Most mmio-using programs now work fine. * [include/dosexe.h] [include/miscemu.h] [include/module.h] [loader/module.c] [loader/task.c] [msdos/dosmem.c] Improved DOS VM flexibility and portability somewhat. (Did I get the #ifdefs right this time, BSD-ers?) * [msdos/int21.c] Made "Get Current PSP address" work as expected in a DOS VM. * [loader/dos/*] Began improving flexibility and portability somewhat. It should be easier to add DPMI RMCB callbacks now. The DOS VM no longer leaves big files lying around in /tmp after a crash. Tue Aug 18 12:38:31 1998 Turchanov Sergey <turchanov@usa.net> * [relay32/winmm.spec] This patch allows WinAmp to play WAV files (at least in PCM format). Sun Aug 16 05:34:13 1998 Pablo Saratxaga <srtxg@chanae.alphanet.ch> * [windows/keyboard.c] Corrected keyboard code to properly handle keys : ? ~ and " on non US keyboards. Sat Aug 15 18:47:14 1998 Brian Craft <bcboy@dorothy.wanglab.brandeis.edu> * [windows/win.c] Fixed severe bug in EnumChildWindwos(). Thu Aug 13 21:05:35 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [controls/tooltips.c] Fixed some bugs. Added subclassing support. * [controls/toolbar.c] Improved tooltip integration. Fixed some bugs. * [controls/commctrl.c] Changed control registration and added some documentation. Fixed ShowHideMenuCtl. * [controls/rebar.c][include/rebar.h][include/commctrl.h] Improved rebar implementation (still no display). * [controls/pager.c][include/pager.h][include/commctrl.h] Improved pager implementation (still no display). * [misc/imagelist.c] Fixed a bug. * [documentation/common_controls] Updated. Sun Aug 9 19:50:20 1998 James Juran <jrj120@psu.edu> * [Makefile.in] [documentation/Makefile.in] [programs/Makefile.in] [programs/*/Makefile.in] Added uninstall rules, cleaned up install rules a little bit. Sun Aug 9 13:21:35 1998 Andreas Mohr <100.30936@germany.net> * [loader/ne/module.c] [if1632/kernel.spec] Added the undocumented HIWORD of GetModuleHandle (hFirstModule). * [loader/ne/segment.c] Wine forgot to set some NE_SEGFLAGS_*. Combined with another loader change, this fixed the "BLINKER -- error in loading module" or ghost MessageBox problem that about 1% of all Windows programs have. Some BLINKER programs still don't work, though. But I'm working on it, with great help from Blinkinc. * [loader/task.c] InitTask needs to decrement the SP register by two as Win95 does. Sun Aug 9 02:41:28 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [if1632/kernel.spec] [relay32/kernel32.spec] [scheduler/syslevel.c] [loader/main.c] [win32/ordinals.c] [include/syslevel.h] [scheduler/Makefile.in] Implemented Win95 'syslevel' routines (including Win16Lock). * [if1632/relay.c] [if1632/thunk.c] [tools/build.c] [loader/task.c] [loader/ne/segment.c] [win32/kernel32.c] [memory/selector.c] [include/stackframe.h] [include/thread.h] 16-bit %fs handling revised. Use Win16Lock where appropriate. * [include/thread.h] [scheduler/synchro.c] [windows/message.c] [windows/queue.c] [win32/process.c] Implemented MsgWaitForMultipleObjects. * [files/change.c] [files/Makefile.in] [scheduler/k32obj.c] [win32/newfns.c] Implemented (dummy) file change notification objects. * [debugger/dbg.y] [scheduler/process.c] [scheduler/thread.c] [include/process.h] [include/thread.h] Suspend all threads except current when hitting debugger break point. * [objects/dib.c] Bugfix for CreateDIBSection.
1998-08-22 19:03:56 +00:00
#include "winerror.h"
#include "windef.h"
#include "winbase.h"
#include "winternl.h"
#include "kernel_private.h"
#include "psapi.h"
#include "wine/exception.h"
#include "wine/list.h"
#include "wine/asm.h"
#include "wine/debug.h"
#include "wine/unicode.h"
Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
WINE_DEFAULT_DEBUG_CHANNEL(module);
2005-08-02 14:56:53 +00:00
/****************************************************************************
* GetDllDirectoryA (KERNEL32.@)
*/
DWORD WINAPI GetDllDirectoryA( DWORD buf_len, LPSTR buffer )
{
UNICODE_STRING str;
NTSTATUS status;
WCHAR data[MAX_PATH];
2005-08-02 14:56:53 +00:00
DWORD len;
str.Buffer = data;
str.MaximumLength = sizeof(data);
for (;;)
{
status = LdrGetDllDirectory( &str );
if (status != STATUS_BUFFER_TOO_SMALL) break;
if (str.Buffer != data) HeapFree( GetProcessHeap(), 0, str.Buffer );
str.MaximumLength = str.Length;
if (!(str.Buffer = HeapAlloc( GetProcessHeap(), 0, str.MaximumLength )))
{
status = STATUS_NO_MEMORY;
break;
}
}
if (!set_ntstatus( status )) return 0;
len = FILE_name_WtoA( str.Buffer, str.Length / sizeof(WCHAR), NULL, 0 );
2005-08-02 14:56:53 +00:00
if (buffer && buf_len > len)
{
FILE_name_WtoA( str.Buffer, -1, buffer, buf_len );
2005-08-02 14:56:53 +00:00
}
else
{
len++; /* for terminating null */
if (buffer) *buffer = 0;
}
if (str.Buffer != data) HeapFree( GetProcessHeap(), 0, str.Buffer );
2005-08-02 14:56:53 +00:00
return len;
}
/****************************************************************************
* GetDllDirectoryW (KERNEL32.@)
*/
DWORD WINAPI GetDllDirectoryW( DWORD buf_len, LPWSTR buffer )
{
UNICODE_STRING str;
NTSTATUS status;
2005-08-02 14:56:53 +00:00
str.Buffer = buffer;
str.MaximumLength = min( buf_len, UNICODE_STRING_MAX_CHARS ) * sizeof(WCHAR);
status = LdrGetDllDirectory( &str );
if (status == STATUS_BUFFER_TOO_SMALL) status = STATUS_SUCCESS;
if (!set_ntstatus( status )) return 0;
return str.Length / sizeof(WCHAR);
2005-08-02 14:56:53 +00:00
}
/****************************************************************************
* SetDllDirectoryA (KERNEL32.@)
*/
BOOL WINAPI SetDllDirectoryA( LPCSTR dir )
{
WCHAR *dirW = NULL;
2005-08-02 14:56:53 +00:00
BOOL ret;
if (dir && !(dirW = FILE_name_AtoW( dir, TRUE ))) return FALSE;
2005-08-02 14:56:53 +00:00
ret = SetDllDirectoryW( dirW );
HeapFree( GetProcessHeap(), 0, dirW );
return ret;
}
/****************************************************************************
* SetDllDirectoryW (KERNEL32.@)
*/
BOOL WINAPI SetDllDirectoryW( LPCWSTR dir )
{
UNICODE_STRING str;
2005-08-02 14:56:53 +00:00
RtlInitUnicodeString( &str, dir );
return set_ntstatus( LdrSetDllDirectory( &str ));
}
/***********************************************************************
2003-10-14 01:16:59 +00:00
* GetBinaryTypeW [KERNEL32.@]
*
2003-10-01 03:20:21 +00:00
* Determine whether a file is executable, and if so, what kind.
*
* PARAMS
* lpApplicationName [I] Path of the file to check
* lpBinaryType [O] Destination for the binary type
*
* RETURNS
* TRUE, if the file is an executable, in which case lpBinaryType is set.
* FALSE, if the file is not an executable or if the function fails.
*
* NOTES
2008-05-06 18:01:59 +00:00
* The type of executable is a property that determines which subsystem an
2003-10-01 03:20:21 +00:00
* executable file runs under. lpBinaryType can be set to one of the following
* values:
* SCS_32BIT_BINARY: A Win32 based application
* SCS_64BIT_BINARY: A Win64 based application
2003-10-01 03:20:21 +00:00
* SCS_DOS_BINARY: An MS-Dos based application
* SCS_WOW_BINARY: A Win16 based application
* SCS_PIF_BINARY: A PIF file that executes an MS-Dos based app
* SCS_POSIX_BINARY: A POSIX based application ( Not implemented )
* SCS_OS216_BINARY: A 16bit OS/2 based application
*
* To find the binary type, this function reads in the files header information.
* If extended header information is not present it will assume that the file
* is a DOS executable. If extended header information is present it will
* determine if the file is a 16, 32 or 64 bit Windows executable by checking the
2003-10-01 03:20:21 +00:00
* flags in the header.
*
* ".com" and ".pif" files are only recognized by their file name extension,
* as per native Windows.
Release 950430 Sat Apr 29 20:42:01 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/static.c] Fixed painting of SS_*FRAME controls. * [if1632/callback.c] Pass the window instance as DS to the 16-bit window procedure. Rewrote Catch() and Throw() to make them work with multiple tasks. * [loader/main.c] New function MAIN_Init() to perform initializations before the first task is started instead of doing them in InitApp(). Temporary hack to command-line parsing to load one program per command-line argument, to make testing task-switching easier. * [loader/*.c] Reimplemented modules to use a Windows-compatible layout and to allow multiple tasks and multiple module instances. Not really finished yet. * [loader/task.c] [misc/exec.c] Reimplemented tasks to use a common address space, and implemented preliminary task-switching capabilities. * [memory/global.c] Fixed bug in GlobalNext(). * [misc/main.c] Updated the list of contributors. Let me know if I forgot someone. * [miscemu/int21.c] Use one DTA per task instead of a global one. * [objects/bitblt.c] Fixed bug in BitBlt() that could cause BadMatch errors. * [tools/build.c] Added new function type 'stub', that makes possible to export an unimplemented function by name as well as by ordinal. This will avoid loading errors for unimplemented functions. Generate an in-memory module layout for built-in DLLs so that the same code can be used for built-in and loaded modules. Changed relay code to make it unnecessary to save the value of the BP register. * [windows/message.c] Implemented multiple message queues and preliminary task-switching capabilities. Inter-task SendMessage() calls are not implemented yet and will probably cause crashes if used. * [windows/property.c] Reimplemented properties and allocate them on the USER heap. * [windows/win.c] Fixed bug in SetWindowWord(). Reimplemented EnumWindows() and EnumTaskWindows(). Tue Apr 18 09:48:38 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [misc/main.c] GetSystemParametersInfo(): Additional action SPI_GETICONTITLEFONT. * [loader/resource.c] Removed the check for NE_SEGFLAGS_EXECUTEONLY, since it broke control.exe. Fixed icon loading. * [objects/font.c] [include/windows.h] Fixed a bug in InitFontsList() and worked on the EnumFonts() functions to make them comprehensible. * [controls/button.c] Fixed my previous patch to handle LBUTTONUP messages. Fri Apr 14 11:41:28 1995 Cameron Heide (heide@ee.ualberta.ca) * [misc/network.c, misc/dos_fs.c] Implemented WNetGetConnection. All that is currently supported are drives, for which the remote name is simply the redirected UNIX directory name. * [miscemu/int2?.c] More drive number validity checking. Wed Apr 12 11:28:37 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] Oops, my previous change to ListBoxDirectory broke the Borland file open dialog. Fixed. Mon Apr 10 23:17:12 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/ole2nls.spec] [misc/ole2nls.c] [misc/Imakefile] New file ole2nls.c. Added stubs for GetUserDefaultLCID, GetSystemDefaultLCID, GetUserDefaultLangID, GetSystemDefaultLangID. Mon Apr 10 10:05:18 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [memory/global.c] [memory/local.c] [include/windows.h] GlobalReAlloc(): If GMEM_MODIFY is set, don't resize the block. LocalReAlloc(): Same for LMEM_MODIFY. * [controls/listbox.c] Fixed a bug in ListBoxDirectory that prevented commdlg from working. Check for errors in some more places. * [if1632/gdi.spec] [if1632/user.spec] 16 bit callback functions should be passed as segptrs. * [include/dlls.h] [loader/ne_image.c] [loader/selector.c] [loader/library.c] Prevent a DLL from being initialized twice (Borlands Resource Workshop used to do this). Provide an additional flag for each w_file that indicates whether it's an EXE or a DLL, for combinations like pbrush.exe/.dll. * [controls/button.c] Handle LBUTTONUP messages even if the button no longer has the capture (for WinHelp). * [include/wintypes.h] FARPROC is now a segptr for the emulator and a function pointer for the library. * [misc/commdlg.c] [misc/commdlg.h] Cleaned the file dialogs up a little. They now work reasonably well, although there are still some problems (e.g. files are initially invisible). * [windows/class.c] [if1632/user.spec] [include/windows.h] GetClassInfo() must take a segptr, as it checks whether the highword is zero. GetClassName() called the wrong atom function. No surprise it didn't find anything. * [misc/lstr.c] AnsiToOem() and OemToAnsi() didn't terminate the strings. Fixed. Removed some warnings. * [if1632/relay.c] [if1632/ddeml.spec] [include/dlls.h] New spec file for the 3.1 DDEML DDL. * [controls/menu.c] Small fix to ChangeMenu - mask out the obsolete flags (MF_APPEND == MF_OWNERDRAW, this led to problems). It also had problems with the MF_BYPOSITION flag. * [windows/message.c] SendMessage(): call the WH_CALLWNDPROC hook function. This is rather ugly, I'm afraid. Windows probably passes a pointer to the 16 bit stack for speed reasons. * [windows/hook.c] [include/windows.h] Set/HookWindowsHook() shouldn't just call their *Ex counterparts, as they have slightly different semantics. MS Hearts now works somewhat, if you disable the new builtin DDEML. The graphics are completely messed up, though.
1995-04-30 10:05:20 +00:00
*/
BOOL WINAPI GetBinaryTypeW( LPCWSTR name, LPDWORD type )
{
static const WCHAR comW[] = { '.','c','o','m',0 };
static const WCHAR pifW[] = { '.','p','i','f',0 };
HANDLE hfile, mapping;
NTSTATUS status;
const WCHAR *ptr;
Release 960818 Sun Aug 18 12:17:54 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [files/drive.c] Added 'Filesystem' option in drives configuration. * [files/dos_fs.c] Added handling of case-insensitive filesystems. * [memory/selector.c] [include/stackframe.h] Removed MAKE_SEGPTR. * [misc/commdlg.c] [multimedia/mcistring.c] Replaced MAKE_SEGPTR by the SEGPTR_* macros. * [objects/bitblt.c] [windows/graphics.c] Use an intermediary pixmap to avoid some BadMatch errors on XGetImage(). Sun Aug 18 09:21:27 1996 Albrecht Kleine <kleine@ak.sax.de> * [windows/message.c] Added handling of WM_NC...mouse messages in JOURNALRECORD hook. * [misc/ver.c] Fixed a bad string result in VerQueryValue[16|32A|32W]. Fri Aug 16 19:55:04 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [if1632/crtdll.spec] [misc/crtdll.c] More additions to get win95 programs further down the road. * [if1632/kernel.spec] [loader/module.c] GetModuleName() added. LoadModule(): params->showCmd can be NULL. * [if1632/kernel32.spec] [if1632/thunk.c] ThunkConnect32() stub added. * [loader/resource.c] Entries include lastentry. * [misc/shell.c] [files/file.c] Made progman work again. Fri Aug 16 09:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/defwnd.c] [windows/winpos.c] [windows/painting.c] Icon painting fixes. * [windows/winpos.c] [windows/painting.c] Enforce and follow hrgnUpdate more closely to cut down on redundant RedrawWindow() calls. * [windows/event.c] Process ConfigureNotify only for managed windows. * [windows/winpos.c] Do not redraw parent if the window was hidden before SetWindowPos(). * [windows/nonclient.c] Omit some nonclient decoration painting for managed windows. * [controls/menu.c] [windows/mdi.c] [windows/nonclient.c] Implemented WM_NEXTMENU. * [controls/listbox.c] Multicolumn listboxes return WVR_VREDRAW on WM_NCCALCSIZE. * [misc/shell.c] Added .ICO file handling to ExtractIcon().
1996-08-18 16:21:52 +00:00
TRACE("%s\n", debugstr_w(name) );
Release 950606 Tue Jun 6 12:11:41 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [controls/menu.c] Fixed bug with drawing multi-column menus with vertical separator. * [debugger/debug.l] Fixed NULL-pointer reference after readline(). * [if1632/winprocs.spec] [miscemu/int21.c] [miscemu/interrupts.c] Added interrupt vector emulation. Allows to retrieve an interrupt vector and jump to it without crashing. * [loader/ldt.c] Moved ldt.c to memory directory. * [loader/task.c] Implemented LockCurrentTask() and GetInstanceData(). * [objects/bitblt.c] Fixed a bug that caused StretchBlt() to use wrong colors when stretching a monochrome bitmap to a color display. * [objects/bitmap.c] Fixed a segmented pointer bug in CreateBitmapIndirect(). * [tools/build.c] Added possibility to have arguments for register functions; used by interrupt vectors to remove the flags from the stack. Generate a new function CallTo32_LargeStack(), that allows calling a 32-bit function using the original 32-bit stack, for functions that need more that 64k of stack. Tue May 30 10:29:56 1995 Martin von Loewis <martin@informatik.hu-berlin.de> * [if1632/shell.spec] [misc/shell.c] DoEnvironmentSubst: fixed prototype * [if1632/gdi.spec] [objects/palette.c] SetSystemPaletteUse: new function * [if1632/kernel.spec] [loader/resource.c] DirectResAlloc: new function * [if1632/user.spec] [windows/keyboard.c] SetKeyboardState: new function Mon May 29 12:58:28 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [tools/build.c] Prevent interrupts from destroying the args for a 32 bit function by loading the correct value into %esp directly after %ss. * [loader/ne_image.c] [loader/module.c] The new instance must be created earlier in LoadModule(), so that fixups referencing it will be handled correctly. Initialize the local heap for a DGROUP in NE_LoadSegment(). * [objects/dib.c] Like RLE8 bitmaps, RLE4 bitmaps don't always end with a proper code. This used to crash Wine. Fixed. * [objects/text.c] Fix possible null pointer dereference in debugging output. * [misc/commdlg.c] Handle user input in the edit control better. Some bugs fixed. * [memory/local.c] Started implementing moveable blocks. This is unfinished (!), but at least it does not seem to break things. Wed May 24 13:26:36 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [loader/module.c] LoadModule(): DLLs occasionally have a data segment, and they work much better if it is loaded :-) LoadLibrary(): pass HMODULE instead of HINSTANCE to NE_InitializeDLLs. FindModule(): also strip off the last backslash of the pathnames (Winhelp tried to load C:\WINDOWS\SYSTEM\COMMDLG.DLL). GetModuleHandle(): just call MODULE_FindModule, it does the same job, only better. * [loader/ne_image.c] LocalInit() the heap of a DLL in NE_InitDLL. (This is probably not really correct, it seems that all programs and DLLs try to do this themselves. But they pass weird parameters.) NE_InitializeDLLs should also call NE_InitDLL for the passed hModule. * [loader/task.c] [misc/user.c] Finish global initializations in InitTask instead of InitApp, or all the DLLs will be initialized in InitTask without any available window classes!
1995-06-06 16:40:35 +00:00
if (type == NULL) return FALSE;
hfile = CreateFileW( name, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
if ( hfile == INVALID_HANDLE_VALUE )
return FALSE;
status = NtCreateSection( &mapping, STANDARD_RIGHTS_REQUIRED | SECTION_QUERY,
NULL, NULL, PAGE_READONLY, SEC_IMAGE, hfile );
CloseHandle( hfile );
switch (status)
2003-10-14 01:16:59 +00:00
{
case STATUS_SUCCESS:
{
SECTION_IMAGE_INFORMATION info;
status = NtQuerySection( mapping, SectionImageInformation, &info, sizeof(info), NULL );
CloseHandle( mapping );
if (status) return FALSE;
switch (info.Machine)
{
case IMAGE_FILE_MACHINE_I386:
case IMAGE_FILE_MACHINE_ARM:
case IMAGE_FILE_MACHINE_THUMB:
case IMAGE_FILE_MACHINE_ARMNT:
case IMAGE_FILE_MACHINE_POWERPC:
*type = SCS_32BIT_BINARY;
return TRUE;
case IMAGE_FILE_MACHINE_AMD64:
case IMAGE_FILE_MACHINE_ARM64:
*type = SCS_64BIT_BINARY;
return TRUE;
}
return FALSE;
}
case STATUS_INVALID_IMAGE_WIN_16:
*type = SCS_WOW_BINARY;
return TRUE;
case STATUS_INVALID_IMAGE_WIN_32:
*type = SCS_32BIT_BINARY;
return TRUE;
case STATUS_INVALID_IMAGE_WIN_64:
*type = SCS_64BIT_BINARY;
return TRUE;
case STATUS_INVALID_IMAGE_NE_FORMAT:
*type = SCS_OS216_BINARY;
return TRUE;
case STATUS_INVALID_IMAGE_PROTECT:
*type = SCS_DOS_BINARY;
return TRUE;
case STATUS_INVALID_IMAGE_NOT_MZ:
if ((ptr = strrchrW( name, '.' )))
{
if (!strcmpiW( ptr, comW ))
{
*type = SCS_DOS_BINARY;
return TRUE;
}
if (!strcmpiW( ptr, pifW ))
{
*type = SCS_PIF_BINARY;
return TRUE;
}
}
return FALSE;
default:
return FALSE;
}
Release 950522 Sun May 21 12:30:30 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/hash.c] [debugger/info.c] Added support for symbolic segmented addresses. Add symbols for all built-in API entry points. * [if1632/relay.c] [include/dlls.h] Removed dll_table structure, as we now use the built-in module structures. * [if1632/relay.c] [loader/main.c] Removed winestat option, as it was no longer very meaningful. * [include/stackframe.h] New macro MAKE_SEGPTR that creates a segmented pointer to a local variable on the 32-bit stack. * [loader/module.c] Added support for multiple instances of an application. Implemented LoadModule() and FreeModule(). * [loader/ne_image.c] [loader/task.c] Moved initialisation of built-in DLLs to InitTask(). * [memory/global.c] Implemented discardable blocks. * [misc/file.c] Search path of current executable in OpenFile(). Fixed bug with searching in Windows path. * [misc/lstr.c] Hard-coded translation tables for Ansi<->Oem. * [misc/user.c] Moved some global initializations to InitApp(), because they need a task context to be performed. * [objects/dc.c] Handle R2_BLACK and R2_WHITE specially so that they work correctly with palette displays. * [tools/build.c] Suppressed generation of the C file for DLL specs, because it's no longer needed. Output all the assembly code directly to stdout. Some changes to integrate Win32 support from Martin von Loewis. * [windows/msgbox.c] Moved message box code from misc/ to windows/. Mon May 15 23:40:04 1995 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca) * [misc/audio.c] [misc/mcicda.c] [misc/mcianim.c] [misc/midi.c] [misc/mmaux.c] [misc/mmsystem.c] Modify code & use pointers conversion macros. Make cdaudio & wave devices work again (only using some applets). * [misc/profile.c] Change getc() to fgetc() where needed. Mon May 15 22:10:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/Imakefile] added entries for the new files gdi32.spec, kernel32.spec, user32.spec, shell32.spec and winprocs32.spec. * [if1632/commdlg.spec][if1632/kernel.spec][if1632/shell.spec] [if1632/storage.spec][if1632/system.spec][if1632/user.spec] ChooseFont, RESERVED5, InternalExtractIcon: Marked as stubs ExtractAssociatedIcon, DoEnvironmentSubst, DumpIcon: stub implementations provided marked storage.dll,storege.sys functions as stubs * [include/pe_image.h] Added structures WIN32_builtin and WIN32_function * [include/peexe.h] PE_Import_Directory: renamed reserved fields to TimeDate, Forwarder, Thunk_List * [include/winerror.h] New file. * [loader/main.c] called RELAY32_Init * [loader/pe_image.c] xmmap: map BSS anonymous dump_imports: renamed to fixup_imports, do the fixup of imported symbols PE_LoadImage: pass raw data size to xmmap * [loader/resource.c] DumpIcon: new function * [misc/kernel32.c] New file. * [misc/main.c] make stdout and stderr unbuffered * [misc/shell.c] DoEnvironmentSubst: new function * [objects/font.c] FONT_MatchFont: try oblique if there is no italic * [rc/Imakefile][rc/parser.l] yywrap: new function Don't link with libfl.a on Linux * [tools/build.c] Added keywords stdcall, subsystem, base GenerateForWin32: new function BuildSpecFiles: call GenerateForWin32 if subsystem is win32 Mon May 15 10:38:14 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] [controls/combo.c] [windows/defwnd.c] Minor fixes. * [misc/message.c] [misc/main.c] [rc/sysres*.rc] [include/texts.h] Rewrote message box handling. * [windows/dialog.c] Dialogs should be invisible until after WM_INITDIALOG is seent. Don't switch to invisible dialog items on a TAB keypress. * [windows/mdi.c] Send WM_NCPAINT message in MDIRestoreChild(). * [windows/painting.c] Fixed typo (&& -> &). * [windows/message.c] [if1632/user.spec] Implemented PostAppMessage(). * [windows/event.c] SetCapture(0) should act like ReleaseCapture(). Tue May 9 11:55:52 1995 Eddie C. Dost (ecd@dressler.de) * [Imakefile] Changed CDEBUGFLAGS for systems running __ELF__ (temporarily) Added ASFLAGS to exported variables. * [debugger/readline/Imakefile] Moved defines for libreadline from DEFINES to EXTRA_DEFINES * [memory/local.c] [miscemu/int21.c] Added some more debugging outputs. Mon May 8 00:55:27 MET DST 1995 Dag Asheim (dash@ifi.uio.no) * [misc/message.c] Fixed a "FIXME" concerning norwegian translation. Sun May 7 23:25:23 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [*/*] Removed warnings in a couple of files and deleted some obsolete code. * [controls/listbox.c] Cleanup, speed improvements & lots of bug fixes. * [controls/combo.c] Mostly rewritten. This is still very buggy, but not quite as bad as before. * [include/commdlg.h] [misc/commdlg.c] Removed the need for sysres.dll. Small bug fixes. * [objects/oembitmap.c] [include/bitmaps/<many>] [include/windows.h] [loader/library.c] [loader/main.c] [rc/sysres*.rc] Removed sysres.dll and replaced the remaining bitmaps/icons with XPM equivalents. * [misc/message.c] [windows/nonclient.c] [misc/main.c] [if1632/winprocs.spec] "About Wine..." now brings up a standard ShellAbout() window with the Wine icon and the list of contributors. * [misc/shell.c] Fixed ShellAbout()/AboutDialogProc() to show the right icon. * [windows/event.c] Small hack for non-alphanumeric keys: Dont't send the ascii value in the WM_KEYDOWN message, but some unused code instead. Should be done properly by sending different codes for each key. The edit control used to get a VK_DELETE message each time the user typed '.'. * [windows/class.c] Removed a check for CS_GLOBALCLASS in CLASS_FindClassByName(). This used to be no problem, but breaks Resource Workshop in 950403. * [objects/dib.c] New diagnostic for a bug I've been encountering. If it shows up, please report it. Sun May 7 23:11:18 EDT 1995 William Magro (wmagro@tc.cornell.edu) * [objects/color.c] Handle situation when 'dc' exists, but palette mapping does not. (Fixes kidpix2 demo.) Sun May 7 03:32:00 1995 Charles M. Hannum (mycroft@mit.edu) * [loader/ldt.c] LDT_Print: Only show the number of entries that the kernel returned. Make this work for NetBSD. Fri May 5 02:53:26 1995 Charles M. Hannum (mycroft@mit.edu) * [debugger/dbg.y] [include/wine.h] [loader/signal.c] Modify cs and ds selector values for NetBSD-current. * [debugger/debug.l] $sp, $esp: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [debugger/regpos.h] Modify sigcontext format for NetBSD-current. SC_ESP: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [include/ldt.h] SELECTOR_TO_ENTRY: Explicitly clear the top half of the selector value, since only 16 bits of it may have been saved. * [misc/winsocket.c] Set structure packing with `#pragma pack' to accomodate other/older compilers. Tue May 2 18:15:01 1995 Paal Beyer (beyer@idt.unit.no) * [misc/commdlg.c] Fixed path-names so when changing directory the listboxes changes too. * [debugger/dbg.y debugger/debug.l wine.ini] Added SymbolTableFile to wine.ini so symbols can be read without standing in the directory containing wine.sym. Added the possibility to specify full name of wine.sym from the debugger prompt.
1995-05-22 18:23:01 +00:00
}
/***********************************************************************
2003-10-14 01:16:59 +00:00
* GetBinaryTypeA [KERNEL32.@]
* GetBinaryType [KERNEL32.@]
*
* See GetBinaryTypeW.
*/
2003-10-14 01:16:59 +00:00
BOOL WINAPI GetBinaryTypeA( LPCSTR lpApplicationName, LPDWORD lpBinaryType )
{
2003-10-14 01:16:59 +00:00
ANSI_STRING app_nameA;
2003-10-14 01:16:59 +00:00
TRACE("%s\n", debugstr_a(lpApplicationName));
/* Sanity check.
*/
if ( lpApplicationName == NULL || lpBinaryType == NULL )
return FALSE;
2003-10-14 01:16:59 +00:00
RtlInitAnsiString(&app_nameA, lpApplicationName);
if (!set_ntstatus( RtlAnsiStringToUnicodeString( &NtCurrentTeb()->StaticUnicodeString,
&app_nameA, FALSE )))
return FALSE;
return GetBinaryTypeW(NtCurrentTeb()->StaticUnicodeString.Buffer, lpBinaryType);
}
Release 950522 Sun May 21 12:30:30 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/hash.c] [debugger/info.c] Added support for symbolic segmented addresses. Add symbols for all built-in API entry points. * [if1632/relay.c] [include/dlls.h] Removed dll_table structure, as we now use the built-in module structures. * [if1632/relay.c] [loader/main.c] Removed winestat option, as it was no longer very meaningful. * [include/stackframe.h] New macro MAKE_SEGPTR that creates a segmented pointer to a local variable on the 32-bit stack. * [loader/module.c] Added support for multiple instances of an application. Implemented LoadModule() and FreeModule(). * [loader/ne_image.c] [loader/task.c] Moved initialisation of built-in DLLs to InitTask(). * [memory/global.c] Implemented discardable blocks. * [misc/file.c] Search path of current executable in OpenFile(). Fixed bug with searching in Windows path. * [misc/lstr.c] Hard-coded translation tables for Ansi<->Oem. * [misc/user.c] Moved some global initializations to InitApp(), because they need a task context to be performed. * [objects/dc.c] Handle R2_BLACK and R2_WHITE specially so that they work correctly with palette displays. * [tools/build.c] Suppressed generation of the C file for DLL specs, because it's no longer needed. Output all the assembly code directly to stdout. Some changes to integrate Win32 support from Martin von Loewis. * [windows/msgbox.c] Moved message box code from misc/ to windows/. Mon May 15 23:40:04 1995 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca) * [misc/audio.c] [misc/mcicda.c] [misc/mcianim.c] [misc/midi.c] [misc/mmaux.c] [misc/mmsystem.c] Modify code & use pointers conversion macros. Make cdaudio & wave devices work again (only using some applets). * [misc/profile.c] Change getc() to fgetc() where needed. Mon May 15 22:10:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/Imakefile] added entries for the new files gdi32.spec, kernel32.spec, user32.spec, shell32.spec and winprocs32.spec. * [if1632/commdlg.spec][if1632/kernel.spec][if1632/shell.spec] [if1632/storage.spec][if1632/system.spec][if1632/user.spec] ChooseFont, RESERVED5, InternalExtractIcon: Marked as stubs ExtractAssociatedIcon, DoEnvironmentSubst, DumpIcon: stub implementations provided marked storage.dll,storege.sys functions as stubs * [include/pe_image.h] Added structures WIN32_builtin and WIN32_function * [include/peexe.h] PE_Import_Directory: renamed reserved fields to TimeDate, Forwarder, Thunk_List * [include/winerror.h] New file. * [loader/main.c] called RELAY32_Init * [loader/pe_image.c] xmmap: map BSS anonymous dump_imports: renamed to fixup_imports, do the fixup of imported symbols PE_LoadImage: pass raw data size to xmmap * [loader/resource.c] DumpIcon: new function * [misc/kernel32.c] New file. * [misc/main.c] make stdout and stderr unbuffered * [misc/shell.c] DoEnvironmentSubst: new function * [objects/font.c] FONT_MatchFont: try oblique if there is no italic * [rc/Imakefile][rc/parser.l] yywrap: new function Don't link with libfl.a on Linux * [tools/build.c] Added keywords stdcall, subsystem, base GenerateForWin32: new function BuildSpecFiles: call GenerateForWin32 if subsystem is win32 Mon May 15 10:38:14 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] [controls/combo.c] [windows/defwnd.c] Minor fixes. * [misc/message.c] [misc/main.c] [rc/sysres*.rc] [include/texts.h] Rewrote message box handling. * [windows/dialog.c] Dialogs should be invisible until after WM_INITDIALOG is seent. Don't switch to invisible dialog items on a TAB keypress. * [windows/mdi.c] Send WM_NCPAINT message in MDIRestoreChild(). * [windows/painting.c] Fixed typo (&& -> &). * [windows/message.c] [if1632/user.spec] Implemented PostAppMessage(). * [windows/event.c] SetCapture(0) should act like ReleaseCapture(). Tue May 9 11:55:52 1995 Eddie C. Dost (ecd@dressler.de) * [Imakefile] Changed CDEBUGFLAGS for systems running __ELF__ (temporarily) Added ASFLAGS to exported variables. * [debugger/readline/Imakefile] Moved defines for libreadline from DEFINES to EXTRA_DEFINES * [memory/local.c] [miscemu/int21.c] Added some more debugging outputs. Mon May 8 00:55:27 MET DST 1995 Dag Asheim (dash@ifi.uio.no) * [misc/message.c] Fixed a "FIXME" concerning norwegian translation. Sun May 7 23:25:23 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [*/*] Removed warnings in a couple of files and deleted some obsolete code. * [controls/listbox.c] Cleanup, speed improvements & lots of bug fixes. * [controls/combo.c] Mostly rewritten. This is still very buggy, but not quite as bad as before. * [include/commdlg.h] [misc/commdlg.c] Removed the need for sysres.dll. Small bug fixes. * [objects/oembitmap.c] [include/bitmaps/<many>] [include/windows.h] [loader/library.c] [loader/main.c] [rc/sysres*.rc] Removed sysres.dll and replaced the remaining bitmaps/icons with XPM equivalents. * [misc/message.c] [windows/nonclient.c] [misc/main.c] [if1632/winprocs.spec] "About Wine..." now brings up a standard ShellAbout() window with the Wine icon and the list of contributors. * [misc/shell.c] Fixed ShellAbout()/AboutDialogProc() to show the right icon. * [windows/event.c] Small hack for non-alphanumeric keys: Dont't send the ascii value in the WM_KEYDOWN message, but some unused code instead. Should be done properly by sending different codes for each key. The edit control used to get a VK_DELETE message each time the user typed '.'. * [windows/class.c] Removed a check for CS_GLOBALCLASS in CLASS_FindClassByName(). This used to be no problem, but breaks Resource Workshop in 950403. * [objects/dib.c] New diagnostic for a bug I've been encountering. If it shows up, please report it. Sun May 7 23:11:18 EDT 1995 William Magro (wmagro@tc.cornell.edu) * [objects/color.c] Handle situation when 'dc' exists, but palette mapping does not. (Fixes kidpix2 demo.) Sun May 7 03:32:00 1995 Charles M. Hannum (mycroft@mit.edu) * [loader/ldt.c] LDT_Print: Only show the number of entries that the kernel returned. Make this work for NetBSD. Fri May 5 02:53:26 1995 Charles M. Hannum (mycroft@mit.edu) * [debugger/dbg.y] [include/wine.h] [loader/signal.c] Modify cs and ds selector values for NetBSD-current. * [debugger/debug.l] $sp, $esp: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [debugger/regpos.h] Modify sigcontext format for NetBSD-current. SC_ESP: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [include/ldt.h] SELECTOR_TO_ENTRY: Explicitly clear the top half of the selector value, since only 16 bits of it may have been saved. * [misc/winsocket.c] Set structure packing with `#pragma pack' to accomodate other/older compilers. Tue May 2 18:15:01 1995 Paal Beyer (beyer@idt.unit.no) * [misc/commdlg.c] Fixed path-names so when changing directory the listboxes changes too. * [debugger/dbg.y debugger/debug.l wine.ini] Added SymbolTableFile to wine.ini so symbols can be read without standing in the directory containing wine.sym. Added the possibility to specify full name of wine.sym from the debugger prompt.
1995-05-22 18:23:01 +00:00
Release 960712 Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/scroll.c] Use Win32 heap functions to allocate scroll-bar info structure. * [debugger/dbg.y] [debugger/registers.c] Added support for FS and GS segment registers. Check that segment registers value are OK before returning from the signal handler. * [tools/build.c] [if1632/relay.c] [loader/builtin.c] Changed relay debugging for Win32 function: the relay code now passes the entry point address instead of the function name. * [tools/build.c] [miscemu/*.c] Added support for data entry points in Win32 DLLs. Added 'cdecl' function type for Win32. For 'register' function, the relay code now passes a pointer to the SIGCONTEXT structure. * [include/registers.h] [include/wine.h] Moved SIGCONTEXT structure definition in registers.h. * [loader/pe_image.c] Don't die at once if some Win32 entry points cannot be found, but set them to NULL, just like we do for Win16. This allows some programs to go further before crashing. * [loader/task.c] [loader/main.c] Moved global initializations from InitTask() to MAIN_Init(), as they no longer need a task context with the new SEGPTR heap functions. * [memory/string.c] Added lstrcpynAtoW and lstrcpynWtoA; not real API functions, but very convenient. * [windows/graphics.c] Partially implemented DrawEdge(). * [windows/timer.c] [windows/caret.c] Implemented Win32 timer handling. Updated caret management to use Win32 timers (avoids having to use a Win16 callback). * [windows/win.c] Prevent programs from setting some style bits with SetWindowLong(). This should fix some BadMatch crashes. Link new windows at the end of the linked list. * [windows/winpos.c] Don't try to activate a child window in ShowWindow(). * [windows/winproc.c] Added a 32->32 thunk to support Ansi-Unicode translation. Wed Jul 10 22:11:12 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] Additional (undocumented) return value for GetTempDrive() added. * [files/dos_fs.c] [files/file.c] [include/windows.h] GetTempFileName32* added. GetShortPathName* added. * [memory/string.c] Win16 lstrcpy() can get NULL ptrs as argument and survive. * [misc/lzexpand.c] LZOpenFile(): also try opening with compressed filename if normal open fails. * [misc/ole2nls.c] [misc/lstr.c] [include/windows.h] Char* added. CompareString* added. Sun Jul 7 01:22:14 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [objects/font.c] [if1632/gdi32.spec] CreateFontIndirect32A and CreateFontIndirect32W added. * [misc/ole2nls.c] GetUserDefaultLCID return values updated for new languages. Finnish support added for GetLocaleInfoA. * [object/palette] [gdi32.spec] RealizePalette32 and SelectPalette32 added. Sat Jul 6 17:27:30 1996 Ronan Waide <root@waider.ie> * [misc/shell.c] Fixup for SHELL_FindExecutable so that File->Run from progman works once more. Still needs some more fixups - grep for FIXME in this file.
1996-07-12 19:02:39 +00:00
/***********************************************************************
* GetProcAddress (KERNEL32.@)
2003-10-01 03:20:21 +00:00
*
* Find the address of an exported symbol in a loaded dll.
*
* PARAMS
* hModule [I] Handle to the dll returned by LoadLibraryA().
* function [I] Name of the symbol, or an integer ordinal number < 16384
*
* RETURNS
* Success: A pointer to the symbol in the process address space.
* Failure: NULL. Use GetLastError() to determine the cause.
Release 960712 Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/scroll.c] Use Win32 heap functions to allocate scroll-bar info structure. * [debugger/dbg.y] [debugger/registers.c] Added support for FS and GS segment registers. Check that segment registers value are OK before returning from the signal handler. * [tools/build.c] [if1632/relay.c] [loader/builtin.c] Changed relay debugging for Win32 function: the relay code now passes the entry point address instead of the function name. * [tools/build.c] [miscemu/*.c] Added support for data entry points in Win32 DLLs. Added 'cdecl' function type for Win32. For 'register' function, the relay code now passes a pointer to the SIGCONTEXT structure. * [include/registers.h] [include/wine.h] Moved SIGCONTEXT structure definition in registers.h. * [loader/pe_image.c] Don't die at once if some Win32 entry points cannot be found, but set them to NULL, just like we do for Win16. This allows some programs to go further before crashing. * [loader/task.c] [loader/main.c] Moved global initializations from InitTask() to MAIN_Init(), as they no longer need a task context with the new SEGPTR heap functions. * [memory/string.c] Added lstrcpynAtoW and lstrcpynWtoA; not real API functions, but very convenient. * [windows/graphics.c] Partially implemented DrawEdge(). * [windows/timer.c] [windows/caret.c] Implemented Win32 timer handling. Updated caret management to use Win32 timers (avoids having to use a Win16 callback). * [windows/win.c] Prevent programs from setting some style bits with SetWindowLong(). This should fix some BadMatch crashes. Link new windows at the end of the linked list. * [windows/winpos.c] Don't try to activate a child window in ShowWindow(). * [windows/winproc.c] Added a 32->32 thunk to support Ansi-Unicode translation. Wed Jul 10 22:11:12 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] Additional (undocumented) return value for GetTempDrive() added. * [files/dos_fs.c] [files/file.c] [include/windows.h] GetTempFileName32* added. GetShortPathName* added. * [memory/string.c] Win16 lstrcpy() can get NULL ptrs as argument and survive. * [misc/lzexpand.c] LZOpenFile(): also try opening with compressed filename if normal open fails. * [misc/ole2nls.c] [misc/lstr.c] [include/windows.h] Char* added. CompareString* added. Sun Jul 7 01:22:14 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [objects/font.c] [if1632/gdi32.spec] CreateFontIndirect32A and CreateFontIndirect32W added. * [misc/ole2nls.c] GetUserDefaultLCID return values updated for new languages. Finnish support added for GetLocaleInfoA. * [object/palette] [gdi32.spec] RealizePalette32 and SelectPalette32 added. Sat Jul 6 17:27:30 1996 Ronan Waide <root@waider.ie> * [misc/shell.c] Fixup for SHELL_FindExecutable so that File->Run from progman works once more. Still needs some more fixups - grep for FIXME in this file.
1996-07-12 19:02:39 +00:00
*/
FARPROC get_proc_address( HMODULE hModule, LPCSTR function )
Release 960712 Fri Jul 12 17:43:05 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/scroll.c] Use Win32 heap functions to allocate scroll-bar info structure. * [debugger/dbg.y] [debugger/registers.c] Added support for FS and GS segment registers. Check that segment registers value are OK before returning from the signal handler. * [tools/build.c] [if1632/relay.c] [loader/builtin.c] Changed relay debugging for Win32 function: the relay code now passes the entry point address instead of the function name. * [tools/build.c] [miscemu/*.c] Added support for data entry points in Win32 DLLs. Added 'cdecl' function type for Win32. For 'register' function, the relay code now passes a pointer to the SIGCONTEXT structure. * [include/registers.h] [include/wine.h] Moved SIGCONTEXT structure definition in registers.h. * [loader/pe_image.c] Don't die at once if some Win32 entry points cannot be found, but set them to NULL, just like we do for Win16. This allows some programs to go further before crashing. * [loader/task.c] [loader/main.c] Moved global initializations from InitTask() to MAIN_Init(), as they no longer need a task context with the new SEGPTR heap functions. * [memory/string.c] Added lstrcpynAtoW and lstrcpynWtoA; not real API functions, but very convenient. * [windows/graphics.c] Partially implemented DrawEdge(). * [windows/timer.c] [windows/caret.c] Implemented Win32 timer handling. Updated caret management to use Win32 timers (avoids having to use a Win16 callback). * [windows/win.c] Prevent programs from setting some style bits with SetWindowLong(). This should fix some BadMatch crashes. Link new windows at the end of the linked list. * [windows/winpos.c] Don't try to activate a child window in ShowWindow(). * [windows/winproc.c] Added a 32->32 thunk to support Ansi-Unicode translation. Wed Jul 10 22:11:12 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de> * [files/directory.c] Additional (undocumented) return value for GetTempDrive() added. * [files/dos_fs.c] [files/file.c] [include/windows.h] GetTempFileName32* added. GetShortPathName* added. * [memory/string.c] Win16 lstrcpy() can get NULL ptrs as argument and survive. * [misc/lzexpand.c] LZOpenFile(): also try opening with compressed filename if normal open fails. * [misc/ole2nls.c] [misc/lstr.c] [include/windows.h] Char* added. CompareString* added. Sun Jul 7 01:22:14 1996 Jukka Iivonen <iivonen@cc.helsinki.fi> * [objects/font.c] [if1632/gdi32.spec] CreateFontIndirect32A and CreateFontIndirect32W added. * [misc/ole2nls.c] GetUserDefaultLCID return values updated for new languages. Finnish support added for GetLocaleInfoA. * [object/palette] [gdi32.spec] RealizePalette32 and SelectPalette32 added. Sat Jul 6 17:27:30 1996 Ronan Waide <root@waider.ie> * [misc/shell.c] Fixup for SHELL_FindExecutable so that File->Run from progman works once more. Still needs some more fixups - grep for FIXME in this file.
1996-07-12 19:02:39 +00:00
{
FARPROC fp;
if (!hModule) hModule = NtCurrentTeb()->Peb->ImageBaseAddress;
if ((ULONG_PTR)function >> 16)
{
ANSI_STRING str;
RtlInitAnsiString( &str, function );
if (!set_ntstatus( LdrGetProcedureAddress( hModule, &str, 0, (void**)&fp ))) return NULL;
}
else
if (!set_ntstatus( LdrGetProcedureAddress( hModule, NULL, LOWORD(function), (void**)&fp )))
return NULL;
return fp;
Release 980503 Thu Apr 30 16:28:12 1998 James Juran <jrj120@psu.edu> * [scheduler/process.c] Implemented GetExitCodeProcess. The code is a direct translation of GetExitCodeThread. Mon Apr 27 22:20:25 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [loader/pe_image.c] Unload dummy module when PE_LoadLibraryEx32A fails with PE_LoadImage (makes Encarta 98 installer proceed). * [files/drive.c] Make GetDriveType16 return DRIVE_REMOVABLE for TYPE_CDROM. Make GetCurrentDirectory32 behave like the code does and not like the help describes. * [files/profile.c] Revoke recent change in PROFILE_GetSection and try better handling of special case. * [include/windows.h] Change definition of ACCEL32. * [misc/commdlg.c] Replace the GetXXXFilename32 macros by normal code. Fix two reported bugs in my changes to commdlg. * [windows/win.c] Add a hook to catch bogus WM_SIZE messages by emitting a warning in the appropriate case. * [objects/bitmap.c] Reject unreasonbable large size arguments in CreateCompatibleBitmap32 and add an fixme for that situation. Sun Apr 26 18:30:07 1998 Alexandre Julliard <julliard@lrc.epfl.ch> * [include/ldt.h] [debugger/*.c] [miscemu/instr.c] Added IS_SELECTOR_SYSTEM and IS_SELECTOR_32BIT macros. Make instruction emulation support system selectors. * [loader/*.c] Started moving NE specific functions to the new loader/ne directory. * [memory/environ.c] Enforce the 127 chars limit only when creating the environment of a Win16 process. Sun Apr 26 12:22:23 1998 Andreas Mohr <100.30936@germany.net> * [files/file.c] Fixed an incredible typo in CopyFile32A that made it unusable since a rewrite in 970112 (!!). * [files/directory.c] Fixed GetTempPath32A/W to include trailing backslash. * [misc/ver.c] Make find_pe_resource "work" with corrupt files. * [misc/wsprintf.c] Altered WPRINTF_ParseFormatA/W to treat invalid format chars as normal output, too. * [msdos/dpmi.c] Implemented "Allocate/Free real mode callback" (0x0303/0x0304). Cross your fingers if you need to use it ;) (completely untested) Implemented "Call real mode proc with far return" (0x0301, tested). * [msdos/int21.c] Fixed ioctlGenericBlkDevReq/0x60. * [relay32/dplayx.spec] [relay32/builtin32.c] [relay32/Makefile.in] Added built-in DPLAYX.DLL. * [windows/win.c] Fixed GetWindowWord()/GWW_HWNDPARENT to return the window's owner if it has no parent (SDK). Sat Apr 25 15:09:53 1998 M.T.Fortescue <mark@mtfhpc.demon.co.uk> * [debugger/db_disasm.c] Fixed disassemble bug for no-display option and 'lock', 'repne' and 'repe' prefixes. * [debugger/registers.c] Added textual flag description output on 'info regs'. Sat Apr 25 14:18:26 1998 Matthew Becker <mbecker@glasscity.net> * [*/*.c] Added stubs and/or documentation for the following functions: LookupPrivilegeValue, OpenService, ControlService, RegGetKeySecurity, StartService, SetComputerName, DeleteService, CloseServiceHandle, OpenProcessToken, OpenSCManager, DeregisterEventSource, WaitForDebugEvent, WaitForInputIdle, RegisterEventSource, SetDebugErrorLevel, SetConsoleCursorPosition, ChoosePixelFormat, SetPixelFormat, GetPixelFormat, DescribePixelFormat, SwapBuffers, PolyBezier, AbortPath, DestroyAcceleratorTable, HeapWalk, DdeInitialize, DdeUninitialize, DdeConnectList, DdeDisconnectList, DdeCreateStringHandle, DdePostAdvise, DdeGetData, DdeNameService, DdeGetLastError, WNetGetDirectoryType, EnumPrinters, RegFlushKey, RegGetKeySecurity, DllGetClassObject, DllCanUnloadNow, CreateBitmap, CreateCompatibleBitmap, CreateBitmapIndirect, GetBitmapBits, SetBitmapBits, LoadImage, CopyImage, LoadBitmap, DrawIcon, CreateDiscardableBitmap, SetDIBits, GetCharABCWidths, LoadTypeLib, SetConsoleCtrlHandler, CreateConsoleScreenBuffer, ReadConsoleInput, GetConsoleCursorInfo, SetConsoleCursorInfo, SetConsoleWindowInfo, SetConsoleTextAttribute, SetConsoleScreenBufferSize, FillConsoleOutputCharacter, FillConsoleOutputAttribute, CreateMailslot, GetMailslotInfo, GetCompressedFileSize, GetProcessWindowStation, GetThreadDesktop, SetDebugErrorLevel, WaitForDebugEvent, SetComputerName, CreateMDIWindow. Thu Apr 23 23:54:04 1998 Douglas Ridgway <ridgway@winehq.com> * [include/windows.h] [objects/enhmetafile.c] [relay32/gdi32.spec] Implement CopyEnhMetaFile, Get/SetEnhMetaFileBits, other fixes. * [include/windows.h] [objects/metafile.c] [relay32/gdi32.spec] 32-bit metafile fixes, implement EnumMetaFile32, GetMetaFileBitsEx. * [objects/font.c] [graphics/x11drv/xfont.c] [graphics/x11drv/text.c] Some rotated text support for X11R6 displays. * [win32/newfns.c] [ole/ole2nls.c] Moved GetNumberFormat32A. Wed Apr 22 17:38:20 1998 David Lee Lambert <lamber45@egr.msu.edu> * [ole/ole2nls.c] [misc/network.c] Changed some function documentation to the new style. * [misc/network.c] [include/windows.h] [if1632/user.spec] [relay32/mpr.spec] [misc/mpr.c] Added stubs for some Win32 network functions; renamed some 16-bit ones with 32-bit counterparts, as well as WNetGetDirectoryType; moved the stubs in misc/mpr.c (three of them!) to misc/network.c. * [ole/compobj.c] [ole/storage.c] [ole/ole2disp.c] [ole/ole2nls.c] [ole/folders.c] [ole/moniker.c] [ole/ole2.c] [graphics/fontengine.c] [graphics/ddraw.c] [graphics/env.c] [graphics/driver.c] [graphics/escape.c] Changed fprintf's to proper debug-macros. * [include/winnls.h] Added some flags (for internal use). * [ole/ole2nls.c] Added the Unicode core function, and worked out a way to hide the commonality of the core. * [relay32/kernel32.spec] Added support for GetDate/Time32A/W. Wed Apr 22 09:16:03 1998 Gordon Chaffee <chaffee@cs.berkeley.edu> * [win32/code_page.c] Fixed problem with MultiByteToWideChar that was introduced in last release. Made MultiByteToWideChar more compatible with Win32. * [graphics/x11drv/graphics.c] Fixed problem with drawing arcs. Tue Apr 21 11:24:58 1998 Constantine Sapuntzakis <csapuntz@tma-1.lcs.mit.edu> * [ole/ole2nls.c] Move stuff from 0x409 case to Lang_En. * [relay32/user32.spec] [windows/winpos.c] Added stubs for GetWindowRgn32 and SetWindowRgn32. Makes Office Paperclip happy. Tue Apr 21 11:16:16 1998 Constantine Sapuntzakis <csapuntz@tma-1.lcs.mit.edu> * [loader/pe_image.c] If image is relocated, TLS addresses need to be adjusted. * [debugger/*.c] Generalized tests for 32-bit segments. Tue Apr 21 02:04:59 1998 James Juran <jrj120@psu.edu> * [misc/*.c] [miscemu/*.c] [msdos/*.c] [if1632/*.c] [include/*.h] [loader/*.c] [memory/*.c] [multimedia/*.c] [objects/*.c] Almost all fprintf statements converted to appropriate debug messages. * [README] Updated "GETTING MORE INFORMATION" section to include WineHQ. * [documentation/debugger] Fixed typo. * [windows/defwnd.c] Added function documentation. Sun Apr 19 16:30:58 1998 Marcus Meissner <marcus@mud.de> * [Make.rules.in] Added lint target (using lclint). * [relay32/oleaut32.spec][relay32/Makefile.in][ole/typelib.c] [ole/ole2disp.c] Added oleaut32 spec, added some SysString functions. * [if1632/signal.c] Added printing of faultaddress in Linux (using CR2 debug register). * [configure.in] Added <sys/types.h> for statfs checks. * [loader/*.c][debugger/break.c][debugger/hash.c] Started to split win32/win16 module handling, preparing support for other binary formats (like ELF). Sat Apr 18 10:07:41 1998 Rein Klazes <rklazes@casema.net> * [misc/registry.c] Fixed a bug that made RegQueryValuexxx returning incorrect registry values. Fri Apr 17 22:59:22 1998 Alexander V. Lukyanov <lav@long.yar.ru> * [misc/lstr.c] FormatMessage32*: remove linefeed when nolinefeed set; check for target underflow. Fri Apr 17 00:38:14 1998 Alexander V. Lukyanov <lav@long.yar.ru> * [misc/crtdll.c] Implement xlat_file_ptr for CRT stdin/stdout/stderr address translation. Wed Apr 15 20:43:56 1998 Jim Peterson <jspeter@birch.ee.vt.edu> * [controls/menu.c] Added 'odaction' parameter to MENU_DrawMenuItem() and redirected WM_DRAWITEM messages to GetWindow(hwnd,GW_OWNER). Tue Apr 14 16:17:55 1998 Berend Reitsma <berend@united-info.com> * [graphics/metafiledrv/init.c] [graphics/painting.c] [graphics/win16drv/init.c] [graphics/x11drv/graphics.c] [graphics/x11drv/init.c] [include/gdi.h] [include/x11drv.h] [relay32/gdi32.spec] Added PolyPolyline routine. * [windows/winproc.c] Changed WINPROC_GetProc() to return proc instead of &(jmp proc).
1998-05-03 19:01:20 +00:00
}
#ifdef __x86_64__
/*
* Work around a Delphi bug on x86_64. When delay loading a symbol,
* Delphi saves rcx, rdx, r8 and r9 to the stack. It then calls
* GetProcAddress(), pops the saved registers and calls the function.
* This works fine if all of the parameters are ints. However, since
* it does not save xmm0 - 3, it relies on GetProcAddress() preserving
* these registers if the function takes floating point parameters.
* This wrapper saves xmm0 - 3 to the stack.
*/
extern FARPROC get_proc_address_wrapper( HMODULE module, LPCSTR function );
__ASM_GLOBAL_FUNC( get_proc_address_wrapper,
"pushq %rbp\n\t"
__ASM_SEH(".seh_pushreg %rbp\n\t")
__ASM_CFI(".cfi_adjust_cfa_offset 8\n\t")
__ASM_CFI(".cfi_rel_offset %rbp,0\n\t")
"movq %rsp,%rbp\n\t"
__ASM_SEH(".seh_setframe %rbp,0\n\t")
__ASM_CFI(".cfi_def_cfa_register %rbp\n\t")
"subq $0x40,%rsp\n\t"
__ASM_SEH(".seh_stackalloc 0x40\n\t")
__ASM_SEH(".seh_endprologue\n\t")
"movaps %xmm0,-0x10(%rbp)\n\t"
"movaps %xmm1,-0x20(%rbp)\n\t"
"movaps %xmm2,-0x30(%rbp)\n\t"
"movaps %xmm3,-0x40(%rbp)\n\t"
"call " __ASM_NAME("get_proc_address") "\n\t"
"movaps -0x40(%rbp), %xmm3\n\t"
"movaps -0x30(%rbp), %xmm2\n\t"
"movaps -0x20(%rbp), %xmm1\n\t"
"movaps -0x10(%rbp), %xmm0\n\t"
"leaq 0(%rbp),%rsp\n\t"
__ASM_CFI(".cfi_def_cfa_register %rsp\n\t")
"popq %rbp\n\t"
__ASM_CFI(".cfi_adjust_cfa_offset -8\n\t")
__ASM_CFI(".cfi_same_value %rbp\n\t")
"ret" )
#else /* __x86_64__ */
static inline FARPROC get_proc_address_wrapper( HMODULE module, LPCSTR function )
{
return get_proc_address( module, function );
}
#endif /* __x86_64__ */
FARPROC WINAPI GetProcAddress( HMODULE hModule, LPCSTR function )
{
return get_proc_address_wrapper( hModule, function );
}
typedef struct _PEB32
{
BOOLEAN InheritedAddressSpace;
BOOLEAN ReadImageFileExecOptions;
BOOLEAN BeingDebugged;
BOOLEAN SpareBool;
DWORD Mutant;
DWORD ImageBaseAddress;
DWORD LdrData;
} PEB32;
typedef struct _LIST_ENTRY32
{
DWORD Flink;
DWORD Blink;
} LIST_ENTRY32;
typedef struct _PEB_LDR_DATA32
{
ULONG Length;
BOOLEAN Initialized;
DWORD SsHandle;
LIST_ENTRY32 InLoadOrderModuleList;
} PEB_LDR_DATA32;
typedef struct _UNICODE_STRING32
{
USHORT Length;
USHORT MaximumLength;
DWORD Buffer;
} UNICODE_STRING32;
typedef struct _LDR_DATA_TABLE_ENTRY32
{
LIST_ENTRY32 InLoadOrderModuleList;
LIST_ENTRY32 InMemoryOrderModuleList;
LIST_ENTRY32 InInitializationOrderModuleList;
DWORD BaseAddress;
DWORD EntryPoint;
ULONG SizeOfImage;
UNICODE_STRING32 FullDllName;
UNICODE_STRING32 BaseDllName;
} LDR_DATA_TABLE_ENTRY32;
typedef struct {
HANDLE process;
PLIST_ENTRY head, current;
LDR_DATA_TABLE_ENTRY ldr_module;
BOOL wow64;
LDR_DATA_TABLE_ENTRY32 ldr_module32;
} MODULE_ITERATOR;
static BOOL init_module_iterator(MODULE_ITERATOR *iter, HANDLE process)
{
PROCESS_BASIC_INFORMATION pbi;
PPEB_LDR_DATA ldr_data;
NTSTATUS status;
if (!IsWow64Process(process, &iter->wow64))
return FALSE;
/* Get address of PEB */
status = NtQueryInformationProcess(process, ProcessBasicInformation,
&pbi, sizeof(pbi), NULL);
if (status != STATUS_SUCCESS)
{
SetLastError(RtlNtStatusToDosError(status));
return FALSE;
}
if (sizeof(void *) == 8 && iter->wow64)
{
PEB_LDR_DATA32 *ldr_data32_ptr;
DWORD ldr_data32, first_module;
PEB32 *peb32;
peb32 = (PEB32 *)(DWORD_PTR)pbi.PebBaseAddress;
if (!ReadProcessMemory(process, &peb32->LdrData, &ldr_data32,
sizeof(ldr_data32), NULL))
return FALSE;
ldr_data32_ptr = (PEB_LDR_DATA32 *)(DWORD_PTR) ldr_data32;
if (!ReadProcessMemory(process,
&ldr_data32_ptr->InLoadOrderModuleList.Flink,
&first_module, sizeof(first_module), NULL))
return FALSE;
iter->head = (LIST_ENTRY *)&ldr_data32_ptr->InLoadOrderModuleList;
iter->current = (LIST_ENTRY *)(DWORD_PTR) first_module;
iter->process = process;
return TRUE;
}
/* Read address of LdrData from PEB */
if (!ReadProcessMemory(process, &pbi.PebBaseAddress->LdrData,
&ldr_data, sizeof(ldr_data), NULL))
return FALSE;
/* Read address of first module from LdrData */
if (!ReadProcessMemory(process,
&ldr_data->InLoadOrderModuleList.Flink,
&iter->current, sizeof(iter->current), NULL))
return FALSE;
iter->head = &ldr_data->InLoadOrderModuleList;
iter->process = process;
return TRUE;
}
static int module_iterator_next(MODULE_ITERATOR *iter)
{
if (iter->current == iter->head)
return 0;
if (sizeof(void *) == 8 && iter->wow64)
{
LIST_ENTRY32 *entry32 = (LIST_ENTRY32 *)iter->current;
if (!ReadProcessMemory(iter->process,
CONTAINING_RECORD(entry32, LDR_DATA_TABLE_ENTRY32, InLoadOrderModuleList),
&iter->ldr_module32, sizeof(iter->ldr_module32), NULL))
return -1;
iter->current = (LIST_ENTRY *)(DWORD_PTR) iter->ldr_module32.InLoadOrderModuleList.Flink;
return 1;
}
if (!ReadProcessMemory(iter->process,
CONTAINING_RECORD(iter->current, LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList),
&iter->ldr_module, sizeof(iter->ldr_module), NULL))
return -1;
iter->current = iter->ldr_module.InLoadOrderModuleList.Flink;
return 1;
}
static BOOL get_ldr_module(HANDLE process, HMODULE module, LDR_DATA_TABLE_ENTRY *ldr_module)
{
MODULE_ITERATOR iter;
INT ret;
if (!init_module_iterator(&iter, process))
return FALSE;
while ((ret = module_iterator_next(&iter)) > 0)
/* When hModule is NULL we return the process image - which will be
* the first module since our iterator uses InLoadOrderModuleList */
if (!module || module == iter.ldr_module.BaseAddress)
{
*ldr_module = iter.ldr_module;
return TRUE;
}
if (ret == 0)
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
static BOOL get_ldr_module32(HANDLE process, HMODULE module, LDR_DATA_TABLE_ENTRY32 *ldr_module)
{
MODULE_ITERATOR iter;
INT ret;
if (!init_module_iterator(&iter, process))
return FALSE;
while ((ret = module_iterator_next(&iter)) > 0)
/* When hModule is NULL we return the process image - which will be
* the first module since our iterator uses InLoadOrderModuleList */
if (!module || (DWORD)(DWORD_PTR) module == iter.ldr_module32.BaseAddress)
{
*ldr_module = iter.ldr_module32;
return TRUE;
}
if (ret == 0)
SetLastError(ERROR_INVALID_HANDLE);
return FALSE;
}
/***********************************************************************
* K32EnumProcessModules (KERNEL32.@)
*
* NOTES
* Returned list is in load order.
*/
BOOL WINAPI K32EnumProcessModules(HANDLE process, HMODULE *lphModule,
DWORD cb, DWORD *needed)
{
MODULE_ITERATOR iter;
DWORD size = 0;
INT ret;
if (process == GetCurrentProcess())
{
PPEB_LDR_DATA ldr_data = NtCurrentTeb()->Peb->LdrData;
PLIST_ENTRY head = &ldr_data->InLoadOrderModuleList;
PLIST_ENTRY entry = head->Flink;
if (cb && !lphModule)
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
while (entry != head)
{
PLDR_DATA_TABLE_ENTRY table_entry = (PLDR_DATA_TABLE_ENTRY)
((PBYTE)entry - offsetof(LDR_DATA_TABLE_ENTRY, InLoadOrderModuleList));
if (cb >= sizeof(HMODULE))
{
*lphModule++ = table_entry->BaseAddress;
cb -= sizeof(HMODULE);
}
size += sizeof(HMODULE);
entry = entry->Flink;
}
if (!needed)
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
*needed = size;
return TRUE;
}
if (!init_module_iterator(&iter, process))
return FALSE;
if (cb && !lphModule)
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
while ((ret = module_iterator_next(&iter)) > 0)
{
if (cb >= sizeof(HMODULE))
{
if (sizeof(void *) == 8 && iter.wow64)
*lphModule++ = (HMODULE) (DWORD_PTR)iter.ldr_module32.BaseAddress;
else
*lphModule++ = iter.ldr_module.BaseAddress;
cb -= sizeof(HMODULE);
}
size += sizeof(HMODULE);
}
if (!needed)
{
SetLastError(ERROR_NOACCESS);
return FALSE;
}
*needed = size;
return ret == 0;
}
/***********************************************************************
* K32EnumProcessModulesEx (KERNEL32.@)
*
* NOTES
* Returned list is in load order.
*/
BOOL WINAPI K32EnumProcessModulesEx(HANDLE process, HMODULE *lphModule,
DWORD cb, DWORD *needed, DWORD filter)
{
FIXME("(%p, %p, %d, %p, %d) semi-stub\n",
process, lphModule, cb, needed, filter);
return K32EnumProcessModules(process, lphModule, cb, needed);
}
/***********************************************************************
* K32GetModuleBaseNameW (KERNEL32.@)
*/
DWORD WINAPI K32GetModuleBaseNameW(HANDLE process, HMODULE module,
LPWSTR base_name, DWORD size)
{
LDR_DATA_TABLE_ENTRY ldr_module;
BOOL wow64;
if (!IsWow64Process(process, &wow64))
return 0;
if (sizeof(void *) == 8 && wow64)
{
LDR_DATA_TABLE_ENTRY32 ldr_module32;
if (!get_ldr_module32(process, module, &ldr_module32))
return 0;
size = min(ldr_module32.BaseDllName.Length / sizeof(WCHAR), size);
if (!ReadProcessMemory(process, (void *)(DWORD_PTR)ldr_module32.BaseDllName.Buffer,
base_name, size * sizeof(WCHAR), NULL))
return 0;
}
else
{
if (!get_ldr_module(process, module, &ldr_module))
return 0;
size = min(ldr_module.BaseDllName.Length / sizeof(WCHAR), size);
if (!ReadProcessMemory(process, ldr_module.BaseDllName.Buffer,
base_name, size * sizeof(WCHAR), NULL))
return 0;
}
base_name[size] = 0;
return size;
}
/***********************************************************************
* K32GetModuleBaseNameA (KERNEL32.@)
*/
DWORD WINAPI K32GetModuleBaseNameA(HANDLE process, HMODULE module,
LPSTR base_name, DWORD size)
{
WCHAR *base_name_w;
DWORD len, ret = 0;
if(!base_name || !size) {
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
base_name_w = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * size);
if(!base_name_w)
return 0;
len = K32GetModuleBaseNameW(process, module, base_name_w, size);
TRACE("%d, %s\n", len, debugstr_w(base_name_w));
if (len)
{
ret = WideCharToMultiByte(CP_ACP, 0, base_name_w, len,
base_name, size, NULL, NULL);
if (ret < size) base_name[ret] = 0;
}
HeapFree(GetProcessHeap(), 0, base_name_w);
return ret;
}
/***********************************************************************
* K32GetModuleFileNameExW (KERNEL32.@)
*/
DWORD WINAPI K32GetModuleFileNameExW(HANDLE process, HMODULE module,
LPWSTR file_name, DWORD size)
{
LDR_DATA_TABLE_ENTRY ldr_module;
BOOL wow64;
DWORD len;
if (!size) return 0;
if (!IsWow64Process(process, &wow64))
return 0;
if (sizeof(void *) == 8 && wow64)
{
LDR_DATA_TABLE_ENTRY32 ldr_module32;
if (!get_ldr_module32(process, module, &ldr_module32))
return 0;
len = ldr_module32.FullDllName.Length / sizeof(WCHAR);
if (!ReadProcessMemory(process, (void *)(DWORD_PTR)ldr_module32.FullDllName.Buffer,
file_name, min( len, size ) * sizeof(WCHAR), NULL))
return 0;
}
else
{
if (!get_ldr_module(process, module, &ldr_module))
return 0;
len = ldr_module.FullDllName.Length / sizeof(WCHAR);
if (!ReadProcessMemory(process, ldr_module.FullDllName.Buffer,
file_name, min( len, size ) * sizeof(WCHAR), NULL))
return 0;
}
if (len < size)
{
file_name[len] = 0;
return len;
}
else
{
file_name[size - 1] = 0;
return size;
}
}
/***********************************************************************
* K32GetModuleFileNameExA (KERNEL32.@)
*/
DWORD WINAPI K32GetModuleFileNameExA(HANDLE process, HMODULE module,
LPSTR file_name, DWORD size)
{
WCHAR *ptr;
DWORD len;
TRACE("(hProcess=%p, hModule=%p, %p, %d)\n", process, module, file_name, size);
if (!file_name || !size)
{
SetLastError( ERROR_INVALID_PARAMETER );
return 0;
}
if ( process == GetCurrentProcess() )
{
len = GetModuleFileNameA( module, file_name, size );
file_name[size - 1] = '\0';
return len;
}
if (!(ptr = HeapAlloc(GetProcessHeap(), 0, size * sizeof(WCHAR)))) return 0;
len = K32GetModuleFileNameExW(process, module, ptr, size);
if (!len)
{
file_name[0] = '\0';
}
else
{
if (!WideCharToMultiByte( CP_ACP, 0, ptr, -1, file_name, size, NULL, NULL ))
{
file_name[size - 1] = 0;
len = size;
}
else if (len < size) len = strlen( file_name );
}
HeapFree(GetProcessHeap(), 0, ptr);
return len;
}
/***********************************************************************
* K32GetModuleInformation (KERNEL32.@)
*/
BOOL WINAPI K32GetModuleInformation(HANDLE process, HMODULE module,
MODULEINFO *modinfo, DWORD cb)
{
LDR_DATA_TABLE_ENTRY ldr_module;
BOOL wow64;
if (cb < sizeof(MODULEINFO))
{
SetLastError(ERROR_INSUFFICIENT_BUFFER);
return FALSE;
}
if (!IsWow64Process(process, &wow64))
return FALSE;
if (sizeof(void *) == 8 && wow64)
{
LDR_DATA_TABLE_ENTRY32 ldr_module32;
if (!get_ldr_module32(process, module, &ldr_module32))
return FALSE;
modinfo->lpBaseOfDll = (void *)(DWORD_PTR)ldr_module32.BaseAddress;
modinfo->SizeOfImage = ldr_module32.SizeOfImage;
modinfo->EntryPoint = (void *)(DWORD_PTR)ldr_module32.EntryPoint;
}
else
{
if (!get_ldr_module(process, module, &ldr_module))
return FALSE;
modinfo->lpBaseOfDll = ldr_module.BaseAddress;
modinfo->SizeOfImage = ldr_module.SizeOfImage;
modinfo->EntryPoint = ldr_module.EntryPoint;
}
return TRUE;
}
#ifdef __i386__
/***********************************************************************
* __wine_dll_register_16 (KERNEL32.@)
*
* No longer used.
*/
void __wine_dll_register_16( const IMAGE_DOS_HEADER *header, const char *file_name )
{
ERR( "loading old style 16-bit dll %s no longer supported\n", file_name );
}
/***********************************************************************
* __wine_dll_unregister_16 (KERNEL32.@)
*
* No longer used.
*/
void __wine_dll_unregister_16( const IMAGE_DOS_HEADER *header )
{
}
#endif