Commit ade697e8 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 951124

Tue Nov 21 18:49:10 1995 Alexandre Julliard <julliard@sunsite.unc.edu> * [configure.in] [Makefile] [misc/dos_fs.c] Got rid of autoconf.h file. * [debugger/dbg.y] More logical behavior upon syntax errors. * [include/hook.h] [windows/hook.c] Changed hook structure and rewrote most of the hook functions for better compatibility, based on investigations by Alex Korobka. * [include/message.h] [windows/message.c] Added hooks to message queue structure and made the structure layout Windows-compatible. Added support for WH_MOUSE, WH_KEYBOARD, WH_HARDWARE and WH_JOURNALRECORD hooks. * [misc/main.c] Added command-line option for changing the language at run-time (not implemented yet), based on a suggestion from Michael Patra. * [objects/cursoricon.c] Fixed silly SEGPTR bug in DumpIcon(). Mon Nov 20 22:22:22 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [controls/listbox.c] [controls/combo.c] [include/listbox.h] Partial implementaion of LBS_EXTENDEDSEL style, yet more updates for drag & drop support. Now works. * [windows/defwnd.c] More message handlers. * [windows/win.c] DragObject, DragDetect, AnyPopup functions. * [controls/listbox.c] More kludgy fixes (WM_...TOITEM, etc.). * [objects/cursoricon.c] [objects/oembitmap.c] IconToCursor skeleton, patch for OBM_LoadCursorIcon to handle new cursor. * [include/bitmaps/ocr*] New OEM cursors. Mon Nov 20 11:05:20 EST 1995 Jim Peterson <jspeter@birch.ee.vt.edu> * [toolkit/heap.c] Swapped flags and size arguments to LocalRealloc as per changes in memory/local.c by William Magro in previous release. * [include/wintypes.h] Reinstated the #define's for 'min' and 'max', since they're part of the Windows API. I really don't think it's a wise idea, so I put a '#ifndef DONT_DEFINE_min_AND_max' around them. I think the actual WINE code should never use these (it should use 'MIN' and 'MAX' instead). * [loader/*] Put '#ifndef WINELIB' around many things that WINElib should not need. * [controls/edit.c] Took out many '#if defined(WINELIB)' sections with the associated comment 'temporary fix, until Local memory is correctly implemented in WINELIB', since the effective translations are now in toolkit/miscstubs.c. Took out the #ifndef's I put in EDIT_ClearText. Whoever modified this file fixed (or at least postponed) the bug I had encountered. * [loader/task.c] Put an #ifdef in TASK_CreateTask() that hardwires the current drive to C: This will probably cause a lot of trouble if this change is forgotten in the future, but it will let things like the OpenFileName dialog work for now. * [toolkit/libres.c] [toolkit/Makefile.in] [toolkit/Makefile] [include/libres.h] Made new libres.c file, which will contain functions for supporting accessing resources by name in WINElib. 'winerc' will need to be changed. * [toolkit/heap.c] Refined memory routines to allow for differences between LocalAlloc and GlobalAlloc and between LocalSize and GlobalSize. * [windows/message.c] [include/windows.h] Defined the GetCurrentTime routine in windows/message.c, and removed the #define in windows.h. Mon Nov 20 00:36:42 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be> * [*/*] Added new debugging type DEBUG_WIN32 and DEBUG_ENV. * [loader/module.c] Added undocumented GetExpWinVer. * [tools/build.c] Previous code didn't pop possibly changed %esi, %edi and %edx from the stack. * [win32/advapi.c] Added GetUserNameA. * [win32/code_page.c] Added stub for MultiByteToWideChar. * [win32/console.c] Added SetConsoleCtrlHandler stub. * [win32/file.c] Added ReadFile CreateFileA GetFileInformationByHandle stubs. Added CloseHandle. * [win32/memory.c] Changed VirtualAlloc and VirtualFree. * [win32/process.c] Added ExitProcess. Sun Nov 19 17:54:42 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [include/windows.h] Fixed a few broken structure definitions. * [loader/resource.c] FindResource(): Need to check for '#xxx' strings here. * [miscemu/int21.c] FindNext(): Return MS-DOS filenames uppercase. * [objects/cursoricon.c] CreateIcon(), CreateCursor(): Added missing element to CURSORICONINFO initializers. * [misc/file.c] _lopen(): Files opened in OF_WRITE mode are truncated. OpenFile(): Ignore OF_READ/OF_WRITE/OF_READWRITE when files are created; use read/write mode. * [misc/profile.c] load(): Rewritten. * [misc/commdlg.c] Fixed bad call to strncpy() that smashed the stack. * [controls/combo.c] [windows/winpos.c] [memory/selector.c] Operator precedence fixes. People who use gcc 2.7.1 don't need a debugger :-) * [if1632/gdi.spec] [objects/palette.c] Add ResizePalette() and AnimatePalette() stubs. They don't do anything, but sometimes that's good enough. Fri Nov 17 09:10:35 GMT 1995 John Harvey <john@division.co.uk> * [include/wine.h] [include/registers.h] [include/winsock.h] Added definitions for Unixware. * [loader/signal.c] [misc/comm.c] [misc/winsocket.c] Misc. fixes for Unixware. * [loader/task.c] Made assignemts to context in InitTask for registers use the macros from registers.h to make them more portable. (Needed for Unixware) * [tools/build.c] Fixed register acces routines to work on Unixware. Bit grubby but it seems to work. * [controls/edit.c] EDIT_WM_NCCreate allocates local heap if hasn't been previously allocated. * [miscemu/int21.c] mkdir now creates directory with permission to access it. * [misc/dos_fs.c] mkdir now creates directory with permission to access it. DOS_opendir now uses linked list of dirents to avoid problems with realloc changing address of malloced memory. Thu Nov 16 12:47:13 1995 Michael Patra <patra@itp1.Physik.TU-Berlin.DE> * [controls/menu.c] MENU_CalcItemSize(): Fixed handling of empty menu items. Sat Nov 11 21:46:54 1995 Hans de Graaff <graaff@twi72.twi.tudelft.nl> * [misc/file.c] In OpenFile, unlink should be done on the unix filename. Sat Nov 11 16:43:29 1995 Cameron Heide (heide@ee.ualberta.ca) * [include/handle32.h] New header file containing internal Win32 kernel handle information. * [win32/file.c] Added ReadFile, CreateFile, and CloseFileHandle, and did some reorganizing to match the new handle allocation scheme. * [win32/init.c] Added CloseHandle and the creation of standard I/O handles. * [win32/object_mgt.c] New module for allocating and freeing Win32 kernel handles.
parent 902da699
This is release 951105 of Wine the MS Windows emulator. This is still a
This is release 951124 of Wine the MS Windows emulator. This is still a
developer's only release. There are many bugs and many unimplemented API
features. Most applications still do not work.
Patches should be submitted to "wine-new@amscons.com". Please don't forget
to include a ChangeLog entry. I'll make a new release every other week.
WHAT'S NEW with Wine-951105: (see ChangeLog for details)
- A lot of fixes for Winelib.
- Built-in debugger improvements.
- Get/SetMetafileBits implemented.
WHAT'S NEW with Wine-951124: (see ChangeLog for details)
- Drag and drop implemented.
- Unixware is now fully supported.
- Many Win32 improvements.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -17,11 +17,11 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-951105.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-951105.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-951105.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-951105.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-951105.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/Wine-951124.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-951124.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-951124.tar.gz
ftp.funet.fi:/pub/OS/Linux/ALPHA/Wine/Wine-951124.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-951124.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
1. 32-bit/16-bit call translation:
- EBP and ESP are sometimes corrupted while running 16-bit code.
- Message flow is not correct for multiple tasks, some messages are not supported.
2. Messaging:
- Message flow is not correct for multiple tasks
- Dialog Boxes created by WM_CREATE handler aren't visible
- MDI does not send WM_GETMINMAX message.
- resizing of MDI child windows sometimes leaves them unrepainted
3. Controls:
- Some features are missing (like VK_SHIFT aided multiple selection in listboxes)
4. Miscellaneous:
- InitializeLoadedDLLs() can't init LZEXPAND.DLL. (cs:ip => 0:0)
- LoadCursor does not correctly handle bitmap cursors
- AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple times.
- Dialogs don't support resources which are referred to as integers.
5. Where to look in source files:
- grep for FIXME in the source files.
----------------------------------------------------------------------
Tue Nov 21 18:49:10 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [configure.in] [Makefile] [misc/dos_fs.c]
Got rid of autoconf.h file.
* [debugger/dbg.y]
More logical behavior upon syntax errors.
* [include/hook.h] [windows/hook.c]
Changed hook structure and rewrote most of the hook functions for
better compatibility, based on investigations by Alex Korobka.
* [include/message.h] [windows/message.c]
Added hooks to message queue structure and made the structure
layout Windows-compatible.
Added support for WH_MOUSE, WH_KEYBOARD, WH_HARDWARE and
WH_JOURNALRECORD hooks.
* [misc/main.c]
Added command-line option for changing the language at run-time
(not implemented yet), based on a suggestion from Michael Patra.
* [objects/cursoricon.c]
Fixed silly SEGPTR bug in DumpIcon().
Mon Nov 20 22:22:22 1995 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [controls/listbox.c] [controls/combo.c] [include/listbox.h]
Partial implementaion of LBS_EXTENDEDSEL style,
yet more updates for drag & drop support. Now works.
* [windows/defwnd.c]
More message handlers.
* [windows/win.c]
DragObject, DragDetect, AnyPopup functions.
* [controls/listbox.c]
More kludgy fixes (WM_...TOITEM, etc.).
* [objects/cursoricon.c] [objects/oembitmap.c]
IconToCursor skeleton, patch for OBM_LoadCursorIcon to handle new
cursor.
* [include/bitmaps/ocr*]
New OEM cursors.
Mon Nov 20 11:05:20 EST 1995 Jim Peterson <jspeter@birch.ee.vt.edu>
* [toolkit/heap.c]
Swapped flags and size arguments to LocalRealloc as per changes in
memory/local.c by William Magro in previous release.
* [include/wintypes.h]
Reinstated the #define's for 'min' and 'max', since they're part of
the Windows API. I really don't think it's a wise idea, so I put
a '#ifndef DONT_DEFINE_min_AND_max' around them. I think the actual
WINE code should never use these (it should use 'MIN' and 'MAX'
instead).
* [loader/*]
Put '#ifndef WINELIB' around many things that WINElib should not need.
* [controls/edit.c]
Took out many '#if defined(WINELIB)' sections with the associated
comment 'temporary fix, until Local memory is correctly implemented in
WINELIB', since the effective translations are now in
toolkit/miscstubs.c.
Took out the #ifndef's I put in EDIT_ClearText. Whoever modified this
file fixed (or at least postponed) the bug I had encountered.
* [loader/task.c]
Put an #ifdef in TASK_CreateTask() that hardwires the current drive to
C: This will probably cause a lot of trouble if this change is
forgotten in the future, but it will let things like the OpenFileName
dialog work for now.
* [toolkit/libres.c] [toolkit/Makefile.in] [toolkit/Makefile]
[include/libres.h]
Made new libres.c file, which will contain functions for supporting
accessing resources by name in WINElib. 'winerc' will need to be
changed.
* [toolkit/heap.c]
Refined memory routines to allow for differences between LocalAlloc
and GlobalAlloc and between LocalSize and GlobalSize.
* [windows/message.c] [include/windows.h]
Defined the GetCurrentTime routine in windows/message.c, and removed
the #define in windows.h.
Mon Nov 20 00:36:42 MET 1995 Sven Verdoolaege <skimo@dns.ufsia.ac.be>
* [*/*]
Added new debugging type DEBUG_WIN32 and DEBUG_ENV.
* [loader/module.c]
Added undocumented GetExpWinVer.
* [tools/build.c]
Previous code didn't pop possibly changed %esi, %edi and %edx
from the stack.
* [win32/advapi.c]
Added GetUserNameA.
* [win32/code_page.c]
Added stub for MultiByteToWideChar.
* [win32/console.c]
Added SetConsoleCtrlHandler stub.
* [win32/file.c]
Added ReadFile CreateFileA GetFileInformationByHandle stubs.
Added CloseHandle.
* [win32/memory.c]
Changed VirtualAlloc and VirtualFree.
* [win32/process.c]
Added ExitProcess.
Sun Nov 19 17:54:42 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>
* [include/windows.h]
Fixed a few broken structure definitions.
* [loader/resource.c]
FindResource(): Need to check for '#xxx' strings here.
* [miscemu/int21.c]
FindNext(): Return MS-DOS filenames uppercase.
* [objects/cursoricon.c]
CreateIcon(), CreateCursor(): Added missing element to CURSORICONINFO
initializers.
* [misc/file.c]
_lopen(): Files opened in OF_WRITE mode are truncated.
OpenFile(): Ignore OF_READ/OF_WRITE/OF_READWRITE when files are
created; use read/write mode.
* [misc/profile.c]
load(): Rewritten.
* [misc/commdlg.c]
Fixed bad call to strncpy() that smashed the stack.
* [controls/combo.c] [windows/winpos.c] [memory/selector.c]
Operator precedence fixes. People who use gcc 2.7.1 don't need a
debugger :-)
* [if1632/gdi.spec] [objects/palette.c]
Add ResizePalette() and AnimatePalette() stubs. They don't do anything,
but sometimes that's good enough.
Fri Nov 17 09:10:35 GMT 1995 John Harvey <john@division.co.uk>
* [include/wine.h] [include/registers.h] [include/winsock.h]
Added definitions for Unixware.
* [loader/signal.c] [misc/comm.c] [misc/winsocket.c]
Misc. fixes for Unixware.
* [loader/task.c]
Made assignemts to context in InitTask for registers use the macros
from registers.h to make them more portable. (Needed for Unixware)
* [tools/build.c]
Fixed register acces routines to work on Unixware. Bit grubby but
it seems to work.
* [controls/edit.c]
EDIT_WM_NCCreate allocates local heap if hasn't been previously
allocated.
* [miscemu/int21.c]
mkdir now creates directory with permission to access it.
* [misc/dos_fs.c]
mkdir now creates directory with permission to access it.
DOS_opendir now uses linked list of dirents to avoid problems with
realloc changing address of malloced memory.
Thu Nov 16 12:47:13 1995 Michael Patra <patra@itp1.Physik.TU-Berlin.DE>
* [controls/menu.c]
MENU_CalcItemSize(): Fixed handling of empty menu items.
Sat Nov 11 21:46:54 1995 Hans de Graaff <graaff@twi72.twi.tudelft.nl>
* [misc/file.c]
In OpenFile, unlink should be done on the unix filename.
Sat Nov 11 16:43:29 1995 Cameron Heide (heide@ee.ualberta.ca)
* [include/handle32.h]
New header file containing internal Win32 kernel handle
information.
* [win32/file.c]
Added ReadFile, CreateFile, and CloseFileHandle, and did
some reorganizing to match the new handle allocation scheme.
* [win32/init.c]
Added CloseHandle and the creation of standard I/O handles.
* [win32/object_mgt.c]
New module for allocating and freeing Win32 kernel handles.
----------------------------------------------------------------------
Fri Nov 3 20:08:17 1995 Alexandre Julliard <julliard@sunsite.unc.edu>
* [configure.in]
......
......@@ -84,8 +84,6 @@ clean:
distclean:
for i in $(ALLSUBDIRS); do (cd $$i; $(MAKE) distclean); done
echo "/* autoconf.h generated automatically. Run Configure */" >autoconf.h
echo "#error You must run Configure before you can build the makefiles." >>autoconf.h
$(RM) *.o \#*\# *~ *.bak wine wine.sym winelib.a TAGS
$(RM) config.* include/config.h Make.rules Makefile
......
/* autoconf.h generated automatically. Run Configure */
#error You must run Configure before you can build the makefiles.
/* @configure_input@ */
#define WINE_INI_GLOBAL @WINE_INI_GLOBAL@
#define AutoDefines @LANG@
......@@ -1596,18 +1596,6 @@ else
TOP_SRCDIR="${top_srcdir}"
fi
echo $ac_n "checking for wine.ini in autoconf.h""... $ac_c" 1>&6
if test -f ${TOP_SRCDIR}/autoconf.h; then
if test `grep -c WINE_INI_GLOBAL ${TOP_SRCDIR}/autoconf.h` -ne 0; then
WINE_INI_GLOBAL=`grep WINE_INI_GLOBAL ${TOP_SRCDIR}/autoconf.h | tr ' ' '\n' | tail -1`
echo "$ac_t""${WINE_INI_GLOBAL}" 1>&6
fi
fi
if test -z "${WINE_INI_GLOBAL}"; then
echo "$ac_t""no" 1>&6
fi
if test -z "${WINE_INI_GLOBAL}"; then
echo $ac_n "checking for /usr/local/etc/wine.conf""... $ac_c" 1>&6
if test -f /usr/local/etc/wine.conf; then
echo "$ac_t""yes" 1>&6
......@@ -1616,7 +1604,6 @@ else
echo "$ac_t""no" 1>&6
WINE_INI_GLOBAL="\"${TOP_SRCDIR}/wine.ini\""
fi
fi
cat >> confdefs.h <<EOF
#define WINE_INI_GLOBAL $WINE_INI_GLOBAL
......
......@@ -55,18 +55,6 @@ else
TOP_SRCDIR="${top_srcdir}"
fi
AC_MSG_CHECKING(for wine.ini in autoconf.h)
if test -f ${TOP_SRCDIR}/autoconf.h; then
if test `grep -c WINE_INI_GLOBAL ${TOP_SRCDIR}/autoconf.h` -ne 0; then
WINE_INI_GLOBAL=`grep WINE_INI_GLOBAL ${TOP_SRCDIR}/autoconf.h | tr ' ' '\n' | tail -1`
AC_MSG_RESULT(${WINE_INI_GLOBAL})
fi
fi
if test -z "${WINE_INI_GLOBAL}"; then
AC_MSG_RESULT(no)
fi
if test -z "${WINE_INI_GLOBAL}"; then
AC_MSG_CHECKING(for /usr/local/etc/wine.conf)
if test -f /usr/local/etc/wine.conf; then
AC_MSG_RESULT(yes)
......@@ -75,7 +63,6 @@ else
AC_MSG_RESULT(no)
WINE_INI_GLOBAL="\"${TOP_SRCDIR}/wine.ini\""
fi
fi
AC_SUBST(WINE_INI_GLOBAL)
AC_DEFINE_UNQUOTED(WINE_INI_GLOBAL,$WINE_INI_GLOBAL)
......
......@@ -148,7 +148,7 @@ static LONG CBCreate(HWND hwnd, WORD wParam, LONG lParam)
0, 0, lphc->RectButton.left, lphl->StdItemHeight,
hwnd, (HMENU)1, WIN_GetWindowInstance(hwnd), 0L);
break;
case CBS_DROPDOWNLIST: /* static control, downdown listbox */
case CBS_DROPDOWNLIST: /* static control, dropdown listbox */
dprintf_combo(stddeb,"CBS_DROPDOWNLIST\n");
lphc->RectButton = rect;
lphc->RectButton.left = lphc->RectButton.right - 6 - CBitWidth;
......@@ -299,7 +299,7 @@ static LONG CBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
newFocused = lphl->ItemsCount - 1;
ListBoxSetCurSel(lphl, newFocused);
ListBoxSendNotification(lphl, hwnd, CBN_SELCHANGE);
ListBoxSendNotification(lphl, CBN_SELCHANGE);
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
......@@ -324,7 +324,7 @@ static LONG CBChar(HWND hwnd, WORD wParam, LONG lParam)
newFocused = lphl->ItemsCount - 1;
ListBoxSetCurSel(lphl, newFocused);
ListBoxSendNotification(lphl, hwnd, CBN_SELCHANGE);
ListBoxSendNotification(lphl, CBN_SELCHANGE);
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
......@@ -577,7 +577,7 @@ static LONG CBShowDropDown(HWND hwnd, WORD wParam, LONG lParam)
LPHEADCOMBO lphc = ComboGetStorageHeader(hwnd);
RECT rect;
if (lphc->dwStyle & 3 == CBS_SIMPLE) return LB_ERR;
if ((lphc->dwStyle & 3) == CBS_SIMPLE) return LB_ERR;
wParam = !!wParam;
if (wParam != lphc->DropDownVisible) {
......@@ -708,7 +708,7 @@ static LONG CBLKeyDown( HWND hwnd, WORD wParam, LONG lParam )
newFocused = lphl->ItemsCount - 1;
ListBoxSetCurSel(lphl, newFocused);
ListBoxSendNotification(lphl, hwnd, CBN_SELCHANGE);
ListBoxSendNotification(lphl, CBN_SELCHANGE);
lphl->ItemFocused = newFocused;
ListBoxScrollToFocus(lphl);
......@@ -862,7 +862,7 @@ static LONG CBLLButtonUp( HWND hwnd, WORD wParam, LONG lParam )
else if (lphl->PrevFocused != lphl->ItemFocused)
{
SendMessage(CLBoxGetCombo(hwnd),CB_SETCURSEL,lphl->ItemFocused,0);
ListBoxSendNotification(lphl, CLBoxGetCombo(hwnd), CBN_SELCHANGE);
ListBoxSendNotification(lphl, CBN_SELCHANGE);
}
SendMessage(CLBoxGetCombo(hwnd),CB_SHOWDROPDOWN,0,0);
......
......@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <string.h>
#include <windows.h>
#include "instance.h"
#include "local.h"
#include "win.h"
#include "class.h"
......@@ -106,13 +107,8 @@ static int ButtonCol; /* col in text buffer when button pressed */
static HLOCAL EDIT_HeapAlloc(HWND hwnd, int bytes, WORD flags)
{
HLOCAL ret;
#if defined(WINELIB)
/* temporary fix, until Local memory is correctly implemented in WINELIB */
ret = LocalAlloc( flags, bytes );
#else
ret = LOCAL_Alloc( WIN_GetWindowInstance(hwnd), flags, bytes );
#endif
if (!ret)
printf("EDIT_HeapAlloc: Out of heap-memory\n");
return ret;
......@@ -126,11 +122,11 @@ static HLOCAL EDIT_HeapAlloc(HWND hwnd, int bytes, WORD flags)
static void *EDIT_HeapLock(HWND hwnd, HANDLE handle)
{
HINSTANCE hinstance = WIN_GetWindowInstance( hwnd );
HANDLE offs;
#if defined(WINELIB)
return handle;
return LOCAL_Lock( hinstance, handle );
#else
HANDLE offs;
if (handle == 0) return 0;
offs = LOCAL_Lock( hinstance, handle );
return PTR_SEG_OFF_TO_LIN( hinstance, offs );
......@@ -142,12 +138,8 @@ static void *EDIT_HeapLock(HWND hwnd, HANDLE handle)
*/
static void EDIT_HeapUnlock(HWND hwnd, HANDLE handle)
{
#if defined(WINELIB)
return 0;
#else
if (handle == 0) return;
LOCAL_Unlock( WIN_GetWindowInstance( hwnd ), handle );
#endif
}
/*********************************************************************
......@@ -157,12 +149,8 @@ static void EDIT_HeapUnlock(HWND hwnd, HANDLE handle)
*/
static HLOCAL EDIT_HeapReAlloc(HWND hwnd, HANDLE handle, int bytes)
{
#if defined(WINELIB)
return LocalReAlloc( handle, bytes, LMEM_FIXED );
#else
return LOCAL_ReAlloc( WIN_GetWindowInstance(hwnd), handle, bytes,
LMEM_FIXED );
#endif
}
......@@ -173,11 +161,7 @@ static HLOCAL EDIT_HeapReAlloc(HWND hwnd, HANDLE handle, int bytes)
*/
static void EDIT_HeapFree(HWND hwnd, HANDLE handle)
{
#if defined(WINELIB)
LocalFree( handle );
#else
LOCAL_Free( WIN_GetWindowInstance(hwnd), handle );
#endif
}
......@@ -188,11 +172,7 @@ static void EDIT_HeapFree(HWND hwnd, HANDLE handle)
*/
static unsigned int EDIT_HeapSize(HWND hwnd, HANDLE handle)
{
#if defined(WINELIB)
return LocalSize( handle );
#else
return LOCAL_Size( WIN_GetWindowInstance(hwnd), handle );
#endif
}
/********************************************************************
......@@ -264,7 +244,7 @@ static void EDIT_ClearTextPointers(HWND hwnd)
{
EDITSTATE *es = EDIT_GetEditState(hwnd);
dprintf_edit( stddeb, "EDIT_ClerTextPointers\n" );
dprintf_edit( stddeb, "EDIT_ClearTextPointers\n" );
es->textptrs = xrealloc(es->textptrs, sizeof(int));
es->textptrs[0] = 0;
}
......@@ -1315,11 +1295,11 @@ static void EDIT_ClearText(HWND hwnd)
char *text;
dprintf_edit(stddeb,"EDIT_ClearText %d\n",blen);
#ifndef WINELIB
/*#ifndef WINELIB*/
es->hText = EDIT_HeapReAlloc(hwnd, es->hText, blen);
text = EDIT_HeapLock(hwnd, es->hText);
memset(text, 0, blen);
#endif
/*#endif*/
es->textlen = 0;
es->wlines = 0;
es->CurrLine = es->CurrCol = 0;
......@@ -1327,9 +1307,9 @@ static void EDIT_ClearText(HWND hwnd)
es->wleft = es->wtop = 0;
es->textwidth = 0;
es->TextChanged = FALSE;
#ifndef WINELIB
/*#ifndef WINELIB*/
EDIT_ClearTextPointers(hwnd);
#endif
/*#endif*/
}
/*********************************************************************
......@@ -2230,6 +2210,13 @@ static void EDIT_WM_Paint(HWND hwnd)
EndPaint(hwnd, &ps);
}
static BOOL LOCAL_HeapExists(WORD ds)
{
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 );
if (!ptr->heap) return 0;
return 1;
}
/*********************************************************************
* WM_NCCREATE
*/
......@@ -2238,11 +2225,11 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
CREATESTRUCT *createStruct = (CREATESTRUCT *)PTR_SEG_TO_LIN(lParam);
WND *wndPtr = WIN_FindWndPtr(hwnd);
EDITSTATE *es;
char *text;
char *text = NULL;
HANDLE ds;
/* store pointer to local or global heap in window structure so that */
/* EDITSTATE structure itself can be stored on local heap */
/* allocate space for state variable structure */
es = xmalloc( sizeof(EDITSTATE) );
SetWindowLong( hwnd, 0, (LONG)es );
......@@ -2251,6 +2238,33 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
es->ClientWidth = es->ClientHeight = 1;
/* --- text buffer */
es->MaxTextLen = MAXTEXTLEN + 1;
/*
* Hack - If there is no local heap then hwnd should be a globalHeap block
* and the local heap needs to be initilised to the same size(minus something)
* as the global block
*/
ds = WIN_GetWindowInstance(hwnd);
if (!LOCAL_HeapExists(ds))
{
DWORD globalSize;
globalSize = GlobalSize(ds);
printf("No local heap allocated global size is %d 0x%x\n",globalSize, globalSize);
/*
* I assume the local heap should start at 0
*/
LocalInit(ds, 0, globalSize);
/*
* Apparantly we should do an UnlockSegment here but i think this
* is because LocalInit is supposed to do a LockSegment. Since
* Local Init doesn't do this then it doesn't seem like a good idea to do the
* UnlockSegment here yet!
* UnlockSegment(hwnd);
*/
}
if (!(createStruct->lpszName))
{
dprintf_edit( stddeb, "EDIT_WM_NCCREATE: lpszName == 0\n" );
......@@ -2268,16 +2282,23 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
{
char *windowName = (char *)PTR_SEG_TO_LIN( createStruct->lpszName );
dprintf_edit( stddeb, "EDIT_WM_NCCREATE: lpszName != 0\n" );
if (strlen(windowName) < EditBufStartLen(hwnd))
{
es->textlen = EditBufStartLen(hwnd) + 3;
es->hText = EDIT_HeapAlloc(hwnd, es->textlen + 2, LMEM_MOVEABLE);
text = EDIT_HeapLock(hwnd, es->hText);
strcpy(text, windowName);
if(IsMultiLine(hwnd)) {
strcat(text, "\r\n");
}
*(text + es->textlen) = '\0';
if (es->hText)
{
text = EDIT_HeapLock(hwnd, es->hText);
if (text)
{
strcpy(text, windowName);
if(IsMultiLine(hwnd)) {
strcat(text, "\r\n");
}
*(text + es->textlen) = '\0';
}
}
}
else
{
......@@ -2288,8 +2309,11 @@ static long EDIT_WM_NCCreate(HWND hwnd, LONG lParam)
if(IsMultiLine(hwnd)) strcat(text, "\r\n");
*(text + es->textlen) = '\0';
}
*(text + es->textlen + 1) = '\0';
EDIT_BuildTextPointers(hwnd);
if (text)
{
*(text + es->textlen + 1) = '\0';
EDIT_BuildTextPointers(hwnd);
}
}
/* ES_AUTOVSCROLL and ES_AUTOHSCROLL are automatically applied if */
......
......@@ -302,7 +302,7 @@ static void MENU_CalcItemSize( HDC hdc, LPMENUITEM lpitem, HWND hwndOwner,
lpitem->rect.bottom += MAX( HIWORD(dwSize), SYSMETRICS_CYMENU );
if (menuBar) lpitem->rect.right += MENU_BAR_ITEMS_SPACE;
else if ((p = strchr( lpitem->item_text, '\t' )) != NULL)
else if ( ( lpitem->item_text != NULL ) && (p = strchr( lpitem->item_text, '\t' )) != NULL)
{
/* Item contains a tab (only meaningful in popup menus) */
lpitem->xTab = check_bitmap_width + MENU_TAB_SPACE +
......@@ -312,7 +312,7 @@ static void MENU_CalcItemSize( HDC hdc, LPMENUITEM lpitem, HWND hwndOwner,
}
else
{
if (strchr( lpitem->item_text, '\b' ))
if( ( lpitem->item_text != NULL ) && strchr( lpitem->item_text, '\b' ))
lpitem->rect.right += MENU_TAB_SPACE;
lpitem->xTab = lpitem->rect.right - check_bitmap_width
- arrow_bitmap_width;
......
......@@ -35,7 +35,7 @@ int yyerror(char *);
%token CONT STEP LIST NEXT QUIT HELP BACKTRACE INFO STACK SEGMENTS REGS
%token ENABLE DISABLE BREAK DELETE SET MODE PRINT EXAM DEFINE ABORT
%token NO_SYMBOL
%token NO_SYMBOL EOL
%token SYMBOLFILE
%token <string> IDENTIFIER
......@@ -68,55 +68,55 @@ int yyerror(char *);
input: line { issue_prompt(); }
| input line { issue_prompt(); }
line: command '\n'
| '\n'
| error '\n' { yyerrok; }
command: QUIT { exit(0); }
| HELP { DEBUG_Help(); }
| CONT { dbg_exec_mode = EXEC_CONT; return 0; }
| STEP { dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| NEXT { dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| LIST { DEBUG_List( NULL, 15 ); }
| LIST addr { DEBUG_List( &$2, 15 ); }
| ABORT { kill(getpid(), SIGABRT); }
| SYMBOLFILE IDENTIFIER { DEBUG_ReadSymbolTable( $2 ); }
| DEFINE IDENTIFIER addr { DEBUG_AddSymbol( $2, &$3 ); }
| MODE NUM { mode_command($2); }
| ENABLE NUM { DEBUG_EnableBreakpoint( $2, TRUE ); }
| DISABLE NUM { DEBUG_EnableBreakpoint( $2, FALSE ); }
| BREAK '*' addr { DEBUG_AddBreakpoint( &$3 ); }
| BREAK symbol { DEBUG_AddBreakpoint( &$2 ); }
| BREAK { DBG_ADDR addr = { CS_reg(DEBUG_context),
line: command
| EOL
| error EOL { yyerrok; }
command: QUIT EOL { exit(0); }
| HELP EOL { DEBUG_Help(); }
| CONT EOL { dbg_exec_mode = EXEC_CONT; return 0; }
| STEP EOL { dbg_exec_mode = EXEC_STEP_INSTR; return 0; }
| NEXT EOL { dbg_exec_mode = EXEC_STEP_OVER; return 0; }
| LIST EOL { DEBUG_List( NULL, 15 ); }
| LIST addr EOL { DEBUG_List( &$2, 15 ); }
| ABORT EOL { kill(getpid(), SIGABRT); }
| SYMBOLFILE IDENTIFIER EOL { DEBUG_ReadSymbolTable( $2 ); }
| DEFINE IDENTIFIER addr EOL { DEBUG_AddSymbol( $2, &$3 ); }
| MODE NUM EOL { mode_command($2); }
| ENABLE NUM EOL { DEBUG_EnableBreakpoint( $2, TRUE ); }
| DISABLE NUM EOL { DEBUG_EnableBreakpoint( $2, FALSE ); }
| BREAK '*' addr EOL { DEBUG_AddBreakpoint( &$3 ); }
| BREAK symbol EOL { DEBUG_AddBreakpoint( &$2 ); }
| BREAK EOL { DBG_ADDR addr = { CS_reg(DEBUG_context),
EIP_reg(DEBUG_context) };
DEBUG_AddBreakpoint( &addr );
}
| DELETE BREAK NUM { DEBUG_DelBreakpoint( $3 ); }
| BACKTRACE { DEBUG_BackTrace(); }
| DELETE BREAK NUM EOL { DEBUG_DelBreakpoint( $3 ); }
| BACKTRACE EOL { DEBUG_BackTrace(); }
| infocmd
| x_command
| print_command
| deposit_command
deposit_command:
SET REG '=' expr { DEBUG_SetRegister( $2, $4 ); }
| SET '*' addr '=' expr { DEBUG_WriteMemory( &$3, $5 ); }
| SET IDENTIFIER '=' addr { if (!DEBUG_SetSymbolValue( $2, &$4 ))
{
fprintf( stderr,
SET REG '=' expr EOL { DEBUG_SetRegister( $2, $4 ); }
| SET '*' addr '=' expr EOL { DEBUG_WriteMemory( &$3, $5 ); }
| SET IDENTIFIER '=' addr EOL { if (!DEBUG_SetSymbolValue( $2, &$4 ))
{
fprintf( stderr,
"Symbol %s not found\n", $2 );
YYERROR;
YYERROR;
}
}
}
x_command:
EXAM addr { DEBUG_ExamineMemory( &$2, 1, 'x'); }
| EXAM FORMAT addr { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff ); }
EXAM addr EOL { DEBUG_ExamineMemory( &$2, 1, 'x'); }
| EXAM FORMAT addr EOL { DEBUG_ExamineMemory( &$3, $2>>8, $2&0xff ); }
print_command:
PRINT addr { DEBUG_Print( &$2, 1, 'x' ); }
| PRINT FORMAT addr { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff ); }
PRINT addr EOL { DEBUG_Print( &$2, 1, 'x' ); }
| PRINT FORMAT addr EOL { DEBUG_Print( &$3, $2 >> 8, $2 & 0xff ); }
symbol: IDENTIFIER { if (!DEBUG_GetSymbolValue( $1, &$$ ))
{
......@@ -175,11 +175,11 @@ x_command:
$$ = DEBUG_ReadMemory( &addr ); }
| '*' segaddr %prec OP_DEREF { $$ = DEBUG_ReadMemory( &$2 ); }
infocmd: INFO REGS { DEBUG_InfoRegisters(); }
| INFO STACK { DEBUG_InfoStack(); }
| INFO BREAK { DEBUG_InfoBreakpoints(); }
| INFO SEGMENTS { LDT_Print( 0, -1 ); }
| INFO SEGMENTS expr { LDT_Print( SELECTOR_TO_ENTRY($3), 1 ); }
infocmd: INFO REGS EOL { DEBUG_InfoRegisters(); }
| INFO STACK EOL { DEBUG_InfoStack(); }
| INFO BREAK EOL { DEBUG_InfoBreakpoints(); }
| INFO SEGMENTS EOL { LDT_Print( 0, -1 ); }
| INFO SEGMENTS expr EOL { LDT_Print( SELECTOR_TO_ENTRY($3), 1 ); }
%%
......
......@@ -34,7 +34,7 @@ IDENTIFIER [_a-zA-Z\.~][_a-zA-Z0-9\.~]*
%%
\n { syntax_error = 0; return '\n'; } /*Indicates end of command*/
\n { syntax_error = 0; return EOL; } /*Indicates end of command*/
"||" { return OP_LOR; }
"&&" { return OP_LAND; }
......@@ -82,7 +82,7 @@ $ss { yylval.reg = REG_SS; return REG; }
info|inf|in { return INFO; }
show|sho|sh { return INFO; }
list|l { return LIST; }
list|lis|li|l { return LIST; }
segments|segment|segm|seg|se { return SEGMENTS; }
break|brea|bre|br|b { return BREAK; }
enable|enabl|enab|ena { return ENABLE;}
......
......@@ -68,7 +68,7 @@ base 1
0064 stub GetSidSubAuthority
0065 stub GetSidSubAuthorityCount
0066 stub GetTokenInformation
0067 stub GetUserNameA
0067 stdcall GetUserNameA(ptr ptr) GetUserNameA
0068 stub GetUserNameW
0069 stub ImpersonateLoggedOnUser
0070 stub ImpersonateNamedPipeClient
......
......@@ -246,8 +246,8 @@ id 3
364 pascal16 SetPaletteEntries(word word word ptr) SetPaletteEntries
365 pascal16 RealizeDefaultPalette(word) RealizeDefaultPalette
366 stub UpdateColors
367 stub AnimatePalette
368 stub ResizePalette
367 pascal16 AnimatePalette(word word word ptr) AnimatePalette
368 pascal16 ResizePalette(word word) ResizePalette
370 pascal16 GetNearestPaletteIndex(word long) GetNearestPaletteIndex
372 pascal16 ExtFloodFill(word s_word s_word long word) ExtFloodFill
373 pascal16 SetSystemPaletteUse(word word) SetSystemPaletteUse
......
......@@ -114,8 +114,8 @@ id 1
115 pascal OutputDebugString(ptr) OutputDebugString
116 stub InitLib
117 pascal16 OldYield() OldYield
118 stub GetTaskQueueDS
119 stub GetTaskQueueES
118 register GetTaskQueueDS() GetTaskQueueDS
119 register GetTaskQueueES() GetTaskQueueES
120 stub UndefDynLink
121 pascal16 LocalShrink(word word) LocalShrink
122 pascal16 IsTaskLocked() IsTaskLocked
......@@ -164,7 +164,7 @@ id 1
164 pascal16 GlobalLRUNewest(word) GlobalLRUNewest
165 stub A20Proc
166 pascal16 WinExec(ptr word) WinExec
167 stub GetExpWinVer
167 pascal16 GetExpWinVer(word) GetExpWinVer
168 pascal16 DirectResAlloc(word word word) DirectResAlloc
169 pascal GetFreeSpace(word) GetFreeSpace
170 pascal16 AllocCStoDSAlias(word) AllocCStoDSAlias
......
......@@ -24,7 +24,7 @@ base 1
0020 stub ClearCommBreak
0021 stub ClearCommError
0022 stub CloseConsoleHandle
0023 stub CloseHandle
0023 stdcall CloseHandle(long) CloseHandle
0024 stub CloseProfileUserMapping
0025 stub CmdBatNotification
0026 stub CommConfigDialogA
......@@ -46,7 +46,7 @@ base 1
0042 stub CreateDirectoryW
0043 stub CreateEventA
0044 stub CreateEventW
0045 stub CreateFileA
0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFileA
0046 stub CreateFileMappingA
0047 stub CreateFileMappingW
0048 stub CreateFileW
......@@ -101,7 +101,7 @@ base 1
0097 stub EnumTimeFormatsW
0098 stub EraseTape
0099 stub EscapeCommFunction
0100 stub ExitProcess
0100 stdcall ExitProcess(long) ExitProcess
0101 stub ExitThread
0102 stub ExitVDM
0103 stub ExpandEnvironmentStringsA
......@@ -200,7 +200,7 @@ base 1
0196 stub GetCurrentDirectoryA
0197 stub GetCurrentDirectoryW
0198 stub GetCurrentProcess
0199 stub GetCurrentProcessId
0199 stdcall GetCurrentProcessId() GetCurrentThreadId
0200 stub GetCurrentThread
0201 stdcall GetCurrentThreadId() GetCurrentThreadId
0202 stub GetDateFormatA
......@@ -220,7 +220,7 @@ base 1
0216 stub GetExitCodeThread
0217 stub GetFileAttributesA
0218 stub GetFileAttributesW
0219 stub GetFileInformationByHandle
0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle
0220 stub GetFileSize
0221 stub GetFileTime
0222 stdcall GetFileType(long) GetFileType
......@@ -238,7 +238,7 @@ base 1
0234 stub GetMailslotInfo
0235 stdcall GetModuleFileNameA(long ptr long) GetModuleFileNameA
0236 stub GetModuleFileNameW
0237 stdcall GetModuleHandleA(ptr) GetModuleHandle
0237 stdcall GetModuleHandleA(ptr) WIN32_GetModuleHandle
0238 stub GetModuleHandleW
0239 stub GetNamedPipeHandleStateA
0240 stub GetNamedPipeHandleStateW
......@@ -265,7 +265,7 @@ base 1
0261 stub GetProcessShutdownParameters
0262 stub GetProcessTimes
0263 stub GetProcessWorkingSetSize
0264 stub GetProfileIntA
0264 stdcall GetProfileIntA(ptr ptr long) GetProfileInt
0265 stub GetProfileIntW
0266 stub GetProfileSectionA
0267 stub GetProfileSectionW
......@@ -394,7 +394,7 @@ base 1
0389 stub MoveFileExW
0390 stub MoveFileW
0391 stub MulDiv
0392 stub MultiByteToWideChar
0392 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar
0393 stub OpenConsoleW
0394 stub OpenEventA
0395 stub OpenEventW
......@@ -430,7 +430,7 @@ base 1
0425 stub ReadConsoleOutputCharacterW
0426 stub ReadConsoleOutputW
0427 stub ReadConsoleW
0428 stub ReadFile
0428 stdcall ReadFile(long ptr long ptr ptr) ReadFile
0429 stub ReadFileEx
0430 stub ReadProcessMemory
0431 stub RegisterConsoleVDM
......@@ -461,7 +461,7 @@ base 1
0456 stub SetConsoleActiveScreenBuffer
0457 stub SetConsoleCP
0458 stub SetConsoleCommandHistoryMode
0459 stub SetConsoleCtrlHandler
0459 stdcall SetConsoleCtrlHandler(ptr long) SetConsoleCtrlHandler
0460 stub SetConsoleCursor
0461 stub SetConsoleCursorInfo
0462 stub SetConsoleCursorPosition
......@@ -610,11 +610,11 @@ base 1
0605 stub lstrcmpiA
0606 stub lstrcmpiW
0607 stub lstrcpy
0608 stub lstrcpyA
0608 stdcall lstrcpyA(ptr ptr) strcpy
0609 stub lstrcpyW
0610 stub lstrcpyn
0611 stub lstrcpynA
0612 stub lstrcpynW
0613 stub lstrlen
0614 stub lstrlenA
0614 stdcall lstrlenA(ptr) strlen
0615 stub lstrlenW
......@@ -405,13 +405,13 @@ id 2
456 pascal16 LoadIconHandler(word word) LoadIconHandler
457 pascal16 DestroyIcon(word) DestroyIcon
458 pascal16 DestroyCursor(word) DestroyCursor
459 pascal DumpIcon(ptr ptr ptr ptr) DumpIcon
459 pascal DumpIcon(segptr ptr ptr ptr) DumpIcon
460 pascal16 GetInternalWindowPos(word ptr ptr) GetInternalWindowPos
461 pascal16 SetInternalWindowPos(word word ptr ptr) SetInternalWindowPos
462 pascal16 CalcChildScroll(word word) CalcChildScroll
463 stub ScrollChildren
464 pascal16 DragObject(word word word word word word) DragObject
465 stub DragDetect
464 pascal DragObject(word word word word word word) DragObject
465 pascal16 DragDetect(word long) DragDetect
466 pascal16 DrawFocusRect(word ptr) DrawFocusRect
470 stub StringFunc
471 pascal16 lstrcmpi(ptr ptr) lstrcmpi
......
......@@ -199,7 +199,7 @@ base 1
0194 stub ExcludeUpdateRgn
0195 stub ExitWindowsEx
0196 stub FillRect
0197 stub FindWindowA
0197 return FindWindowA 8 0
0198 stub FindWindowExA
0199 stub FindWindowExW
0200 stub FindWindowW
......@@ -290,7 +290,7 @@ base 1
0285 stub GetScrollRange
0286 stub GetShellWindow
0287 stub GetSubMenu
0288 stub GetSysColor
0288 stdcall GetSysColor(long) GetSysColor
0289 stub GetSysColorBrush
0290 stub GetSystemMenu
0291 stub GetSystemMetrics
......@@ -356,15 +356,15 @@ base 1
0351 stub IsZoomed
0352 stub KillSystemTimer
0353 stub KillTimer
0354 stub LoadAcceleratorsA
0354 stdcall LoadAcceleratorsA(long ptr) LoadAccelerators
0355 stub LoadAcceleratorsW
0356 stub LoadBitmapA
0356 stdcall LoadBitmapA(long ptr) LoadBitmap
0357 stub LoadBitmapW
0358 stub LoadCursorA
0358 stdcall LoadCursorA(long ptr) LoadCursor
0359 stub LoadCursorFromFileA
0360 stub LoadCursorFromFileW
0361 stub LoadCursorW
0362 stub LoadIconA
0362 stdcall LoadIconA(long ptr) LoadIcon
0363 stub LoadIconW
0364 stub LoadImageA
0365 stub LoadImageW
......@@ -376,7 +376,7 @@ base 1
0371 stub LoadMenuIndirectW
0372 stub LoadMenuW
0373 stub LoadRemoteFonts
0374 stub LoadStringA
0374 stdcall LoadStringA(long long ptr long) LoadString
0375 stub LoadStringW
0376 stub LockWindowStation
0377 stub LockWindowUpdate
......@@ -473,7 +473,7 @@ base 1
0468 stub SetClassWord
0469 stub SetClipboardData
0470 stub SetClipboardViewer
0471 stub SetCursor
0471 stdcall SetCursor(long) SetCursor
0472 stub SetCursorContents
0473 stub SetCursorPos
0474 stub SetDebugErrorLevel
......@@ -495,7 +495,7 @@ base 1
0490 stub SetMenuItemInfoA
0491 stub SetMenuItemInfoW
0492 stub SetMessageExtraInfo
0493 stub SetMessageQueue
0493 stdcall SetMessageQueue(long) SetMessageQueue
0494 stub SetParent
0495 stub SetProcessWindowStation
0496 stub SetPropA
......@@ -541,7 +541,7 @@ base 1
0536 stub SwapMouseButton
0537 stub SwitchDesktop
0538 stub SwitchToThisWindow
0539 stub SystemParametersInfoA
0539 stdcall SystemParametersInfoA(long long ptr long) SystemParametersInfo
0540 stub SystemParametersInfoW
0541 stub TabbedTextOutA
0542 stub TabbedTextOutW
......@@ -586,7 +586,7 @@ base 1
0581 stub WindowFromPoint
0582 stub keybd_event
0583 stub mouse_event
0584 stub wsprintfA
0584 cdecl wsprintfA(ptr ptr ...) wsprintf
0585 stub wsprintfW
0586 stub wvsprintfA
0587 stub wvsprintfW
/* XPM */
static char * ocr_bummer[] = {
"32 32 3 1 5 9",
" s black c black",
"X s white c white",
". s None c None",
"............ .............",
"........... XXXXXXX ............",
"......... XXXXXXXXX ...........",
"........ XXXXXXXXXXXXX .........",
"....... XX XXXXXXX XX ........",
"....... X .. XXXXX .. X ........",
"....... X ... XXX ... X ........",
"....... X ... XXX ... X ........",
"...... XX ... XXX ... XX .......",
"...... XXX XXXXX XXX .......",
"...... XXXXXXXX XXXXXXXX .......",
"...... XXXXXXX . XXXXXXX .......",
". .... XXXXXX . XXXXXX ... ...",
" XX .... XXXX . XXXX ... XX ..",
". XX .... XX XX .... X ...",
" XXXXX .. XXXXXXX .. XXXX ..",
" XX XXX XXXXXXX XXX XX ..",
". ... XXX X XXX .. ...",
"......... XXX ..........",
".......... XXXX ..........",
"...... XXXX XXX .......",
". XXX ...... XXX ...",
" XXXXX ............. XXXX ..",
" XX ................... XX ..",
". X ...................... X ...",
". X ...................... X ...",
".. ........................ ....",
"................................",
"................................",
"................................",
"................................",
"................................"};
/* XPM */
static char * ocr_dragobject[] = {
"32 32 3 1 5 9",
" s black c black",
". s None c None",
"X s white c white",
" .......................",
" XXXXXXX .....................",
" XXXXXXX X ....................",
" XXXXXXX ....................",
" XXXXXXXXXX ....................",
" XXXXXXXXXX ....................",
" XXXXXXXXXX ....................",
" XXXXXXXXXX ....................",
" XXXXXXXXXX ....................",
" XXXX XXXXX ....................",
" XXXX XXXX ....................",
" XXXX X XXX ....................",
" XXXX XX XX ....................",
" XXXX XXX X ....................",
" XXXX .....................",
"..... XXXXX ....................",
"..... XXXXXX ...................",
"..... XXXXXXX ..................",
"..... XXXXXXXX .................",
"..... XXXXX ................",
"..... XX X ....................",
"..... X . XX ...................",
"..... ... X ...................",
"..... .... XX ..................",
"........... X ..................",
"........... XX .................",
"............ X .................",
"............. ..................",
"................................",
"................................",
"................................",
"................................"};
#ifndef __WINE_HANDLE32_H
#define __WINE_HANDLE32_H
#include <malloc.h>
/* The _*_OBJECT structures contain information needed about each
* particular type of handle. This information is a combination of
* equivalent UNIX-style handles/descriptors and general information
* that the Win32 API might request.
*
* The KERNEL_OBJECT structure must be the first member of any specific
* kernel object type's structure.
*/
typedef struct {
unsigned long magic;
} KERNEL_OBJECT, *HANDLE32;
typedef struct {
KERNEL_OBJECT common;
unsigned long thread_id;
unsigned long process_id;
} THREAD_OBJECT;
typedef struct {
KERNEL_OBJECT common;
unsigned long process_id;
unsigned long main_thread_id;
} PROCESS_OBJECT;
/* The FILE object includes things like disk files, pipes, and
* character devices (com ports, consoles, ...).
*/
typedef struct {
KERNEL_OBJECT common;
int fd; /* UNIX fd */
int type; /* FILE_TYPE_* */
unsigned long misc_flags; /* special flags */
unsigned long access_flags; /* UNIX access flags */
unsigned long create_flags; /* UNIX creation flags */
} FILE_OBJECT;
typedef struct {
KERNEL_OBJECT common;
} SEMAPHORE_OBJECT;
typedef struct {
KERNEL_OBJECT common;
} EVENT_OBJECT;
/* Should this even be here?
*/
typedef struct {
KERNEL_OBJECT common;
} REGKEY_OBJECT;
/* Object number definitions. These numbers are used to
* validate the kernel object by comparison against the
* object's 'magic' value.
*/
#define KERNEL_OBJECT_UNUSED 2404554046UL
#define KERNEL_OBJECT_THREAD (KERNEL_OBJECT_UNUSED + 1)
#define KERNEL_OBJECT_PROCESS (KERNEL_OBJECT_UNUSED + 2)
#define KERNEL_OBJECT_FILE (KERNEL_OBJECT_UNUSED + 3)
#define KERNEL_OBJECT_SEMAPHORE (KERNEL_OBJECT_UNUSED + 4)
#define KERNEL_OBJECT_EVENT (KERNEL_OBJECT_UNUSED + 5)
#define KERNEL_OBJECT_REGKEY (KERNEL_OBJECT_UNUSED + 6)
/* Define the invalid handle value
*/
#define INVALID_HANDLE_VALUE ((HANDLE32)-1)
/* Functions for checking kernel objects.
*/
int ValidateKernelObject(KERNEL_OBJECT *ptr);
/* For now, CreateKernelObject and ReleaseKernelObject will
* simply map to malloc() and free().
*/
#define CreateKernelObject(size) (malloc(size))
#define ReleaseKernelObject(ptr) (free(ptr))
/* Prototypes for the Close*Handle functions
*/
int CloseFileHandle(FILE_OBJECT *hFile);
#endif /* __WINE_HANDLE32_H */
......@@ -11,31 +11,28 @@
#include "ldt.h"
#include "callback.h"
#ifndef WINELIB
#pragma pack(1)
#endif
/* Hook data (pointed to by a HHOOK) */
typedef struct
{
HHOOK next; /* Next hook in chain */
HOOKPROC proc; /* Hook procedure */
short id; /* Hook id (WH_xxx) */
HTASK htask; /* Task owning this hook */
HANDLE next; /* 00 Next hook in chain */
HOOKPROC proc WINE_PACKED; /* 02 Hook procedure */
short id; /* 06 Hook id (WH_xxx) */
HQUEUE ownerQueue; /* 08 Owner queue (0 for system hook) */
HMODULE ownerModule; /* 0a Owner module */
WORD inHookProc; /* 0c TRUE if in this->proc */
} HOOKDATA;
#ifndef WINELIB
#pragma pack(4)
#endif
#define FIRST_HOOK WH_MSGFILTER
#define LAST_HOOK WH_SHELL
#define SYSTEM_HOOK(id) (systemHooks[(id)-FIRST_HOOK])
#define TASK_HOOK(id) (taskHooks[(id)-FIRST_HOOK])
#define INTERNAL_CALL_HOOK(hhook,code,wparam,lparam) \
((hhook) ? CallHookProc(((HOOKDATA*)PTR_SEG_TO_LIN(hhook))->proc,\
code, wparam, lparam) : 0)
#define CALL_SYSTEM_HOOK(id,code,wparam,lparam) \
INTERNAL_CALL_HOOK(SYSTEM_HOOK(id),code,wparam,lparam)
#define CALL_TASK_HOOK(id,code,wparam,lparam) \
INTERNAL_CALL_HOOK(TASK_HOOK(id),code,wparam,lparam)
#define HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */
extern HHOOK systemHooks[];
extern HHOOK taskHooks[];
extern DWORD HOOK_CallHooks( short id, short code,
WPARAM wParam, LPARAM lParam );
#endif /* HOOK_H */
......@@ -2,6 +2,9 @@
*
* Win32 functions, structures, and types related to kernel functions
*/
#ifndef __WINE_KERNEL32_H
#define __WINE_KERNEL32_H
#include <stddef.h>
int KERN32_Init(void);
......@@ -78,3 +81,54 @@ typedef struct {
#define TIME_ZONE_ID_STANDARD 1
#define TIME_ZONE_ID_DAYLIGHT 2
/* File object type definitions
*/
#define FILE_TYPE_UNKNOWN 0
#define FILE_TYPE_DISK 1
#define FILE_TYPE_CHAR 2
#define FILE_TYPE_PIPE 3
#define FILE_TYPE_REMOTE 32768
/* File creation flags
*/
#define GENERIC_READ 0x80000000L
#define GENERIC_WRITE 0x40000000L
#define CREATE_NEW 1
#define CREATE_ALWAYS 2
#define OPEN_EXISTING 3
#define OPEN_ALWAYS 4
#define TRUNCATE_EXISTING 5
/* Standard handle identifiers
*/
#define STD_INPUT_HANDLE ((DWORD) -10)
#define STD_OUTPUT_HANDLE ((DWORD) -11)
#define STD_ERROR_HANDLE ((DWORD) -12)
/* The security attributes structure (not filled in yet)
*/
typedef struct {
void *junk;
} SECURITY_ATTRIBUTES, *LPSECURITY_ATTRIBUTES;
typedef struct
{
int dwLowDateTime;
int dwHighDateTime;
} FILETIME;
typedef struct
{
int dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
int dwVolumeSerialNumber;
int nFileSizeHigh;
int nFileSizeLow;
int nNumberOfLinks;
int nFileIndexHigh;
int nFileIndexLow;
} BY_HANDLE_FILE_INFORMATION ;
#endif /* __WINE_KERNEL32_H */
/*
* WINElib-Resources
*/
#ifndef __WINE_LIBRES_H
#define __WINE_LIBRES_H
#include "windows.h"
#ifdef WINELIB
HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type );
HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc );
LPSTR LIBRES_LockResource( HMODULE hModule, HGLOBAL handle );
BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle );
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc );
DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc );
HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size );
#endif
#endif
......@@ -24,7 +24,7 @@ typedef struct {
WORD DrawCtlType;
WORD CtlID;
LPLISTSTRUCT lpFirst;
DWORD dwStyle;
HWND hSelf;
HWND hParent;
HFONT hFont;
BOOL bRedrawFlag;
......@@ -34,6 +34,7 @@ typedef struct {
LPINT TabStops;
HANDLE hDrawItemStruct;
BOOL needMeasure;
WORD HeapSel;
/* MDESC *Heap; */
} HEADLIST,*LPHEADLIST;
......@@ -41,7 +42,7 @@ typedef struct {
extern void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent);
extern void DestroyListBoxStruct(LPHEADLIST lphl);
extern void ListBoxSendNotification(LPHEADLIST lphl,HWND hwnd, WORD code);
extern void ListBoxSendNotification(LPHEADLIST lphl, WORD code);
extern LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex);
extern int ListMaxFirstVisible(LPHEADLIST lphl);
......
......@@ -9,6 +9,10 @@
#include "windows.h"
#ifndef WINELIB
#pragma pack(1)
#endif
/* Message as stored in the queue (contains the extraInfo field) */
typedef struct tagQMSG
{
......@@ -19,30 +23,45 @@ typedef struct tagQMSG
typedef struct tagMESSAGEQUEUE
{
WORD next;
HTASK hTask; /* hTask owning the queue */
WORD msgSize; /* Size of messages in the queue */
WORD msgCount; /* Number of waiting messages */
WORD nextMessage; /* Next message to be retrieved */
WORD nextFreeMessage; /* Next available slot in the queue */
WORD queueSize; /* Size of the queue */
DWORD GetMessageTimeVal; /* Value returned by GetMessageTime */
DWORD GetMessagePosVal; /* Value returned by GetMessagePos */
DWORD GetMessageExtraInfoVal; /* Value returned by GetMessageExtraInfo */
LPARAM lParam; /* Next four values set by SendMessage */
WPARAM wParam;
UINT msg;
HWND hWnd;
WORD wPostQMsg; /* PostQuitMessage flag */
WORD wExitCode; /* PostQuitMessage exit code */
WORD InSendMessageHandle; /* Handle of task that sent a message */
WORD wPaintCount; /* Number of WM_PAINT needed */
WORD wTimerCount; /* Number of timers for this application */
WORD tempStatus; /* State reset by GetQueueStatus */
WORD status; /* Queue state */
QMSG messages[1]; /* Queue messages */
WORD next; /* 00 Next queue */
HTASK hTask; /* 02 hTask owning the queue */
WORD msgSize; /* 04 Size of messages in the queue */
WORD msgCount; /* 06 Number of waiting messages */
WORD nextMessage; /* 08 Next message to be retrieved */
WORD nextFreeMessage; /* 0a Next available slot in the queue */
WORD queueSize; /* 0c Size of the queue */
DWORD GetMessageTimeVal WINE_PACKED; /* 0e Value for GetMessageTime */
DWORD GetMessagePosVal WINE_PACKED; /* 12 Value for GetMessagePos */
WORD reserved1; /* 16 Unknown */
DWORD GetMessageExtraInfoVal; /* 18 Value for GetMessageExtraInfo */
WORD reserved2; /* 1c Unknown */
LPARAM lParam WINE_PACKED; /* 1e Next 4 values set by SendMessage */
WPARAM wParam; /* 22 */
UINT msg; /* 24 */
HWND hWnd; /* 26 */
DWORD SendMessageReturn; /* 28 Return value for SendMessage */
WORD wPostQMsg; /* 2c PostQuitMessage flag */
WORD wExitCode; /* 2e PostQuitMessage exit code */
WORD reserved3[3]; /* 30 Unknown */
WORD wWinVersion; /* 36 Expected Windows version */
HQUEUE InSendMessageHandle; /* 38 Queue of task that sent a message */
HTASK hSendingTask; /* 3a Handle of task that sent a message */
HTASK hPrevSendingTask; /* 3c Handle of previous sender */
WORD wPaintCount; /* 3e Number of WM_PAINT needed */
WORD wTimerCount; /* 40 Number of timers for this task */
WORD tempStatus; /* 42 State reset by GetQueueStatus */
WORD status; /* 44 Queue state */
WORD wakeMask; /* 46 Task wake-up mask */
WORD SendMsgReturnPtrs[3]; /* 48 Near ptr to return values (?) */
HANDLE hCurHook; /* 4e Current hook */
HANDLE hooks[WH_NB_HOOKS]; /* 50 Task hooks list */
WORD reserved4[3]; /* 68 Unknown */
QMSG messages[1]; /* 6e Queue messages */
} MESSAGEQUEUE;
#ifndef WINELIB
#pragma pack(4)
#endif
extern void MSG_IncPaintCount( HANDLE hQueue );
extern void MSG_DecPaintCount( HANDLE hQueue );
......
......@@ -5,11 +5,12 @@
#include <windows.h>
#include "comm.h"
#define WINE_PATH_LENGTH 256
struct dosdirent {
int inuse;
DIR *ds;
char unixpath[256];
char filename[256];
char unixpath[WINE_PATH_LENGTH];
char filename[WINE_PATH_LENGTH];
char filemask[13];
char attribute;
char search_attribute;
......@@ -17,6 +18,7 @@ struct dosdirent {
long filetime;
int telldirnum;
short entnum; /* Directory entry number */
struct dosdirent *next;
};
struct fcb {
......
......@@ -7,6 +7,18 @@
#ifndef OPTIONS_H
#define OPTIONS_H
/* Supported languages */
typedef enum
{
LANG_En, /* English */
LANG_Es, /* Spanish */
LANG_De, /* German */
LANG_No, /* Norwegian */
LANG_Fr, /* French */
LANG_Fi, /* Finnish */
LANG_Da /* Danish */
} WINE_LANGUAGE;
struct options
{
char * desktopGeometry; /* NULL when no desktop */
......@@ -21,6 +33,7 @@ struct options
if write access is requested */
int enhanced; /* Start Wine in enhanced mode */
int ipc; /* Use IPC mechanisms */
WINE_LANGUAGE language; /* Current language */
};
extern struct options Options;
......
......@@ -10,6 +10,8 @@
#include <windows.h>
#include "wine.h"
#ifndef __svr4__
#define EAX_reg(context) ((context)->sc_eax)
#define EBX_reg(context) ((context)->sc_ebx)
#define ECX_reg(context) ((context)->sc_ecx)
......@@ -63,4 +65,55 @@
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
#else /* __svr4__ */
#define EAX_reg(context) ((context)->uc_mcontext.gregs[EAX])
#define EBX_reg(context) ((context)->uc_mcontext.gregs[EBX])
#define ECX_reg(context) ((context)->uc_mcontext.gregs[ECX])
#define EDX_reg(context) ((context)->uc_mcontext.gregs[EDX])
#define ESI_reg(context) ((context)->uc_mcontext.gregs[ESI])
#define EDI_reg(context) ((context)->uc_mcontext.gregs[EDI])
#define EBP_reg(context) ((context)->uc_mcontext.gregs[EBP])
#define AX_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[EAX]))
#define BX_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[EBX]))
#define CX_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[ECX]))
#define DX_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[EDX]))
#define SI_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[ESI]))
#define DI_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[EDI]))
#define BP_reg(context) (*(WORD*)&((context)->uc_mcontext.gregs[EBP]))
#define AL_reg(context) (*(BYTE*)(&(context)->uc_mcontext.gregs[EAX]))
#define AH_reg(context) (*(((BYTE*)(&(context)->uc_mcontext.gregs[EAX])+1)))
#define BL_reg(context) (*(BYTE*)(&(context)->uc_mcontext.gregs[EBX]))
#define BH_reg(context) (*(((BYTE*)(&(context)->uc_mcontext.gregs[EBX])+1)))
#define CL_reg(context) (*(BYTE*)(&(context)->uc_mcontext.gregs[ECX]))
#define CH_reg(context) (*(((BYTE*)(&(context)->uc_mcontext.gregs[ECX])+1)))
#define DL_reg(context) (*(BYTE*)(&(context)->uc_mcontext.gregs[EDX]))
#define DH_reg(context) (*(((BYTE*)(&(context)->uc_mcontext.gregs[EDX])+1)))
#define CS_reg(context) ((context)->uc_mcontext.gregs[CS])
#define DS_reg(context) ((context)->uc_mcontext.gregs[DS])
#define ES_reg(context) ((context)->uc_mcontext.gregs[ES])
#define SS_reg(context) ((context)->uc_mcontext.gregs[SS])
#define FS_reg(context) ((context)->uc_mcontext.gregs[FS])
#define GS_reg(context) ((context)->uc_mcontext.gregs[GS])
#define EFL_reg(context) ((context)->uc_mcontext.gregs[EFL])
#define FL_reg(context) (*(WORD*)(&(context)->uc_mcontext.gregs[EFL]))
#define EIP_reg(context) ((context)->uc_mcontext.gregs[EIP])
#define ESP_reg(context) ((context)->uc_mcontext.gregs[R_ESP])
#define IP_reg(context) (*(WORD*)(&(context)->uc_mcontext.gregs[EIP]))
#define SP_reg(context) (*(WORD*)(&(context)->uc_mcontext.gregs[R_ESP]))
#define SET_CFLAG(context) (EFL_reg(context) |= 0x0001)
#define RESET_CFLAG(context) (EFL_reg(context) &= 0xfffffffe)
#endif /* __svr4__ */
#endif /* __WINE_REGISTERS_H */
......@@ -97,6 +97,7 @@
#undef DEBUG_DRIVER
#undef DEBUG_EDIT
#undef DEBUG_ENUM
#undef DEBUG_ENV
#undef DEBUG_EVENT
#undef DEBUG_EXEC
#undef DEBUG_FILE
......@@ -105,6 +106,7 @@
#undef DEBUG_GDI
#undef DEBUG_GLOBAL
#undef DEBUG_GRAPHICS
#undef DEBUG_HOOK
#undef DEBUG_ICON
#undef DEBUG_INT
#undef DEBUG_KEY
......@@ -149,6 +151,7 @@
#undef DEBUG_UTILITY
#undef DEBUG_VXD
#undef DEBUG_WIN
#undef DEBUG_WIN32
#undef DEBUG_WINSOCK
#endif
......@@ -174,6 +177,7 @@
#define DEBUG_DRIVER
#define DEBUG_EDIT
#define DEBUG_ENUM
#define DEBUG_ENV
#define DEBUG_EVENT
#define DEBUG_EXEC
#define DEBUG_FILE
......@@ -182,6 +186,7 @@
#define DEBUG_GDI
#define DEBUG_GLOBAL
#define DEBUG_GRAPHICS
#define DEBUG_HOOK
#define DEBUG_ICON
#define DEBUG_INT
#define DEBUG_KEY
......@@ -226,5 +231,6 @@
#define DEBUG_UTILITY
#define DEBUG_VXD
#define DEBUG_WIN
#define DEBUG_WIN32
#define DEBUG_WINSOCK
#endif
#ifndef _WINBASE_H
#define _WINBASE_H
#ifdef UNICODE
#define LoadAccelerators LoadAcceleratorsW
#define TranslateAccelat
#else
#define LoadAccelerators LoadAcceleratorsA
#endif
#define INVALID_HANDLE_VALUE ((HANDLE) -1)
#define WAIT_FAILED 0xffffffff
#define WAIT_OBJECT_0 0
#define WAIT_ABANDONED STATUS_ABANDONED_WAIT_0
#define WAIT_ABANDONED_0 STATUS_ABANDONED_WAIT_0
#define WAIT_TIMEOUT STATUS_TIMEOUT
#define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000
#define MEM_TOPDOWN 0x100000
#define MEM_RELEASE 0x8000
#define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04
#define PAGE_WRITECOPY 0x08
#define PAGE_EXECUTE 0x10
#define PAGE_EXECUTE_READ 0x20
#define PAGE_EXECUTE_READWRITE 0x40
#define PAGE_EXECUTE_WRITECOPY 0x80
#define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200
HANDLE WINAPI OpenProcess(DWORD access, BOOL inherit, DWORD id);
int WINAPI GetCurrentProcessId(void);
int WINAPI TerminateProcess(HANDLE h, int ret);
WINAPI void * VirtualAlloc (void *addr,DWORD size,DWORD type,DWORD protect);
struct _EXCEPTION_POINTERS;
typedef LONG (TOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *);
WINAPI TOP_LEVEL_EXCEPTION_FILTER *SetUnhandledExceptionFilter(TOP_LEVEL_EXCEPTION_FILTER *func);
/*WINAPI int SetErrorMode(int);*/
#define STATUS_WAIT_0 0x00000000
#define STATUS_ABANDONED_WAIT_0 0x00000080
#define STATUS_USER_APC 0x000000C0
#define STATUS_TIMEOUT 0x00000102
#define STATUS_PENDING 0x00000103
#define STATUS_GUARD_PAGE_VIOLATION 0x80000001
#define STATUS_DATATYPE_MISALIGNMENT 0x80000002
#define STATUS_BREAKPOINT 0x80000003
#define STATUS_SINGLE_STEP 0x80000004
#define STATUS_ACCESS_VIOLATION 0xC0000005
#define STATUS_IN_PAGE_ERROR 0xC0000006
#define STATUS_NO_MEMORY 0xC0000017
#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
#define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
#define STATUS_INVALID_DISPOSITION 0xC0000026
#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
#define STATUS_FLOAT_OVERFLOW 0xC0000091
#define STATUS_FLOAT_STACK_CHECK 0xC0000092
#define STATUS_FLOAT_UNDERFLOW 0xC0000093
#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
#define STATUS_INTEGER_OVERFLOW 0xC0000095
#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
#define STATUS_STACK_OVERFLOW 0xC00000FD
#define STATUS_CONTROL_C_EXIT 0xC000013A
#define DUPLICATE_CLOSE_SOURCE 0x00000001
#define DUPLICATE_SAME_ACCESS 0x00000002
typedef struct
{
int type;
} exception;
typedef struct
{
int pad[39];
int edi;
int esi;
int ebx;
int edx;
int ecx;
int eax;
int ebp;
int eip;
int cs;
int eflags;
int esp;
int ss;
} exception_info;
#endif
/*DWORD WINAPI GetVersion( void );*/
int
WINAPI WinMain(HINSTANCE, HINSTANCE prev, char *cmd, int show);
#define GMEM_FIXED 0x0000
#define GMEM_MOVEABLE 0x0002
DECLARE_HANDLE(HACCEL);
HACCEL WINAPI LoadAcceleratorsA( HINSTANCE, const char *);
#define FreeModule(hLibModule) FreeLibrary((hLibModule))
#define MakeProcInstance(lpProc,hInstance) (lpProc)
#define FreeProcInstance(lpProc) (lpProc)
#ifndef _WINCON_H_
#define _WINCON_H_
#ifdef UNICODE
#define FillConsoleOutputCharacter FillConsoleOutputCharacterW
#define GetConsoleTitle GetConsoleTitleW
#define PeekConsoleInput PeekConsoleInputW
#define ReadConsole ReadConsoleW
#define ReadConsoleInput ReadConsoleInputW
#define ReadConsoleOutput ReadConsoleOutputW
#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterW
#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferW
#define SetConsoleTitle SetConsoleTitleW
#define WriteConsole WriteConsoleW
#define WriteConsoleInput WriteConsoleInputW
#define WriteConsoleOutput WriteConsoleOutputW
#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterW
#else
#define FillConsoleOutputCharacter FillConsoleOutputCharacterA
#define GetConsoleTitle GetConsoleTitleA
#define PeekConsoleInput PeekConsoleInputA
#define ReadConsole ReadConsoleA
#define ReadConsoleInput ReadConsoleInputA
#define ReadConsoleOutput ReadConsoleOutputA
#define ReadConsoleOutputCharacter ReadConsoleOutputCharacterA
#define ScrollConsoleScreenBuffer ScrollConsoleScreenBufferA
#define SetConsoleTitle SetConsoleTitleA
#define WriteConsole WriteConsoleA
#define WriteConsoleInput WriteConsoleInputA
#define WriteConsoleOutput WriteConsoleOutputA
#define WriteConsoleOutputCharacter WriteConsoleOutputCharacterA
#endif
#if 0
typedef struct
{
int bKeyDown;
WORD wRepeatCount;
WORD wVirtualKeyCode;
WORD wVirtualScanCode;
char AsciiChar;
char pad;
#if 0
union
{
WCHAR UnicodeChar;
CHAR AsciiChar;
}
uChar;
#endif
DWORD dwControlKeyState;
} __attribute__ ((packed)) KEY_EVENT_RECORD;
#define RIGHT_ALT_PRESSED 0x1
#define LEFT_ALT_PRESSED 0x2
#define RIGHT_CTRL_PRESSED 0x4
#define LEFT_CTRL_PRESSED 0x8
#define SHIFT_PRESSED 0x10
#define NUMLOCK_ON 0x20
#define SCROLLLOCK_ON 0x40
#define CAPSLOCK_ON 0x80
#define ENHANCED_KEY 0x100
typedef struct
{
COORD dwMousePosition;
DWORD dwButtonState;
DWORD dwControlKeyState;
DWORD dwEventFlags;
}
MOUSE_EVENT_RECORD;
#define CONSOLE_TEXTMODE_BUFFER 1
#define FROM_LEFT_1ST_BUTTON_PRESSED 0x0001
#define RIGHTMOST_BUTTON_PRESSED 0x0002
#define FROM_LEFT_2ND_BUTTON_PRESSED 0x0004
#define FROM_LEFT_3RD_BUTTON_PRESSED 0x0008
#define FROM_LEFT_4TH_BUTTON_PRESSED 0x0010
#define MOUSE_MOVED 0x0001
#define DOUBLE_CLICK 0x0002
typedef struct
{
COORD size;
}
WINDOW_BUFFER_SIZE_RECORD;
typedef struct
{
UINT dwCommandId;
}
MENU_EVENT_RECORD;
typedef struct
{
BOOL bSetFocus;
}
FOCUS_EVENT_RECORD;
typedef struct
{
WORD EventType;
union
{
KEY_EVENT_RECORD KeyEvent;
MOUSE_EVENT_RECORD MouseEvent;
WINDOW_BUFFER_SIZE_RECORD WindowBufferSizeEvent;
MENU_EVENT_RECORD MenuEvent;
FOCUS_EVENT_RECORD FocusEvent;
}
Event;
}
INPUT_RECORD;
#define KEY_EVENT 0x1
#define MOUSE_EVENT 0x2
#define WINDOW_BUFFER_SIZE_EVENT 0x4
#define MENU_EVENT 0x8
#define FOCUS_EVENT 0x10
typedef struct
{
union
{
WCHAR UnicodeChar;
CHAR AsciiChar;
}
Char;
WORD Attributes;
}
CHAR_INFO;
#define FOREGROUND_BLUE 0x01
#define FOREGROUND_GREEN 0x02
#define FOREGROUND_RED 0x04
#define FOREGROUND_INTENSITY 0x08
#define BACKGROUND_BLUE 0x10
#define BACKGROUND_GREEN 0x20
#define BACKGROUND_RED 0x40
#define BACKGROUND_INTENSITY 0x80
typedef struct
{
COORD dwSize;
COORD dwCursorPosition;
WORD wAttrs;
SMALL_RECT srWindow;
COORD dwMaximumWindowSize;
}
CONSOLE_SCREEN_BUFFER_INFO;
typedef struct
{
DWORD size;
BOOL bVisible;
}
CONSOLE_CURSOR_INFO;
#endif
#define CTRL_C_EVENT 0
#define CTRL_BREAK_EVENT 1
#define CTRL_CLOSE_EVENT 2
#define CTRL_LOGOFF_EVENT 5
#define CTRL_SHUTDOWN_EVENT 6
typedef BOOL HANDLER_ROUTINE (WORD ctrltype);
#if 0
#define ENABLE_PROCESSED_INPUT 0x01
#define ENABLE_LINE_INPUT 0x02
#define ENABLE_ECHO_INPUT 0x04
#define ENABLE_WINDOW_INPUT 0x08
#define ENABLE_MOUSE_INPUT 0x10
#define ENABLE_PROCESSED_OUTPUT 0x01
#define ENABLE_WRAP_AT_EOL_OUTPUT 0x02
BOOL WINAPI AllocConsole (VOID);
HANDLE WINAPI CreateConsoleScreenBuffer (DWORD access,
DWORD mode,
CONST SECURITY_ATTRIBUTES * lattr,
DWORD flags,
VOID * ptr);
BOOL WINAPI FillConsoleOutputAttribute (HANDLE h,
WORD attr,
DWORD len,
COORD co,
DWORD * done);
BOOL WINAPI FillConsoleOutputCharacterA (HANDLE h,
CHAR c,
DWORD len,
COORD co,
DWORD * done);
BOOL WINAPI FlushBuffer (HANDLE h);
BOOL WINAPI FreeConsole (VOID);
BOOL WINAPI GenerateConsoleCtrlEvent (DWORD ev, DWORD group);
UINT WINAPI GetConsoleCP (VOID);
BOOL WINAPI GetConsoleCursorInfo (HANDLE h, CONSOLE_CURSOR_INFO *info);
BOOL WINAPI GetConsoleMode (HANDLE h, DWORD * mode);
UINT WINAPI GetConsoleOutputCP (VOID);
BOOL WINAPI GetConsoleScreenBufferInfo (HANDLE h, CONSOLE_SCREEN_BUFFER_INFO *
ptr);
DWORD WINAPI GetConsoleTitleA (LPSTR str, DWORD len);
COORD WINAPI GetLargestConsoleWindowSize (HANDLE h);
BOOL WINAPI GetNumberOfConsoleInputEvents (HANDLE h,
DWORD * n);
BOOL WINAPI GetNumberOfConsoleMouseButtons (DWORD * n);
BOOL WINAPI PeekConsoleInputA (HANDLE h,
INPUT_RECORD * ptr,
DWORD len,
DWORD * done);
BOOL WINAPI ReadConsoleA (HANDLE h,
VOID * ptr,
DWORD len,
DWORD * done,
VOID * res);
BOOL WINAPI ReadConsoleInputA (HANDLE h,
INPUT_RECORD * ptr,
DWORD len,
DWORD * done);
BOOL WINAPI ReadConsoleOutputA (HANDLE h,
CHAR_INFO * ptr,
COORD size,
COORD fred,
SMALL_RECT * reg);
BOOL WINAPI ReadConsoleOutputAttribute (HANDLE h,
WORD * attr,
DWORD len,
COORD rc,
DWORD * done);
BOOL WINAPI ReadConsoleOutputCharacterA (HANDLE h,
LPSTR c,
DWORD len,
COORD rc,
DWORD * done);
BOOL WINAPI ScrollConsoleScreenBufferA (HANDLE h,
CONST SMALL_RECT * sr,
CONST SMALL_RECT * cr,
COORD cpos,
CONST CHAR_INFO * i);
BOOL WINAPI SetConsoleActiveScreenBuffer (HANDLE h);
BOOL WINAPI SetConsoleCP (UINT i);
BOOL WINAPI SetConsoleCtrlHandler (HANDLER_ROUTINE * func, BOOL a);
BOOL WINAPI SetConsoleCursorInfo (HANDLE h, CONST CONSOLE_CURSOR_INFO * info);
BOOL WINAPI SetConsoleCursorPosition (HANDLE h, COORD pos);
BOOL WINAPI SetConsoleMode (HANDLE h, DWORD mode);
BOOL WINAPI SetConsoleOutputCP (UINT i);
BOOL WINAPI SetConsoleScreenBufferSize (HANDLE h, COORD size);
BOOL WINAPI SetConsoleTextAttribute (HANDLE h,
WORD attrs);
BOOL WINAPI SetConsoleTitleA (const char * str);
BOOL WINAPI SetConsoleWindowInfo (HANDLE h,
BOOL abs,
CONST SMALL_RECT * wnd);
BOOL WINAPI WriteConsoleA (HANDLE h,
CONST VOID * ptr,
DWORD slen,
DWORD * done,
VOID * res);
BOOL WINAPI WriteConsoleInputA (HANDLE h,
CONST INPUT_RECORD * ptr,
DWORD len,
DWORD * done);
BOOL WINAPI WriteConsoleOutputA (HANDLE h,
CONST CHAR_INFO * ptr,
COORD size,
COORD fred,
SMALL_RECT* where);
BOOL WINAPI WriteConsoleOutputAttribute (HANDLE h,
CONST WORD *attr,
DWORD len,
COORD co,
DWORD * done);
BOOL WINAPI WriteConsoleOutputCharacterA (HANDLE h,
const char * c,
DWORD len,
COORD co,
DWORD * done);
#endif
#endif
......@@ -14,13 +14,9 @@ static inline int runtime_cpu(void) { return 3; }
#endif
#if defined ( linux) || defined(__svr4__)
/*
* SVR4 NOTE:
* This is not correct but gets it through the compiler
* Must come back and look at this again
*/
struct sigcontext_struct {
#if defined ( linux)
struct sigcontext_struct
{
unsigned short sc_gs, __gsh;
unsigned short sc_fs, __fsh;
unsigned short sc_es, __esh;
......@@ -44,20 +40,21 @@ struct sigcontext_struct {
unsigned long oldmask;
unsigned long cr2;
};
#ifdef linux
#define WINE_DATA_SELECTOR 0x2b
#define WINE_CODE_SELECTOR 0x23
#endif
#ifdef __svr4__
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif
#endif /* linux */
#ifdef __NetBSD__
#include <signal.h>
#define sigcontext_struct sigcontext
#define HZ 100
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif
#ifdef __svr4__
#include <signal.h>
#include <sys/ucontext.h>
#define sigcontext_struct ucontext
#define WINE_DATA_SELECTOR 0x1f
#define WINE_CODE_SELECTOR 0x17
#endif
......@@ -65,7 +62,6 @@ struct sigcontext_struct {
#ifdef __FreeBSD__
#include <signal.h>
#define sigcontext_struct sigcontext
#define HZ 100
#define WINE_DATA_SELECTOR 0x27
#define WINE_CODE_SELECTOR 0x1f
#endif
......
extern int WIN32_LastError;
#define ERROR_CALL_NOT_IMPLEMENTED 120
/* ERROR_UNKNOWN is a placeholder for error conditions which haven't
* been tested yet so we're not exactly sure what will be returned.
* All instances of ERROR_UNKNOWN should be tested under Win95/NT
* and replaced.
*/
#define ERROR_UNKNOWN 99999
#define ERROR_INVALID_HANDLE 6
#define ERROR_INVALID_PARAMETER 87
#define ERROR_CALL_NOT_IMPLEMENTED 120
#ifndef __WINE_WINNLS_H
#define __WINE_WINNLS_H
#define LOCALE_ILANGUAGE 0x00000001
#define LOCALE_SLANGUAGE 0x00000002
#define LOCALE_SENGLANGUAGE 0x00001001
......@@ -102,3 +105,5 @@
#define NORM_IGNORENONSPACE 2
#define NORM_IGNORESYMBOLS 4
#define NORM_STRINGSORT 0x1000
#endif /* __WINE_WINNLS_H */
......@@ -65,6 +65,7 @@ typedef WSADATA FAR *LPWSADATA;
#ifndef _SYS_SOCKET_H_
#ifndef _sys_socket_h
#ifndef _NET_TRANSPORT_SOCKET_H
#ifndef _NET_SOCKET_H
/*
* Structure used by kernel to pass protocol
* information in raw sockets.
......@@ -76,6 +77,7 @@ struct sockproto {
#endif
#endif
#endif
#endif
/*
* Maximum queue length specifiable by listen.
......
......@@ -79,6 +79,7 @@ DECLARE_HANDLE(HMETAFILE);
DECLARE_HANDLE(HMODULE);
DECLARE_HANDLE(HPALETTE);
DECLARE_HANDLE(HPEN);
DECLARE_HANDLE(HQUEUE);
DECLARE_HANDLE(HRGN);
DECLARE_HANDLE(HRSRC);
DECLARE_HANDLE(HTASK);
......@@ -137,4 +138,13 @@ typedef FARPROC HOOKPROC;
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef DONT_DEFINE_min_AND_max
#ifndef min
#define min(a,b) MIN(a,b)
#endif
#ifndef max
#define max(a,b) MAX(a,b)
#endif
#endif
#endif /* __WINE_WINTYPES_H */
......@@ -58,10 +58,10 @@ int MAIN_Init(void)
/* Initialize Win32 relay code */
if (!RELAY32_Init()) return 0;
#endif
/* Create built-in modules */
if (!MODULE_Init()) return 0;
#endif
/* Initialize the DOS file system */
DOS_InitFS();
......
......@@ -29,15 +29,16 @@
static HMODULE hFirstModule = 0;
static HMODULE hCachedModule = 0; /* Module cached by MODULE_OpenFile */
#ifndef WINELIB
static HANDLE hInitialStack32 = 0;
#endif
/***********************************************************************
* MODULE_LoadBuiltin
*
* Load a built-in module. If the 'force' parameter is FALSE, we only
* load the module if it has not been disabled via the -dll option.
*/
#ifndef WINELIB /* JBP: Not really allowed in libwine.a (FIXME:?) */
#ifndef WINELIB
static HMODULE MODULE_LoadBuiltin( LPCSTR name, BOOL force )
{
HMODULE hModule;
......@@ -705,7 +706,7 @@ DWORD MODULE_GetEntryPoint( HMODULE hModule, WORD ordinal )
}
if (sel == 0xfe) sel = 0xffff; /* constant entry */
else sel = NE_SEG_TABLE(pModule)[sel-1].selector;
else sel = (WORD)NE_SEG_TABLE(pModule)[sel-1].selector;
return MAKELONG( offset, sel );
}
......@@ -912,7 +913,7 @@ HINSTANCE LoadModule( LPCSTR name, LPVOID paramBlock )
HANDLE hInstance, hPrevInstance;
NE_MODULE *pModule;
LOADPARAMS *params = (LOADPARAMS *)paramBlock;
#ifndef WINELIB /* JBP: Disabled for now in winelib.a */
#ifndef WINELIB
WORD *pModRef, *pDLLs;
int i, fd;
......@@ -1195,9 +1196,15 @@ int GetModuleFileName( HANDLE hModule, LPSTR lpFileName, short nSize )
*/
HANDLE LoadLibrary( LPCSTR libname )
{
#ifdef WINELIB
dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
WINELIB_UNIMP("LoadLibrary()");
return (HANDLE)0;
#else
HANDLE handle;
dprintf_module( stddeb, "LoadLibrary: (%08x) %s\n", (int)libname, libname);
/* This does not increment the module reference count, and will
* therefore cause crashes on FreeLibrary calls.
if ((handle = MODULE_FindModule( libname )) != 0) return handle;
......@@ -1212,6 +1219,7 @@ HANDLE LoadLibrary( LPCSTR libname )
}
if (handle >= (HANDLE)32) NE_InitializeDLLs( GetExePtr(handle) );
return handle;
#endif
}
......@@ -1326,12 +1334,23 @@ FARPROC GetProcAddress( HANDLE hModule, SEGPTR name )
}
#ifndef WINELIB
/**********************************************************************
* GetExpWinVer (KERNEL.167)
*/
WORD GetExpWinVer( HMODULE hModule )
{
NE_MODULE *pModule = (NE_MODULE *)GlobalLock( hModule );
return pModule->expected_version;
}
/***********************************************************************
* GetWndProcEntry16 (not a Windows API function)
*
* Return an entry point from the WINPROCS dll.
*/
#ifndef WINELIB
WNDPROC GetWndProcEntry16( char *name )
{
WORD ordinal;
......
#ifndef WINELIB
/*
* NE modules
*
......@@ -532,3 +533,4 @@ void NE_InitializeDLLs( HMODULE hModule )
void PatchCodeHandle(HANDLE hSel)
{
}
#endif /* WINELIB */
#ifndef WINELIB
/*
*
* Copyright 1993 Robert J. Amstadt
......@@ -206,10 +207,6 @@ HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
pTypeInfo->count * sizeof(NE_NAMEINFO));
}
}
fprintf( stderr, "FindResource('%*.*s',%08lx,%08lx): Not found.\n",
*((BYTE *)pModule + pModule->name_table),
*((BYTE *)pModule + pModule->name_table),
(char *)pModule + pModule->name_table + 1, typeId, resId );
return 0;
}
......@@ -362,3 +359,4 @@ BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
fprintf( stderr, "FreeResource: "NPFMT" "NPFMT" not found!\n", hModule, handle );
return FALSE;
}
#endif /* WINELIB */
#ifndef WINELIB
/*
* Copyright 1994 Eric Youndale & Erik Bos
*
......@@ -107,7 +108,7 @@ void fixup_imports(struct PE_Import_Directory *pe_imports)
int fixup_failed=0;
/* OK, now dump the import list */
printf("\nDumping imports list\n");
dprintf_win32(stddeb, "\nDumping imports list\n");
pe_imp = pe_imports;
while (pe_imp->ModuleName)
{
......@@ -117,7 +118,7 @@ void fixup_imports(struct PE_Import_Directory *pe_imports)
char * c;
Module = ((char *) load_addr) + pe_imp->ModuleName;
printf("%s\n", Module);
dprintf_win32(stddeb, "%s\n", Module);
c = strchr(Module, '.');
if (c) *c = 0;
......@@ -135,7 +136,7 @@ void fixup_imports(struct PE_Import_Directory *pe_imports)
fprintf(stderr,"Import by ordinal not supported\n");
exit(0);
}
printf("--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
dprintf_win32(stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
#ifndef WINELIB /* FIXME: JBP: Should this happen in libwine.a? */
*thunk_list=(unsigned int)RELAY32_GetEntryPoint(Module,pe_name->Name,pe_name->Hint);
#else
......@@ -159,11 +160,11 @@ static void dump_table(struct w_files *wpnt)
{
int i;
printf("Dump of segment table\n");
printf(" Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n");
dprintf_win32(stddeb, "Dump of segment table\n");
dprintf_win32(stddeb, " Name VSz Vaddr SzRaw Fileadr *Reloc *Lineum #Reloc #Linum Char\n");
for(i=0; i< wpnt->pe->pe_header->coff.NumberOfSections; i++)
{
printf("%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n",
dprintf_win32(stddeb, "%8s: %4.4lx %8.8lx %8.8lx %8.8lx %8.8lx %8.8lx %4.4x %4.4x %8.8lx\n",
wpnt->pe->pe_seg[i].Name,
wpnt->pe->pe_seg[i].Virtual_Size,
wpnt->pe->pe_seg[i].Virtual_Address,
......@@ -200,7 +201,7 @@ HINSTANCE PE_LoadImage(struct w_files *wpnt)
wpnt->pe->pe_header->coff.NumberOfSections);
load_addr = wpnt->pe->pe_header->opt_coff.BaseOfImage;
printf("Load addr is %x\n",load_addr);
dprintf_win32(stddeb, "Load addr is %x\n",load_addr);
dump_table(wpnt);
for(i=0; i < wpnt->pe->pe_header->coff.NumberOfSections; i++)
......@@ -366,7 +367,7 @@ void PE_Win32CallToStart(struct sigcontext_struct context)
int fs;
struct w_files *wpnt=wine_files;
fs=(int)GlobalAlloc(GHND,0x10000);
fprintf(stddeb,"Going to start Win32 program\n");
dprintf_win32(stddeb,"Going to start Win32 program\n");
InitTask(context);
USER_InitApp(wpnt->hModule);
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
......@@ -387,3 +388,4 @@ void PE_InitDLL(struct w_files *wpnt)
printf("InitPEDLL() called!\n");
}
}
#endif /* WINELIB */
#ifndef WINELIB
/*
* (c) 1994 Erik Bos <erik@xs4all.nl>
*
......@@ -150,3 +151,5 @@ PE_FindResource(HANDLE instance, SEGPTR resource_name, SEGPTR type_name,
return find_type(r->wpnt->pe->pe_resource, resource_name, type_name);
}
#endif
#endif /* WINELIB */
......@@ -23,6 +23,7 @@
#include "resource.h"
#include "stddebug.h"
#include "debug.h"
#include "libres.h"
#define PrintId(name) \
if (HIWORD((DWORD)name)) \
......@@ -41,10 +42,18 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource: module="NPFMT" type=", hModule );
PrintId( type );
if (HIWORD(name)) /* Check for '#xxx' name */
{
char *ptr = PTR_SEG_TO_LIN( name );
if (ptr[0] == '#') {
if (!(name = (SEGPTR)atoi( ptr + 1 ))) return 0;
}
}
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -54,6 +63,9 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
default:
return 0;
}
#else
return LIBRES_FindResource( hModule, type, name );
#endif
}
......@@ -69,6 +81,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -78,6 +91,9 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
default:
return 0;
}
#else
return LIBRES_LoadResource( hModule, hRsrc );
#endif
}
......@@ -94,6 +110,7 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
if (!handle) return (SEGPTR)0;
hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -103,6 +120,9 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
default:
return 0;
}
#else
return LIBRES_LockResource( hModule, handle );
#endif
}
/* 32-bit version */
......@@ -115,6 +135,7 @@ LPSTR LockResource( HGLOBAL handle )
if (!handle) return NULL;
hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -124,6 +145,9 @@ LPSTR LockResource( HGLOBAL handle )
default:
return 0;
}
#else
return LIBRES_LockResource( hModule, handle );
#endif
}
......@@ -139,6 +163,7 @@ BOOL FreeResource( HGLOBAL handle )
if (!handle) return FALSE;
hModule = GetExePtr( handle );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -148,6 +173,9 @@ BOOL FreeResource( HGLOBAL handle )
default:
return FALSE;
}
#else
return LIBRES_FreeResource( hModule, handle );
#endif
}
......@@ -163,6 +191,7 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -172,6 +201,9 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
default:
return 0;
}
#else
return LIBRES_AccessResource( hModule, hRsrc );
#endif
}
......@@ -186,6 +218,7 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
dprintf_resource(stddeb, "SizeofResource: module="NPFMT" res="NPFMT"\n",
hModule, hRsrc );
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -195,6 +228,9 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
default:
return 0;
}
#else
return LIBRES_SizeofResource( hModule, hRsrc );
#endif
}
......@@ -210,6 +246,7 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
hModule, hRsrc, size );
if (!hRsrc) return 0;
if (!(pModule = (WORD *)GlobalLock( hModule ))) return 0;
#ifndef WINELIB
switch(*pModule)
{
case NE_SIGNATURE:
......@@ -219,6 +256,9 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
default:
return 0;
}
#else
return LIBRES_AllocResource( hModule, hRsrc, size );
#endif
}
/**********************************************************************
......
......@@ -18,7 +18,6 @@
#include "miscemu.h"
#include "registers.h"
#include "win.h"
#include "xmalloc.h"
#if !defined(BSD4_4) || defined(linux) || defined(__FreeBSD__)
char * cstack[4096];
......@@ -46,20 +45,25 @@ wine_sigaction(int sig,struct sigaction * new, struct sigaction * old)
#endif
#if defined(linux) || defined(__svr4__)
#if defined(linux)
static void win_fault(int signal, struct sigcontext_struct context_struct)
{
struct sigcontext_struct *context = &context_struct;
#elif defined(__svr4__)
static void win_fault(int signal, void *siginfo, ucontext_t *context)
{
#else
static void win_fault(int signal, int code, struct sigcontext *context)
{
#endif
int i;
if (signal != SIGTRAP)
{
if (CS_reg(context) == WINE_CODE_SELECTOR)
{
fprintf(stderr, "Segmentation fault in Wine program (%04x:%08lx)."
" Please debug.\n",
fprintf(stderr, "Segmentation fault in Wine program (%x:%lx)."
" Please debug\n",
CS_reg(context), EIP_reg(context) );
}
else if (INSTR_EmulateInstruction( context )) return;
......@@ -100,11 +104,15 @@ void init_wine_signals(void)
sigset_t sig_mask;
struct sigaltstack ss;
#if !defined (__FreeBSD__)
ss.ss_base = xmalloc (MINSIGSTKSZ);
#if !defined (__FreeBSD__)
if ((ss.ss_base = malloc(MINSIGSTKSZ)) == NULL) {
#else
ss.ss_sp = xmalloc (MINSIGSTKSZ);
if ((ss.ss_sp = malloc(MINSIGSTKSZ)) == NULL) {
#endif
fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
MINSIGSTKSZ);
exit(1);
}
ss.ss_size = MINSIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) < 0) {
......@@ -143,6 +151,56 @@ void init_wine_signals(void)
}
#endif /* CONFIG_IPC */
#endif /* __FreeBSD__ || __NetBSD__ */
#if defined (__svr4__)
sigset_t sig_mask;
struct sigaltstack ss;
if ((ss.ss_sp = malloc(SIGSTKSZ) ) == NULL) {
fprintf(stderr, "Unable to allocate signal stack (%d bytes)\n",
SIGSTKSZ);
exit(1);
}
ss.ss_size = SIGSTKSZ;
ss.ss_flags = 0;
if (sigaltstack(&ss, NULL) < 0) {
perror("sigstack");
exit(1);
}
sigemptyset(&sig_mask);
segv_act.sa_handler = (void (*)) win_fault;
segv_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGBUS, &segv_act, NULL) < 0) {
perror("sigaction: SIGBUS");
exit(1);
}
segv_act.sa_handler = (void (*)) win_fault;
segv_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGSEGV, &segv_act, NULL) < 0) {
perror("sigaction: SIGSEGV");
exit(1);
}
segv_act.sa_handler = (void (*)) win_fault; /* For breakpoints */
segv_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
segv_act.sa_mask = sig_mask;
if (sigaction(SIGTRAP, &segv_act, NULL) < 0) {
perror("sigaction: SIGTRAP");
exit(1);
}
#ifdef CONFIG_IPC
usr2_act.sa_handler = (void (*)) stop_wait; /* For breakpoints */
usr2_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
usr2_act.sa_mask = sig_mask;
if (sigaction(SIGUSR2, &usr2_act, NULL) < 0) {
perror("sigaction: SIGUSR2");
exit(1);
}
#endif /* CONFIG_IPC */
#endif /* __svr4__ */
}
#endif /* ifndef WINELIB */
......@@ -419,7 +419,11 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
pTask->hPrevInstance = hPrevInstance;
pTask->hModule = hModule;
pTask->hParent = hCurrentTask;
#ifdef WINELIB
pTask->curdrive = 'C' - 'A' + 0x80;
#else
pTask->curdrive = filename[0] - 'A' + 0x80;
#endif
pTask->magic = TDB_MAGIC;
pTask->nCmdShow = cmdShow;
strcpy( pTask->curdir, filename+2 );
......@@ -710,7 +714,7 @@ void InitTask( struct sigcontext_struct context )
INSTANCEDATA *pinstance;
LONG stacklow, stackhi;
context.sc_eax = 0;
EAX_reg(&context) = 0;
if (!(pTask = (TDB *)GlobalLock( hCurrentTask ))) return;
if (!(pModule = (NE_MODULE *)GlobalLock( pTask->hModule ))) return;
......@@ -730,7 +734,9 @@ void InitTask( struct sigcontext_struct context )
firstTask = 0;
}
#ifndef WINELIB
NE_InitializeDLLs( pTask->hModule );
#endif
/* Registers on return are:
* ax 1 if OK, 0 on error
......@@ -740,13 +746,13 @@ void InitTask( struct sigcontext_struct context )
* di instance handle of the new task
* es:bx pointer to command-line inside PSP
*/
context.sc_eax = 1;
context.sc_ebx = 0x81;
context.sc_ecx = pModule->stack_size;
context.sc_edx = pTask->nCmdShow;
context.sc_esi = (DWORD)pTask->hPrevInstance;
context.sc_edi = (DWORD)pTask->hInstance;
context.sc_es = (WORD)pTask->hPDB;
EAX_reg(&context) = 1;
EBX_reg(&context) = 0x81;
ECX_reg(&context) = pModule->stack_size;
EDX_reg(&context) = pTask->nCmdShow;
ESI_reg(&context) = (DWORD)pTask->hPrevInstance;
EDI_reg(&context) = (DWORD)pTask->hInstance;
ES_reg (&context) = (WORD)pTask->hPDB;
/* Initialize the local heap */
if ( pModule->heap_size )
......@@ -970,6 +976,28 @@ HGLOBAL GetTaskQueue( HANDLE hTask )
/***********************************************************************
* GetTaskQueueDS (KERNEL.118)
*/
#ifndef WINELIB
void GetTaskQueueDS( struct sigcontext_struct context )
{
DS_reg(&context) = GlobalHandleToSel( GetTaskQueue(0) );
}
#endif /* WINELIB */
/***********************************************************************
* GetTaskQueueES (KERNEL.119)
*/
#ifndef WINELIB
void GetTaskQueueES( struct sigcontext_struct context )
{
ES_reg(&context) = GlobalHandleToSel( GetTaskQueue(0) );
}
#endif /* WINELIB */
/***********************************************************************
* GetCurrentTask (KERNEL.36)
*/
HTASK GetCurrentTask(void)
......
......@@ -316,7 +316,7 @@ WORD SelectorAccessRights( WORD sel, WORD op, WORD val )
}
else /* set */
{
entry.read_only = (val & 2 == 0);
entry.read_only = ((val & 2) == 0);
entry.type = (val >> 2) & 3;
entry.seg_32bit = val & 0x4000;
entry.limit_in_pages = val & 0x8000;
......
......@@ -626,9 +626,8 @@ int SetCommState(DCB FAR *lpdcb)
port.c_cflag |= CRTSCTS;
if (lpdcb->fDtrDisable)
#endif
port.c_cflag &= ~CRTSCTS;
#endif
if (lpdcb->fInX)
port.c_iflag |= IXON;
if (lpdcb->fOutX)
......@@ -727,16 +726,17 @@ int GetCommState(int fd, DCB FAR *lpdcb)
lpdcb->fNull = 0;
lpdcb->fChEvt = 0;
lpdcb->fBinary = 1;
lpdcb->fDtrDisable = 0;
#ifndef __svr4__
lpdcb->fDtrDisable = 0;
if (port.c_cflag & CRTSCTS) {
lpdcb->fDtrflow = 1;
lpdcb->fRtsflow = 1;
lpdcb->fOutxCtsFlow = 1;
lpdcb->fOutxDsrFlow = 1;
#endif
} else
#endif
lpdcb->fDtrDisable = 1;
if (port.c_iflag & IXON)
......
......@@ -509,11 +509,10 @@ static LRESULT FILEDLG_WMCommand(HWND hWnd, WPARAM wParam, LPARAM lParam)
tmpstr2[0] = 'A'+ drive;
tmpstr2[1] = ':';
tmpstr2[2] = '\\';
strncpy(tmpstr2 + 3, DOS_GetCurrentDir(drive), 510); tmpstr2[510]=0;
strncpy(tmpstr2 + 3, DOS_GetCurrentDir(drive), 507); tmpstr2[510]=0;
if (strlen(tmpstr2) > 3)
strcat(tmpstr2, "\\");
strcat(tmpstr2, "\\");
strncat(tmpstr2, tmpstr, 511-strlen(tmpstr2)); tmpstr2[511]=0;
printf("strcpy'ing '%s'\n",tmpstr2); fflush(stdout);
strcpy(PTR_SEG_TO_LIN(lpofn->lpstrFile), tmpstr2);
}
lpofn->nFileOffset = 0;
......
......@@ -24,6 +24,7 @@
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/param.h>
#include <sys/mount.h>
#include <sys/errno.h>
#endif
#ifdef __svr4__
#include <sys/statfs.h>
......@@ -38,11 +39,6 @@
#include "debug.h"
#include "xmalloc.h"
#ifndef WINE_INI_GLOBAL
/* Get the WINE_INI_GLOBAL definition from autoconf.h */
#include "autoconf.h"
#endif
#define WINE_INI_USER "~/.winerc"
#define MAX_DOS_DRIVES 26
......@@ -50,7 +46,6 @@ extern char WindowsDirectory[256], SystemDirectory[256],TempDirectory[256];
char WindowsPath[256];
static int max_open_dirs = 0;
static int CurrentDrive = 2;
struct DosDriveStruct { /* eg: */
......@@ -206,7 +201,7 @@ void DOS_InitFS(void)
{
int x;
char drive[2], temp[256];
struct dosdirent *dp;
GetPrivateProfileString("wine", "windows", "c:\\windows",
WindowsDirectory, sizeof(WindowsDirectory), WINE_INI);
......@@ -295,9 +290,12 @@ void DOS_InitFS(void)
DosDrives[x].disabled);
}
}
for (x=0; x!=max_open_dirs ; x++)
DosDirs[x].inuse = 0;
dp = DosDirs;
while (dp)
{
dp->inuse = 0;
dp = dp->next;
}
dprintf_dosfs(stddeb,"wine.ini = %s\n",WINE_INI);
dprintf_dosfs(stddeb,"win.ini = %s\n",WIN_INI);
......@@ -582,8 +580,11 @@ int DOS_MakeDir(int drive, char *dirname)
strcat(temp, dirname);
ToUnix(temp);
DOS_SimplifyPath(temp);
mkdir(temp,0);
if (mkdir(temp, S_IRWXU | S_IRWXG | S_IRWXO) == -1)
{
dprintf_dosfs(stddeb, "DOS_MakeDir: %c:\%s => %s failed errno %d",'A'+drive, dirname, temp, errno);
return 0;
}
dprintf_dosfs(stddeb, "DOS_MakeDir: %c:\%s => %s",'A'+drive, dirname, temp);
return 1;
}
......@@ -845,10 +846,11 @@ static int match(char *filename, char *filemask)
struct dosdirent *DOS_opendir(char *dosdirname)
{
int x, len;
int len;
char *unixdirname;
char dirname[256];
DIR *ds;
struct dosdirent *dp;
if ((unixdirname = DOS_GetUnixFileName(dosdirname)) == NULL) return NULL;
......@@ -856,43 +858,51 @@ struct dosdirent *DOS_opendir(char *dosdirname)
strncpy(dirname, unixdirname, len);
dirname[len] = 0;
unixdirname = strrchr(unixdirname, '/') + 1;
if ((ds = opendir(dirname)) == NULL)
return NULL;
for (x=0; x <= max_open_dirs; x++) {
if (x == max_open_dirs) {
if (DosDirs) {
DosDirs=(struct dosdirent*)xrealloc(DosDirs,(++max_open_dirs)*sizeof(DosDirs[0]));
} else {
DosDirs=(struct dosdirent*)xmalloc(sizeof(DosDirs[0]));
max_open_dirs=1;
}
break; /* this one is definitely not in use */
}
if (!DosDirs[x].inuse) break;
if (strcmp(DosDirs[x].unixpath, dirname) == 0) break;
dp = DosDirs;
while (dp)
{
if (dp->inuse)
break;
if (strcmp(dp->unixpath, dirname) == 0)
break;
dp = dp->next;
}
if (!dp)
{
dp = xmalloc(sizeof(struct dosdirent));
dp->next = DosDirs;
DosDirs = dp;
}
strncpy(DosDirs[x].filemask, unixdirname, 12);
DosDirs[x].filemask[12] = 0;
strncpy(dp->filemask, unixdirname, 12);
dp->filemask[12] = 0;
dprintf_dosfs(stddeb,"DOS_opendir: %s / %s\n", unixdirname, dirname);
DosDirs[x].inuse = 1;
strcpy(DosDirs[x].unixpath, dirname);
DosDirs[x].entnum = 0;
dp->inuse = 1;
strcpy(dp->unixpath, dirname);
dp->entnum = 0;
if ((ds = opendir(dirname)) == NULL) return NULL;
if (-1==(DosDirs[x].telldirnum=telldir(ds))) {
if ((dp->telldirnum=telldir(ds)) == -1)
{
dp->inuse = 0;
closedir(ds);
return NULL;
}
if (-1==closedir(ds)) return NULL;
return &DosDirs[x];
if (closedir(ds) == -1)
{
dp->inuse = 0;
return NULL;
}
return dp;
}
struct dosdirent *DOS_readdir(struct dosdirent *de)
{
char temp[256];
char temp[WINE_PATH_LENGTH];
struct dirent *d;
struct stat st;
DIR *ds;
......
......@@ -50,7 +50,7 @@ INT _lopen (LPSTR lpPathName, INT iReadWrite)
switch(iReadWrite & 3)
{
case OF_READ: mode = O_RDONLY; break;
case OF_WRITE: mode = O_WRONLY; break;
case OF_WRITE: mode = O_WRONLY | O_TRUNC; break;
case OF_READWRITE: mode = O_RDWR; break;
}
handle = open( UnixFileName, mode );
......@@ -148,7 +148,7 @@ INT OpenFile (LPCSTR lpFileName, LPOFSTRUCT ofs, UINT wStyle)
int res, handle;
int verify_time = 0;
dprintf_file(stddeb,"Openfile(%s,<struct>,%d)\n",lpFileName,wStyle);
dprintf_file(stddeb,"Openfile(%s,<struct>,%X)\n",lpFileName,wStyle);
action = wStyle & 0xff00;
......@@ -171,7 +171,10 @@ INT OpenFile (LPCSTR lpFileName, LPOFSTRUCT ofs, UINT wStyle)
ofs->nErrCode = ExtendedError;
return -1;
}
handle = open (unixfilename, (wStyle & 0x0003) | O_CREAT, 0666);
/* Apparently, at least the OF_READ parameter is ignored when
* a file is created. Using O_RDWR makes the most sense.
*/
handle = open (unixfilename, O_TRUNC | O_RDWR | O_CREAT, 0666);
if (handle == -1)
{
errno_to_doserr();
......@@ -253,8 +256,8 @@ INT OpenFile (LPCSTR lpFileName, LPOFSTRUCT ofs, UINT wStyle)
return 0;
if (action & OF_DELETE)
return unlink(ofs->szPathName);
return unlink(DOS_GetUnixFileName(ofs->szPathName));
/* FIXME: I suppose we should check return codes here like stat below */
/* Now on to getting some information about that file */
......
......@@ -138,7 +138,10 @@ SEGPTR WIN16_AnsiUpper( SEGPTR strOrChar )
if (HIWORD(strOrChar))
{
char *s = PTR_SEG_TO_LIN(strOrChar);
while (*s) *s++ = ToUpper( *s );
while (*s) {
*s = ToUpper( *s );
s++;
}
return strOrChar;
}
else return (SEGPTR)ToUpper( (int)strOrChar );
......@@ -151,7 +154,10 @@ LPSTR AnsiUpper(LPSTR strOrChar)
/* I am not sure if the locale stuff works with toupper, but then again
I am not sure if the Linux libc locale stuffs works at all */
while (*s) *s++ = ToUpper( *s );
while (*s) {
*s = ToUpper( *s );
s++;
}
return strOrChar;
}
......@@ -183,7 +189,10 @@ SEGPTR WIN16_AnsiLower(SEGPTR strOrChar)
if (HIWORD(strOrChar))
{
char *s = PTR_SEG_TO_LIN( strOrChar );
while (*s) *s++ = ToLower( *s );
while (*s) {
*s = ToLower( *s );
s++;
}
return strOrChar;
}
else return (SEGPTR)ToLower( (int)strOrChar );
......@@ -196,7 +205,10 @@ LPSTR AnsiLower(LPSTR strOrChar)
/* I am not sure if the locale stuff works with toupper, but then again
I am not sure if the Linux libc locale stuffs works at all */
while (*s) *s++ = ToLower( *s );
while (*s) {
*s = ToLower( *s );
s++;
}
return strOrChar;
}
......@@ -231,23 +243,25 @@ SEGPTR AnsiPrev( SEGPTR start, SEGPTR current)
/* AnsiToOem Keyboard.5 */
INT AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr) /* why is this int ??? */
INT AnsiToOem(LPSTR lpAnsiStr, LPSTR lpOemStr)
{
while(*lpAnsiStr){
*lpOemStr++=Ansi2Oem[(unsigned char)(*lpAnsiStr++)];
}
*lpOemStr = 0;
return -1;
dprintf_keyboard(stddeb, "AnsiToOem: %s\n", lpAnsiStr);
while(*lpAnsiStr){
*lpOemStr++=Ansi2Oem[(unsigned char)(*lpAnsiStr++)];
}
*lpOemStr = 0;
return -1;
}
/* OemToAnsi Keyboard.6 */
BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr) /* why is this BOOL ???? */
BOOL OemToAnsi(LPSTR lpOemStr, LPSTR lpAnsiStr)
{
while(*lpOemStr){
*lpAnsiStr++=Oem2Ansi[(unsigned char)(*lpOemStr++)];
}
*lpAnsiStr = 0;
return -1;
dprintf_keyboard(stddeb, "OemToAnsi: %s\n", lpOemStr);
while(*lpOemStr){
*lpAnsiStr++=Oem2Ansi[(unsigned char)(*lpOemStr++)];
}
*lpAnsiStr = 0;
return -1;
}
/* AnsiToOemBuff Keyboard.134 */
......
......@@ -44,6 +44,18 @@ const char people[] = "Wine is available thanks to the work of "
"Gregory Trubetskoy, Michael Veksler, Morten Welinder, Jan Willamowius, "
"Carl Williams, Karl Guenter Wuensch, Eric Youngdale, and James Youngman.";
static const char *langNames[] =
{
"En", /* LANG_En */
"Es", /* LANG_Es */
"De", /* LANG_De */
"No", /* LANG_No */
"Fr", /* LANG_Fr */
"Fi", /* LANG_Fi */
"Da", /* LANG_Da */
NULL
};
#define WINE_CLASS "Wine" /* Class name for resources */
typedef struct tagENVENTRY {
......@@ -75,7 +87,13 @@ struct options Options =
FALSE,
FALSE, /* AllowReadOnly */
FALSE, /* Enhanced mode */
FALSE /* IPC enabled */
FALSE, /* IPC enabled */
#ifdef DEFAULT_LANG
DEFAULT_LANG /* Default language */
#else
LANG_En
#endif
};
......@@ -87,6 +105,7 @@ static XrmOptionDescRec optionsTable[] =
{ "-display", ".display", XrmoptionSepArg, (caddr_t)NULL },
{ "-iconic", ".iconic", XrmoptionNoArg, (caddr_t)"on" },
{ "-ipc", ".ipc", XrmoptionNoArg, (caddr_t)"off"},
{ "-language", ".language", XrmoptionSepArg, (caddr_t)"En" },
{ "-name", ".name", XrmoptionSepArg, (caddr_t)NULL },
{ "-privatemap", ".privatemap", XrmoptionNoArg, (caddr_t)"on" },
{ "-fixedmap", ".fixedmap", XrmoptionNoArg, (caddr_t)NULL },
......@@ -110,6 +129,7 @@ static XrmOptionDescRec optionsTable[] =
" -iconic Start as an icon\n" \
" -ipc Enable IPC facilities\n" \
" -debug Enter debugger before starting application\n" \
" -language xx Set the language (one of En,Es,De,No,Fr,Fi,Da)\n" \
" -name name Set the application name\n" \
" -privatemap Use a private color map\n" \
" -fixedmap Use a \"standard\" color map\n" \
......@@ -272,6 +292,28 @@ static BOOL MAIN_ParseDLLOptions(char *options)
/***********************************************************************
* MAIN_ParseLanguageOption
*
* Parse -language option.
*/
static void MAIN_ParseLanguageOption( char *arg )
{
const char **p = langNames;
Options.language = LANG_En; /* First language */
for (p = langNames; *p; p++)
{
if (!strcasecmp( *p, arg )) return;
Options.language++;
}
fprintf( stderr, "Invalid language specified '%s'. Supported languages are: ", arg );
for (p = langNames; *p; p++) fprintf( stderr, "%s ", *p );
fprintf( stderr, "\n" );
exit(1);
}
/***********************************************************************
* MAIN_ParseOptions
*
* Parse command line options and open display.
......@@ -329,6 +371,8 @@ static void MAIN_ParseOptions( int *argc, char *argv[] )
screenDepth = atoi( value.addr );
if (MAIN_GetResource( db, ".desktop", &value))
Options.desktopGeometry = value.addr;
if (MAIN_GetResource( db, ".language", &value))
MAIN_ParseLanguageOption( (char *)value.addr );
#ifdef DEBUG_RUNTIME
if (MAIN_GetResource( db, ".debugoptions", &value))
ParseDebugOptions((char*)value.addr);
......@@ -610,7 +654,7 @@ int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
{
LPENVENTRY lpNewEnv;
LPENVENTRY lpEnv = lpEnvList;
printf("SetEnvironnement('%s', '%s', %d) !\n",
dprintf_env(stddeb, "SetEnvironnement('%s', '%s', %d) !\n",
lpPortName, lpEnviron, nCount);
if (lpPortName == NULL) return -1;
while (lpEnv != NULL) {
......@@ -621,28 +665,28 @@ int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
free(lpEnv->Value);
free(lpEnv->Name);
free(lpEnv);
printf("SetEnvironnement() // entry deleted !\n");
dprintf_env(stddeb, "SetEnvironnement() // entry deleted !\n");
return -1;
}
free(lpEnv->Value);
lpEnv->Value = malloc(nCount);
if (lpEnv->Value == NULL) {
printf("SetEnvironment() // Error allocating entry value !\n");
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0;
}
memcpy(lpEnv->Value, lpEnviron, nCount);
lpEnv->wSize = nCount;
printf("SetEnvironnement() // entry modified !\n");
dprintf_env(stddeb, "SetEnvironnement() // entry modified !\n");
return nCount;
}
if (lpEnv->Next == NULL) break;
lpEnv = lpEnv->Next;
}
if (nCount == 0 || lpEnviron == NULL) return -1;
printf("SetEnvironnement() // new entry !\n");
dprintf_env(stddeb, "SetEnvironnement() // new entry !\n");
lpNewEnv = malloc(sizeof(ENVENTRY));
if (lpNewEnv == NULL) {
printf("SetEnvironment() // Error allocating new entry !\n");
dprintf_env(stddeb, "SetEnvironment() // Error allocating new entry !\n");
return 0;
}
if (lpEnvList == NULL) {
......@@ -656,13 +700,13 @@ int SetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nCount)
lpNewEnv->Next = NULL;
lpNewEnv->Name = malloc(strlen(lpPortName) + 1);
if (lpNewEnv->Name == NULL) {
printf("SetEnvironment() // Error allocating entry name !\n");
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry name !\n");
return 0;
}
strcpy(lpNewEnv->Name, lpPortName);
lpNewEnv->Value = malloc(nCount);
if (lpNewEnv->Value == NULL) {
printf("SetEnvironment() // Error allocating entry value !\n");
dprintf_env(stddeb, "SetEnvironment() // Error allocating entry value !\n");
return 0;
}
memcpy(lpNewEnv->Value, lpEnviron, nCount);
......@@ -688,18 +732,18 @@ int GetEnvironment(LPSTR lpPortName, LPSTR lpEnviron, WORD nMaxSiz)
{
WORD nCount;
LPENVENTRY lpEnv = lpEnvList;
printf("GetEnvironnement('%s', '%s', %d) !\n",
dprintf_env(stddeb, "GetEnvironnement('%s', '%s', %d) !\n",
lpPortName, lpEnviron, nMaxSiz);
while (lpEnv != NULL) {
if (lpEnv->Name != NULL && strcmp(lpEnv->Name, lpPortName) == 0) {
nCount = MIN(nMaxSiz, lpEnv->wSize);
memcpy(lpEnviron, lpEnv->Value, nCount);
printf("GetEnvironnement() // found '%s' !\n", lpEnviron);
dprintf_env(stddeb, "GetEnvironnement() // found '%s' !\n", lpEnviron);
return nCount;
}
lpEnv = lpEnv->Next;
}
printf("GetEnvironnement() // not found !\n");
dprintf_env(stddeb, "GetEnvironnement() // not found !\n");
return 0;
}
......
......@@ -20,6 +20,7 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "wine.h"
#include "windows.h"
......@@ -34,8 +35,6 @@ static char Copyright [] = "Copyright (C) 1993 Miguel de Icaza";
#define STRSIZE 255
#define overflow (next == &CharBuffer [STRSIZE-1])
enum { FirstBrace, OnSecHeader, IgnoreToEOL, KeyDef, KeyValue };
typedef struct TKeys {
char *KeyName;
char *Value;
......@@ -93,14 +92,16 @@ static char *GetIniFileName(char *name, char *dir)
static TSecHeader *load (char *filename, char **pfullname)
{
FILE *f;
int state;
TSecHeader *SecHeader = 0;
char CharBuffer [STRSIZE];
char *next = '\0';
char *bufptr;
char *lastnonspc;
int bufsize;
char *file;
char c;
int c;
char path[MAX_PATH+1];
BOOL firstbrace;
*pfullname = NULL;
/* Try the Windows directory */
......@@ -135,96 +136,99 @@ static TSecHeader *load (char *filename, char **pfullname)
*pfullname = strdup(file);
dprintf_profile(stddeb,"Loading %s\n", file);
state = FirstBrace;
next = CharBuffer;
while ((c = fgetc (f)) != EOF){
if (c == '\r') /* Ignore Carriage Return */
firstbrace = TRUE;
for(;;) {
c = fgetc(f);
if (c == EOF) goto finished;
if (isspace(c))
continue;
switch (state){
case OnSecHeader:
if (c == ']' || overflow){
*next = '\0';
next = CharBuffer;
SecHeader->AppName = strdup (CharBuffer);
state = IgnoreToEOL;
dprintf_profile(stddeb,"%s: section %s\n", file, CharBuffer);
} else
*next++ = c;
break;
case IgnoreToEOL:
if (c == '\n'){
state = KeyDef;
next = CharBuffer;
}
break;
case FirstBrace:
case KeyDef:
if (c == '['){
TSecHeader *temp;
temp = SecHeader;
SecHeader = (TSecHeader *) xmalloc (sizeof (TSecHeader));
SecHeader->link = temp;
SecHeader->Keys = 0;
state = OnSecHeader;
next = CharBuffer;
break;
}
if (state == FirstBrace) /* On first pass, don't allow dangling keys */
break;
if (c == '\t')
break;
if (c == '[') {
TSecHeader *temp = SecHeader;
if (c == '\n' || c == ';' || overflow) /* Abort Definition */
next = CharBuffer;
if (c == ';')
{
state = IgnoreToEOL;
break;
}
if (c == '\n')
break;
SecHeader = (TSecHeader *) xmalloc (sizeof (TSecHeader));
SecHeader->link = temp;
SecHeader->Keys = NULL;
do {
c = fgetc(f);
if (c == EOF) goto bad_file;
} while (isspace(c));
bufptr = lastnonspc = CharBuffer;
bufsize = 0;
do {
if (c != ']') {
bufsize++;
*bufptr++ = c;
if (!isspace(c))
lastnonspc = bufptr;
} else
break;
c = fgetc(f);
if (c == EOF) goto bad_file;
} while(bufsize < STRSIZE-1);
*lastnonspc = 0;
if (!strlen(CharBuffer))
fprintf(stderr, "warning: empty section name in ini file\n");
SecHeader->AppName = strdup (CharBuffer);
dprintf_profile(stddeb,"%s: section %s\n", file, CharBuffer);
firstbrace = FALSE;
} else if (SecHeader) {
TKeys *temp = SecHeader->Keys;
BOOL skipspc;
if (c == '=' || overflow){
TKeys *temp;
temp = SecHeader->Keys;
while(next[-1]==' ')next--;
*next = '\0';
SecHeader->Keys = (TKeys *) xmalloc (sizeof (TKeys));
SecHeader->Keys->link = temp;
SecHeader->Keys->KeyName = strdup (CharBuffer);
state = KeyValue;
next = CharBuffer;
dprintf_profile(stddeb,"%s: key %s\n", file, CharBuffer);
} else {
*next++ = c;
}
break;
case KeyValue:
if (overflow || c == '\n'){
*next = '\0';
SecHeader->Keys->Value = strdup (CharBuffer);
state = c == '\n' ? KeyDef : IgnoreToEOL;
next = CharBuffer;
dprintf_profile (stddeb, "[%s] (%s)=%s\n", SecHeader->AppName,
SecHeader->Keys->KeyName, SecHeader->Keys->Value);
} else
*next++ = c;
break;
if (firstbrace)
goto bad_file;
bufptr = lastnonspc = CharBuffer;
bufsize = 0;
do {
if (c != '=') {
bufsize++;
*bufptr++ = c;
if (!isspace(c))
lastnonspc = bufptr;
} else
break;
c = fgetc(f);
if (c == EOF) goto bad_file;
} while(bufsize < STRSIZE-1);
*lastnonspc = 0;
if (!strlen(CharBuffer))
fprintf(stderr, "warning: empty key name in ini file\n");
SecHeader->Keys = (TKeys *) xmalloc (sizeof (TKeys));
SecHeader->Keys->link = temp;
SecHeader->Keys->KeyName = strdup (CharBuffer);
dprintf_profile(stddeb,"%s: key %s\n", file, CharBuffer);
} /* switch */
} /* while ((c = fgetc (f)) != EOF) */
bufptr = lastnonspc = CharBuffer;
bufsize = 0;
skipspc = TRUE;
do {
c = fgetc(f);
if (c == EOF) break;
if (c != '\n') {
if (!isspace(c) || !skipspc) {
skipspc = FALSE;
bufsize++;
*bufptr++ = c;
if (!isspace(c))
lastnonspc = bufptr;
}
} else
break;
} while(bufsize < STRSIZE-1);
*lastnonspc = 0;
SecHeader->Keys->Value = strdup (CharBuffer);
dprintf_profile (stddeb, "[%s] (%s)=%s\n", SecHeader->AppName,
SecHeader->Keys->KeyName, SecHeader->Keys->Value);
}
}
bad_file:
fprintf(stderr, "warning: bad ini file\n");
finished:
return SecHeader;
}
......
......@@ -170,7 +170,7 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
/* 0x0130 */
NULL,
"WM_LBTRACKPOINT",
"wm_lbtrackpoint",
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
......@@ -251,12 +251,12 @@ const char *MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"WM_MDIICONARRANGE", /* 0x0228 */
"WM_MDIGETACTIVE", /* 0x0229 */
"WM_DROPOBJECT",
"WM_QUERYDROPOBJECT",
NULL,
"WM_DRAGLOOP",
"WM_DRAGSELECT",
"WM_DRAGMOVE",
"wm_dropobject",
"wm_querydropobject",
"wm_begindrag",
"wm_dragloop",
"wn_dragselect",
"wm_dragmove",
/* 0x0230*/
"WM_MDISETMENU", /* 0x0230 */
......
......@@ -155,6 +155,8 @@ DWORD USER32_CreateWindowExA(long flags,char* class,char *title,
strcpy( classbuf, class );
titlebuf = alloca( strlen(title)+1 );
strcpy( titlebuf, title );
return CreateWindowEx( flags, MAKE_SEGPTR(classbuf), MAKE_SEGPTR(titlebuf),
style,x,y,width,height,parent,menu,instance,param );
return (DWORD) CreateWindowEx(flags,MAKE_SEGPTR(classbuf),
MAKE_SEGPTR(titlebuf),style,x,y,width,height,
(HWND)parent,(HMENU)menu,(HINSTANCE)instance,
param);
}
......@@ -11,6 +11,10 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/ioctl.h>
#ifdef __svr4__
#include <sys/filio.h>
#include <sys/ioccom.h>
#endif
#include <sys/msg.h>
#include <sys/socket.h>
#include <netinet/in.h>
......@@ -19,6 +23,7 @@
#include <errno.h>
#include <netdb.h>
#include <unistd.h>
#undef TRANSPARENT
#include "winsock.h"
#include "toolhelp.h"
#include "stddebug.h"
......@@ -196,15 +201,15 @@ static WORD wsaerrno(void)
case EPROCLIM: return WSAEPROCLIM;
#endif
case EUSERS: return WSAEUSERS;
#ifdef EDQUOT
case EDQUOT: return WSAEDQUOT;
#endif
case ESTALE: return WSAESTALE;
case EREMOTE: return WSAEREMOTE;
/* just in case we ever get here and there are no problems */
case 0: return 0;
#ifdef EDQUOT
default:
#endif
fprintf(stderr, "winsock: unknown errorno %d!\n", errno);
return WSAEOPNOTSUPP;
}
......@@ -241,9 +246,8 @@ static WORD wsaherrno(void)
/* just in case we ever get here and there are no problems */
case 0: return 0;
#ifdef EDQUOT
default:
#endif
fprintf(stderr, "winsock: unknown h_errorno %d!\n", h_errno);
return WSAEOPNOTSUPP;
}
......
......@@ -555,6 +555,8 @@ void OpenExistingFile(struct sigcontext_struct *context)
{
#ifdef __svr4__
printf("Should call flock and needs porting to lockf\n");
result = 0;
retries = 0;
#else
result = flock(handle, lock | LOCK_NB);
#endif
......@@ -634,7 +636,7 @@ static void MakeDir(struct sigcontext_struct *context)
return;
}
if ((mkdir(dirname,0) == -1) && errno!=EEXIST) {
if ((mkdir(dirname, S_IRWXU | S_IRWXG | S_IRWXO) == -1) && errno!=EEXIST) {
Error( CanNotMakeDir, EC_AccessDenied, EL_Disk );
AX_reg(context) = CanNotMakeDir;
SET_CFLAG(context);
......@@ -693,7 +695,7 @@ static void FindNext(struct sigcontext_struct *context)
struct dosdirent *dp;
struct tm *t;
BYTE *dta = GetCurrentDTA();
memcpy(&dp, dta+0x11, sizeof(dp));
dprintf_int(stddeb, "int21: FindNext, dta %p, dp %p\n", dta, dp);
......@@ -716,13 +718,14 @@ static void FindNext(struct sigcontext_struct *context)
setword(&dta[0x18], ((t->tm_year - 80) << 9) + (t->tm_mon << 5) +
(t->tm_mday)); /* date */
setdword(&dta[0x1a], dp->filesize);
strncpy(dta + 0x1e, dp->filename, 13);
strncpy(dta + 0x1e, dp->filename, 12);
*(dta + 0x1e + 13) = 0;
AnsiUpper(dta+0x1e);
AX_reg(context) = 0;
RESET_CFLAG(context);
dprintf_int(stddeb, "int21: FindNext -- (%s) index=%d size=%ld\n", dp->filename, dp->entnum, dp->filesize);
return;
}
static void FindFirst(struct sigcontext_struct *context)
......@@ -761,6 +764,7 @@ static void FindFirst(struct sigcontext_struct *context)
dp->search_attribute = ECX_reg(context) & (FA_LABEL | FA_DIREC);
memcpy(dta + 0x11, &dp, sizeof(dp));
FindNext(context);
}
static void GetFileDateTime(struct sigcontext_struct *context)
......@@ -1459,6 +1463,9 @@ void DOS3Call( struct sigcontext_struct context )
ioctlGetDeviceInfo(&context);
break;
case 0x01:
break;
case 0x08: /* Check if drive is removable. */
drive = BL_reg(&context) ? (BL_reg(&context) - 1)
: DOS_GetDefaultDrive();
......
......@@ -40,6 +40,8 @@ void INT_Int2fHandler( struct sigcontext_struct context )
case 0x4a:
switch(AL_reg(&context))
{
case 0x10: /* smartdrv */
break; /* not installed */
case 0x12: /* realtime compression interface */
break; /* not installed */
default:
......
......@@ -150,15 +150,20 @@ LONG GetBitmapBits( HBITMAP hbitmap, LONG count, LPSTR buffer )
LONG height;
XImage * image;
/* KLUDGE! */
if (count < 0) {
fprintf(stderr, "Negative number of bytes (%ld) passed to GetBitmapBits???\n", count );
count = -count;
}
bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return 0;
dprintf_bitmap(stddeb, "GetBitmapBits: %dx%d %d colors %p\n",
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, buffer );
/* Only get entire lines */
height = count / bmp->bitmap.bmWidthBytes;
if (height > bmp->bitmap.bmHeight) height = bmp->bitmap.bmHeight;
dprintf_bitmap(stddeb, "GetBitmapBits: %dx%d %d colors %p fetched height: %ld\n",
bmp->bitmap.bmWidth, bmp->bitmap.bmHeight,
1 << bmp->bitmap.bmBitsPixel, buffer, height );
if (!height) return 0;
if (!(image = BITMAP_BmpToImage( &bmp->bitmap, buffer ))) return 0;
......@@ -180,6 +185,11 @@ LONG SetBitmapBits( HBITMAP hbitmap, LONG count, LPSTR buffer )
LONG height;
XImage * image;
/* KLUDGE! */
if (count < 0) {
fprintf(stderr, "Negative number of bytes (%ld) passed to SetBitmapBits???\n", count );
count = -count;
}
bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return 0;
......
......@@ -15,15 +15,15 @@
#include "xmalloc.h"
Colormap COLOR_WinColormap = 0;
int COLOR_FixedMap = 0;
int COLOR_Redshift = 0;
int COLOR_Redmax = 0;
int COLOR_Greenshift = 0;
int COLOR_Greenmax = 0;
int COLOR_Blueshift = 0;
int COLOR_Bluemax = 0;
int COLOR_Graymax = 0;
static int COLOR_FixedMap = 0;
static int COLOR_Redshift = 0;
static int COLOR_Redmax = 0;
static int COLOR_Greenshift = 0;
static int COLOR_Greenmax = 0;
static int COLOR_Blueshift = 0;
static int COLOR_Bluemax = 0;
static int COLOR_Graymax = 0;
/* System palette static colors */
......
......@@ -33,6 +33,7 @@
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#include "task.h"
Cursor CURSORICON_XCursor = None; /* Current X cursor */
......@@ -411,6 +412,40 @@ static HANDLE CURSORICON_Copy( HANDLE hInstance, HANDLE handle )
return hNew;
}
/***********************************************************************
* CURSORICON_IconToCursor
*
* Should convert bitmap to mono and truncate if too large
* FIXME: if icon is passed returns a copy of OCR_DRAGOBJECT cursor
* but should actually convert icon to cursor.
*/
HCURSOR CURSORICON_IconToCursor(HICON hIcon)
{
CURSORICONINFO *ptr = NULL;
if(hIcon)
if (!(ptr = (CURSORICONINFO*)GlobalLock( hIcon ))) return FALSE;
if (ptr->bPlanes * ptr->bBitsPerPixel == 1)
{
return hIcon; /* assuming it's a cursor */
}
else
{
/* kludge */
HTASK hTask = GetCurrentTask();
TDB* pTask = (TDB *)GlobalLock(hTask);
if(!pTask) return 0;
fprintf( stdnimp, "IconToCursor: Icons are not supported, returning default!\n");
return CURSORICON_Copy( pTask->hInstance ,
CURSORICON_Load(0,MAKEINTRESOURCE(OCR_DRAGOBJECT),
SYSMETRICS_CXCURSOR, SYSMETRICS_CYCURSOR, 1, TRUE) );
}
return 0;
}
/***********************************************************************
* LoadCursor (USER.173)
......@@ -453,7 +488,7 @@ HICON LoadIcon( HANDLE hInstance, SEGPTR name )
HICON CreateCursor( HANDLE hInstance, INT xHotSpot, INT yHotSpot,
INT nWidth, INT nHeight, LPSTR lpANDbits, LPSTR lpXORbits)
{
CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 1, 1 };
CURSORICONINFO info = { { xHotSpot, yHotSpot }, nWidth, nHeight, 0, 1, 1 };
dprintf_cursor( stddeb, "CreateCursor: %dx%d spot=%d,%d xor=%p and=%p\n",
nWidth, nHeight, xHotSpot, yHotSpot, lpXORbits, lpANDbits);
......@@ -467,7 +502,7 @@ HICON CreateCursor( HANDLE hInstance, INT xHotSpot, INT yHotSpot,
HICON CreateIcon( HANDLE hInstance, INT nWidth, INT nHeight, BYTE bPlanes,
BYTE bBitsPixel, LPSTR lpANDbits, LPSTR lpXORbits)
{
CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, bPlanes, bBitsPixel };
CURSORICONINFO info = { { 0, 0 }, nWidth, nHeight, 0, bPlanes, bBitsPixel };
dprintf_icon( stddeb, "CreateIcon: %dx%dx%d, xor=%p, and=%p\n",
nWidth, nHeight, bPlanes * bBitsPixel, lpXORbits, lpANDbits);
......@@ -584,16 +619,17 @@ BOOL DrawIcon( HDC hdc, short x, short y, HICON hIcon )
/***********************************************************************
* DumpIcon (USER.459)
*/
DWORD DumpIcon( CURSORICONINFO *info, WORD *lpLen,
LPSTR *lpXorBits, LPSTR *lpAndBits )
DWORD DumpIcon( SEGPTR pInfo, WORD *lpLen,
SEGPTR *lpXorBits, SEGPTR *lpAndBits )
{
CURSORICONINFO *info = PTR_SEG_TO_LIN( pInfo );
int sizeAnd, sizeXor;
if (!info) return 0;
sizeXor = info->nHeight * info->nWidthBytes;
sizeAnd = info->nHeight * ((info->nWidth + 15) / 16 * 2);
if (lpAndBits) *lpAndBits = (LPSTR)(info + 1);
if (lpXorBits) *lpXorBits = (LPSTR)(info + 1) + sizeAnd;
if (lpAndBits) *lpAndBits = pInfo + sizeof(CURSORICONINFO);
if (lpXorBits) *lpXorBits = pInfo + sizeof(CURSORICONINFO) + sizeAnd;
if (lpLen) *lpLen = sizeof(CURSORICONINFO) + sizeAnd + sizeXor;
return MAKELONG( sizeXor, sizeXor );
}
......
......@@ -7,6 +7,7 @@ static char Copyright[] = "Copyright David W. Metcalfe, 1994";
*/
#include <string.h>
#include <fcntl.h>
#include "gdi.h"
#include "bitmap.h"
#include "metafile.h"
......@@ -407,7 +408,7 @@ void PlayMetaFileRecord(HDC hdc, HANDLETABLE *ht, METARECORD *mr,
break;
case META_RECTANGLE:
Ellipse(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
Rectangle(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
break;
......@@ -575,7 +576,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf)
HANDLE hMem = mf->hMetaHdr;
METAHEADER *mh = (METAHEADER *)GlobalLock(hMem);
dprintf_metafile(stddeb,"GetMetaFileBits: hmf in: %x\n", hmf);
dprintf_metafile(stddeb,"GetMetaFileBits: hmf in: "NPFMT"\n", hmf);
/* can't get bits of disk based metafile */
/* FIXME: should the disk file be loaded in this case? */
......@@ -591,7 +592,7 @@ HANDLE GetMetaFileBits(HMETAFILE hmf)
GlobalUnlock(hMem);
GlobalFree(hmf);
dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: %x\n", hMem);
dprintf_metafile(stddeb,"GetMetaFileBits: hMem out: "NPFMT"\n", hMem);
return hMem;
}
......@@ -607,7 +608,7 @@ HMETAFILE SetMetaFileBits(HANDLE hMem)
METAFILE *mf;
METAHEADER *mh = (METAHEADER *)GlobalLock(hMem);
dprintf_metafile(stddeb,"SetMetaFileBits: hMem in: %x\n", hMem);
dprintf_metafile(stddeb,"SetMetaFileBits: hMem in: "NPFMT"\n", hMem);
if (!mh) return FALSE;
......@@ -626,12 +627,12 @@ HMETAFILE SetMetaFileBits(HANDLE hMem)
mf->hMetaHdr = hMem;
mf->wMagic = METAFILE_MAGIC;
mf->MetaOffset = mh->mtHeaderSize * 2;
mf->hFile = mf->hBuffer = (HANDLE) NULL;
mf->hFile = (int) (mf->hBuffer = (HANDLE) NULL);
GlobalUnlock(hMem);
GlobalUnlock(hmf);
dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: %x\n", hmf);
dprintf_metafile(stddeb,"SetMetaFileBits: hmf out: "NPFMT"\n", hmf);
return hmf;
}
......
......@@ -167,19 +167,31 @@ static char **OBM_Icons_Data[OIC_LAST-OIC_FIRST+1] =
#include "bitmaps/ocr_sizenesw"
#include "bitmaps/ocr_sizewe"
#include "bitmaps/ocr_sizens"
#include "bitmaps/ocr_bummer"
#include "bitmaps/ocr_dragobject"
#if 0
#include "bitmaps/ocr_sizeall"
#include "bitmaps/ocr_icocur"
#endif
/* Cursor are not all contiguous (go figure...) */
#define OCR_FIRST0 OCR_BUMMER
#define OCR_LAST0 OCR_DRAGOBJECT
#define OCR_BASE0 0
#define OCR_FIRST1 OCR_NORMAL
#define OCR_LAST1 OCR_UP
#define OCR_BASE1 (OCR_BASE0 + OCR_LAST0 - OCR_FIRST0 + 1)
#define OCR_FIRST2 OCR_SIZE
#define OCR_LAST2 OCR_SIZENS /* OCR_ICOCUR */
#define NB_CURSORS (OCR_LAST2 - OCR_FIRST2 + 1 + OCR_LAST1 - OCR_FIRST1 + 1)
#define OCR_LAST2 OCR_SIZENS
#define OCR_BASE2 (OCR_BASE1 + OCR_LAST1 - OCR_FIRST1 + 1)
#define NB_CURSORS (OCR_BASE2 + OCR_LAST2 - OCR_FIRST2 + 1)
static char **OBM_Cursors_Data[NB_CURSORS] =
{
ocr_bummer, /* OCR_BUMMER */
ocr_dragobject,/* OCR_DRAGOBJECT */
ocr_normal, /* OCR_NORMAL */
ocr_ibeam, /* OCR_IBEAM */
ocr_wait, /* OCR_WAIT */
......@@ -389,9 +401,11 @@ HANDLE OBM_LoadCursorIcon( WORD id, BOOL fCursor )
if (fCursor)
{
if ((id >= OCR_FIRST1) && (id <= OCR_LAST1))
id -= OCR_FIRST1;
id = OCR_BASE1 + id - OCR_FIRST1;
else if ((id >= OCR_FIRST2) && (id <= OCR_LAST2))
id += (OCR_LAST1 - OCR_FIRST1 + 1) - OCR_FIRST2;
id = OCR_BASE2 + id - OCR_FIRST2;
else if ((id >= OCR_FIRST0) && (id <= OCR_LAST0))
id = OCR_BASE0 + id - OCR_FIRST0;
else return 0;
if (OBM_Cursors[id]) return OBM_Cursors[id];
}
......
......@@ -135,8 +135,17 @@ WORD SetPaletteEntries( HPALETTE hpalette, WORD start, WORD count,
*/
BOOL ResizePalette(HPALETTE hPal, UINT cEntries)
{
fprintf(stdnimp,"ResizePalette: empty stub! \n");
return FALSE;
fprintf(stdnimp,"ResizePalette: empty stub! \n");
return FALSE;
}
/***********************************************************************
* AnimatePalette (GDI.367)
*/
void AnimatePalette(HPALETTE hPal, UINT StartIndex, UINT NumEntries,
LPPALETTEENTRY PaletteColors)
{
fprintf(stdnimp,"AnimatePalette: empty stub! \n");
}
/***********************************************************************
......
......@@ -36,5 +36,5 @@ langclean::
y.tab.o: y.tab.c y.tab.h parser.h
lex.yy.o: lex.yy.c y.tab.h parser.h
winerc.o: $(TOPSRC)/include/windows.h $(TOPSRC)/include/neexe.h parser.h y.tab.h
### Dependencies:
......@@ -539,13 +539,16 @@ void create_output(gen_res* top)
fprintf( header, "/* %s\n"
" * This file is automatically generated. Do not edit!\n"
" */\n\n"
"#ifndef __RESOURCE_DEFINED__\n"
"#define __RESOURCE_DEFINED__\n"
"struct resource\n"
"{\n"
" int id, type;\n"
" char *name;\n"
" unsigned char *bytes;\n"
" unsigned int size;\n"
"};\n\n", hname );
"};\n"
"#endif\n", hname );
/* Declare the resources */
......
......@@ -7,6 +7,7 @@ C_SRCS = \
atom.c \
arch.c \
heap.c \
libres.c \
miscstubs.c \
sup.c \
winmain.c
......
WINElib resources: a proposal
One of the current issues with WINElib is the inadequate support for accessing
resources by name. I propose the following technique (which I have already
begun to implement) to allow this:
An internal table of resource entries is provided along with a registering
function for adding a resource to this table. 'winerc' should construct
*.c files much the same way as it does now with the inclusion of a single
static 'constructor' function that registers the associated resources with
the internal mechanism like so:
static void DoIt() __attribute__ ((constructor));
static void DoIt()
{
LIBRES_RegisterResource(hello3_MENU_MAIN__bytes,
sizeof(hello3_MENU_MAIN__bytes),
"MAIN",
RT_MENU);
LIBRES_RegisterResource(hello3_DIALOG_DIADEMO__bytes,
sizeof(hello3_DIALOG_DIADEMO__bytes),
"DIADEMO",
RT_DIALOG);
... etc. ...
}
The internal table can then be searched for the resource by name.
The only potential drawback I've determined so far is this technique's
reliance on gcc's 'constructor' attribute, which disallows compilation with
some other compiler. However, I'm guessing that WINE is already heavily
dependent on gcc, so this is probably not too much of a factor.
Any comments/suggestions/criticisms will be greatly appreciated.
Thank you,
--Jim
......@@ -211,47 +211,13 @@ DWORD int GlobalHandle(WORD selector)
#else /* WINELIB16 */
#ifdef DEBUG_HEAP
static void* LastTwenty[20]={ 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0 };
void CheckMem(void* f)
{
int i;
for(i=0; i<20; i++)
{
if(LastTwenty[i]==f)
LastTwenty[i]=NULL;
else if(LastTwenty[i])
if( *((int*)LastTwenty[i]) != 0x12345678 ||
*(((int*)LastTwenty[i])+1) != 0x0fedcba9 )
fprintf(stderr,"memory corrupted at %p\n",LastTwenty[i]);
}
fflush(stderr);
}
void NewMem(void* n)
{
int i;
for(i=0; i<20; i++)
if(!LastTwenty[i])
{
LastTwenty[i]=n;
return;
}
for(i=0; i<20; i++)
LastTwenty[i]=LastTwenty[i+1];
LastTwenty[4]=n;
}
#endif
typedef struct { DWORD Size; DWORD Padding[3]; } HeapData;
HANDLE LocalAlloc (WORD flags, WORD bytes)
HANDLE HEAP_Alloc (WORD flags, DWORD bytes)
{
HANDLE m;
#ifdef DEBUG_HEAP
bytes+=2*sizeof(int);
#endif
HeapData* m;
bytes+=sizeof(HeapData);
if (flags & LMEM_WINE_ALIGN)
m = memalign (4, bytes);
else
......@@ -260,125 +226,118 @@ HANDLE LocalAlloc (WORD flags, WORD bytes)
if (flags & LMEM_ZEROINIT)
bzero (m, bytes);
}
#ifdef DEBUG_HEAP
CheckMem(NULL);
*((int*) m)=0x12345678;
*(((int*) m)+1)=0x0fedcba9;
fprintf(stderr,"%p malloc'd\n",m); fflush(stderr);
NewMem(m);
return (HANDLE) (((int*)m)+2);
#endif
return m;
m->Size=bytes-sizeof(HeapData);
return m+1;
}
WORD LocalCompact (WORD min_free)
HANDLE HEAP_Free (HANDLE hMem)
{
return min_free;
HeapData* m=(HeapData*)hMem;
free(m-1);
return 0;
}
WORD LocalFlags (HANDLE hMem)
DWORD HEAP_Size (HANDLE hMem)
{
return 0;
HeapData* m=(HeapData*)hMem;
return (m-1)->Size;
}
HANDLE HEAP_ReAlloc(HANDLE hMem,DWORD bytes,UINT flags)
{
HeapData* m=(HeapData*)hMem;
if(!bytes)
{
free(m-1);
return 0; /* Inaccurate behavior, but should suffice */
}
m=realloc (m-1, bytes+sizeof(HeapData));
if(flags & LMEM_ZEROINIT && bytes > m->Size)
bzero ((char*)m+sizeof(HeapData)+m->Size, bytes-m->Size);
m->Size=bytes;
return m+1;
}
HANDLE LocalAlloc (WORD flags, WORD bytes)
{
return HEAP_Alloc(flags,bytes);
}
UINT LocalFlags (HANDLE hMem)
{
return 0;
}
HANDLE LocalFree (HANDLE hMem)
{
#ifdef DEBUG_HEAP
hMem=(HANDLE) (((int*)hMem)-2);
CheckMem(hMem);
fprintf(stderr,"%p free-ing...",hMem);
if( *((int*)hMem) != 0x12345678 ||
*(((int*)hMem)+1) != 0x0fedcba9 )
fprintf(stderr,"memory corrupted...");
else
{
*((int*)hMem) = 0x9abcdef0;
*(((int*)hMem)+1) = 0x87654321;
}
fflush(stderr);
#endif
free(hMem);
#ifdef DEBUG_HEAP
fprintf(stderr,"free'd\n"); fflush(stderr);
#endif
return 0;
return HEAP_Free(hMem);
}
BOOL LocalInit (HANDLE segment, WORD start, WORD end)
{
return TRUE;
return TRUE;
}
LPVOID LocalLock (HANDLE hMem)
{
return hMem;
return hMem;
}
HANDLE LocalReAlloc (HANDLE hMem, WORD flags, WORD bytes)
HANDLE LocalReAlloc (HANDLE hMem, WORD new_size, WORD flags)
{
#ifdef DEBUG_HEAP
LocalFree(hMem);
return LocalAlloc(flags,bytes);
#endif
return realloc(hMem, bytes);
if (!(flags & LMEM_MODIFY))
return HEAP_ReAlloc (hMem, new_size, flags);
else
return hMem;
}
WORD LocalSize (HANDLE hMem)
UINT LocalSize (HANDLE hMem)
{
/* Not implemented yet */
return 0;
return HEAP_Size(hMem);
}
BOOL LocalUnlock (HANDLE hMem)
{
return 0;
return 0;
}
HANDLE GlobalAlloc (WORD flags, DWORD size)
{
return LocalAlloc (flags, size);
return HEAP_Alloc (flags,size);
}
HANDLE GlobalFree (HANDLE hMem)
{
return LocalFree (hMem);
return HEAP_Free (hMem);
}
LPVOID GlobalLock (HGLOBAL hMem)
{
return LocalLock (hMem);
return hMem;
}
BOOL GlobalUnlock (HANDLE hMem)
{
return LocalUnlock (hMem);
return 0;
}
WORD GlobalFlags (HANDLE hMem)
{
return LocalFlags (hMem);
return LocalFlags (hMem);
}
DWORD GlobalSize (HANDLE hMem)
{
return LocalSize (hMem);
}
DWORD GlobalCompact(DWORD desired)
{
if (desired)
return desired;
else
return 0x01000000; /* Should check the available core. */
return HEAP_Size (hMem);
}
HANDLE GlobalReAlloc(HANDLE hMem, DWORD new_size, WORD flags)
{
if (!(flags & GMEM_MODIFY))
return LocalReAlloc (hMem, new_size, flags);
else
return hMem;
if (!(flags & GMEM_MODIFY))
return HEAP_ReAlloc (hMem, new_size, flags);
else
return hMem;
}
#endif
#include <windows.h>
#include "hello3res.h"
#include <commdlg.h>
BOOL FileOpen(HWND hWnd)
{
char filename[80] = "test.c";
OPENFILENAME ofn = { sizeof(OPENFILENAME),
hWnd, NULL, "C code\0*.c\0", NULL, 0, 0, filename, 80,
NULL, 0, NULL, NULL, OFN_CREATEPROMPT |
OFN_SHOWHELP, 0, 0, NULL, 0, NULL };
return GetOpenFileName(&ofn);
}
BOOL CALLBACK DlgProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam)
{
......@@ -37,6 +48,9 @@ LRESULT WndProc (HWND wnd, UINT msg, WPARAM w, LPARAM l)
ReleaseDC(wnd,hdc);
return 0;
}
case 102:
FileOpen(wnd);
return 0;
default:
return DefWindowProc (wnd, msg, w, l);
}
......
......@@ -3,6 +3,7 @@ MAIN MENU
POPUP "Menu demo" {
MENUITEM "Dialog Demo", 100
MENUITEM "Bitmap Demo", 101
MENUITEM "Open...", 102
}
}
......@@ -14,13 +15,10 @@ BEGIN
CONTROL "Pushbutton", 100, "BUTTON", BS_PUSHBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 14, 92, 52, 13
CONTROL "Checkbox", 101, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 76, 47, 12
CONTROL "Static text", 102, "STATIC", SS_LEFT | WS_CHILD | WS_VISIBLE, 17, 60, 39, 10
#if 0
/* Edit controls don't work, yet */
CONTROL "Edit control", 103, "EDIT", ES_LEFT | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP, 18, 41, 44, 13
#endif
CONTROL "Radio button", 104, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE, 17, 23, 58, 12
CONTROL "Checkbox", 101, "BUTTON", BS_AUTOCHECKBOX | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 19, 76, 47, 12
#if 0
#if 1
CONTROL "", 106, "COMBOBOX", CBS_DROPDOWN | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85
#else
CONTROL "", 106, "LISTBOX", LBS_STANDARD | LBS_DISABLENOSCROLL | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 86, 23, 86, 85
......
/*
* WINElib-Resources
*
* Copied and modified heavily from loader/resource.c
*/
#include <stdio.h>
#include "windows.h"
struct resource /* This needs to coincide with what winerc generates. */
{ /* It should really only appear in one place. */
int id, type;
char *name;
unsigned char *bytes;
unsigned int size;
};
typedef struct RLE
{
struct resource** Resources /* NULL-terminated array of pointers */
struct RLE* next;
} ResListE;
static ResListE* ResourceList=NULL;
void LIBRES_RegisterResources(struct resource** Res)
{
ResListE** Curr;
ResListE* n;
for(Curr=&ResourceList; *Curr; Curr=&((*Curr)->next)) { }
n=malloc(sizeof(ResListE));
if(n)
{
n.Resources=Res;
n.next=NULL;
*Curr=n;
}
else
fprintf(stderr,"LIBRES_RegisterResources(): Out of memory.\n");
}
/**********************************************************************
* LIBRES_FindResource
*/
HRSRC LIBRES_FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
{
WINELIB_UNIMP("LIBRES_FindResource()");
return 0;
}
/**********************************************************************
* LIBRES_LoadResource
*/
HGLOBAL LIBRES_LoadResource( HMODULE hModule, HRSRC hRsrc )
{
return (HGLOBAL)(((struct resource*)hRsrc)->bytes);
}
/**********************************************************************
* LIBRES_LockResource
*/
LPVOID LIBRES_LockResource( HMODULE hModule, HGLOBAL handle )
{
return handle;
}
/**********************************************************************
* LIBRES_FreeResource
*/
BOOL LIBRES_FreeResource( HMODULE hModule, HGLOBAL handle )
{
return 0;
}
/**********************************************************************
* LIBRES_AccessResource
*/
INT LIBRES_AccessResource( HINSTANCE hModule, HRSRC hRsrc )
{
WINELIB_UNIMP("LIBRES_AccessResource()");
return -1;
}
/**********************************************************************
* LIBRES_SizeofResource
*/
DWORD LIBRES_SizeofResource( HMODULE hModule, HRSRC hRsrc )
{
return (HGLOBAL)(((struct resource*)hRsrc)->size);
}
/**********************************************************************
* LIBRES_AllocResource
*/
HGLOBAL LIBRES_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
{
WINELIB_UNIMP("LIBRES_AllocResource()");
return 0;
}
......@@ -48,43 +48,20 @@ void GlobalFreeAll(HANDLE owner)
fprintf(stderr,"JBP: GlobalFreeAll() ignored.\n");
}
SEGPTR WIN16_GlobalLock(HGLOBAL h)
{
return (SEGPTR)h;
}
HLOCAL LOCAL_Free( WORD ds, HLOCAL handle )
{
return LocalFree(handle);
}
HLOCAL LOCAL_Alloc( WORD ds, WORD flags, WORD size )
{
return LocalAlloc(flags,size);
}
HLOCAL LOCAL_ReAlloc( WORD ds, HLOCAL handle, WORD size, WORD flags )
{
return LocalReAlloc(handle,size,flags);
}
SEGPTR WIN16_GlobalLock(HGLOBAL h)
{ return (SEGPTR)h; }
HLOCAL LOCAL_Free(WORD ds, HLOCAL handle)
{ return LocalFree(handle); }
HLOCAL LOCAL_Alloc(WORD ds, WORD flags, WORD size)
{ return LocalAlloc(flags,size); }
HLOCAL LOCAL_ReAlloc(WORD ds, HLOCAL handle, WORD size, WORD flags)
{ return LocalReAlloc(handle,size,flags); }
NPVOID LOCAL_Lock( WORD ds, HLOCAL handle )
{
return LocalLock(handle);
}
{ return LocalLock(handle); }
BOOL LOCAL_Unlock( WORD ds, HLOCAL handle )
{
fprintf(stderr,"JBP: LOCAL_Unlock() ignored.\n");
return 1;
}
{ return LocalUnlock(handle); }
WORD LOCAL_Size( WORD ds, HLOCAL handle )
{
fprintf(stderr,"JBP: LOCAL_Size() ignored.\n");
return 0;
}
{ return LocalSize(handle); }
void FarSetOwner(HANDLE a, WORD b)
{
......
......@@ -30,6 +30,7 @@
#define TYPE_RETURN 8
#define TYPE_STUB 9
#define TYPE_STDCALL 10
#define TYPE_CDECL 11
#define MAX_ORDINALS 1299
......@@ -83,6 +84,17 @@ static int debugging = 1;
#define CONTEXTOFFSET(reg) \
((int)&(((struct sigcontext_struct *)1)->reg) - 1 \
- sizeof(struct sigcontext_struct))
#ifdef __svr4__
#define sc_eax uc_mcontext.gregs[EAX]
#define sc_ebx uc_mcontext.gregs[EBX]
#define sc_ecx uc_mcontext.gregs[ECX]
#define sc_edx uc_mcontext.gregs[EDX]
#define sc_esi uc_mcontext.gregs[ESI]
#define sc_edi uc_mcontext.gregs[EDI]
#define sc_ds uc_mcontext.gregs[DS]
#define sc_es uc_mcontext.gregs[ES]
#define sc_eflags uc_mcontext.gregs[EFL]
#endif
static void *xmalloc (size_t size)
{
......@@ -313,6 +325,8 @@ static int ParseExportFunction(int ordinal, int type)
fdp->arg_types[i] = 'l';
else if (!strcmp(token, "ptr"))
fdp->arg_types[i] = 'p';
else if (!strcmp(token, "..."))
fdp->arg_types[i] = '.';
else
{
fprintf(stderr, "%d: Unknown variable type '%s'\n", Line, token);
......@@ -436,6 +450,8 @@ static int ParseOrdinal(int ordinal)
return ParseExportFunction(ordinal, TYPE_REGISTER);
else if (strcmp(token, "stdcall") == 0)
return ParseExportFunction(ordinal, TYPE_STDCALL);
else if (strcmp(token, "cdecl") == 0)
return ParseExportFunction(ordinal, TYPE_CDECL);
else if (strcmp(token, "equate") == 0)
return ParseEquate(ordinal);
else if (strcmp(token, "return") == 0)
......@@ -732,6 +748,7 @@ static void BuildSpec32Files( char *specname )
ORDFUNCDEF *fdp;
ORDRETDEF *rdp;
int i;
int varargs;
SpecFp = fopen( specname, "r");
if (SpecFp == NULL)
......@@ -744,6 +761,7 @@ static void BuildSpec32Files( char *specname )
printf( "/* File generated automatically, do not edit! */\n" );
printf( "#include <sys/types.h>\n");
printf( "#include <stdarg.h>\n");
printf( "#include \"windows.h\"\n");
printf( "#include \"dlls.h\"\n");
printf( "#include \"pe_image.h\"\n");
......@@ -768,48 +786,56 @@ static void BuildSpec32Files( char *specname )
printf( "\t/*NOTREACHED*/\n\treturn 0;\n}\n\n");
break;
case TYPE_STDCALL:
case TYPE_CDECL:
varargs=0;
argc=strlen(fdp->arg_types);
printf( "void %s_%d(", UpperDLLName, i);
printf( "void %s_%d(", UpperDLLName, i);
for(argno=0;argno<argc;argno++)
{
switch(fdp->arg_types[argno])
{
case 'p': printf( "void *");break;
case 'l': printf( "int ");break;
case '.': printf( "... ");varargs=argno;break;
default:
fprintf(stderr, "Not supported argument type %c\n",
fdp->arg_types[argno]);
exit(1);
}
putchar( 'a'+argno );
if(fdp->arg_types[argno]!='.') putchar( 'a'+argno );
if (argno!=argc-1) putchar( ',' );
}
printf( ")\n{\n" );
printf( ")" );
if(odp->type == TYPE_STDCALL) printf(" /*__attribute__ ((stdcall))*/");
printf( "\n{\n" );
if (varargs) printf( "\tva_list valist;\n\n\tva_start(valist, %c);",
'a'+varargs-1 );
printf( "\tdprintf_relay(stddeb,\"Call %%s.%%s(");
for (argno=0;argno<argc;argno++)
{
if(fdp->arg_types[argno]!='.')
{
putchar( '%' );
putchar( (fdp->arg_types[argno] == 'p') ? 'p' : 'x' );
if (argno < argc-1) putchar( ',' );
}
}
printf( ")\\n\", \"%s\", \"%s\"", UpperDLLName, odp->export_name);
for(argno=0;argno<argc;argno++) printf( ",%c", 'a'+argno);
for(argno=0;argno<argc;argno++)
if(fdp->arg_types[argno]!='.') printf( ",%c", 'a'+argno);
printf( ");\n\t%s(", fdp->internal_name );
for(argno=0;argno<argc;argno++)
{
putchar('a'+argno);
if (fdp->arg_types[argno]=='.') printf("valist");
else putchar('a'+argno);
if (argno!=argc-1) putchar(',');
}
printf( ");\n\t__asm__ __volatile__(\"movl %%ebp,%%esp;"
"popl %%ebp;ret $%d\");\n}\n\n",
4*argc);
printf( ");\n}\n\n");
break;
case TYPE_RETURN:
printf( "void %s_%d()\n{\n\t", UpperDLLName, i);
printf( "RELAY32_DebugEnter(\"%s\",\"%s\");\n\t",
UpperDLLName, odp->export_name);
printf( "WIN32_LastError=ERROR_CALL_NOT_IMPLEMENTED;\n");
printf( "\t__asm__ __volatile__ (\"movl %d,%%eax\");\n",
printf( "\t__asm__ __volatile__ (\"movl $%d,%%eax\");\n",
rdp->ret_value);
printf( "\t__asm__ __volatile__ (\"movl %%ebp,%%esp;popl %%ebp;"
"ret $%d\");\n}\n\n", rdp->arg_size);
......@@ -836,6 +862,7 @@ static void BuildSpec32Files( char *specname )
break;
case TYPE_RETURN:
case TYPE_STDCALL:
case TYPE_CDECL:
case TYPE_STUB:
printf( "{\"%s\",%s_%d},\n", odp->export_name, UpperDLLName, i);
break;
......
......@@ -2,12 +2,16 @@ TOPSRC = @top_srcdir@
MODULE = win32
C_SRCS = \
advapi.c \
code_page.c \
console.c \
environment.c \
error.c \
file.c \
init.c \
memory.c \
object_mgt.c \
process.c \
thread.c \
time.c
......
/*
* Win32 advapi functions
*
* Copyright 1995 Martin von Loewis
*/
#include <stdio.h>
#include <unistd.h>
#include "windows.h"
#include "winerror.h"
/*#include "kernel32.h"*/
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* GetUserNameA (ADVAPI32.67)
*/
int GetUserNameA(LPSTR lpszName, LPDWORD lpSize)
{
size_t len;
char *name;
name=getlogin();
len = name ? strlen(name) : 0;
if (!len || !lpSize || len > *lpSize) {
if (lpszName) *lpszName = 0;
return 0;
}
*lpSize=len;
strcpy(lpszName, name);
return 1;
}
......@@ -8,6 +8,9 @@
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* GetACP (KERNEL32.148)
......@@ -36,3 +39,11 @@ UINT GetOEMCP(void)
return 437; /* MS-DOS United States */
}
/***********************************************************************
* MultiByteToWideChar (KERNEL32.392)
*/
int MultiByteToWideChar(UINT page, DWORD flags, char *src, int srclen,
WCHAR *dst, int dstlen)
{
return (srclen==-1) ? strlen(src) * 2: srclen*2;
}
/*
* Win32 kernel functions
*
* Copyright 1995 Martin von Loewis and Cameron Heide
*/
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "wincon.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* SetConsoleCtrlHandler (KERNEL32.459)
*/
BOOL SetConsoleCtrlHandler(HANDLER_ROUTINE * func, BOOL a)
{
return 0;
}
......@@ -10,6 +10,8 @@
#include "winerror.h"
#include "kernel32.h"
#include "task.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
......@@ -20,7 +22,7 @@ LPSTR GetCommandLineA(void)
static char buffer[256];
PDB *pdb = (PDB *)GlobalLock( GetCurrentPDB() );
memcpy( buffer, &pdb->cmdLine[1], pdb->cmdLine[0] );
printf("CommandLine = %s\n", buffer );
dprintf_win32(stddeb,"CommandLine = %s\n", buffer );
return buffer;
}
......@@ -8,6 +8,8 @@
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "stddebug.h"
#include "debug.h"
static int WIN32_LastError;
......
......@@ -7,9 +7,48 @@
#include <errno.h>
#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "handle32.h"
#include "dos_fs.h"
#include "stddebug.h"
#define DEBUG_WIN32
#include "debug.h"
extern FILE_OBJECT *hstdin;
extern FILE_OBJECT *hstdout;
extern FILE_OBJECT *hstderr;
static int TranslateCreationFlags(DWORD create_flags);
static int TranslateAccessFlags(DWORD access_flags);
/***********************************************************************
* GetFileInformationByHandle (KERNEL32.219)
*
*/
HANDLE WINAPI CreateFileA(const char * filename, DWORD a, DWORD b, void * c,
DWORD d, DWORD e, DWORD f)
{
dprintf_win32(stderr, "CreateFileA: %s\n", filename);
return -1;
}
/***********************************************************************
* GetFileInformationByHandle (KERNEL32.219)
*
*/
DWORD WINAPI GetFileInformationByHandle(HANDLE hFile,
BY_HANDLE_FILE_INFORMATION *lpfi)
{
memset(lpfi, 0, sizeof(BY_HANDLE_FILE_INFORMATION));
return 1;
}
/***********************************************************************
* GetFileType (KERNEL32.222)
......@@ -17,34 +56,50 @@
* GetFileType currently only supports stdin, stdout, and stderr, which
* are considered to be of type FILE_TYPE_CHAR.
*/
DWORD GetFileType(HANDLE hFile)
DWORD GetFileType(FILE_OBJECT *hFile)
{
DWORD file_type;
if((DWORD)hFile < 3)
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
file_type = 2; /* FILE_TYPE_CHAR */
SetLastError(ERROR_UNKNOWN);
return FILE_TYPE_UNKNOWN;
}
else
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
file_type = 0; /* FILE_TYPE_UNKNOWN */
SetLastError(ERROR_UNKNOWN);
return FILE_TYPE_UNKNOWN;
}
return file_type;
return hFile->type;
}
/***********************************************************************
* GetStdHandle (KERNEL32.276)
*/
HANDLE GetStdHandle(DWORD nStdHandle)
HANDLE32 GetStdHandle(DWORD nStdHandle)
{
switch(nStdHandle)
{
case -10/*STD_INPUT_HANDLE*/:return (HANDLE)0;
case -11/*STD_OUTPUT_HANDLE*/:return (HANDLE)1;
case -12/*STD_ERROR_HANDLE*/:return (HANDLE)2;
}
return (HANDLE)-1;
HANDLE32 rc;
switch(nStdHandle)
{
case STD_INPUT_HANDLE:
rc = (HANDLE32)hstdin;
break;
case STD_OUTPUT_HANDLE:
rc = (HANDLE32)hstdout;
break;
case STD_ERROR_HANDLE:
rc = (HANDLE32)hstderr;
break;
default:
rc = INVALID_HANDLE_VALUE;
SetLastError(ERROR_UNKNOWN);
break;
}
return rc;
}
/***********************************************************************
......@@ -53,21 +108,32 @@ HANDLE GetStdHandle(DWORD nStdHandle)
* Luckily enough, this function maps almost directly into an lseek
* call, the exception being the use of 64-bit offsets.
*/
DWORD SetFilePointer(HANDLE hFile, LONG distance, LONG *highword,
DWORD SetFilePointer(FILE_OBJECT *hFile, LONG distance, LONG *highword,
DWORD method)
{
int rc;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_UNKNOWN);
return ((DWORD)0xFFFFFFFF);
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_UNKNOWN);
return ((DWORD)0xFFFFFFFF);
}
if(highword != NULL)
{
if(*highword != 0)
{
printf("SetFilePointer: 64-bit offsets not yet supported.\n");
dprintf_win32(stddeb, "SetFilePointer: 64-bit offsets not yet supported.\n");
return -1;
}
}
rc = lseek((DWORD)hFile, distance, method);
rc = lseek(hFile->fd, distance, method);
if(rc == -1)
SetLastError(ErrnoToLastError(errno));
return rc;
......@@ -75,22 +141,203 @@ DWORD SetFilePointer(HANDLE hFile, LONG distance, LONG *highword,
/***********************************************************************
* WriteFile (KERNEL32.578)
*
* WriteFile isn't very useful at this point since only standard
* handles are permitted, but it lets us see runtime errors at least.
*/
BOOL WriteFile(HANDLE hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
LPDWORD numberOfBytesWritten, LPOVERLAPPED lpOverlapped)
BOOL WriteFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
LPDWORD numberOfBytesWritten, LPOVERLAPPED lpOverlapped)
{
int written;
if((DWORD)hFile < 3)
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_UNKNOWN);
return 0;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_UNKNOWN);
return 0;
}
written = write(hFile->fd, lpBuffer, numberOfBytesToWrite);
if(numberOfBytesWritten)
*numberOfBytesWritten = written;
return 1;
}
/***********************************************************************
* ReadFile (KERNEL32.428)
*/
BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread,
LPDWORD numread, LPOVERLAPPED lpOverlapped)
{
int actual_read;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
written = write((DWORD)hFile, lpBuffer, numberOfBytesToWrite);
if(numberOfBytesWritten)
*numberOfBytesWritten = written;
SetLastError(ERROR_UNKNOWN);
return 0;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_UNKNOWN);
return 0;
}
actual_read = read(hFile->fd, lpBuffer, numtoread);
if(actual_read == -1)
{
SetLastError(ErrnoToLastError(errno));
return 0;
}
if(numread)
*numread = actual_read;
return 1;
}
/*************************************************************************
* CreateFile (KERNEL32.45)
*
* Doesn't support character devices or pipes yet.
*/
HANDLE32 CreateFile(LPSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES security, DWORD creation,
DWORD attributes, HANDLE32 template)
{
int access_flags, create_flags;
int fd;
FILE_OBJECT *file_obj;
int type;
/* Translate the various flags to Unix-style.
*/
access_flags = TranslateAccessFlags(access);
create_flags = TranslateCreationFlags(creation);
if(template)
printf("CreateFile: template handles not supported.\n");
/* If the name starts with '\\?' or '\\.', ignore the first 3 chars.
*/
if(!strncmp(filename, "\\\\?", 3) || !strncmp(filename, "\\\\.", 3))
filename += 3;
/* If the name still starts with '\\', it's a UNC name.
*/
if(!strncmp(filename, "\\\\", 2))
{
printf("CreateFile: UNC names not supported.\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return INVALID_HANDLE_VALUE;
}
/* If the name is either CONIN$ or CONOUT$, give them stdin
* or stdout, respectively.
*/
if(!strcmp(filename, "CONIN$"))
{
type = FILE_TYPE_CHAR;
fd = 0;
}
else if(!strcmp(filename, "CONOUT$"))
{
type = FILE_TYPE_CHAR;
fd = 1;
}
else
{
type = FILE_TYPE_DISK;
/* Try to open the file.
*/
fd = open(DOS_GetUnixFileName(filename),
access_flags | create_flags, 0666);
if(fd == -1)
{
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
}
/* We seem to have succeeded, so allocate a kernel object
* and set it up.
*/
file_obj = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(file_obj == NULL)
{
SetLastError(ERROR_UNKNOWN);
return INVALID_HANDLE_VALUE;
}
file_obj->common.magic = KERNEL_OBJECT_FILE;
file_obj->fd = fd;
file_obj->type = type;
file_obj->misc_flags = attributes;
file_obj->access_flags = access_flags;
file_obj->create_flags = create_flags;
return (HANDLE32)file_obj;
}
int CloseFileHandle(FILE_OBJECT *hFile)
{
/* If it's one of the 3 standard handles, don't really
* close it.
*/
if(hFile->fd > 2)
close(hFile->fd);
return 1;
}
static int TranslateAccessFlags(DWORD access_flags)
{
int rc = 0;
switch(access_flags)
{
case GENERIC_READ:
rc = O_RDONLY;
break;
case GENERIC_WRITE:
rc = O_WRONLY;
break;
case (GENERIC_READ | GENERIC_WRITE):
rc = O_RDWR;
break;
}
return rc;
}
static int TranslateCreationFlags(DWORD create_flags)
{
int rc = 0;
switch(create_flags)
{
case CREATE_NEW:
rc = O_CREAT | O_EXCL;
break;
case CREATE_ALWAYS:
rc = O_CREAT | O_TRUNC;
break;
case OPEN_EXISTING:
rc = 0;
break;
case OPEN_ALWAYS:
rc = O_CREAT;
break;
case TRUNCATE_EXISTING:
rc = O_TRUNC;
break;
}
return rc;
}
This diff is collapsed. Click to expand it.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment