Release 961215
Sun Dec 15 16:18:15 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/x11drv/bitblt.c]
Fixed BITBLT_StretchImage for partially covered or inverted
bitmaps.
* [objects/dib.c]
Fixed the upside-down bitmap problem.
Sat Dec 14 02:49:57 1996 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* [if1632/user32.spec]
IsMenu and RemoveMenu added (use existing Win16 functions).
* [include/windows.h]
Corrections to BITMAPINFOHEADER structure.
* [loader/module.c] [if1632/kernel32.spec]
New function GetModuleFileName32A (heavily based on original
Win16 version).
* [loader/pe_image.c]
Hack to allow files with short PE header to be loaded (e.g.
COMDLG32.DLL from Win32s).
* [misc/winsock_async.c]
#if out EIDRM case (not present in FreeBSD).
* [tools/build.c]
Remove trailing comments from .s files generated by build
as these break assembly when not run through pre-processor.
* [windows/graphics.c] [if1632/gdi32.spec]
New function Polyline32 - based on original Polyline. Needs
metafile support adding still.
Fri Dec 13 13:04:06 1996 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [win32/findfile.c] [if1632/kernel.spec]
FindFirstFile32A(): Use dos current directory for drive prefixes.
FindNextFile32A(): Fill in file attribute information.
Implement FindFirstFile16, FindNextFile16, FindClose16.
* [files/drive.c]
GetCurrentDirectory32A - Fix problem with null 3rd character in
string.
Tue Dec 10 14:49:07 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [windows/painting.c][windows/message.c]
Don't use linked lists to call SendMessage(), for it might destroy
the current listentry.
* [misc/registry.c]
Fixed temporary file saving (rename doesn't work across
partitions).
* [files/*.c]
GetFullPathName*,GetDriveType32A fixed, CreateDirectoryEx*,
GetVolumeInformation32W fixed.
* [win32/process.c][if1632/kernel.spec][if1632/kernel32.spec]
LoadLibrary* updated to new naming std., *32W added.
* [win32/console.c] [include/wincon.h]
Additions for NT commandline executables.
* [if1632/advapi32.spec][if1632/kernel32.spec][win32/init.c]
GetUserName32W added, GetComputerName32W added,
GetStartupInfo32W added, GetSystemInfo updated to NT standard.
* [windows/msgbox.c][misc/shell.c][windows/graphics.c]
MessageBox32W, ShellAbout32W, CommandLineToArgvW, Polygon32 added.
* [misc/crtdll.c][include/crtdll.h][if1632/crtdll.spec][misc/ntdll.c]
[if1632/ntdll.spec]
Lot of new unicode functions added (needed for NT).
* [loader/pe_image.c]
NtCurrentTeb added.
Tue Dec 10 22:39:33 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/keyboard.c]
Rewrote function TranslateAccelerator().
Mon Dec 9 14:52:13 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [windows/defwnd.c]
DEFWND_SetText(): Set icon name.
Sun Dec 8 23:30:00 1996 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [loader/signal.c] [misc/winsock.c] [misc/winsock_async.c]
[if1632/winsock.spec]
IPC resource cleanup, bugfixes.
* [windows/dialog.c] [windows/defdlg.c]
More DefDlgProc() fixes.
Sun Dec 8 14:01:42 1996 Vadim Strizhevsky <striv@ms.com>
* [misc/clipboard.c] [objects/font.c] [win32/init.c]
[win32/newfns.c] [windows/graphics.c]
Added a few WIN32 functions which needed to run some win32
accessories. Clock should now work almost as well as 16 bit version.
Add: RegisterClipboardFormat32W GetTextExtentExPoint32*
GetModuleHandleW, DisableThreadLibraryCalls (empty stub),
Polygon32
Fix: Polygon16 possible memory leak on error return.
diff --git a/loader/module.c b/loader/module.c
index 3866137..ed35931 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -1075,7 +1075,7 @@
char *p;
/* Try with prepending the path of the current module */
- GetModuleFileName( hModule, buffer, sizeof(buffer) );
+ GetModuleFileName16( hModule, buffer, sizeof(buffer) );
if (!(p = strrchr( buffer, '\\' ))) p = buffer;
memcpy( p + 1, pstr + 1, *pstr );
strcpy( p + 1 + *pstr, ".dll" );
@@ -1284,9 +1284,9 @@
/**********************************************************************
- * GetModuleFileName (KERNEL.49)
+ * GetModuleFileName16 (KERNEL.49)
*/
-INT16 GetModuleFileName( HINSTANCE16 hModule, LPSTR lpFileName, INT16 nSize )
+INT16 GetModuleFileName16( HINSTANCE16 hModule, LPSTR lpFileName, INT16 nSize )
{
NE_MODULE *pModule;
@@ -1294,10 +1294,44 @@
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), nSize );
- dprintf_module( stddeb, "GetModuleFilename: %s\n", lpFileName );
+ dprintf_module( stddeb, "GetModuleFileName16: %s\n", lpFileName );
return strlen(lpFileName);
}
+
+/***********************************************************************
+ * GetModuleFileName32A (KERNEL32.235)
+ */
+DWORD GetModuleFileName32A( HMODULE32 hModule, LPSTR lpFileName, DWORD size )
+{
+ NE_MODULE *pModule;
+
+ if (!hModule)
+ {
+ TDB *pTask = (TDB *)GlobalLock16( GetCurrentTask() );
+ hModule = pTask->hInstance;
+ }
+ hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
+ if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
+ lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), size );
+ dprintf_module( stddeb, "GetModuleFileName32A: %s\n", lpFileName );
+ return strlen(lpFileName);
+}
+
+
+/***********************************************************************
+ * GetModuleFileName32W (KERNEL32.236)
+ */
+DWORD GetModuleFileName32W( HMODULE32 hModule, LPWSTR lpFileName, DWORD size )
+{
+ LPSTR fnA = (char*)HeapAlloc( GetProcessHeap(), 0, size );
+ DWORD res = GetModuleFileName32A( hModule, fnA, size );
+ lstrcpynAtoW( lpFileName, fnA, size );
+ HeapFree( GetProcessHeap(), 0, fnA );
+ return res;
+}
+
+
/**********************************************************************
* GetModuleName (KERNEL.27)
*/
@@ -1314,7 +1348,7 @@
/***********************************************************************
* LoadLibrary (KERNEL.95)
*/
-HINSTANCE16 LoadLibrary( LPCSTR libname )
+HINSTANCE16 LoadLibrary16( LPCSTR libname )
{
HINSTANCE16 handle;
diff --git a/loader/pe_image.c b/loader/pe_image.c
index 370b926..a99e627 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -194,7 +194,7 @@
char *p, buffer[256];
/* Try with prepending the path of the current module */
- GetModuleFileName (hModule, buffer, sizeof (buffer));
+ GetModuleFileName16 (hModule, buffer, sizeof (buffer));
if (!(p = strrchr (buffer, '\\')))
p = buffer;
strcpy (p + 1, name);
@@ -389,6 +389,16 @@
lseek( fd, offset, SEEK_SET);
read( fd, pe->pe_header, sizeof(struct pe_header_s));
+/* FIXME: this is a *horrible* hack to make COMDLG32.DLL load OK. The
+problem needs to be fixed properly at some stage */
+
+ if (pe->pe_header->opt_coff.NumberOfRvaAndSizes != 16) {
+ printf("Short PE Header!!!\n");
+ lseek( fd, -(16 - pe->pe_header->opt_coff.NumberOfRvaAndSizes) * sizeof (struct Directory), SEEK_CUR);
+ }
+
+/* horrible hack ends !!! */
+
/* read sections */
pe->pe_seg = xmalloc(sizeof(struct pe_segment_table) *
pe->pe_header->coff.NumberOfSections);
@@ -627,14 +637,22 @@
typedef struct _TEB
{
- void *Except;
- void *stack;
- int dummy1[4];
- struct _TEB *TEBDSAlias;
- int dummy2[2];
- int taskid;
+ void *Except; /* 00 */
+ void *stack; /* 04 */
+ int dummy1[4]; /* 08 */
+ struct _TEB *TEBDSAlias; /* 18 */
+ int dummy2[2]; /* 1C */
+ int taskid; /* 24 */
+ int dummy3[2]; /* 28 */
+ LPBYTE process; /* 30 */ /* points to current process struct */
} TEB;
+/* the current process structure. Only the processheap is of interest (off 0x18) */
+struct {
+ DWORD dummy[6];
+ HANDLE32 procheap; /* 18: Process Heap */
+} dummyprocess;
+
void PE_InitTEB(int hTEB)
{
TDB *pTask;
@@ -646,6 +664,14 @@
pTEB->Except = (void *)(-1);
pTEB->TEBDSAlias = pTEB;
pTEB->taskid = getpid();
+
+ dummyprocess.procheap = GetProcessHeap();
+ pTEB->process = &dummyprocess;
+}
+
+VOID
+NtCurrentTeb(CONTEXT *context) {
+ context->Eax = GlobalLock16(LOWORD(context->SegFs));
}
void PE_InitializeDLLs(HMODULE16 hModule)
diff --git a/loader/resource.c b/loader/resource.c
index cf7cc0b..200406f 100644
--- a/loader/resource.c
+++ b/loader/resource.c
@@ -505,57 +505,6 @@
/**********************************************************************
- * TranslateAccelerator [USER.178]
- */
-INT16 TranslateAccelerator(HWND hWnd, HACCEL16 hAccel, LPMSG16 msg)
-{
- ACCELHEADER *lpAccelTbl;
- int i;
-
- if (hAccel == 0 || msg == NULL) return 0;
- if (msg->message != WM_KEYDOWN &&
- msg->message != WM_KEYUP &&
- msg->message != WM_SYSKEYDOWN &&
- msg->message != WM_SYSKEYUP &&
- msg->message != WM_CHAR) return 0;
-
- dprintf_accel(stddeb, "TranslateAccelerators hAccel=%04x !\n", hAccel);
-
- lpAccelTbl = (LPACCELHEADER)GlobalLock16(hAccel);
- for (i = 0; i < lpAccelTbl->wCount; i++) {
- if(lpAccelTbl->tbl[i].type & VIRTKEY_ACCEL) {
- if(msg->wParam == lpAccelTbl->tbl[i].wEvent &&
- (msg->message == WM_KEYDOWN || msg->message == WM_SYSKEYDOWN)) {
- INT mask = 0;
-
- if(GetKeyState(VK_SHIFT) & 0x8000) mask |= SHIFT_ACCEL;
- if(GetKeyState(VK_CONTROL) & 0x8000) mask |= CONTROL_ACCEL;
- if(GetKeyState(VK_MENU) & 0x8000) mask |= ALT_ACCEL;
- if(mask == (lpAccelTbl->tbl[i].type &
- (SHIFT_ACCEL | CONTROL_ACCEL | ALT_ACCEL))) {
- SendMessage16(hWnd, WM_COMMAND, lpAccelTbl->tbl[i].wIDval,
- 0x00010000L);
- GlobalUnlock16(hAccel);
- return 1;
- }
- if (msg->message == WM_KEYUP || msg->message == WM_SYSKEYUP)
- return 1;
- }
- }
- else {
- if (msg->wParam == lpAccelTbl->tbl[i].wEvent &&
- msg->message == WM_CHAR) {
- SendMessage16(hWnd, WM_COMMAND, lpAccelTbl->tbl[i].wIDval, 0x00010000L);
- GlobalUnlock16(hAccel);
- return 1;
- }
- }
- }
- GlobalUnlock16(hAccel);
- return 0;
-}
-
-/**********************************************************************
* LoadString16
*/
INT16
diff --git a/loader/signal.c b/loader/signal.c
index d9238e3..a693c7d 100644
--- a/loader/signal.c
+++ b/loader/signal.c
@@ -9,6 +9,8 @@
#include <sys/time.h>
#include <sys/timeb.h>
+#include <sys/types.h>
+#include <sys/wait.h>
#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__svr4__) || defined(_SCO_DS)
#ifndef _SCO_DS
@@ -21,8 +23,10 @@
#include "debugger.h"
#include "miscemu.h"
+#include "options.h"
#include "registers.h"
#include "win.h"
+#include "winsock.h"
#if !defined(BSD4_4) || defined(linux) || defined(__FreeBSD__)
char * cstack[4096];
@@ -68,6 +72,45 @@
DOSMEM_Tick();
}
+/**********************************************************************
+ * SIGNAL_break
+ *
+ * Handle Ctrl-C and such
+ */
+#ifdef linux
+static void SIGNAL_break(int signal, SIGCONTEXT context_struct)
+{
+ SIGCONTEXT *context = &context_struct;
+#elif defined(__svr4__) || defined(_SCO_DS)
+static void SIGNAL_break(int signal, void *siginfo, SIGCONTEXT *context)
+{
+#else
+static void SIGNAL_break(int signal, int code, SIGCONTEXT *context)
+{
+#endif
+ if (Options.debug) wine_debug( signal, context ); /* Enter our debugger */
+ exit(0);
+}
+
+/**********************************************************************
+ * SIGNAL_child
+ *
+ * wait4 terminated child processes
+ */
+#ifdef linux
+static void SIGNAL_child(int signal, SIGCONTEXT context_struct)
+{
+ SIGCONTEXT *context = &context_struct;
+#elif defined(__svr4__) || defined(_SCO_DS)
+static void SIGNAL_child(int signal, void *siginfo, SIGCONTEXT *context)
+{
+#else
+static void SIGNAL_child(int signal, int code, SIGCONTEXT *context)
+{
+#endif
+ wait4( 0, NULL, WNOHANG, NULL);
+}
+
/**********************************************************************
* SIGNAL_trap
@@ -206,6 +249,8 @@
#endif /* __svr4__ || _SCO_DS */
SIGNAL_SetHandler( SIGALRM, (void (*)())wine_timer, 1);
+ SIGNAL_SetHandler( SIGINT, (void (*)())SIGNAL_break, 1);
+ SIGNAL_SetHandler( SIGCHLD, (void (*)())SIGNAL_child, 1);
SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault, 1);
SIGNAL_SetHandler( SIGILL, (void (*)())SIGNAL_fault, 1);
SIGNAL_SetHandler( SIGFPE, (void (*)())SIGNAL_fault, 1);
diff --git a/loader/task.c b/loader/task.c
index 824e2d5..1795097 100644
--- a/loader/task.c
+++ b/loader/task.c
@@ -351,6 +351,7 @@
static void TASK_CallToStart(void)
{
int cs_reg, ds_reg, fs_reg, ip_reg;
+ int exit_code = 1;
TDB *pTask = (TDB *)GlobalLock16( hCurrentTask );
NE_MODULE *pModule = MODULE_GetPtr( pTask->hModule );
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
@@ -372,8 +373,9 @@
PE_InitTEB( fs_reg );
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs_reg));
PE_InitializeDLLs( pTask->hModule );
- CallTaskStart32( (FARPROC32)(pModule->pe_module->load_addr +
+ exit_code = CallTaskStart32((FARPROC32)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint) );
+ TASK_KillCurrentTask( exit_code );
}
else
{
@@ -402,11 +404,10 @@
pTask->hPDB /*es*/, 0 /*bp*/, 0 /*ax*/,
pModule->stack_size /*bx*/, pModule->heap_size /*cx*/,
0 /*dx*/, 0 /*si*/, ds_reg /*di*/ );
+ /* This should never return */
+ fprintf( stderr, "TASK_CallToStart: Main program returned!\n" );
+ TASK_KillCurrentTask( 1 );
}
-
- /* This should never return */
- fprintf( stderr, "TASK_CallToStart: Main program returned!\n" );
- TASK_KillCurrentTask( 1 );
}
#endif
@@ -461,7 +462,7 @@
/* Get current directory */
- GetModuleFileName( hModule, filename, sizeof(filename) );
+ GetModuleFileName16( hModule, filename, sizeof(filename) );
name = strrchr(filename, '\\');
if (name) *(name+1) = 0;
@@ -470,6 +471,10 @@
pTask->nEvents = 1; /* So the task can be started */
pTask->hSelf = hTask;
pTask->flags = 0;
+
+ if (pModule->flags & NE_FFLAGS_WIN32)
+ pTask->flags |= TDBF_WIN32;
+
pTask->version = pModule->expected_version;
pTask->hInstance = hInstance;
pTask->hPrevInstance = hPrevInstance;