Release 980913
Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net>
* [files/file.c] [include/file.h]
Fixed SetFilePointer to allow negative positions as in DOS.
* [graphics/ddraw.c]
Added some methods to IDirect3D.
* [ole/compobj.c] [if1632/compobj.spec]
Added/implemented CoCreateStandardMalloc16,
CoGetClassObject, CoCreateInstance,
LookupETask, SetETask, CoGetState16.
* [loader/task.c]
MakeProcInstance: return 0 if func == NULL.
* [*/*] [tools/winapi-check]
Added zillions of missing WINAPI's and __cdecl's.
(oops, several caused by myself)
Wrote script for automated checking.
* [if1632/compobj.spec]
Many stub names.
* [misc/ddeml.c] [ole/compobj.c]
Some stubs.
Tue Sep 9 21:36:48 1998 Anders Carlsson <anders.carlsson@linux.nu>
* [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c]
[dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h]
Added preliminary tab control support.
Sat Sep 5 16:27:20 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk>
* [graphics/psdrv/*]
More changes to the PostScript driver:
Implemented pens and solid brushes.
Colour/greyscale for fonts, pens and brushes.
To get coloured output you need to have *ColorDevice set to true
in your PPD, otherwise you'll get greyscale.
Landscape mode now works, as does non-A4 page sizes.
Encoding of fonts to ANSI is better, Symbol works again.
* [objects/dc.c] [include/gdi.h] [*/*]
Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they
belong.
Sat Sep 5 05:12:09 1998 Ove Kaaven <ovek@arcticnet.no>
* [include/dosexe.h] [include/miscemu.h] [include/msdos.h]
[loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c]
[msdos/int2f.c] [msdos/interrupts.c]
Fixed portability. Adapted some code to make it easier to
integrate the DOS subsystem with the DPMI subsystem, made
the DPMI simulated real-mode interrupts be handled the V86
way. Added support for .COM files. Made int2f DPMI check
fail, to avoid pkunzip crashing in attempting to use DPMI.
Generally moved stuff around a little.
It is now technically possible to load several DOS programs
into the same memory space. Not tested, though.
Fri Sep 4 21:40:45 1998 Marcus Meissner <marcus@jet.franken.de>
* [if1632/kernel.spec]
Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe.
* [win32/except.c]
Fixed one bad program behaviour, (deleting SEH while in
first walk). RtlUnwind is broken too I think (it should unwind
on success, not while walking the exception chain).
* [ole/ole2nls.c]
Get*DefaultLCID returns 0x400|id. expected by one application.
* [if1632/snoop.c]
Handle non-standard SP returns more graceful.
* [windows/class.c]
hinstances are mostly irrelevant for win32.
* [memory/string.c] [misc/registry.c]
lstrcmpi32W: use toupper for characters < 0x100. (speedup hack
for registry.c)
Some small speedup hacks for registry.c
Thu Sep 3 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de>
* [Makefile.in][configure][configure.in][dlls/Makefile.in]
[dlls/comctl32/Makefile.in]
Created dlls/comctl32 and moved the common controls stuff to it.
* [misc/version.c]
Removed COMCTL32_DllGetVersion. The fixed function is part
of the common controls stuff.
* [dlls/comctl32/*.c][include/commctrl.h]
Added structure size tests.
* [dlls/comctl32/toolbar.c]
Fixed a bug in TOOLBAR_GetMaxWidth().
* [dlls/comctl32/animate.c][include/animate.h]
[dlls/comctl32/comboex.c][include/comboex.h]
[dlls/comctl32/hotkey.c][include/hotkey.h]
[dlls/comctl32/listview.c][include/listview.h]
[dlls/comctl32/commctrl.c][include/commctrl.h]
New files. Added Animation, ComboBoxEx, Hotkey and
Listview control dummies.
* [dlls/comctl32/tooltips.c]
Fixed a display bug and font selection.
* [dlls/comctl32/comctl32undoc.c][include/commctrl.h]
Added missing DPA functions. Fixed bugs and published the
function prototypes.
* [documentation/common_controls]
Updated.
Wed Sep 2 15:43:45 1998 Patrik Stridvall <ps@leissner.se>
* [AUTHORS] [include/authors.h]
Added myself as a Wine author.
* [memory/virtual.c] [objects/dc.c]
Fixed runtime errors for Solaris.
* [misc/ddeml.c] [objects/gdiobj.c]
Minor fixes.
* [win32/device.c]
Added stubs for IFSMgr VxDCall and
a partial implementation of IFSMgr DeviceIo.
* [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec]
[relay32/msnet32.spec] [relay32/oledlg.spec]
Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL.
* [misc/Makefile.in] [misc/imm.c] [include/imm.h]
Added news files for implementation of IMM32.DLL.
All functions return 0 as is correct for all Western Languages.
* [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h]
Added new files for implementation of OLEDLG.DLL.
Added stubs with FIXME:s for all functions.
Wed Sep 2 10:50:00 1998 Juergen Schmied <juergen.schmied@metronet.de>
* [dlls/shell32/contmenu.c][dlls/shell32/shellole.c]
[dlls/shell32/shlfolder.c][dlls/shell32/shlview.c]
[documentation/shell32][include/shell.h]
Clean up, bugfixes.
* [dlls/shell32/enumidlist.c]
Fileattributes implemented.
* [dlls/shell32/pidl.c]
Class pidlmgr splited into functions, structures changed,
some functions rewritten.
* [dlls/shell32/shell32_main.c]
Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation.
* [dlls/shell32/shellord.c][relay32/shell32.spec]
Parameter documented, implemented SHCloneSpecialIDList.
Stub improved ShellExecuteEx32A.
New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup,
FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp,
SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy,
SHGetDataFromIDListA, SHFileOperationA.
* [include/winnls.h][include/ole2nls.c]
TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented
in OLE_GetFormatA, GetTimeFormat32A.
* [win32/code_page.c]
WideCharToMultiByte: parameter checking and returning of strlen
implemented.
* [windows/keyboard.c][windows/defwnd.c]
Debug messages added.
* [windows/win.c]
WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented.
* [controls/menu.c]
Missing line added.
* [include/winerror.h]
Macros for SUCCEEDED and FAILED added.
Mon Aug 31 00:55:31 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de>
* [loader/module.c]
Bugfix: LoadModule16 should *not* call LoadModule32.
* [files/dos_fs.c]
Bugfix: don't crash if given directory doesn't exist.
Sat Aug 29 15:00:49 1998 Turchanov Sergey <turchanov@usa.net>
* [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec]
Almost completed implementation of [snd]PlaySound (except
flags SND_ALIAS_ID and SND_APPLICATION).
* [if1632/user.spec][windows/winpos.c]
Added SetWindowRgn16 stub.
Sat Aug 29 02:53:31 1998 Alexander Lukyanov <lav@long.yar.ru>
* [files/drive.c]
GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non
existent drive.
* [msdos/int21.c]
INT21_FindFirstFCB: check drive validity to prevent oops.
* [win32/file.c]
CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE.
* [files/dos_fs.c]
Make DOSFS_OpenDir treat "" as "/".
DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE.
* [windows/dialog.c]
GetNextDlgTabItem32: use last/first item instead of first/last
when hwndCtrl==0. This fixes initial focus.
Sat Aug 29 02:46:32 1998 Adrian Harvey <adrian@select.com.au>
* [include/process.h] [include/process.c]
Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line
with thread constant, and Win32 documentation (which calls it
a pseudohandle.) Made GetCurrentProcess actually use this
constant instead of the value.
* [include/process.h] [include/thread.h] [scheduler/thread.c]
[scheduler/process.c] [scheduler/handle.c]
Modify HANDLE_GetObjPtr to understand about
CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE.
This allows DuplicateHandle to do the correct thing with these
handles. Removed now duplicate functionality from THREAD_GetPtr
and PROCESS_GetPtr.
* [loader/ne/segment.c]
Fixed two places where HFILE32s were being created and passed to
16-bit code. This should unbreak NE self-loading code.
Added two casts to remove compile time warnings.
Fri Aug 28 21:04:13 1998 Joseph Pranevich <knight@baltimore.wwaves.com>
* [msdos/dosmem.c] [msdos/int2f.c]
Added beginnings of DOS error table.
* [msdos/int1a.c]
Stub for subfunction 0xb0.
* [msdos/int10.c] [loader/dos/dosvm.c]
INT 10 support completely rewritten and lots of debugging
added. Now, DOS apps that use INT 10 to write to the screen will
work. (Beyond Zork does, at least. Somewhat.)
* [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c]
Another shot at getting MS's generic error message facility
right.
* [msdos/int21.c]
Command.Com wanted to set its own PSP address. I let it.
Wed Aug 26 12:26:20 1998 Matthew Toseland <Matthew.Toseland@btinternet.com>
* [include/file.h] [misc/lzexpand.c]
Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't
convert lzw handles.
Tue Aug 25 22:22:55 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de>
* [misc/registry.c]
In RegEnumvalue, ivalue == 0 is a legal request and should
return the first entry.
* [msdos/int21.c]
Add handling for Int21-48/49 in Win16. Makes blinker demo work.
* [windows/winproc.c]
Add Msg32A<->Msg32W translation for LB_ADDSTRING.
Tue Aug 25 21:03:31 1998 Kristian Nielsen <kristian.nielsen@risoe.dk>
* [windows/win.c]
Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD
flag when a child window is reparented to the desktop window.
Mon Aug 24 20:55:22 1998 Berend Reitsma <berend at asset-control dot com>
* [controls/menu.c]
Menus created with SetMenuItemInfo and InsertMenuItem should
work now.
Sun Aug 23 23:23:23 1998 Alex Korobka <korobka@ams.sunysb.edu>
* [controls/combo.c]
Added CB_GETITEMHEIGHT.
* [windows/winpos.c]
WM_NCHITTEST, SWP_FRAMECHANGED bugfixes.
Sat Aug 22 21:15:29 1998 Alex Priem <alexp@sci.kun.nl>
* [files/profile.c] [include/windows.h]
Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW,
GetPrivateProfileStructW, GetProfileSectionW,
WriteProfileSection[AW], WritePrivateProfileStructW.
diff --git a/loader/dos/Makefile.in b/loader/dos/Makefile.in
index 67b4c7a..257425d 100644
--- a/loader/dos/Makefile.in
+++ b/loader/dos/Makefile.in
@@ -14,7 +14,7 @@
all: $(MODULE).o $(PROGRAMS)
dosmod: dosmod.c
- $(CC) $(ALLCFLAGS) -o dosmod $<
+ $(CC) $(ALLCFLAGS) -o dosmod dosmod.c
@MAKE_RULES@
diff --git a/loader/dos/dosmod.c b/loader/dos/dosmod.c
index 9807ecf..1be2171 100644
--- a/loader/dos/dosmod.c
+++ b/loader/dos/dosmod.c
@@ -22,12 +22,14 @@
#include <sys/stat.h>
#include <sys/mman.h>
#include <sys/vm86.h>
-#include <sys/syscall.h>
#include <sys/types.h>
#include <sys/ptrace.h>
#include <sys/wait.h>
-/* FIXME: hack because libc vm86 may be the old syscall version */
+ /* FIXME: hack because libc vm86 may be the old syscall version */
+
+#define SYS_vm86 166
+
static __inline__ int vm86plus( int func, struct vm86plus_struct *ptr )
{
int res;
diff --git a/loader/dos/dosvm.c b/loader/dos/dosvm.c
index ec2e91d..9b4abb8 100644
--- a/loader/dos/dosvm.c
+++ b/loader/dos/dosvm.c
@@ -6,8 +6,6 @@
* This code hasn't been completely cleaned up yet.
*/
-#ifdef linux
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -28,6 +26,8 @@
#include "ldt.h"
#include "dosexe.h"
+#ifdef MZ_SUPPORTED
+
static void DOSVM_Dump( LPDOSTASK lpDosTask)
{
unsigned iofs;
@@ -64,24 +64,10 @@
exit(0);
}
-static int DOSVM_Int(int vect, LPDOSTASK lpDosTask, PCONTEXT context )
+static int DOSVM_Int(int vect, PCONTEXT context )
{
- /* we should really map to if1632/wprocs.spec, but not all
- interrupt handlers are adapted to support our VM yet */
- switch (vect) {
- case 0x20:
- return -1;
- case 0x21:
- if (AH_reg(context)==0x4c) return -1;
- DOS3Call(context);
- break;
- case 0x1a:
- INT_Int1aHandler(context);
- break;
- case 0x2f:
- INT_Int2fHandler(context);
- break;
- }
+ /* moved to INT_RealModeInterrupt in msdos/interrupts.c */
+ INT_RealModeInterrupt(vect,context);
return 0;
}
@@ -109,8 +95,8 @@
DOSVM_Dump(lpDosTask);
break;
case VM86_INTx:
- TRACE(int,"DOS EXE calls INT %02x\n",VM86_ARG(lpDosTask->fn));
- ret=DOSVM_Int(VM86_ARG(lpDosTask->fn),lpDosTask,&context); break;
+ TRACE(int,"DOS EXE calls INT %02x with AX=%04lx\n",VM86_ARG(lpDosTask->fn),context.Eax);
+ ret=DOSVM_Int(VM86_ARG(lpDosTask->fn),&context); break;
case VM86_STI:
break;
case VM86_PICRETURN:
@@ -144,9 +130,9 @@
/* no VM86 (dosmod) task is currently running, start one */
if ((lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL)
return 0;
- lpDosTask->img=DOSMEM_MemoryBase(pModule->self);
lpDosTask->hModule=pModule->self;
- stat=MZ_InitTask(lpDosTask);
+ stat=MZ_InitMemory(lpDosTask,pModule);
+ if (stat>=32) stat=MZ_InitTask(lpDosTask);
if (stat<32) {
free(lpDosTask);
return -1;
@@ -177,7 +163,7 @@
return 0;
}
-#else /* !linux */
+#else /* !MZ_SUPPORTED */
int DOSVM_Enter( PCONTEXT context )
{
@@ -185,4 +171,4 @@
return -1;
}
-#endif /* linux */
+#endif
diff --git a/loader/dos/module.c b/loader/dos/module.c
index cce308f..2494135 100644
--- a/loader/dos/module.c
+++ b/loader/dos/module.c
@@ -6,8 +6,6 @@
* This code hasn't been completely cleaned up yet.
*/
-#ifdef linux
-
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -17,18 +15,22 @@
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
-#include <sys/mman.h>
-#include <sys/vm86.h>
#include "windows.h"
#include "winbase.h"
#include "module.h"
#include "task.h"
+#include "file.h"
#include "ldt.h"
#include "process.h"
#include "miscemu.h"
#include "debug.h"
#include "dosexe.h"
+#ifdef MZ_SUPPORTED
+
+#include <sys/mman.h>
+#include <sys/vm86.h>
+
/* define this to try mapping through /proc/pid/mem instead of a temp file,
but Linus doesn't like mmapping /proc/pid/mem, so it doesn't work for me */
#undef MZ_MAPSELF
@@ -85,25 +87,11 @@
/* FIXME: integrate the PDB stuff from Wine (loader/task.c) */
}
-static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env,
- LPDOSTASK lpDosTask, NE_MODULE *pModule )
+int MZ_InitMemory( LPDOSTASK lpDosTask, NE_MODULE *pModule )
{
- IMAGE_DOS_HEADER mz_header;
- DWORD image_start,image_size,min_size,max_size,avail;
- BYTE*psp_start,*load_start;
int x;
- SEGPTR reloc;
- if ((_hread16(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
- (mz_header.e_magic != IMAGE_DOS_SIGNATURE))
- return 11; /* invalid exe */
- /* calculate load size */
- image_start=mz_header.e_cparhdr<<4;
- image_size=mz_header.e_cp<<9; /* pages are 512 bytes */
- if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp;
- image_size-=image_start;
- min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4);
- max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4);
+ if (lpDosTask->img_ofs) return 32; /* already allocated */
/* allocate 1MB+64K shared memory */
lpDosTask->img_ofs=START_OFFSET;
@@ -132,7 +120,43 @@
/* initialize the memory */
MZ_InitSystem(lpDosTask->img);
TRACE(module,"Initializing DOS memory structures\n");
+ /* FIXME: make DOSMEM_Init copy static dosmem memory into newly allocated shared memory */
DOSMEM_Init(lpDosTask->hModule);
+ return 32;
+}
+
+static int MZ_LoadImage( HFILE16 hFile, LPCSTR cmdline, LPCSTR env,
+ LPDOSTASK lpDosTask, NE_MODULE *pModule )
+{
+ IMAGE_DOS_HEADER mz_header;
+ DWORD image_start,image_size,min_size,max_size,avail;
+ BYTE*psp_start,*load_start;
+ int x,old_com=0;
+ SEGPTR reloc;
+
+ if ((_hread16(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
+ (mz_header.e_magic != IMAGE_DOS_SIGNATURE)) {
+#if 0
+ return 11; /* invalid exe */
+#endif
+ old_com=1; /* assume .COM file */
+ image_start=0;
+ image_size=GetFileSize(HFILE16_TO_HFILE32(hFile),NULL);
+ min_size=0x10000; max_size=0x100000;
+ mz_header.e_crlc=0;
+ mz_header.e_ss=0; mz_header.e_sp=0xFFFE;
+ mz_header.e_cs=0; mz_header.e_ip=0x100;
+ } else {
+ /* calculate load size */
+ image_start=mz_header.e_cparhdr<<4;
+ image_size=mz_header.e_cp<<9; /* pages are 512 bytes */
+ if ((mz_header.e_cblp!=0)&&(mz_header.e_cblp!=4)) image_size-=512-mz_header.e_cblp;
+ image_size-=image_start;
+ min_size=image_size+((DWORD)mz_header.e_minalloc<<4)+(PSP_SIZE<<4);
+ max_size=image_size+((DWORD)mz_header.e_maxalloc<<4)+(PSP_SIZE<<4);
+ }
+
+ MZ_InitMemory(lpDosTask,pModule);
/* FIXME: allocate memory for environment variables */
@@ -149,24 +173,26 @@
ERR(module, "error allocating DOS memory\n");
return 0;
}
- lpDosTask->load_seg=lpDosTask->psp_seg+PSP_SIZE;
+ lpDosTask->load_seg=lpDosTask->psp_seg+(old_com?0:PSP_SIZE);
load_start=psp_start+(PSP_SIZE<<4);
MZ_InitPSP(psp_start, cmdline, env);
/* load executable image */
- TRACE(module,"loading DOS EXE image size, %08lx bytes\n",image_size);
+ TRACE(module,"loading DOS %s image size, %08lx bytes\n",old_com?"COM":"EXE",image_size);
_llseek16(hFile,image_start,FILE_BEGIN);
if ((_hread16(hFile,load_start,image_size)) != image_size)
return 11; /* invalid exe */
- /* load relocation table */
- TRACE(module,"loading DOS EXE relocation table, %d entries\n",mz_header.e_lfarlc);
- /* FIXME: is this too slow without read buffering? */
- _llseek16(hFile,mz_header.e_lfarlc,FILE_BEGIN);
- for (x=0; x<mz_header.e_crlc; x++) {
- if (_lread16(hFile,&reloc,sizeof(reloc)) != sizeof(reloc))
- return 11; /* invalid exe */
- *(WORD*)SEGPTR16(load_start,reloc)+=lpDosTask->load_seg;
+ if (mz_header.e_crlc) {
+ /* load relocation table */
+ TRACE(module,"loading DOS EXE relocation table, %d entries\n",mz_header.e_lfarlc);
+ /* FIXME: is this too slow without read buffering? */
+ _llseek16(hFile,mz_header.e_lfarlc,FILE_BEGIN);
+ for (x=0; x<mz_header.e_crlc; x++) {
+ if (_lread16(hFile,&reloc,sizeof(reloc)) != sizeof(reloc))
+ return 11; /* invalid exe */
+ *(WORD*)SEGPTR16(load_start,reloc)+=lpDosTask->load_seg;
+ }
}
/* initialize vm86 struct */
@@ -184,9 +210,10 @@
int MZ_InitTask( LPDOSTASK lpDosTask )
{
+ extern char * DEBUG_argv0;
int read_fd[2],write_fd[2];
pid_t child;
- char *fname,*farg,arg[16],fproc[64];
+ char *fname,*farg,arg[16],fproc[64],path[256],*fpath;
/* create read pipe */
if (pipe(read_fd)<0) return 0;
@@ -236,7 +263,14 @@
/* now load dosmod */
execlp("dosmod",fname,farg,NULL);
execl("dosmod",fname,farg,NULL);
+ /* hmm, they didn't install properly */
execl("loader/dos/dosmod",fname,farg,NULL);
+ /* last resort, try to find it through argv[0] */
+ fpath=strrchr(strcpy(path,DEBUG_argv0),'/');
+ if (fpath) {
+ strcpy(fpath,"/loader/dos/dosmod");
+ execl(path,fname,farg,NULL);
+ }
/* if failure, exit */
ERR(module,"Failed to spawn dosmod, error=%s\n",strerror(errno));
exit(1);
@@ -247,56 +281,65 @@
HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env,
LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info )
{
- LPDOSTASK lpDosTask;
+ LPDOSTASK lpDosTask = NULL; /* keep gcc from complaining */
HMODULE16 hModule;
HINSTANCE16 hInstance;
- NE_MODULE *pModule;
+ TDB *pTask = (TDB*)GlobalLock16( GetCurrentTask() );
+ NE_MODULE *pModule = pTask ? NE_GetPtr( pTask->hModule ) : NULL;
HFILE16 hFile;
OFSTRUCT ofs;
- int err;
+ int err, alloc = !(pModule && pModule->dos_image);
- if ((lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL)
+ GlobalUnlock16( GetCurrentTask() );
+
+ if (alloc && (lpDosTask = calloc(1, sizeof(DOSTASK))) == NULL)
return 0;
if ((hFile = OpenFile16( name, &ofs, OF_READ )) == HFILE_ERROR16)
return 2; /* File not found */
- if ((hModule = MODULE_CreateDummyModule(&ofs)) < 32)
- return hModule;
+ if (alloc) {
+ if ((hModule = MODULE_CreateDummyModule(&ofs)) < 32)
+ return hModule;
- lpDosTask->hModule = hModule;
+ lpDosTask->hModule = hModule;
- pModule = (NE_MODULE *)GlobalLock16(hModule);
- pModule->lpDosTask = lpDosTask;
+ pModule = (NE_MODULE *)GlobalLock16(hModule);
+ pModule->lpDosTask = lpDosTask;
- lpDosTask->img=NULL; lpDosTask->mm_name[0]=0; lpDosTask->mm_fd=-1;
+ lpDosTask->img=NULL; lpDosTask->mm_name[0]=0; lpDosTask->mm_fd=-1;
+ } else lpDosTask=pModule->lpDosTask;
err = MZ_LoadImage( hFile, cmdline, env, lpDosTask, pModule );
_lclose16(hFile);
- pModule->dos_image = lpDosTask->img;
- if (err<32) {
+ if (alloc) {
+ pModule->dos_image = lpDosTask->img;
+ if (err<32) {
+ if (lpDosTask->mm_name[0]!=0) {
+ if (lpDosTask->img!=NULL) munmap(lpDosTask->img,0x110000-START_OFFSET);
+ if (lpDosTask->mm_fd>=0) close(lpDosTask->mm_fd);
+ unlink(lpDosTask->mm_name);
+ } else
+ if (lpDosTask->img!=NULL) VirtualFree(lpDosTask->img,0x110000,MEM_RELEASE);
+ return err;
+ }
+ err = MZ_InitTask( lpDosTask );
if (lpDosTask->mm_name[0]!=0) {
- if (lpDosTask->img!=NULL) munmap(lpDosTask->img,0x110000-START_OFFSET);
- if (lpDosTask->mm_fd>=0) close(lpDosTask->mm_fd);
+ /* we unlink the temp file here to avoid leaving a mess in /tmp
+ if/when Wine crashes; the mapping still remains open, though */
unlink(lpDosTask->mm_name);
- } else
- if (lpDosTask->img!=NULL) VirtualFree(lpDosTask->img,0x110000,MEM_RELEASE);
- return err;
- }
- err = MZ_InitTask( lpDosTask );
- if (lpDosTask->mm_name[0]!=0) {
- /* we unlink the temp file here to avoid leaving a mess in /tmp
- if/when Wine crashes; the mapping still remains open, though */
- unlink(lpDosTask->mm_name);
- }
- if (err<32) {
- MZ_KillModule( lpDosTask );
- /* FIXME: cleanup hModule */
- return err;
- }
+ }
+ if (err<32) {
+ MZ_KillModule( lpDosTask );
+ /* FIXME: cleanup hModule */
+ return err;
+ }
- hInstance = NE_CreateInstance(pModule, NULL, (cmdline == NULL));
- PROCESS_Create( pModule, cmdline, env, hInstance, 0, startup, info );
- return hInstance;
+ hInstance = NE_CreateInstance(pModule, NULL, (cmdline == NULL));
+ PROCESS_Create( pModule, cmdline, env, hInstance, 0, startup, info );
+ return hInstance;
+ } else {
+ return (err<32) ? err : pTask->hInstance;
+ }
}
void MZ_KillModule( LPDOSTASK lpDosTask )
@@ -340,7 +383,7 @@
return 0;
}
-#else /* !linux */
+#else /* !MZ_SUPPORTED */
HINSTANCE16 MZ_CreateProcess( LPCSTR name, LPCSTR cmdline, LPCSTR env,
LPSTARTUPINFO32A startup, LPPROCESS_INFORMATION info )
diff --git a/loader/module.c b/loader/module.c
index 0804df3..1bbe11a 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -306,20 +306,22 @@
else
{
hInstance = NE_LoadModule( name, &hPrevInstance, FALSE, FALSE );
- pModule = hInstance >= 32 ? NE_GetPtr( hInstance ) : NULL;
+ if (hInstance < 32) return hInstance;
+
+ if ( !(pModule = NE_GetPtr(hInstance))
+ || (pModule->flags & NE_FFLAGS_LIBMODULE))
+ {
+ /* FIXME: cleanup */
+ return 11;
+ }
}
/* Create a task for this instance */
- if (pModule && !(pModule->flags & NE_FFLAGS_LIBMODULE))
- {
- PDB32 *pdb;
+ pModule->flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */
- pModule->flags |= NE_FFLAGS_GUI;
-
- pdb = PROCESS_Create( pModule, cmd_line, env, hInstance,
- hPrevInstance, startup, info );
- }
+ PROCESS_Create( pModule, cmd_line, env, hInstance,
+ hPrevInstance, startup, info );
return hInstance;
}
@@ -331,39 +333,63 @@
HINSTANCE16 WINAPI LoadModule16( LPCSTR name, LPVOID paramBlock )
{
LOADPARAMS *params;
- LOADPARAMS32 params32;
- HINSTANCE16 hInstance;
- LPSTR cmd_line;
+ LPSTR cmd_line, new_cmd_line;
+ LPCVOID env = NULL;
+ STARTUPINFO32A startup;
+ PROCESS_INFORMATION info;
+ HINSTANCE16 hInstance, hPrevInstance;
+ NE_MODULE *pModule;
+ PDB32 *pdb;
+
+ /* Load module */
if (!paramBlock || (paramBlock == (LPVOID)-1))
return LoadLibrary16( name );
- /* Transfer arguments to 32-bit param-block */
- params = (LOADPARAMS *)paramBlock;
- memset( ¶ms32, '\0', sizeof(params32) );
+ hInstance = NE_LoadModule( name, &hPrevInstance, FALSE, FALSE );
+ if ( hInstance < 32 || !(pModule = NE_GetPtr(hInstance))
+ || (pModule->flags & NE_FFLAGS_LIBMODULE))
+ return hInstance;
+ /* Create a task for this instance */
+
+ pModule->flags |= NE_FFLAGS_GUI; /* FIXME: is this necessary? */
+
+ params = (LOADPARAMS *)paramBlock;
cmd_line = (LPSTR)PTR_SEG_TO_LIN( params->cmdLine );
if (!cmd_line) cmd_line = "";
else if (*cmd_line) cmd_line++; /* skip the length byte */
- if (!(params32.lpCmdLine = HeapAlloc( GetProcessHeap(), 0,
- strlen(cmd_line)+strlen(name)+2 )))
+ if (!(new_cmd_line = HeapAlloc( GetProcessHeap(), 0,
+ strlen(cmd_line)+strlen(name)+2 )))
return 0;
- strcpy( params32.lpCmdLine, name );
- strcat( params32.lpCmdLine, " " );
- strcat( params32.lpCmdLine, cmd_line );
+ strcpy( new_cmd_line, name );
+ strcat( new_cmd_line, " " );
+ strcat( new_cmd_line, cmd_line );
- if (params->hEnvironment)
- params32.lpEnvAddress = GlobalLock16( params->hEnvironment );
+ if (params->hEnvironment) env = GlobalLock16( params->hEnvironment );
+
+ memset( &info, '\0', sizeof(info) );
+ memset( &startup, '\0', sizeof(startup) );
+ startup.cb = sizeof(startup);
if (params->showCmd)
- params32.lpCmdShow = PTR_SEG_TO_LIN( params->showCmd );
+ {
+ startup.dwFlags = STARTF_USESHOWWINDOW;
+ startup.wShowWindow = ((UINT16 *)PTR_SEG_TO_LIN(params->showCmd))[1];
+ }
- /* Call LoadModule32 */
- hInstance = LoadModule32( name, ¶ms32 );
+ pdb = PROCESS_Create( pModule, new_cmd_line, env,
+ hInstance, hPrevInstance, &startup, &info );
- /* Clean up */
+ CloseHandle( info.hThread );
+ CloseHandle( info.hProcess );
+
if (params->hEnvironment) GlobalUnlock16( params->hEnvironment );
- HeapFree( GetProcessHeap(), 0, params32.lpCmdLine );
+ HeapFree( GetProcessHeap(), 0, new_cmd_line );
+
+ /* Start task */
+
+ if (pdb) TASK_StartTask( pdb->task );
return hInstance;
}
@@ -521,11 +547,9 @@
lpStartupInfo, lpProcessInfo );
/* Try DOS module */
-#ifdef linux
if (hInstance == 11)
hInstance = MZ_CreateProcess( name, cmdline, lpEnvironment,
lpStartupInfo, lpProcessInfo );
-#endif
if (hInstance < 32)
{
diff --git a/loader/ne/resource.c b/loader/ne/resource.c
index 90fb416..da37944 100644
--- a/loader/ne/resource.c
+++ b/loader/ne/resource.c
@@ -383,7 +383,7 @@
assert( !__winelib ); /* Can't use Win16 resource functions in Winelib */
- if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != -1)
+ if ((fd = _lopen16( NE_MODULE_NAME(pModule), OF_READ )) != HFILE_ERROR16)
{
WORD sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
NE_NAMEINFO *pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
diff --git a/loader/ne/segment.c b/loader/ne/segment.c
index ff92d5c..8215c30 100644
--- a/loader/ne/segment.c
+++ b/loader/ne/segment.c
@@ -106,10 +106,11 @@
stack16Top->ip = 0;
stack16Top->cs = 0;
TRACE(dll,"CallLoadAppSegProc(hmodule=0x%04x,hf=0x%04x,segnum=%d\n",
- pModule->self,hf,segnum
- );
+ pModule->self,hf,segnum );
newselector = Callbacks->CallLoadAppSegProc(selfloadheader->LoadAppSeg,
- pModule->self, hf, segnum );
+ pModule->self,
+ HFILE32_TO_HFILE16(hf),
+ segnum );
TRACE(dll,"Ret CallLoadAppSegProc: selector = 0x%04x\n",newselector);
_lclose32( hf );
if (newselector != oldselector) {
@@ -218,7 +219,7 @@
*((BYTE *)pTarget + pTarget->name_table),
(char *)pTarget + pTarget->name_table + 1,
ordinal );
- address = 0xdeadbeef;
+ address = (FARPROC16)0xdeadbeef;
}
}
if (TRACE_ON(fixup))
@@ -248,7 +249,7 @@
*((BYTE *)pTarget + pTarget->name_table),
(char *)pTarget + pTarget->name_table + 1, func_name );
}
- if (!address) address = 0xdeadbeef;
+ if (!address) address = (FARPROC16) 0xdeadbeef;
if (TRACE_ON(fixup))
{
NE_MODULE *pTarget = NE_GetPtr( module );
@@ -418,8 +419,10 @@
stack16Top->cs = 0;
hf = FILE_DupUnixHandle( NE_OpenFile( pModule ) );
- TRACE(dll,"CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",pModule->self,hf);
- Callbacks->CallBootAppProc(selfloadheader->BootApp, pModule->self, hf);
+ TRACE(dll,"CallBootAppProc(hModule=0x%04x,hf=0x%04x)\n",pModule->self,
+ HFILE32_TO_HFILE16(hf));
+ Callbacks->CallBootAppProc(selfloadheader->BootApp, pModule->self,
+ HFILE32_TO_HFILE16(hf));
TRACE(dll,"Return from CallBootAppProc\n");
_lclose32(hf);
/* some BootApp procs overwrite the selector of dgroup */
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 8ef9b73..dd26b2b 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -911,8 +911,7 @@
if ((PE_HEADER(wm->module)->FileHeader.Characteristics & IMAGE_FILE_DLL) &&
(PE_HEADER(wm->module)->OptionalHeader.AddressOfEntryPoint)
) {
- DWORD (CALLBACK *entry)(HMODULE32,DWORD,LPVOID) = (void*)RVA_PTR( wm->module,
- OptionalHeader.AddressOfEntryPoint );
+ DLLENTRYPROC32 entry = (void*)RVA_PTR( wm->module,OptionalHeader.AddressOfEntryPoint );
TRACE(relay, "CallTo32(entryproc=%p,module=%08x,type=%ld,res=%p)\n",
entry, wm->module, type, lpReserved );
entry( wm->module, type, lpReserved );
diff --git a/loader/resource.c b/loader/resource.c
index 798b8a5..6d11b55 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -85,7 +85,7 @@
case MODULE32_PE:
ret = PE_FindResourceEx32W(wm,name,type,lang);
if ( ret==0 )
- ERR(resource,"%s not found!\n",debugres_w (name));
+ ERR(resource,"(0x%08lx(%s),%s not found!\n",hModule,wm->modname,debugres_w (name));
return ret;
default:
ERR(module,"unknown module type %d\n",wm->type);
diff --git a/loader/task.c b/loader/task.c
index 099333e..df06353 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -1032,6 +1032,10 @@
BYTE *thunk,*lfunc;
SEGPTR thunkaddr;
+ if (!func) {
+ ERR(task, "Ouch ! MakeProcInstance called with func == NULL !\n");
+ return (FARPROC16)0; /* Windows seems to do the same */
+ }
if (!hInstance) hInstance = CURRENT_DS;
thunkaddr = TASK_AllocThunk( GetCurrentTask() );
if (!thunkaddr) return (FARPROC16)0;