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.
This commit is contained in:
parent
902da699bd
commit
ade697e88a
20
ANNOUNCE
20
ANNOUNCE
|
@ -1,14 +1,14 @@
|
|||
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.
|
||||
|
||||
|
|
20
BUGS
20
BUGS
|
@ -1,9 +1,27 @@
|
|||
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.
|
||||
|
||||
|
||||
|
|
211
ChangeLog
211
ChangeLog
|
@ -1,3 +1,214 @@
|
|||
----------------------------------------------------------------------
|
||||
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>
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -1,2 +0,0 @@
|
|||
/* autoconf.h generated automatically. Run Configure */
|
||||
#error You must run Configure before you can build the makefiles.
|
|
@ -1,3 +0,0 @@
|
|||
/* @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
|
||||
|
|
13
configure.in
13
configure.in
|
@ -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);
|
||||
|
|
102
controls/edit.c
102
controls/edit.c
|
@ -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"
|
||||
|
@ -107,12 +108,7 @@ 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 );
|
||||
#if defined(WINELIB)
|
||||
return LOCAL_Lock( hinstance, handle );
|
||||
#else
|
||||
HANDLE offs;
|
||||
|
||||
#if defined(WINELIB)
|
||||
return handle;
|
||||
#else
|
||||
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 */
|
||||
|
|
|
@ -2,14 +2,16 @@
|
|||
* Listbox controls
|
||||
*
|
||||
* Copyright Martin Ayotte, 1993
|
||||
* Copyright Constantine Sapuntzakis, 1995
|
||||
* Constantine Sapuntzakis, 1995
|
||||
* Alex Korobka, 1995
|
||||
*
|
||||
*/
|
||||
|
||||
/*
|
||||
* TODO:
|
||||
* FIXME:
|
||||
* - check if multi-column listboxes work
|
||||
* - implement more messages and styles
|
||||
* - implement more messages and styles (LB_EXTENDEDSEL for instance)
|
||||
* - exterminate evil InvalidateRect(whole listbox) where possible!!!!
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -33,10 +35,26 @@
|
|||
((void *)((handle) ? ((handle) | ((int)lphl->Heap & 0xffff0000)) : 0))
|
||||
#else
|
||||
/* FIXME: shouldn't each listbox have its own heap? */
|
||||
#if 0
|
||||
#define LIST_HEAP_ALLOC(lphl,f,size) USER_HEAP_ALLOC(size)
|
||||
#define LIST_HEAP_FREE(lphl,handle) USER_HEAP_FREE(handle)
|
||||
#define LIST_HEAP_ADDR(lphl,handle) USER_HEAP_LIN_ADDR(handle)
|
||||
#define LIST_HEAP_SEG_ADDR(lphl,handle) USER_HEAP_SEG_ADDR(handle)
|
||||
#else
|
||||
/* Something like this maybe ? */
|
||||
#define LIST_HEAP_ALLOC(lphl,f,size) \
|
||||
LOCAL_Alloc( lphl->HeapSel, LMEM_FIXED, (size) )
|
||||
#if 0
|
||||
#define LIST_HEAP_REALLOC(handle,size) \
|
||||
LOCAL_ReAlloc( USER_HeapSel, (handle), (size), LMEM_FIXED )
|
||||
#endif
|
||||
#define LIST_HEAP_FREE(lphl,handle) \
|
||||
LOCAL_Free( lphl->HeapSel, (handle) )
|
||||
#define LIST_HEAP_ADDR(lphl,handle) \
|
||||
((handle) ? PTR_SEG_OFF_TO_LIN(lphl->HeapSel, (handle)) : NULL)
|
||||
#define LIST_HEAP_SEG_ADDR(lphl,handle) \
|
||||
((handle) ? MAKELONG((handle), lphl->HeapSel) : 0)
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#define LIST_HEAP_SIZE 0x10000
|
||||
|
@ -66,9 +84,9 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
|
|||
lphl->iNumStops = 0;
|
||||
lphl->TabStops = NULL;
|
||||
lphl->hFont = GetStockObject(SYSTEM_FONT);
|
||||
lphl->hSelf = hwnd;
|
||||
lphl->hParent = parent;
|
||||
lphl->StdItemHeight = 15; /* FIXME: should get the font height */
|
||||
lphl->dwStyle = styles;
|
||||
lphl->OwnerDrawn = styles & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE);
|
||||
lphl->HasStrings = (styles & LBS_HASSTRINGS) || !lphl->OwnerDrawn;
|
||||
|
||||
|
@ -93,6 +111,8 @@ void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
|
|||
HeapBase = GlobalLock(HeapHandle);
|
||||
HEAP_Init(&lphl->Heap, HeapBase, LIST_HEAP_SIZE);
|
||||
#endif
|
||||
lphl->HeapSel = GlobalAlloc(GMEM_FIXED,LIST_HEAP_SIZE);
|
||||
LocalInit( lphl->HeapSel, 0, LIST_HEAP_SIZE-1);
|
||||
}
|
||||
|
||||
void DestroyListBoxStruct(LPHEADLIST lphl)
|
||||
|
@ -101,6 +121,7 @@ void DestroyListBoxStruct(LPHEADLIST lphl)
|
|||
USER_HEAP_FREE(lphl->hDrawItemStruct);
|
||||
|
||||
/* XXX need to free lphl->Heap */
|
||||
GlobalFree(lphl->HeapSel);
|
||||
free(lphl);
|
||||
}
|
||||
|
||||
|
@ -111,15 +132,17 @@ static LPHEADLIST ListBoxGetStorageHeader(HWND hwnd)
|
|||
|
||||
/* Send notification "code" as part of a WM_COMMAND-message if hwnd
|
||||
has the LBS_NOTIFY style */
|
||||
void ListBoxSendNotification(LPHEADLIST lphl, HWND hwnd, WORD code)
|
||||
void ListBoxSendNotification(LPHEADLIST lphl, WORD code)
|
||||
{
|
||||
if (lphl->dwStyle & LBS_NOTIFY)
|
||||
DWORD dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
|
||||
if (dwStyle & LBS_NOTIFY)
|
||||
#ifdef WINELIB32
|
||||
SendMessage(lphl->hParent, WM_COMMAND,
|
||||
MAKEWPARAM(lphl->CtlID,code), (LPARAM)hwnd);
|
||||
MAKEWPARAM(lphl->CtlID,code), (LPARAM)lphl->hSelf);
|
||||
#else
|
||||
SendMessage(lphl->hParent, WM_COMMAND,
|
||||
lphl->CtlID, MAKELONG(hwnd, code));
|
||||
lphl->CtlID, MAKELONG(lphl->hSelf, code));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
@ -191,6 +214,8 @@ LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex)
|
|||
void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls,
|
||||
RECT *rect, WORD itemAction, WORD itemState)
|
||||
{
|
||||
LONG dwStyle = GetWindowLong(hwnd,GWL_STYLE);
|
||||
|
||||
if (lphl->OwnerDrawn) {
|
||||
DRAWITEMSTRUCT *dis = USER_HEAP_LIN_ADDR(lphl->hDrawItemStruct);
|
||||
|
||||
|
@ -217,7 +242,7 @@ void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC hdc, LPLISTSTRUCT lpls,
|
|||
FillRect(hdc, rect, GetStockObject(BLACK_BRUSH));
|
||||
}
|
||||
|
||||
if (lphl->dwStyle & LBS_USETABSTOPS) {
|
||||
if (dwStyle & LBS_USETABSTOPS) {
|
||||
TabbedTextOut(hdc, rect->left + 5, rect->top + 2,
|
||||
(char *)lpls->itemText, strlen((char *)lpls->itemText),
|
||||
lphl->iNumStops, lphl->TabStops, 0);
|
||||
|
@ -269,7 +294,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
|
|||
MEASUREITEMSTRUCT *lpmeasure = (MEASUREITEMSTRUCT *) USER_HEAP_LIN_ADDR(hTemp);
|
||||
|
||||
if (lpmeasure == NULL) {
|
||||
fprintf(stderr,"ListBoxAskMeasure() out of memory !\n");
|
||||
fprintf(stdnimp,"ListBoxAskMeasure() out of memory !\n");
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -277,7 +302,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
|
|||
lpmeasure->itemHeight = lphl->StdItemHeight;
|
||||
SendMessage(lphl->hParent, WM_MEASUREITEM, 0, (LPARAM)USER_HEAP_SEG_ADDR(hTemp));
|
||||
|
||||
if (lphl->dwStyle & LBS_OWNERDRAWFIXED) {
|
||||
if (GetWindowLong(lphl->hSelf,GWL_STYLE) & LBS_OWNERDRAWFIXED) {
|
||||
lphl->StdItemHeight = lpmeasure->itemHeight;
|
||||
lphl->needMeasure = FALSE;
|
||||
}
|
||||
|
@ -285,6 +310,7 @@ void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
|
|||
USER_HEAP_FREE(hTemp);
|
||||
}
|
||||
|
||||
/* -------------------- strings and item data ---------------------- */
|
||||
|
||||
LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id)
|
||||
{
|
||||
|
@ -314,6 +340,8 @@ int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr)
|
|||
|
||||
dprintf_listbox(stddeb,"ListBoxInsertString(%d, %p);\n", uIndex, newstr);
|
||||
|
||||
if (!newstr) return -1;
|
||||
|
||||
if (uIndex == (UINT)-1)
|
||||
uIndex = lphl->ItemsCount;
|
||||
|
||||
|
@ -326,7 +354,7 @@ int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr)
|
|||
lplsnew = ListBoxCreateItem(lphl, Count);
|
||||
|
||||
if (lplsnew == NULL) {
|
||||
printf("ListBoxInsertString() out of memory !\n");
|
||||
fprintf(stdnimp,"ListBoxInsertString() out of memory !\n");
|
||||
return LB_ERRSPACE;
|
||||
}
|
||||
|
||||
|
@ -368,9 +396,10 @@ int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPSTR newstr)
|
|||
|
||||
int ListBoxAddString(LPHEADLIST lphl, LPSTR newstr)
|
||||
{
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
UINT pos = (UINT) -1;
|
||||
|
||||
if (lphl->HasStrings && (lphl->dwStyle & LBS_SORT)) {
|
||||
if (lphl->HasStrings && (dwStyle & LBS_SORT)) {
|
||||
LPLISTSTRUCT lpls = lphl->lpFirst;
|
||||
for (pos = 0; lpls != NULL; lpls = lpls->lpNext, pos++)
|
||||
if (strcmp(lpls->itemText, newstr) >= 0)
|
||||
|
@ -465,6 +494,7 @@ int ListBoxFindString(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr)
|
|||
UINT Count;
|
||||
UINT First = nFirst + 1;
|
||||
LPSTR lpMatchStr = (LPSTR)MatchStr;
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
|
||||
if (First > lphl->ItemsCount) return LB_ERR;
|
||||
|
||||
|
@ -475,7 +505,7 @@ int ListBoxFindString(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr)
|
|||
while(lpls != NULL) {
|
||||
if (lphl->HasStrings) {
|
||||
if (strstr(lpls->itemText, lpMatchStr) == lpls->itemText) return Count;
|
||||
} else if (lphl->dwStyle & LBS_SORT) {
|
||||
} else if (dwStyle & LBS_SORT) {
|
||||
/* XXX Do a compare item */
|
||||
}
|
||||
else
|
||||
|
@ -492,7 +522,7 @@ int ListBoxFindString(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr)
|
|||
while (Count < First) {
|
||||
if (lphl->HasStrings) {
|
||||
if (strstr(lpls->itemText, lpMatchStr) == lpls->itemText) return Count;
|
||||
} else if (lphl->dwStyle & LBS_SORT) {
|
||||
} else if (dwStyle & LBS_SORT) {
|
||||
/* XXX Do a compare item */
|
||||
} else {
|
||||
if (lpls->mis.itemData == (DWORD)lpMatchStr) return Count;
|
||||
|
@ -528,13 +558,21 @@ int ListBoxResetContent(LPHEADLIST lphl)
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
/* --------------------- selection ------------------------- */
|
||||
|
||||
int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
|
||||
{
|
||||
LPLISTSTRUCT lpls;
|
||||
DWORD dwStyle = GetWindowWord(lphl->hSelf,GWL_STYLE);
|
||||
|
||||
if (lphl->dwStyle & LBS_MULTIPLESEL) return 0;
|
||||
/* use ListBoxSetSel instead */
|
||||
if (dwStyle & LBS_MULTIPLESEL ) return 0;
|
||||
|
||||
/* unselect all previously selected */
|
||||
if (dwStyle & LBS_EXTENDEDSEL )
|
||||
ListBoxSetSel(lphl,-1,0);
|
||||
else
|
||||
/* unselect previous item */
|
||||
if (lphl->ItemFocused != -1) {
|
||||
lpls = ListBoxGetItem(lphl, lphl->ItemFocused);
|
||||
if (lpls == 0) return LB_ERR;
|
||||
|
@ -558,7 +596,9 @@ int ListBoxSetSel(LPHEADLIST lphl, WORD wIndex, WORD state)
|
|||
{
|
||||
LPLISTSTRUCT lpls;
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) return 0;
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) &
|
||||
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ))
|
||||
return 0;
|
||||
|
||||
if (wIndex == (UINT)-1) {
|
||||
for (lpls = lphl->lpFirst; lpls != NULL; lpls = lpls->lpNext) {
|
||||
|
@ -584,6 +624,7 @@ int ListBoxGetSel(LPHEADLIST lphl, WORD wIndex)
|
|||
return lpls->itemState;
|
||||
}
|
||||
|
||||
/* ------------------------- dir listing ------------------------ */
|
||||
|
||||
int ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPSTR filespec)
|
||||
{
|
||||
|
@ -648,6 +689,7 @@ int ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPSTR filespec)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* ------------------------- dimensions ------------------------- */
|
||||
|
||||
int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT lprect)
|
||||
{
|
||||
|
@ -663,7 +705,7 @@ int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height)
|
|||
{
|
||||
LPLISTSTRUCT lpls;
|
||||
|
||||
if (!(lphl->dwStyle & LBS_OWNERDRAWVARIABLE)) {
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) & LBS_OWNERDRAWVARIABLE)) {
|
||||
lphl->StdItemHeight = (short)height;
|
||||
return 0;
|
||||
}
|
||||
|
@ -675,6 +717,7 @@ int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height)
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* -------------------------- string search ------------------------ */
|
||||
|
||||
int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar)
|
||||
{
|
||||
|
@ -706,11 +749,13 @@ int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar)
|
|||
static LONG LBCreate(HWND hwnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
LPHEADLIST lphl;
|
||||
LONG dwStyle = GetWindowLong(hwnd,GWL_STYLE);
|
||||
RECT rect;
|
||||
|
||||
CreateListBoxStruct(hwnd, ODT_LISTBOX, GetWindowLong(hwnd,GWL_STYLE), GetParent(hwnd));
|
||||
CreateListBoxStruct(hwnd, ODT_LISTBOX, dwStyle, GetParent(hwnd));
|
||||
lphl = ListBoxGetStorageHeader(hwnd);
|
||||
dprintf_listbox(stddeb,"ListBox WM_CREATE %p !\n", lphl);
|
||||
dprintf_listbox(stddeb,"ListBox created: lphl = %p dwStyle = "NPFMT":"NPFMT"\n",
|
||||
lphl, HIWORD(dwStyle), LOWORD(dwStyle));
|
||||
|
||||
GetClientRect(hwnd,&rect);
|
||||
lphl->ColumnsWidth = rect.right - rect.left;
|
||||
|
@ -731,7 +776,7 @@ static LONG LBDestroy(HWND hwnd, WORD wParam, LONG lParam)
|
|||
ListBoxResetContent(lphl);
|
||||
|
||||
DestroyListBoxStruct(lphl);
|
||||
dprintf_listbox(stddeb,"ListBox WM_DESTROY %p !\n", lphl);
|
||||
dprintf_listbox(stddeb,"ListBox destroyed: lphl = %p\n",lphl);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -850,6 +895,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
WORD wRet;
|
||||
int y;
|
||||
RECT rectsel;
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
|
||||
SetFocus(hwnd);
|
||||
SetCapture(hwnd);
|
||||
|
@ -860,19 +906,32 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
if (y == -1)
|
||||
return 0;
|
||||
|
||||
if (lphl->dwStyle & LBS_MULTIPLESEL) {
|
||||
if (dwStyle & LBS_MULTIPLESEL) {
|
||||
lphl->ItemFocused = y;
|
||||
wRet = ListBoxGetSel(lphl, y);
|
||||
ListBoxSetSel(lphl, y, !wRet);
|
||||
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
} else {
|
||||
ListBoxSetCurSel(lphl, y);
|
||||
}
|
||||
if (lphl->dwStyle & LBS_MULTIPLESEL)
|
||||
ListBoxSendNotification(lphl, hwnd, LBN_SELCHANGE);
|
||||
|
||||
ListBoxGetItemRect(lphl, y, &rectsel);
|
||||
InvalidateRect(hwnd, &rectsel, TRUE);
|
||||
if(lphl->PrevFocused) {
|
||||
ListBoxGetItemRect(lphl, lphl->PrevFocused, &rectsel);
|
||||
InvalidateRect(hwnd, &rectsel, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
if (dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL))
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
|
||||
if (dwStyle & LBS_NOTIFY)
|
||||
SendMessage(lphl->hParent, WM_LBTRACKPOINT, y, lParam);
|
||||
|
||||
if (GetWindowLong(lphl->hSelf,GWL_EXSTYLE) & WS_EX_DRAGDETECT)
|
||||
if( DragDetect(lphl->hSelf,MAKEPOINT(lParam)) )
|
||||
SendMessage(lphl->hParent, WM_BEGINDRAG,0,0L);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -887,7 +946,7 @@ static LONG LBLButtonUp(HWND hwnd, WORD wParam, LONG lParam)
|
|||
if (GetCapture() == hwnd) ReleaseCapture();
|
||||
|
||||
if (lphl->PrevFocused != lphl->ItemFocused)
|
||||
ListBoxSendNotification(lphl, hwnd, LBN_SELCHANGE);
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -919,6 +978,7 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam)
|
|||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
int y;
|
||||
WORD wRet;
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
RECT rect, rectsel; /* XXX Broken */
|
||||
|
||||
dprintf_listbox(stddeb,"LBMouseMove %d %d\n",SLOWORD(lParam),SHIWORD(lParam));
|
||||
|
@ -947,14 +1007,16 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam)
|
|||
if (wRet == lphl->ItemFocused) {
|
||||
return 0;
|
||||
}
|
||||
if (lphl->dwStyle & LBS_MULTIPLESEL) {
|
||||
if (dwStyle & LBS_MULTIPLESEL) {
|
||||
lphl->ItemFocused = wRet;
|
||||
ListBoxSendNotification(lphl, hwnd, LBN_SELCHANGE);
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
} else {
|
||||
ListBoxSetCurSel(lphl, wRet);
|
||||
if(dwStyle & LBS_EXTENDEDSEL)
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
}
|
||||
ListBoxGetItemRect(lphl, wRet, &rectsel);
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
InvalidateRect(hwnd, &rectsel, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -964,20 +1026,42 @@ static LONG LBMouseMove(HWND hwnd, WORD wParam, LONG lParam)
|
|||
|
||||
/***********************************************************************
|
||||
* LBKeyDown
|
||||
*
|
||||
* Doesn't yet handle properly VK_SHIFT with LB_EXTENDEDSEL
|
||||
*/
|
||||
static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
WORD newFocused = lphl->ItemFocused;
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
WORD newFocused = 0xFFFF;
|
||||
RECT rect;
|
||||
|
||||
if (wParam == VK_SPACE) {
|
||||
if (lphl->dwStyle & LBS_MULTIPLESEL) {
|
||||
WORD wRet = ListBoxGetSel(lphl, lphl->ItemFocused);
|
||||
ListBoxSetSel(lphl, lphl->ItemFocused, !wRet);
|
||||
}
|
||||
return 0;
|
||||
ListBoxGetItemRect(lphl,lphl->ItemFocused,&rect);
|
||||
switch(wParam)
|
||||
{
|
||||
/* ugly kludge that belongs in TranslateMessage */
|
||||
|
||||
case VK_HOME:
|
||||
case VK_END:
|
||||
case VK_LEFT:
|
||||
case VK_RIGHT:
|
||||
case VK_UP:
|
||||
case VK_DOWN:
|
||||
case VK_PRIOR:
|
||||
case VK_NEXT:
|
||||
if ( dwStyle & LBS_WANTKEYBOARDINPUT )
|
||||
{
|
||||
newFocused = (WORD)(INT)SendMessage(lphl->hParent,WM_VKEYTOITEM,
|
||||
wParam,MAKELPARAM(lphl->ItemFocused,hwnd));
|
||||
if ( newFocused == 0xFFFE ) return 0L;
|
||||
}
|
||||
switch(wParam) {
|
||||
if ( newFocused == 0xFFFF )
|
||||
{
|
||||
newFocused = lphl->ItemFocused;
|
||||
|
||||
/* nested switch */
|
||||
switch(wParam)
|
||||
{
|
||||
case VK_HOME:
|
||||
newFocused = 0;
|
||||
break;
|
||||
|
@ -985,7 +1069,7 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
newFocused = lphl->ItemsCount - 1;
|
||||
break;
|
||||
case VK_LEFT:
|
||||
if (lphl->dwStyle & LBS_MULTICOLUMN) {
|
||||
if (dwStyle & LBS_MULTICOLUMN) {
|
||||
if (newFocused >= lphl->ItemsPerColumn) {
|
||||
newFocused -= lphl->ItemsPerColumn;
|
||||
} else {
|
||||
|
@ -997,19 +1081,16 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
if (newFocused > 0) newFocused--;
|
||||
break;
|
||||
case VK_RIGHT:
|
||||
if (lphl->dwStyle & LBS_MULTICOLUMN) {
|
||||
if (dwStyle & LBS_MULTICOLUMN)
|
||||
newFocused += lphl->ItemsPerColumn;
|
||||
}
|
||||
break;
|
||||
case VK_DOWN:
|
||||
newFocused++;
|
||||
break;
|
||||
case VK_PRIOR:
|
||||
if (newFocused > lphl->ItemsVisible) {
|
||||
if (newFocused > lphl->ItemsVisible)
|
||||
newFocused -= lphl->ItemsVisible;
|
||||
} else {
|
||||
newFocused = 0;
|
||||
}
|
||||
else newFocused = 0;
|
||||
break;
|
||||
case VK_NEXT:
|
||||
newFocused += lphl->ItemsVisible;
|
||||
|
@ -1017,19 +1098,49 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
default:
|
||||
return 0;
|
||||
}
|
||||
/* end of nested switch */
|
||||
}
|
||||
break;
|
||||
case VK_SPACE:
|
||||
if (dwStyle & LBS_MULTIPLESEL)
|
||||
{
|
||||
WORD wRet = ListBoxGetSel(lphl, lphl->ItemFocused);
|
||||
ListBoxSetSel(lphl, lphl->ItemFocused, !wRet);
|
||||
}
|
||||
return 0;
|
||||
|
||||
/* chars are handled in LBChar */
|
||||
default:
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* at this point newFocused is set up */
|
||||
|
||||
if (newFocused >= lphl->ItemsCount)
|
||||
newFocused = lphl->ItemsCount - 1;
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) {
|
||||
if (!(dwStyle & LBS_MULTIPLESEL))
|
||||
{
|
||||
ListBoxSetCurSel(lphl, newFocused);
|
||||
ListBoxSendNotification(lphl, hwnd, LBN_SELCHANGE);
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
}
|
||||
|
||||
lphl->ItemFocused = newFocused;
|
||||
ListBoxScrollToFocus(lphl);
|
||||
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
|
||||
|
||||
if( ListBoxScrollToFocus(lphl) || (dwStyle &
|
||||
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL)) )
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
else
|
||||
{
|
||||
InvalidateRect(hwnd, &rect, TRUE);
|
||||
if( newFocused < 0x8000 )
|
||||
{
|
||||
ListBoxGetItemRect(lphl, newFocused, &rect);
|
||||
InvalidateRect(hwnd, &rect, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1040,21 +1151,34 @@ static LONG LBKeyDown(HWND hwnd, WORD wParam, LONG lParam)
|
|||
static LONG LBChar(HWND hwnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
WORD newFocused;
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
WORD newFocused = 0xFFFF;
|
||||
|
||||
if ( (dwStyle & LBS_WANTKEYBOARDINPUT) && !(lphl->HasStrings))
|
||||
{
|
||||
newFocused = (WORD)(INT)SendMessage(lphl->hParent,WM_CHARTOITEM,
|
||||
wParam,MAKELPARAM(lphl->ItemFocused,hwnd));
|
||||
if ( newFocused == 0xFFFE ) return 0L;
|
||||
}
|
||||
|
||||
if (newFocused == 0xFFFF )
|
||||
newFocused = ListBoxFindNextMatch(lphl, wParam);
|
||||
|
||||
if (newFocused == (WORD)LB_ERR) return 0;
|
||||
|
||||
if (newFocused >= lphl->ItemsCount)
|
||||
newFocused = lphl->ItemsCount - 1;
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) {
|
||||
|
||||
if (!(dwStyle & LBS_MULTIPLESEL))
|
||||
{
|
||||
ListBoxSetCurSel(lphl, newFocused);
|
||||
ListBoxSendNotification(lphl, hwnd, LBN_SELCHANGE);
|
||||
ListBoxSendNotification(lphl, LBN_SELCHANGE);
|
||||
}
|
||||
|
||||
lphl->ItemFocused = newFocused;
|
||||
ListBoxScrollToFocus(lphl);
|
||||
SetScrollPos(hwnd, SB_VERT, lphl->FirstVisible, TRUE);
|
||||
|
||||
InvalidateRect(hwnd, NULL, TRUE);
|
||||
|
||||
return 0;
|
||||
|
@ -1095,6 +1219,7 @@ static LONG LBSetFont(HWND hwnd, WPARAM wParam, LPARAM lParam)
|
|||
static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
LONG dwStyle = GetWindowLong(lphl->hSelf,GWL_STYLE);
|
||||
LPLISTSTRUCT lpls;
|
||||
PAINTSTRUCT ps;
|
||||
HBRUSH hBrush;
|
||||
|
@ -1127,7 +1252,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
|
|||
FillRect(hdc, &rect, hBrush);
|
||||
|
||||
maxwidth = rect.right;
|
||||
if (lphl->dwStyle & LBS_MULTICOLUMN) {
|
||||
if (dwStyle & LBS_MULTICOLUMN) {
|
||||
rect.right = lphl->ColumnsWidth;
|
||||
}
|
||||
lpls = lphl->lpFirst;
|
||||
|
@ -1142,7 +1267,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
|
|||
height = lpls->mis.itemHeight;
|
||||
|
||||
if (top > rect.bottom) {
|
||||
if (lphl->dwStyle & LBS_MULTICOLUMN) {
|
||||
if (dwStyle & LBS_MULTICOLUMN) {
|
||||
lphl->ItemsPerColumn = MAX(lphl->ItemsPerColumn, ipc);
|
||||
ipc = 0;
|
||||
top = 0;
|
||||
|
@ -1159,7 +1284,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
|
|||
lpls->itemRect.left = rect.left;
|
||||
lpls->itemRect.right = rect.right;
|
||||
|
||||
dprintf_listbox(stddeb,"drawing item: %d %d %d %d %d\n",rect.left,top,rect.right,top+height,lpls->itemState);
|
||||
dprintf_listbox(stddeb,"drawing item: %ld %d %ld %d %d\n",(LONG)rect.left,top,(LONG)rect.right,top+height,lpls->itemState);
|
||||
if (lphl->OwnerDrawn) {
|
||||
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE, 0);
|
||||
if (lpls->itemState)
|
||||
|
@ -1370,7 +1495,7 @@ static LONG LBGetItemRect(HWND hwnd, WORD wParam, LONG lParam)
|
|||
static LONG LBGetSel(HWND hwnd, WORD wParam, LONG lParam)
|
||||
{
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
return ListBoxGetSel(lphl, wParam);
|
||||
return (ListBoxGetSel(lphl, wParam) )? 1 : 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -1381,15 +1506,19 @@ static LONG LBGetSelCount(HWND hwnd, WORD wParam, LONG lParam)
|
|||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
LPLISTSTRUCT lpls;
|
||||
int cnt = 0;
|
||||
int items = 0;
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) return LB_ERR;
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) &
|
||||
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ))
|
||||
return LB_ERR;
|
||||
|
||||
lpls = lphl->lpFirst;
|
||||
|
||||
while (lpls != NULL) {
|
||||
if (lpls->itemState > 0) cnt++;
|
||||
|
||||
lpls = lpls->lpNext;
|
||||
for( lpls = lphl->lpFirst;
|
||||
lpls;
|
||||
lpls = lpls->lpNext )
|
||||
{
|
||||
items++;
|
||||
if (lpls->itemState )
|
||||
cnt++;
|
||||
}
|
||||
|
||||
return cnt;
|
||||
|
@ -1405,7 +1534,9 @@ static LONG LBGetSelItems(HWND hwnd, WORD wParam, LONG lParam)
|
|||
int cnt, idx;
|
||||
int *lpItems = PTR_SEG_TO_LIN(lParam);
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) return LB_ERR;
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) &
|
||||
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ))
|
||||
return LB_ERR;
|
||||
|
||||
if (wParam == 0) return 0;
|
||||
|
||||
|
@ -1481,7 +1612,9 @@ static LONG LBSelItemRange(HWND hwnd, WORD wParam, LONG lParam)
|
|||
WORD last = HIWORD(lParam);
|
||||
BOOL select = wParam;
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) return LB_ERR;
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) &
|
||||
(LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ))
|
||||
return LB_ERR;
|
||||
|
||||
if (first >= lphl->ItemsCount ||
|
||||
last >= lphl->ItemsCount) return LB_ERR;
|
||||
|
@ -1509,7 +1642,7 @@ static LONG LBSetCaretIndex(HWND hwnd, WORD wParam, LONG lParam)
|
|||
{
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
|
||||
if (!(lphl->dwStyle & LBS_MULTIPLESEL)) return 0;
|
||||
if (!(GetWindowLong(lphl->hSelf,GWL_STYLE) & LBS_MULTIPLESEL)) return 0;
|
||||
if (wParam >= lphl->ItemsCount) return LB_ERR;
|
||||
|
||||
lphl->ItemFocused = wParam;
|
||||
|
@ -1649,6 +1782,20 @@ static LONG LBSetItemHeight(HWND hwnd, WORD wParam, LONG lParam)
|
|||
return wRet;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* LBPassToParent
|
||||
*/
|
||||
static LRESULT LBPassToParent(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
||||
{
|
||||
WND* ptrWnd = WIN_FindWndPtr(hwnd);
|
||||
|
||||
if( ptrWnd )
|
||||
if( /* !(ptrWnd->dwExStyle & WS_EX_NOPARENTNOTIFY) && */
|
||||
ptrWnd->hwndParent )
|
||||
return SendMessage(ptrWnd->hwndParent,message,wParam,lParam);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* ListBoxWndProc
|
||||
*/
|
||||
|
@ -1702,6 +1849,24 @@ LRESULT ListBoxWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
|
|||
case LB_SETSEL: return LBSetSel(hwnd, wParam, lParam);
|
||||
case LB_SETTOPINDEX: return LBSetTopIndex(hwnd, wParam, lParam);
|
||||
case LB_SETITEMHEIGHT: return LBSetItemHeight(hwnd, wParam, lParam);
|
||||
|
||||
case WM_DROPFILES: return LBPassToParent(hwnd, message, wParam, lParam);
|
||||
|
||||
case WM_DROPOBJECT:
|
||||
case WM_QUERYDROPOBJECT:
|
||||
case WM_DRAGSELECT:
|
||||
case WM_DRAGMOVE:
|
||||
{
|
||||
LPDRAGINFO lpDragInfo = (LPDRAGINFO) PTR_SEG_TO_LIN((SEGPTR)lParam);
|
||||
LPHEADLIST lphl = ListBoxGetStorageHeader(hwnd);
|
||||
|
||||
/* more undocumented Microsoft crap - drag&drop depends on it - AK */
|
||||
|
||||
lpDragInfo->l = ListBoxFindMouse(lphl,lpDragInfo->pt.x,
|
||||
lpDragInfo->pt.y);
|
||||
|
||||
return LBPassToParent(hwnd, message, wParam, lParam);
|
||||
}
|
||||
}
|
||||
|
||||
return DefWindowProc(hwnd, message, wParam, lParam);
|
||||
|
|
|
@ -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; }
|
||||
line: command
|
||||
| EOL
|
||||
| error EOL { 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),
|
||||
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
|
||||
|
|
|
@ -0,0 +1,38 @@
|
|||
/* 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 ...",
|
||||
".. ........................ ....",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................"};
|
|
@ -0,0 +1,38 @@
|
|||
/* 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 .................",
|
||||
"............. ..................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................",
|
||||
"................................"};
|
275
include/debug.h
275
include/debug.h
|
@ -37,6 +37,7 @@
|
|||
#undef DEBUG_DRIVER
|
||||
#undef DEBUG_EDIT
|
||||
#undef DEBUG_ENUM
|
||||
#undef DEBUG_ENV
|
||||
#undef DEBUG_EVENT
|
||||
#undef DEBUG_EXEC
|
||||
#undef DEBUG_FILE
|
||||
|
@ -45,6 +46,7 @@
|
|||
#undef DEBUG_GDI
|
||||
#undef DEBUG_GLOBAL
|
||||
#undef DEBUG_GRAPHICS
|
||||
#undef DEBUG_HOOK
|
||||
#undef DEBUG_ICON
|
||||
#undef DEBUG_INT
|
||||
#undef DEBUG_KEY
|
||||
|
@ -89,6 +91,7 @@
|
|||
#undef DEBUG_UTILITY
|
||||
#undef DEBUG_VXD
|
||||
#undef DEBUG_WIN
|
||||
#undef DEBUG_WIN32
|
||||
#undef DEBUG_WINSOCK
|
||||
#endif
|
||||
|
||||
|
@ -114,6 +117,7 @@
|
|||
#define DEBUG_DRIVER
|
||||
#define DEBUG_EDIT
|
||||
#define DEBUG_ENUM
|
||||
#define DEBUG_ENV
|
||||
#define DEBUG_EVENT
|
||||
#define DEBUG_EXEC
|
||||
#define DEBUG_FILE
|
||||
|
@ -122,6 +126,7 @@
|
|||
#define DEBUG_GDI
|
||||
#define DEBUG_GLOBAL
|
||||
#define DEBUG_GRAPHICS
|
||||
#define DEBUG_HOOK
|
||||
#define DEBUG_ICON
|
||||
#define DEBUG_INT
|
||||
#define DEBUG_KEY
|
||||
|
@ -166,6 +171,7 @@
|
|||
#define DEBUG_UTILITY
|
||||
#define DEBUG_VXD
|
||||
#define DEBUG_WIN
|
||||
#define DEBUG_WIN32
|
||||
#define DEBUG_WINSOCK
|
||||
#endif
|
||||
|
||||
|
@ -277,6 +283,11 @@ short debug_msg_enabled[]={
|
|||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_ENV
|
||||
1,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_EVENT
|
||||
1,
|
||||
#else
|
||||
|
@ -317,6 +328,11 @@ short debug_msg_enabled[]={
|
|||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_HOOK
|
||||
1,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_ICON
|
||||
1,
|
||||
#else
|
||||
|
@ -537,6 +553,11 @@ short debug_msg_enabled[]={
|
|||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_WIN32
|
||||
1,
|
||||
#else
|
||||
0,
|
||||
#endif
|
||||
#ifdef DEBUG_WINSOCK
|
||||
1,
|
||||
#else
|
||||
|
@ -823,8 +844,21 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_event if(!debug_msg_enabled[21]) ; else fprintf
|
||||
#define debugging_event debug_msg_enabled[21]
|
||||
#define dprintf_env if(!debug_msg_enabled[21]) ; else fprintf
|
||||
#define debugging_env debug_msg_enabled[21]
|
||||
#else
|
||||
#ifdef DEBUG_ENV
|
||||
#define dprintf_env fprintf
|
||||
#define debugging_env 1
|
||||
#else
|
||||
#define dprintf_env while(0) fprintf
|
||||
#define debugging_env 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_event if(!debug_msg_enabled[22]) ; else fprintf
|
||||
#define debugging_event debug_msg_enabled[22]
|
||||
#else
|
||||
#ifdef DEBUG_EVENT
|
||||
#define dprintf_event fprintf
|
||||
|
@ -836,8 +870,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_exec if(!debug_msg_enabled[22]) ; else fprintf
|
||||
#define debugging_exec debug_msg_enabled[22]
|
||||
#define dprintf_exec if(!debug_msg_enabled[23]) ; else fprintf
|
||||
#define debugging_exec debug_msg_enabled[23]
|
||||
#else
|
||||
#ifdef DEBUG_EXEC
|
||||
#define dprintf_exec fprintf
|
||||
|
@ -849,8 +883,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_file if(!debug_msg_enabled[23]) ; else fprintf
|
||||
#define debugging_file debug_msg_enabled[23]
|
||||
#define dprintf_file if(!debug_msg_enabled[24]) ; else fprintf
|
||||
#define debugging_file debug_msg_enabled[24]
|
||||
#else
|
||||
#ifdef DEBUG_FILE
|
||||
#define dprintf_file fprintf
|
||||
|
@ -862,8 +896,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_fixup if(!debug_msg_enabled[24]) ; else fprintf
|
||||
#define debugging_fixup debug_msg_enabled[24]
|
||||
#define dprintf_fixup if(!debug_msg_enabled[25]) ; else fprintf
|
||||
#define debugging_fixup debug_msg_enabled[25]
|
||||
#else
|
||||
#ifdef DEBUG_FIXUP
|
||||
#define dprintf_fixup fprintf
|
||||
|
@ -875,8 +909,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_font if(!debug_msg_enabled[25]) ; else fprintf
|
||||
#define debugging_font debug_msg_enabled[25]
|
||||
#define dprintf_font if(!debug_msg_enabled[26]) ; else fprintf
|
||||
#define debugging_font debug_msg_enabled[26]
|
||||
#else
|
||||
#ifdef DEBUG_FONT
|
||||
#define dprintf_font fprintf
|
||||
|
@ -888,8 +922,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_gdi if(!debug_msg_enabled[26]) ; else fprintf
|
||||
#define debugging_gdi debug_msg_enabled[26]
|
||||
#define dprintf_gdi if(!debug_msg_enabled[27]) ; else fprintf
|
||||
#define debugging_gdi debug_msg_enabled[27]
|
||||
#else
|
||||
#ifdef DEBUG_GDI
|
||||
#define dprintf_gdi fprintf
|
||||
|
@ -901,8 +935,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_global if(!debug_msg_enabled[27]) ; else fprintf
|
||||
#define debugging_global debug_msg_enabled[27]
|
||||
#define dprintf_global if(!debug_msg_enabled[28]) ; else fprintf
|
||||
#define debugging_global debug_msg_enabled[28]
|
||||
#else
|
||||
#ifdef DEBUG_GLOBAL
|
||||
#define dprintf_global fprintf
|
||||
|
@ -914,8 +948,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_graphics if(!debug_msg_enabled[28]) ; else fprintf
|
||||
#define debugging_graphics debug_msg_enabled[28]
|
||||
#define dprintf_graphics if(!debug_msg_enabled[29]) ; else fprintf
|
||||
#define debugging_graphics debug_msg_enabled[29]
|
||||
#else
|
||||
#ifdef DEBUG_GRAPHICS
|
||||
#define dprintf_graphics fprintf
|
||||
|
@ -927,8 +961,21 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_icon if(!debug_msg_enabled[29]) ; else fprintf
|
||||
#define debugging_icon debug_msg_enabled[29]
|
||||
#define dprintf_hook if(!debug_msg_enabled[30]) ; else fprintf
|
||||
#define debugging_hook debug_msg_enabled[30]
|
||||
#else
|
||||
#ifdef DEBUG_HOOK
|
||||
#define dprintf_hook fprintf
|
||||
#define debugging_hook 1
|
||||
#else
|
||||
#define dprintf_hook while(0) fprintf
|
||||
#define debugging_hook 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_icon if(!debug_msg_enabled[31]) ; else fprintf
|
||||
#define debugging_icon debug_msg_enabled[31]
|
||||
#else
|
||||
#ifdef DEBUG_ICON
|
||||
#define dprintf_icon fprintf
|
||||
|
@ -940,8 +987,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_int if(!debug_msg_enabled[30]) ; else fprintf
|
||||
#define debugging_int debug_msg_enabled[30]
|
||||
#define dprintf_int if(!debug_msg_enabled[32]) ; else fprintf
|
||||
#define debugging_int debug_msg_enabled[32]
|
||||
#else
|
||||
#ifdef DEBUG_INT
|
||||
#define dprintf_int fprintf
|
||||
|
@ -953,8 +1000,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_key if(!debug_msg_enabled[31]) ; else fprintf
|
||||
#define debugging_key debug_msg_enabled[31]
|
||||
#define dprintf_key if(!debug_msg_enabled[33]) ; else fprintf
|
||||
#define debugging_key debug_msg_enabled[33]
|
||||
#else
|
||||
#ifdef DEBUG_KEY
|
||||
#define dprintf_key fprintf
|
||||
|
@ -966,8 +1013,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_keyboard if(!debug_msg_enabled[32]) ; else fprintf
|
||||
#define debugging_keyboard debug_msg_enabled[32]
|
||||
#define dprintf_keyboard if(!debug_msg_enabled[34]) ; else fprintf
|
||||
#define debugging_keyboard debug_msg_enabled[34]
|
||||
#else
|
||||
#ifdef DEBUG_KEYBOARD
|
||||
#define dprintf_keyboard fprintf
|
||||
|
@ -979,8 +1026,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_ldt if(!debug_msg_enabled[33]) ; else fprintf
|
||||
#define debugging_ldt debug_msg_enabled[33]
|
||||
#define dprintf_ldt if(!debug_msg_enabled[35]) ; else fprintf
|
||||
#define debugging_ldt debug_msg_enabled[35]
|
||||
#else
|
||||
#ifdef DEBUG_LDT
|
||||
#define dprintf_ldt fprintf
|
||||
|
@ -992,8 +1039,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_listbox if(!debug_msg_enabled[34]) ; else fprintf
|
||||
#define debugging_listbox debug_msg_enabled[34]
|
||||
#define dprintf_listbox if(!debug_msg_enabled[36]) ; else fprintf
|
||||
#define debugging_listbox debug_msg_enabled[36]
|
||||
#else
|
||||
#ifdef DEBUG_LISTBOX
|
||||
#define dprintf_listbox fprintf
|
||||
|
@ -1005,8 +1052,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_local if(!debug_msg_enabled[35]) ; else fprintf
|
||||
#define debugging_local debug_msg_enabled[35]
|
||||
#define dprintf_local if(!debug_msg_enabled[37]) ; else fprintf
|
||||
#define debugging_local debug_msg_enabled[37]
|
||||
#else
|
||||
#ifdef DEBUG_LOCAL
|
||||
#define dprintf_local fprintf
|
||||
|
@ -1018,8 +1065,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_malloc if(!debug_msg_enabled[36]) ; else fprintf
|
||||
#define debugging_malloc debug_msg_enabled[36]
|
||||
#define dprintf_malloc if(!debug_msg_enabled[38]) ; else fprintf
|
||||
#define debugging_malloc debug_msg_enabled[38]
|
||||
#else
|
||||
#ifdef DEBUG_MALLOC
|
||||
#define dprintf_malloc fprintf
|
||||
|
@ -1031,8 +1078,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mci if(!debug_msg_enabled[37]) ; else fprintf
|
||||
#define debugging_mci debug_msg_enabled[37]
|
||||
#define dprintf_mci if(!debug_msg_enabled[39]) ; else fprintf
|
||||
#define debugging_mci debug_msg_enabled[39]
|
||||
#else
|
||||
#ifdef DEBUG_MCI
|
||||
#define dprintf_mci fprintf
|
||||
|
@ -1044,8 +1091,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mcianim if(!debug_msg_enabled[38]) ; else fprintf
|
||||
#define debugging_mcianim debug_msg_enabled[38]
|
||||
#define dprintf_mcianim if(!debug_msg_enabled[40]) ; else fprintf
|
||||
#define debugging_mcianim debug_msg_enabled[40]
|
||||
#else
|
||||
#ifdef DEBUG_MCIANIM
|
||||
#define dprintf_mcianim fprintf
|
||||
|
@ -1057,8 +1104,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mciwave if(!debug_msg_enabled[39]) ; else fprintf
|
||||
#define debugging_mciwave debug_msg_enabled[39]
|
||||
#define dprintf_mciwave if(!debug_msg_enabled[41]) ; else fprintf
|
||||
#define debugging_mciwave debug_msg_enabled[41]
|
||||
#else
|
||||
#ifdef DEBUG_MCIWAVE
|
||||
#define dprintf_mciwave fprintf
|
||||
|
@ -1070,8 +1117,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mdi if(!debug_msg_enabled[40]) ; else fprintf
|
||||
#define debugging_mdi debug_msg_enabled[40]
|
||||
#define dprintf_mdi if(!debug_msg_enabled[42]) ; else fprintf
|
||||
#define debugging_mdi debug_msg_enabled[42]
|
||||
#else
|
||||
#ifdef DEBUG_MDI
|
||||
#define dprintf_mdi fprintf
|
||||
|
@ -1083,8 +1130,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_menu if(!debug_msg_enabled[41]) ; else fprintf
|
||||
#define debugging_menu debug_msg_enabled[41]
|
||||
#define dprintf_menu if(!debug_msg_enabled[43]) ; else fprintf
|
||||
#define debugging_menu debug_msg_enabled[43]
|
||||
#else
|
||||
#ifdef DEBUG_MENU
|
||||
#define dprintf_menu fprintf
|
||||
|
@ -1096,8 +1143,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_menucalc if(!debug_msg_enabled[42]) ; else fprintf
|
||||
#define debugging_menucalc debug_msg_enabled[42]
|
||||
#define dprintf_menucalc if(!debug_msg_enabled[44]) ; else fprintf
|
||||
#define debugging_menucalc debug_msg_enabled[44]
|
||||
#else
|
||||
#ifdef DEBUG_MENUCALC
|
||||
#define dprintf_menucalc fprintf
|
||||
|
@ -1109,8 +1156,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_message if(!debug_msg_enabled[43]) ; else fprintf
|
||||
#define debugging_message debug_msg_enabled[43]
|
||||
#define dprintf_message if(!debug_msg_enabled[45]) ; else fprintf
|
||||
#define debugging_message debug_msg_enabled[45]
|
||||
#else
|
||||
#ifdef DEBUG_MESSAGE
|
||||
#define dprintf_message fprintf
|
||||
|
@ -1122,8 +1169,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_metafile if(!debug_msg_enabled[44]) ; else fprintf
|
||||
#define debugging_metafile debug_msg_enabled[44]
|
||||
#define dprintf_metafile if(!debug_msg_enabled[46]) ; else fprintf
|
||||
#define debugging_metafile debug_msg_enabled[46]
|
||||
#else
|
||||
#ifdef DEBUG_METAFILE
|
||||
#define dprintf_metafile fprintf
|
||||
|
@ -1135,8 +1182,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_midi if(!debug_msg_enabled[45]) ; else fprintf
|
||||
#define debugging_midi debug_msg_enabled[45]
|
||||
#define dprintf_midi if(!debug_msg_enabled[47]) ; else fprintf
|
||||
#define debugging_midi debug_msg_enabled[47]
|
||||
#else
|
||||
#ifdef DEBUG_MIDI
|
||||
#define dprintf_midi fprintf
|
||||
|
@ -1148,8 +1195,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mmio if(!debug_msg_enabled[46]) ; else fprintf
|
||||
#define debugging_mmio debug_msg_enabled[46]
|
||||
#define dprintf_mmio if(!debug_msg_enabled[48]) ; else fprintf
|
||||
#define debugging_mmio debug_msg_enabled[48]
|
||||
#else
|
||||
#ifdef DEBUG_MMIO
|
||||
#define dprintf_mmio fprintf
|
||||
|
@ -1161,8 +1208,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mmsys if(!debug_msg_enabled[47]) ; else fprintf
|
||||
#define debugging_mmsys debug_msg_enabled[47]
|
||||
#define dprintf_mmsys if(!debug_msg_enabled[49]) ; else fprintf
|
||||
#define debugging_mmsys debug_msg_enabled[49]
|
||||
#else
|
||||
#ifdef DEBUG_MMSYS
|
||||
#define dprintf_mmsys fprintf
|
||||
|
@ -1174,8 +1221,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_mmtime if(!debug_msg_enabled[48]) ; else fprintf
|
||||
#define debugging_mmtime debug_msg_enabled[48]
|
||||
#define dprintf_mmtime if(!debug_msg_enabled[50]) ; else fprintf
|
||||
#define debugging_mmtime debug_msg_enabled[50]
|
||||
#else
|
||||
#ifdef DEBUG_MMTIME
|
||||
#define dprintf_mmtime fprintf
|
||||
|
@ -1187,8 +1234,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_module if(!debug_msg_enabled[49]) ; else fprintf
|
||||
#define debugging_module debug_msg_enabled[49]
|
||||
#define dprintf_module if(!debug_msg_enabled[51]) ; else fprintf
|
||||
#define debugging_module debug_msg_enabled[51]
|
||||
#else
|
||||
#ifdef DEBUG_MODULE
|
||||
#define dprintf_module fprintf
|
||||
|
@ -1200,8 +1247,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_msg if(!debug_msg_enabled[50]) ; else fprintf
|
||||
#define debugging_msg debug_msg_enabled[50]
|
||||
#define dprintf_msg if(!debug_msg_enabled[52]) ; else fprintf
|
||||
#define debugging_msg debug_msg_enabled[52]
|
||||
#else
|
||||
#ifdef DEBUG_MSG
|
||||
#define dprintf_msg fprintf
|
||||
|
@ -1213,8 +1260,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_nonclient if(!debug_msg_enabled[51]) ; else fprintf
|
||||
#define debugging_nonclient debug_msg_enabled[51]
|
||||
#define dprintf_nonclient if(!debug_msg_enabled[53]) ; else fprintf
|
||||
#define debugging_nonclient debug_msg_enabled[53]
|
||||
#else
|
||||
#ifdef DEBUG_NONCLIENT
|
||||
#define dprintf_nonclient fprintf
|
||||
|
@ -1226,8 +1273,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_ole if(!debug_msg_enabled[52]) ; else fprintf
|
||||
#define debugging_ole debug_msg_enabled[52]
|
||||
#define dprintf_ole if(!debug_msg_enabled[54]) ; else fprintf
|
||||
#define debugging_ole debug_msg_enabled[54]
|
||||
#else
|
||||
#ifdef DEBUG_OLE
|
||||
#define dprintf_ole fprintf
|
||||
|
@ -1239,8 +1286,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_palette if(!debug_msg_enabled[53]) ; else fprintf
|
||||
#define debugging_palette debug_msg_enabled[53]
|
||||
#define dprintf_palette if(!debug_msg_enabled[55]) ; else fprintf
|
||||
#define debugging_palette debug_msg_enabled[55]
|
||||
#else
|
||||
#ifdef DEBUG_PALETTE
|
||||
#define dprintf_palette fprintf
|
||||
|
@ -1252,8 +1299,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_profile if(!debug_msg_enabled[54]) ; else fprintf
|
||||
#define debugging_profile debug_msg_enabled[54]
|
||||
#define dprintf_profile if(!debug_msg_enabled[56]) ; else fprintf
|
||||
#define debugging_profile debug_msg_enabled[56]
|
||||
#else
|
||||
#ifdef DEBUG_PROFILE
|
||||
#define dprintf_profile fprintf
|
||||
|
@ -1265,8 +1312,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_prop if(!debug_msg_enabled[55]) ; else fprintf
|
||||
#define debugging_prop debug_msg_enabled[55]
|
||||
#define dprintf_prop if(!debug_msg_enabled[57]) ; else fprintf
|
||||
#define debugging_prop debug_msg_enabled[57]
|
||||
#else
|
||||
#ifdef DEBUG_PROP
|
||||
#define dprintf_prop fprintf
|
||||
|
@ -1278,8 +1325,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_reg if(!debug_msg_enabled[56]) ; else fprintf
|
||||
#define debugging_reg debug_msg_enabled[56]
|
||||
#define dprintf_reg if(!debug_msg_enabled[58]) ; else fprintf
|
||||
#define debugging_reg debug_msg_enabled[58]
|
||||
#else
|
||||
#ifdef DEBUG_REG
|
||||
#define dprintf_reg fprintf
|
||||
|
@ -1291,8 +1338,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_region if(!debug_msg_enabled[57]) ; else fprintf
|
||||
#define debugging_region debug_msg_enabled[57]
|
||||
#define dprintf_region if(!debug_msg_enabled[59]) ; else fprintf
|
||||
#define debugging_region debug_msg_enabled[59]
|
||||
#else
|
||||
#ifdef DEBUG_REGION
|
||||
#define dprintf_region fprintf
|
||||
|
@ -1304,8 +1351,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_relay if(!debug_msg_enabled[58]) ; else fprintf
|
||||
#define debugging_relay debug_msg_enabled[58]
|
||||
#define dprintf_relay if(!debug_msg_enabled[60]) ; else fprintf
|
||||
#define debugging_relay debug_msg_enabled[60]
|
||||
#else
|
||||
#ifdef DEBUG_RELAY
|
||||
#define dprintf_relay fprintf
|
||||
|
@ -1317,8 +1364,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_resource if(!debug_msg_enabled[59]) ; else fprintf
|
||||
#define debugging_resource debug_msg_enabled[59]
|
||||
#define dprintf_resource if(!debug_msg_enabled[61]) ; else fprintf
|
||||
#define debugging_resource debug_msg_enabled[61]
|
||||
#else
|
||||
#ifdef DEBUG_RESOURCE
|
||||
#define dprintf_resource fprintf
|
||||
|
@ -1330,8 +1377,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_scroll if(!debug_msg_enabled[60]) ; else fprintf
|
||||
#define debugging_scroll debug_msg_enabled[60]
|
||||
#define dprintf_scroll if(!debug_msg_enabled[62]) ; else fprintf
|
||||
#define debugging_scroll debug_msg_enabled[62]
|
||||
#else
|
||||
#ifdef DEBUG_SCROLL
|
||||
#define dprintf_scroll fprintf
|
||||
|
@ -1343,8 +1390,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_selector if(!debug_msg_enabled[61]) ; else fprintf
|
||||
#define debugging_selector debug_msg_enabled[61]
|
||||
#define dprintf_selector if(!debug_msg_enabled[63]) ; else fprintf
|
||||
#define debugging_selector debug_msg_enabled[63]
|
||||
#else
|
||||
#ifdef DEBUG_SELECTOR
|
||||
#define dprintf_selector fprintf
|
||||
|
@ -1356,8 +1403,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_sem if(!debug_msg_enabled[62]) ; else fprintf
|
||||
#define debugging_sem debug_msg_enabled[62]
|
||||
#define dprintf_sem if(!debug_msg_enabled[64]) ; else fprintf
|
||||
#define debugging_sem debug_msg_enabled[64]
|
||||
#else
|
||||
#ifdef DEBUG_SEM
|
||||
#define dprintf_sem fprintf
|
||||
|
@ -1369,8 +1416,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_shm if(!debug_msg_enabled[63]) ; else fprintf
|
||||
#define debugging_shm debug_msg_enabled[63]
|
||||
#define dprintf_shm if(!debug_msg_enabled[65]) ; else fprintf
|
||||
#define debugging_shm debug_msg_enabled[65]
|
||||
#else
|
||||
#ifdef DEBUG_SHM
|
||||
#define dprintf_shm fprintf
|
||||
|
@ -1382,8 +1429,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_stress if(!debug_msg_enabled[64]) ; else fprintf
|
||||
#define debugging_stress debug_msg_enabled[64]
|
||||
#define dprintf_stress if(!debug_msg_enabled[66]) ; else fprintf
|
||||
#define debugging_stress debug_msg_enabled[66]
|
||||
#else
|
||||
#ifdef DEBUG_STRESS
|
||||
#define dprintf_stress fprintf
|
||||
|
@ -1395,8 +1442,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_syscolor if(!debug_msg_enabled[65]) ; else fprintf
|
||||
#define debugging_syscolor debug_msg_enabled[65]
|
||||
#define dprintf_syscolor if(!debug_msg_enabled[67]) ; else fprintf
|
||||
#define debugging_syscolor debug_msg_enabled[67]
|
||||
#else
|
||||
#ifdef DEBUG_SYSCOLOR
|
||||
#define dprintf_syscolor fprintf
|
||||
|
@ -1408,8 +1455,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_task if(!debug_msg_enabled[66]) ; else fprintf
|
||||
#define debugging_task debug_msg_enabled[66]
|
||||
#define dprintf_task if(!debug_msg_enabled[68]) ; else fprintf
|
||||
#define debugging_task debug_msg_enabled[68]
|
||||
#else
|
||||
#ifdef DEBUG_TASK
|
||||
#define dprintf_task fprintf
|
||||
|
@ -1421,8 +1468,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_text if(!debug_msg_enabled[67]) ; else fprintf
|
||||
#define debugging_text debug_msg_enabled[67]
|
||||
#define dprintf_text if(!debug_msg_enabled[69]) ; else fprintf
|
||||
#define debugging_text debug_msg_enabled[69]
|
||||
#else
|
||||
#ifdef DEBUG_TEXT
|
||||
#define dprintf_text fprintf
|
||||
|
@ -1434,8 +1481,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_timer if(!debug_msg_enabled[68]) ; else fprintf
|
||||
#define debugging_timer debug_msg_enabled[68]
|
||||
#define dprintf_timer if(!debug_msg_enabled[70]) ; else fprintf
|
||||
#define debugging_timer debug_msg_enabled[70]
|
||||
#else
|
||||
#ifdef DEBUG_TIMER
|
||||
#define dprintf_timer fprintf
|
||||
|
@ -1447,8 +1494,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_toolhelp if(!debug_msg_enabled[69]) ; else fprintf
|
||||
#define debugging_toolhelp debug_msg_enabled[69]
|
||||
#define dprintf_toolhelp if(!debug_msg_enabled[71]) ; else fprintf
|
||||
#define debugging_toolhelp debug_msg_enabled[71]
|
||||
#else
|
||||
#ifdef DEBUG_TOOLHELP
|
||||
#define dprintf_toolhelp fprintf
|
||||
|
@ -1460,8 +1507,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_utility if(!debug_msg_enabled[70]) ; else fprintf
|
||||
#define debugging_utility debug_msg_enabled[70]
|
||||
#define dprintf_utility if(!debug_msg_enabled[72]) ; else fprintf
|
||||
#define debugging_utility debug_msg_enabled[72]
|
||||
#else
|
||||
#ifdef DEBUG_UTILITY
|
||||
#define dprintf_utility fprintf
|
||||
|
@ -1473,8 +1520,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_vxd if(!debug_msg_enabled[71]) ; else fprintf
|
||||
#define debugging_vxd debug_msg_enabled[71]
|
||||
#define dprintf_vxd if(!debug_msg_enabled[73]) ; else fprintf
|
||||
#define debugging_vxd debug_msg_enabled[73]
|
||||
#else
|
||||
#ifdef DEBUG_VXD
|
||||
#define dprintf_vxd fprintf
|
||||
|
@ -1486,8 +1533,8 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_win if(!debug_msg_enabled[72]) ; else fprintf
|
||||
#define debugging_win debug_msg_enabled[72]
|
||||
#define dprintf_win if(!debug_msg_enabled[74]) ; else fprintf
|
||||
#define debugging_win debug_msg_enabled[74]
|
||||
#else
|
||||
#ifdef DEBUG_WIN
|
||||
#define dprintf_win fprintf
|
||||
|
@ -1499,8 +1546,21 @@ extern short debug_msg_enabled[];
|
|||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_winsock if(!debug_msg_enabled[73]) ; else fprintf
|
||||
#define debugging_winsock debug_msg_enabled[73]
|
||||
#define dprintf_win32 if(!debug_msg_enabled[75]) ; else fprintf
|
||||
#define debugging_win32 debug_msg_enabled[75]
|
||||
#else
|
||||
#ifdef DEBUG_WIN32
|
||||
#define dprintf_win32 fprintf
|
||||
#define debugging_win32 1
|
||||
#else
|
||||
#define dprintf_win32 while(0) fprintf
|
||||
#define debugging_win32 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_RUNTIME
|
||||
#define dprintf_winsock if(!debug_msg_enabled[76]) ; else fprintf
|
||||
#define debugging_winsock debug_msg_enabled[76]
|
||||
#else
|
||||
#ifdef DEBUG_WINSOCK
|
||||
#define dprintf_winsock fprintf
|
||||
|
@ -1536,6 +1596,7 @@ static char *debug_msg_name[] = {
|
|||
"driver",
|
||||
"edit",
|
||||
"enum",
|
||||
"env",
|
||||
"event",
|
||||
"exec",
|
||||
"file",
|
||||
|
@ -1544,6 +1605,7 @@ static char *debug_msg_name[] = {
|
|||
"gdi",
|
||||
"global",
|
||||
"graphics",
|
||||
"hook",
|
||||
"icon",
|
||||
"int",
|
||||
"key",
|
||||
|
@ -1588,6 +1650,7 @@ static char *debug_msg_name[] = {
|
|||
"utility",
|
||||
"vxd",
|
||||
"win",
|
||||
"win32",
|
||||
"winsock",
|
||||
""
|
||||
};
|
||||
|
|
|
@ -0,0 +1,87 @@
|
|||
#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 HOOK_MAGIC ((int)'H' | (int)'K' << 8) /* 'HK' */
|
||||
|
||||
#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)
|
||||
|
||||
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 */
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* 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
|
||||
|
|
|
@ -0,0 +1,124 @@
|
|||
#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)
|
|
@ -0,0 +1,335 @@
|
|||
#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
|
||||
|
1447
include/windows.h
1447
include/windows.h
File diff suppressed because it is too large
Load Diff
|
@ -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
|
||||
|
|
|
@ -1,2 +1,12 @@
|
|||
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
|
||||
|
|
|
@ -1,3 +1,6 @@
|
|||
#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;
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#ifndef WINELIB
|
||||
/*
|
||||
* NE modules
|
||||
*
|
||||
|
@ -532,3 +533,4 @@ void NE_InitializeDLLs( HMODULE hModule )
|
|||
void PatchCodeHandle(HANDLE hSel)
|
||||
{
|
||||
}
|
||||
#endif /* WINELIB */
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#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 */
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#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 */
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
#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;
|
||||
|
@ -101,10 +105,14 @@ void init_wine_signals(void)
|
|||
struct sigaltstack ss;
|
||||
|
||||
#if !defined (__FreeBSD__)
|
||||
ss.ss_base = xmalloc (MINSIGSTKSZ);
|
||||
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 )
|
||||
|
@ -969,6 +975,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)
|
||||
*/
|
||||
|
|
|
@ -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;
|
||||
|
|
13
misc/file.c
13
misc/file.c
|
@ -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 */
|
||||
|
||||
|
|
46
misc/lstr.c
46
misc/lstr.c
|
@ -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 */
|
||||
|
|
68
misc/main.c
68
misc/main.c
|
@ -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" \
|
||||
|
@ -271,6 +291,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
|
||||
*
|
||||
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
176
misc/profile.c
176
misc/profile.c
|
@ -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,13 +92,15 @@ 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;
|
||||
|
||||
|
@ -135,96 +136,99 @@ static TSecHeader *load (char *filename, char **pfullname)
|
|||
*pfullname = strdup(file);
|
||||
dprintf_profile(stddeb,"Loading %s\n", file);
|
||||
|
||||
firstbrace = TRUE;
|
||||
for(;;) {
|
||||
c = fgetc(f);
|
||||
if (c == EOF) goto finished;
|
||||
|
||||
state = FirstBrace;
|
||||
next = CharBuffer;
|
||||
while ((c = fgetc (f)) != EOF){
|
||||
if (c == '\r') /* Ignore Carriage Return */
|
||||
if (isspace(c))
|
||||
continue;
|
||||
|
||||
switch (state){
|
||||
if (c == '[') {
|
||||
TSecHeader *temp = SecHeader;
|
||||
|
||||
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;
|
||||
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;
|
||||
|
||||
case IgnoreToEOL:
|
||||
if (c == '\n'){
|
||||
state = KeyDef;
|
||||
next = CharBuffer;
|
||||
}
|
||||
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);
|
||||
|
||||
case FirstBrace:
|
||||
case KeyDef:
|
||||
if (c == '['){
|
||||
TSecHeader *temp;
|
||||
dprintf_profile(stddeb,"%s: key %s\n", file, CharBuffer);
|
||||
|
||||
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;
|
||||
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);
|
||||
|
||||
if (c == '\t')
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '\n' || c == ';' || overflow) /* Abort Definition */
|
||||
next = CharBuffer;
|
||||
|
||||
if (c == ';')
|
||||
{
|
||||
state = IgnoreToEOL;
|
||||
break;
|
||||
}
|
||||
|
||||
if (c == '\n')
|
||||
break;
|
||||
|
||||
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;
|
||||
|
||||
} /* switch */
|
||||
|
||||
} /* while ((c = fgetc (f)) != EOF) */
|
||||
}
|
||||
bad_file:
|
||||
fprintf(stderr, "warning: bad ini file\n");
|
||||
finished:
|
||||
return SecHeader;
|
||||
}
|
||||
|
||||
|
|
14
misc/spy.c
14
misc/spy.c
|
@ -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);
|
||||
|
@ -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;
|
||||
static 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_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");
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -0,0 +1,37 @@
|
|||
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
|
163
toolkit/heap.c
163
toolkit/heap.c
|
@ -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 };
|
||||
typedef struct { DWORD Size; DWORD Padding[3]; } HeapData;
|
||||
|
||||
void CheckMem(void* f)
|
||||
HANDLE HEAP_Alloc (WORD flags, DWORD bytes)
|
||||
{
|
||||
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
|
||||
|
||||
HANDLE LocalAlloc (WORD flags, WORD 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;
|
||||
}
|
||||
|
||||
HANDLE LocalReAlloc (HANDLE hMem, WORD new_size, WORD flags)
|
||||
{
|
||||
if (!(flags & LMEM_MODIFY))
|
||||
return HEAP_ReAlloc (hMem, new_size, flags);
|
||||
else
|
||||
return hMem;
|
||||
}
|
||||
|
||||
HANDLE LocalReAlloc (HANDLE hMem, WORD flags, WORD bytes)
|
||||
UINT LocalSize (HANDLE hMem)
|
||||
{
|
||||
#ifdef DEBUG_HEAP
|
||||
LocalFree(hMem);
|
||||
return LocalAlloc(flags,bytes);
|
||||
#endif
|
||||
return realloc(hMem, bytes);
|
||||
}
|
||||
|
||||
WORD 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
|
||||
|
|
|
@ -1,5 +1,16 @@
|
|||
#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
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
@ -49,42 +49,19 @@ void GlobalFreeAll(HANDLE owner)
|
|||
}
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
{ 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
|
||||
|
||||
|
|
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* 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;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* 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;
|
||||
|
||||
|
|
303
win32/file.c
303
win32/file.c
|
@ -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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
|
107
win32/init.c
107
win32/init.c
|
@ -10,9 +10,53 @@
|
|||
#include "windows.h"
|
||||
#include "winerror.h"
|
||||
#include "kernel32.h"
|
||||
#include "handle32.h"
|
||||
#include "stddebug.h"
|
||||
#include "debug.h"
|
||||
|
||||
/* The global error value
|
||||
*/
|
||||
int WIN32_LastError;
|
||||
|
||||
/* Standard system handles for stdin, stdout, and stderr.
|
||||
*/
|
||||
FILE_OBJECT *hstdin, *hstdout, *hstderr;
|
||||
|
||||
static int CreateStdHandles(void);
|
||||
|
||||
/*********************************************************************
|
||||
* CloseHandle (KERNEL32.23)
|
||||
*/
|
||||
BOOL CloseHandle(HANDLE32 handle)
|
||||
{
|
||||
int rc;
|
||||
|
||||
if(ValidateKernelObject(handle) != 0)
|
||||
{
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
}
|
||||
|
||||
switch(handle->magic)
|
||||
{
|
||||
case KERNEL_OBJECT_UNUSED:
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return 0;
|
||||
|
||||
case KERNEL_OBJECT_FILE:
|
||||
rc = CloseFileHandle((FILE_OBJECT *)handle);
|
||||
break;
|
||||
|
||||
default:
|
||||
printf("CloseHandle: type %ld not implemented yet.\n",
|
||||
handle->magic);
|
||||
break;
|
||||
}
|
||||
|
||||
ReleaseKernelObject(handle);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetModuleFileNameA (KERNEL32.235)
|
||||
*/
|
||||
|
@ -22,6 +66,17 @@ DWORD GetModuleFileNameA(HMODULE hModule, LPSTR lpFilename, DWORD nSize)
|
|||
return 8;
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetModuleHandle (KERNEL32.237)
|
||||
*/
|
||||
HMODULE WIN32_GetModuleHandle(char *module)
|
||||
{
|
||||
if(module == NULL)
|
||||
return (HMODULE)0;
|
||||
else
|
||||
return GetModuleHandle(module);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetStartupInfoA (KERNEL32.273)
|
||||
*/
|
||||
|
@ -38,7 +93,59 @@ VOID GetStartupInfoA(LPSTARTUPINFO lpStartupInfo)
|
|||
lpStartupInfo->hStdError = (HANDLE)2;
|
||||
}
|
||||
|
||||
/* Initialize whatever internal data structures we need.
|
||||
*
|
||||
* Returns 1 on success, 0 on failure.
|
||||
*/
|
||||
int KERN32_Init(void)
|
||||
{
|
||||
/* Create the standard system handles
|
||||
*/
|
||||
if(CreateStdHandles() != 0)
|
||||
return 0;
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
/* CreateStdHandles creates the standard input, output, and error handles.
|
||||
* These handles aren't likely to be used since they're generally used for
|
||||
* console output, but startup code still likes to mess with them. They're
|
||||
* also useful for debugging since apps and runtime libraries might write
|
||||
* errors to stderr.
|
||||
*
|
||||
* Returns 0 on success, nonzero on failure.
|
||||
*/
|
||||
static int CreateStdHandles(void)
|
||||
{
|
||||
/* Create the standard input handle.
|
||||
*/
|
||||
hstdin = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
|
||||
if(hstdin == NULL)
|
||||
return 1;
|
||||
hstdin->common.magic = KERNEL_OBJECT_FILE;
|
||||
hstdin->fd = 0;
|
||||
hstdin->type = FILE_TYPE_CHAR;
|
||||
hstdin->misc_flags = 0;
|
||||
|
||||
/* Create the standard output handle
|
||||
*/
|
||||
hstdout = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
|
||||
if(hstdout == NULL)
|
||||
return 1;
|
||||
hstdout->common.magic = KERNEL_OBJECT_FILE;
|
||||
hstdout->fd = 1;
|
||||
hstdout->type = FILE_TYPE_CHAR;
|
||||
hstdout->misc_flags = 0;
|
||||
|
||||
/* Create the standard error handle
|
||||
*/
|
||||
hstderr = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
|
||||
if(hstderr == NULL)
|
||||
return 1;
|
||||
hstderr->common.magic = KERNEL_OBJECT_FILE;
|
||||
hstderr->fd = 2;
|
||||
hstderr->type = FILE_TYPE_CHAR;
|
||||
hstderr->misc_flags = 0;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
|
106
win32/memory.c
106
win32/memory.c
|
@ -9,9 +9,22 @@
|
|||
#include <string.h>
|
||||
#include <sys/time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include "windows.h"
|
||||
#include "winerror.h"
|
||||
#include "kernel32.h"
|
||||
#include "winbase.h"
|
||||
#include "stddebug.h"
|
||||
#include "debug.h"
|
||||
|
||||
typedef struct {
|
||||
caddr_t ptr;
|
||||
long size;
|
||||
} virtual_mem_t;
|
||||
|
||||
virtual_mem_t *mem = 0;
|
||||
int mem_count = 0;
|
||||
int mem_used = 0;
|
||||
|
||||
/***********************************************************************
|
||||
* VirtualAlloc (KERNEL32.548)
|
||||
|
@ -19,9 +32,79 @@
|
|||
LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize,
|
||||
DWORD fdwAllocationType, DWORD fdwProtect)
|
||||
{
|
||||
char *ptr;
|
||||
caddr_t ptr;
|
||||
int i;
|
||||
virtual_mem_t *tmp_mem;
|
||||
int prot;
|
||||
|
||||
printf("VirtualAlloc: size = %ld, address=%p\n", cbSize, lpvAddress);
|
||||
dprintf_win32(stddeb, "VirtualAlloc: size = %ld, address=%p\n", cbSize, lpvAddress);
|
||||
if (fdwAllocationType & MEM_RESERVE || !lpvAddress) {
|
||||
ptr = mmap((void *)((((unsigned long)lpvAddress-1) & 0xFFFF0000L)
|
||||
+ 0x00010000L),
|
||||
cbSize, PROT_NONE, MAP_ANON|MAP_PRIVATE,0,0);
|
||||
if (lpvAddress && ((unsigned long)ptr & 0xFFFF0000L)) {
|
||||
munmap(ptr, cbSize);
|
||||
cbSize += 65535;
|
||||
ptr = mmap(lpvAddress, cbSize,
|
||||
PROT_NONE, MAP_ANON|MAP_PRIVATE,0,0);
|
||||
ptr = (void *)((((unsigned long)ptr-1) & 0xFFFF0000L)+0x00010000L);
|
||||
}
|
||||
/* remember the size for VirtualFree since it's going to be handed
|
||||
a zero len */
|
||||
if (ptr) {
|
||||
if (mem_count == mem_used) {
|
||||
tmp_mem = realloc(mem,(mem_count+10)*sizeof(virtual_mem_t));
|
||||
if (!tmp_mem) return 0;
|
||||
mem = tmp_mem;
|
||||
memset(mem+mem_count, 0, 10*sizeof(virtual_mem_t));
|
||||
mem_count += 10;
|
||||
}
|
||||
for (i=0; i<mem_count; i++) {
|
||||
if (!(mem+i)->ptr) {
|
||||
(mem+i)->ptr = ptr;
|
||||
(mem+i)->size = cbSize;
|
||||
mem_used++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
ptr = lpvAddress;
|
||||
}
|
||||
if (fdwAllocationType & MEM_COMMIT) {
|
||||
switch(fdwProtect & ~(PAGE_GUARD | PAGE_NOCACHE)) {
|
||||
case PAGE_READONLY:
|
||||
prot=PROT_READ;
|
||||
break;
|
||||
case PAGE_READWRITE:
|
||||
prot=PROT_READ|PROT_WRITE;
|
||||
break;
|
||||
case PAGE_WRITECOPY:
|
||||
prot=PROT_WRITE;
|
||||
break;
|
||||
case PAGE_EXECUTE:
|
||||
prot=PROT_EXEC;
|
||||
break;
|
||||
case PAGE_EXECUTE_READ:
|
||||
prot=PROT_EXEC|PROT_READ;
|
||||
break;
|
||||
case PAGE_EXECUTE_READWRITE:
|
||||
prot=PROT_EXEC|PROT_READ|PROT_WRITE;
|
||||
break;
|
||||
case PAGE_EXECUTE_WRITECOPY:
|
||||
prot=PROT_EXEC|PROT_WRITE;
|
||||
break;
|
||||
case PAGE_NOACCESS:
|
||||
default:
|
||||
prot=PROT_NONE;
|
||||
break;
|
||||
}
|
||||
mprotect(ptr, cbSize, prot);
|
||||
}
|
||||
return ptr;
|
||||
#if 0
|
||||
/* kludge for gnu-win32 */
|
||||
if (fdwAllocationType & MEM_RESERVE) return sbrk(0);
|
||||
ptr = malloc(cbSize + 65536);
|
||||
if(ptr)
|
||||
{
|
||||
|
@ -30,7 +113,8 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize,
|
|||
ptr = (void *)(((unsigned long)ptr & 0xFFFF0000L) + 0x00010000L);
|
||||
memset(ptr, 0, cbSize);
|
||||
}
|
||||
printf("VirtualAlloc: got pointer %p\n", ptr);
|
||||
#endif
|
||||
dprintf_win32(stddeb, "VirtualAlloc: got pointer %p\n", ptr);
|
||||
return ptr;
|
||||
}
|
||||
|
||||
|
@ -39,8 +123,24 @@ LPVOID VirtualAlloc(LPVOID lpvAddress, DWORD cbSize,
|
|||
*/
|
||||
BOOL VirtualFree(LPVOID lpvAddress, DWORD cbSize, DWORD fdwFreeType)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (fdwFreeType & MEM_RELEASE) {
|
||||
for (i=0; i<mem_count; i++) {
|
||||
if ((mem+i)->ptr == lpvAddress) {
|
||||
munmap(lpvAddress, (mem+i)->size);
|
||||
(mem+i)->ptr = 0;
|
||||
mem_used--;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
mprotect(lpvAddress, cbSize, PROT_NONE);
|
||||
}
|
||||
#if 0
|
||||
if(lpvAddress)
|
||||
free(lpvAddress);
|
||||
#endif
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -0,0 +1,19 @@
|
|||
/*
|
||||
* object_mgt.c - Kernel object management functions
|
||||
*
|
||||
* Revision History:
|
||||
*
|
||||
* Oct 28 1995 C. Heide
|
||||
* First created.
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "handle32.h"
|
||||
|
||||
int ValidateKernelObject(KERNEL_OBJECT *ptr)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -0,0 +1,23 @@
|
|||
/*
|
||||
* Win32 kernel 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"
|
||||
|
||||
/***********************************************************************
|
||||
* ExitProcess (KERNEL32.100)
|
||||
*/
|
||||
|
||||
void ExitProcess(DWORD status)
|
||||
{
|
||||
exit(status);
|
||||
}
|
||||
|
|
@ -9,6 +9,8 @@
|
|||
#include "windows.h"
|
||||
#include "winerror.h"
|
||||
#include "kernel32.h"
|
||||
#include "stddebug.h"
|
||||
#include "debug.h"
|
||||
|
||||
/***********************************************************************
|
||||
* GetCurrentThreadId (KERNEL32.200)
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
#include "windows.h"
|
||||
#include "winerror.h"
|
||||
#include "kernel32.h"
|
||||
#include "stddebug.h"
|
||||
#include "debug.h"
|
||||
|
||||
/***********************************************************************
|
||||
* GetTimeZoneInformation (KERNEL32.302)
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* Default window procedure
|
||||
*
|
||||
* Copyright 1993 Alexandre Julliard
|
||||
* 1995 Alex Korobka
|
||||
*/
|
||||
|
||||
#include <stdlib.h>
|
||||
|
@ -20,6 +21,8 @@
|
|||
/* Last COLOR id */
|
||||
#define COLOR_MAX COLOR_BTNHIGHLIGHT
|
||||
|
||||
static short iMenuKey = 0;
|
||||
static short iMenuSysKey = 0;
|
||||
|
||||
/***********************************************************************
|
||||
* DEFWND_SetText
|
||||
|
@ -244,16 +247,95 @@ LRESULT DefWindowProc( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||
return NC_HandleSysCommand( hwnd, wParam, pt );
|
||||
}
|
||||
|
||||
case WM_KEYDOWN:
|
||||
|
||||
if(wParam == VK_F10) iMenuKey = VK_F10;
|
||||
break;
|
||||
|
||||
case WM_SYSKEYDOWN:
|
||||
/* this breaks current pseudo accelerators but
|
||||
creates a basis for implementing real ones */
|
||||
|
||||
if(wParam == VK_F10)
|
||||
{
|
||||
iMenuKey = VK_F10;
|
||||
break;
|
||||
}
|
||||
|
||||
if (wParam == VK_MENU)
|
||||
{ /* Send to WS_OVERLAPPED parent. TODO: Handle MDI */
|
||||
SendMessage( WIN_GetTopParent(hwnd), WM_SYSCOMMAND,
|
||||
SC_KEYMENU, 0L );
|
||||
{
|
||||
iMenuSysKey = (iMenuSysKey)? 0: 1;
|
||||
iMenuKey = 0;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_KEYUP:
|
||||
case WM_SYSKEYUP:
|
||||
|
||||
if( (wParam == VK_MENU && iMenuSysKey) ||
|
||||
(wParam == VK_F10 && iMenuKey) )
|
||||
|
||||
/* Send to WS_OVERLAPPED parent. TODO: Handle MDI */
|
||||
SendMessage( WIN_GetTopParent(hwnd), WM_SYSCOMMAND,
|
||||
SC_KEYMENU, 0L );
|
||||
|
||||
iMenuSysKey = 0;
|
||||
iMenuKey = 0;
|
||||
break;
|
||||
|
||||
case WM_SHOWWINDOW:
|
||||
if( !lParam ) return 0; /* sent from ShowWindow */
|
||||
|
||||
if( !(wndPtr->dwStyle & WS_POPUP) || !wndPtr->hwndOwner )
|
||||
return 0;
|
||||
|
||||
if( wndPtr->dwStyle & WS_VISIBLE )
|
||||
{ if( wParam ) return 0; }
|
||||
else
|
||||
if(!wParam ) return 0;
|
||||
|
||||
ShowWindow(hwnd,(wParam)? SW_SHOWNOACTIVATE: SW_HIDE);
|
||||
break;
|
||||
|
||||
case WM_CANCELMODE:
|
||||
|
||||
/* EndMenu() should be called if in menu state but currently it's
|
||||
impossible to detect - menu code should be updated*/
|
||||
|
||||
if( GetCapture() == hwnd )
|
||||
ReleaseCapture();
|
||||
|
||||
break;
|
||||
|
||||
case WM_VKEYTOITEM:
|
||||
case WM_CHARTOITEM:
|
||||
return -1;
|
||||
|
||||
case WM_DROPOBJECT:
|
||||
return DRAG_FILE;
|
||||
|
||||
case WM_QUERYDROPOBJECT:
|
||||
if(wndPtr->dwExStyle & WS_EX_ACCEPTFILES)
|
||||
return 1;
|
||||
break;
|
||||
|
||||
case WM_QUERYDRAGICON:
|
||||
{
|
||||
HICON hI = 0;
|
||||
|
||||
len = 1;
|
||||
while(len < 64)
|
||||
if( (hI = LoadIcon(wndPtr->hInstance,MAKEINTRESOURCE(len))) )
|
||||
return hI;
|
||||
}
|
||||
break;
|
||||
|
||||
case WM_QUERYOPEN:
|
||||
case WM_QUERYENDSESSION:
|
||||
return 1;
|
||||
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -411,7 +411,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
|
|||
header->y * yUnit / 8,
|
||||
header->cx * xUnit / 4,
|
||||
header->cy * yUnit / 8,
|
||||
hwnd, (HMENU)header->id,
|
||||
hwnd, (HMENU)((DWORD)header->id),
|
||||
dlgInfo->hDialogHeap, (SEGPTR)0 );
|
||||
}
|
||||
else
|
||||
|
@ -422,7 +422,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
|
|||
header->y * yUnit / 8,
|
||||
header->cx * xUnit / 4,
|
||||
header->cy * yUnit / 8,
|
||||
hwnd, (HMENU)header->id,
|
||||
hwnd, (HMENU)((DWORD)header->id),
|
||||
hInst, (SEGPTR)0 );
|
||||
}
|
||||
|
||||
|
|
348
windows/hook.c
348
windows/hook.c
|
@ -1,24 +1,215 @@
|
|||
/*
|
||||
* Windows hook functions
|
||||
*
|
||||
* Copyright 1994 Alexandre Julliard
|
||||
* Copyright 1994, 1995 Alexandre Julliard
|
||||
*
|
||||
* Based on investigations by Alex Korobka
|
||||
*/
|
||||
|
||||
/* Warning!
|
||||
* HHOOK is not a real handle, but a 32-bit pointer to a HOOKDATA structure.
|
||||
* This is for compatibility with Windows 3.0 where HHOOK was a HOOKPROC.
|
||||
/*
|
||||
* Warning!
|
||||
* A HHOOK is a 32-bit handle for compatibility with Windows 3.0 where it was
|
||||
* a pointer to the next function. Now it is in fact composed of a USER heap
|
||||
* handle in the low 16 bits and of a HOOK_MAGIC value in the high 16 bits
|
||||
* (except for WINELIB32 where it is a 32-bit handle). -- AJ
|
||||
*/
|
||||
|
||||
#include "hook.h"
|
||||
#include "message.h"
|
||||
#include "user.h"
|
||||
#include "stddebug.h"
|
||||
#include "debug.h"
|
||||
|
||||
HHOOK systemHooks[LAST_HOOK-FIRST_HOOK+1] = { 0, };
|
||||
/* This should probably reside in USER heap */
|
||||
static HANDLE HOOK_systemHooks[WH_NB_HOOKS] = { 0, };
|
||||
|
||||
/* Task-specific hooks should probably be in the task structure */
|
||||
HHOOK taskHooks[LAST_HOOK-FIRST_HOOK+1] = { 0, };
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_GetNextHook
|
||||
*
|
||||
* Get the next hook of a given hook.
|
||||
*/
|
||||
static HANDLE HOOK_GetNextHook( HANDLE hook )
|
||||
{
|
||||
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR( hook );
|
||||
if (!data) return 0;
|
||||
if (data->next) return data->next;
|
||||
if (!data->ownerQueue) return 0; /* Already system hook */
|
||||
/* Now start enumerating the system hooks */
|
||||
return HOOK_systemHooks[data->id - WH_FIRST_HOOK];
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_GetHook
|
||||
*
|
||||
* Get the first hook for a given type.
|
||||
*/
|
||||
static HANDLE HOOK_GetHook( short id )
|
||||
{
|
||||
MESSAGEQUEUE *queue;
|
||||
HANDLE hook = 0;
|
||||
|
||||
if ((queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) )) != NULL)
|
||||
hook = queue->hooks[id - WH_FIRST_HOOK];
|
||||
if (!hook) hook = HOOK_systemHooks[id - WH_FIRST_HOOK];
|
||||
return hook;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_SetHook
|
||||
*
|
||||
* Install a given hook.
|
||||
*/
|
||||
HANDLE HOOK_SetHook( short id, HOOKPROC proc, HINSTANCE hInst, HTASK hTask )
|
||||
{
|
||||
HOOKDATA *data;
|
||||
HANDLE handle;
|
||||
HQUEUE hQueue = 0;
|
||||
|
||||
if ((id < WH_FIRST_HOOK) || (id > WH_LAST_HOOK)) return 0;
|
||||
if (!(hInst = GetExePtr( hInst ))) return 0;
|
||||
|
||||
dprintf_hook( stddeb, "Setting hook %d: %08lx "NPFMT" "NPFMT"\n",
|
||||
id, (DWORD)proc, hInst, hTask );
|
||||
|
||||
if (hTask) /* Task-specific hook */
|
||||
{
|
||||
if ((id == WH_JOURNALRECORD) || (id == WH_JOURNALPLAYBACK) ||
|
||||
(id == WH_SYSMSGFILTER)) return 0; /* System-only hooks */
|
||||
if (!(hQueue = GetTaskQueue( hTask ))) return 0;
|
||||
}
|
||||
|
||||
if (id == WH_JOURNALPLAYBACK || id == WH_CBT ||
|
||||
id == WH_DEBUG || id == WH_SHELL)
|
||||
{
|
||||
fprintf( stdnimp, "Unimplemented hook set: (%d,%08lx,"NPFMT","NPFMT")!\n",
|
||||
id, (DWORD)proc, hInst, hTask );
|
||||
}
|
||||
|
||||
/* Create the hook structure */
|
||||
|
||||
if (!(handle = (HANDLE)USER_HEAP_ALLOC( sizeof(HOOKDATA) ))) return 0;
|
||||
data = (HOOKDATA *) USER_HEAP_LIN_ADDR( handle );
|
||||
data->proc = proc;
|
||||
data->id = id;
|
||||
data->ownerQueue = hQueue;
|
||||
data->ownerModule = hInst;
|
||||
data->inHookProc = 0;
|
||||
dprintf_hook( stddeb, "Setting hook %d: ret="NPFMT"\n", id, handle );
|
||||
|
||||
/* Insert it in the correct linked list */
|
||||
|
||||
if (hQueue)
|
||||
{
|
||||
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock( hQueue );
|
||||
data->next = queue->hooks[id - WH_FIRST_HOOK];
|
||||
queue->hooks[id - WH_FIRST_HOOK] = handle;
|
||||
}
|
||||
else
|
||||
{
|
||||
data->next = HOOK_systemHooks[id - WH_FIRST_HOOK];
|
||||
HOOK_systemHooks[id - WH_FIRST_HOOK] = handle;
|
||||
}
|
||||
return handle;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_RemoveHook
|
||||
*
|
||||
* Remove a hook from the list.
|
||||
*/
|
||||
static BOOL HOOK_RemoveHook( HANDLE hook )
|
||||
{
|
||||
HOOKDATA *data;
|
||||
HANDLE *prevHook;
|
||||
|
||||
dprintf_hook( stddeb, "Removing hook "NPFMT"\n", hook );
|
||||
|
||||
if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook))) return FALSE;
|
||||
if (data->inHookProc)
|
||||
{
|
||||
/* Mark it for deletion later on */
|
||||
dprintf_hook( stddeb, "Hook still running, deletion delayed\n" );
|
||||
data->proc = (FARPROC)0;
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
/* Remove it from the linked list */
|
||||
|
||||
if (data->ownerQueue)
|
||||
{
|
||||
MESSAGEQUEUE *queue = (MESSAGEQUEUE *)GlobalLock( data->ownerQueue );
|
||||
if (!queue) return FALSE;
|
||||
prevHook = &queue->hooks[data->id - WH_FIRST_HOOK];
|
||||
}
|
||||
else prevHook = &HOOK_systemHooks[data->id - WH_FIRST_HOOK];
|
||||
|
||||
while (*prevHook && *prevHook != hook)
|
||||
prevHook = &((HOOKDATA *)USER_HEAP_LIN_ADDR(*prevHook))->next;
|
||||
|
||||
if (!*prevHook) return FALSE;
|
||||
*prevHook = data->next;
|
||||
USER_HEAP_FREE( hook );
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_CallHook
|
||||
*
|
||||
* Call a hook procedure.
|
||||
*/
|
||||
static DWORD HOOK_CallHook( HANDLE hook, short code,
|
||||
WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HOOKDATA *data;
|
||||
MESSAGEQUEUE *queue;
|
||||
HANDLE prevHook;
|
||||
DWORD ret;
|
||||
|
||||
/* Find the first hook with a valid proc */
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (!hook) return 0;
|
||||
if (!(data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook))) return 0;
|
||||
if (data->proc) break;
|
||||
hook = data->next;
|
||||
}
|
||||
|
||||
/* Now call it */
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
||||
prevHook = queue->hCurHook;
|
||||
queue->hCurHook = hook;
|
||||
data->inHookProc = 1;
|
||||
|
||||
dprintf_hook( stddeb, "Calling hook "NPFMT": %d %04lx %08lx\n",
|
||||
hook, code, (DWORD)wParam, lParam );
|
||||
ret = CallHookProc( data->proc, code, wParam, lParam );
|
||||
dprintf_hook( stddeb, "Ret hook "NPFMT" = %08lx\n", hook, ret );
|
||||
|
||||
data->inHookProc = 0;
|
||||
queue->hCurHook = prevHook;
|
||||
if (!data->proc) HOOK_RemoveHook( hook );
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* HOOK_CallHooks
|
||||
*
|
||||
* Call a hook chain.
|
||||
*/
|
||||
DWORD HOOK_CallHooks( short id, short code, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HANDLE hook = HOOK_GetHook( id );
|
||||
if (!hook) return 0;
|
||||
return HOOK_CallHook( hook, code, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
|
@ -26,55 +217,44 @@ HHOOK taskHooks[LAST_HOOK-FIRST_HOOK+1] = { 0, };
|
|||
*/
|
||||
FARPROC SetWindowsHook( short id, HOOKPROC proc )
|
||||
{
|
||||
HHOOK hhook = SetWindowsHookEx( id, proc, 0, 0 );
|
||||
HOOKDATA *data = PTR_SEG_TO_LIN(hhook);
|
||||
if (data != NULL) {
|
||||
data = PTR_SEG_TO_LIN(data->next);
|
||||
if (data != NULL) {
|
||||
return data->proc;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
#ifdef WINELIB
|
||||
HINSTANCE hInst = 0;
|
||||
#else
|
||||
HINSTANCE hInst = FarGetOwner( HIWORD(proc) );
|
||||
#endif
|
||||
/* WH_MSGFILTER is the only task-specific hook for SetWindowsHook() */
|
||||
HTASK hTask = (id == WH_MSGFILTER) ? GetCurrentTask() : 0;
|
||||
|
||||
HANDLE handle = HOOK_SetHook( id, proc, hInst, hTask );
|
||||
if (!handle) return -1;
|
||||
if (!((HOOKDATA *)USER_HEAP_LIN_ADDR( handle ))->next) return 0;
|
||||
/* Not sure if the return value is correct; should not matter much
|
||||
* since it's never used (see DefHookProc). -- AJ */
|
||||
#ifdef WINELIB32
|
||||
return (FARPROC)handle;
|
||||
#else
|
||||
return (FARPROC)MAKELONG( handle, HOOK_MAGIC );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* UnhookWindowsHook (USER.234)
|
||||
*/
|
||||
BOOL UnhookWindowsHook( short id, FARPROC hproc )
|
||||
BOOL UnhookWindowsHook( short id, HOOKPROC proc )
|
||||
{
|
||||
HHOOK *prevHook,hhook;
|
||||
HANDLE hook = HOOK_GetHook( id );
|
||||
|
||||
prevHook = &TASK_HOOK(id);
|
||||
while (*prevHook) {
|
||||
HOOKDATA *data = (HOOKDATA *)PTR_SEG_TO_LIN(*prevHook);
|
||||
dprintf_hook( stddeb, "UnhookWindowsHook: %d %08lx\n", id, (DWORD)proc );
|
||||
|
||||
if (data->proc == hproc) {
|
||||
hhook = *prevHook;
|
||||
*prevHook = data->next;
|
||||
#ifdef WINELIB32
|
||||
USER_HEAP_FREE((HANDLE)hhook);
|
||||
#else
|
||||
USER_HEAP_FREE(LOWORD(hhook));
|
||||
#endif
|
||||
return TRUE;
|
||||
while (hook)
|
||||
{
|
||||
HOOKDATA *data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook);
|
||||
if (data->proc == proc) break;
|
||||
hook = HOOK_GetNextHook( hook );
|
||||
}
|
||||
}
|
||||
prevHook = &SYSTEM_HOOK(id);
|
||||
while (*prevHook) {
|
||||
HOOKDATA *data = (HOOKDATA *)PTR_SEG_TO_LIN(*prevHook);
|
||||
if (data->proc == hproc) {
|
||||
hhook = *prevHook;
|
||||
*prevHook = data->next;
|
||||
#ifdef WINELIB32
|
||||
USER_HEAP_FREE((HANDLE)hhook);
|
||||
#else
|
||||
USER_HEAP_FREE(LOWORD(hhook));
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
}
|
||||
return FALSE;
|
||||
if (!hook) return FALSE;
|
||||
return HOOK_RemoveHook( hook );
|
||||
}
|
||||
|
||||
|
||||
|
@ -83,7 +263,14 @@ BOOL UnhookWindowsHook( short id, FARPROC hproc )
|
|||
*/
|
||||
DWORD DefHookProc( short code, WORD wParam, DWORD lParam, HHOOK *hhook )
|
||||
{
|
||||
return CallNextHookEx( *hhook, code, wParam, lParam );
|
||||
/* Note: the *hhook parameter is never used, since we rely on the
|
||||
* current hook value from the task queue to find the next hook. */
|
||||
MESSAGEQUEUE *queue;
|
||||
HANDLE next;
|
||||
|
||||
if (!(queue = (MESSAGEQUEUE *)GlobalLock( GetTaskQueue(0) ))) return 0;
|
||||
if (!(next = HOOK_GetNextHook( queue->hCurHook ))) return 0;
|
||||
return HOOK_CallHook( next, code, wParam, lParam );
|
||||
}
|
||||
|
||||
|
||||
|
@ -92,47 +279,23 @@ DWORD DefHookProc( short code, WORD wParam, DWORD lParam, HHOOK *hhook )
|
|||
*/
|
||||
BOOL CallMsgFilter( SEGPTR msg, short code )
|
||||
{
|
||||
if (CALL_TASK_HOOK( WH_MSGFILTER, code, 0, (LPARAM)msg ))
|
||||
return TRUE;
|
||||
return CALL_SYSTEM_HOOK( WH_SYSMSGFILTER, code, 0, (LPARAM)msg );
|
||||
if (GetSysModalWindow()) return FALSE;
|
||||
if (HOOK_CallHooks( WH_SYSMSGFILTER, code, 0, (LPARAM)msg )) return TRUE;
|
||||
return HOOK_CallHooks( WH_MSGFILTER, code, 0, (LPARAM)msg );
|
||||
}
|
||||
|
||||
|
||||
/***********************************************************************
|
||||
* SetWindowsHookEx (USER.291)
|
||||
*/
|
||||
HHOOK SetWindowsHookEx( short id, HOOKPROC proc, HINSTANCE hinst, HTASK htask )
|
||||
HHOOK SetWindowsHookEx( short id, HOOKPROC proc, HINSTANCE hInst, HTASK hTask )
|
||||
{
|
||||
HOOKDATA *data;
|
||||
HANDLE handle;
|
||||
HHOOK *prevHook;
|
||||
|
||||
if ((id < FIRST_HOOK) || (id > LAST_HOOK)) return 0;
|
||||
if (id != WH_GETMESSAGE && id != WH_CALLWNDPROC) {
|
||||
fprintf( stdnimp, "Unimplemented hook set: (%d,%08lx,"NPFMT","NPFMT")!\n",
|
||||
id, (DWORD)proc, hinst, htask );
|
||||
}
|
||||
if (htask) /* Task-specific hook */
|
||||
{
|
||||
if ((id == WH_JOURNALRECORD) || (id == WH_JOURNALPLAYBACK) ||
|
||||
(id == WH_SYSMSGFILTER)) return 0;
|
||||
prevHook = &TASK_HOOK( id );
|
||||
}
|
||||
else /* System-wide hook */
|
||||
{
|
||||
prevHook = &SYSTEM_HOOK( id );
|
||||
}
|
||||
|
||||
handle = (HANDLE) USER_HEAP_ALLOC( sizeof(*data) );
|
||||
if (!handle) return 0;
|
||||
data = (HOOKDATA *) USER_HEAP_LIN_ADDR( handle );
|
||||
|
||||
data->next = *prevHook;
|
||||
data->proc = proc;
|
||||
data->id = id;
|
||||
data->htask = htask;
|
||||
*prevHook = (HHOOK)USER_HEAP_SEG_ADDR(handle);
|
||||
return *prevHook;
|
||||
HANDLE handle = HOOK_SetHook( id, proc, hInst, hTask );
|
||||
#ifdef WINELIB32
|
||||
return (HHOOK)handle;
|
||||
#else
|
||||
return MAKELONG( handle, HOOK_MAGIC );
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
@ -141,22 +304,12 @@ HHOOK SetWindowsHookEx( short id, HOOKPROC proc, HINSTANCE hinst, HTASK htask )
|
|||
*/
|
||||
BOOL UnhookWindowsHookEx( HHOOK hhook )
|
||||
{
|
||||
HOOKDATA *data = (HOOKDATA *)PTR_SEG_TO_LIN(hhook);
|
||||
HHOOK *prevHook;
|
||||
|
||||
if (!data) return FALSE;
|
||||
prevHook = data->htask ? &TASK_HOOK(data->id) : &SYSTEM_HOOK(data->id);
|
||||
while (*prevHook && (*prevHook != hhook)) {
|
||||
prevHook = &((HOOKDATA *)*prevHook)->next;
|
||||
}
|
||||
if (!*prevHook) return FALSE;
|
||||
*prevHook = data->next;
|
||||
#ifdef WINELIB32
|
||||
USER_HEAP_FREE( (HANDLE)hhook );
|
||||
return HOOK_RemoveHook( (HANDLE)hhook );
|
||||
#else
|
||||
USER_HEAP_FREE( hhook & 0xffff );
|
||||
if (HIWORD(hhook) != HOOK_MAGIC) return FALSE; /* Not a new format hook */
|
||||
return HOOK_RemoveHook( LOWORD(hhook) );
|
||||
#endif
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
|
||||
|
@ -165,7 +318,8 @@ BOOL UnhookWindowsHookEx( HHOOK hhook )
|
|||
*/
|
||||
DWORD CallNextHookEx( HHOOK hhook, short code, WPARAM wParam, LPARAM lParam )
|
||||
{
|
||||
HOOKDATA *data = (HOOKDATA *)PTR_SEG_TO_LIN(hhook);
|
||||
if (data == NULL || !data->next) return 0;
|
||||
else return INTERNAL_CALL_HOOK( data->next, code, wParam, lParam );
|
||||
HANDLE next;
|
||||
if (HIWORD(hhook) != HOOK_MAGIC) return 0; /* Not a new format hook */
|
||||
if (!(next = HOOK_GetNextHook( LOWORD(hhook) ))) return 0;
|
||||
return HOOK_CallHook( next, code, wParam, lParam );
|
||||
}
|
||||
|
|
|
@ -52,29 +52,12 @@ static HANDLE MSG_CreateMsgQueue( int size )
|
|||
int queueSize;
|
||||
|
||||
queueSize = sizeof(MESSAGEQUEUE) + size * sizeof(QMSG);
|
||||
if (!(hQueue = GlobalAlloc( GMEM_FIXED, queueSize ))) return 0;
|
||||
if (!(hQueue = GlobalAlloc( GMEM_FIXED | GMEM_ZEROINIT, queueSize )))
|
||||
return 0;
|
||||
msgQueue = (MESSAGEQUEUE *) GlobalLock( hQueue );
|
||||
msgQueue->next = 0;
|
||||
msgQueue->hTask = 0;
|
||||
msgQueue->msgSize = sizeof(QMSG);
|
||||
msgQueue->msgCount = 0;
|
||||
msgQueue->nextMessage = 0;
|
||||
msgQueue->nextFreeMessage = 0;
|
||||
msgQueue->queueSize = size;
|
||||
msgQueue->GetMessageTimeVal = 0;
|
||||
msgQueue->GetMessagePosVal = 0;
|
||||
msgQueue->GetMessageExtraInfoVal = 0;
|
||||
msgQueue->lParam = 0;
|
||||
msgQueue->wParam = 0;
|
||||
msgQueue->msg = 0;
|
||||
msgQueue->hWnd = 0;
|
||||
msgQueue->wPostQMsg = 0;
|
||||
msgQueue->wExitCode = 0;
|
||||
msgQueue->InSendMessageHandle = 0;
|
||||
msgQueue->wPaintCount = 0;
|
||||
msgQueue->wTimerCount = 0;
|
||||
msgQueue->tempStatus = 0;
|
||||
msgQueue->status = 0;
|
||||
msgQueue->wWinVersion = 0; /* FIXME? */
|
||||
GlobalUnlock( hQueue );
|
||||
return hQueue;
|
||||
}
|
||||
|
@ -292,6 +275,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
|
|||
static WORD lastClickMsg = 0;
|
||||
static POINT lastClickPos = { 0, 0 };
|
||||
POINT pt = msg->pt;
|
||||
MOUSEHOOKSTRUCT hook = { msg->pt, 0, HTCLIENT, 0 };
|
||||
|
||||
BOOL mouseClick = ((msg->message == WM_LBUTTONDOWN) ||
|
||||
(msg->message == WM_RBUTTONDOWN) ||
|
||||
|
@ -304,7 +288,10 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
|
|||
msg->hwnd = GetCapture();
|
||||
ScreenToClient( msg->hwnd, &pt );
|
||||
msg->lParam = MAKELONG( pt.x, pt.y );
|
||||
return TRUE; /* No need to further process the message */
|
||||
/* No need to further process the message */
|
||||
hook.hwnd = msg->hwnd;
|
||||
return !HOOK_CallHooks( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
|
||||
msg->message, (LPARAM)MAKE_SEGPTR(&hook));
|
||||
}
|
||||
|
||||
if ((hittest = MSG_GetWindowForEvent( msg->pt, &msg->hwnd )) != HTERROR)
|
||||
|
@ -389,7 +376,10 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
|
|||
}
|
||||
msg->lParam = MAKELONG( pt.x, pt.y );
|
||||
|
||||
return TRUE;
|
||||
hook.hwnd = msg->hwnd;
|
||||
hook.wHitTestCode = hittest;
|
||||
return !HOOK_CallHooks( WH_MOUSE, remove ? HC_ACTION : HC_NOREMOVE,
|
||||
msg->message, (LPARAM)MAKE_SEGPTR(&hook));
|
||||
}
|
||||
|
||||
|
||||
|
@ -400,7 +390,7 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
|
|||
* Return value indicates whether the translated message must be passed
|
||||
* to the user.
|
||||
*/
|
||||
static BOOL MSG_TranslateKeyboardMsg( MSG *msg )
|
||||
static BOOL MSG_TranslateKeyboardMsg( MSG *msg, BOOL remove )
|
||||
{
|
||||
/* Should check Ctrl-Esc and PrintScreen here */
|
||||
|
||||
|
@ -412,7 +402,8 @@ static BOOL MSG_TranslateKeyboardMsg( MSG *msg )
|
|||
msg->hwnd = GetActiveWindow();
|
||||
msg->message += WM_SYSKEYDOWN - WM_KEYDOWN;
|
||||
}
|
||||
return TRUE;
|
||||
return !HOOK_CallHooks( WH_KEYBOARD, remove ? HC_ACTION : HC_NOREMOVE,
|
||||
msg->wParam, msg->lParam );
|
||||
}
|
||||
|
||||
|
||||
|
@ -439,9 +430,15 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, WORD first, WORD last,
|
|||
}
|
||||
else if ((msg->message >= WM_KEYFIRST) && (msg->message <= WM_KEYLAST))
|
||||
{
|
||||
if (!MSG_TranslateKeyboardMsg( msg )) continue;
|
||||
if (!MSG_TranslateKeyboardMsg( msg, remove )) continue;
|
||||
}
|
||||
else /* Non-standard hardware event */
|
||||
{
|
||||
HARDWAREHOOKSTRUCT hook = { msg->hwnd, msg->message,
|
||||
msg->wParam, msg->lParam };
|
||||
if (HOOK_CallHooks( WH_HARDWARE, remove ? HC_ACTION : HC_NOREMOVE,
|
||||
0, (LPARAM)MAKE_SEGPTR(&hook) )) continue;
|
||||
}
|
||||
else continue; /* Should never happen */
|
||||
|
||||
/* Check message against filters */
|
||||
|
||||
|
@ -451,7 +448,13 @@ static BOOL MSG_PeekHardwareMsg( MSG *msg, HWND hwnd, WORD first, WORD last,
|
|||
if ((msg->hwnd != GetDesktopWindow()) &&
|
||||
(GetWindowTask(msg->hwnd) != GetCurrentTask()))
|
||||
continue; /* Not for this task */
|
||||
if (remove) MSG_RemoveMsg( sysMsgQueue, pos );
|
||||
if (remove)
|
||||
{
|
||||
MSG tmpMsg = *msg; /* FIXME */
|
||||
HOOK_CallHooks( WH_JOURNALRECORD, HC_ACTION,
|
||||
0, (LPARAM)MAKE_SEGPTR(&tmpMsg) );
|
||||
MSG_RemoveMsg( sysMsgQueue, pos );
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
|
@ -955,8 +958,7 @@ BOOL GetMessage( SEGPTR msg, HWND hwnd, UINT first, UINT last )
|
|||
{
|
||||
MSG_PeekMessage( (MSG *)PTR_SEG_TO_LIN(msg),
|
||||
hwnd, first, last, PM_REMOVE, FALSE );
|
||||
CALL_TASK_HOOK( WH_GETMESSAGE, 0, 0, (LPARAM)msg );
|
||||
CALL_SYSTEM_HOOK( WH_GETMESSAGE, 0, 0, (LPARAM)msg );
|
||||
HOOK_CallHooks( WH_GETMESSAGE, HC_ACTION, 0, (LPARAM)msg );
|
||||
return (((MSG *)PTR_SEG_TO_LIN(msg))->message != WM_QUIT);
|
||||
}
|
||||
|
||||
|
@ -1066,8 +1068,7 @@ LRESULT SendMessage( HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam )
|
|||
|
||||
EnterSpyMessage(SPY_SENDMESSAGE, hwnd, msg, wParam, lParam);
|
||||
|
||||
CALL_TASK_HOOK( WH_CALLWNDPROC, HC_ACTION, 1, MAKE_SEGPTR(&msgstruct) );
|
||||
CALL_SYSTEM_HOOK( WH_CALLWNDPROC, HC_ACTION, 1, MAKE_SEGPTR(&msgstruct) );
|
||||
HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 1, MAKE_SEGPTR(&msgstruct) );
|
||||
if (!(wndPtr = WIN_FindWndPtr( hwnd )))
|
||||
{
|
||||
ExitSpyMessage(SPY_RESULT_INVALIDHWND,hwnd,msg,0);
|
||||
|
@ -1142,6 +1143,7 @@ LONG DispatchMessage( LPMSG msg )
|
|||
{
|
||||
HINSTANCE ds = msg->hwnd ? WIN_GetWindowInstance( msg->hwnd )
|
||||
: (HINSTANCE)CURRENT_DS;
|
||||
/* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
|
||||
return CallWndProc( (WNDPROC)msg->lParam, ds, msg->hwnd,
|
||||
msg->message, msg->wParam, GetTickCount() );
|
||||
}
|
||||
|
@ -1152,6 +1154,7 @@ LONG DispatchMessage( LPMSG msg )
|
|||
if (!wndPtr->lpfnWndProc) return 0;
|
||||
painting = (msg->message == WM_PAINT);
|
||||
if (painting) wndPtr->flags |= WIN_NEEDS_BEGINPAINT;
|
||||
/* HOOK_CallHooks( WH_CALLWNDPROC, HC_ACTION, 0, FIXME ); */
|
||||
retval = CallWindowProc( wndPtr->lpfnWndProc, msg->hwnd, msg->message,
|
||||
msg->wParam, msg->lParam );
|
||||
if (painting && IsWindow(msg->hwnd) &&
|
||||
|
@ -1221,6 +1224,14 @@ DWORD GetTickCount(void)
|
|||
return (t.tv_sec * 1000) + (t.tv_usec / 1000);
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* GetCurrentTime (effectively identical to GetTickCount)
|
||||
*/
|
||||
DWORD GetCurrentTime(void)
|
||||
{
|
||||
return GetTickCount();
|
||||
}
|
||||
|
||||
/***********************************************************************
|
||||
* InSendMessage (USER.192
|
||||
*
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/* utility.c Utility functions for Wine
|
||||
* Author: acb
|
||||
* Author: Andrew Bulhak
|
||||
* Commenced: 10-9-1993
|
||||
*
|
||||
* This unit contains the implementations of
|
||||
|
@ -19,8 +19,6 @@
|
|||
#include "debug.h"
|
||||
|
||||
|
||||
/* static char Copyright[] = "Copyright Andrew C. Bulhak, 1993"; */
|
||||
|
||||
|
||||
/* MulDiv is a simple function that may as well have been
|
||||
* implemented as a macro; however Microsoft, in their infinite
|
||||
|
@ -424,24 +422,3 @@ int wvsprintf(LPSTR buf, LPSTR format, LPSTR args)
|
|||
return result;
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* DragDetect ( USER.465 )
|
||||
*
|
||||
* Hardly ever called at all
|
||||
*/
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* DragObject ( USER.464 )
|
||||
*
|
||||
* responsible for generation of WM_QUERYDROPOBJECT, WM_DRAGLOOP,
|
||||
* WM_DRAGMOVE, WM_DROPOBJECT
|
||||
*/
|
||||
LONG DragObject(HWND hDesktop, HWND hWnd, UINT Unknown1, WORD Unknown2, WORD Unknown3, HCURSOR hCursor)
|
||||
{
|
||||
|
||||
fprintf(stdnimp,"DragObject: EmptyStub!!!\n");
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
|
259
windows/win.c
259
windows/win.c
|
@ -31,6 +31,11 @@
|
|||
static HWND hwndDesktop = 0;
|
||||
static HWND hWndSysModal = 0;
|
||||
|
||||
static WORD wDragWidth = 8;
|
||||
static WORD wDragHeight= 6;
|
||||
|
||||
extern HCURSOR CURSORICON_IconToCursor(HICON);
|
||||
|
||||
/***********************************************************************
|
||||
* WIN_FindWndPtr
|
||||
*
|
||||
|
@ -1205,7 +1210,16 @@ BOOL EnumChildWindows(HWND hwnd, FARPROC wndenumprc, LPARAM lParam)
|
|||
*/
|
||||
BOOL AnyPopup()
|
||||
{
|
||||
dprintf_win(stdnimp,"EMPTY STUB !! AnyPopup !\n");
|
||||
WND *wndPtr = WIN_FindWndPtr(hwndDesktop);
|
||||
HWND hwnd = wndPtr->hwndChild;
|
||||
|
||||
for( ; hwnd ; hwnd = wndPtr->hwndNext )
|
||||
{
|
||||
wndPtr = WIN_FindWndPtr(hwnd);
|
||||
if(wndPtr->hwndOwner)
|
||||
if(wndPtr->dwStyle & WS_VISIBLE)
|
||||
return TRUE;
|
||||
}
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -1238,3 +1252,246 @@ HWND GetSysModalWindow(void)
|
|||
{
|
||||
return hWndSysModal;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* DRAG_QueryUpdate
|
||||
*
|
||||
* recursively find a child that contains spDragInfo->pt point
|
||||
* and send WM_QUERYDROPOBJECT
|
||||
*/
|
||||
BOOL DRAG_QueryUpdate( HWND hQueryWnd, SEGPTR spDragInfo )
|
||||
{
|
||||
HWND hWnd;
|
||||
BOOL wParam,bResult = 0;
|
||||
POINT pt;
|
||||
LPDRAGINFO ptrDragInfo = (LPDRAGINFO) PTR_SEG_TO_LIN(spDragInfo);
|
||||
WND *ptrQueryWnd = WIN_FindWndPtr(hQueryWnd),*ptrWnd;
|
||||
RECT tempRect; /* this sucks */
|
||||
|
||||
if( !ptrQueryWnd || !ptrDragInfo ) return 0;
|
||||
|
||||
pt = ptrDragInfo->pt;
|
||||
|
||||
GetWindowRect(hQueryWnd,&tempRect);
|
||||
|
||||
if( !PtInRect(&tempRect,pt) ||
|
||||
(ptrQueryWnd->dwStyle & WS_DISABLED) )
|
||||
return 0;
|
||||
|
||||
if( !(ptrQueryWnd->dwStyle & WS_MINIMIZE) )
|
||||
{
|
||||
tempRect = ptrQueryWnd->rectClient;
|
||||
if(ptrQueryWnd->dwStyle & WS_CHILD)
|
||||
MapWindowPoints(ptrQueryWnd->hwndParent,0,(LPPOINT)&tempRect,2);
|
||||
|
||||
if( PtInRect(&tempRect,pt) )
|
||||
{
|
||||
wParam = 0;
|
||||
ptrWnd = WIN_FindWndPtr(hWnd = ptrQueryWnd->hwndChild);
|
||||
|
||||
for( ;ptrWnd ;ptrWnd = WIN_FindWndPtr(hWnd = ptrWnd->hwndNext) )
|
||||
if( ptrWnd->dwStyle & WS_VISIBLE )
|
||||
{
|
||||
GetWindowRect(hWnd,&tempRect);
|
||||
|
||||
if( PtInRect(&tempRect,pt) )
|
||||
break;
|
||||
}
|
||||
|
||||
if(ptrWnd)
|
||||
dprintf_msg(stddeb,"DragQueryUpdate: hwnd = "NPFMT", %i %i - %i %i\n",hWnd,
|
||||
ptrWnd->rectWindow.left,ptrWnd->rectWindow.top,
|
||||
ptrWnd->rectWindow.right,ptrWnd->rectWindow.bottom);
|
||||
else
|
||||
dprintf_msg(stddeb,"DragQueryUpdate: hwnd = "NPFMT"\n",hWnd);
|
||||
|
||||
if(ptrWnd)
|
||||
if( !(ptrWnd->dwStyle & WS_DISABLED) )
|
||||
bResult = DRAG_QueryUpdate(hWnd, spDragInfo);
|
||||
|
||||
if(bResult) return bResult;
|
||||
}
|
||||
else wParam = 1;
|
||||
}
|
||||
else wParam = 1;
|
||||
|
||||
ScreenToClient(hQueryWnd,&ptrDragInfo->pt);
|
||||
|
||||
ptrDragInfo->hScope = hQueryWnd;
|
||||
|
||||
bResult = SendMessage( hQueryWnd ,WM_QUERYDROPOBJECT ,
|
||||
(WPARAM)wParam ,(LPARAM) spDragInfo );
|
||||
if( !bResult )
|
||||
ptrDragInfo->pt = pt;
|
||||
|
||||
return bResult;
|
||||
}
|
||||
|
||||
/*******************************************************************
|
||||
* DragDetect ( USER.465 )
|
||||
*
|
||||
*/
|
||||
BOOL DragDetect(HWND hWnd, POINT pt)
|
||||
{
|
||||
MSG msg;
|
||||
RECT rect;
|
||||
|
||||
rect.left = pt.x - wDragWidth;
|
||||
rect.right = pt.x + wDragWidth;
|
||||
|
||||
rect.top = pt.y - wDragHeight;
|
||||
rect.bottom = pt.y + wDragHeight;
|
||||
|
||||
SetCapture(hWnd);
|
||||
|
||||
while(1)
|
||||
{
|
||||
while(PeekMessage(&msg ,0 ,WM_MOUSEFIRST ,WM_MOUSELAST ,PM_REMOVE))
|
||||
{
|
||||
if( msg.message == WM_LBUTTONUP )
|
||||
{
|
||||
ReleaseCapture();
|
||||
return 0;
|
||||
}
|
||||
if( msg.message == WM_MOUSEMOVE )
|
||||
{
|
||||
POINT pt = { LOWORD(msg.lParam), HIWORD(msg.lParam) };
|
||||
if( !PtInRect( &rect, pt ) )
|
||||
{
|
||||
ReleaseCapture();
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
WaitMessage();
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* DragObject ( USER.464 )
|
||||
*
|
||||
*/
|
||||
DWORD DragObject(HWND hwndScope, HWND hWnd, WORD wObj, HANDLE hOfStruct,
|
||||
WORD szList , HCURSOR hCursor)
|
||||
{
|
||||
MSG msg;
|
||||
LPDRAGINFO lpDragInfo;
|
||||
SEGPTR spDragInfo;
|
||||
HCURSOR hDragCursor=0, hOldCursor=0, hBummer=0;
|
||||
HANDLE hDragInfo = GlobalAlloc( GMEM_SHARE | GMEM_ZEROINIT, 2*sizeof(DRAGINFO));
|
||||
WND *wndPtr = WIN_FindWndPtr(hWnd);
|
||||
DWORD dwRet = 0;
|
||||
short dragDone = 0;
|
||||
HCURSOR hCurrentCursor = 0;
|
||||
HWND hCurrentWnd = 0;
|
||||
WORD btemp;
|
||||
|
||||
fprintf(stdnimp,"DragObject: experimental\n");
|
||||
|
||||
lpDragInfo = (LPDRAGINFO) GlobalLock(hDragInfo);
|
||||
spDragInfo = (SEGPTR) WIN16_GlobalLock(hDragInfo);
|
||||
|
||||
if( !lpDragInfo || !spDragInfo ) return 0L;
|
||||
|
||||
hBummer = LoadCursor(0,IDC_BUMMER);
|
||||
|
||||
if( !hBummer || !wndPtr )
|
||||
{
|
||||
GlobalFree(hDragInfo);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
if(hCursor)
|
||||
{
|
||||
if( !(hDragCursor = CURSORICON_IconToCursor(hCursor)) )
|
||||
{
|
||||
GlobalFree(hDragInfo);
|
||||
return 0L;
|
||||
}
|
||||
|
||||
if( hDragCursor == hCursor ) hDragCursor = 0;
|
||||
else hCursor = hDragCursor;
|
||||
|
||||
hOldCursor = SetCursor(hDragCursor);
|
||||
}
|
||||
|
||||
lpDragInfo->hWnd = hWnd;
|
||||
lpDragInfo->hScope = 0;
|
||||
lpDragInfo->wFlags = wObj;
|
||||
lpDragInfo->hList = szList; /* near pointer! */
|
||||
lpDragInfo->hOfStruct = hOfStruct;
|
||||
lpDragInfo->l = 0L;
|
||||
|
||||
SetCapture(hWnd);
|
||||
ShowCursor(1);
|
||||
|
||||
while( !dragDone )
|
||||
{
|
||||
WaitMessage();
|
||||
|
||||
if( !PeekMessage(&msg,0,WM_MOUSEFIRST,WM_MOUSELAST,PM_REMOVE) )
|
||||
continue;
|
||||
|
||||
*(lpDragInfo+1) = *lpDragInfo;
|
||||
|
||||
lpDragInfo->pt = msg.pt;
|
||||
|
||||
/* update DRAGINFO struct */
|
||||
dprintf_msg(stddeb,"drag: lpDI->hScope = "NPFMT"\n",lpDragInfo->hScope);
|
||||
|
||||
if( (btemp = (WORD)DRAG_QueryUpdate(hwndScope, spDragInfo)) > 0 )
|
||||
hCurrentCursor = hCursor;
|
||||
else
|
||||
{
|
||||
hCurrentCursor = hBummer;
|
||||
lpDragInfo->hScope = 0;
|
||||
}
|
||||
if( hCurrentCursor )
|
||||
SetCursor(hCurrentCursor);
|
||||
|
||||
dprintf_msg(stddeb,"drag: got "NPFMT"\n",btemp);
|
||||
|
||||
/* send WM_DRAGLOOP */
|
||||
SendMessage( hWnd, WM_DRAGLOOP, (WPARAM)(hCurrentCursor != hBummer) ,
|
||||
(LPARAM) spDragInfo );
|
||||
/* send WM_DRAGSELECT or WM_DRAGMOVE */
|
||||
if( hCurrentWnd != lpDragInfo->hScope )
|
||||
{
|
||||
if( hCurrentWnd )
|
||||
SendMessage( hCurrentWnd, WM_DRAGSELECT, 0,
|
||||
(LPARAM)MAKELONG(LOWORD(spDragInfo)+sizeof(DRAGINFO),
|
||||
HIWORD(spDragInfo)) );
|
||||
hCurrentWnd = lpDragInfo->hScope;
|
||||
if( hCurrentWnd )
|
||||
SendMessage( hCurrentWnd, WM_DRAGSELECT, 1, (LPARAM)spDragInfo);
|
||||
}
|
||||
else
|
||||
if( hCurrentWnd )
|
||||
SendMessage( hCurrentWnd, WM_DRAGMOVE, 0, (LPARAM)spDragInfo);
|
||||
|
||||
|
||||
/* check if we're done */
|
||||
if( msg.message == WM_LBUTTONUP || msg.message == WM_NCLBUTTONUP )
|
||||
dragDone = TRUE;
|
||||
}
|
||||
|
||||
ReleaseCapture();
|
||||
ShowCursor(0);
|
||||
|
||||
if( hCursor )
|
||||
{
|
||||
SetCursor(hOldCursor);
|
||||
if( hDragCursor )
|
||||
DestroyCursor(hDragCursor);
|
||||
}
|
||||
|
||||
if( hCurrentCursor != hBummer )
|
||||
dwRet = SendMessage( lpDragInfo->hScope, WM_DROPOBJECT,
|
||||
hWnd, (LPARAM)spDragInfo );
|
||||
GlobalFree(hDragInfo);
|
||||
|
||||
return dwRet;
|
||||
}
|
||||
|
||||
|
|
|
@ -616,7 +616,7 @@ LONG WINPOS_HandleWindowPosChanging( WINDOWPOS *winpos )
|
|||
WND *wndPtr = WIN_FindWndPtr( winpos->hwnd );
|
||||
if (!wndPtr || (winpos->flags & SWP_NOSIZE)) return 0;
|
||||
if ((wndPtr->dwStyle & WS_THICKFRAME) ||
|
||||
(wndPtr->dwStyle & (WS_POPUP | WS_CHILD) == 0))
|
||||
((wndPtr->dwStyle & (WS_POPUP | WS_CHILD)) == 0))
|
||||
{
|
||||
NC_GetMinMaxInfo( winpos->hwnd, &maxSize, NULL, NULL, NULL );
|
||||
winpos->cx = MIN( winpos->cx, maxSize.x );
|
||||
|
|
Loading…
Reference in New Issue