Release 980215
Sun Feb 15 12:02:59 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [graphics/x11drv/*.c] [objects/*.c]
A few X11 critical section optimizations, mostly with XGet/PutPixel.
* [scheduler/sysdeps.c] [misc/main.c]
Make sure X11 critical section is available before any Xlib call.
* [if1632/relay.c] [tools/build.c]
Yet another attempt at fixing Catch/Throw.
* [loader/pe_image.c]
Fixed broken PE DLL loading.
* [include/winnt.h] [scheduler/handle.c] [scheduler/*.c]
Implemented handle access rights.
Added Get/SetHandleInformation.
Sun Feb 15 09:45:23 1997 Andreas Mohr <100.30936@germany.net>
* [misc/winsock.c]
Fixed bug in WSACleanup which lead to crashes in WINSOCK_HandleIO.
* [graphics/fontengine.c] [include/font.h]
Minor improvements.
* [memory/global.c]
Implemented GlobalEntryHandle.
* [misc/toolhelp.c]
Fixed a memory bug in Notify*register.
* [misc/w32scomb.c]
Improved Get16DLLAddress.
* [objects/gdiobj.c]
Implemented GdiSeeGdiDo.
Sat Feb 14 14:57:39 1998 John Richardson <jrichard@zko.dec.com>
* [win32/console.c]
Added the console implementation, AllocConsole, FreeConsole,
CONSOLE_InheritConsole.
* [documentation/console]
Some documentation on the console.
* [include/winerror.h]
Added some error defines.
* [scheduler/k32obj.c]
Registered the scheduler ops.
Fri Feb 13 19:35:35 1998 James Moody <013263m@dragon.acadiau.ca>
* [ole/ole2nls.c]
Some English language fixes for missing values.
* [controls/listbox.c]
Fix to allow an empty listbox to deselect all items.
* [relay32/user32.spec] [windows/keyboard.c]
CreateAcceleratorTableA stub method.
* [windows/sysmetrics.c]
Added missing SM_CXCURSOR & SM_CYCURSOR initializers.
* [windows/message.c]
PostThreadMessage32A stub method.
Fri Feb 13 17:12:24 1998 Jim Peterson <jspeter@roanoke.infi.net>
* [libtest/hello3res.rc] [libtest/hello3.c] [libtest/Makefile.in]
Updated the 'hello3' test so that it functions properly again.
Fri Feb 13 14:08:07 1998 Martin Boehme <boehme@informatik.mu-luebeck.de>
* [graphics/mapping.c]
Fixed the embarrassing bugs I introduced into DPtoLP and
LPtoDP.
* [windows/scroll.c]
Prevent ScrollWindow32 from sending WM_ERASEBKGND.
Thu Feb 12 22:46:53 1998 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [objects/metafile] [include/ldt.h]
Fix to cope with records longer than 64K.
* [windows/clipboard.c]
Clean up bitmaps and metapicts properly.
Mon Feb 3 21:52:18 1998 Karl Backström <karl_b@geocities.com>
* [programs/winhelp/Sw.rc] [resources/sysres_Sw.rc]
Minor update of Swedish language support.
diff --git a/ANNOUNCE b/ANNOUNCE
index 143313c..f2e7fac 100644
--- a/ANNOUNCE
+++ b/ANNOUNCE
@@ -1,15 +1,13 @@
-This is release 980201 of Wine, the MS Windows emulator. This is still a
+This is release 980215 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 correctly.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
-WHAT'S NEW with Wine-980201: (see ChangeLog for details)
- - Support for Catalan and Swedish languages.
- - More Direct* support.
- - X11 thread-safe wrappers.
- - Support for Postscript printer fonts.
+WHAT'S NEW with Wine-980215: (see ChangeLog for details)
+ - Preliminary console allocation support.
+ - Hopefully no more Xlib errno problems.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@@ -18,10 +16,10 @@
the release is available at the ftp sites. The sources will be available
from the following locations:
- ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-980201.tar.gz
- ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980201.tar.gz
- ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-980201.tar.gz
- ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980201.tar.gz
+ ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-980215.tar.gz
+ ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-980215.tar.gz
+ ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-980215.tar.gz
+ ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-980215.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
diff --git a/AUTHORS b/AUTHORS
index 616a2e6..09aad3f 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -8,6 +8,7 @@
Bob Amstadt,
Dag Asheim,
Martin Ayotte,
+Karl Backström,
Peter Bajusz,
Georg Beyerle,
Ross Biro,
@@ -72,6 +73,7 @@
Bruce Milner,
Steffen Moeller,
Andreas Mohr,
+James Moody,
Philippe De Muyter,
Itai Nahshon,
Kristian Nielsen,
diff --git a/ChangeLog b/ChangeLog
index 2a08206..7ee7ad4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,103 @@
----------------------------------------------------------------------
+Sun Feb 15 12:02:59 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
+
+ * [graphics/x11drv/*.c] [objects/*.c]
+ A few X11 critical section optimizations, mostly with XGet/PutPixel.
+
+ * [scheduler/sysdeps.c] [misc/main.c]
+ Make sure X11 critical section is available before any Xlib call.
+
+ * [if1632/relay.c] [tools/build.c]
+ Yet another attempt at fixing Catch/Throw.
+
+ * [loader/pe_image.c]
+ Fixed broken PE DLL loading.
+
+ * [include/winnt.h] [scheduler/handle.c] [scheduler/*.c]
+ Implemented handle access rights.
+ Added Get/SetHandleInformation.
+
+Sun Feb 15 09:45:23 1997 Andreas Mohr <100.30936@germany.net>
+
+ * [misc/winsock.c]
+ Fixed bug in WSACleanup which lead to crashes in WINSOCK_HandleIO.
+
+ * [graphics/fontengine.c] [include/font.h]
+ Minor improvements.
+
+ * [memory/global.c]
+ Implemented GlobalEntryHandle.
+
+ * [misc/toolhelp.c]
+ Fixed a memory bug in Notify*register.
+
+ * [misc/w32scomb.c]
+ Improved Get16DLLAddress.
+
+ * [objects/gdiobj.c]
+ Implemented GdiSeeGdiDo.
+
+
+Sat Feb 14 14:57:39 1998 John Richardson <jrichard@zko.dec.com>
+
+ * [win32/console.c]
+ Added the console implementation, AllocConsole, FreeConsole,
+ CONSOLE_InheritConsole.
+
+ * [documentation/console]
+ Some documentation on the console.
+
+ * [include/winerror.h]
+ Added some error defines.
+
+ * [scheduler/k32obj.c]
+ Registered the scheduler ops.
+
+Fri Feb 13 19:35:35 1998 James Moody <013263m@dragon.acadiau.ca>
+
+ * [ole/ole2nls.c]
+ Some English language fixes for missing values.
+
+ * [controls/listbox.c]
+ Fix to allow an empty listbox to deselect all items.
+
+ * [relay32/user32.spec] [windows/keyboard.c]
+ CreateAcceleratorTableA stub method.
+
+ * [windows/sysmetrics.c]
+ Added missing SM_CXCURSOR & SM_CYCURSOR initializers.
+
+ * [windows/message.c]
+ PostThreadMessage32A stub method.
+
+Fri Feb 13 17:12:24 1998 Jim Peterson <jspeter@roanoke.infi.net>
+
+ * [libtest/hello3res.rc] [libtest/hello3.c] [libtest/Makefile.in]
+ Updated the 'hello3' test so that it functions properly again.
+
+Fri Feb 13 14:08:07 1998 Martin Boehme <boehme@informatik.mu-luebeck.de>
+
+ * [graphics/mapping.c]
+ Fixed the embarrassing bugs I introduced into DPtoLP and
+ LPtoDP.
+
+ * [windows/scroll.c]
+ Prevent ScrollWindow32 from sending WM_ERASEBKGND.
+
+Thu Feb 12 22:46:53 1998 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
+
+ * [objects/metafile] [include/ldt.h]
+ Fix to cope with records longer than 64K.
+
+ * [windows/clipboard.c]
+ Clean up bitmaps and metapicts properly.
+
+Mon Feb 3 21:52:18 1998 Karl Backström <karl_b@geocities.com>
+
+ * [programs/winhelp/Sw.rc] [resources/sysres_Sw.rc]
+ Minor update of Swedish language support.
+
+----------------------------------------------------------------------
Sun Feb 1 13:24:54 1998 Alexandre Julliard <julliard@lrc.epfl.ch>
* [files/drive.c]
diff --git a/Makefile.in b/Makefile.in
index 7e31639..342073f 100644
--- a/Makefile.in
+++ b/Makefile.in
@@ -119,7 +119,7 @@
libwine.so.1.0: $(LIBOBJS)
$(CC) -shared -Wl,-soname,libwine.so -o$@ $(LIBOBJS) $(LDOPTIONS) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
-install_emu: dummy
+install_emu: install_lib
$(INSTALL_PROGRAM) wine $(bindir)/wine
install_lib: install_includes
diff --git a/controls/listbox.c b/controls/listbox.c
index 81d6654..a830489 100644
--- a/controls/listbox.c
+++ b/controls/listbox.c
@@ -1141,6 +1141,7 @@
/* A few sanity checks */
+ if ((last == -1) && (descr->nb_items == 0)) return LB_OKAY;
if (!(descr->style & LBS_MULTIPLESEL)) return LB_ERR;
if (last == -1) last = descr->nb_items - 1;
if ((first < 0) || (first >= descr->nb_items)) return LB_ERR;
diff --git a/controls/menu.c b/controls/menu.c
index e70533d..ee9fadf 100644
--- a/controls/menu.c
+++ b/controls/menu.c
@@ -164,26 +164,33 @@
* Print a menuitem in readable form.
*/
+#define debug_print_menuitem(pre, mp, post) \
+ if(debugging_menu) do_debug_print_menuitem(pre, mp, post)
+
#define MENUOUT(text) \
- dprintf_menu (stddeb, "%s%s", (count++ ? "," : ""), (text))
+ p+=sprintf(p, "%s%s", (count++ ? "," : ""), (text))
#define MENUFLAG(bit,text) \
do { \
if (flags & (bit)) { flags &= ~(bit); MENUOUT ((text)); } \
} while (0)
-static void debug_print_menuitem(const char *prefix, MENUITEM * mp, const char *postfix)
+static void do_debug_print_menuitem(const char *prefix, MENUITEM * mp,
+ const char *postfix)
{
- dprintf_menu(stddeb, "%s", prefix);
+ char buff[256];
+ char *p;
+
+ p = buff;
if (mp) {
UINT32 flags = mp->fType;
int typ = MENU_ITEM_TYPE(flags);
- dprintf_menu(stddeb, "{ ID=0x%x", mp->wID);
+ p+=sprintf(p, "{ ID=0x%x", mp->wID);
if (flags & MF_POPUP)
- dprintf_menu(stddeb, ", Sub=0x%x", mp->hSubMenu);
+ p+=sprintf(p, ", Sub=0x%x", mp->hSubMenu);
if (flags) {
int count = 0;
- dprintf_menu(stddeb, ", Typ=");
+ p+=sprintf(p, ", Typ=");
if (typ == MFT_STRING)
/* Nothing */ ;
else if (typ == MFT_SEPARATOR)
@@ -205,12 +212,12 @@
MENUFLAG(MFT_RIGHTJUSTIFY, "right");
if (flags)
- dprintf_menu(stddeb, "+0x%x", flags);
+ p+=sprintf(p, "+0x%x", flags);
}
flags = mp->fState;
if (flags) {
int count = 0;
- dprintf_menu(stddeb, ", State=");
+ p+=sprintf(p, ", State=");
MENUFLAG(MFS_GRAYED, "grey");
MENUFLAG(MFS_DISABLED, "dis");
MENUFLAG(MFS_CHECKED, "check");
@@ -218,27 +225,28 @@
MENUFLAG(MF_USECHECKBITMAPS, "usebit");
MENUFLAG(MF_MOUSESELECT, "mouse");
if (flags)
- dprintf_menu(stddeb, "+0x%x", flags);
+ p+=sprintf(p, "+0x%x", flags);
}
if (mp->hCheckBit)
- dprintf_menu(stddeb, ", Chk=0x%x", mp->hCheckBit);
+ p+=sprintf(p, ", Chk=0x%x", mp->hCheckBit);
if (mp->hUnCheckBit)
- dprintf_menu(stddeb, ", Unc=0x%x", mp->hUnCheckBit);
+ p+=sprintf(p, ", Unc=0x%x", mp->hUnCheckBit);
if (typ == MFT_STRING) {
if (mp->text)
- dprintf_menu(stddeb, ", Text=\"%s\"", mp->text);
+ p+=sprintf(p, ", Text=\"%s\"", mp->text);
else
- dprintf_menu(stddeb, ", Text=Null");
+ p+=sprintf(p, ", Text=Null");
} else if (mp->text == NULL)
/* Nothing */ ;
else
- dprintf_menu(stddeb, ", Text=%p", mp->text);
- dprintf_menu(stddeb, " }");
+ p+=sprintf(p, ", Text=%p", mp->text);
+ p+=sprintf(p, " }");
} else {
- dprintf_menu(stddeb, "NULL");
+ p+=sprintf(p, "NULL");
}
- dprintf_menu(stddeb, "%s", postfix);
+
+ dprintf_menu(stddeb, "%s %s %s\n", prefix, buff, postfix);
}
#undef MENUOUT
@@ -595,9 +603,10 @@
DWORD dwSize;
char *p;
- dprintf_menu(stddeb, "MENU_CalcItemSize: HDC 0x%x at (%d,%d): ",
+ dprintf_menu(stddeb, "MENU_CalcItemSize: HDC 0x%x at (%d,%d)\n",
hdc, orgX, orgY);
- debug_print_menuitem("", lpitem, (menuBar ? " (MenuBar)\n" : "\n"));
+ debug_print_menuitem("MENU_CalcItemSize: menuitem:", lpitem,
+ (menuBar ? " (MenuBar)" : ""));
SetRect32( &lpitem->rect, orgX, orgY, orgX, orgY );
@@ -770,7 +779,7 @@
dprintf_menu( stddeb,
"MENU_MenuBarCalcSize: calling MENU_CalcItemSize"
" org=(%d, %d)\n", orgX, orgY );
- debug_print_menuitem (" item: ", lpitem, "\n");
+ debug_print_menuitem (" item: ", lpitem, "");
MENU_CalcItemSize( hdc, lpitem, hwndOwner, orgX, orgY, TRUE );
if (lpitem->rect.right > lprect->right)
{
@@ -816,7 +825,7 @@
{
RECT32 rect;
- debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "\n");
+ debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
if (lpitem->fType & MF_SYSMENU)
{
@@ -1408,7 +1417,7 @@
{
LPSTR prevText = IS_STRING_ITEM(item->fType) ? item->text : NULL;
- debug_print_menuitem("MENU_SetItemData from: ", item, "\n");
+ debug_print_menuitem("MENU_SetItemData from: ", item, "");
if (IS_STRING_ITEM(flags))
{
@@ -1465,7 +1474,7 @@
SetRectEmpty32( &item->rect );
if (prevText) HeapFree( SystemHeap, 0, prevText );
- debug_print_menuitem("MENU_SetItemData to : ", item, "\n");
+ debug_print_menuitem("MENU_SetItemData to : ", item, "");
return TRUE;
}
@@ -2904,7 +2913,7 @@
dprintf_menu(stddeb,"GetMenuState(%04x, %04x, %04x);\n",
hMenu, wItemID, wFlags);
if (!(item = MENU_FindItem( &hMenu, &wItemID, wFlags ))) return -1;
- debug_print_menuitem (" item: ", item, "\n");
+ debug_print_menuitem (" item: ", item, "");
if (item->fType & MF_POPUP)
{
POPUPMENU *menu = (POPUPMENU *) USER_HEAP_LIN_ADDR( item->hSubMenu );
@@ -3722,7 +3731,7 @@
BOOL32 unicode)
{
MENUITEM *menu = MENU_FindItem (&hmenu, &item, bypos);
- debug_print_menuitem("GetMenuItemInfo32_common: ", menu, "\n");
+ debug_print_menuitem("GetMenuItemInfo32_common: ", menu, "");
if (!menu)
return FALSE;
@@ -3829,7 +3838,7 @@
if (lpmii->fMask & MIIM_DATA)
menu->dwItemData = lpmii->dwItemData;
- debug_print_menuitem("SetMenuItemInfo32_common: ", menu, "\n");
+ debug_print_menuitem("SetMenuItemInfo32_common: ", menu, "");
return TRUE;
}
@@ -3860,7 +3869,7 @@
{
MENUITEM *menu = MENU_FindItem(&hmenu, &item, bypos);
if (!menu) return FALSE;
- debug_print_menuitem("SetMenuDefaultItem32: ", menu, "\n");
+ debug_print_menuitem("SetMenuDefaultItem32: ", menu, "");
fprintf(stdnimp, "SetMenuDefaultItem32 (0x%x,%d,%d), empty stub!\n",
hmenu, item, bypos);
return TRUE;
diff --git a/controls/scroll.c b/controls/scroll.c
index a678d8a..f1f4512 100644
--- a/controls/scroll.c
+++ b/controls/scroll.c
@@ -973,27 +973,31 @@
/* Check if the scrollbar should be hidden or disabled */
- new_flags = infoPtr->flags;
- if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
+ if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))
{
- /* Hide or disable scroll-bar */
- if (info->fMask & SIF_DISABLENOSCROLL) new_flags = ESB_DISABLE_BOTH;
- else if (nBar != SB_CTL)
+ new_flags = infoPtr->flags;
+ if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
{
- ShowScrollBar32( hwnd, nBar, FALSE );
- bRedraw = FALSE; /* No need to repaint anything */
+ /* Hide or disable scroll-bar */
+ if (info->fMask & SIF_DISABLENOSCROLL)
+ new_flags = ESB_DISABLE_BOTH;
+ else if (nBar != SB_CTL)
+ {
+ ShowScrollBar32( hwnd, nBar, FALSE );
+ bRedraw = FALSE; /* No need to repaint anything */
+ }
}
- }
- else /* Show and enable scroll-bar */
- {
- new_flags = 0;
- if (nBar != SB_CTL) ShowScrollBar32( hwnd, nBar, TRUE );
- }
+ else /* Show and enable scroll-bar */
+ {
+ new_flags = 0;
+ if (nBar != SB_CTL) ShowScrollBar32( hwnd, nBar, TRUE );
+ }
- if (infoPtr->flags != new_flags)
- {
- infoPtr->flags = new_flags;
- repaint_arrows = TRUE;
+ if (infoPtr->flags != new_flags)
+ {
+ infoPtr->flags = new_flags;
+ repaint_arrows = TRUE;
+ }
}
if (bRedraw || repaint_arrows)
diff --git a/documentation/console b/documentation/console
new file mode 100644
index 0000000..a623e35
--- /dev/null
+++ b/documentation/console
@@ -0,0 +1,42 @@
+
+Console - First Pass
+--------------------
+
+Consoles are just xterms created with the -Sxxn switch.
+A pty is opened and the master goes to the xterm side
+and the slave is held by the wine side. The slave fd
+is changed into a HANDLE32 and this HANDLE32 is set
+to the STD_*_HANDLES.
+
+For now writing/reading to a console just calls FileWrite/FileRead.
+
+If the command line console is to be inheirited or
+a process inherits it's parents console (-- can that happen???),
+the console is created at process init time via PROCESS_InheritConsole.
+The 0, 1, and 2 file descriptors are duped to be the
+STD_*_HANDLES in this case. Also in this case a flag is set
+to indicate that the console comes from the parent process or
+command line.
+
+If a process doesn't have a console at all, it's
+pdb->console is set to NULL. This helps indicate when
+it is possible to create a new console (via AllocConsole).
+
+
+Like most k32 objects, when the FreeConsole is called, the
+ref count is decremented and the console is freed when
+it reaches zero. The free kills the xterm and closes
+the master/slave fds.
+
+Also like most k32 objects, we assume that (K32OBJ) header is the
+first field so the casting (from K32OBJ *to CONSOLE *)
+works correctly.
+
+BUGS
+----
+
+A exit handler needs to be added. If the process exits
+without calling FreeConsole, the xterm continues on...
+But... there should probably be a generic exit handler in
+wine for this kind of stuff (K32OBJs).
+
diff --git a/documentation/internals b/documentation/internals
index 40ca690..8ccbb66 100644
--- a/documentation/internals
+++ b/documentation/internals
@@ -24,13 +24,13 @@
wrappers). The wrapper for a function X...() is calles TSX...() (for
"Thread Safe X ..."). So for example, instead of calling XOpenDisplay()
in the code, TSXOpenDisplay() must be used. Likewise, X include files
-that contain function prototypes are wrapped, so that eg. "TSXutil.h" must
-be included rather than <X11/Xutil.h>. It is important that this scheme
-is used everywhere to avoid the introduction of nondeterministic and
-hard-to-find errors in Wine.
+that contain function prototypes are wrapped, so that eg. "ts_xutil.h"
+must be included rather than <X11/Xutil.h>. It is important that this
+scheme is used everywhere to avoid the introduction of nondeterministic
+and hard-to-find errors in Wine.
The code for the thread safe X wrappers is contained in the tsx11/
-directory and in include/TS*.h. To use a new (ie. not previously used) X
+directory and in include/ts*.h. To use a new (ie. not previously used) X
function in Wine, a new wrapper must be created. The wrappers are
generated (semi-)automatically from the X11R6 includes using the
tools/make_X11wrappers perl script. In simple cases it should be enough
diff --git a/documentation/languages b/documentation/languages
index d354f2e..f6c2256 100644
--- a/documentation/languages
+++ b/documentation/languages
@@ -2,7 +2,7 @@
to the list of languages that Wine can display system menus and forms
in. Currently at least the following languages are still missing:
Bulgarian, Chinese, Greek, Icelandic, Japanese, Dutch, Polish, Portuguese,
-Romanian, Russian, Croatian, Slovak, Swedish, Turkish, and Slovanian.
+Romanian, Russian, Croatian, Slovak, Turkish, and Slovanian.
To add a new language you need to be able to translate the relatively
few texts, of course. You will need very little knowledge of
diff --git a/files/drive.c b/files/drive.c
index 34859a7..cdb7d9c 100644
--- a/files/drive.c
+++ b/files/drive.c
@@ -11,6 +11,7 @@
#include <stdlib.h>
#include <sys/types.h>
#include <sys/stat.h>
+#include <fcntl.h>
#if defined(__linux__) || defined(sun) || defined(hpux)
#include <sys/vfs.h>
diff --git a/files/file.c b/files/file.c
index 3eaaf8d..29f9abf 100644
--- a/files/file.c
+++ b/files/file.c
@@ -84,7 +84,8 @@
(*file)->unix_name = NULL;
(*file)->type = FILE_TYPE_DISK;
- handle = PROCESS_AllocHandle( &(*file)->header, 0 );
+ handle = HANDLE_Alloc( &(*file)->header, FILE_ALL_ACCESS | GENERIC_READ |
+ GENERIC_WRITE | GENERIC_EXECUTE /*FIXME*/, FALSE );
/* If the allocation failed, the object is already destroyed */
if (handle == INVALID_HANDLE_VALUE32) *file = NULL;
return handle;
@@ -118,7 +119,7 @@
*/
static FILE_OBJECT *FILE_GetFile( HFILE32 handle )
{
- return (FILE_OBJECT *)PROCESS_GetObjPtr( handle, K32OBJ_FILE );
+ return (FILE_OBJECT *)HANDLE_GetObjPtr( handle, K32OBJ_FILE, 0 /*FIXME*/ );
}
@@ -511,7 +512,7 @@
dprintf_file( stddeb, "FILE_Dup for handle %d\n", hFile );
if (!(file = FILE_GetFile( hFile ))) return HFILE_ERROR32;
- handle = PROCESS_AllocHandle( &file->header, 0 );
+ handle = HANDLE_Alloc( &file->header, FILE_ALL_ACCESS /*FIXME*/, FALSE );
FILE_ReleaseFile( file );
dprintf_file( stddeb, "FILE_Dup return handle %d\n", handle );
return handle;
@@ -528,8 +529,9 @@
FILE_OBJECT *file;
dprintf_file( stddeb, "FILE_Dup2 for handle %d\n", hFile1 );
+ /* FIXME: should use DuplicateHandle */
if (!(file = FILE_GetFile( hFile1 ))) return HFILE_ERROR32;
- if (!PROCESS_SetObjPtr( hFile2, &file->header, 0 )) hFile2 = HFILE_ERROR32;
+ if (!HANDLE_SetObjPtr( hFile2, &file->header, 0 )) hFile2 = HFILE_ERROR32;
FILE_ReleaseFile( file );
return hFile2;
}
diff --git a/graphics/fontengine.c b/graphics/fontengine.c
index 5a118ac..f261b13 100644
--- a/graphics/fontengine.c
+++ b/graphics/fontengine.c
@@ -6,6 +6,7 @@
#include <stdio.h>
#include <stdlib.h>
#include "windows.h"
+#include "font.h"
/* GDI 300 */
WORD WINAPI EngineEnumerateFont(LPSTR fontname, FARPROC16 proc, DWORD data )
@@ -13,13 +14,31 @@
fprintf(stderr,"EngineEnumerateFont(%s,%p,%lx),stub\n",fontname,proc,data);
return 0;
}
-#ifdef NOTDEF
+
/* GDI 301 */
WORD WINAPI EngineDeleteFont(LPFONTINFO16 lpFontInfo)
{
- return 0
+ WORD handle;
+
+ /* untested, don't know if it works.
+ We seem to access some structure that is located after the
+ FONTINFO. The FONTINFO docu says that there may follow some char-width
+ table or font bitmap or vector info.
+ I think it is some kind of font bitmap that begins at offset 0x52,
+ as FONTINFO goes up to 0x51.
+ If this is correct, everything should be implemented correctly.
+ */
+ if ( ((lpFontInfo->dfType & (RASTER_FONTTYPE|DEVICE_FONTTYPE))
+ == (RASTER_FONTTYPE|DEVICE_FONTTYPE))
+ && (LOWORD(lpFontInfo->dfFace) == LOWORD(lpFontInfo)+0x6e)
+ && (handle = *(WORD *)(lpFontInfo+0x54)) )
+ {
+ *(WORD *)(lpFontInfo+0x54) = 0;
+ GlobalFree16(handle);
+ }
+ return 1;
}
-#endif
+
/* GDI 302 */
WORD WINAPI EngineRealizeFont(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
{
@@ -27,27 +46,33 @@
return 0;
}
-#ifdef NOTDEF
+
/* GDI 303 */
-WORD WINAPI EngineGetCharWidth(LPFONTINFO16 lpFontInfo, BYTE, BYTE, LPINT16)
+WORD WINAPI EngineGetCharWidth(LPFONTINFO16 lpFontInfo, BYTE firstChar, BYTE lastChar, LPINT16 buffer)
{
- return 0;
+ int i;
+
+ for (i = firstChar; i <= lastChar; i++)
+ *buffer++ = lpFontInfo->dfAvgWidth; /* insert some charwidth functionality here; use average width for now */
+ return 1;
}
/* GDI 304 */
-WORD WINAPI EngineSetFontContext(LPFONTINFO lpFontInfo, WORD data)
+WORD WINAPI EngineSetFontContext(LPFONTINFO16 lpFontInfo, WORD data)
{
+ return 0;
}
+
/* GDI 305 */
-WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO lpFontInfo, WORD, WORD, LPSTR string, DWORD dword, LPBITMAPMETRICS16 metrics)
+WORD WINAPI EngineGetGlyphBMP(WORD word, LPFONTINFO16 lpFontInfo, WORD w1, WORD w2, LPSTR string, DWORD dword, /*LPBITMAPMETRICS16*/ LPVOID metrics)
{
return 0;
}
/* GDI 306 */
-DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR fontdir, LPCSTR string)
+DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR16 fontdir, LPCSTR string)
{
- return 0;
+ return -1; /* error */
}
@@ -55,6 +80,5 @@
WORD WINAPI EngineExtTextOut()
{
+ return 0;
}
-
-#endif
diff --git a/graphics/mapping.c b/graphics/mapping.c
index 0ced954..b810a23 100644
--- a/graphics/mapping.c
+++ b/graphics/mapping.c
@@ -74,8 +74,8 @@
{
if (dc->w.UseWorldXform)
{
- x = (FLOAT)points->x - dc->w.WorldXform.eDx;
- y = (FLOAT)points->y - dc->w.WorldXform.eDy;
+ x = (FLOAT)XDPTOLP( dc, points->x ) - dc->w.WorldXform.eDx;
+ y = (FLOAT)YDPTOLP( dc, points->y ) - dc->w.WorldXform.eDy;
points->x = (INT32)( (x*dc->w.WorldXform.eM22 -
y*dc->w.WorldXform.eM21) / determinant );
points->y = (INT32)( (-x*dc->w.WorldXform.eM12 +
@@ -83,8 +83,8 @@
}
else
{
- points->x = XLPTODP( dc, points->x );
- points->y = YLPTODP( dc, points->y );
+ points->x = XDPTOLP( dc, points->x );
+ points->y = YDPTOLP( dc, points->y );
}
points++;
}
@@ -130,14 +130,14 @@
y = (FLOAT)points->x * dc->w.WorldXform.eM12 +
(FLOAT)points->y * dc->w.WorldXform.eM22 +
dc->w.WorldXform.eDy;
- points->x = XDPTOLP( dc, (INT32)x );
- points->y = YDPTOLP( dc, (INT32)y );
+ points->x = XLPTODP( dc, (INT32)x );
+ points->y = YLPTODP( dc, (INT32)y );
}
else
{
- points->x = XDPTOLP( dc, points->x );
- points->y = YDPTOLP( dc, points->y );
+ points->x = XLPTODP( dc, points->x );
+ points->y = YLPTODP( dc, points->y );
}
points++;
}
diff --git a/graphics/win16drv/init.c b/graphics/win16drv/init.c
index e81e565..91d0c30 100644
--- a/graphics/win16drv/init.c
+++ b/graphics/win16drv/init.c
@@ -471,7 +471,7 @@
PROFILE_GetWineIniString( "spooler", pszOutput, "",
psCmd, sizeof(psCmd) );
- printf("Got printerSpoolCommand \"%s\"\n",psCmd);
+ printf("Got printerSpoolCommand \"%s\" for output device \"%s\"\n",psCmd, pszOutput);
if (!*psCmd)
psCmdP = pszOutput;
else
diff --git a/graphics/x11drv/bitblt.c b/graphics/x11drv/bitblt.c
index 95039c3..100d63e 100644
--- a/graphics/x11drv/bitblt.c
+++ b/graphics/x11drv/bitblt.c
@@ -7,7 +7,7 @@
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
-#include "ts_xlib.h"
+#include <X11/Xlib.h>
#include <X11/Intrinsic.h>
#include "bitmap.h"
#include "callback.h"
@@ -596,14 +596,14 @@
{
if (COLOR_PixelToPalette && (depthDst != 1))
if (swap) for (i = 0; i < width; i++)
- *pdata-- = COLOR_PixelToPalette[TSXGetPixel( image, i, row )];
+ *pdata-- = COLOR_PixelToPalette[XGetPixel( image, i, row )];
else for (i = 0; i < width; i++)
- *pdata++ = COLOR_PixelToPalette[TSXGetPixel( image, i, row )];
+ *pdata++ = COLOR_PixelToPalette[XGetPixel( image, i, row )];
else
if (swap) for (i = 0; i < width; i++)
- *pdata-- = TSXGetPixel( image, i, row );
+ *pdata-- = XGetPixel( image, i, row );
else for (i = 0; i < width; i++)
- *pdata++ = TSXGetPixel( image, i, row );
+ *pdata++ = XGetPixel( image, i, row );
}
else
{
@@ -615,16 +615,16 @@
bg = COLOR_PixelToPalette[bg];
}
if (swap) for (i = 0; i < width; i++)
- *pdata-- = TSXGetPixel( image, i, row ) ? bg : fg;
+ *pdata-- = XGetPixel( image, i, row ) ? bg : fg;
else for (i = 0; i < width; i++)
- *pdata++ = TSXGetPixel( image, i, row ) ? bg : fg;
+ *pdata++ = XGetPixel( image, i, row ) ? bg : fg;
}
else /* color -> monochrome */
{
if (swap) for (i = 0; i < width; i++)
- *pdata-- = (TSXGetPixel( image, i, row ) == bg) ? 1 : 0;
+ *pdata-- = (XGetPixel( image, i, row ) == bg) ? 1 : 0;
else for (i = 0; i < width; i++)
- *pdata++ = (TSXGetPixel( image, i, row ) == bg) ? 1 : 0;
+ *pdata++ = (XGetPixel( image, i, row ) == bg) ? 1 : 0;
}
}
}
@@ -720,7 +720,7 @@
pixel = rowDst + visRectDst->right - 1;
y = ydst - visRectDst->top;
for (x = visRectDst->right-visRectDst->left-1; x >= 0; x--)
- TSXPutPixel( dstImage, x, y, *pixel-- );
+ XPutPixel( dstImage, x, y, *pixel-- );
if (mode != STRETCH_DELETESCANS)
memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00,
widthDst*sizeof(int) );
@@ -794,7 +794,7 @@
pixel = rowDst + visRectDst->right - 1;
y = (ydst >> 16) - visRectDst->top;
for (x = visRectDst->right-visRectDst->left-1; x >= 0; x--)
- TSXPutPixel( dstImage, x, y, *pixel-- );
+ XPutPixel( dstImage, x, y, *pixel-- );
if (mode != STRETCH_DELETESCANS)
memset( rowDst, (mode == STRETCH_ANDSCANS) ? 0xff : 0x00,
widthDst*sizeof(int) );
@@ -831,7 +831,7 @@
OffsetRect32( &rectDst, -xDst, -yDst );
/* FIXME: avoid BadMatch errors */
- imageSrc = TSXGetImage( display, dcSrc->u.x.drawable,
+ imageSrc = XGetImage( display, dcSrc->u.x.drawable,
visRectSrc->left, visRectSrc->top,
visRectSrc->right - visRectSrc->left,
visRectSrc->bottom - visRectSrc->top,
@@ -843,10 +843,10 @@
dcDst->w.textPixel, dcDst->w.bitsPerPixel != 1 ?
dcDst->w.backgroundPixel : dcSrc->w.backgroundPixel,
dcDst->w.stretchBltMode );
- TSXPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0,
+ XPutImage( display, pixmap, gc, imageDst, 0, 0, 0, 0,
rectDst.right - rectDst.left, rectDst.bottom - rectDst.top );
- TSXDestroyImage( imageSrc );
- TSXDestroyImage( imageDst );
+ XDestroyImage( imageSrc );
+ XDestroyImage( imageDst );
}
@@ -869,31 +869,31 @@
if (!COLOR_PixelToPalette ||
(dcDst->w.bitsPerPixel == 1)) /* monochrome -> monochrome */
{
- TSXCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
+ XCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top, width, height, 0, 0);
}
else /* color -> color */
{
if (dcSrc->w.flags & DC_MEMORY)
- imageSrc = TSXGetImage( display, dcSrc->u.x.drawable,
+ imageSrc = XGetImage( display, dcSrc->u.x.drawable,
visRectSrc->left, visRectSrc->top,
width, height, AllPlanes, ZPixmap );
else
{
/* Make sure we don't get a BadMatch error */
- TSXCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
+ XCopyArea( display, dcSrc->u.x.drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top,
width, height, 0, 0);
- imageSrc = TSXGetImage( display, pixmap, 0, 0, width, height,
+ imageSrc = XGetImage( display, pixmap, 0, 0, width, height,
AllPlanes, ZPixmap );
}
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
- TSXPutPixel(imageSrc, x, y,
- COLOR_PixelToPalette[TSXGetPixel(imageSrc, x, y)]);
- TSXPutImage( display, pixmap, gc, imageSrc,
+ XPutPixel(imageSrc, x, y,
+ COLOR_PixelToPalette[XGetPixel(imageSrc, x, y)]);
+ XPutImage( display, pixmap, gc, imageSrc,
0, 0, 0, 0, width, height );
- TSXDestroyImage( imageSrc );
+ XDestroyImage( imageSrc );
}
}
else
@@ -902,35 +902,35 @@
{
if (COLOR_PixelToPalette)
{
- TSXSetBackground( display, gc,
+ XSetBackground( display, gc,
COLOR_PixelToPalette[dcDst->w.textPixel] );
- TSXSetForeground( display, gc,
+ XSetForeground( display, gc,
COLOR_PixelToPalette[dcDst->w.backgroundPixel]);
}
else
{
- TSXSetBackground( display, gc, dcDst->w.textPixel );
- TSXSetForeground( display, gc, dcDst->w.backgroundPixel );
+ XSetBackground( display, gc, dcDst->w.textPixel );
+ XSetForeground( display, gc, dcDst->w.backgroundPixel );
}
- TSXCopyPlane( display, dcSrc->u.x.drawable, pixmap, gc,
+ XCopyPlane( display, dcSrc->u.x.drawable, pixmap, gc,
visRectSrc->left, visRectSrc->top,
width, height, 0, 0, 1 );
}
else /* color -> monochrome */
{
/* FIXME: avoid BadMatch error */
- imageSrc = TSXGetImage( display, dcSrc->u.x.drawable,
+ imageSrc = XGetImage( display, dcSrc->u.x.drawable,
visRectSrc->left, visRectSrc->top,
width, height, AllPlanes, ZPixmap );
XCREATEIMAGE( imageDst, width, height, dcDst->w.bitsPerPixel );
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
- TSXPutPixel(imageDst, x, y, (TSXGetPixel(imageSrc,x,y) ==
+ XPutPixel(imageDst, x, y, (XGetPixel(imageSrc,x,y) ==
dcSrc->w.backgroundPixel) );
- TSXPutImage( display, pixmap, gc, imageDst,
+ XPutImage( display, pixmap, gc, imageDst,
0, 0, 0, 0, width, height );
- TSXDestroyImage( imageSrc );
- TSXDestroyImage( imageDst );
+ XDestroyImage( imageSrc );
+ XDestroyImage( imageDst );
}
}
}
@@ -950,7 +950,7 @@
if (!COLOR_PixelToPalette || (dc->w.bitsPerPixel == 1) ||
(COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL) )
{
- TSXCopyArea( display, dc->u.x.drawable, pixmap, gc,
+ XCopyArea( display, dc->u.x.drawable, pixmap, gc,
visRectDst->left, visRectDst->top, width, height, 0, 0 );
}
else
@@ -959,23 +959,23 @@
XImage *image;
if (dc->w.flags & DC_MEMORY)
- image = TSXGetImage( display, dc->u.x.drawable,
+ image = XGetImage( display, dc->u.x.drawable,
visRectDst->left, visRectDst->top,
width, height, AllPlanes, ZPixmap );
else
{
/* Make sure we don't get a BadMatch error */
- TSXCopyArea( display, dc->u.x.drawable, pixmap, gc,
+ XCopyArea( display, dc->u.x.drawable, pixmap, gc,
visRectDst->left, visRectDst->top, width, height, 0, 0);
- image = TSXGetImage( display, pixmap, 0, 0, width, height,
+ image = XGetImage( display, pixmap, 0, 0, width, height,
AllPlanes, ZPixmap );
}
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
- TSXPutPixel( image, x, y,
- COLOR_PixelToPalette[TSXGetPixel( image, x, y )]);
- TSXPutImage( display, pixmap, gc, image, 0, 0, 0, 0, width, height );
- TSXDestroyImage( image );
+ XPutPixel( image, x, y,
+ COLOR_PixelToPalette[XGetPixel( image, x, y )]);
+ XPutImage( display, pixmap, gc, image, 0, 0, 0, 0, width, height );
+ XDestroyImage( image );
}
}
@@ -996,23 +996,23 @@
if (!COLOR_PaletteToPixel || (dc->w.bitsPerPixel == 1) ||
(COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL) )
{
- TSXCopyArea( display, pixmap, dc->u.x.drawable, gc, 0, 0,
+ XCopyArea( display, pixmap, dc->u.x.drawable, gc, 0, 0,
width, height, visRectDst->left, visRectDst->top );
}
else
{
register INT32 x, y;
- XImage *image = TSXGetImage( display, pixmap, 0, 0, width, height,
+ XImage *image = XGetImage( display, pixmap, 0, 0, width, height,
AllPlanes, ZPixmap );
for (y = 0; y < height; y++)
for (x = 0; x < width; x++)
{
- TSXPutPixel( image, x, y,
- COLOR_PaletteToPixel[TSXGetPixel( image, x, y )]);
+ XPutPixel( image, x, y,
+ COLOR_PaletteToPixel[XGetPixel( image, x, y )]);
}
- TSXPutImage( display, dc->u.x.drawable, gc, image, 0, 0,
+ XPutImage( display, dc->u.x.drawable, gc, image, 0, 0,
visRectDst->left, visRectDst->top, width, height );
- TSXDestroyImage( image );
+ XDestroyImage( image );
}
}
@@ -1092,10 +1092,11 @@
*
* Implementation of PatBlt(), BitBlt() and StretchBlt().
*/
-BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
- INT32 widthDst, INT32 heightDst,
- DC *dcSrc, INT32 xSrc, INT32 ySrc,
- INT32 widthSrc, INT32 heightSrc, DWORD rop )
+static BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
+ INT32 widthDst, INT32 heightDst,
+ DC *dcSrc, INT32 xSrc, INT32 ySrc,
+ INT32 widthSrc, INT32 heightSrc,
+ DWORD rop )
{
BOOL32 usePat, useSrc, useDst, destUsed, fStretch, fNullBrush;
RECT32 visRectDst, visRectSrc;
@@ -1171,14 +1172,14 @@
{
case BLACKNESS: /* 0x00 */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel)
- TSXSetFunction( display, dcDst->u.x.gc, GXclear );
+ XSetFunction( display, dcDst->u.x.gc, GXclear );
else
{
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
- TSXSetForeground( display, dcDst->u.x.gc, COLOR_PaletteToPixel[0] );
- TSXSetFillStyle( display, dcDst->u.x.gc, FillSolid );
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XSetForeground( display, dcDst->u.x.gc, COLOR_PaletteToPixel[0] );
+ XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
}
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
@@ -1186,10 +1187,10 @@
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel ||
!Options.perfectGraphics)
{
- TSXSetFunction( display, dcDst->u.x.gc, GXinvert );
+ XSetFunction( display, dcDst->u.x.gc, GXinvert );
if( COLOR_GetSystemPaletteFlags() & (COLOR_PRIVATE | COLOR_VIRTUAL) )
- TSXSetFunction( display, dcDst->u.x.gc, GXinvert);
+ XSetFunction( display, dcDst->u.x.gc, GXinvert);
else
{
/* Xor is much better when we do not have full colormap. */
@@ -1197,11 +1198,11 @@
/* and white. */
Pixel xor_pix = (WhitePixelOfScreen(screen) ^
BlackPixelOfScreen(screen));
- TSXSetFunction( display, dcDst->u.x.gc, GXxor );
- TSXSetForeground( display, dcDst->u.x.gc, xor_pix);
- TSXSetFillStyle( display, dcDst->u.x.gc, FillSolid );
+ XSetFunction( display, dcDst->u.x.gc, GXxor );
+ XSetForeground( display, dcDst->u.x.gc, xor_pix);
+ XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
}
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
@@ -1211,8 +1212,8 @@
if (Options.perfectGraphics) break;
if (DC_SetupGCForBrush( dcDst ))
{
- TSXSetFunction( display, dcDst->u.x.gc, GXxor );
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XSetFunction( display, dcDst->u.x.gc, GXxor );
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
@@ -1221,8 +1222,8 @@
if (Options.perfectGraphics) break;
if (DC_SetupGCForBrush( dcDst ))
{
- TSXSetFunction( display, dcDst->u.x.gc, GXequiv );
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XSetFunction( display, dcDst->u.x.gc, GXequiv );
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
}
return TRUE;
@@ -1230,58 +1231,58 @@
case SRCCOPY: /* 0xcc */
if (dcSrc->w.bitsPerPixel == dcDst->w.bitsPerPixel)
{
- TSXSetGraphicsExposures( display, dcDst->u.x.gc, True );
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
- TSXCopyArea( display, dcSrc->u.x.drawable,
+ XSetGraphicsExposures( display, dcDst->u.x.gc, True );
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XCopyArea( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top );
- TSXSetGraphicsExposures( display, dcDst->u.x.gc, False );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, False );
return TRUE;
}
if (dcSrc->w.bitsPerPixel == 1)
{
- TSXSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel );
- TSXSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel );
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
- TSXSetGraphicsExposures( display, dcDst->u.x.gc, True );
- TSXCopyPlane( display, dcSrc->u.x.drawable,
+ XSetBackground( display, dcDst->u.x.gc, dcDst->w.textPixel );
+ XSetForeground( display, dcDst->u.x.gc, dcDst->w.backgroundPixel );
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, True );
+ XCopyPlane( display, dcSrc->u.x.drawable,
dcDst->u.x.drawable, dcDst->u.x.gc,
visRectSrc.left, visRectSrc.top,
width, height, visRectDst.left, visRectDst.top, 1 );
- TSXSetGraphicsExposures( display, dcDst->u.x.gc, False );
+ XSetGraphicsExposures( display, dcDst->u.x.gc, False );
return TRUE;
}
break;
case PATCOPY: /* 0xf0 */
if (!DC_SetupGCForBrush( dcDst )) return TRUE;
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
case WHITENESS: /* 0xff */
if ((dcDst->w.bitsPerPixel == 1) || !COLOR_PaletteToPixel)
- TSXSetFunction( display, dcDst->u.x.gc, GXset );
+ XSetFunction( display, dcDst->u.x.gc, GXset );
else
{
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
- TSXSetForeground( display, dcDst->u.x.gc,
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XSetForeground( display, dcDst->u.x.gc,
COLOR_PaletteToPixel[COLOR_GetSystemPaletteSize() - 1]);
- TSXSetFillStyle( display, dcDst->u.x.gc, FillSolid );
+ XSetFillStyle( display, dcDst->u.x.gc, FillSolid );
}
- TSXFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
+ XFillRectangle( display, dcDst->u.x.drawable, dcDst->u.x.gc,
visRectDst.left, visRectDst.top, width, height );
return TRUE;
}
- tmpGC = TSXCreateGC( display, dcDst->u.x.drawable, 0, NULL );
- pixmaps[DST] = TSXCreatePixmap( display, rootWindow, width, height,
+ tmpGC = XCreateGC( display, dcDst->u.x.drawable, 0, NULL );
+ pixmaps[DST] = XCreatePixmap( display, rootWindow, width, height,
dcDst->w.bitsPerPixel );
if (useSrc)
{
- pixmaps[SRC] = TSXCreatePixmap( display, rootWindow, width, height,
+ pixmaps[SRC] = XCreatePixmap( display, rootWindow, width, height,
dcDst->w.bitsPerPixel );
if (fStretch)
BITBLT_GetSrcAreaStretch( dcSrc, dcDst, pixmaps[SRC], tmpGC,
@@ -1300,13 +1301,13 @@
for (opcode = BITBLT_Opcodes[(rop >> 16) & 0xff]; *opcode; opcode++)
{
if (OP_DST(*opcode) == DST) destUsed = TRUE;
- TSXSetFunction( display, tmpGC, OP_ROP(*opcode) );
+ XSetFunction( display, tmpGC, OP_ROP(*opcode) );
switch(OP_SRCDST(*opcode))
{
case OP_ARGS(DST,TMP):
case OP_ARGS(SRC,TMP):
if (!pixmaps[TMP])
- pixmaps[TMP] = TSXCreatePixmap( display, rootWindow,
+ pixmaps[TMP] = XCreatePixmap( display, rootWindow,
width, height,
dcDst->w.bitsPerPixel );
/* fall through */
@@ -1314,32 +1315,32 @@
case OP_ARGS(SRC,DST):
case OP_ARGS(TMP,SRC):
case OP_ARGS(TMP,DST):
- TSXCopyArea( display, pixmaps[OP_SRC(*opcode)],
+ XCopyArea( display, pixmaps[OP_SRC(*opcode)],
pixmaps[OP_DST(*opcode)], tmpGC,
0, 0, width, height, 0, 0 );
break;
case OP_ARGS(PAT,TMP):
if (!pixmaps[TMP] && !fNullBrush)
- pixmaps[TMP] = TSXCreatePixmap( display, rootWindow,
+ pixmaps[TMP] = XCreatePixmap( display, rootWindow,
width, height,
dcDst->w.bitsPerPixel );
/* fall through */
case OP_ARGS(PAT,DST):
case OP_ARGS(PAT,SRC):
if (!fNullBrush)
- TSXFillRectangle( display, pixmaps[OP_DST(*opcode)],
+ XFillRectangle( display, pixmaps[OP_DST(*opcode)],
tmpGC, 0, 0, width, height );
break;
}
}
- TSXSetFunction( display, dcDst->u.x.gc, GXcopy );
+ XSetFunction( display, dcDst->u.x.gc, GXcopy );
BITBLT_PutDstArea( dcDst, pixmaps[destUsed ? DST : SRC],
dcDst->u.x.gc, &visRectDst );
- TSXFreePixmap( display, pixmaps[DST] );
- if (pixmaps[SRC]) TSXFreePixmap( display, pixmaps[SRC] );
- if (pixmaps[TMP]) TSXFreePixmap( display, pixmaps[TMP] );
- TSXFreeGC( display, tmpGC );
+ XFreePixmap( display, pixmaps[DST] );
+ if (pixmaps[SRC]) XFreePixmap( display, pixmaps[SRC] );
+ if (pixmaps[TMP]) XFreePixmap( display, pixmaps[TMP] );
+ XFreeGC( display, tmpGC );
return TRUE;
}
@@ -1380,7 +1381,11 @@
{
struct StretchBlt_params params = { dc, left, top, width, height,
NULL, 0, 0, 0, 0, rop };
- return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ BOOL32 result;
+ EnterCriticalSection( &X11DRV_CritSection );
+ result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ return result;
}
@@ -1393,7 +1398,11 @@
{
struct StretchBlt_params params = { dcDst, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, width, height, rop};
- return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ BOOL32 result;
+ EnterCriticalSection( &X11DRV_CritSection );
+ result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ return result;
}
@@ -1408,5 +1417,9 @@
struct StretchBlt_params params = { dcDst, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc,
rop };
- return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ BOOL32 result;
+ EnterCriticalSection( &X11DRV_CritSection );
+ result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, ¶ms );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ return result;
}
diff --git a/graphics/x11drv/brush.c b/graphics/x11drv/brush.c
index efb7bb1..5c2fae1 100644
--- a/graphics/x11drv/brush.c
+++ b/graphics/x11drv/brush.c
@@ -107,6 +107,7 @@
unsigned int x, y;
Pixmap pixmap;
+ EnterCriticalSection( &X11DRV_CritSection );
if (color != prevColor)
{
int r = GetRValue( color ) * DITHER_LEVELS;
@@ -122,16 +123,17 @@
int dr = ((r + d) / MATRIX_SIZE_2) / 256;
int dg = ((g + d) / MATRIX_SIZE_2) / 256;
int db = ((b + d) / MATRIX_SIZE_2) / 256;
- TSXPutPixel( ditherImage, x, y, PIXEL_VALUE(dr,dg,db) );
+ XPutPixel( ditherImage, x, y, PIXEL_VALUE(dr,dg,db) );
}
}
prevColor = color;
}
- pixmap = TSXCreatePixmap( display, rootWindow,
- MATRIX_SIZE, MATRIX_SIZE, screenDepth );
- TSXPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
+ pixmap = XCreatePixmap( display, rootWindow,
+ MATRIX_SIZE, MATRIX_SIZE, screenDepth );
+ XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
+ LeaveCriticalSection( &X11DRV_CritSection );
return pixmap;
}
diff --git a/graphics/x11drv/graphics.c b/graphics/x11drv/graphics.c
index cdb1073..da14d48 100644
--- a/graphics/x11drv/graphics.c
+++ b/graphics/x11drv/graphics.c
@@ -408,23 +408,25 @@
x = dc->w.DCOrgX + XLPTODP( dc, x );
y = dc->w.DCOrgY + YLPTODP( dc, y );
+ EnterCriticalSection( &X11DRV_CritSection );
if (dc->w.flags & DC_MEMORY)
{
- image = TSXGetImage( display, dc->u.x.drawable, x, y, 1, 1,
+ image = XGetImage( display, dc->u.x.drawable, x, y, 1, 1,
AllPlanes, ZPixmap );
}
else
{
/* If we are reading from the screen, use a temporary copy */
/* to avoid a BadMatch error */
- if (!pixmap) pixmap = TSXCreatePixmap( display, rootWindow,
+ if (!pixmap) pixmap = XCreatePixmap( display, rootWindow,
1, 1, dc->w.bitsPerPixel );
- TSXCopyArea( display, dc->u.x.drawable, pixmap, BITMAP_colorGC,
+ XCopyArea( display, dc->u.x.drawable, pixmap, BITMAP_colorGC,
x, y, 1, 1, 0, 0 );
- image = TSXGetImage( display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
+ image = XGetImage( display, pixmap, 0, 0, 1, 1, AllPlanes, ZPixmap );
}
- pixel = TSXGetPixel( image, 0, 0 );
- TSXDestroyImage( image );
+ pixel = XGetPixel( image, 0, 0 );
+ XDestroyImage( image );
+ LeaveCriticalSection( &X11DRV_CritSection );
return COLOR_ToLogical(pixel);
}
@@ -579,8 +581,8 @@
int left, right;
#define TO_FLOOD(x,y) ((fillType == FLOODFILLBORDER) ? \
- (TSXGetPixel(image,x,y) != pixel) : \
- (TSXGetPixel(image,x,y) == pixel))
+ (XGetPixel(image,x,y) != pixel) : \
+ (XGetPixel(image,x,y) == pixel))
if (!TO_FLOOD(x,y)) return;
@@ -589,15 +591,15 @@
left = right = x;
while ((left > 0) && TO_FLOOD( left-1, y )) left--;
while ((right < image->width) && TO_FLOOD( right, y )) right++;
- TSXFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
+ XFillRectangle( display, dc->u.x.drawable, dc->u.x.gc,
xOrg + left, yOrg + y, right-left, 1 );
/* Set the pixels of this line so we don't fill it again */
for (x = left; x < right; x++)
{
- if (fillType == FLOODFILLBORDER) TSXPutPixel( image, x, y, pixel );
- else TSXPutPixel( image, x, y, ~pixel );
+ if (fillType == FLOODFILLBORDER) XPutPixel( image, x, y, pixel );
+ else XPutPixel( image, x, y, ~pixel );
}
/* Fill the line above */
@@ -637,6 +639,8 @@
* X11DRV_DoFloodFill
*
* Main flood-fill routine.
+ *
+ * The Xlib critical section must be entered before calling this function.
*/
struct FloodFill_params
@@ -656,7 +660,7 @@
if (GetRgnBox32( dc->w.hGCClipRgn, &rect ) == ERROR) return FALSE;
- if (!(image = TSXGetImage( display, dc->u.x.drawable,
+ if (!(image = XGetImage( display, dc->u.x.drawable,
dc->w.DCOrgX + rect.left,
dc->w.DCOrgY + rect.top,
rect.right - rect.left,
@@ -666,7 +670,7 @@
if (DC_SetupGCForBrush( dc ))
{
/* ROP mode is always GXcopy for flood-fill */
- TSXSetFunction( display, dc->u.x.gc, GXcopy );
+ XSetFunction( display, dc->u.x.gc, GXcopy );
X11DRV_InternalFloodFill(image, dc,
XLPTODP(dc,params->x) - rect.left,
YLPTODP(dc,params->y) - rect.top,
@@ -676,7 +680,7 @@
params->fillType );
}
- TSXDestroyImage( image );
+ XDestroyImage( image );
return TRUE;
}
@@ -688,11 +692,15 @@
X11DRV_ExtFloodFill( DC *dc, INT32 x, INT32 y, COLORREF color,
UINT32 fillType )
{
+ BOOL32 result;
struct FloodFill_params params = { dc, x, y, color, fillType };
dprintf_graphics( stddeb, "X11DRV_ExtFloodFill %d,%d %06lx %d\n",
x, y, color, fillType );
if (!PtVisible32( dc->hSelf, x, y )) return FALSE;
- return CALL_LARGE_STACK( X11DRV_DoFloodFill, ¶ms );
+ EnterCriticalSection( &X11DRV_CritSection );
+ result = CALL_LARGE_STACK( X11DRV_DoFloodFill, ¶ms );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ return result;
}
diff --git a/graphics/x11drv/init.c b/graphics/x11drv/init.c
index 80ea04c..600c980 100644
--- a/graphics/x11drv/init.c
+++ b/graphics/x11drv/init.c
@@ -5,11 +5,11 @@
*/
#include <string.h>
-#include "tsx11defs.h"
#include "x11drv.h"
#include "color.h"
#include "bitmap.h"
+
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
static BOOL32 X11DRV_DeleteDC( DC *dc );
@@ -109,8 +109,6 @@
*/
BOOL32 X11DRV_Init(void)
{
- if (!TSX11_Init()) return FALSE;
-
/* FIXME: colormap management should be merged with the X11DRV */
if( !COLOR_Init() ) return FALSE;
diff --git a/if1632/builtin.c b/if1632/builtin.c
index 159ddc9..0167750 100644
--- a/if1632/builtin.c
+++ b/if1632/builtin.c
@@ -242,7 +242,8 @@
for (table = BuiltinDLLs; table->descr; table++)
if (!lstrcmpi32A( table->descr->name, dllname )) break;
- if (!table->descr) return BUILTIN32_LoadModule( name, force );
+ if (!table->descr) return BUILTIN32_LoadModule( name, force,
+ PROCESS_Current() );
if ((table->flags & DLL_FLAG_NOT_USED) && !force) return 0;
return BUILTIN_DoLoadModule16( table->descr );
diff --git a/if1632/gdi.spec b/if1632/gdi.spec
index 5fafc0d..8d2ff8c 100644
--- a/if1632/gdi.spec
+++ b/if1632/gdi.spec
@@ -211,9 +211,9 @@
282 pascal DrvGetPrinterData(ptr ptr ptr ptr long ptr) DrvGetPrinterData
299 stub ENGINEGETCHARWIDTHEX
300 pascal EngineEnumerateFont(ptr segptr long) EngineEnumerateFont
-301 stub ENGINEDELETEFONT
+301 pascal16 EngineDeleteFont(ptr) EngineDeleteFont
302 pascal EngineRealizeFont(ptr ptr ptr) EngineRealizeFont
-303 stub ENGINEGETCHARWIDTH
+303 pascal16 EngineGetCharWidth(ptr word word ptr) EngineGetCharWidth
304 stub ENGINESETFONTCONTEXT
305 stub ENGINEGETGLYPHBMP
306 stub ENGINEMAKEFONTDIR
@@ -285,7 +285,7 @@
449 stub DEVICECOLORMATCH
450 pascal16 PolyPolygon(word ptr ptr word) PolyPolygon16
451 pascal16 CreatePolyPolygonRgn(ptr ptr word word) CreatePolyPolygonRgn16
-452 stub GDISEEGDIDO
+452 pascal GdiSeeGdiDo(word word word word) GdiSeeGdiDo
460 stub GDITASKTERMINATION
461 pascal16 SetObjectOwner(word word) SetObjectOwner16
462 pascal16 IsGDIObject(word) IsGDIObject
diff --git a/if1632/relay.c b/if1632/relay.c
index b475753..74e7fad 100644
--- a/if1632/relay.c
+++ b/if1632/relay.c
@@ -58,6 +58,20 @@
}
+
+static void RELAY_dumpstr( unsigned char *s )
+{
+ fputc( '\"', stdout );
+ for ( ; *s; s++)
+ {
+ if (*s < ' ') printf( "\\0x%02x", *s );
+ else if (*s == '\\') fputs( "\\\\", stdout );
+ else fputc( *s, stdout );
+ }
+ fputc( '\"', stdout );
+}
+
+
/***********************************************************************
* RELAY_DebugCallFrom16
*/
@@ -76,94 +90,102 @@
frame->entry_ip,
&ordinal ));
VA_START16( args16 );
- for (i = 0; i < strlen(args); i++)
+
+ if (func_type & 4) /* cdecl */
{
- switch(args[i])
+ while (*args)
{
- case 'w':
- case 's':
- args16 += 2;
- break;
- case 'l':
- case 'p':
- case 't':
- case 'T':
- args16 += 4;
- break;
+ switch(*args)
+ {
+ case 'w':
+ case 's':
+ printf( "0x%04x", *(WORD *)args16 );
+ args16 += 2;
+ break;
+ case 'l':
+ printf( "0x%08x", *(int *)args16 );
+ args16 += 4;
+ break;
+ case 't':
+ printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
+ if (HIWORD(*(SEGPTR *)args16))
+ RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
+ args16 += 4;
+ break;
+ case 'p':
+ printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
+ args16 += 4;
+ break;
+ case 'T':
+ printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
+ if (HIWORD( *(SEGPTR *)args16 ))
+ RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
+ args16 += 4;
+ break;
+ }
+ args++;
+ if (*args) printf( "," );
+ }
+ }
+ else /* not cdecl */
+ {
+ /* Start with the last arg */
+ for (i = 0; args[i]; i++)
+ {
+ switch(args[i])
+ {
+ case 'w':
+ case 's':
+ args16 += 2;
+ break;
+ case 'l':
+ case 'p':
+ case 't':
+ case 'T':
+ args16 += 4;
+ break;
+ }
+ }
+
+ while (*args)
+ {
+ switch(*args)
+ {
+ case 'w':
+ case 's':
+ args16 -= 2;
+ printf( "0x%04x", *(WORD *)args16 );
+ break;
+ case 'l':
+ args16 -= 4;
+ printf( "0x%08x", *(int *)args16 );
+ break;
+ case 't':
+ args16 -= 4;
+ printf( "0x%08x", *(int *)args16 );
+ if (HIWORD(*(SEGPTR *)args16))
+ RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
+ break;
+ case 'p':
+ args16 -= 4;
+ printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
+ break;
+ case 'T':
+ args16 -= 4;
+ printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
+ if (HIWORD( *(SEGPTR *)args16 ))
+ RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
+ break;
+ }
+ args++;
+ if (*args) printf( "," );
}
}
- while (*args)
- {
- switch(*args)
- {
- case 'w':
- case 's':
- args16 -= 2;
- printf( "0x%04x", *(WORD *)args16 );
- break;
- case 'l':
- args16 -= 4;
- printf( "0x%08x", *(int *)args16 );
- break;
- case 't':
- args16 -= 4;
- printf( "0x%08x", *(int *)args16 );
- if (HIWORD(*(int *)args16)) {
- LPBYTE s = (LPBYTE)PTR_SEG_TO_LIN(*(int*)args16);
-
- /* filter out non printable chars, which would destroy output */
- fputs(" \"",stdout);
- while (*s) {
- if (*s < ' ') {
- printf( "\\0x%02x",*s++);
- continue;
- }
- if (*s=='\\') {
- fputs( "\\\\",stdout);
- s++;
- continue;
- }
- fputc(*s++,stdout);
- }
- fputs("\"",stdout);
- }
- break;
- case 'p':
- args16 -= 4;
- printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
- break;
- case 'T':
- args16 -= 4;
- printf( "%04x:%04x", *(WORD *)(args16+2), *(WORD *)args16 );
- if (HIWORD(*(int *)args16)) {
- LPBYTE s = (LPBYTE)PTR_SEG_TO_LIN(*(int*)args16);
-
- /* filter out non printable chars, which would destroy output */
- fputs(" \"",stdout);
- while (*s) {
- if (*s < ' ') {
- printf( "\\0x%02x",*s++);
- continue;
- }
- if (*s=='\\') {
- fputs( "\\\\",stdout);
- s++;
- continue;
- }
- fputc(*s++,stdout);
- }
- fputs("\"",stdout);
- }
- break;
- }
- args++;
- if (*args) printf( "," );
- }
printf( ") ret=%04x:%04x ds=%04x\n", frame->cs, frame->ip, frame->ds );
VA_END16( args16 );
- if (func_type == 2) /* register function */
+ if (func_type & 2) /* register function */
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x ES=%04x EFL=%08lx\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
@@ -248,7 +270,8 @@
CS_reg(context), IP_reg(context), DS_reg(context) );
nb_args = stack[1] / sizeof(WORD);
while (nb_args--) printf( ",0x%04x", *(--stack16) );
- printf( ")\n" );
+ printf( ") ss:sp=%04x:%04x\n", SELECTOROF(thdb->cur_stack),
+ OFFSETOF(thdb->cur_stack) );
printf( " AX=%04x BX=%04x CX=%04x DX=%04x SI=%04x DI=%04x BP=%04x ES=%04x\n",
AX_reg(context), BX_reg(context), CX_reg(context),
DX_reg(context), SI_reg(context), DI_reg(context),
@@ -261,7 +284,8 @@
SELECTOROF(thdb->cur_stack) );
stack++;
while (nb_args--) printf( ",0x%04x", *stack++ );
- printf( ")\n" );
+ printf( ") ss:sp=%04x:%04x\n", SELECTOROF(thdb->cur_stack),
+ OFFSETOF(thdb->cur_stack) );
}
}
@@ -301,7 +325,8 @@
lpbuf[0] = IP_reg(context);
lpbuf[1] = CS_reg(context);
- lpbuf[2] = SP_reg(context);
+ /* Windows pushes 4 more words before saving sp */
+ lpbuf[2] = SP_reg(context) - 4 * sizeof(WORD);
lpbuf[3] = BP_reg(context);
lpbuf[4] = SI_reg(context);
lpbuf[5] = DI_reg(context);
@@ -334,23 +359,32 @@
VA_END16( valist );
/* Find the frame32 corresponding to the frame16 we are jumping to */
+ pFrame = THREAD_STACK16( thdb );
frame32 = THREAD_STACK16( thdb )->frame32;
while (frame32 && frame32->frame16)
{
- if (OFFSETOF(frame32->frame16) > lpbuf[2]) break;
+ if (OFFSETOF(frame32->frame16) < OFFSETOF(thdb->cur_stack))
+ break; /* Something strange is going on */
+ if (OFFSETOF(frame32->frame16) > lpbuf[2])
+ {
+ /* We found the right frame */
+ pFrame->frame32 = frame32;
+ break;
+ }
frame32 = ((STACK16FRAME *)PTR_SEG_TO_LIN(frame32->frame16))->frame32;
}
- thdb->cur_stack = PTR_SEG_OFF_TO_SEGPTR( lpbuf[8], lpbuf[2]-sizeof(WORD) );
- pFrame = THREAD_STACK16( thdb );
- pFrame->frame32 = frame32;
IP_reg(context) = lpbuf[0];
CS_reg(context) = lpbuf[1];
+ SP_reg(context) = lpbuf[2] + 4 * sizeof(WORD) + sizeof(WORD) /*extra arg*/;
BP_reg(context) = lpbuf[3];
SI_reg(context) = lpbuf[4];
DI_reg(context) = lpbuf[5];
DS_reg(context) = lpbuf[6];
+ if (lpbuf[8] != SS_reg(context))
+ fprintf( stderr, "Switching stack segment with Throw() not supported; expect crash now\n" );
+
if (debugging_relay) /* Make sure we have a valid entry point address */
{
static FARPROC16 entryPoint = NULL;
diff --git a/if1632/thunk.c b/if1632/thunk.c
index 9cf9bcf4..499ec20 100644
--- a/if1632/thunk.c
+++ b/if1632/thunk.c
@@ -133,7 +133,7 @@
/* TASK_Reschedule() 16-bit entry point */
static FARPROC16 TASK_RescheduleProc;
-extern void CallFrom16_long_wwwll(void);
+extern void CallFrom16_p_long_wwwll(void);
/* Callbacks function table for the emulator */
static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
@@ -141,7 +141,7 @@
(void *)CallTo16_sreg_, /* CallRegisterShortProc */
(void *)CallTo16_lreg_, /* CallRegisterLongProc */
THUNK_CallTaskReschedule, /* CallTaskRescheduleProc */
- CallFrom16_long_wwwll, /* CallFrom16WndProc */
+ CallFrom16_p_long_wwwll, /* CallFrom16WndProc */
THUNK_CallWndProc16, /* CallWndProc */
(void *)CallTo16_long_lwwll, /* CallDriverProc */
(void *)CallTo16_word_wwlll, /* CallDriverCallback */
diff --git a/if1632/toolhelp.spec b/if1632/toolhelp.spec
index 9940d99..a06f375 100644
--- a/if1632/toolhelp.spec
+++ b/if1632/toolhelp.spec
@@ -26,8 +26,8 @@
72 pascal16 MemManInfo(ptr) MemManInfo
73 pascal16 NotifyRegister(word segptr word) NotifyRegister
74 pascal16 NotifyUnregister(word) NotifyUnregister
-75 return INTERRUPTREGISTER 6 0
-76 return INTERRUPTUNREGISTER 2 0
+75 return INTERRUPTREGISTER 6 1
+76 return INTERRUPTUNREGISTER 2 1
77 stub TERMINATEAPP
78 pascal MemoryRead(word long ptr long) MemoryRead
79 pascal MemoryWrite(word long ptr long) MemoryWrite
diff --git a/include/font.h b/include/font.h
index 7ccc65c..e629126 100644
--- a/include/font.h
+++ b/include/font.h
@@ -18,6 +18,39 @@
LOGFONT16 logfont WINE_PACKED;
} FONTOBJ;
+typedef struct {
+ WORD dfVersion;
+ DWORD dfSize;
+ CHAR dfCopyright[60];
+ WORD dfType;
+ WORD dfPoints;
+ WORD dfVertRes;
+ WORD dfHorizRes;
+ WORD dfAscent;
+ WORD dfInternalLeading;
+ WORD dfExternalLeading;
+ BYTE dfItalic;
+ BYTE dfUnderline;
+ BYTE dfStrikeOut;
+ WORD dfWeight;
+ BYTE dfCharSet;
+ WORD dfPixWidth;
+ WORD dfPixHeight;
+ BYTE dfPitchAndFamily;
+ WORD dfAvgWidth;
+ WORD dfMaxWidth;
+ BYTE dfFirstChar;
+ BYTE dfLastChar;
+ BYTE dfDefaultChar;
+ BYTE dfBreakChar;
+ WORD dfWidthBytes;
+ DWORD dfDevice;
+ DWORD dfFace;
+ DWORD dfReserved;
+ CHAR szDeviceName[60]; /* FIXME: length unknown */
+ CHAR szFaceName[60]; /* dito */
+} FONTDIR16, *LPFONTDIR16;
+
#pragma pack(4)
#define FONTCACHE 32 /* dynamic font cache size */
diff --git a/include/k32obj.h b/include/k32obj.h
index 5ac2a5e..f117ce8 100644
--- a/include/k32obj.h
+++ b/include/k32obj.h
@@ -59,7 +59,7 @@
extern BOOL32 K32OBJ_IsValid( K32OBJ *ptr, K32OBJ_TYPE type );
extern BOOL32 K32OBJ_AddName( K32OBJ *obj, LPCSTR name );
extern K32OBJ *K32OBJ_Create( K32OBJ_TYPE type, DWORD size, LPCSTR name,
- HANDLE32 *handle );
+ DWORD access, HANDLE32 *handle );
extern K32OBJ *K32OBJ_FindName( LPCSTR name );
extern K32OBJ *K32OBJ_FindNameType( LPCSTR name, K32OBJ_TYPE type );
diff --git a/include/ldt.h b/include/ldt.h
index f77592a..4d6713f 100644
--- a/include/ldt.h
+++ b/include/ldt.h
@@ -64,6 +64,8 @@
(__winelib ? (void*)(ptr) : PTR_SEG_OFF_TO_LIN(SELECTOROF(ptr),OFFSETOF(ptr)))
#define PTR_SEG_OFF_TO_SEGPTR(seg,off) \
(__winelib ? (SEGPTR)PTR_SEG_OFF_TO_LIN(seg,off) : (SEGPTR)MAKELONG(off,seg))
+#define PTR_SEG_OFF_TO_HUGEPTR(seg,off) \
+ (PTR_SEG_OFF_TO_SEGPTR( (seg) + (HIWORD(off) << __AHSHIFT), LOWORD(off) ))
extern unsigned char ldt_flags_copy[LDT_SIZE];
diff --git a/include/local.h b/include/local.h
index f39677c..9073f8f 100644
--- a/include/local.h
+++ b/include/local.h
@@ -25,5 +25,6 @@
extern LPSTR LOCAL_Lock( HANDLE16 ds, HLOCAL16 handle );
extern SEGPTR LOCAL_LockSegptr( HANDLE16 ds, HLOCAL16 handle );
extern BOOL16 LOCAL_Unlock( HANDLE16 ds, HLOCAL16 handle );
+extern WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags );
#endif /* __WINE_LOCAL_H */
diff --git a/include/module.h b/include/module.h
index 7e7a743..ea988db 100644
--- a/include/module.h
+++ b/include/module.h
@@ -148,6 +148,7 @@
extern void NE_InitializeDLLs( HMODULE16 hModule );
/* relay32/builtin.c */
-extern HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force );
+extern HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force,
+ struct _PDB32 *process );
#endif /* __WINE_MODULE_H */
diff --git a/include/pe_image.h b/include/pe_image.h
index aafab14..ceab086 100644
--- a/include/pe_image.h
+++ b/include/pe_image.h
@@ -29,7 +29,8 @@
typedef struct pe_modref PE_MODREF;
extern int PE_unloadImage(HMODULE32 hModule);
-extern FARPROC32 PE_FindExportedFunction(HMODULE32 hModule, LPCSTR funcName);
+extern FARPROC32 PE_FindExportedFunction( struct _PDB32 *process,
+ HMODULE32 hModule, LPCSTR funcName);
extern void my_wcstombs(char * result, u_short * source, int len);
extern BOOL32 PE_EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
extern BOOL32 PE_EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
diff --git a/include/process.h b/include/process.h
index 848f775..dbce014 100644
--- a/include/process.h
+++ b/include/process.h
@@ -17,7 +17,7 @@
/* Process handle entry */
typedef struct
{
- DWORD flags; /* Handle flags */
+ DWORD access; /* Access flags */
K32OBJ *ptr; /* Object ptr */
} HANDLE_ENTRY;
@@ -103,12 +103,17 @@
#define PROCESS_ID_TO_PDB(id) ((PDB32 *)((id) ^ PROCESS_OBFUSCATOR))
#define PDB_TO_PROCESS_ID(pdb) ((DWORD)(pdb) ^ PROCESS_OBFUSCATOR)
+/* scheduler/handle.c */
+extern HANDLE_TABLE *HANDLE_AllocTable( PDB32 *process );
+extern HANDLE32 HANDLE_Alloc( K32OBJ *ptr, DWORD access, BOOL32 inherit );
+extern K32OBJ *HANDLE_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type,
+ DWORD access );
+extern BOOL32 HANDLE_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD access );
+
/* scheduler/process.c */
extern PDB32 *PROCESS_Current(void);
+extern PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access );
extern PDB32 *PROCESS_IdToPDB( DWORD id );
-extern HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags);
-extern K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type );
-extern BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags );
extern PDB32 *PROCESS_Create( TDB *pTask, LPCSTR cmd_line );
#endif /* __WINE_PROCESS_H */
diff --git a/include/thread.h b/include/thread.h
index c17349c..8ffe980 100644
--- a/include/thread.h
+++ b/include/thread.h
@@ -122,6 +122,7 @@
extern THDB *THREAD_Create( struct _PDB32 *pdb, DWORD stack_size,
LPTHREAD_START_ROUTINE start_addr, LPVOID param );
extern THDB *THREAD_Current(void);
+extern THDB *THREAD_GetPtr( HANDLE32 handle, DWORD access );
extern void THREAD_AddQueue( THREAD_QUEUE *queue, THDB *thread );
extern void THREAD_RemoveQueue( THREAD_QUEUE *queue, THDB *thread );
diff --git a/include/ts_xlib.h b/include/ts_xlib.h
index 69f9a5e..7088599 100644
--- a/include/ts_xlib.h
+++ b/include/ts_xlib.h
@@ -67,6 +67,7 @@
extern int TSXFillRectangle(Display*, Drawable, GC, int, int, unsigned int, unsigned int);
extern int TSXFlush(Display*);
extern int TSXFree(void*);
+extern int TSXFreeColormap(Display*, Colormap);
extern int TSXFreeColors(Display*, Colormap, unsigned long*, int, unsigned long);
extern int TSXFreeCursor(Display*, Cursor);
extern int TSXFreeFont(Display*, XFontStruct*);
diff --git a/include/ts_xutil.h b/include/ts_xutil.h
index 253f212..41af045 100644
--- a/include/ts_xutil.h
+++ b/include/ts_xutil.h
@@ -23,6 +23,7 @@
extern int TSXEmptyRegion(Region);
extern int TSXEqualRegion(Region, Region);
extern int TSXFindContext(Display*, XID, XContext, XPointer*);
+extern XVisualInfo * TSXGetVisualInfo(Display*, long, XVisualInfo*, int*);
extern int TSXGetWMSizeHints(Display*, Window, XSizeHints*, long*, Atom);
extern int TSXIntersectRegion(Region, Region, Region);
extern int TSXLookupString(XKeyEvent*, char*, int, KeySym*, XComposeStatus*);
@@ -41,8 +42,6 @@
extern int TSXUnionRegion(Region, Region, Region);
extern int TSXXorRegion(Region, Region, Region);
extern int TSXDestroyImage(struct _XImage *);
-extern unsigned long TSXGetPixel(struct _XImage *, int, int);
-extern int TSXPutPixel(struct _XImage *, int, int, unsigned long);
extern struct _XImage * TSXSubImage(struct _XImage *, int, int, unsigned int, unsigned int);
extern int TSXAddPixel(struct _XImage *, long);
extern XContext TSXUniqueContext(void);
diff --git a/include/tsx11defs.h b/include/tsx11defs.h
deleted file mode 100644
index 87396a7..0000000
--- a/include/tsx11defs.h
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * Thread safe wrappers around X11 calls
- *
- * Copyright 1998 Kristian Nielsen
- */
-
-#ifndef __WINE_TSX11DEFS_H
-#define __WINE_TSX11DEFS_H
-
-#include "winbase.h"
-
-extern CRITICAL_SECTION *TSX11_SectionPtr;
-
-extern int TSX11_Init(void);
-
-#define X11_LOCK() \
- (TSX11_SectionPtr ? EnterCriticalSection(TSX11_SectionPtr) : 0)
-
-#define X11_UNLOCK() \
- (TSX11_SectionPtr ? LeaveCriticalSection(TSX11_SectionPtr) : 0)
-
-#endif /* __WINE_TSX11DEFS_H */
diff --git a/include/version.h b/include/version.h
index 0581786..7c96165 100644
--- a/include/version.h
+++ b/include/version.h
@@ -1 +1 @@
-#define WINE_RELEASE_INFO "Wine release 980201"
+#define WINE_RELEASE_INFO "Wine release 980215"
diff --git a/include/winbase.h b/include/winbase.h
index 46aaa97..d1c3004 100644
--- a/include/winbase.h
+++ b/include/winbase.h
@@ -97,6 +97,9 @@
#define DUPLICATE_CLOSE_SOURCE 0x00000001
#define DUPLICATE_SAME_ACCESS 0x00000002
+#define HANDLE_FLAG_INHERIT 0x00000001
+#define HANDLE_FLAG_PROTECT_FROM_CLOSE 0x00000002
+
typedef struct
{
int type;
diff --git a/include/windows.h b/include/windows.h
index 11f7d6c..a983aa5 100644
--- a/include/windows.h
+++ b/include/windows.h
@@ -4698,8 +4698,6 @@
/* File creation flags
*/
-#define GENERIC_READ 0x80000000L
-#define GENERIC_WRITE 0x40000000L
#define CREATE_NEW 1
#define CREATE_ALWAYS 2
#define OPEN_EXISTING 3
@@ -5360,6 +5358,12 @@
DECL_WINELIB_TYPE_AW(NONCLIENTMETRICS);
DECL_WINELIB_TYPE_AW(LPNONCLIENTMETRICS);
+typedef struct tagANIMATIONINFO
+{
+ UINT32 cbSize;
+ INT32 iMinAnimate;
+} ANIMATIONINFO, *LPANIMATIONINFO;
+
typedef struct tagNMHDR
{
HWND32 hwndFrom;
@@ -5661,6 +5665,7 @@
/* Declarations for functions that exist only in Win32 */
+BOOL32 WINAPI AllocConsole(void);
BOOL32 WINAPI AreFileApisANSI(void);
BOOL32 WINAPI Beep(DWORD,DWORD);
BOOL32 WINAPI ClearCommError(INT32,LPDWORD,LPCOMSTAT);
@@ -5738,6 +5743,7 @@
DWORD WINAPI FormatMessage32A(DWORD,LPCVOID,DWORD,DWORD,LPSTR,
DWORD,LPDWORD);
#define FormatMessage WINELIB_NAME_AW(FormatMessage)
+BOOL32 WINAPI FreeConsole(void);
BOOL32 WINAPI FreeEnvironmentStrings32A(LPSTR);
BOOL32 WINAPI FreeEnvironmentStrings32W(LPWSTR);
#define FreeEnvironmentStrings WINELIB_NAME_AW(FreeEnvironmentStrings)
@@ -5776,6 +5782,7 @@
DWORD WINAPI GetFullPathName32W(LPCWSTR,DWORD,LPWSTR,LPWSTR*);
#define GetFullPathName WINELIB_NAME_AW(GetFullPathName)
INT32 WINAPI GetGraphicsMode(HDC32);
+BOOL32 WINAPI GetHandleInformation(HANDLE32,LPDWORD);
DWORD WINAPI GetLargestConsoleWindowSize(HANDLE32);
VOID WINAPI GetLocalTime(LPSYSTEMTIME);
DWORD WINAPI GetLogicalDrives(void);
@@ -5917,6 +5924,7 @@
BOOL32 WINAPI SetFileTime(HFILE32,const FILETIME*,const FILETIME*,
const FILETIME*);
INT32 WINAPI SetGraphicsMode(HDC32,INT32);
+BOOL32 WINAPI SetHandleInformation(HANDLE32,DWORD,DWORD);
VOID WINAPI SetLastErrorEx(DWORD,DWORD);
BOOL32 WINAPI SetMenuItemInfo32A(HMENU32,UINT32,BOOL32,const MENUITEMINFO32A*);
BOOL32 WINAPI SetMenuItemInfo32W(HMENU32,UINT32,BOOL32,const MENUITEMINFO32W*);
diff --git a/include/winerror.h b/include/winerror.h
index a0a996f..e0c9dda 100644
--- a/include/winerror.h
+++ b/include/winerror.h
@@ -31,6 +31,7 @@
#define ERROR_LOCK_VIOLATION 33
#define ERROR_DUP_NAME 52
#define ERROR_FILE_EXISTS 80
+#define ERROR_CANNOT_MAKE 82
#define ERROR_INVALID_PARAMETER 87
#define ERROR_BROKEN_PIPE 109
#define ERROR_DISK_FULL 112
diff --git a/include/winnt.h b/include/winnt.h
index e18eeb3..8d5a226 100644
--- a/include/winnt.h
+++ b/include/winnt.h
@@ -318,4 +318,86 @@
#define LANG_TURKISH 0x1f
#define LANG_UKRAINIAN 0x22
+
+/* Access rights */
+
+#define DELETE 0x00010000
+#define READ_CONTROL 0x00020000
+#define WRITE_DAC 0x00040000
+#define WRITE_OWNER 0x00080000
+#define SYNCHRONIZE 0x00100000
+#define STANDARD_RIGHTS_REQUIRED 0x000f0000
+
+#define STANDARD_RIGHTS_READ READ_CONTROL
+#define STANDARD_RIGHTS_WRITE READ_CONTROL
+#define STANDARD_RIGHTS_EXECUTE READ_CONTROL
+
+#define STANDARD_RIGHTS_ALL 0x001f0000
+
+#define SPECIFIC_RIGHTS_ALL 0x0000ffff
+
+#define GENERIC_READ 0x80000000
+#define GENERIC_WRITE 0x40000000
+#define GENERIC_EXECUTE 0x20000000
+#define GENERIC_ALL 0x10000000
+
+#define EVENT_MODIFY_STATE 0x0002
+#define EVENT_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define SEMAPHORE_MODIFY_STATE 0x0002
+#define SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+#define MUTEX_MODIFY_STATE 0x0001
+#define MUTEX_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1)
+
+#define PROCESS_TERMINATE 0x0001
+#define PROCESS_CREATE_THREAD 0x0002
+#define PROCESS_VM_OPERATION 0x0008
+#define PROCESS_VM_READ 0x0010
+#define PROCESS_VM_WRITE 0x0020
+#define PROCESS_DUP_HANDLE 0x0040
+#define PROCESS_CREATE_PROCESS 0x0080
+#define PROCESS_SET_QUOTA 0x0100
+#define PROCESS_SET_INFORMATION 0x0200
+#define PROCESS_QUERY_INFORMATION 0x0400
+#define PROCESS_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0xfff)
+
+#define THREAD_TERMINATE 0x0001
+#define THREAD_SUSPEND_RESUME 0x0002
+#define THREAD_GET_CONTEXT 0x0008
+#define THREAD_SET_CONTEXT 0x0010
+#define THREAD_SET_INFORMATION 0x0020
+#define THREAD_QUERY_INFORMATION 0x0040
+#define THREAD_SET_THREAD_TOKEN 0x0080
+#define THREAD_IMPERSONATE 0x0100
+#define THREAD_DIRECT_IMPERSONATION 0x0200
+#define THREAD_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3ff)
+
+#define FILE_READ_DATA 0x0001 /* file & pipe */
+#define FILE_LIST_DIRECTORY 0x0001 /* directory */
+#define FILE_WRITE_DATA 0x0002 /* file & pipe */
+#define FILE_ADD_FILE 0x0002 /* directory */
+#define FILE_APPEND_DATA 0x0004 /* file */
+#define FILE_ADD_SUBDIRECTORY 0x0004 /* directory */
+#define FILE_CREATE_PIPE_INSTANCE 0x0004 /* named pipe */
+#define FILE_READ_EA 0x0008 /* file & directory */
+#define FILE_READ_PROPERTIES FILE_READ_EA
+#define FILE_WRITE_EA 0x0010 /* file & directory */
+#define FILE_WRITE_PROPERTIES FILE_WRITE_EA
+#define FILE_EXECUTE 0x0020 /* file */
+#define FILE_TRAVERSE 0x0020 /* directory */
+#define FILE_DELETE_CHILD 0x0040 /* directory */
+#define FILE_READ_ATTRIBUTES 0x0080 /* all */
+#define FILE_WRITE_ATTRIBUTES 0x0100 /* all */
+#define FILE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x1ff)
+
+#define FILE_GENERIC_READ (STANDARD_RIGHTS_READ | FILE_READ_DATA | \
+ FILE_READ_ATTRIBUTES | FILE_READ_EA | \
+ SYNCHRONIZE)
+#define FILE_GENERIC_WRITE (STANDARD_RIGHTS_WRITE | FILE_WRITE_DATA | \
+ FILE_WRITE_ATTRIBUTES | FILE_WRITE_EA | \
+ FILE_APPEND_DATA | SYNCHRONIZE)
+#define FILE_GENERIC_EXECUTE (STANDARD_RIGHTS_EXECUTE | FILE_EXECUTE | \
+ FILE_READ_ATTRIBUTES | SYNCHRONIZE)
+
#endif /* __WINE_WINNT_H */
diff --git a/include/x11drv.h b/include/x11drv.h
index 885a595..cddfaab 100644
--- a/include/x11drv.h
+++ b/include/x11drv.h
@@ -7,8 +7,7 @@
#include "ts_xlib.h"
#include "ts_xutil.h"
-#include "tsx11defs.h"
-
+#include "winbase.h"
#include "windows.h"
/* X physical pen */
@@ -111,4 +110,8 @@
extern BOOL32 X11DRV_BRUSH_Init(void);
extern BOOL32 X11DRV_FONT_Init( struct tagDeviceCaps* );
+/* Xlib critical section */
+
+extern CRITICAL_SECTION X11DRV_CritSection;
+
#endif /* __WINE_X11DRV_H */
diff --git a/library/winestub.c b/library/winestub.c
index e39b7be..c23e075 100644
--- a/library/winestub.c
+++ b/library/winestub.c
@@ -13,8 +13,7 @@
}
extern int PASCAL WinMain(HINSTANCE32,HINSTANCE32,LPSTR,int);
-extern int MAIN_WinelibInit(void);
-extern BOOL32 MAIN_WineInit( int *argc, char *argv[] );
+extern BOOL32 MAIN_WinelibInit( int *argc, char *argv[] );
extern void TASK_Reschedule(void);
/* Most Windows C/C++ compilers use something like this to */
@@ -30,7 +29,7 @@
_ARGC = argc;
_ARGV = (char **)argv;
- MAIN_WineInit( &argc, argv );
+ if (!MAIN_WinelibInit( &argc, argv )) return 0;
/* Alloc szCmdParam */
for (i = 1; i < argc; i++) len += strlen(argv[i]) + 1;
@@ -40,7 +39,6 @@
else lpszCmdParam[0] = '\0';
for (i = 2; i < argc; i++) strcat(strcat(lpszCmdParam, " "), argv[i]);
- if(!MAIN_WinelibInit()) return 0;
hInstance = WinExec32( *argv, SW_SHOWNORMAL );
TASK_Reschedule();
InitApp( hInstance );
diff --git a/libtest/Makefile.in b/libtest/Makefile.in
index f68cd12..039c6f9 100644
--- a/libtest/Makefile.in
+++ b/libtest/Makefile.in
@@ -3,7 +3,7 @@
SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = none
-RCFLAGS = -w16 -h
+RCFLAGS = -w32 -h
PROGRAMS = expand hello hello2 hello3 hello4 hello5 new rolex
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LIBS)
diff --git a/libtest/hello3.c b/libtest/hello3.c
index 588c627..6a75ff4 100644
--- a/libtest/hello3.c
+++ b/libtest/hello3.c
@@ -1,4 +1,5 @@
#include <windows.h>
+#include <resource.h>
#include "hello3res.h"
#include <commdlg.h>
diff --git a/libtest/hello3res.rc b/libtest/hello3res.rc
index c0dfe0a..020e574 100644
--- a/libtest/hello3res.rc
+++ b/libtest/hello3res.rc
@@ -7,6 +7,8 @@
}
}
+BITDEMO BITMAP "../rc/winelogo.bmp"
+
DIADEMO DIALOG 20, 20, 179, 118
STYLE DS_MODALFRAME | WS_CAPTION | WS_POPUP | WS_VISIBLE | WS_SYSMENU
CAPTION "Dialog demo"
diff --git a/loader/main.c b/loader/main.c
index 767eb10..e255cc7 100644
--- a/loader/main.c
+++ b/loader/main.c
@@ -48,18 +48,6 @@
BOOL32 MAIN_KernelInit(void)
{
extern BOOL32 EVENT_Init(void);
- extern BOOL32 PROCESS_Init(void);
- extern BOOL32 VIRTUAL_Init(void);
-
- /* Initialize virtual memory management */
- if (!VIRTUAL_Init()) return FALSE;
-
- /* Create the system and SEGPTR heaps */
- if (!(SystemHeap = HeapCreate( HEAP_GROWABLE, 0x10000, 0 ))) return FALSE;
- if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
-
- /* Create the initial process */
- if (!PROCESS_Init()) return FALSE;
/* Initialize signal handling */
if (!SIGNAL_Init()) return FALSE;
@@ -173,12 +161,21 @@
/***********************************************************************
* Winelib initialisation routine
*/
-int MAIN_WinelibInit(void)
+BOOL32 MAIN_WinelibInit( int *argc, char *argv[] )
{
+ extern BOOL32 PROCESS_Init(void);
+
+ /* Create the initial process */
+ if (!PROCESS_Init()) return FALSE;
+
+ /* Parse command line arguments */
+ MAIN_WineInit( argc, argv );
+
/* Initialize the kernel */
- if (!MAIN_KernelInit()) return 0;
+ if (!MAIN_KernelInit()) return FALSE;
/* Initialize all the USER stuff */
- if (!MAIN_UserInit()) return 0;
- return 1;
+ if (!MAIN_UserInit()) return FALSE;
+
+ return TRUE;
}
diff --git a/loader/module.c b/loader/module.c
index 35134fd..c7216e6 100644
--- a/loader/module.c
+++ b/loader/module.c
@@ -1800,7 +1800,8 @@
);
return (FARPROC32)0;
}
- return PE_FindExportedFunction( pModule->module32, function );
+ return PE_FindExportedFunction( PROCESS_Current(), pModule->module32,
+ function );
}
/***********************************************************************
diff --git a/loader/pe_image.c b/loader/pe_image.c
index acc8a66..96a9b15 100644
--- a/loader/pe_image.c
+++ b/loader/pe_image.c
@@ -90,7 +90,8 @@
* If it is a ordinal:
* - use ordinal-pe_export->Base as offset into the functionlist
*/
-FARPROC32 PE_FindExportedFunction( HMODULE32 hModule, LPCSTR funcName)
+FARPROC32 PE_FindExportedFunction( PDB32 *process, HMODULE32 hModule,
+ LPCSTR funcName)
{
IMAGE_EXPORT_DIRECTORY *exports;
unsigned load_addr;
@@ -98,7 +99,6 @@
u_long * function;
u_char ** name, *ename;
int i;
- PDB32 *process=PROCESS_Current();
PE_MODREF *pem;
u_long rva_start, rva_end, addr;
char * forward;
@@ -157,12 +157,14 @@
}
if (forward)
{
+ HMODULE32 hMod;
char module[256];
char *end = strchr(forward, '.');
if (!end) return NULL;
strncpy(module, forward, (end - forward));
module[end-forward] = 0;
- return GetProcAddress32(MODULE_FindModule(module), end + 1);
+ hMod = MODULE_HANDLEtoHMODULE32( MODULE_FindModule(module) );
+ return PE_FindExportedFunction( process, hMod, end + 1);
}
return NULL;
}
@@ -259,8 +261,10 @@
char *Module;
IMAGE_IMPORT_BY_NAME *pe_name;
LPIMAGE_THUNK_DATA import_list,thunk_list;
+ HMODULE32 hImpModule;
Module = (char *) RVA(pe_imp->Name);
+ hImpModule = MODULE_HANDLEtoHMODULE32( MODULE_FindModule(Module) );
dprintf_win32 (stddeb, "%s\n", Module);
/* FIXME: forwarder entries ... */
@@ -275,7 +279,8 @@
int ordinal = IMAGE_ORDINAL(import_list->u1.Ordinal);
dprintf_win32 (stddeb, "--- Ordinal %s,%d\n", Module, ordinal);
- thunk_list->u1.Function=(LPDWORD)GetProcAddress32(MODULE_FindModule(Module),(LPCSTR)ordinal);
+ thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
+ process, hImpModule, (LPCSTR)ordinal);
if (!thunk_list->u1.Function) {
fprintf(stderr,"No implementation for %s.%d, setting to NULL\n",
Module, ordinal);
@@ -284,9 +289,8 @@
} else { /* import by name */
pe_name = (LPIMAGE_IMPORT_BY_NAME)RVA(import_list->u1.AddressOfData);
dprintf_win32 (stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
- thunk_list->u1.Function=(LPDWORD)GetProcAddress32(
- MODULE_FindModule (Module),
- pe_name->Name);
+ thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
+ process, hImpModule, pe_name->Name);
if (!thunk_list->u1.Function) {
fprintf(stderr,"No implementation for %s.%d(%s), setting to NULL\n",
Module,pe_name->Hint,pe_name->Name);
@@ -305,8 +309,8 @@
int ordinal = IMAGE_ORDINAL(thunk_list->u1.Ordinal);
dprintf_win32(stddeb,"--- Ordinal %s.%d\n",Module,ordinal);
- thunk_list->u1.Function=(LPDWORD)GetProcAddress32(MODULE_FindModule(Module),
- (LPCSTR) ordinal);
+ thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
+ process, hImpModule, (LPCSTR) ordinal);
if (!thunk_list->u1.Function) {
fprintf(stderr, "No implementation for %s.%d, setting to NULL\n",
Module,ordinal);
@@ -316,7 +320,8 @@
pe_name=(LPIMAGE_IMPORT_BY_NAME) RVA(thunk_list->u1.AddressOfData);
dprintf_win32(stddeb,"--- %s %s.%d\n",
pe_name->Name,Module,pe_name->Hint);
- thunk_list->u1.Function=(LPDWORD)GetProcAddress32(MODULE_FindModule(Module),pe_name->Name);
+ thunk_list->u1.Function=(LPDWORD)PE_FindExportedFunction(
+ process, hImpModule, pe_name->Name );
if (!thunk_list->u1.Function) {
fprintf(stderr, "No implementation for %s.%d, setting to NULL\n",
Module, pe_name->Hint);
@@ -504,7 +509,7 @@
IMAGE_DOS_HEADER *dos_header = (IMAGE_DOS_HEADER *)hModule;
IMAGE_NT_HEADERS *nt_header = PE_HEADER(hModule);
- pem = (PE_MODREF*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,
+ pem = (PE_MODREF*)HeapAlloc(process->heap,HEAP_ZERO_MEMORY,
sizeof(*pem));
/* NOTE: fixup_imports takes care of the correct order */
pem->next = process->modref_list;
@@ -725,7 +730,7 @@
* internal dll but in another process. Just create
* a PE_MODREF and return.
*/
- pem = (PE_MODREF*)HeapAlloc(GetProcessHeap(),
+ pem = (PE_MODREF*)HeapAlloc(process->heap,
HEAP_ZERO_MEMORY,sizeof(*pem));
pem->module = hModule;
dh = (IMAGE_DOS_HEADER*)pem->module;
@@ -739,13 +744,13 @@
} else {
/* try to load builtin, enabled modules first */
- if ((hModule = BUILTIN32_LoadModule( name, FALSE )))
+ if ((hModule = BUILTIN32_LoadModule( name, FALSE, process )))
return MODULE_HANDLEtoHMODULE32( hModule );
/* try to open the specified file */
if (HFILE_ERROR32==(hFile=OpenFile32(name,&ofs,OF_READ))) {
/* Now try the built-in even if disabled */
- if ((hModule = BUILTIN32_LoadModule( name, TRUE ))) {
+ if ((hModule = BUILTIN32_LoadModule( name, TRUE, process ))) {
fprintf( stderr, "Warning: could not load Windows DLL '%s', using built-in module.\n", name );
return MODULE_HANDLEtoHMODULE32( hModule );
}
diff --git a/memory/global.c b/memory/global.c
index ad9d600..8dafd47 100644
--- a/memory/global.c
+++ b/memory/global.c
@@ -800,7 +800,20 @@
*/
BOOL16 WINAPI GlobalEntryHandle( GLOBALENTRY *pGlobal, HGLOBAL16 hItem )
{
- return FALSE;
+ GLOBALARENA *pArena = GET_ARENA_PTR(hItem);
+
+ pGlobal->dwAddress = pArena->base;
+ pGlobal->dwBlockSize = pArena->size;
+ pGlobal->hBlock = pArena->handle;
+ pGlobal->wcLock = pArena->lockCount;
+ pGlobal->wcPageLock = pArena->pageLockCount;
+ pGlobal->wFlags = (GetCurrentPDB() == pArena->hOwner);
+ pGlobal->wHeapPresent = FALSE;
+ pGlobal->hOwner = pArena->hOwner;
+ pGlobal->wType = GT_UNKNOWN;
+ pGlobal->wData = 0;
+ pGlobal->dwNext++;
+ return TRUE;
}
diff --git a/memory/ldt.c b/memory/ldt.c
index 126e30b..50171b0 100644
--- a/memory/ldt.c
+++ b/memory/ldt.c
@@ -289,7 +289,7 @@
flags[1] = (ldt_flags_copy[i] & LDT_FLAGS_READONLY) ? '-' : 'w';
flags[2] = '-';
}
- printf("%04x: sel=%04x base=%08lx limit=%08lx %d-bit %c%c%c\n",
+ fprintf(stderr,"%04x: sel=%04x base=%08lx limit=%08lx %d-bit %c%c%c\n",
i, ENTRY_TO_SELECTOR(i),
ldt_copy[i].base, ldt_copy[i].limit,
ldt_flags_copy[i] & LDT_FLAGS_32BIT ? 32 : 16,
diff --git a/memory/local.c b/memory/local.c
index 780dc17..cb572e8 100644
--- a/memory/local.c
+++ b/memory/local.c
@@ -638,7 +638,7 @@
/***********************************************************************
* LOCAL_Compact
*/
-static WORD LOCAL_Compact( HANDLE16 ds, WORD minfree, WORD flags )
+WORD LOCAL_Compact( HANDLE16 ds, UINT16 minfree, UINT16 flags )
{
char *ptr = PTR_SEG_OFF_TO_LIN( ds, 0 );
LOCALHEAPINFO *pInfo;
diff --git a/memory/virtual.c b/memory/virtual.c
index bc75762..442ccd5 100644
--- a/memory/virtual.c
+++ b/memory/virtual.c
@@ -659,7 +659,7 @@
{
BOOL32 ret = FALSE;
- PDB32 *pdb = (PDB32 *)PROCESS_GetObjPtr( handle, K32OBJ_PROCESS );
+ PDB32 *pdb = PROCESS_GetPtr( handle, PROCESS_VM_OPERATION );
if (pdb)
{
if (pdb == PROCESS_Current())
@@ -742,7 +742,7 @@
{
BOOL32 ret = FALSE;
- PDB32 *pdb = (PDB32 *)PROCESS_GetObjPtr( handle, K32OBJ_PROCESS );
+ PDB32 *pdb = PROCESS_GetPtr( handle, PROCESS_QUERY_INFORMATION );
if (pdb)
{
if (pdb == PROCESS_Current())
@@ -877,7 +877,7 @@
if (obj->type == K32OBJ_MEM_MAPPED_FILE)
{
SetLastError( ERROR_ALREADY_EXISTS );
- handle = PROCESS_AllocHandle( obj, 0 );
+ handle = HANDLE_Alloc( obj, FILE_MAP_ALL_ACCESS /*FIXME*/, FALSE );
}
else
{
@@ -919,9 +919,16 @@
else /* We have a file */
{
BY_HANDLE_FILE_INFORMATION info;
- if (!(obj = PROCESS_GetObjPtr( hFile, K32OBJ_FILE ))) goto error;
- /* FIXME: should check if the file permissions agree
- * with the required protection flags */
+ DWORD access = GENERIC_READ;
+
+ if (((protect & 0xff) == PAGE_READWRITE) ||
+ ((protect & 0xff) == PAGE_WRITECOPY) ||
+ ((protect & 0xff) == PAGE_EXECUTE_READWRITE) ||
+ ((protect & 0xff) == PAGE_EXECUTE_WRITECOPY))
+ access |= GENERIC_WRITE;
+ if (!(obj = HANDLE_GetObjPtr( hFile, K32OBJ_FILE, access )))
+ goto error;
+
if (!GetFileInformationByHandle( hFile, &info )) goto error;
if (!size_high && !size_low)
{
@@ -950,7 +957,8 @@
mapping->file = (FILE_OBJECT *)obj;
if (!K32OBJ_AddName( &mapping->header, name )) handle = 0;
- else handle = PROCESS_AllocHandle( &mapping->header, 0 );
+ else handle = HANDLE_Alloc( &mapping->header,
+ FILE_MAP_ALL_ACCESS /*FIXME*/, FALSE );
K32OBJ_DecCount( &mapping->header );
return handle;
@@ -986,7 +994,7 @@
SYSTEM_LOCK();
if ((obj = K32OBJ_FindNameType( name, K32OBJ_MEM_MAPPED_FILE )))
{
- handle = PROCESS_AllocHandle( obj, 0 );
+ handle = HANDLE_Alloc( obj, access, inherit );
K32OBJ_DecCount( obj );
}
SYSTEM_UNLOCK();
@@ -1053,8 +1061,9 @@
return NULL;
}
- if (!(mapping = (FILE_MAPPING *)PROCESS_GetObjPtr( handle,
- K32OBJ_MEM_MAPPED_FILE )))
+ if (!(mapping = (FILE_MAPPING *)HANDLE_GetObjPtr( handle,
+ K32OBJ_MEM_MAPPED_FILE,
+ 0 /* FIXME */ )))
return NULL;
if (mapping->size_high || offset_high)
diff --git a/misc/crtdll.c b/misc/crtdll.c
index 2415c39..dac9b30 100644
--- a/misc/crtdll.c
+++ b/misc/crtdll.c
@@ -1701,3 +1701,11 @@
LONG __cdecl CRTDLL__ftol(double fl) {
return (LONG)fl;
}
+/*********************************************************************
+ * _sleep (CRTDLL.267)
+ */
+VOID __cdecl CRTDLL__sleep(unsigned long timeout)
+{
+ dprintf_crtdll(stddeb,"CRTDLL__sleep for %ld milliseconds\n",timeout);
+ Sleep((timeout)?timeout:1);
+}
diff --git a/misc/main.c b/misc/main.c
index 2fffd0b..2ca79c7 100644
--- a/misc/main.c
+++ b/misc/main.c
@@ -509,7 +509,7 @@
keyboard_value.bell_duration = keyboard_state.bell_duration;
keyboard_value.auto_repeat_mode = keyboard_state.global_auto_repeat;
- TSXChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
+ XChangeKeyboardControl(display, KBKeyClickPercent | KBBellPercent |
KBBellPitch | KBBellDuration | KBAutoRepeatMode, &keyboard_value);
}
@@ -556,6 +556,9 @@
gettimeofday( &tv, NULL);
MSG_WineStartTicks = (tv.tv_sec * 1000) + (tv.tv_usec / 1000);
+ /* We need this before calling any Xlib function */
+ InitializeCriticalSection( &X11DRV_CritSection );
+
TSXrmInitialize();
putenv("XKB_DISABLE="); /* Disable XKB extension if present. */
@@ -759,6 +762,26 @@
#undef lpnm
break;
+ case SPI_GETANIMATION: {
+ LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
+
+ /* Tell it "disabled" */
+ lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
+ uParam = sizeof(ANIMATIONINFO);
+ lpAnimInfo->iMinAnimate = 0; /* Minimise and restore animation is disabled (nonzero == enabled) */
+ break;
+ }
+
+ case SPI_SETANIMATION: {
+ LPANIMATIONINFO lpAnimInfo = (LPANIMATIONINFO)lpvParam;
+
+ /* Do nothing */
+ fprintf(stderr, "SystemParametersInfo: SPI_SETANIMATION ignored.\n");
+ lpAnimInfo->cbSize = sizeof(ANIMATIONINFO);
+ uParam = sizeof(ANIMATIONINFO);
+ break;
+ }
+
default:
return SystemParametersInfo16(uAction,uParam,lpvParam,fuWinIni);
}
diff --git a/misc/shell.c b/misc/shell.c
index 02a24d2..7007c23 100644
--- a/misc/shell.c
+++ b/misc/shell.c
@@ -32,6 +32,7 @@
"Bob Amstadt",
"Dag Asheim",
"Martin Ayotte",
+ "Karl Backstr\366m",
"Peter Bajusz",
"Georg Beyerle",
"Ross Biro",
@@ -96,6 +97,7 @@
"Bruce Milner",
"Steffen Moeller",
"Andreas Mohr",
+ "James Moody",
"Philippe De Muyter",
"Itai Nahshon",
"Kristian Nielsen",
diff --git a/misc/toolhelp.c b/misc/toolhelp.c
index 51074b9..2e485ae 100644
--- a/misc/toolhelp.c
+++ b/misc/toolhelp.c
@@ -14,6 +14,7 @@
#include "toolhelp.h"
#include "stddebug.h"
#include "debug.h"
+#include "heap.h"
/* FIXME: to make this working, we have to callback all these registered
* functions from all over the WINE code. Someone with more knowledge than
@@ -37,15 +38,16 @@
dprintf_toolhelp( stddeb, "NotifyRegister(%x,%lx,%x) called.\n",
htask, (DWORD)lpfnCallback, wFlags );
+ if (!htask) htask = GetCurrentTask();
for (i=0;i<nrofnotifys;i++)
if (notifys[i].htask==htask)
break;
if (i==nrofnotifys) {
if (notifys==NULL)
- notifys=(struct notify*)HeapAlloc( GetProcessHeap(), 0,
+ notifys=(struct notify*)HeapAlloc( SystemHeap, 0,
sizeof(struct notify) );
else
- notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
+ notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
sizeof(struct notify)*(nrofnotifys+1));
if (!notifys) return FALSE;
nrofnotifys++;
@@ -61,13 +63,14 @@
int i;
dprintf_toolhelp( stddeb, "NotifyUnregister(%x) called.\n", htask );
+ if (!htask) htask = GetCurrentTask();
for (i=nrofnotifys;i--;)
if (notifys[i].htask==htask)
break;
if (i==-1)
return FALSE;
memcpy(notifys+i,notifys+(i+1),sizeof(struct notify)*(nrofnotifys-i-1));
- notifys=(struct notify*)HeapReAlloc( GetProcessHeap(), 0, notifys,
+ notifys=(struct notify*)HeapReAlloc( SystemHeap, 0, notifys,
(nrofnotifys-1)*sizeof(struct notify));
nrofnotifys--;
return TRUE;
diff --git a/misc/ver.c b/misc/ver.c
index c19e5f3..c548da7 100644
--- a/misc/ver.c
+++ b/misc/ver.c
@@ -36,7 +36,7 @@
* This function will print via dprintf_ver to stddeb the prologue string,
* followed by the address of teststring and the string it contains if
* teststring is non-null or "(null)" otherwise, and then the epilogue
- * string.
+ * string followed by a new line.
*
* Revision history
* 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu)
@@ -44,6 +44,9 @@
* 05-Jul-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Fixed problem that caused bug with tools/make_debug -- renaming
* this function should fix the problem.
+ * 15-Feb-1998 Dimitrie Paun (dimi@cs.toronto.edu)
+ * Modified it to make it print the message using only one
+ * dprintf_ver call.
*
*****************************************************************************/
@@ -52,17 +55,131 @@
char const * teststring,
char const * epilogue )
{
- dprintf_ver(stddeb, "%s", prologue);
-
- if(teststring)
- dprintf_ver(stddeb, "%p (\"%s\")", (void const *) teststring,
- teststring);
- else
- dprintf_ver(stddeb, "(null)");
+ dprintf_ver(stddeb, "%s %p (\"%s\") %s\n", prologue,
+ (void const *) teststring,
+ teststring ? teststring : "(null)",
+ epilogue);
+}
- dprintf_ver(stddeb, "%s", epilogue);
+/******************************************************************************
+ *
+ * This function will print via dprintf_ver to stddeb debug info regarding
+ * the file info structure vffi.
+ * 15-Feb-1998 Dimitrie Paun (dimi@cs.toronto.edu)
+ * Added this function to clean up the code.
+ *
+ *****************************************************************************/
+static void print_vffi_debug(VS_FIXEDFILEINFO *vffi)
+{
+ char buff[1024];
+ char *p;
- return;
+ dprintf_ver(stddeb," structversion=0x%lx.0x%lx, fileversion=0x%lx.0x%lx, productversion=0x%lx.0x%lx, flagmask=0x%lx, flags=%s%s%s%s%s%s\n",
+ (vffi->dwStrucVersion>>16),vffi->dwStrucVersion&0xFFFF,
+ vffi->dwFileVersionMS,vffi->dwFileVersionLS,
+ vffi->dwProductVersionMS,vffi->dwProductVersionLS,
+ vffi->dwFileFlagsMask,
+ (vffi->dwFileFlags & VS_FF_DEBUG) ? "DEBUG," : "",
+ (vffi->dwFileFlags & VS_FF_PRERELEASE) ? "PRERELEASE," : "",
+ (vffi->dwFileFlags & VS_FF_PATCHED) ? "PATCHED," : "",
+ (vffi->dwFileFlags & VS_FF_PRIVATEBUILD) ? "PRIVATEBUILD," : "",
+ (vffi->dwFileFlags & VS_FF_INFOINFERRED) ? "INFOINFERRED," : "",
+ (vffi->dwFileFlags & VS_FF_SPECIALBUILD) ? "SPECIALBUILD," : ""
+ );
+
+ p = buff;
+ p+=sprintf(p," OS=0x%lx.0x%lx (",
+ (vffi->dwFileOS&0xFFFF0000)>>16,
+ vffi->dwFileOS&0x0000FFFF
+ );
+ switch (vffi->dwFileOS&0xFFFF0000) {
+ case VOS_DOS:p+=sprintf(p,"DOS,");break;
+ case VOS_OS216:p+=sprintf(p,"OS/2-16,");break;
+ case VOS_OS232:p+=sprintf(p,"OS/2-32,");break;
+ case VOS_NT:p+=sprintf(p,"NT,");break;
+ case VOS_UNKNOWN:
+ default:
+ p+=sprintf(p,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
+ }
+ switch (vffi->dwFileOS & 0xFFFF) {
+ case VOS__BASE:p+=sprintf(p,"BASE");break;
+ case VOS__WINDOWS16:p+=sprintf(p,"WIN16");break;
+ case VOS__WINDOWS32:p+=sprintf(p,"WIN32");break;
+ case VOS__PM16:p+=sprintf(p,"PM16");break;
+ case VOS__PM32:p+=sprintf(p,"PM32");break;
+ default:p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileOS&0xFFFF);break;
+ }
+ p+=sprintf(p,")");
+ dprintf_ver(stddeb, "%s\n", buff);
+
+ p = buff;
+ switch (vffi->dwFileType) {
+ default:
+ case VFT_UNKNOWN:
+ p+=sprintf(p,"filetype=Unknown(0x%lx)",vffi->dwFileType);
+ break;
+ case VFT_APP:p+=sprintf(p,"filetype=APP,");break;
+ case VFT_DLL:p+=sprintf(p,"filetype=DLL,");break;
+ case VFT_DRV:
+ p+=sprintf(p,"filetype=DRV,");
+ switch(vffi->dwFileSubtype) {
+ default:
+ case VFT2_UNKNOWN:
+ p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
+ break;
+ case VFT2_DRV_PRINTER:
+ p+=sprintf(p,"PRINTER");
+ break;
+ case VFT2_DRV_KEYBOARD:
+ p+=sprintf(p,"KEYBOARD");
+ break;
+ case VFT2_DRV_LANGUAGE:
+ p+=sprintf(p,"LANGUAGE");
+ break;
+ case VFT2_DRV_DISPLAY:
+ p+=sprintf(p,"DISPLAY");
+ break;
+ case VFT2_DRV_MOUSE:
+ p+=sprintf(p,"MOUSE");
+ break;
+ case VFT2_DRV_NETWORK:
+ p+=sprintf(p,"NETWORK");
+ break;
+ case VFT2_DRV_SYSTEM:
+ p+=sprintf(p,"SYSTEM");
+ break;
+ case VFT2_DRV_INSTALLABLE:
+ p+=sprintf(p,"INSTALLABLE");
+ break;
+ case VFT2_DRV_SOUND:
+ p+=sprintf(p,"SOUND");
+ break;
+ case VFT2_DRV_COMM:
+ p+=sprintf(p,"COMM");
+ break;
+ case VFT2_DRV_INPUTMETHOD:
+ p+=sprintf(p,"INPUTMETHOD");
+ break;
+ }
+ break;
+ case VFT_FONT:
+ p+=sprintf(p,"filetype=FONT.");
+ switch (vffi->dwFileSubtype) {
+ default:
+ p+=sprintf(p,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
+ break;
+ case VFT2_FONT_RASTER:p+=sprintf(p,"RASTER");break;
+ case VFT2_FONT_VECTOR:p+=sprintf(p,"VECTOR");break;
+ case VFT2_FONT_TRUETYPE:p+=sprintf(p,"TRUETYPE");break;
+ }
+ break;
+ case VFT_VXD:p+=sprintf(p,"filetype=VXD");break;
+ case VFT_STATIC_LIB:p+=sprintf(p,"filetype=STATIC_LIB");break;
+ }
+ dprintf_ver(stddeb, "%s\n", buff);
+
+ dprintf_ver(stddeb, " filedata=0x%lx.0x%lx\n",
+ vffi->dwFileDateMS,vffi->dwFileDateLS);
}
/******************************************************************************
@@ -515,110 +632,10 @@
}
if (*(WORD*)buf < len)
len = *(WORD*)buf;
- dprintf_ver(stddeb," structversion=0x%lx.0x%lx,\n fileversion=0x%lx.0x%lx,\n productversion=0x%lx.0x%lx,\n flagmask=0x%lx,\n flags=",
- (vffi->dwStrucVersion>>16),vffi->dwStrucVersion&0xFFFF,
- vffi->dwFileVersionMS,vffi->dwFileVersionLS,
- vffi->dwProductVersionMS,vffi->dwProductVersionLS,
- vffi->dwFileFlagsMask
- );
- if (vffi->dwFileFlags & VS_FF_DEBUG)
- dprintf_ver(stddeb,"DEBUG,");
- if (vffi->dwFileFlags & VS_FF_PRERELEASE)
- dprintf_ver(stddeb,"PRERELEASE,");
- if (vffi->dwFileFlags & VS_FF_PATCHED)
- dprintf_ver(stddeb,"PATCHED,");
- if (vffi->dwFileFlags & VS_FF_PRIVATEBUILD)
- dprintf_ver(stddeb,"PRIVATEBUILD,");
- if (vffi->dwFileFlags & VS_FF_INFOINFERRED)
- dprintf_ver(stddeb,"INFOINFERRED,");
- if (vffi->dwFileFlags & VS_FF_SPECIALBUILD)
- dprintf_ver(stddeb,"SPECIALBUILD,");
- dprintf_ver(stddeb,"\n OS=0x%lx.0x%lx (",
- (vffi->dwFileOS&0xFFFF0000)>>16,
- vffi->dwFileOS&0x0000FFFF
- );
- switch (vffi->dwFileOS&0xFFFF0000) {
- case VOS_DOS:dprintf_ver(stddeb,"DOS,");break;
- case VOS_OS216:dprintf_ver(stddeb,"OS/2-16,");break;
- case VOS_OS232:dprintf_ver(stddeb,"OS/2-32,");break;
- case VOS_NT:dprintf_ver(stddeb,"NT,");break;
- case VOS_UNKNOWN:
- default:
- dprintf_ver(stddeb,"UNKNOWN(0x%lx),",vffi->dwFileOS&0xFFFF0000);break;
- }
- switch (vffi->dwFileOS & 0xFFFF) {
- case VOS__BASE:dprintf_ver(stddeb,"BASE");break;
- case VOS__WINDOWS16:dprintf_ver(stddeb,"WIN16");break;
- case VOS__WINDOWS32:dprintf_ver(stddeb,"WIN32");break;
- case VOS__PM16:dprintf_ver(stddeb,"PM16");break;
- case VOS__PM32:dprintf_ver(stddeb,"PM32");break;
- default:dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileOS&0xFFFF);break;
- }
- dprintf_ver(stddeb,")\n ");
- switch (vffi->dwFileType) {
- default:
- case VFT_UNKNOWN:
- dprintf_ver(stddeb,"filetype=Unknown(0x%lx)",vffi->dwFileType);
- break;
- case VFT_APP:dprintf_ver(stddeb,"filetype=APP,");break;
- case VFT_DLL:dprintf_ver(stddeb,"filetype=DLL,");break;
- case VFT_DRV:
- dprintf_ver(stddeb,"filetype=DRV,");
- switch(vffi->dwFileSubtype) {
- default:
- case VFT2_UNKNOWN:
- dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
- break;
- case VFT2_DRV_PRINTER:
- dprintf_ver(stddeb,"PRINTER");
- break;
- case VFT2_DRV_KEYBOARD:
- dprintf_ver(stddeb,"KEYBOARD");
- break;
- case VFT2_DRV_LANGUAGE:
- dprintf_ver(stddeb,"LANGUAGE");
- break;
- case VFT2_DRV_DISPLAY:
- dprintf_ver(stddeb,"DISPLAY");
- break;
- case VFT2_DRV_MOUSE:
- dprintf_ver(stddeb,"MOUSE");
- break;
- case VFT2_DRV_NETWORK:
- dprintf_ver(stddeb,"NETWORK");
- break;
- case VFT2_DRV_SYSTEM:
- dprintf_ver(stddeb,"SYSTEM");
- break;
- case VFT2_DRV_INSTALLABLE:
- dprintf_ver(stddeb,"INSTALLABLE");
- break;
- case VFT2_DRV_SOUND:
- dprintf_ver(stddeb,"SOUND");
- break;
- case VFT2_DRV_COMM:
- dprintf_ver(stddeb,"COMM");
- break;
- case VFT2_DRV_INPUTMETHOD:
- dprintf_ver(stddeb,"INPUTMETHOD");
- break;
- }
- break;
- case VFT_FONT:
- dprintf_ver(stddeb,"filetype=FONT.");
- switch (vffi->dwFileSubtype) {
- default:
- dprintf_ver(stddeb,"UNKNOWN(0x%lx)",vffi->dwFileSubtype);
- break;
- case VFT2_FONT_RASTER:dprintf_ver(stddeb,"RASTER");break;
- case VFT2_FONT_VECTOR:dprintf_ver(stddeb,"VECTOR");break;
- case VFT2_FONT_TRUETYPE:dprintf_ver(stddeb,"TRUETYPE");break;
- }
- break;
- case VFT_VXD:dprintf_ver(stddeb,"filetype=VXD");break;
- case VFT_STATIC_LIB:dprintf_ver(stddeb,"filetype=STATIC_LIB");break;
- }
- dprintf_ver(stddeb,"\n filedata=0x%lx.0x%lx\n",vffi->dwFileDateMS,vffi->dwFileDateLS);
+
+ if(debugging_ver)
+ print_vffi_debug(vffi);
+
return len;
}
@@ -706,9 +723,9 @@
else
dprintf_ver(stddeb, "\n");
- ver_dstring("\tlpszFilename = ", lpszFilename, "\n");
- ver_dstring("\tlpszWinDir = ", lpszWinDir, "\n");
- ver_dstring("\tlpszAppDir = ", lpszAppDir, "\n");
+ ver_dstring("\tlpszFilename = ", lpszFilename, "");
+ ver_dstring("\tlpszWinDir = ", lpszWinDir, "");
+ ver_dstring("\tlpszAppDir = ", lpszAppDir, "");
dprintf_ver(stddeb, "\tlpszCurDir = %p\n", lpszCurDir);
if(lpuCurDirLen)
@@ -807,30 +824,19 @@
*lpuCurDirLen = curDirSizeReq;
}
- dprintf_ver(stddeb, "VerFindFile() ret = %lu ",
- retval);
+ dprintf_ver(stddeb, "VerFindFile() ret = %lu (%s%s%s)\n", retval,
+ (retval & VFF_CURNEDEST) ? "VFF_CURNEDEST " : "",
+ (retval & VFF_FILEINUSE) ? "VFF_FILEINUSE " : "",
+ (retval & VFF_BUFFTOOSMALL) ? "VFF_BUFFTOOSMALL " : "");
- if(retval) {
- dprintf_ver(stddeb, "( ");
-
- if(retval & VFF_CURNEDEST)
- dprintf_ver(stddeb, "VFF_CURNEDEST ");
- if(retval & VFF_FILEINUSE)
- dprintf_ver(stddeb, "VFF_FILEINUSE ");
- if(retval & VFF_BUFFTOOSMALL)
- dprintf_ver(stddeb, "VFF_BUFFTOOSMALL ");
-
- dprintf_ver(stddeb, ")");
- }
-
- ver_dstring("\n\t(Exit) lpszCurDir = ", lpszCurDir, "\n");
+ ver_dstring("\t(Exit) lpszCurDir = ", lpszCurDir, "");
if(lpuCurDirLen)
dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = %p (%u)\n",
lpuCurDirLen, *lpuCurDirLen);
else
dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = (null)\n");
- ver_dstring("\t(Exit) lpszDestDir = ", lpszDestDir, "\n");
+ ver_dstring("\t(Exit) lpszDestDir = ", lpszDestDir, "");
if(lpuDestDirLen)
dprintf_ver(stddeb, "\t(Exit) lpuDestDirLen = %p (%u)\n",
lpuDestDirLen, *lpuDestDirLen);
diff --git a/misc/version.c b/misc/version.c
index c07d013..b694a78 100644
--- a/misc/version.c
+++ b/misc/version.c
@@ -6,6 +6,7 @@
*/
#include <stdio.h>
+#include <string.h>
#include "windows.h"
#include "winbase.h"
#include "process.h"
diff --git a/misc/w32scomb.c b/misc/w32scomb.c
index 3005fae..4d77ce8 100644
--- a/misc/w32scomb.c
+++ b/misc/w32scomb.c
@@ -22,15 +22,20 @@
* A 16:16 segmented pointer to the function is returned.
* Written without any docu.
*/
-FARPROC16 WINAPI Get16DLLAddress(HMODULE32 handle, LPSTR func_name) {
- if ( (strcasecmp(func_name, "StackLinearToSegmented"))
- && (strcasecmp(func_name, "CoThkCommon")) ) {
- fprintf(stderr, "Get16DLLAddress() called for function %s(). Please report to Andreas Mohr.\n", func_name);
- }
- if (!handle) {
- handle = (HMODULE32)LoadLibrary16("WIN32S16");
- FreeLibrary16(handle);
- }
- return WIN32_GetProcAddress16(handle,func_name);
-}
+SEGPTR WINAPI Get16DLLAddress(HMODULE32 handle, LPSTR func_name) {
+ HANDLE32 ThunkHeap = HeapCreate(HEAP_WINE_SEGPTR | HEAP_WINE_CODESEG, 0, 64);
+ LPBYTE x;
+ LPVOID tmpheap = HeapAlloc(ThunkHeap, 0, 32);
+ SEGPTR thunk = HEAP_GetSegptr(ThunkHeap, 0, tmpheap);
+ DWORD proc_16;
+ WORD cs;
+ if (!handle) handle=GetModuleHandle16("WIN32S16");
+ proc_16 = (DWORD)WIN32_GetProcAddress16(handle, func_name);
+
+ x=PTR_SEG_TO_LIN(thunk);
+ *x++=0xba; *(DWORD*)x=proc_16;x+=4; /* movl proc_16, $edx */
+ *x++=0xea; *(DWORD*)x=(DWORD)GetProcAddress32(GetModuleHandle32A("KERNEL32"),"QT_Thunk");x+=4; /* jmpl QT_Thunk */
+ GET_CS(cs); *(WORD*)x=(WORD)cs;
+ return thunk;
+}
diff --git a/misc/win32s16.c b/misc/win32s16.c
index ecf61b0..d602aef 100644
--- a/misc/win32s16.c
+++ b/misc/win32s16.c
@@ -20,7 +20,7 @@
*
* Written without any docu.
*/
-SEGPTR WINAPI StackLinearToSegmented()
+SEGPTR WINAPI StackLinearToSegmented(WORD w1, WORD w2)
{
fprintf(stderr, "StackLinearToSegmented(), stub !\n");
return (SEGPTR)NULL;
diff --git a/misc/winsock.c b/misc/winsock.c
index ff3dba3..835151d 100644
--- a/misc/winsock.c
+++ b/misc/winsock.c
@@ -396,8 +396,6 @@
if( --pwsi->num_startup > 0 ) return 0;
SIGNAL_MaskAsyncEvents( TRUE );
- if( pTask )
- pTask->pwsi = NULL;
WINSOCK_cancel_task_aops( pTask->hSelf, __ws_memfree );
SIGNAL_MaskAsyncEvents( FALSE );
@@ -439,6 +437,8 @@
if( pwsi->buffer ) SEGPTR_FREE(pwsi->buffer);
if( pwsi->dbuffer ) SEGPTR_FREE(pwsi->dbuffer);
+ if( pTask )
+ pTask->pwsi = NULL;
memset( pwsi, 0, sizeof(WSINFO) );
WS_FREE(pwsi);
return 0;
diff --git a/miscemu/main.c b/miscemu/main.c
index 6ac2cc8..6110790 100644
--- a/miscemu/main.c
+++ b/miscemu/main.c
@@ -44,6 +44,7 @@
*/
int main( int argc, char *argv[] )
{
+ extern BOOL32 PROCESS_Init(void);
extern BOOL32 MAIN_WineInit( int *argc, char *argv[] );
extern void *CALL32_Init(void);
extern char * DEBUG_argv0;
@@ -59,6 +60,10 @@
*/
DEBUG_argv0 = argv[0];
+ /* Create the initial process */
+ if (!PROCESS_Init()) return FALSE;
+
+ /* Parse command-line */
if (!MAIN_WineInit( &argc, argv )) return 1;
/* Handle -dll option (hack) */
diff --git a/msdos/dpmi.c b/msdos/dpmi.c
index 0352d01..907f081 100644
--- a/msdos/dpmi.c
+++ b/msdos/dpmi.c
@@ -518,6 +518,20 @@
case 0x0703: /* Discard page contents */
break; /* Just ignore it */
+ case 0x0800: /* Physical address mapping */
+ if(!(ptr=DOSMEM_MapRealToLinear(MAKELONG(CX_reg(context),BX_reg(context)))))
+ {
+ AX_reg(context) = 0x8021;
+ SET_CFLAG(context);
+ }
+ else
+ {
+ BX_reg(context) = HIWORD(ptr);
+ CX_reg(context) = LOWORD(ptr);
+ RESET_CFLAG(context);
+ }
+ break;
+
default:
INT_BARF( context, 0x31 );
AX_reg(context) = 0x8001; /* unsupported function */
diff --git a/multimedia/dsound.c b/multimedia/dsound.c
index 118a97e..e931f78 100644
--- a/multimedia/dsound.c
+++ b/multimedia/dsound.c
@@ -159,14 +159,13 @@
) {
memcpy(&(this->wfx),wfex,sizeof(this->wfx));
- dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->SetFormat(%p),stub!\n",this,wfex);
- dprintf_dsound(stderr," [formattag=0x%04x,",wfex->wFormatTag);
- dprintf_dsound(stderr,"chans=%d,",wfex->nChannels);
- dprintf_dsound(stderr,"samplerate=%ld,",wfex->nSamplesPerSec);
- dprintf_dsound(stderr,"bytespersec=%ld,",wfex->nAvgBytesPerSec);
- dprintf_dsound(stderr,"blockalign=%d,",wfex->nBlockAlign);
- dprintf_dsound(stderr,"bitspersamp=%d,",wfex->wBitsPerSample);
- dprintf_dsound(stderr,"cbSize=%d]\n",wfex->cbSize);
+ dprintf_dsound(stderr,"IDirectSoundBuffer(%p)->SetFormat(%p),stub!\n",
+ this,wfex);
+ dprintf_dsound(stderr," [formattag=0x%04x,chans=%d,samplerate=%ld"
+ "bytespersec=%ld,blockalign=%d,bitspersamp=%d,cbSize=%d]\n",
+ wfex->wFormatTag, wfex->nChannels, wfex->nSamplesPerSec,
+ wfex->nAvgBytesPerSec, wfex->nBlockAlign,
+ wfex->wBitsPerSample, wfex->cbSize);
return 0;
}
diff --git a/multimedia/joystick.c b/multimedia/joystick.c
index a1580b3..15dd0fa 100644
--- a/multimedia/joystick.c
+++ b/multimedia/joystick.c
@@ -293,7 +293,7 @@
{
struct js_status js;
- dprintf_mmsys(stderr, "JoyGetPos(%04X, %p):", wID, lpInfo);
+ dprintf_mmsys(stderr, "JoyGetPos(%04X, %p)\n", wID, lpInfo);
if (joyOpenDriver(wID) == FALSE) return MMSYSERR_NODRIVER;
dev_stat = read(joy_dev[wID], &js, sizeof(js));
if (dev_stat != sizeof(js)) {
@@ -307,7 +307,7 @@
lpInfo->wYpos = js.y;
lpInfo->wZpos = 0; /* FIXME: Don't know what to do with this value as joystick driver doesn't provide a Z value */
lpInfo->wButtons = js.buttons;
- dprintf_mmsys(stderr, "x: %d, y: %d, buttons: %d\n", js.x, js.y, js.buttons);
+ dprintf_mmsys(stderr, "JoyGetPos: x: %d, y: %d, buttons: %d\n", js.x, js.y, js.buttons);
return JOYERR_NOERROR;
}
diff --git a/objects/bitmap.c b/objects/bitmap.c
index fc59250..7d8a36d 100644
--- a/objects/bitmap.c
+++ b/objects/bitmap.c
@@ -42,7 +42,7 @@
static int XPutImage_wrapper( const struct XPutImage_descr *descr )
{
- return TSXPutImage( display, descr->bmp->pixmap, BITMAP_GC(descr->bmp),
+ return XPutImage( display, descr->bmp->pixmap, BITMAP_GC(descr->bmp),
descr->image, 0, 0, 0, 0, descr->width, descr->height );
}
@@ -235,7 +235,7 @@
*/
XImage *BITMAP_GetXImage( const BITMAPOBJ *bmp )
{
- return TSXGetImage( display, bmp->pixmap, 0, 0, bmp->bitmap.bmWidth,
+ return XGetImage( display, bmp->pixmap, 0, 0, bmp->bitmap.bmWidth,
bmp->bitmap.bmHeight, AllPlanes, ZPixmap );
}
@@ -284,6 +284,8 @@
return 0;
}
+ EnterCriticalSection( &X11DRV_CritSection );
+
/* Hack: change the bitmap height temporarily to avoid */
/* getting unnecessary bitmap rows. */
old_height = bmp->bitmap.bmHeight;
@@ -304,7 +306,7 @@
{
if ((w%8) == 0)
*tbuf = 0;
- *tbuf |= TSXGetPixel(image,w,h)<<(7-(w&7));
+ *tbuf |= XGetPixel(image,w,h)<<(7-(w&7));
if ((w&7) == 7) ++tbuf;
}
tbuf += pad;
@@ -315,8 +317,8 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- if (!(w & 1)) *tbuf = TSXGetPixel( image, w, h) << 4;
- else *tbuf++ |= TSXGetPixel( image, w, h) & 0x0f;
+ if (!(w & 1)) *tbuf = XGetPixel( image, w, h) << 4;
+ else *tbuf++ |= XGetPixel( image, w, h) & 0x0f;
}
tbuf += pad;
}
@@ -325,7 +327,7 @@
for (h=0;h<height;h++)
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
- *tbuf++ = TSXGetPixel(image,w,h);
+ *tbuf++ = XGetPixel(image,w,h);
tbuf += pad;
}
break;
@@ -335,7 +337,7 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- long pixel = TSXGetPixel(image,w,h);
+ long pixel = XGetPixel(image,w,h);
*tbuf++ = pixel & 0xff;
*tbuf++ = (pixel>>8) & 0xff;
@@ -347,7 +349,7 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- long pixel = TSXGetPixel(image,w,h);
+ long pixel = XGetPixel(image,w,h);
*tbuf++ = pixel & 0xff;
*tbuf++ = (pixel>> 8) & 0xff;
@@ -356,7 +358,9 @@
tbuf += pad;
}
}
- TSXDestroyImage( image );
+ XDestroyImage( image );
+ LeaveCriticalSection( &X11DRV_CritSection );
+
GDI_HEAP_UNLOCK( hbitmap );
return height * bmp->bitmap.bmWidthBytes;
}
@@ -411,10 +415,11 @@
widthbytes = DIB_GetXImageWidthBytes(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
tmpbuffer = (LPBYTE)xmalloc(widthbytes*height);
- image = TSXCreateImage( display, DefaultVisualOfScreen(screen),
- bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,
- bmp->bitmap.bmWidth,height,32,widthbytes
- );
+
+ EnterCriticalSection( &X11DRV_CritSection );
+ image = XCreateImage( display, DefaultVisualOfScreen(screen),
+ bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,
+ bmp->bitmap.bmWidth,height,32,widthbytes );
/* copy 16 bit padded image buffer with real bitsperpixel to XImage */
sbuf = (LPBYTE)buffer;
@@ -425,7 +430,7 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- TSXPutPixel(image,w,h,(sbuf[0]>>(7-(w&7))) & 1);
+ XPutPixel(image,w,h,(sbuf[0]>>(7-(w&7))) & 1);
if ((w&7) == 7)
sbuf++;
}
@@ -437,8 +442,8 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- if (!(w & 1)) TSXPutPixel( image, w, h, *sbuf >> 4 );
- else TSXPutPixel( image, w, h, *sbuf++ & 0xf );
+ if (!(w & 1)) XPutPixel( image, w, h, *sbuf >> 4 );
+ else XPutPixel( image, w, h, *sbuf++ & 0xf );
}
sbuf += pad;
}
@@ -447,7 +452,7 @@
for (h=0;h<height;h++)
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
- TSXPutPixel(image,w,h,*sbuf++);
+ XPutPixel(image,w,h,*sbuf++);
sbuf += pad;
}
break;
@@ -457,7 +462,7 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- TSXPutPixel(image,w,h,sbuf[1]*256+sbuf[0]);
+ XPutPixel(image,w,h,sbuf[1]*256+sbuf[0]);
sbuf+=2;
}
}
@@ -467,7 +472,7 @@
{
for (w=0;w<bmp->bitmap.bmWidth;w++)
{
- TSXPutPixel(image,w,h,(sbuf[2]<<16)+(sbuf[1]<<8)+sbuf[0]);
+ XPutPixel(image,w,h,(sbuf[2]<<16)+(sbuf[1]<<8)+sbuf[0]);
sbuf += 3;
}
sbuf += pad;
@@ -480,8 +485,9 @@
descr.width = bmp->bitmap.bmWidth;
descr.height = height;
CALL_LARGE_STACK( XPutImage_wrapper, &descr );
-
- TSXDestroyImage( image ); /* frees tmpbuffer too */
+ XDestroyImage( image ); /* frees tmpbuffer too */
+ LeaveCriticalSection( &X11DRV_CritSection );
+
GDI_HEAP_UNLOCK( hbitmap );
return height * bmp->bitmap.bmWidthBytes;
}
diff --git a/objects/cursoricon.c b/objects/cursoricon.c
index e2a183a..888e95e 100644
--- a/objects/cursoricon.c
+++ b/objects/cursoricon.c
@@ -969,6 +969,7 @@
* CURSORICON_SetCursor
*
* Change the X cursor. Helper function for SetCursor() and ShowCursor().
+ * The Xlib critical section must be entered before calling this function.
*/
static BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
{
@@ -981,12 +982,12 @@
static const char data[] = { 0 };
bg.red = bg.green = bg.blue = 0x0000;
- pixmapBits = TSXCreateBitmapFromData( display, rootWindow, data, 1, 1 );
+ pixmapBits = XCreateBitmapFromData( display, rootWindow, data, 1, 1 );
if (pixmapBits)
{
- cursor = TSXCreatePixmapCursor( display, pixmapBits, pixmapBits,
+ cursor = XCreatePixmapCursor( display, pixmapBits, pixmapBits,
&bg, &bg, 0, 0 );
- TSXFreePixmap( display, pixmapBits );
+ XFreePixmap( display, pixmapBits );
}
}
else /* Create the X cursor from the bits */
@@ -1008,9 +1009,9 @@
* as the Windows cursor data). Perhaps use a more generic
* algorithm here.
*/
- pixmapAll = TSXCreatePixmap( display, rootWindow,
+ pixmapAll = XCreatePixmap( display, rootWindow,
ptr->nWidth, ptr->nHeight * 2, 1 );
- image = TSXCreateImage( display, DefaultVisualOfScreen(screen),
+ image = XCreateImage( display, DefaultVisualOfScreen(screen),
1, ZPixmap, 0, (char *)(ptr + 1), ptr->nWidth,
ptr->nHeight * 2, 16, ptr->nWidthBytes);
if (image)
@@ -1018,19 +1019,19 @@
image->byte_order = MSBFirst;
image->bitmap_bit_order = MSBFirst;
image->bitmap_unit = 16;
- TS_XInitImageFuncPtrs(image);
+ _XInitImageFuncPtrs(image);
if (pixmapAll)
- TSXPutImage( display, pixmapAll, BITMAP_monoGC, image,
+ XPutImage( display, pixmapAll, BITMAP_monoGC, image,
0, 0, 0, 0, ptr->nWidth, ptr->nHeight * 2 );
image->data = NULL;
- TSXDestroyImage( image );
+ XDestroyImage( image );
}
/* Now create the 2 pixmaps for bits and mask */
- pixmapBits = TSXCreatePixmap( display, rootWindow,
+ pixmapBits = XCreatePixmap( display, rootWindow,
ptr->nWidth, ptr->nHeight, 1 );
- pixmapMask = TSXCreatePixmap( display, rootWindow,
+ pixmapMask = XCreatePixmap( display, rootWindow,
ptr->nWidth, ptr->nHeight, 1 );
/* Make sure everything went OK so far */
@@ -1059,39 +1060,39 @@
* I don't know if it's correct per the X spec, but maybe
* we ought to take advantage of it. -- AJ
*/
- TSXCopyArea( display, pixmapAll, pixmapBits, BITMAP_monoGC,
+ XCopyArea( display, pixmapAll, pixmapBits, BITMAP_monoGC,
0, 0, ptr->nWidth, ptr->nHeight, 0, 0 );
- TSXCopyArea( display, pixmapAll, pixmapMask, BITMAP_monoGC,
+ XCopyArea( display, pixmapAll, pixmapMask, BITMAP_monoGC,
0, 0, ptr->nWidth, ptr->nHeight, 0, 0 );
- TSXSetFunction( display, BITMAP_monoGC, GXandReverse );
- TSXCopyArea( display, pixmapAll, pixmapBits, BITMAP_monoGC,
+ XSetFunction( display, BITMAP_monoGC, GXandReverse );
+ XCopyArea( display, pixmapAll, pixmapBits, BITMAP_monoGC,
0, ptr->nHeight, ptr->nWidth, ptr->nHeight, 0, 0 );
- TSXSetFunction( display, BITMAP_monoGC, GXorReverse );
- TSXCopyArea( display, pixmapAll, pixmapMask, BITMAP_monoGC,
+ XSetFunction( display, BITMAP_monoGC, GXorReverse );
+ XCopyArea( display, pixmapAll, pixmapMask, BITMAP_monoGC,
0, ptr->nHeight, ptr->nWidth, ptr->nHeight, 0, 0 );
- TSXSetFunction( display, BITMAP_monoGC, GXcopy );
+ XSetFunction( display, BITMAP_monoGC, GXcopy );
fg.red = fg.green = fg.blue = 0xffff;
bg.red = bg.green = bg.blue = 0x0000;
- cursor = TSXCreatePixmapCursor( display, pixmapBits, pixmapMask,
+ cursor = XCreatePixmapCursor( display, pixmapBits, pixmapMask,
&fg, &bg, ptr->ptHotSpot.x, ptr->ptHotSpot.y );
}
/* Now free everything */
- if (pixmapAll) TSXFreePixmap( display, pixmapAll );
- if (pixmapBits) TSXFreePixmap( display, pixmapBits );
- if (pixmapMask) TSXFreePixmap( display, pixmapMask );
+ if (pixmapAll) XFreePixmap( display, pixmapAll );
+ if (pixmapBits) XFreePixmap( display, pixmapBits );
+ if (pixmapMask) XFreePixmap( display, pixmapMask );
GlobalUnlock16( hCursor );
}
if (cursor == None) return FALSE;
- if (CURSORICON_XCursor != None) TSXFreeCursor( display, CURSORICON_XCursor );
+ if (CURSORICON_XCursor != None) XFreeCursor( display, CURSORICON_XCursor );
CURSORICON_XCursor = cursor;
if (rootWindow != DefaultRootWindow(display))
{
/* Set the cursor on the desktop window */
- TSXDefineCursor( display, rootWindow, cursor );
+ XDefineCursor( display, rootWindow, cursor );
}
else
{
@@ -1100,7 +1101,7 @@
while(hwnd)
{
Window win = WIN_GetXWindow( hwnd );
- if (win) TSXDefineCursor( display, win, cursor );
+ if (win) XDefineCursor( display, win, cursor );
hwnd = GetWindow32( hwnd, GW_HWNDNEXT );
}
}
@@ -1130,7 +1131,11 @@
hActiveCursor = hCursor;
/* Change the cursor shape only if it is visible */
if (CURSOR_ShowCount >= 0)
+ {
+ EnterCriticalSection( &X11DRV_CritSection );
CALL_LARGE_STACK( CURSORICON_SetCursor, hActiveCursor );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ }
return hOldCursor;
}
@@ -1172,6 +1177,7 @@
dprintf_cursor( stddeb, "ShowCursor: %d, count=%d\n",
bShow, CURSOR_ShowCount );
+ EnterCriticalSection( &X11DRV_CritSection );
if (bShow)
{
if (++CURSOR_ShowCount == 0) /* Show it */
@@ -1182,6 +1188,7 @@
if (--CURSOR_ShowCount == -1) /* Hide it */
CALL_LARGE_STACK( CURSORICON_SetCursor, 0 );
}
+ LeaveCriticalSection( &X11DRV_CritSection );
return CURSOR_ShowCount;
}
diff --git a/objects/dc.c b/objects/dc.c
index b2041ef..a0ccb3f 100644
--- a/objects/dc.c
+++ b/objects/dc.c
@@ -276,15 +276,17 @@
{
register int x, y;
XImage *image;
- pixmap = TSXCreatePixmap( display, rootWindow, 8, 8, screenDepth );
- image = TSXGetImage( display, dc->u.x.brush.pixmap, 0, 0, 8, 8,
+ EnterCriticalSection( &X11DRV_CritSection );
+ pixmap = XCreatePixmap( display, rootWindow, 8, 8, screenDepth );
+ image = XGetImage( display, dc->u.x.brush.pixmap, 0, 0, 8, 8,
AllPlanes, ZPixmap );
for (y = 0; y < 8; y++)
for (x = 0; x < 8; x++)
- TSXPutPixel( image, x, y,
- COLOR_PixelToPalette[TSXGetPixel( image, x, y)] );
- TSXPutImage( display, pixmap, gc, image, 0, 0, 0, 0, 8, 8 );
- TSXDestroyImage( image );
+ XPutPixel( image, x, y,
+ COLOR_PixelToPalette[XGetPixel( image, x, y)] );
+ XPutImage( display, pixmap, gc, image, 0, 0, 0, 0, 8, 8 );
+ XDestroyImage( image );
+ LeaveCriticalSection( &X11DRV_CritSection );
val.tile = pixmap;
}
else val.tile = dc->u.x.brush.pixmap;
diff --git a/objects/dib.c b/objects/dib.c
index f802f14..c4227ef 100644
--- a/objects/dib.c
+++ b/objects/dib.c
@@ -252,25 +252,25 @@
for (i = dstwidth/8, x = left&~7; (i > 0); i--)
{
pix = *bits++;
- TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 6) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 5) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 4) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 3) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 2) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[(pix >> 1) & 1] );
- TSXPutPixel( bmpImage, x++, h, colors[pix & 1] );
+ XPutPixel( bmpImage, x++, h, colors[pix >> 7] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 6) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 5) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 4) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 3) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 2) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[(pix >> 1) & 1] );
+ XPutPixel( bmpImage, x++, h, colors[pix & 1] );
}
pix = *bits;
switch(dstwidth & 7)
{
- case 7: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 6: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 5: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 4: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 3: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 2: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
- case 1: TSXPutPixel( bmpImage, x++, h, colors[pix >> 7] );
+ case 7: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 6: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 5: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 4: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 3: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 2: XPutPixel( bmpImage, x++, h, colors[pix >> 7] ); pix <<= 1;
+ case 1: XPutPixel( bmpImage, x++, h, colors[pix >> 7] );
}
}
@@ -326,10 +326,10 @@
for (h = lines-1; h >= 0; h--) {
for (i = dstwidth/2, x = left&~1; i > 0; i--) {
BYTE pix = *bits++;
- TSXPutPixel( bmpImage, x++, h, colors[pix >> 4] );
- TSXPutPixel( bmpImage, x++, h, colors[pix & 0x0f] );
+ XPutPixel( bmpImage, x++, h, colors[pix >> 4] );
+ XPutPixel( bmpImage, x++, h, colors[pix & 0x0f] );
}
- if (dstwidth & 1) TSXPutPixel( bmpImage, x, h, colors[*bits >> 4] );
+ if (dstwidth & 1) XPutPixel( bmpImage, x, h, colors[*bits >> 4] );
srcbits += linebytes;
bits = srcbits + (left >> 1);
}
@@ -338,10 +338,10 @@
for (h = 0; h < lines; h++) {
for (i = dstwidth/2, x = left&~1; i > 0; i--) {
BYTE pix = *bits++;
- TSXPutPixel( bmpImage, x++, h, colors[pix >> 4] );
- TSXPutPixel( bmpImage, x++, h, colors[pix & 0x0f] );
+ XPutPixel( bmpImage, x++, h, colors[pix >> 4] );
+ XPutPixel( bmpImage, x++, h, colors[pix & 0x0f] );
}
- if (dstwidth & 1) TSXPutPixel( bmpImage, x, h, colors[*bits >> 4] );
+ if (dstwidth & 1) XPutPixel( bmpImage, x, h, colors[*bits >> 4] );
srcbits += linebytes;
bits = srcbits + (left >> 1);
}
@@ -375,11 +375,11 @@
if (length) { /* encoded */
c = *bits++;
while (length--) {
- TSXPutPixel(bmpImage, x++, lines, colors[c >> 4]);
+ XPutPixel(bmpImage, x++, lines, colors[c >> 4]);
check_xy(x, y);
if (length) {
length--;
- TSXPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
+ XPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
check_xy(x, y);
}
}
@@ -402,11 +402,11 @@
default: /* absolute */
while (length--) {
c = *bits++;
- TSXPutPixel(bmpImage, x++, lines, colors[c >> 4]);
+ XPutPixel(bmpImage, x++, lines, colors[c >> 4]);
check_xy(x, y);
if (length) {
length--;
- TSXPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
+ XPutPixel(bmpImage, x++, lines, colors[c & 0xf]);
check_xy(x, y);
}
}
@@ -438,7 +438,7 @@
if (lines > 0) {
for (h = lines - 1; h >= 0; h--) {
for (x = left; x < dstwidth; x++, bits++) {
- TSXPutPixel( bmpImage, x, h, colors[*bits] );
+ XPutPixel( bmpImage, x, h, colors[*bits] );
}
bits = (srcbits += linebytes) + left;
}
@@ -446,7 +446,7 @@
lines = -lines;
for (h = 0; h < lines; h++) {
for (x = left; x < dstwidth; x++, bits++) {
- TSXPutPixel( bmpImage, x, h, colors[*bits] );
+ XPutPixel( bmpImage, x, h, colors[*bits] );
}
bits = (srcbits += linebytes) + left;
}
@@ -530,7 +530,7 @@
color = colors[color_index];
while(length--)
- TSXPutPixel(bmpImage, x++, line, color);
+ XPutPixel(bmpImage, x++, line, color);
}
else
{
@@ -595,7 +595,7 @@
while(length--)
{
color_index = (*pIn++);
- TSXPutPixel(bmpImage, x++, line,
+ XPutPixel(bmpImage, x++, line,
colors[color_index]);
}
@@ -662,7 +662,7 @@
r = (BYTE) ((val & 0x7c00) >> 7);
g = (BYTE) ((val & 0x03e0) >> 2);
b = (BYTE) ((val & 0x001f) << 3);
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(r,g,b)) );
}
ptr = (LPWORD) (srcbits += linebytes) + left;
@@ -675,7 +675,7 @@
r = (BYTE) ((val & 0x7c00) >> 7);
g = (BYTE) ((val & 0x03e0) >> 2);
b = (BYTE) ((val & 0x001f) << 3);
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(r,g,b)) );
}
ptr = (LPWORD) (srcbits += linebytes) + left;
@@ -707,7 +707,7 @@
if (lines > 0) {
for (h = lines - 1; h >= 0; h--) {
for (x = left; x < dstwidth; x++, bits += 3) {
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(bits[2],bits[1],bits[0])));
}
bits = (srcbits += linebytes) + left * 3;
@@ -716,7 +716,7 @@
lines = -lines;
for (h = 0; h < lines; h++) {
for (x = left; x < dstwidth; x++, bits += 3) {
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(bits[2],bits[1],bits[0])));
}
bits = (srcbits += linebytes) + left * 3;
@@ -745,7 +745,7 @@
if (lines > 0) {
for (h = lines - 1; h >= 0; h--) {
for (x = left; x < dstwidth; x++, bits += 4) {
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(bits[2],bits[1],bits[0])));
}
bits = (srcbits += linebytes) + left * 4;
@@ -754,7 +754,7 @@
lines = -lines;
for (h = 0; h < lines; h++) {
for (x = left; x < dstwidth; x++, bits += 4) {
- TSXPutPixel( bmpImage, x, h,
+ XPutPixel( bmpImage, x, h,
COLOR_ToPhysical(dc, RGB(bits[2],bits[1],bits[0])));
}
bits = (srcbits += linebytes) + left * 4;
@@ -768,6 +768,7 @@
*
* Transfer the bits to an X image.
* Helper function for SetDIBits() and SetDIBitsToDevice().
+ * The Xlib critical section must be entered before calling this function.
*/
static int DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR *descr )
{
@@ -831,10 +832,10 @@
break;
}
if (colorMapping) HeapFree( GetProcessHeap(), 0, colorMapping );
- TSXPutImage( display, descr->drawable, descr->gc, bmpImage,
+ XPutImage( display, descr->drawable, descr->gc, bmpImage,
descr->xSrc, descr->ySrc, descr->xDest, descr->yDest,
descr->width, descr->height );
- TSXDestroyImage( bmpImage );
+ XDestroyImage( bmpImage );
return lines;
}
@@ -944,7 +945,10 @@
descr.width = bmp->bitmap.bmWidth;
descr.height = lines;
+ EnterCriticalSection( &X11DRV_CritSection );
result = CALL_LARGE_STACK( DIB_SetImageBits, &descr );
+ LeaveCriticalSection( &X11DRV_CritSection );
+
GDI_HEAP_UNLOCK( hdc );
GDI_HEAP_UNLOCK( hbitmap );
return result;
@@ -975,6 +979,7 @@
DIB_SETIMAGEBITS_DESCR descr;
DC * dc;
DWORD width, oldcy = cy;
+ INT32 result;
int height, tmpheight;
/* Check parameters */
@@ -1018,7 +1023,10 @@
descr.width = cx;
descr.height = cy;
- return CALL_LARGE_STACK( DIB_SetImageBits, &descr );
+ EnterCriticalSection( &X11DRV_CritSection );
+ result = CALL_LARGE_STACK( DIB_SetImageBits, &descr );
+ LeaveCriticalSection( &X11DRV_CritSection );
+ return result;
}
/***********************************************************************
@@ -1199,6 +1207,7 @@
xend = info->bmiHeader.biWidth;
}
+ EnterCriticalSection( &X11DRV_CritSection );
bmpImage = (XImage *)CALL_LARGE_STACK( BITMAP_GetXImage, bmp );
switch( info->bmiHeader.biBitCount )
@@ -1209,7 +1218,7 @@
for( y = yend - 1; (int)y >= (int)startscan; y-- )
{
for( x = 0; x < xend; x++ )
- *bbits++ = TSXGetPixel( bmpImage, x, y );
+ *bbits++ = XGetPixel( bmpImage, x, y );
bbits += pad;
}
break;
@@ -1220,7 +1229,7 @@
*bbits = 0;
for( x = 0; x < xend; x++ ) {
- *bbits |= TSXGetPixel( bmpImage, x, y)<<(7-(x&7));
+ *bbits |= XGetPixel( bmpImage, x, y)<<(7-(x&7));
if ((x&7)==7) {
bbits++;
*bbits=0;
@@ -1236,7 +1245,7 @@
*bbits = 0;
for( x = 0; x < xend; x++ ) {
- *bbits |= TSXGetPixel( bmpImage, x, y)<<(4*(1-(x&1)));
+ *bbits |= XGetPixel( bmpImage, x, y)<<(4*(1-(x&1)));
if ((x&1)==1) {
bbits++;
*bbits=0;
@@ -1252,7 +1261,7 @@
{
*bbits = 0;
for( x = 0; x < xend; x++ ) {
- unsigned long pixel=TSXGetPixel( bmpImage, x, y);
+ unsigned long pixel=XGetPixel( bmpImage, x, y);
*bbits++ = pixel & 0xff;
*bbits++ = (pixel >> 8) & 0xff;
}
@@ -1265,7 +1274,7 @@
{
*bbits = 0;
for( x = 0; x < xend; x++ ) {
- unsigned long pixel=TSXGetPixel( bmpImage, x, y);
+ unsigned long pixel=XGetPixel( bmpImage, x, y);
*bbits++ = (pixel >>16) & 0xff;
*bbits++ = (pixel >> 8) & 0xff;
*bbits++ = pixel & 0xff;
@@ -1278,7 +1287,7 @@
{
*bbits = 0;
for( x = 0; x < xend; x++ ) {
- unsigned long pixel=TSXGetPixel( bmpImage, x, y);
+ unsigned long pixel=XGetPixel( bmpImage, x, y);
*bbits++ = (pixel >>16) & 0xff;
*bbits++ = (pixel >> 8) & 0xff;
*bbits++ = pixel & 0xff;
@@ -1292,7 +1301,8 @@
break;
}
- TSXDestroyImage( bmpImage );
+ XDestroyImage( bmpImage );
+ LeaveCriticalSection( &X11DRV_CritSection );
info->bmiHeader.biCompression = 0;
}
diff --git a/objects/font.c b/objects/font.c
index 124663e..b1ac08d 100644
--- a/objects/font.c
+++ b/objects/font.c
@@ -1136,11 +1136,9 @@
*/
BOOL32 WINAPI GetRasterizerCaps32( LPRASTERIZER_STATUS lprs, UINT32 cbNumBytes)
{
- RASTERIZER_STATUS rs;
-
- rs.nSize = sizeof(rs);
- rs.wFlags = 0;
- rs.nLanguageID = 0;
+ lprs->nSize = sizeof(RASTERIZER_STATUS);
+ lprs->wFlags = TT_AVAILABLE|TT_ENABLED;
+ lprs->nLanguageID = 0;
return TRUE;
}
diff --git a/objects/gdiobj.c b/objects/gdiobj.c
index fe3c6f9..0557012 100644
--- a/objects/gdiobj.c
+++ b/objects/gdiobj.c
@@ -850,6 +850,28 @@
/***********************************************************************
+ * GdiSeeGdiDo (GDI.452)
+ */
+DWORD WINAPI GdiSeeGdiDo( WORD wReqType, WORD wParam1, WORD wParam2,
+ WORD wParam3 )
+{
+ switch (wReqType)
+ {
+ case 0x0001: /* LocalAlloc */
+ return LOCAL_Alloc( GDI_HeapSel, wParam1, wParam3 );
+ case 0x0002: /* LocalFree */
+ return LOCAL_Free( GDI_HeapSel, wParam1 );
+ case 0x0003: /* LocalCompact */
+ return LOCAL_Compact( GDI_HeapSel, wParam3, 0 );
+ case 0x0103: /* LocalHeap */
+ return GDI_HeapSel;
+ default:
+ fprintf(stderr, "GdiSeeGdiDo: wReqType %04x (unknown)", wReqType);
+ return (DWORD)-1;
+ }
+}
+
+/***********************************************************************
* MulDiv16 (GDI.128)
*/
INT16 WINAPI MulDiv16( INT16 foo, INT16 bar, INT16 baz )
diff --git a/objects/metafile.c b/objects/metafile.c
index b390b04..4d426d7 100644
--- a/objects/metafile.c
+++ b/objects/metafile.c
@@ -15,6 +15,7 @@
#include "heap.h"
#include "metafile.h"
#include "metafiledrv.h"
+#include "toolhelp.h"
#include "stddebug.h"
#include "debug.h"
@@ -365,9 +366,9 @@
METARECORD *mr;
HANDLETABLE16 *ht;
HGLOBAL16 hHT;
- SEGPTR spht, spRecord;
+ SEGPTR spht;
int offset = 0;
- WORD i;
+ WORD i, seg;
HPEN32 hPen;
HBRUSH32 hBrush;
HFONT32 hFont;
@@ -389,19 +390,20 @@
sizeof(HANDLETABLE16) * mh->mtNoObjects);
spht = WIN16_GlobalLock16(hHT);
+ seg = GlobalHandleToSel(hmf);
offset = mh->mtHeaderSize * 2;
/* loop through metafile records */
- spRecord = WIN16_GlobalLock16(hmf);
while (offset < (mh->mtSize * 2))
{
mr = (METARECORD *)((char *)mh + offset);
if (!lpEnumFunc( hdc, (HANDLETABLE16 *)spht,
- (METARECORD *)((UINT32)spRecord + offset),
- mh->mtNoObjects, (LONG)lpData)) {
- result = FALSE;
- break;
+ (METARECORD *) PTR_SEG_OFF_TO_HUGEPTR(seg, offset),
+ mh->mtNoObjects, (LONG)lpData ))
+ {
+ result = FALSE;
+ break;
}
@@ -421,7 +423,7 @@
/* free handle table */
GlobalFree16(hHT);
-
+ GlobalUnlock16(hmf);
return result;
}
@@ -1025,7 +1027,7 @@
* Warning: this function can change the metafile handle.
*/
-static BOOL32 MF_WriteRecord( DC *dc, METARECORD *mr, WORD rlen)
+static BOOL32 MF_WriteRecord( DC *dc, METARECORD *mr, DWORD rlen)
{
DWORD len;
METAHEADER *mh;
diff --git a/objects/oembitmap.c b/objects/oembitmap.c
index 9fb5881..700e9fe 100644
--- a/objects/oembitmap.c
+++ b/objects/oembitmap.c
@@ -322,6 +322,8 @@
* OBM_CreateBitmaps
*
* Create the 2 bitmaps from XPM data.
+ *
+ * The Xlib critical section must be entered before calling this function.
*/
static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
{
@@ -330,14 +332,14 @@
int err;
attrs = (XpmAttributes *)HEAP_xalloc( GetProcessHeap(), 0,
- TSXpmAttributesSize() );
+ XpmAttributesSize() );
attrs->valuemask = XpmColormap | XpmDepth | XpmColorSymbols |XpmHotspot;
attrs->colormap = COLOR_GetColormap();
attrs->depth = descr->color ? screenDepth : 1;
attrs->colorsymbols = (attrs->depth > 1) ? OBM_Colors : OBM_BlackAndWhite;
attrs->numsymbols = (attrs->depth > 1) ? NB_COLOR_SYMBOLS : 2;
- err = TSXpmCreatePixmapFromData( display, rootWindow, descr->data,
+ err = XpmCreatePixmapFromData( display, rootWindow, descr->data,
&pixmap, &pixmask, attrs );
if (err != XpmSuccess)
@@ -355,8 +357,8 @@
HeapFree( GetProcessHeap(), 0, attrs );
if (!descr->bitmap)
{
- if (pixmap) TSXFreePixmap( display, pixmap );
- if (pixmask) TSXFreePixmap( display, pixmask );
+ if (pixmap) XFreePixmap( display, pixmap );
+ if (pixmask) XFreePixmap( display, pixmask );
if (descr->bitmap) GDI_FreeObject( descr->bitmap );
if (descr->need_mask && descr->mask) GDI_FreeObject( descr->mask );
return FALSE;
@@ -381,11 +383,14 @@
descr.color = OBM_Pixmaps_Data[id].color;
descr.need_mask = FALSE;
+ EnterCriticalSection( &X11DRV_CritSection );
if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
{
+ LeaveCriticalSection( &X11DRV_CritSection );
fprintf( stderr, "Error creating OEM bitmap %d\n", OBM_FIRST+id );
return 0;
}
+ LeaveCriticalSection( &X11DRV_CritSection );
return descr.bitmap;
}
@@ -424,11 +429,14 @@
descr.color = !fCursor;
descr.need_mask = TRUE;
+ EnterCriticalSection( &X11DRV_CritSection );
if (!CALL_LARGE_STACK( OBM_CreateBitmaps, &descr ))
{
+ LeaveCriticalSection( &X11DRV_CritSection );
fprintf( stderr, "Error creating OEM cursor/icon %d\n", id );
return 0;
}
+ LeaveCriticalSection( &X11DRV_CritSection );
bmpXor = (BITMAPOBJ *) GDI_GetObjPtr( descr.bitmap, BITMAP_MAGIC );
bmpAnd = (BITMAPOBJ *) GDI_GetObjPtr( descr.mask, BITMAP_MAGIC );
diff --git a/ole/ole2nls.c b/ole/ole2nls.c
index 500a3fe..477927b 100644
--- a/ole/ole2nls.c
+++ b/ole/ole2nls.c
@@ -547,9 +547,7 @@
LOCVAL(LOCALE_IMEASURE,"0")
LOCVAL(LOCALE_SDECIMAL,",")
LOCVAL(LOCALE_STHOUSAND,".")
-/*
-LOCVAL(LOCALE_SGROUPING)
-*/
+LOCVAL(LOCALE_SGROUPING, "3;0")
LOCVAL(LOCALE_IDIGITS,"2")
LOCVAL(LOCALE_ILZERO,"1")
/*
@@ -558,25 +556,19 @@
LOCVAL(LOCALE_SNATIVEDIGITS)
*/
LOCVAL(LOCALE_SCURRENCY,"DM")
-/*
-LOCVAL(LOCALE_SINTLSYMBOL)
-LOCVAL(LOCALE_SMONDECIMALSEP)
-LOCVAL(LOCALE_SMONTHOUSANDSEP)
-LOCVAL(LOCALE_SMONGROUPING)
-*/
+LOCVAL(LOCALE_SINTLSYMBOL, "USD")
+LOCVAL(LOCALE_SMONDECIMALSEP, ".")
+LOCVAL(LOCALE_SMONTHOUSANDSEP, ".")
+LOCVAL(LOCALE_SMONGROUPING, "3;0")
LOCVAL(LOCALE_ICURRDIGITS,"2")
-/*
-LOCVAL(LOCALE_IINTLCURRDIGITS)
-*/
+LOCVAL(LOCALE_IINTLCURRDIGITS,"2")
LOCVAL(LOCALE_ICURRENCY,"3")
LOCVAL(LOCALE_INEGCURR,"8")
LOCVAL(LOCALE_SDATE,".")
LOCVAL(LOCALE_STIME,":")
LOCVAL(LOCALE_SSHORTDATE,"dd.MM.yyyy")
LOCVAL(LOCALE_SLONGDATE,"ddd, d. MMMM yyyy")
-/*
-LOCVAL(LOCALE_STIMEFORMAT)
-*/
+LOCVAL(LOCALE_STIMEFORMAT, "h:mm:ss tt")
LOCVAL(LOCALE_IDATE,"1")
/*
LOCVAL(LOCALE_ILDATE)
@@ -590,9 +582,11 @@
/*
LOCVAL(LOCALE_IDAYLZERO)
LOCVAL(LOCALE_IMONLZERO)
-LOCVAL(LOCALE_S1159)
-LOCVAL(LOCALE_S2359)
-LOCVAL(LOCALE_ICALENDARTYPE)
+*/
+LOCVAL(LOCALE_S1159,"AM")
+LOCVAL(LOCALE_S2359,"PM")
+LOCVAL(LOCALE_ICALENDARTYPE,"1")
+/*
LOCVAL(LOCALE_IOPTIONALCALENDAR)
LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
LOCVAL(LOCALE_IFIRSTWEEKOFYEAR)
@@ -821,8 +815,10 @@
/*
LOCVAL(LOCALE_IDAYLZERO)
LOCVAL(LOCALE_IMONLZERO)
-LOCVAL(LOCALE_S1159)
-LOCVAL(LOCALE_S2359)
+*/
+LOCVAL(LOCALE_S1159, "AM")
+LOCVAL(LOCALE_S2359, "PM")
+/*
LOCVAL(LOCALE_ICALENDARTYPE)
LOCVAL(LOCALE_IOPTIONALCALENDAR)
LOCVAL(LOCALE_IFIRSTDAYOFWEEK)
@@ -868,9 +864,9 @@
LOCVAL(LOCALE_SABBREVMONTHNAME11,"marras")
LOCVAL(LOCALE_SABBREVMONTHNAME12,"joulu")
LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
+LOCVAL(LOCALE_SPOSITIVESIGN, "")
+LOCVAL(LOCALE_SNEGATIVESIGN, "-")
/*
-LOCVAL(LOCALE_SPOSITIVESIGN)
-LOCVAL(LOCALE_SNEGATIVESIGN)
LOCVAL(LOCALE_IPOSSIGNPOSN)
LOCVAL(LOCALE_INEGSIGNPOSN)
LOCVAL(LOCALE_IPOSSYMPRECEDES)
@@ -1160,8 +1156,8 @@
LOCVAL(LOCALE_ITLZERO, "1")
LOCVAL(LOCALE_IDAYLZERO, "1")
LOCVAL(LOCALE_IMONLZERO, "1")
-LOCVAL(LOCALE_S1159, "")
-LOCVAL(LOCALE_S2359, "")
+LOCVAL(LOCALE_S1159, "AM")
+LOCVAL(LOCALE_S2359, "PM")
LOCVAL(LOCALE_ICALENDARTYPE, "1")
LOCVAL(LOCALE_IOPTIONALCALENDAR, "0")
LOCVAL(LOCALE_IFIRSTDAYOFWEEK, "0")
diff --git a/programs/notepad/ChangeLog b/programs/notepad/ChangeLog
index 1662094..b9385c6 100644
--- a/programs/notepad/ChangeLog
+++ b/programs/notepad/ChangeLog
@@ -1,3 +1,12 @@
+Tue Feb 10 23:34:08 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ * Fixed broken language menus
+
+Fri Feb 06 23.54.35 1998 Karl Backström <karl_b@geocities.com>
+ * [main.c] [main.h] [notepad.rc]
+ Fixed language support for menus.
+ * NEW [dialog.c] [dialog.h]
+ Moved all menu and dialog related stuff here.
+
Sun Jan 18 23:05:04 1998 Karl Backström <karl_b@geocities.com>
* [Sw.rc]
Added/updated Swedish language support.
diff --git a/programs/notepad/De.rc b/programs/notepad/De.rc
index 33139b6..544fdaa 100644
--- a/programs/notepad/De.rc
+++ b/programs/notepad/De.rc
@@ -57,7 +57,7 @@
#define DIALOG_PAGESETUP_CAPTION "Seite einrichten"
#define DIALOG_PAGESETUP_HEAD "&Kopfzeile:"
#define DIALOG_PAGESETUP_TAIL "&Fußzeile:"
-#define DIALOG_PAGESETUP_BORDERS "Ränder"
+#define DIALOG_PAGESETUP_BORDER "Ränder"
#define DIALOG_PAGESETUP_LEFT "&Links:"
#define DIALOG_PAGESETUP_RIGHT "&Rechts:"
#define DIALOG_PAGESETUP_TOP "&Oben:"
@@ -72,8 +72,8 @@
#define STRING_UNTITLED "(unbenannt)"
-#define STRING_ALLFILES "Alle Dateien (*.*)"
-#define STRING_TEXTFILES "Textdateien (*.txt)"
+#define STRING_ALL_FILES "Alle Dateien (*.*)"
+#define STRING_TEXT_FILES_TXT "Textdateien (*.txt)"
#define STRING_TOOLARGE "'%s' ist zu gross für den Editor\n \
Benutzen Sie bitte einen anderen Editor, um diese Datei zu bearbeiten."
diff --git a/programs/notepad/En.rc b/programs/notepad/En.rc
index 01b24ae..88b4cef 100644
--- a/programs/notepad/En.rc
+++ b/programs/notepad/En.rc
@@ -72,8 +72,8 @@
#define STRING_UNTITLED "(untitled)"
-#define STRING_ALLFILES "All files (*.*)"
-#define STRING_TEXTFILES "Text files (*.txt)"
+#define STRING_ALL_FILES "All files (*.*)"
+#define STRING_TEXT_FILES_TXT "Text files (*.txt)"
#define STRING_TOOLARGE "File '%s' is too large for notepad.\n \
Please use a different editor."
diff --git a/programs/notepad/Makefile.in b/programs/notepad/Makefile.in
index 6b254f7..7cb8fae 100644
--- a/programs/notepad/Makefile.in
+++ b/programs/notepad/Makefile.in
@@ -13,7 +13,8 @@
MOSTSRCS = \
license.c \
- main.c
+ main.c \
+ dialog.c
# Some strings need addresses >= 0x10000
STRINGSRCS = \
diff --git a/programs/notepad/Sw.rc b/programs/notepad/Sw.rc
index 8b6d49d..18c44a0 100644
--- a/programs/notepad/Sw.rc
+++ b/programs/notepad/Sw.rc
@@ -72,8 +72,8 @@
#define STRING_UNTITLED "(untitled)"
-#define STRING_ALLFILES "Alla filer (*.*)"
-#define STRING_TEXTFILES "Text filer (*.txt)"
+#define STRING_ALL_FILES "Alla filer (*.*)"
+#define STRING_TEXT_FILES_TXT "Text filer (*.txt)"
#define STRING_TOOLARGE "Filen '%s' är för stor för notepad.\n \
Använd en annan editor."
diff --git a/programs/notepad/dialog.c b/programs/notepad/dialog.c
new file mode 100644
index 0000000..36167d9
--- /dev/null
+++ b/programs/notepad/dialog.c
@@ -0,0 +1,298 @@
+/*
+ * Notepad
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ */
+
+#include <stdio.h>
+#include "windows.h"
+#include "commdlg.h"
+#ifdef WINELIB
+#include "shell.h"
+#include "options.h"
+#endif
+#include "main.h"
+#include "license.h"
+#include "dialog.h"
+#include "version.h"
+
+static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+
+VOID DIALOG_FileNew(VOID)
+{
+ fprintf(stderr, "FileNew()\n");
+}
+
+VOID DIALOG_FileOpen(VOID)
+{
+ OPENFILENAME openfilename;
+ CHAR szPath[MAX_PATHNAME_LEN];
+ CHAR szDir[MAX_PATHNAME_LEN];
+ CHAR szzFilter[2 * MAX_STRING_LEN + 100];
+ LPSTR p = szzFilter;
+
+ LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
+ p += strlen(p) + 1;
+ lstrcpy(p, "*.txt");
+ p += strlen(p) + 1;
+ LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
+ p += strlen(p) + 1;
+ lstrcpy(p, "*.*");
+ p += strlen(p) + 1;
+ *p = '\0';
+
+ GetWindowsDirectory(szDir, sizeof(szDir));
+
+ openfilename.lStructSize = 0;
+ openfilename.hwndOwner = Globals.hMainWnd;
+ openfilename.hInstance = Globals.hInstance;
+ openfilename.lpstrFilter = szzFilter;
+ openfilename.lpstrCustomFilter = 0;
+ openfilename.nMaxCustFilter = 0;
+ openfilename.nFilterIndex = 0;
+ openfilename.lpstrFile = szPath;
+ openfilename.nMaxFile = sizeof(szPath);
+ openfilename.lpstrFileTitle = 0;
+ openfilename.nMaxFileTitle = 0;
+ openfilename.lpstrInitialDir = szDir;
+ openfilename.lpstrTitle = 0;
+ openfilename.Flags = 0;
+ openfilename.nFileOffset = 0;
+ openfilename.nFileExtension = 0;
+ openfilename.lpstrDefExt = 0;
+ openfilename.lCustData = 0;
+ openfilename.lpfnHook = 0;
+ openfilename.lpTemplateName = 0;
+
+ if (GetOpenFileName(&openfilename));
+}
+
+VOID DIALOG_FileSave(VOID)
+{
+ fprintf(stderr, "FileSave()\n");
+}
+
+VOID DIALOG_FileSaveAs(VOID)
+{
+ OPENFILENAME savefilename;
+ CHAR szPath[MAX_PATHNAME_LEN];
+ CHAR szDir[MAX_PATHNAME_LEN];
+ CHAR szzFilter[2 * MAX_STRING_LEN + 100];
+ LPSTR p = szzFilter;
+
+ LoadString(Globals.hInstance, IDS_TEXT_FILES_TXT, p, MAX_STRING_LEN);
+ p += strlen(p) + 1;
+ lstrcpy(p, "*.txt");
+ p += strlen(p) + 1;
+ LoadString(Globals.hInstance, IDS_ALL_FILES, p, MAX_STRING_LEN);
+ p += strlen(p) + 1;
+ lstrcpy(p, "*.*");
+ p += strlen(p) + 1;
+ *p = '\0';
+
+ GetWindowsDirectory(szDir, sizeof(szDir));
+
+ savefilename.lStructSize = 0;
+ savefilename.hwndOwner = Globals.hMainWnd;
+ savefilename.hInstance = Globals.hInstance;
+ savefilename.lpstrFilter = szzFilter;
+ savefilename.lpstrCustomFilter = 0;
+ savefilename.nMaxCustFilter = 0;
+ savefilename.nFilterIndex = 0;
+ savefilename.lpstrFile = szPath;
+ savefilename.nMaxFile = sizeof(szPath);
+ savefilename.lpstrFileTitle = 0;
+ savefilename.nMaxFileTitle = 0;
+ savefilename.lpstrInitialDir = szDir;
+ savefilename.lpstrTitle = 0;
+ savefilename.Flags = 0;
+ savefilename.nFileOffset = 0;
+ savefilename.nFileExtension = 0;
+ savefilename.lpstrDefExt = 0;
+ savefilename.lCustData = 0;
+ savefilename.lpfnHook = 0;
+ savefilename.lpTemplateName = 0;
+
+ if (GetSaveFileName(&savefilename));
+}
+
+VOID DIALOG_FilePrint(VOID)
+{
+ PRINTDLG printer;
+ printer.lStructSize = 0;
+ printer.hwndOwner = Globals.hMainWnd;
+ printer.hInstance = Globals.hInstance;
+ printer.hDevMode = 0;
+ printer.hDevNames = 0;
+ printer.hDC = 0;
+ printer.Flags = 0;
+ printer.nFromPage = 0;
+ printer.nToPage = 0;
+ printer.nMinPage = 0;
+ printer.nMaxPage = 0;
+ printer.nCopies = 0;
+ printer.lCustData = 0;
+ printer.lpfnPrintHook = 0;
+ printer.lpfnSetupHook = 0;
+ printer.lpPrintTemplateName = 0;
+ printer.lpSetupTemplateName = 0;
+ printer.hPrintTemplate = 0;
+ printer.hSetupTemplate = 0;
+
+ if(PrintDlg16(&printer));
+}
+
+VOID DIALOG_FilePageSetup(VOID)
+{
+ DIALOG_PageSetup();
+}
+
+VOID DIALOG_FilePrinterSetup(VOID)
+{
+ fprintf(stderr, "FilePrinterSetup()\n");
+}
+
+VOID DIALOG_FileExit(VOID)
+{
+ PostQuitMessage(0);
+}
+
+VOID DIALOG_EditUndo(VOID)
+{
+ fprintf(stderr, "EditUndo()\n");
+}
+
+VOID DIALOG_EditCut(VOID)
+{
+ fprintf(stderr, "EditCut()\n");
+}
+
+VOID DIALOG_EditCopy(VOID)
+{
+ fprintf(stderr, "EditCopy()\n");
+}
+
+VOID DIALOG_EditPaste(VOID)
+{
+ fprintf(stderr, "EditPaste()\n");
+}
+
+VOID DIALOG_EditDelete(VOID)
+{
+ fprintf(stderr, "EditDelete()\n");
+}
+
+VOID DIALOG_EditSelectAll(VOID)
+{
+ fprintf(stderr, "EditSelectAll()\n");
+}
+
+VOID DIALOG_EditTimeDate(VOID)
+{
+ fprintf(stderr, "EditTimeDate()\n");
+}
+
+VOID DIALOG_EditWrap(VOID)
+{
+ Globals.bWrapLongLines = !Globals.bWrapLongLines;
+ CheckMenuItem(Globals.hEditMenu, NP_EDIT_WRAP, MF_BYCOMMAND |
+ (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
+}
+
+VOID DIALOG_Search(VOID)
+{
+ FINDREPLACE find;
+ CHAR szFind[MAX_PATHNAME_LEN];
+ find.lStructSize = 0;
+ find.hwndOwner = Globals.hMainWnd;
+ find.hInstance = Globals.hInstance;
+ find.lpstrFindWhat = szFind;
+ find.wFindWhatLen = sizeof(szFind);
+ find.Flags = 0;
+ find.lCustData = 0;
+ find.lpfnHook = 0;
+ find.lpTemplateName = 0;
+ FindText(&find);
+}
+
+VOID DIALOG_SearchNext(VOID)
+{
+ fprintf(stderr, "SearchNext()\n");
+}
+
+VOID DIALOG_HelpContents(VOID)
+{
+ printf("NP_HELP_CONTENTS\n");
+ WinHelp(Globals.hMainWnd, HELPFILE, HELP_INDEX, 0);
+}
+
+VOID DIALOG_HelpSearch(VOID)
+{
+ fprintf(stderr, "HelpSearch()\n");
+}
+
+VOID DIALOG_HelpHelp(VOID)
+{
+ printf("NP_HELP_ON_HELP\n");
+ WinHelp(Globals.hMainWnd, HELPFILE, HELP_HELPONHELP, 0);
+}
+
+VOID DIALOG_HelpLicense(VOID)
+{
+ WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
+}
+
+VOID DIALOG_HelpNoWarranty(VOID)
+{
+ printf("NP_ABOUT_NO_WARRANTY\n");
+ WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
+}
+
+VOID DIALOG_HelpAboutWine(VOID)
+{
+ printf("NP_ABOUT_WINE\n");
+ ShellAbout(Globals.hMainWnd, "Notepad", "Notepad\n" WINE_RELEASE_INFO, 0);
+}
+
+
+/***********************************************************************
+ *
+ * DIALOG_PageSetup
+ */
+
+VOID DIALOG_PageSetup(VOID)
+{
+ WNDPROC lpfnDlg = MakeProcInstance(DIALOG_PAGESETUP_DlgProc, Globals.hInstance);
+ DialogBox(Globals.hInstance, STRING_PAGESETUP_Xx,
+ Globals.hMainWnd, lpfnDlg);
+ FreeProcInstance(lpfnDlg);
+}
+
+
+/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
+ *
+ * DIALOG_PAGESETUP_DlgProc
+ */
+
+static LRESULT DIALOG_PAGESETUP_DlgProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ switch (msg)
+ {
+ case WM_COMMAND:
+ switch (wParam)
+ {
+ case IDOK:
+ EndDialog(hDlg, IDOK);
+ return TRUE;
+
+ case IDCANCEL:
+ EndDialog(hDlg, IDCANCEL);
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+/* Local Variables: */
+/* c-file-style: "GNU" */
+/* End: */
diff --git a/programs/notepad/dialog.h b/programs/notepad/dialog.h
new file mode 100644
index 0000000..47491b4
--- /dev/null
+++ b/programs/notepad/dialog.h
@@ -0,0 +1,41 @@
+/*
+ * Notepad
+ *
+ * Copyright 1998 Marcel Baur <mbaur@g26.ethz.ch>
+ */
+
+#include "windows.h"
+
+VOID DIALOG_FileNew(VOID);
+VOID DIALOG_FileOpen(VOID);
+VOID DIALOG_FileSave(VOID);
+VOID DIALOG_FileSaveAs(VOID);
+VOID DIALOG_FilePrint(VOID);
+VOID DIALOG_FilePageSetup(VOID);
+VOID DIALOG_FilePrinterSetup(VOID);
+VOID DIALOG_FileExit(VOID);
+
+VOID DIALOG_EditUndo(VOID);
+VOID DIALOG_EditCut(VOID);
+VOID DIALOG_EditCopy(VOID);
+VOID DIALOG_EditPaste(VOID);
+VOID DIALOG_EditDelete(VOID);
+VOID DIALOG_EditSelectAll(VOID);
+VOID DIALOG_EditTimeDate(VOID);
+VOID DIALOG_EditWrap(VOID);
+
+VOID DIALOG_Search(VOID);
+VOID DIALOG_SearchNext(VOID);
+
+VOID DIALOG_HelpContents(VOID);
+VOID DIALOG_HelpSearch(VOID);
+VOID DIALOG_HelpHelp(VOID);
+VOID DIALOG_HelpLicense(VOID);
+VOID DIALOG_HelpNoWarranty(VOID);
+VOID DIALOG_HelpAboutWine(VOID);
+
+VOID DIALOG_PageSetup(VOID);
+
+/* Local Variables: */
+/* c-file-style: "GNU" */
+/* End: */
diff --git a/programs/notepad/main.c b/programs/notepad/main.c
index cdc2b64..db12923 100644
--- a/programs/notepad/main.c
+++ b/programs/notepad/main.c
@@ -4,15 +4,109 @@
* Copyright 1997 Marcel Baur <mbaur@g26.ethz.ch>
*/
-#include <windows.h>
-
+#include <stdio.h>
+#include "windows.h"
#include "main.h"
#include "license.h"
+#include "dialog.h"
+#ifdef WINELIB
+#include "options.h"
+#include "resource.h"
+#include "shell.h"
+void LIBWINE_Register_De();
+void LIBWINE_Register_En();
+void LIBWINE_Register_Sw();
+#endif
NOTEPAD_GLOBALS Globals;
-CHAR STRING_MENU_Xx[] = "MENU_En";
-CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_En";
+CHAR STRING_MENU_Xx[] = "MENU_Xx";
+CHAR STRING_PAGESETUP_Xx[] = "DIALOG_PAGESETUP_Xx";
+
+static BOOL MAIN_LoadStringOtherLanguage(UINT num, UINT ids, LPSTR str, UINT len)
+{
+ ids -= Globals.wStringTableOffset;
+ ids += num * 0x100;
+ return(LoadString(Globals.hInstance, ids, str, len));
+};
+
+VOID MAIN_SelectLanguageByName(LPCSTR lang)
+{
+ INT i;
+ CHAR newlang[3];
+
+ for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+ if (MAIN_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)) &&
+ !lstrcmp(lang, newlang))
+ {
+ MAIN_SelectLanguageByNumber(i);
+ return;
+ }
+
+ /* Fallback */
+ for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+ if (MAIN_LoadStringOtherLanguage(i, IDS_LANGUAGE_ID, newlang, sizeof(newlang)))
+ {
+ MAIN_SelectLanguageByNumber(i);
+ return;
+ }
+
+ MessageBox(Globals.hMainWnd, "No language found", "FATAL ERROR", MB_OK);
+ PostQuitMessage(1);
+}
+
+VOID MAIN_SelectLanguageByNumber(UINT num)
+{
+ INT i;
+ CHAR lang[3];
+ CHAR caption[MAX_STRING_LEN];
+ CHAR item[MAX_STRING_LEN];
+ HMENU hMainMenu;
+
+ /* Select string table */
+ Globals.wStringTableOffset = num * 0x100;
+
+ /* Get Language id */
+ LoadString(Globals.hInstance, IDS_LANGUAGE_ID, lang, sizeof(lang));
+ Globals.lpszLanguage = lang;
+
+ /* Set frame caption */
+ LoadString(Globals.hInstance, IDS_NOTEPAD, caption, sizeof(caption));
+ SetWindowText(Globals.hMainWnd, caption);
+
+ /* Change Resource names */
+ lstrcpyn(STRING_MENU_Xx + sizeof(STRING_MENU_Xx) - 3, lang, 3);
+ lstrcpyn(STRING_PAGESETUP_Xx + sizeof(STRING_PAGESETUP_Xx) - 3, lang, 3);
+
+ /* Create menu */
+ hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx);
+ Globals.hFileMenu = GetSubMenu(hMainMenu, 0);
+ Globals.hEditMenu = GetSubMenu(hMainMenu, 1);
+ Globals.hSearchMenu = GetSubMenu(hMainMenu, 2);
+ Globals.hLanguageMenu = GetSubMenu(hMainMenu, 3);
+ Globals.hHelpMenu = GetSubMenu(hMainMenu, 4);
+
+ /* Remove dummy item */
+ RemoveMenu(Globals.hLanguageMenu, 0, MF_BYPOSITION);
+ /* Add language items */
+ for (i = 0; i <= MAX_LANGUAGE_NUMBER; i++)
+ if (MAIN_LoadStringOtherLanguage(i, IDS_LANGUAGE_MENU_ITEM, item, sizeof(item)))
+ AppendMenu(Globals.hLanguageMenu, MF_STRING | MF_BYCOMMAND,
+ NP_FIRST_LANGUAGE + i, item);
+
+ SetMenu(Globals.hMainWnd, hMainMenu);
+
+ /* Destroy old menu */
+ if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
+ Globals.hMainMenu = hMainMenu;
+
+#ifdef WINELIB
+ /* Update system menus */
+ for (i = 0; Languages[i].name && lstrcmp(lang, Languages[i].name);) i++;
+ if (Languages[i].name) Options.language = i;
+
+#endif
+}
/***********************************************************************
*
@@ -47,7 +141,7 @@
if (langnum > MAX_LANGUAGE_NUMBER)
{
MessageBox(0, "No language found", "FATAL ERROR", MB_OK);
- return(1);
+ PostQuitMessage(0);
}
}
@@ -65,61 +159,42 @@
int NOTEPAD_MenuCommand (WPARAM wParam)
{
- printf("NOTEPAD_MenuCommand()\n");
+// printf("NOTEPAD_MenuCommand()\n");
switch (wParam) {
- case NP_FILE_NEW: break;
- case NP_FILE_SAVE: break;
- case NP_FILE_SAVEAS: break;
- case NP_FILE_PRINT: break;
- case NP_FILE_PAGESETUP: break;
- case NP_FILE_PRINTSETUP: break;
+ case NP_FILE_NEW: DIALOG_FileNew(); break;
+ case NP_FILE_OPEN: DIALOG_FileOpen(); break;
+ case NP_FILE_SAVE: DIALOG_FileSave(); break;
+ case NP_FILE_SAVEAS: DIALOG_FileSaveAs(); break;
+ case NP_FILE_PRINT: DIALOG_FilePrint(); break;
+ case NP_FILE_PAGESETUP: DIALOG_FilePageSetup(); break;
+ case NP_FILE_PRINTSETUP: DIALOG_FilePrinterSetup();break;
+ case NP_FILE_EXIT: DIALOG_FileExit(); break;
- case NP_FILE_EXIT:
- PostQuitMessage(0);
- break;
+ case NP_EDIT_UNDO: DIALOG_EditUndo(); break;
+ case NP_EDIT_CUT: DIALOG_EditCut(); break;
+ case NP_EDIT_COPY: DIALOG_EditCopy(); break;
+ case NP_EDIT_PASTE: DIALOG_EditPaste(); break;
+ case NP_EDIT_DELETE: DIALOG_EditDelete(); break;
+ case NP_EDIT_SELECTALL: DIALOG_EditSelectAll(); break;
+ case NP_EDIT_TIMEDATE: DIALOG_EditTimeDate();break;
+ case NP_EDIT_WRAP: DIALOG_EditWrap(); break;
- case NP_EDIT_UNDO: break;
- case NP_EDIT_CUT: break;
- case NP_EDIT_COPY: break;
- case NP_EDIT_PASTE: break;
- case NP_EDIT_DELETE: break;
- case NP_EDIT_TIMEDATE: break;
- case NP_EDIT_WRAP:
- Globals.bWrapLongLines = !Globals.bWrapLongLines;
- CheckMenuItem(Globals.hEditMenu, NP_EDIT_WRAP, MF_BYCOMMAND |
- (Globals.bWrapLongLines ? MF_CHECKED : MF_UNCHECKED));
- break;
+ case NP_SEARCH_SEARCH: DIALOG_Search(); break;
+ case NP_SEARCH_NEXT: DIALOG_SearchNext(); break;
- case NP_SEARCH_SEARCH: break;
- case NP_SEARCH_NEXT: break;
-
- case NP_HELP_CONTENTS:
- printf("NP_HELP_CONTENTS\n");
- WinHelp(Globals.hMainWnd, HELPFILE, HELP_INDEX, 0);
- break;
-
- case NP_HELP_SEARCH: break;
-
- case NP_HELP_ON_HELP:
- printf("NP_HELP_ON_HELP\n");
- WinHelp(Globals.hMainWnd, HELPFILE, HELP_HELPONHELP, 0);
- break;
-
- case NP_HELP_LICENSE:
- WineLicense(Globals.hMainWnd, Globals.lpszLanguage);
- break;
-
- case NP_HELP_NO_WARRANTY:
- printf("NP_ABOUT_NO_WARRANTY\n");
- WineWarranty(Globals.hMainWnd, Globals.lpszLanguage);
- break;
-
- case NP_HELP_ABOUT_WINE:
- printf("NP_ABOUT_WINE\n");
- ShellAbout(Globals.hMainWnd, "WINE", "Notepad", 0);
- break;
-
+ case NP_HELP_CONTENTS: DIALOG_HelpContents(); break;
+ case NP_HELP_SEARCH: DIALOG_HelpSearch(); break;
+ case NP_HELP_ON_HELP: DIALOG_HelpHelp(); break;
+ case NP_HELP_LICENSE: DIALOG_HelpLicense(); break;
+ case NP_HELP_NO_WARRANTY: DIALOG_HelpNoWarranty(); break;
+ case NP_HELP_ABOUT_WINE: DIALOG_HelpAboutWine(); break;
+
+ // Handle languages
+ default:
+ if ((wParam >=NP_FIRST_LANGUAGE) && (wParam<=NP_LAST_LANGUAGE))
+ MAIN_SelectLanguageByNumber(wParam - NP_FIRST_LANGUAGE);
+ else printf("Unimplemented menu command %i\n", wParam);
}
return 0;
}
@@ -172,7 +247,7 @@
void DumpGlobals(void) {
- printf("DumpGlobals()");
+ printf("DumpGlobals()\n");
printf(" Globals.lpszIniFile: %s\n", Globals.lpszIniFile);
printf(" Globals.lpszIcoFile: %s\n", Globals.lpszIcoFile);
printf("Globals.lpszLanguage: %s\n", Globals.lpszLanguage);
@@ -188,25 +263,33 @@
char className[] = "NPClass"; /* To make sure className >= 0x10000 */
char winName[] = "Notepad";
+ #if defined(WINELIB) && !defined(HAVE_WINE_CONSTRUCTOR)
+ /* Register resources */
+ LIBWINE_Register_De();
+ LIBWINE_Register_En();
+ LIBWINE_Register_Sw();
+ #endif
+
printf("WinMain()\n");
/* Setup Globals */
Globals.lpszIniFile = "notepad.ini";
Globals.lpszIcoFile = "notepad.ico";
- Globals.lpszLanguage = "En";
+
+ /* Select Language */
+#ifdef WINELIB
+ Globals.lpszLanguage = Languages[Options.language].name;
+#else
+ Globals.lpszLanguage = "En";
+#endif
+
Globals.hInstance = hInstance;
- Globals.hMainMenu = LoadMenu(Globals.hInstance, STRING_MENU_Xx);
- Globals.hFileMenu = GetSubMenu(Globals.hMainMenu, 0);
- Globals.hEditMenu = GetSubMenu(Globals.hMainMenu, 1);
- Globals.hSearchMenu = GetSubMenu(Globals.hMainMenu, 2);
- Globals.hLanguageMenu = GetSubMenu(Globals.hMainMenu, 3);
- Globals.hHelpMenu = GetSubMenu(Globals.hMainMenu, 4);
Globals.hMainIcon = ExtractIcon(Globals.hInstance,
Globals.lpszIcoFile, 0);
if (!Globals.hMainIcon) Globals.hMainIcon =
LoadIcon(0, MAKEINTRESOURCE(DEFAULTICON));
-
+
DumpGlobals();
if (!prev){
@@ -228,12 +311,14 @@
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, 0,
LoadMenu(Globals.hInstance, STRING_MENU_Xx),
Globals.hInstance, 0);
+ MAIN_SelectLanguageByName(Globals.lpszLanguage);
SetMenu(Globals.hMainWnd, Globals.hMainMenu);
ShowWindow (Globals.hMainWnd, show);
UpdateWindow (Globals.hMainWnd);
+
while (GetMessage (&msg, 0, 0, 0)) {
TranslateMessage (&msg);
DispatchMessage (&msg);
diff --git a/programs/notepad/main.h b/programs/notepad/main.h
index bb2fd2f..c1b08ef 100644
--- a/programs/notepad/main.h
+++ b/programs/notepad/main.h
@@ -38,20 +38,27 @@
/* function prototypes */
/* class names */
+VOID MAIN_SelectLanguageByName(LPCSTR);
+VOID MAIN_SelectLanguageByNumber(UINT);
-/* resource names */
-// extern CHAR[] STRING_MENU_Xx;
+/* Resource names */
+extern CHAR STRING_MENU_Xx[];
+extern CHAR STRING_PAGESETUP_Xx[];
- #define STRINGID(id) (0x##id + Globals.wStringTableOffset)
+#define STRINGID(id) (0x##id + Globals.wStringTableOffset)
#else /* RC_INVOKED */
- #define STRINGID(id) id
+#define STRINGID(id) id
#endif
/* string table index */
-#define IDS_LANGUAGE_ID STRINGID(00)
+#define IDS_LANGUAGE_ID STRINGID(00)
+#define IDS_LANGUAGE_MENU_ITEM STRINGID(01)
+#define IDS_NOTEPAD STRINGID(02)
+#define IDS_TEXT_FILES_TXT STRINGID(03)
+#define IDS_ALL_FILES STRINGID(04)
/* main menu */
@@ -89,10 +96,20 @@
/* Dialog `Page Setup' */
-#define NP_PAGESETUP_LEFT 1000
-#define NP_PAGESETUP_RIGHT 1001
-#define NP_PAGESETUP_TOP 1002
-#define NP_PAGESETUP_BOTTOM 1003
+#define NP_PAGESETUP_HEAD 1000
+#define NP_PAGESETUP_HEAD_TXT 1001
+#define NP_PAGESETUP_TAIL 1002
+#define NP_PAGESETUP_TAIL_TXT 1003
+#define NP_PAGESETUP_LEFT 1005
+#define NP_PAGESETUP_LEFT_TXT 1006
+#define NP_PAGESETUP_RIGHT 1007
+#define NP_PAGESETUP_RIGHT_TXT 1008
+#define NP_PAGESETUP_TOP 1009
+#define NP_PAGESETUP_TOP_TXT 1010
+#define NP_PAGESETUP_BOTTOM 1011
+#define NP_PAGESETUP_BOTTOM_TXT 1012
+#define NP_HELP 1013
+#define NP_PAGESETUP_BORDER 1014
/* Local Variables: */
diff --git a/programs/notepad/notepad.rc b/programs/notepad/notepad.rc
index 5a438de..349d6c5 100644
--- a/programs/notepad/notepad.rc
+++ b/programs/notepad/notepad.rc
@@ -60,3 +60,48 @@
}
+/* Dialog `Page setup' */
+
+CONCAT(DIALOG_PAGESETUP_, LANGUAGE_ID) DIALOG 0, 0, 225, 95
+STYLE DS_MODALFRAME | WS_CAPTION | WS_SYSMENU
+CAPTION DIALOG_PAGESETUP_CAPTION
+{
+LTEXT DIALOG_PAGESETUP_HEAD, NP_PAGESETUP_HEAD_TXT, 10, 07, 40, 15
+EDITTEXT NP_PAGESETUP_HEAD, 60, 05, 110, 12, WS_BORDER | WS_TABSTOP
+LTEXT DIALOG_PAGESETUP_TAIL, NP_PAGESETUP_TAIL_TXT, 10, 24, 40, 15
+EDITTEXT NP_PAGESETUP_TAIL, 60, 22, 110, 12, WS_BORDER | WS_TABSTOP
+GROUPBOX DIALOG_PAGESETUP_BORDER, NP_PAGESETUP_BORDER, 10, 43, 160, 45
+LTEXT DIALOG_PAGESETUP_LEFT, NP_PAGESETUP_LEFT_TXT, 20, 55, 30, 10, WS_CHILD
+EDITTEXT NP_PAGESETUP_LEFT, 50, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
+LTEXT DIALOG_PAGESETUP_TOP, NP_PAGESETUP_TOP_TXT, 20, 73, 30, 10, WS_CHILD
+EDITTEXT NP_PAGESETUP_TOP, 50, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
+LTEXT DIALOG_PAGESETUP_RIGHT, NP_PAGESETUP_RIGHT_TXT, 100, 55, 30, 10, WS_CHILD
+EDITTEXT NP_PAGESETUP_RIGHT, 130, 55, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
+LTEXT DIALOG_PAGESETUP_BOTTOM, NP_PAGESETUP_BOTTOM_TXT, 100, 73, 30, 10, WS_CHILD
+EDITTEXT NP_PAGESETUP_BOTTOM, 130, 73, 35, 11, WS_CHILD | WS_BORDER | WS_TABSTOP
+DEFPUSHBUTTON DIALOG_OK, IDOK, 180, 3, 40, 15, WS_TABSTOP
+PUSHBUTTON DIALOG_CANCEL, IDCANCEL, 180, 21, 40, 15, WS_TABSTOP
+PUSHBUTTON DIALOG_HELP, NP_HELP, 180, 39, 40, 15, WS_TABSTOP
+}
+
+
+/* Strings */
+
+#define ADDSTRING(str) ADDSTRING1(LANGUAGE_NUMBER, IDS_ ## str) STRING_ ## str
+#define ADDSTRING1(langnum, ids) ADDSTRING2(langnum, ids)
+#define ADDSTRING2(langnum, ids) 0x ## langnum ## ids
+
+#define STRINGIFY(str) STRINGIFY1(str)
+#define STRINGIFY1(str) #str
+
+#define STRING_LANGUAGE_ID STRINGIFY(LANGUAGE_ID)
+#define STRING_LANGUAGE_MENU_ITEM LANGUAGE_MENU_ITEM
+
+STRINGTABLE
+{
+ADDSTRING(LANGUAGE_ID)
+ADDSTRING(LANGUAGE_MENU_ITEM)
+ADDSTRING(NOTEPAD)
+ADDSTRING(TEXT_FILES_TXT)
+ADDSTRING(ALL_FILES)
+}
diff --git a/programs/progman/ChangeLog b/programs/progman/ChangeLog
index 2d7bd4e..a32b13e 100644
--- a/programs/progman/ChangeLog
+++ b/programs/progman/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jan 18 23:05:04 1998 Karl Backström <karl_b@geocities.com>
+ * [Sw.rc]
+ Added Swedish language support.
+
Mon Jul 28 18:28:14 1997 Peter Schlaile <up9n@rz.uni-karlsruhe.de>
* [grpfile.c]
diff --git a/programs/winhelp/ChangeLog b/programs/winhelp/ChangeLog
index 1780acb..3d072ba 100644
--- a/programs/winhelp/ChangeLog
+++ b/programs/winhelp/ChangeLog
@@ -1,3 +1,7 @@
+Sun Jan 18 23:05:04 1998 Karl Backström <karl_b@geocities.com>
+ * [Sw.rc]
+ Added Swedish language support.
+
Fri Jul 4 12:00:00 1997 Henrik Olsen <Henrik.Olsen@iaeste.dk>
* [Da.rc] (new)
diff --git a/programs/winhelp/Sw.rc b/programs/winhelp/Sw.rc
index 687c7a2..8228db8 100644
--- a/programs/winhelp/Sw.rc
+++ b/programs/winhelp/Sw.rc
@@ -20,7 +20,7 @@
#define MENU_EDIT "&Redigera"
#define MENU_EDIT_COPY_DIALOG "&Kopiera..."
-#define MENU_EDIT_ANNOTATE "&Annmärk..."
+#define MENU_EDIT_ANNOTATE "&Markera..."
#define MENU_BOOKMARK "&Bokmärke"
#define MENU_BOOKMARK_DEFINE "&Defingera..."
diff --git a/relay32/builtin32.c b/relay32/builtin32.c
index b9f48d9..c1c7803 100644
--- a/relay32/builtin32.c
+++ b/relay32/builtin32.c
@@ -106,7 +106,7 @@
*
* Load a built-in Win32 module. Helper function for BUILTIN32_LoadModule.
*/
-static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll )
+static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll, PDB32 *pdb )
{
extern void RELAY_CallFrom32();
extern void CALL32_Regs();
@@ -124,7 +124,6 @@
DEBUG_ENTRY_POINT *debug;
REG_ENTRY_POINT *regs;
PE_MODREF *pem;
- PDB32 *pdb = PROCESS_Current();
INT32 i, size;
BYTE *addr;
@@ -279,8 +278,7 @@
/* Create a modref */
- pem = (PE_MODREF *)HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY,
- sizeof(*pem) );
+ pem = (PE_MODREF *)HeapAlloc( pdb->heap, HEAP_ZERO_MEMORY, sizeof(*pem) );
pem->module = (HMODULE32)addr;
pem->pe_export = exp;
pem->next = pdb->modref_list;
@@ -304,7 +302,7 @@
* 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.
*/
-HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force )
+HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force, PDB32 *process )
{
BUILTIN32_DLL *table;
char dllname[16], *p;
@@ -320,7 +318,7 @@
if (!table->descr) return 0;
if (!table->used && !force) return 0;
- return BUILTIN32_DoLoadModule( table );
+ return BUILTIN32_DoLoadModule( table, process );
}
diff --git a/relay32/crtdll.spec b/relay32/crtdll.spec
index d1bdd34..f1c8972 100644
--- a/relay32/crtdll.spec
+++ b/relay32/crtdll.spec
@@ -268,7 +268,7 @@
264 stub _setjmp
265 cdecl _setmode(long long) CRTDLL__setmode
266 stub _setsystime
-267 cdecl _sleep(long) sleep
+267 cdecl _sleep(long) CRTDLL__sleep
268 stub _snprintf
269 stub _snwprintf
270 stub _sopen
diff --git a/relay32/kernel32.spec b/relay32/kernel32.spec
index 644978a..0b10e0e 100644
--- a/relay32/kernel32.spec
+++ b/relay32/kernel32.spec
@@ -91,7 +91,7 @@
102 stdcall AddAtomW(wstr) AddAtom32W
-103 stub AllocConsole
+103 stdcall AllocConsole() AllocConsole
104 stub AllocLSCallback
105 stdcall AllocSLCallback(ptr ptr) AllocSLCallback
106 stdcall AreFileApisANSI() AreFileApisANSI
@@ -255,7 +255,7 @@
264 stub FoldStringW
265 stdcall FormatMessageA(long ptr long long ptr long ptr) FormatMessage32A
266 stdcall FormatMessageW(long ptr long long ptr long ptr) FormatMessage32W
-267 stub FreeConsole
+267 stdcall FreeConsole() FreeConsole
268 stdcall FreeEnvironmentStringsA(ptr) FreeEnvironmentStrings32A
269 stdcall FreeEnvironmentStringsW(ptr) FreeEnvironmentStrings32W
270 stub FreeLSCallback
@@ -324,7 +324,7 @@
333 stdcall GetFullPathNameA(str long ptr ptr) GetFullPathName32A
334 stdcall GetFullPathNameW(wstr long ptr ptr) GetFullPathName32W
335 stub GetHandleContext
-336 stub GetHandleInformation
+336 stdcall GetHandleInformation(long ptr) GetHandleInformation
337 stub GetLSCallbackTarget
338 stub GetLSCallbackTemplate
339 stdcall GetLargestConsoleWindowSize(long) GetLargestConsoleWindowSize
@@ -641,7 +641,7 @@
650 stdcall SetFileTime(long ptr ptr ptr) SetFileTime
651 stub SetHandleContext
652 stdcall SetHandleCount(long) SetHandleCount32
-653 stub SetHandleInformation
+653 stdcall SetHandleInformation(long long long) SetHandleInformation
654 stdcall SetLastError(long) SetLastError
655 stub SetLocalTime
656 stdcall SetLocaleInfoA(long long str) SetLocaleInfoA
diff --git a/relay32/user32.spec b/relay32/user32.spec
index 5fdddb2..dc4f01a 100644
--- a/relay32/user32.spec
+++ b/relay32/user32.spec
@@ -64,7 +64,7 @@
61 stdcall CopyImage(long long long long long) CopyImage32
62 stdcall CopyRect(ptr ptr) CopyRect32
63 stdcall CountClipboardFormats() CountClipboardFormats32
- 64 stub CreateAcceleratorTableA
+ 64 stdcall CreateAcceleratorTableA(ptr long) CreateAcceleratorTable32A
65 stub CreateAcceleratorTableW
66 stdcall CreateCaret(long long long long) CreateCaret32
67 stdcall CreateCursor(long long long long long ptr ptr) CreateCursor32
@@ -424,7 +424,7 @@
419 stdcall PostMessageA(long long long long) PostMessage32A
420 stdcall PostMessageW(long long long long) PostMessage32W
421 stdcall PostQuitMessage(long) PostQuitMessage32
-422 stub PostThreadMessageA
+422 stdcall PostThreadMessageA(long long long long) PostThreadMessage32A
423 stub PostThreadMessageW
424 stdcall PtInRect(ptr long long) PtInRect32
425 stub QuerySendMessage
diff --git a/resources/sysres_Sw.rc b/resources/sysres_Sw.rc
index f40d7cf..24560c3 100644
--- a/resources/sysres_Sw.rc
+++ b/resources/sysres_Sw.rc
@@ -1,6 +1,6 @@
SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
- MENUITEM "&Restore", 61728
+ MENUITEM "&Återställ", 61728
MENUITEM "&Flytta", 61456
MENUITEM "&Storlek", 61440
MENUITEM "Mi&nimera", 61472
@@ -34,12 +34,12 @@
ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "&Ok", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Cancel", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Abort", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Retry", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Ignore", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&Yes", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
- PUSHBUTTON "&No", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Avbryt", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Avbryt", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Försök igen", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Ignorera", 5, 208, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Ja", 6, 256, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
+ PUSHBUTTON "&Nej", 7, 304, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
END
SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 15, 40, 210, 152
@@ -51,7 +51,7 @@
LISTBOX 99, 8, 65, 137, 82, LBS_NOTIFY | WS_VSCROLL | WS_BORDER
ICON "", 1088, 189, 10, 14, 16
LTEXT "", 100, 8, 10, 137, 33
- LTEXT "Wine was brought to you by:", 98, 8, 55, 137, 10
+ LTEXT "Wine hade inte varit möjligt utan dessa personer:", 98, 8, 55, 137, 10
}
OPEN_FILE DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 275, 134
@@ -65,9 +65,9 @@
LTEXT "&Kataloger:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "Lista över filer av &type:", 1089, 6, 104, 90, 9
+ LTEXT "Lista över filer av &typen:", 1089, 6, 104, 90, 9
COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- LTEXT "&Kataloger:", 1091, 110, 104, 92, 9
+ LTEXT "&Enheter:", 1091, 110, 104, 92, 9
COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Öppna", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Avbryt", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
@@ -87,9 +87,9 @@
LTEXT "&Kataloger:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
- LTEXT "Lista över filer av &typen:", 1089, 6, 104, 90, 9
+ LTEXT "Lista filer av &typen:", 1089, 6, 104, 90, 9
COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
- LTEXT "&Kataloger:", 1091, 110, 104, 92, 9
+ LTEXT "&Enheter:", 1091, 110, 104, 92, 9
COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Spara som", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Avbryt", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
@@ -112,7 +112,7 @@
DEFPUSHBUTTON "Skriv ut", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Avbryt", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Inställningar", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
- LTEXT "&Fråm:", 1090, 60, 80, 30, 9
+ LTEXT "&Från:", 1090, 60, 80, 30, 9
LTEXT "&Till:", 1091, 120, 80, 30, 9
LTEXT "Utskriftskvalitet:", 1092, 6, 100, 76, 9
COMBOBOX 1136, 80, 100, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
@@ -128,7 +128,7 @@
{
GROUPBOX "Skrivare", 1072, 6, 10, 180, 65, BS_GROUPBOX
RADIOBUTTON "&Standardskrivare", 1056, 16, 20, 80, 12
- LTEXT "[none]", 1088, 35, 35, 120, 9
+ LTEXT "[ingen]", 1088, 35, 35, 120, 9
RADIOBUTTON "Specifierad &skrivare", 1057, 16, 50, 80, 12
COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
@@ -166,8 +166,8 @@
PUSHBUTTON "&Använd", 1026,218,40,40,14,WS_GROUP
PUSHBUTTON "&Hjälp" , 1038,218,57,40,14,WS_GROUP
GROUPBOX "Effekter",1072,6,72,84,34,WS_GROUP
- CHECKBOX "Stri&keout", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
- CHECKBOX "&Understryken", 1041, 10,94,50,10, BS_AUTOCHECKBOX
+ CHECKBOX "&Genomstruken", 1040, 10,82,50,10, BS_AUTOCHECKBOX | WS_TABSTOP
+ CHECKBOX "&Understruken", 1041, 10,94,50,10, BS_AUTOCHECKBOX
LTEXT "&Färg:", 1091 ,6,110,30,9
COMBOBOX 1139,6,120,84,100,CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_HASSTRINGS |
CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
@@ -215,10 +215,10 @@
CAPTION "Sök"
FONT 8, "Helv"
{
- LTEXT "&Sök efter vad:", -1, 4, 8, 42, 8
+ LTEXT "&Sök efter:", -1, 4, 8, 42, 8
EDITTEXT 1152, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
CHECKBOX "&Bara hela ord", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- CHECKBOX "&Skillnad på stora/små bokstäver", 1041, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP
+ CHECKBOX "&Skillnad på stora/små bokstäver", 1041, 4, 42, 100, 12, BS_AUTOCHECKBOX | WS_TABSTOP
GROUPBOX "Riktning", 1072, 107, 26, 68, 28
CONTROL "&Upp", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 20, 12
CONTROL "&Ner", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
@@ -233,12 +233,12 @@
CAPTION "Sök/ersätt"
FONT 8, "Helv"
{
- LTEXT "&Söka efter:", -1, 4, 9, 48, 8
+ LTEXT "&Sök efter:", -1, 4, 9, 48, 8
EDITTEXT 1152, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
- LTEXT "&Ersätta med:", -1, 4, 26, 48, 8
+ LTEXT "&Ersätt med:", -1, 4, 26, 48, 8
EDITTEXT 1153, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
CHECKBOX "&Bara hela ord", 1040, 5, 46, 104, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
- CHECKBOX "&Skillnad på stora/små bokstäver", 1041, 5, 62, 59, 12, BS_AUTOCHECKBOX | WS_TABSTOP
+ CHECKBOX "&Skillnad på stora/små bokstäver", 1041, 5, 62, 104, 12, BS_AUTOCHECKBOX | WS_TABSTOP
DEFPUSHBUTTON "&Sök efter nästa", 1, 174, 4, 50, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Ersätt", 1024, 174, 21, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Ersätt &alla", 1025, 174, 38, 50, 14, WS_GROUP | WS_TABSTOP
@@ -246,17 +246,3 @@
PUSHBUTTON "&Hjälp", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/scheduler/Makefile.in b/scheduler/Makefile.in
index 178d43a..c0b0a2e 100644
--- a/scheduler/Makefile.in
+++ b/scheduler/Makefile.in
@@ -8,6 +8,7 @@
C_SRCS = \
critsection.c \
event.c \
+ handle.c \
k32obj.c \
mutex.c \
process.c \
diff --git a/scheduler/event.c b/scheduler/event.c
index 0b578ba..fdebbe8 100644
--- a/scheduler/event.c
+++ b/scheduler/event.c
@@ -86,7 +86,7 @@
SYSTEM_LOCK();
event = (EVENT *)K32OBJ_Create( K32OBJ_EVENT, sizeof(*event),
- name, &handle );
+ name, EVENT_ALL_ACCESS, &handle );
if (event)
{
/* Finish initializing it */
@@ -123,7 +123,7 @@
SYSTEM_LOCK();
if ((obj = K32OBJ_FindNameType( name, K32OBJ_EVENT )) != NULL)
{
- handle = PROCESS_AllocHandle( obj, 0 );
+ handle = HANDLE_Alloc( obj, access, inherit );
K32OBJ_DecCount( obj );
}
SYSTEM_UNLOCK();
@@ -150,7 +150,8 @@
{
EVENT *event;
SYSTEM_LOCK();
- if (!(event = (EVENT *)PROCESS_GetObjPtr( handle, K32OBJ_EVENT )))
+ if (!(event = (EVENT *)HANDLE_GetObjPtr( handle, K32OBJ_EVENT,
+ EVENT_MODIFY_STATE )))
{
SYSTEM_UNLOCK();
return FALSE;
@@ -171,7 +172,8 @@
{
EVENT *event;
SYSTEM_LOCK();
- if (!(event = (EVENT *)PROCESS_GetObjPtr( handle, K32OBJ_EVENT )))
+ if (!(event = (EVENT *)HANDLE_GetObjPtr( handle, K32OBJ_EVENT,
+ EVENT_MODIFY_STATE )))
{
SYSTEM_UNLOCK();
return FALSE;
@@ -191,7 +193,8 @@
{
EVENT *event;
SYSTEM_LOCK();
- if (!(event = (EVENT *)PROCESS_GetObjPtr( handle, K32OBJ_EVENT )))
+ if (!(event = (EVENT *)HANDLE_GetObjPtr( handle, K32OBJ_EVENT,
+ EVENT_MODIFY_STATE )))
{
SYSTEM_UNLOCK();
return FALSE;
diff --git a/scheduler/handle.c b/scheduler/handle.c
new file mode 100644
index 0000000..6c1d641
--- /dev/null
+++ b/scheduler/handle.c
@@ -0,0 +1,235 @@
+/*
+ * Win32 process handles
+ *
+ * Copyright 1998 Alexandre Julliard
+ */
+
+#include <assert.h>
+#include <stdio.h>
+#include "winbase.h"
+#include "winerror.h"
+#include "heap.h"
+#include "process.h"
+
+#define HTABLE_SIZE 0x30 /* Handle table initial size */
+#define HTABLE_INC 0x10 /* Handle table increment */
+
+/* Reserved access rights */
+#define RESERVED_ALL (0x0007 << RESERVED_SHIFT)
+#define RESERVED_SHIFT 25
+#define RESERVED_INHERIT (HANDLE_FLAG_INHERIT<<RESERVED_SHIFT)
+#define RESERVED_CLOSE_PROTECT (HANDLE_FLAG_PROTECT_FROM_CLOSE<<RESERVED_SHIFT)
+
+
+/***********************************************************************
+ * HANDLE_AllocTable
+ */
+HANDLE_TABLE *HANDLE_AllocTable( PDB32 *process )
+{
+ HANDLE_TABLE *table = HeapAlloc( process->system_heap, HEAP_ZERO_MEMORY,
+ sizeof(HANDLE_TABLE) +
+ (HTABLE_SIZE-1) * sizeof(HANDLE_ENTRY) );
+ if (!table) return NULL;
+ table->count = HTABLE_SIZE;
+ return table;
+}
+
+
+/***********************************************************************
+ * HANDLE_GrowTable
+ */
+static BOOL32 HANDLE_GrowTable( PDB32 *process )
+{
+ HANDLE_TABLE *table;
+
+ SYSTEM_LOCK();
+ table = process->handle_table;
+ table = HeapReAlloc( process->system_heap,
+ HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE, table,
+ sizeof(HANDLE_TABLE) +
+ (table->count+HTABLE_INC-1) * sizeof(HANDLE_ENTRY) );
+ if (table)
+ {
+ table->count += HTABLE_INC;
+ process->handle_table = table;
+ }
+ SYSTEM_UNLOCK();
+ return (table != NULL);
+}
+
+
+/***********************************************************************
+ * HANDLE_Alloc
+ *
+ * Allocate a handle for a kernel object and increment its refcount.
+ */
+HANDLE32 HANDLE_Alloc( K32OBJ *ptr, DWORD access, BOOL32 inherit )
+{
+ HANDLE32 h;
+ HANDLE_ENTRY *entry;
+ PDB32 *pdb = PROCESS_Current();
+
+ assert( ptr );
+
+ /* Set the inherit reserved flag */
+ access &= ~RESERVED_ALL;
+ if (inherit) access |= RESERVED_INHERIT;
+
+ SYSTEM_LOCK();
+ K32OBJ_IncCount( ptr );
+ entry = pdb->handle_table->entries;
+ for (h = 0; h < pdb->handle_table->count; h++, entry++)
+ if (!entry->ptr) break;
+ if ((h < pdb->handle_table->count) || HANDLE_GrowTable( pdb ))
+ {
+ entry = &pdb->handle_table->entries[h];
+ entry->access = access;
+ entry->ptr = ptr;
+ SYSTEM_UNLOCK();
+ return h + 1; /* Avoid handle 0 */
+ }
+ K32OBJ_DecCount( ptr );
+ SYSTEM_UNLOCK();
+ SetLastError( ERROR_OUTOFMEMORY );
+ return INVALID_HANDLE_VALUE32;
+}
+
+
+/***********************************************************************
+ * HANDLE_GetObjPtr
+ *
+ * Retrieve a pointer to a kernel object and increments its reference count.
+ * The refcount must be decremented when the pointer is no longer used.
+ */
+K32OBJ *HANDLE_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type, DWORD access )
+{
+ K32OBJ *ptr = NULL;
+ PDB32 *pdb = PROCESS_Current();
+
+ SYSTEM_LOCK();
+ if ((handle > 0) && (handle <= pdb->handle_table->count))
+ {
+ HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
+ if ((entry->access & access) != access)
+ fprintf( stderr, "Warning: handle %08x bad access (acc=%08lx req=%08lx)\n",
+ handle, entry->access, access );
+ ptr = entry->ptr;
+ if (ptr && ((type == K32OBJ_UNKNOWN) || (ptr->type == type)))
+ K32OBJ_IncCount( ptr );
+ else
+ ptr = NULL;
+ }
+ SYSTEM_UNLOCK();
+ if (!ptr) SetLastError( ERROR_INVALID_HANDLE );
+ return ptr;
+}
+
+
+/***********************************************************************
+ * HANDLE_SetObjPtr
+ *
+ * Change the object pointer of a handle, and increment the refcount.
+ * Use with caution!
+ */
+BOOL32 HANDLE_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD access )
+{
+ BOOL32 ret = FALSE;
+ PDB32 *pdb = PROCESS_Current();
+
+ SYSTEM_LOCK();
+ if ((handle > 0) && (handle <= pdb->handle_table->count))
+ {
+ HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
+ K32OBJ *old_ptr = entry->ptr;
+ K32OBJ_IncCount( ptr );
+ entry->access = access;
+ entry->ptr = ptr;
+ if (old_ptr) K32OBJ_DecCount( old_ptr );
+ ret = TRUE;
+ }
+ SYSTEM_UNLOCK();
+ if (!ret) SetLastError( ERROR_INVALID_HANDLE );
+ return ret;
+}
+
+
+/*********************************************************************
+ * CloseHandle (KERNEL32.23)
+ */
+BOOL32 WINAPI CloseHandle( HANDLE32 handle )
+{
+ BOOL32 ret = FALSE;
+ PDB32 *pdb = PROCESS_Current();
+ K32OBJ *ptr;
+
+ SYSTEM_LOCK();
+ if ((handle > 0) && (handle <= pdb->handle_table->count))
+ {
+ HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
+ if ((ptr = entry->ptr))
+ {
+ if (!(entry->access & RESERVED_CLOSE_PROTECT))
+ {
+ entry->access = 0;
+ entry->ptr = NULL;
+ K32OBJ_DecCount( ptr );
+ ret = TRUE;
+ }
+ /* FIXME: else SetLastError */
+ }
+ }
+ SYSTEM_UNLOCK();
+ if (!ret) SetLastError( ERROR_INVALID_HANDLE );
+ return ret;
+}
+
+
+/*********************************************************************
+ * GetHandleInformation (KERNEL32.336)
+ */
+BOOL32 WINAPI GetHandleInformation( HANDLE32 handle, LPDWORD flags )
+{
+ BOOL32 ret = FALSE;
+ PDB32 *pdb = PROCESS_Current();
+
+ SYSTEM_LOCK();
+ if ((handle > 0) && (handle <= pdb->handle_table->count))
+ {
+ HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
+ if (entry->ptr)
+ {
+ if (flags)
+ *flags = (entry->access & RESERVED_ALL) >> RESERVED_SHIFT;
+ ret = TRUE;
+ }
+ }
+ SYSTEM_UNLOCK();
+ if (!ret) SetLastError( ERROR_INVALID_HANDLE );
+ return ret;
+}
+
+
+/*********************************************************************
+ * SetHandleInformation (KERNEL32.653)
+ */
+BOOL32 WINAPI SetHandleInformation( HANDLE32 handle, DWORD mask, DWORD flags )
+{
+ BOOL32 ret = FALSE;
+ PDB32 *pdb = PROCESS_Current();
+
+ mask = (mask << RESERVED_SHIFT) & RESERVED_ALL;
+ flags = (flags << RESERVED_SHIFT) & RESERVED_ALL;
+ SYSTEM_LOCK();
+ if ((handle > 0) && (handle <= pdb->handle_table->count))
+ {
+ HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
+ if (entry->ptr)
+ {
+ entry->access = (entry->access & ~mask) | flags;
+ ret = TRUE;
+ }
+ }
+ SYSTEM_UNLOCK();
+ if (!ret) SetLastError( ERROR_INVALID_HANDLE );
+ return ret;
+}
diff --git a/scheduler/k32obj.c b/scheduler/k32obj.c
index c2589ce..c9fad71 100644
--- a/scheduler/k32obj.c
+++ b/scheduler/k32obj.c
@@ -20,6 +20,7 @@
extern const K32OBJ_OPS THREAD_Ops;
extern const K32OBJ_OPS FILE_Ops;
extern const K32OBJ_OPS MEM_MAPPED_FILE_Ops;
+extern const K32OBJ_OPS CONSOLE_Ops;
static const K32OBJ_OPS K32OBJ_NullOps =
{
@@ -41,7 +42,7 @@
&THREAD_Ops, /* K32OBJ_THREAD */
&FILE_Ops, /* K32OBJ_FILE */
&K32OBJ_NullOps, /* K32OBJ_CHANGE */
- &K32OBJ_NullOps, /* K32OBJ_CONSOLE */
+ &CONSOLE_Ops, /* K32OBJ_CONSOLE */
&K32OBJ_NullOps, /* K32OBJ_SCREEN_BUFFER */
&MEM_MAPPED_FILE_Ops, /* K32OBJ_MEM_MAPPED_FILE */
&K32OBJ_NullOps, /* K32OBJ_SERIAL */
@@ -159,7 +160,7 @@
* The refcount of the object must be decremented once it is initialized.
*/
K32OBJ *K32OBJ_Create( K32OBJ_TYPE type, DWORD size, LPCSTR name,
- HANDLE32 *handle )
+ DWORD access, HANDLE32 *handle )
{
/* Check if the name already exists */
@@ -169,7 +170,7 @@
if (obj->type == type)
{
SetLastError( ERROR_ALREADY_EXISTS );
- *handle = PROCESS_AllocHandle( obj, 0 );
+ *handle = HANDLE_Alloc( obj, access, FALSE );
}
else
{
@@ -206,7 +207,7 @@
/* Allocate a handle */
- *handle = PROCESS_AllocHandle( obj, 0 );
+ *handle = HANDLE_Alloc( obj, access, FALSE );
SYSTEM_UNLOCK();
return obj;
}
diff --git a/scheduler/mutex.c b/scheduler/mutex.c
index aebf9a6..b082976 100644
--- a/scheduler/mutex.c
+++ b/scheduler/mutex.c
@@ -84,7 +84,7 @@
SYSTEM_LOCK();
mutex = (MUTEX *)K32OBJ_Create( K32OBJ_MUTEX, sizeof(*mutex),
- name, &handle );
+ name, MUTEX_ALL_ACCESS, &handle );
if (mutex)
{
/* Finish initializing it */
@@ -138,7 +138,7 @@
SYSTEM_LOCK();
if ((obj = K32OBJ_FindNameType( name, K32OBJ_MUTEX )) != NULL)
{
- handle = PROCESS_AllocHandle( obj, 0 );
+ handle = HANDLE_Alloc( obj, access, inherit );
K32OBJ_DecCount( obj );
}
SYSTEM_UNLOCK();
@@ -165,7 +165,8 @@
{
MUTEX *mutex;
SYSTEM_LOCK();
- if (!(mutex = (MUTEX *)PROCESS_GetObjPtr( handle, K32OBJ_MUTEX )))
+ if (!(mutex = (MUTEX *)HANDLE_GetObjPtr( handle, K32OBJ_MUTEX,
+ MUTEX_MODIFY_STATE )))
{
SYSTEM_UNLOCK();
return FALSE;
diff --git a/scheduler/process.c b/scheduler/process.c
index aa44093..84a6bf24 100644
--- a/scheduler/process.c
+++ b/scheduler/process.c
@@ -18,8 +18,8 @@
#include "winerror.h"
#include "pe_image.h"
-#define HTABLE_SIZE 0x30 /* Handle table initial size */
-#define HTABLE_INC 0x10 /* Handle table increment */
+/* Process self-handle */
+#define PROCESS_SELF ((HANDLE32)0x7fffffff)
static BOOL32 PROCESS_Signaled( K32OBJ *obj, DWORD thread_id );
static BOOL32 PROCESS_Satisfied( K32OBJ *obj, DWORD thread_id );
@@ -38,42 +38,6 @@
/***********************************************************************
- * PROCESS_AllocHandleTable
- */
-static HANDLE_TABLE *PROCESS_AllocHandleTable( PDB32 *process )
-{
- HANDLE_TABLE *table = HeapAlloc( process->system_heap, HEAP_ZERO_MEMORY,
- sizeof(HANDLE_TABLE) +
- (HTABLE_SIZE-1) * sizeof(HANDLE_ENTRY) );
- if (!table) return NULL;
- table->count = HTABLE_SIZE;
- return table;
-}
-
-
-/***********************************************************************
- * PROCESS_GrowHandleTable
- */
-static BOOL32 PROCESS_GrowHandleTable( PDB32 *process )
-{
- HANDLE_TABLE *table;
- SYSTEM_LOCK();
- table = process->handle_table;
- table = HeapReAlloc( process->system_heap,
- HEAP_ZERO_MEMORY | HEAP_NO_SERIALIZE, table,
- sizeof(HANDLE_TABLE) +
- (table->count+HTABLE_INC-1) * sizeof(HANDLE_ENTRY) );
- if (table)
- {
- table->count += HTABLE_INC;
- process->handle_table = table;
- }
- SYSTEM_UNLOCK();
- return (table != NULL);
-}
-
-
-/***********************************************************************
* PROCESS_Current
*/
PDB32 *PROCESS_Current(void)
@@ -83,6 +47,25 @@
/***********************************************************************
+ * PROCESS_GetPtr
+ *
+ * Get a process from a handle, incrementing the PDB refcount.
+ */
+PDB32 *PROCESS_GetPtr( HANDLE32 handle, DWORD access )
+{
+ PDB32 *pdb;
+
+ if (handle == PROCESS_SELF)
+ {
+ pdb = PROCESS_Current();
+ K32OBJ_IncCount( &pdb->header );
+ return pdb;
+ }
+ return (PDB32 *)HANDLE_GetObjPtr( handle, K32OBJ_PROCESS, access );
+}
+
+
+/***********************************************************************
* PROCESS_IdToPDB
*
* Convert a process id to a PDB, making sure it is valid.
@@ -102,124 +85,6 @@
}
-/***********************************************************************
- * PROCESS_AllocHandle
- *
- * Allocate a handle for a kernel object and increment its refcount.
- */
-HANDLE32 PROCESS_AllocHandle( K32OBJ *ptr, DWORD flags )
-{
- HANDLE32 h;
- HANDLE_ENTRY *entry;
- PDB32 *pdb = PROCESS_Current();
-
- assert( ptr );
- SYSTEM_LOCK();
- K32OBJ_IncCount( ptr );
- entry = pdb->handle_table->entries;
- for (h = 0; h < pdb->handle_table->count; h++, entry++)
- if (!entry->ptr) break;
- if ((h < pdb->handle_table->count) || PROCESS_GrowHandleTable( pdb ))
- {
- entry = &pdb->handle_table->entries[h];
- entry->flags = flags;
- entry->ptr = ptr;
- SYSTEM_UNLOCK();
- return h + 1; /* Avoid handle 0 */
- }
- K32OBJ_DecCount( ptr );
- SYSTEM_UNLOCK();
- SetLastError( ERROR_OUTOFMEMORY );
- return INVALID_HANDLE_VALUE32;
-}
-
-
-/***********************************************************************
- * PROCESS_GetObjPtr
- *
- * Retrieve a pointer to a kernel object and increments its reference count.
- * The refcount must be decremented when the pointer is no longer used.
- */
-K32OBJ *PROCESS_GetObjPtr( HANDLE32 handle, K32OBJ_TYPE type )
-{
- K32OBJ *ptr = NULL;
- PDB32 *pdb = PROCESS_Current();
-
- SYSTEM_LOCK();
-
- if ((handle > 0) && (handle <= pdb->handle_table->count))
- ptr = pdb->handle_table->entries[handle - 1].ptr;
- else if (handle == 0x7fffffff) ptr = &pdb->header;
-
- if (ptr && ((type == K32OBJ_UNKNOWN) || (ptr->type == type)))
- K32OBJ_IncCount( ptr );
- else ptr = NULL;
-
- SYSTEM_UNLOCK();
- if (!ptr) SetLastError( ERROR_INVALID_HANDLE );
- return ptr;
-}
-
-
-/***********************************************************************
- * PROCESS_SetObjPtr
- *
- * Change the object pointer of a handle, and increment the refcount.
- * Use with caution!
- */
-BOOL32 PROCESS_SetObjPtr( HANDLE32 handle, K32OBJ *ptr, DWORD flags )
-{
- BOOL32 ret = TRUE;
- K32OBJ *old_ptr = NULL;
- PDB32 *pdb = PROCESS_Current();
-
- SYSTEM_LOCK();
- if ((handle > 0) && (handle <= pdb->handle_table->count))
- {
- HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
- old_ptr = entry->ptr;
- K32OBJ_IncCount( ptr );
- entry->flags = flags;
- entry->ptr = ptr;
- }
- else
- {
- SetLastError( ERROR_INVALID_HANDLE );
- ret = FALSE;
- }
- if (old_ptr) K32OBJ_DecCount( old_ptr );
- SYSTEM_UNLOCK();
- return ret;
-}
-
-
-/*********************************************************************
- * CloseHandle (KERNEL32.23)
- */
-BOOL32 WINAPI CloseHandle( HANDLE32 handle )
-{
- BOOL32 ret = FALSE;
- K32OBJ *ptr = NULL;
- PDB32 *pdb = PROCESS_Current();
-
- SYSTEM_LOCK();
- if ((handle > 0) && (handle <= pdb->handle_table->count))
- {
- HANDLE_ENTRY *entry = &pdb->handle_table->entries[handle-1];
- if ((ptr = entry->ptr))
- {
- entry->flags = 0;
- entry->ptr = NULL;
- ret = TRUE;
- }
- }
- if (ptr) K32OBJ_DecCount( ptr );
- SYSTEM_UNLOCK();
- if (!ret) SetLastError( ERROR_INVALID_HANDLE );
- return ret;
-}
-
-
static int pstr_cmp( const void *ps1, const void *ps2 )
{
return lstrcmpi32A( *(LPSTR *)ps1, *(LPSTR *)ps2 );
@@ -265,7 +130,6 @@
if (!(pdb->env_db->cmd_line =
HEAP_strdupA( pdb->heap, 0, cmd_line + (unsigned char)cmd_line[0] + 2)))
goto error;
-
return TRUE;
error:
@@ -284,7 +148,7 @@
static void PROCESS_FreePDB( PDB32 *pdb )
{
pdb->header.type = K32OBJ_UNKNOWN;
- if (pdb->heap) HeapDestroy( pdb->heap );
+ if (pdb->heap && (pdb->heap != pdb->system_heap)) HeapDestroy( pdb->heap );
if (pdb->handle_table) HeapFree( pdb->system_heap, 0, pdb->handle_table );
if (pdb->load_done_evt) K32OBJ_DecCount( pdb->load_done_evt );
if (pdb->event) K32OBJ_DecCount( pdb->event );
@@ -313,6 +177,7 @@
pdb->parent = parent;
pdb->group = pdb;
pdb->priority = 8; /* Normal */
+ pdb->heap = pdb->system_heap; /* will be changed later on */
InitializeCriticalSection( &pdb->crit_section );
@@ -323,7 +188,7 @@
/* Allocate the handle table */
- if (!(pdb->handle_table = PROCESS_AllocHandleTable( pdb ))) goto error;
+ if (!(pdb->handle_table = HANDLE_AllocTable( pdb ))) goto error;
return pdb;
error:
@@ -337,12 +202,22 @@
*/
BOOL32 PROCESS_Init(void)
{
+ extern BOOL32 VIRTUAL_Init(void);
PDB32 *pdb;
THDB *thdb;
+ /* Initialize virtual memory management */
+ if (!VIRTUAL_Init()) return FALSE;
+
+ /* Create the system and SEGPTR heaps */
+ if (!(SystemHeap = HeapCreate( HEAP_GROWABLE, 0x10000, 0 ))) return FALSE;
+ if (!(SegptrHeap = HeapCreate( HEAP_WINE_SEGPTR, 0, 0 ))) return FALSE;
+
+ /* Create the initial process and thread structures */
if (!(pdb = PROCESS_CreatePDB( NULL ))) return FALSE;
if (!(thdb = THREAD_Create( pdb, 0, NULL, NULL ))) return FALSE;
SET_CUR_THREAD( thdb );
+
return TRUE;
}
@@ -495,7 +370,7 @@
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
- return PROCESS_AllocHandle( &pdb->header, 0 );
+ return HANDLE_Alloc( &pdb->header, access, inherit );
}
@@ -805,9 +680,7 @@
*/
BOOL32 WINAPI SetPriorityClass( HANDLE32 hprocess, DWORD priorityclass )
{
- PDB32 *pdb;
-
- pdb = (PDB32*)PROCESS_GetObjPtr(hprocess,K32OBJ_PROCESS);
+ PDB32 *pdb = PROCESS_GetPtr( hprocess, PROCESS_SET_INFORMATION );
if (!pdb) return FALSE;
switch (priorityclass)
{
@@ -827,7 +700,7 @@
fprintf(stderr,"SetPriorityClass: unknown priority class %ld\n",priorityclass);
break;
}
- K32OBJ_DecCount((K32OBJ*)pdb);
+ K32OBJ_DecCount( &pdb->header );
return TRUE;
}
@@ -837,11 +710,8 @@
*/
DWORD WINAPI GetPriorityClass(HANDLE32 hprocess)
{
- PDB32 *pdb;
- DWORD ret;
-
- pdb = (PDB32*)PROCESS_GetObjPtr(hprocess,K32OBJ_PROCESS);
- ret = 0;
+ PDB32 *pdb = PROCESS_GetPtr( hprocess, PROCESS_QUERY_INFORMATION );
+ DWORD ret = 0;
if (pdb)
{
switch (pdb->priority)
@@ -861,7 +731,7 @@
default:
fprintf(stderr,"GetPriorityClass: unknown priority %ld\n",pdb->priority);
}
- K32OBJ_DecCount((K32OBJ*)pdb);
+ K32OBJ_DecCount( &pdb->header );
}
return ret;
}
@@ -918,6 +788,7 @@
BOOL32 WINAPI SetStdHandle( DWORD std_handle, HANDLE32 handle )
{
PDB32 *pdb = PROCESS_Current();
+ /* FIXME: should we close the previous handle? */
switch(std_handle)
{
case STD_INPUT_HANDLE:
diff --git a/scheduler/semaphore.c b/scheduler/semaphore.c
index d6cfd49..19160fd 100644
--- a/scheduler/semaphore.c
+++ b/scheduler/semaphore.c
@@ -55,7 +55,7 @@
SYSTEM_LOCK();
sem = (SEMAPHORE *)K32OBJ_Create( K32OBJ_SEMAPHORE, sizeof(*sem),
- name, &handle );
+ name, SEMAPHORE_ALL_ACCESS, &handle );
if (sem)
{
/* Finish initializing it */
@@ -92,7 +92,7 @@
SYSTEM_LOCK();
if ((obj = K32OBJ_FindNameType( name, K32OBJ_SEMAPHORE )) != NULL)
{
- handle = PROCESS_AllocHandle( obj, 0 );
+ handle = HANDLE_Alloc( obj, access, inherit );
K32OBJ_DecCount( obj );
}
SYSTEM_UNLOCK();
@@ -120,7 +120,8 @@
SEMAPHORE *sem;
SYSTEM_LOCK();
- if (!(sem = (SEMAPHORE *)PROCESS_GetObjPtr( handle, K32OBJ_SEMAPHORE )))
+ if (!(sem = (SEMAPHORE *)HANDLE_GetObjPtr( handle, K32OBJ_SEMAPHORE,
+ SEMAPHORE_MODIFY_STATE )))
{
SYSTEM_UNLOCK();
return FALSE;
diff --git a/scheduler/synchro.c b/scheduler/synchro.c
index 8577992..4195fc2 100644
--- a/scheduler/synchro.c
+++ b/scheduler/synchro.c
@@ -32,7 +32,8 @@
SYSTEM_LOCK();
for (i = 0, ptr = wait->objs; i < count; i++, ptr++)
{
- if (!(*ptr = PROCESS_GetObjPtr( handles[i], K32OBJ_UNKNOWN )))
+ if (!(*ptr = HANDLE_GetObjPtr( handles[i], K32OBJ_UNKNOWN,
+ SYNCHRONIZE )))
break;
if (!K32OBJ_OPS( *ptr )->signaled)
{
diff --git a/scheduler/sysdeps.c b/scheduler/sysdeps.c
index 92cf811..e020953 100644
--- a/scheduler/sysdeps.c
+++ b/scheduler/sysdeps.c
@@ -4,23 +4,25 @@
* Copyright 1998 Alexandre Julliard
*/
-#define NO_REENTRANT_X11
-
-#ifdef NO_REENTRANT_X11
/* Get pointers to the static errno and h_errno variables used by Xlib. This
must be done before including <errno.h> makes the variables invisible. */
extern int errno;
static int *perrno = &errno;
extern int h_errno;
static int *ph_errno = &h_errno;
-#endif
#include <signal.h>
#include <stdio.h>
#include <unistd.h>
#include "thread.h"
+#include "winbase.h"
+
+/* FIXME: X libs compiled w/o -D_REENTRANT should be detected by autoconf. */
+#define NO_REENTRANT_X11
+
#ifdef NO_REENTRANT_X11
-#include "tsx11defs.h"
+/* Xlib critical section (FIXME: does not belong here) */
+CRITICAL_SECTION X11DRV_CritSection = { 0, };
#endif
#ifdef __linux__
@@ -47,15 +49,13 @@
*/
int *__errno_location()
{
- static int static_errno;
THDB *thdb = THREAD_Current();
+ if (!thdb) return perrno;
#ifdef NO_REENTRANT_X11
/* Use static libc errno while running in Xlib. */
- if (TSX11_SectionPtr &&
- (TSX11_SectionPtr->OwningThread == THDB_TO_THREAD_ID(thdb)))
+ if (X11DRV_CritSection.OwningThread == THDB_TO_THREAD_ID(thdb))
return perrno;
#endif
- if (!thdb) return &static_errno;
return &thdb->thread_errno;
}
@@ -66,15 +66,13 @@
*/
int *__h_errno_location()
{
- static int static_h_errno;
THDB *thdb = THREAD_Current();
+ if (!thdb) return ph_errno;
#ifdef NO_REENTRANT_X11
/* Use static libc h_errno while running in Xlib. */
- if (TSX11_SectionPtr &&
- (TSX11_SectionPtr->OwningThread == THDB_TO_THREAD_ID(thdb)))
+ if (X11DRV_CritSection.OwningThread == THDB_TO_THREAD_ID(thdb))
return ph_errno;
#endif
- if (!thdb) return &static_h_errno;
return &thdb->thread_h_errno;
}
@@ -133,8 +131,9 @@
WORD ds, fs;
/* Check if we have a current thread */
- GET_DS( ds );
GET_FS( fs );
+ if (!fs) return NULL;
+ GET_DS( ds );
if (fs == ds) return NULL; /* FIXME: should be an assert */
/* Get the TEB self-pointer */
__asm__( ".byte 0x64\n\tmovl (%1),%0"
diff --git a/scheduler/thread.c b/scheduler/thread.c
index 2629419..023f93d 100644
--- a/scheduler/thread.c
+++ b/scheduler/thread.c
@@ -44,7 +44,7 @@
* Return a pointer to a thread object. The object count must be decremented
* when no longer used.
*/
-static THDB *THREAD_GetPtr( HANDLE32 handle )
+THDB *THREAD_GetPtr( HANDLE32 handle, DWORD access )
{
THDB *thread;
@@ -53,7 +53,7 @@
thread = THREAD_Current();
K32OBJ_IncCount( &thread->header );
}
- else thread = (THDB *)PROCESS_GetObjPtr( handle, K32OBJ_THREAD );
+ else thread = (THDB *)HANDLE_GetObjPtr( handle, K32OBJ_THREAD, access );
return thread;
}
@@ -287,7 +287,7 @@
HANDLE32 handle;
THDB *thread = THREAD_Create( PROCESS_Current(), stack, start, param );
if (!thread) return INVALID_HANDLE_VALUE32;
- handle = PROCESS_AllocHandle( &thread->header, 0 );
+ handle = HANDLE_Alloc( &thread->header, THREAD_ALL_ACCESS, FALSE );
if (handle == INVALID_HANDLE_VALUE32) goto error;
if (SYSDEPS_SpawnThread( thread ) == -1) goto error;
*id = THDB_TO_THREAD_ID( thread );
@@ -470,7 +470,7 @@
*/
BOOL32 WINAPI GetThreadContext( HANDLE32 handle, CONTEXT *context )
{
- THDB *thread = THREAD_GetPtr( handle );
+ THDB *thread = THREAD_GetPtr( handle, THREAD_GET_CONTEXT );
if (!thread) return FALSE;
*context = thread->context;
K32OBJ_DecCount( &thread->header );
@@ -486,7 +486,8 @@
THDB *thread;
INT32 ret;
- if (!(thread = THREAD_GetPtr( hthread ))) return 0;
+ if (!(thread = THREAD_GetPtr( hthread, THREAD_QUERY_INFORMATION )))
+ return 0;
ret = thread->delta_priority;
K32OBJ_DecCount( &thread->header );
return ret;
@@ -500,7 +501,8 @@
{
THDB *thread;
- if (!(thread = THREAD_GetPtr( hthread ))) return FALSE;
+ if (!(thread = THREAD_GetPtr( hthread, THREAD_SET_INFORMATION )))
+ return FALSE;
thread->delta_priority = priority;
K32OBJ_DecCount( &thread->header );
return TRUE;
@@ -522,7 +524,8 @@
{
THDB *thread;
- if (!(thread = THREAD_GetPtr( hthread ))) return FALSE;
+ if (!(thread = THREAD_GetPtr( hthread, THREAD_QUERY_INFORMATION )))
+ return FALSE;
if (exitcode) *exitcode = thread->exit_code;
K32OBJ_DecCount( &thread->header );
return TRUE;
diff --git a/tools/build.c b/tools/build.c
index 93a97d7..34995d2 100644
--- a/tools/build.c
+++ b/tools/build.c
@@ -362,12 +362,6 @@
SpecName, Line );
return -1;
}
- if (odp->type == TYPE_CDECL)
- {
- fprintf( stderr, "%s:%d: 'cdecl' not supported for Win16\n",
- SpecName, Line );
- return -1;
- }
break;
case SPEC_WIN32:
if ((odp->type == TYPE_PASCAL) || (odp->type == TYPE_PASCAL_16))
@@ -918,6 +912,7 @@
switch (odp->type)
{
+ case TYPE_CDECL:
case TYPE_PASCAL:
case TYPE_PASCAL_16:
case TYPE_REGISTER:
@@ -1209,6 +1204,7 @@
break;
case TYPE_REGISTER:
+ case TYPE_CDECL:
case TYPE_PASCAL:
case TYPE_PASCAL_16:
case TYPE_STUB:
@@ -1217,9 +1213,10 @@
fprintf( outfile, "\tpushl $" PREFIX "%s\n",odp->u.func.link_name);
/* FreeBSD does not understand lcall, so do it the hard way */
fprintf( outfile, "\t.byte 0x9a\n" );
- fprintf( outfile, "\t.long " PREFIX "CallFrom16_%s_%s\n",
+ fprintf( outfile, "\t.long " PREFIX "CallFrom16_%s_%s_%s\n",
+ (odp->type == TYPE_CDECL) ? "c" : "p",
(odp->type == TYPE_REGISTER) ? "regs" :
- (odp->type == TYPE_PASCAL) ? "long" : "word",
+ (odp->type == TYPE_PASCAL_16) ? "word" : "long",
odp->u.func.arg_types );
fprintf( outfile, "\t.long 0x%08lx\n",
MAKELONG( Code_Selector, 0x9090 /* nop ; nop */ ) );
@@ -1305,19 +1302,21 @@
* (bp+4) cs
* (bp+2) ip
* (bp) bp
+ *
+ * For 'cdecl' argn up to arg1 are reversed.
*/
-static int TransferArgs16To32( FILE *outfile, char *args )
+static int TransferArgs16To32( FILE *outfile, char *args, int usecdecl )
{
int i, pos16, pos32;
/* Copy the arguments */
pos16 = 6; /* skip bp and return address */
- pos32 = 0;
+ pos32 = usecdecl ? -(strlen(args) * 4) : 0;
for (i = strlen(args); i > 0; i--)
{
- pos32 -= 4;
+ if (!usecdecl) pos32 -= 4;
switch(args[i-1])
{
case 'w': /* word */
@@ -1356,6 +1355,7 @@
default:
fprintf( stderr, "Unknown arg type '%c'\n", args[i-1] );
}
+ if (usecdecl) pos32 += 4;
}
return pos16 - 6; /* Return the size of the 16-bit args */
@@ -1400,6 +1400,9 @@
fprintf( outfile, "\tmovzwl 2(%%ebp),%%eax\n" ); /* Get %ip from stack */
fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
CONTEXTOFFSET(Eip) - sizeof(CONTEXT) );
+ fprintf( outfile, "\tleal 2(%%ebp),%%eax\n" ); /* Get initial %sp */
+ fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
+ CONTEXTOFFSET(Esp) - sizeof(CONTEXT) );
fprintf( outfile, "\tmovzwl 4(%%ebp),%%eax\n" ); /* Get %cs from stack */
fprintf( outfile, "\tmovl %%eax,%d(%%ebx)\n",
CONTEXTOFFSET(SegCs) - sizeof(CONTEXT) );
@@ -1423,7 +1426,6 @@
* RestoreContext16
*
* Restore the registers from the context structure.
- * %edx must point to the 32-bit stack top.
*/
static void RestoreContext16( FILE *outfile )
{
@@ -1432,9 +1434,15 @@
fprintf( outfile, "\tleal -%d(%%ebp),%%ebx\n",
STRUCTOFFSET(STACK32FRAME,ebp) );
- /* Remove everything up to the return address from the 16-bit stack */
+ /* Remove everything up to (including) the return address
+ * from the 16-bit stack */
- fprintf( outfile, "\taddl $22,%%esp\n" );
+ fprintf( outfile, "\tmovl %d(%%ebx),%%eax\n",
+ CONTEXTOFFSET(SegSs) - sizeof(CONTEXT) );
+ fprintf( outfile, "\tmovw %%ax,%%ss\n" );
+ fprintf( outfile, "\tmovl %d(%%ebx),%%esp\n",
+ CONTEXTOFFSET(Esp) - sizeof(CONTEXT) );
+ fprintf( outfile, "\taddl $4,%%esp\n" ); /* Remove return address */
/* Restore the registers */
@@ -1472,7 +1480,8 @@
* BuildCallFrom16Func
*
* Build a 16-bit-to-Wine callback function. The syntax of the function
- * profile is: type_xxxxx, where 'type' is one of 'regs', 'word' or
+ * profile is: call_type_xxxxx, where 'call' is the letter 'c' or 'p' for C or
+ * Pascal calling convention, 'type' is one of 'regs', 'word' or
* 'long' and each 'x' is an argument ('w'=word, 's'=signed word,
* 'l'=long, 'p'=linear pointer, 't'=linear pointer to null-terminated string,
* 'T'=segmented pointer to null-terminated string).
@@ -1500,13 +1509,21 @@
int argsize = 0;
int short_ret = 0;
int reg_func = 0;
- char *args = profile + 5;
+ int cdecl = 0;
+ char *args = profile + 7;
/* Parse function type */
- if (!strncmp( "word_", profile, 5 )) short_ret = 1;
- else if (!strncmp( "regs_", profile, 5 )) reg_func = 1;
- else if (strncmp( "long_", profile, 5 ))
+ if (!strncmp( "c_", profile, 2 )) cdecl = 1;
+ else if (strncmp( "p_", profile, 2 ))
+ {
+ fprintf( stderr, "Invalid function name '%s', ignored\n", profile );
+ return;
+ }
+
+ if (!strncmp( "word_", profile + 2, 5 )) short_ret = 1;
+ else if (!strncmp( "regs_", profile + 2, 5 )) reg_func = 1;
+ else if (strncmp( "long_", profile + 2, 5 ))
{
fprintf( stderr, "Invalid function name '%s', ignored\n", profile );
return;
@@ -1568,7 +1585,7 @@
/* Transfer the arguments */
if (reg_func) BuildContext16( outfile );
- else if (*args) argsize = TransferArgs16To32( outfile, args );
+ else if (*args) argsize = TransferArgs16To32( outfile, args, cdecl );
/* Get the address of the API function */
@@ -1602,9 +1619,15 @@
if (debugging)
{
+ int ftype = 0;
+
+ if (cdecl) ftype |= 4;
+ if (reg_func) ftype |= 2;
+ if (short_ret) ftype |= 1;
+
fprintf( outfile, "\tpushl %%eax\n" );
fprintf( outfile, "\tpushl $Profile_%s\n", profile );
- fprintf( outfile, "\tpushl $%d\n", reg_func ? 2 : (short_ret ? 1 : 0));
+ fprintf( outfile, "\tpushl $%d\n", ftype );
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom16\n" );
fprintf( outfile, "\tpopl %%eax\n" );
fprintf( outfile, "\tpopl %%eax\n" );
@@ -1698,7 +1721,7 @@
/* Remove the arguments and return */
- if (argsize)
+ if (argsize && !cdecl)
{
fprintf( outfile, "\t.byte 0x66\n" );
fprintf( outfile, "\tlret $%d\n", argsize );
@@ -2212,7 +2235,7 @@
for (i = 2; i < argc; i++)
{
fprintf( outfile, "Profile_%s:\t", argv[i] );
- fprintf( outfile, STRING " \"%s\\0\"\n", argv[i] + 5 );
+ fprintf( outfile, STRING " \"%s\\0\"\n", argv[i] + 7 );
}
}
diff --git a/tools/make_X11wrappers b/tools/make_X11wrappers
index 8dffbb3..0f2db0b 100755
--- a/tools/make_X11wrappers
+++ b/tools/make_X11wrappers
@@ -73,12 +73,11 @@
/*
* Thread safe wrappers around $name calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
$x11_incl#include <X11/$extensions_dir$name.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
END
@@ -214,11 +213,11 @@
print OUTC "{\n";
print OUTC " $resultdecl;\n" if $resultdecl;
print OUTC " dprintf_x11(stddeb, \"Call $fn_name\\n\");\n";
- print OUTC " X11_LOCK();\n";
+ print OUTC " EnterCriticalSection( &X11DRV_CritSection );\n";
print OUTC " ";
print OUTC "r = " if $resultdecl;
print OUTC "$fn_name($actuals);\n";
- print OUTC " X11_UNLOCK();\n";
+ print OUTC " LeaveCriticalSection( &X11DRV_CritSection );\n";
print OUTC " dprintf_x11(stddeb, \"Ret $fn_name\\n\");\n";
print OUTC " return r;\n" if $resultdecl;
print OUTC "}\n";
diff --git a/tsx11/Makefile.in b/tsx11/Makefile.in
index 4f935a1..2f20d13 100644
--- a/tsx11/Makefile.in
+++ b/tsx11/Makefile.in
@@ -10,8 +10,7 @@
ts_xlib.c \
ts_xresource.c \
ts_xutil.c \
- ts_xpm.c \
- tsx11defs.c
+ ts_xpm.c
all: $(MODULE).o
diff --git a/tsx11/X11_calls b/tsx11/X11_calls
index 4b442df..856ddf7 100644
--- a/tsx11/X11_calls
+++ b/tsx11/X11_calls
@@ -2,7 +2,7 @@
# protected by a critical section for multi-threaded use.
#
# To add a new call, put it on this list and run tools/make_X11wrappers.
-# Also read the comments at the top of tools_make_X11wrappers.
+# Also read the comments at the top of tools/make_X11wrappers.
#
XActivateScreenSaver
XAddPixel
@@ -53,6 +53,7 @@
XFindContext
XFlush
XFree
+XFreeColormap
XFreeColors
XFreeCursor
XFreeFont
@@ -68,9 +69,9 @@
XGetKeyboardControl
XGetKeyboardMapping
XGetModifierMapping
-XGetPixel
XGetScreenSaver
XGetSelectionOwner
+XGetVisualInfo
XGetWMSizeHints
XGetWindowAttributes
XGetWindowProperty
@@ -98,7 +99,6 @@
XPolygonRegion
XPutBackEvent
XPutImage
-XPutPixel
XQueryColor
XQueryPointer
XQueryTree
diff --git a/tsx11/ts_xlib.c b/tsx11/ts_xlib.c
index 6ae7f4f..765e52d 100644
--- a/tsx11/ts_xlib.c
+++ b/tsx11/ts_xlib.c
@@ -1,12 +1,11 @@
/*
* Thread safe wrappers around Xlib calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
#include <X11/Xlib.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
@@ -14,9 +13,9 @@
{
XFontStruct * r;
dprintf_x11(stddeb, "Call XLoadQueryFont\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XLoadQueryFont(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XLoadQueryFont\n");
return r;
}
@@ -25,9 +24,9 @@
{
XModifierKeymap * r;
dprintf_x11(stddeb, "Call XGetModifierMapping\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetModifierMapping(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetModifierMapping\n");
return r;
}
@@ -36,9 +35,9 @@
{
XImage * r;
dprintf_x11(stddeb, "Call XCreateImage\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateImage(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateImage\n");
return r;
}
@@ -47,9 +46,9 @@
{
XImage * r;
dprintf_x11(stddeb, "Call XGetImage\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetImage(a0, a1, a2, a3, a4, a5, a6, a7);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetImage\n");
return r;
}
@@ -58,9 +57,9 @@
{
Display * r;
dprintf_x11(stddeb, "Call XOpenDisplay\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XOpenDisplay(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XOpenDisplay\n");
return r;
}
@@ -68,9 +67,9 @@
void TSXrmInitialize(void)
{
dprintf_x11(stddeb, "Call XrmInitialize\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
XrmInitialize();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmInitialize\n");
}
@@ -78,9 +77,9 @@
{
char * r;
dprintf_x11(stddeb, "Call XGetAtomName\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetAtomName(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetAtomName\n");
return r;
}
@@ -89,9 +88,9 @@
{
char * r;
dprintf_x11(stddeb, "Call XKeysymToString\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XKeysymToString(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XKeysymToString\n");
return r;
}
@@ -100,9 +99,9 @@
{
Atom r;
dprintf_x11(stddeb, "Call XInternAtom\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XInternAtom(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XInternAtom\n");
return r;
}
@@ -111,9 +110,9 @@
{
Colormap r;
dprintf_x11(stddeb, "Call XCreateColormap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateColormap(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateColormap\n");
return r;
}
@@ -122,9 +121,9 @@
{
Cursor r;
dprintf_x11(stddeb, "Call XCreatePixmapCursor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreatePixmapCursor(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreatePixmapCursor\n");
return r;
}
@@ -133,9 +132,9 @@
{
Cursor r;
dprintf_x11(stddeb, "Call XCreateFontCursor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateFontCursor(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateFontCursor\n");
return r;
}
@@ -144,9 +143,9 @@
{
GC r;
dprintf_x11(stddeb, "Call XCreateGC\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateGC(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateGC\n");
return r;
}
@@ -155,9 +154,9 @@
{
Pixmap r;
dprintf_x11(stddeb, "Call XCreatePixmap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreatePixmap(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreatePixmap\n");
return r;
}
@@ -166,9 +165,9 @@
{
Pixmap r;
dprintf_x11(stddeb, "Call XCreateBitmapFromData\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateBitmapFromData(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateBitmapFromData\n");
return r;
}
@@ -177,9 +176,9 @@
{
Window r;
dprintf_x11(stddeb, "Call XGetSelectionOwner\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetSelectionOwner(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetSelectionOwner\n");
return r;
}
@@ -188,9 +187,9 @@
{
Window r;
dprintf_x11(stddeb, "Call XCreateWindow\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateWindow(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateWindow\n");
return r;
}
@@ -199,9 +198,9 @@
{
char ** r;
dprintf_x11(stddeb, "Call XListFonts\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XListFonts(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XListFonts\n");
return r;
}
@@ -210,9 +209,9 @@
{
KeySym r;
dprintf_x11(stddeb, "Call XKeycodeToKeysym\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XKeycodeToKeysym(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XKeycodeToKeysym\n");
return r;
}
@@ -221,9 +220,9 @@
{
KeySym r;
dprintf_x11(stddeb, "Call XLookupKeysym\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XLookupKeysym(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XLookupKeysym\n");
return r;
}
@@ -232,9 +231,9 @@
{
KeySym * r;
dprintf_x11(stddeb, "Call XGetKeyboardMapping\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetKeyboardMapping(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetKeyboardMapping\n");
return r;
}
@@ -243,9 +242,9 @@
{
char * r;
dprintf_x11(stddeb, "Call XResourceManagerString\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XResourceManagerString(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XResourceManagerString\n");
return r;
}
@@ -254,9 +253,9 @@
{
int r;
dprintf_x11(stddeb, "Call XInitThreads\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XInitThreads();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XInitThreads\n");
return r;
}
@@ -265,9 +264,9 @@
{
int * r;
dprintf_x11(stddeb, "Call XListDepths\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XListDepths(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XListDepths\n");
return r;
}
@@ -276,9 +275,9 @@
{
int r;
dprintf_x11(stddeb, "Call XReconfigureWMWindow\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XReconfigureWMWindow(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XReconfigureWMWindow\n");
return r;
}
@@ -287,9 +286,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetWMProtocols\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetWMProtocols(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetWMProtocols\n");
return r;
}
@@ -298,9 +297,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetTransientForHint\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetTransientForHint(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetTransientForHint\n");
return r;
}
@@ -309,9 +308,9 @@
{
int r;
dprintf_x11(stddeb, "Call XActivateScreenSaver\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XActivateScreenSaver(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XActivateScreenSaver\n");
return r;
}
@@ -320,9 +319,9 @@
{
int r;
dprintf_x11(stddeb, "Call XAllocColor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAllocColor(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAllocColor\n");
return r;
}
@@ -331,9 +330,9 @@
{
int r;
dprintf_x11(stddeb, "Call XAllocColorCells\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAllocColorCells(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAllocColorCells\n");
return r;
}
@@ -342,9 +341,9 @@
{
int r;
dprintf_x11(stddeb, "Call XBell\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XBell(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XBell\n");
return r;
}
@@ -353,9 +352,9 @@
{
int r;
dprintf_x11(stddeb, "Call XChangeGC\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XChangeGC(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XChangeGC\n");
return r;
}
@@ -364,9 +363,9 @@
{
int r;
dprintf_x11(stddeb, "Call XChangeKeyboardControl\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XChangeKeyboardControl(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XChangeKeyboardControl\n");
return r;
}
@@ -375,9 +374,9 @@
{
int r;
dprintf_x11(stddeb, "Call XChangeProperty\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XChangeProperty(a0, a1, a2, a3, a4, a5, a6, a7);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XChangeProperty\n");
return r;
}
@@ -386,9 +385,9 @@
{
int r;
dprintf_x11(stddeb, "Call XChangeWindowAttributes\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XChangeWindowAttributes(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XChangeWindowAttributes\n");
return r;
}
@@ -397,9 +396,9 @@
{
int r;
dprintf_x11(stddeb, "Call XCheckTypedWindowEvent\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCheckTypedWindowEvent(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCheckTypedWindowEvent\n");
return r;
}
@@ -408,9 +407,9 @@
{
int r;
dprintf_x11(stddeb, "Call XCheckWindowEvent\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCheckWindowEvent(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCheckWindowEvent\n");
return r;
}
@@ -419,9 +418,9 @@
{
int r;
dprintf_x11(stddeb, "Call XConvertSelection\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XConvertSelection(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XConvertSelection\n");
return r;
}
@@ -430,9 +429,9 @@
{
int r;
dprintf_x11(stddeb, "Call XCopyArea\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCopyArea(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCopyArea\n");
return r;
}
@@ -441,9 +440,9 @@
{
int r;
dprintf_x11(stddeb, "Call XCopyPlane\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCopyPlane(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCopyPlane\n");
return r;
}
@@ -452,9 +451,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDefineCursor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDefineCursor(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDefineCursor\n");
return r;
}
@@ -463,9 +462,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDestroyWindow\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDestroyWindow(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDestroyWindow\n");
return r;
}
@@ -474,9 +473,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDisplayKeycodes\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDisplayKeycodes(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDisplayKeycodes\n");
return r;
}
@@ -485,9 +484,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawArc\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawArc(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawArc\n");
return r;
}
@@ -496,9 +495,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawLine\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawLine(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawLine\n");
return r;
}
@@ -507,9 +506,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawLines\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawLines(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawLines\n");
return r;
}
@@ -518,9 +517,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawPoint\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawPoint(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawPoint\n");
return r;
}
@@ -529,9 +528,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawRectangle\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawRectangle(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawRectangle\n");
return r;
}
@@ -540,9 +539,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawSegments\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawSegments(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawSegments\n");
return r;
}
@@ -551,9 +550,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawString\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawString(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawString\n");
return r;
}
@@ -562,9 +561,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDrawText\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDrawText(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDrawText\n");
return r;
}
@@ -573,9 +572,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFillArc\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFillArc(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFillArc\n");
return r;
}
@@ -584,9 +583,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFillPolygon\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFillPolygon(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFillPolygon\n");
return r;
}
@@ -595,9 +594,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFillRectangle\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFillRectangle(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFillRectangle\n");
return r;
}
@@ -606,9 +605,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFlush\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFlush(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFlush\n");
return r;
}
@@ -617,20 +616,31 @@
{
int r;
dprintf_x11(stddeb, "Call XFree\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFree(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFree\n");
return r;
}
+int TSXFreeColormap(Display* a0, Colormap a1)
+{
+ int r;
+ dprintf_x11(stddeb, "Call XFreeColormap\n");
+ EnterCriticalSection( &X11DRV_CritSection );
+ r = XFreeColormap(a0, a1);
+ LeaveCriticalSection( &X11DRV_CritSection );
+ dprintf_x11(stddeb, "Ret XFreeColormap\n");
+ return r;
+}
+
int TSXFreeColors(Display* a0, Colormap a1, unsigned long* a2, int a3, unsigned long a4)
{
int r;
dprintf_x11(stddeb, "Call XFreeColors\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeColors(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeColors\n");
return r;
}
@@ -639,9 +649,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreeCursor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeCursor(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeCursor\n");
return r;
}
@@ -650,9 +660,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreeFont\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeFont(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeFont\n");
return r;
}
@@ -661,9 +671,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreeFontNames\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeFontNames(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeFontNames\n");
return r;
}
@@ -672,9 +682,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreeGC\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeGC(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeGC\n");
return r;
}
@@ -683,9 +693,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreeModifiermap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreeModifiermap(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreeModifiermap\n");
return r;
}
@@ -694,9 +704,9 @@
{
int r;
dprintf_x11(stddeb, "Call XFreePixmap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFreePixmap(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFreePixmap\n");
return r;
}
@@ -705,9 +715,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetFontProperty\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetFontProperty(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetFontProperty\n");
return r;
}
@@ -716,9 +726,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetGeometry\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetGeometry(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetGeometry\n");
return r;
}
@@ -727,9 +737,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetInputFocus\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetInputFocus(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetInputFocus\n");
return r;
}
@@ -738,9 +748,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetKeyboardControl\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetKeyboardControl(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetKeyboardControl\n");
return r;
}
@@ -749,9 +759,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetScreenSaver\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetScreenSaver(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetScreenSaver\n");
return r;
}
@@ -760,9 +770,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetWindowProperty\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetWindowProperty(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9, a10, a11);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetWindowProperty\n");
return r;
}
@@ -771,9 +781,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGetWindowAttributes\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetWindowAttributes(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetWindowAttributes\n");
return r;
}
@@ -782,9 +792,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGrabPointer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGrabPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGrabPointer\n");
return r;
}
@@ -793,9 +803,9 @@
{
int r;
dprintf_x11(stddeb, "Call XGrabServer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGrabServer(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGrabServer\n");
return r;
}
@@ -804,9 +814,9 @@
{
int r;
dprintf_x11(stddeb, "Call XInstallColormap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XInstallColormap(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XInstallColormap\n");
return r;
}
@@ -815,9 +825,9 @@
{
KeyCode r;
dprintf_x11(stddeb, "Call XKeysymToKeycode\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XKeysymToKeycode(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XKeysymToKeycode\n");
return r;
}
@@ -826,9 +836,9 @@
{
int r;
dprintf_x11(stddeb, "Call XMapWindow\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XMapWindow(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XMapWindow\n");
return r;
}
@@ -837,9 +847,9 @@
{
int r;
dprintf_x11(stddeb, "Call XNextEvent\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XNextEvent(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XNextEvent\n");
return r;
}
@@ -848,9 +858,9 @@
{
int r;
dprintf_x11(stddeb, "Call XParseGeometry\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XParseGeometry(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XParseGeometry\n");
return r;
}
@@ -859,9 +869,9 @@
{
int r;
dprintf_x11(stddeb, "Call XPending\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XPending(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XPending\n");
return r;
}
@@ -870,9 +880,9 @@
{
int r;
dprintf_x11(stddeb, "Call XPutBackEvent\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XPutBackEvent(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XPutBackEvent\n");
return r;
}
@@ -881,9 +891,9 @@
{
int r;
dprintf_x11(stddeb, "Call XPutImage\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XPutImage(a0, a1, a2, a3, a4, a5, a6, a7, a8, a9);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XPutImage\n");
return r;
}
@@ -892,9 +902,9 @@
{
int r;
dprintf_x11(stddeb, "Call XQueryColor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XQueryColor(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XQueryColor\n");
return r;
}
@@ -903,9 +913,9 @@
{
int r;
dprintf_x11(stddeb, "Call XQueryPointer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XQueryPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XQueryPointer\n");
return r;
}
@@ -914,9 +924,9 @@
{
int r;
dprintf_x11(stddeb, "Call XQueryTree\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XQueryTree(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XQueryTree\n");
return r;
}
@@ -925,9 +935,9 @@
{
int r;
dprintf_x11(stddeb, "Call XResetScreenSaver\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XResetScreenSaver(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XResetScreenSaver\n");
return r;
}
@@ -936,9 +946,9 @@
{
int r;
dprintf_x11(stddeb, "Call XRestackWindows\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XRestackWindows(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XRestackWindows\n");
return r;
}
@@ -947,9 +957,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSendEvent\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSendEvent(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSendEvent\n");
return r;
}
@@ -958,9 +968,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetArcMode\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetArcMode(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetArcMode\n");
return r;
}
@@ -969,9 +979,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetBackground\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetBackground(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetBackground\n");
return r;
}
@@ -980,9 +990,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetClipMask\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetClipMask(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetClipMask\n");
return r;
}
@@ -991,9 +1001,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetClipOrigin\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetClipOrigin(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetClipOrigin\n");
return r;
}
@@ -1002,9 +1012,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetClipRectangles\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetClipRectangles(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetClipRectangles\n");
return r;
}
@@ -1013,9 +1023,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetDashes\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetDashes(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetDashes\n");
return r;
}
@@ -1024,9 +1034,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetFillStyle\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetFillStyle(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetFillStyle\n");
return r;
}
@@ -1035,9 +1045,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetForeground\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetForeground(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetForeground\n");
return r;
}
@@ -1046,9 +1056,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetFunction\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetFunction(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetFunction\n");
return r;
}
@@ -1057,9 +1067,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetGraphicsExposures\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetGraphicsExposures(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetGraphicsExposures\n");
return r;
}
@@ -1068,9 +1078,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetIconName\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetIconName(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetIconName\n");
return r;
}
@@ -1079,9 +1089,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetInputFocus\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetInputFocus(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetInputFocus\n");
return r;
}
@@ -1090,9 +1100,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetLineAttributes\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetLineAttributes(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetLineAttributes\n");
return r;
}
@@ -1101,9 +1111,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetScreenSaver\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetScreenSaver(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetScreenSaver\n");
return r;
}
@@ -1112,9 +1122,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetSelectionOwner\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetSelectionOwner(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetSelectionOwner\n");
return r;
}
@@ -1123,9 +1133,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetSubwindowMode\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetSubwindowMode(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetSubwindowMode\n");
return r;
}
@@ -1134,9 +1144,9 @@
{
int r;
dprintf_x11(stddeb, "Call XStoreColor\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XStoreColor(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XStoreColor\n");
return r;
}
@@ -1145,9 +1155,9 @@
{
int r;
dprintf_x11(stddeb, "Call XStoreName\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XStoreName(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XStoreName\n");
return r;
}
@@ -1156,9 +1166,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSync\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSync(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSync\n");
return r;
}
@@ -1167,9 +1177,9 @@
{
int r;
dprintf_x11(stddeb, "Call XTextExtents\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XTextExtents(a0, a1, a2, a3, a4, a5, a6);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XTextExtents\n");
return r;
}
@@ -1178,9 +1188,9 @@
{
int r;
dprintf_x11(stddeb, "Call XTextWidth\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XTextWidth(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XTextWidth\n");
return r;
}
@@ -1189,9 +1199,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUngrabPointer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUngrabPointer(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUngrabPointer\n");
return r;
}
@@ -1200,9 +1210,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUngrabServer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUngrabServer(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUngrabServer\n");
return r;
}
@@ -1211,9 +1221,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUninstallColormap\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUninstallColormap(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUninstallColormap\n");
return r;
}
@@ -1222,9 +1232,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUnmapWindow\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUnmapWindow(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUnmapWindow\n");
return r;
}
@@ -1233,9 +1243,9 @@
{
int r;
dprintf_x11(stddeb, "Call XWarpPointer\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XWarpPointer(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XWarpPointer\n");
return r;
}
@@ -1244,9 +1254,9 @@
{
int (*r)(Display *);
dprintf_x11(stddeb, "Call XSynchronize\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSynchronize(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSynchronize\n");
return r;
}
@@ -1256,8 +1266,8 @@
void TS_XInitImageFuncPtrs(XImage *a0)
{
dprintf_x11(stddeb, "Call _XInitImageFuncPtrs\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
_XInitImageFuncPtrs(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret _XInitImageFuncPtrs\n");
}
diff --git a/tsx11/ts_xpm.c b/tsx11/ts_xpm.c
index 10cb12f..26b2dc9 100644
--- a/tsx11/ts_xpm.c
+++ b/tsx11/ts_xpm.c
@@ -1,12 +1,11 @@
/*
* Thread safe wrappers around xpm calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
#include <X11/xpm.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
@@ -14,9 +13,9 @@
{
int r;
dprintf_x11(stddeb, "Call XpmCreatePixmapFromData\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XpmCreatePixmapFromData(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XpmCreatePixmapFromData\n");
return r;
}
@@ -25,9 +24,9 @@
{
int r;
dprintf_x11(stddeb, "Call XpmAttributesSize\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XpmAttributesSize();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XpmAttributesSize\n");
return r;
}
diff --git a/tsx11/ts_xresource.c b/tsx11/ts_xresource.c
index cb173d0..4eda899 100644
--- a/tsx11/ts_xresource.c
+++ b/tsx11/ts_xresource.c
@@ -1,13 +1,12 @@
/*
* Thread safe wrappers around Xresource calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
#include <X11/Xlib.h>
#include <X11/Xresource.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
@@ -15,9 +14,9 @@
{
XrmQuark r;
dprintf_x11(stddeb, "Call XrmUniqueQuark\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XrmUniqueQuark();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmUniqueQuark\n");
return r;
}
@@ -26,9 +25,9 @@
{
int r;
dprintf_x11(stddeb, "Call XrmGetResource\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XrmGetResource(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmGetResource\n");
return r;
}
@@ -37,9 +36,9 @@
{
XrmDatabase r;
dprintf_x11(stddeb, "Call XrmGetFileDatabase\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XrmGetFileDatabase(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmGetFileDatabase\n");
return r;
}
@@ -48,9 +47,9 @@
{
XrmDatabase r;
dprintf_x11(stddeb, "Call XrmGetStringDatabase\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XrmGetStringDatabase(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmGetStringDatabase\n");
return r;
}
@@ -58,17 +57,17 @@
void TSXrmMergeDatabases(XrmDatabase a0, XrmDatabase* a1)
{
dprintf_x11(stddeb, "Call XrmMergeDatabases\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
XrmMergeDatabases(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmMergeDatabases\n");
}
void TSXrmParseCommand(XrmDatabase* a0, XrmOptionDescList a1, int a2, const char* a3, int* a4, char** a5)
{
dprintf_x11(stddeb, "Call XrmParseCommand\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
XrmParseCommand(a0, a1, a2, a3, a4, a5);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XrmParseCommand\n");
}
diff --git a/tsx11/ts_xshm.c b/tsx11/ts_xshm.c
index 0071cb5..ff5ee60 100644
--- a/tsx11/ts_xshm.c
+++ b/tsx11/ts_xshm.c
@@ -1,13 +1,12 @@
/*
* Thread safe wrappers around XShm calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
#include <X11/Xlib.h>
#include <X11/extensions/XShm.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
@@ -15,9 +14,9 @@
{
Bool r;
dprintf_x11(stddeb, "Call XShmQueryExtension\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XShmQueryExtension(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XShmQueryExtension\n");
return r;
}
@@ -26,9 +25,9 @@
{
int r;
dprintf_x11(stddeb, "Call XShmPixmapFormat\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XShmPixmapFormat(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XShmPixmapFormat\n");
return r;
}
@@ -37,9 +36,9 @@
{
Status r;
dprintf_x11(stddeb, "Call XShmDetach\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XShmDetach(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XShmDetach\n");
return r;
}
@@ -48,9 +47,9 @@
{
Status r;
dprintf_x11(stddeb, "Call XShmAttach\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XShmAttach(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XShmAttach\n");
return r;
}
diff --git a/tsx11/ts_xutil.c b/tsx11/ts_xutil.c
index d2ea0d3..cd499bb 100644
--- a/tsx11/ts_xutil.c
+++ b/tsx11/ts_xutil.c
@@ -1,14 +1,13 @@
/*
* Thread safe wrappers around Xutil calls.
* This file was generated automatically by tools/make_X11wrappers
- *
- * Copyright 1998 Kristian Nielsen
+ * DO NOT EDIT!
*/
#include <X11/Xlib.h>
#include <X11/Xresource.h>
#include <X11/Xutil.h>
-#include "tsx11defs.h"
+#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
@@ -16,9 +15,9 @@
{
XClassHint * r;
dprintf_x11(stddeb, "Call XAllocClassHint\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAllocClassHint();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAllocClassHint\n");
return r;
}
@@ -27,9 +26,9 @@
{
XSizeHints * r;
dprintf_x11(stddeb, "Call XAllocSizeHints\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAllocSizeHints();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAllocSizeHints\n");
return r;
}
@@ -38,9 +37,9 @@
{
XWMHints * r;
dprintf_x11(stddeb, "Call XAllocWMHints\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAllocWMHints();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAllocWMHints\n");
return r;
}
@@ -49,9 +48,9 @@
{
int r;
dprintf_x11(stddeb, "Call XClipBox\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XClipBox(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XClipBox\n");
return r;
}
@@ -60,9 +59,9 @@
{
Region r;
dprintf_x11(stddeb, "Call XCreateRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XCreateRegion();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XCreateRegion\n");
return r;
}
@@ -71,9 +70,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDeleteContext\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDeleteContext(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDeleteContext\n");
return r;
}
@@ -82,9 +81,9 @@
{
int r;
dprintf_x11(stddeb, "Call XDestroyRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDestroyRegion(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDestroyRegion\n");
return r;
}
@@ -93,9 +92,9 @@
{
int r;
dprintf_x11(stddeb, "Call XEmptyRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XEmptyRegion(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XEmptyRegion\n");
return r;
}
@@ -104,9 +103,9 @@
{
int r;
dprintf_x11(stddeb, "Call XEqualRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XEqualRegion(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XEqualRegion\n");
return r;
}
@@ -115,20 +114,31 @@
{
int r;
dprintf_x11(stddeb, "Call XFindContext\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XFindContext(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XFindContext\n");
return r;
}
+XVisualInfo * TSXGetVisualInfo(Display* a0, long a1, XVisualInfo* a2, int* a3)
+{
+ XVisualInfo * r;
+ dprintf_x11(stddeb, "Call XGetVisualInfo\n");
+ EnterCriticalSection( &X11DRV_CritSection );
+ r = XGetVisualInfo(a0, a1, a2, a3);
+ LeaveCriticalSection( &X11DRV_CritSection );
+ dprintf_x11(stddeb, "Ret XGetVisualInfo\n");
+ return r;
+}
+
int TSXGetWMSizeHints(Display* a0, Window a1, XSizeHints* a2, long* a3, Atom a4)
{
int r;
dprintf_x11(stddeb, "Call XGetWMSizeHints\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XGetWMSizeHints(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XGetWMSizeHints\n");
return r;
}
@@ -137,9 +147,9 @@
{
int r;
dprintf_x11(stddeb, "Call XIntersectRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XIntersectRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XIntersectRegion\n");
return r;
}
@@ -148,9 +158,9 @@
{
int r;
dprintf_x11(stddeb, "Call XLookupString\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XLookupString(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XLookupString\n");
return r;
}
@@ -159,9 +169,9 @@
{
int r;
dprintf_x11(stddeb, "Call XOffsetRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XOffsetRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XOffsetRegion\n");
return r;
}
@@ -170,9 +180,9 @@
{
int r;
dprintf_x11(stddeb, "Call XPointInRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XPointInRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XPointInRegion\n");
return r;
}
@@ -181,9 +191,9 @@
{
Region r;
dprintf_x11(stddeb, "Call XPolygonRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XPolygonRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XPolygonRegion\n");
return r;
}
@@ -192,9 +202,9 @@
{
int r;
dprintf_x11(stddeb, "Call XRectInRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XRectInRegion(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XRectInRegion\n");
return r;
}
@@ -203,9 +213,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSaveContext\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSaveContext(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSaveContext\n");
return r;
}
@@ -213,18 +223,18 @@
void TSXSetWMProperties(Display* a0, Window a1, XTextProperty* a2, XTextProperty* a3, char** a4, int a5, XSizeHints* a6, XWMHints* a7, XClassHint* a8)
{
dprintf_x11(stddeb, "Call XSetWMProperties\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
XSetWMProperties(a0, a1, a2, a3, a4, a5, a6, a7, a8);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetWMProperties\n");
}
void TSXSetWMSizeHints(Display* a0, Window a1, XSizeHints* a2, Atom a3)
{
dprintf_x11(stddeb, "Call XSetWMSizeHints\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
XSetWMSizeHints(a0, a1, a2, a3);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetWMSizeHints\n");
}
@@ -232,9 +242,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSetRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSetRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSetRegion\n");
return r;
}
@@ -243,9 +253,9 @@
{
int r;
dprintf_x11(stddeb, "Call XShrinkRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XShrinkRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XShrinkRegion\n");
return r;
}
@@ -254,9 +264,9 @@
{
int r;
dprintf_x11(stddeb, "Call XStringListToTextProperty\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XStringListToTextProperty(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XStringListToTextProperty\n");
return r;
}
@@ -265,9 +275,9 @@
{
int r;
dprintf_x11(stddeb, "Call XSubtractRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSubtractRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSubtractRegion\n");
return r;
}
@@ -276,9 +286,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUnionRectWithRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUnionRectWithRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUnionRectWithRegion\n");
return r;
}
@@ -287,9 +297,9 @@
{
int r;
dprintf_x11(stddeb, "Call XUnionRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUnionRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUnionRegion\n");
return r;
}
@@ -298,9 +308,9 @@
{
int r;
dprintf_x11(stddeb, "Call XXorRegion\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XXorRegion(a0, a1, a2);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XXorRegion\n");
return r;
}
@@ -309,42 +319,20 @@
{
int r;
dprintf_x11(stddeb, "Call XDestroyImage\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XDestroyImage(a0);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XDestroyImage\n");
return r;
}
-unsigned long TSXGetPixel(struct _XImage *a0, int a1, int a2)
-{
- unsigned long r;
- dprintf_x11(stddeb, "Call XGetPixel\n");
- X11_LOCK();
- r = XGetPixel(a0, a1, a2);
- X11_UNLOCK();
- dprintf_x11(stddeb, "Ret XGetPixel\n");
- return r;
-}
-
-int TSXPutPixel(struct _XImage *a0, int a1, int a2, unsigned long a3)
-{
- int r;
- dprintf_x11(stddeb, "Call XPutPixel\n");
- X11_LOCK();
- r = XPutPixel(a0, a1, a2, a3);
- X11_UNLOCK();
- dprintf_x11(stddeb, "Ret XPutPixel\n");
- return r;
-}
-
struct _XImage * TSXSubImage(struct _XImage *a0, int a1, int a2, unsigned int a3, unsigned int a4)
{
struct _XImage * r;
dprintf_x11(stddeb, "Call XSubImage\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XSubImage(a0, a1, a2, a3, a4);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XSubImage\n");
return r;
}
@@ -353,9 +341,9 @@
{
int r;
dprintf_x11(stddeb, "Call XAddPixel\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XAddPixel(a0, a1);
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XAddPixel\n");
return r;
}
@@ -364,9 +352,9 @@
{
XContext r;
dprintf_x11(stddeb, "Call XUniqueContext\n");
- X11_LOCK();
+ EnterCriticalSection( &X11DRV_CritSection );
r = XUniqueContext();
- X11_UNLOCK();
+ LeaveCriticalSection( &X11DRV_CritSection );
dprintf_x11(stddeb, "Ret XUniqueContext\n");
return r;
}
diff --git a/tsx11/tsx11defs.c b/tsx11/tsx11defs.c
deleted file mode 100644
index 3713852..0000000
--- a/tsx11/tsx11defs.c
+++ /dev/null
@@ -1,21 +0,0 @@
-/*
- * Thread safe wrappers around XShm calls.
- *
- * Copyright 1998 Kristian Nielsen
- */
-
-#include "tsx11defs.h"
-#include "stddebug.h"
-#include "debug.h"
-
-CRITICAL_SECTION *TSX11_SectionPtr = NULL;
-static CRITICAL_SECTION TSX11_Section;
-
-int TSX11_Init(void)
-{
- InitializeCriticalSection( &TSX11_Section );
- dprintf_x11(stddeb, "TSX11_Init: X11 critical section is %p\n",
- &TSX11_Section);
- TSX11_SectionPtr = &TSX11_Section;
- return TRUE;
-}
diff --git a/win32/console.c b/win32/console.c
index 8b27d3c..2396f34 100644
--- a/win32/console.c
+++ b/win32/console.c
@@ -3,11 +3,25 @@
*
* Copyright 1995 Martin von Loewis and Cameron Heide
* Copyright 1997 Karl Garrison
+ * Copyright 1998 John Richardson
*/
#include <stdio.h>
#include <stdlib.h>
+#include <unistd.h>
+#include <pty.h>
+#include <termios.h>
+#include <sys/ioctl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <errno.h>
+#include <signal.h>
+#include <assert.h>
#include "windows.h"
+#include "k32obj.h"
+#include "file.h"
+#include "process.h"
#include "winerror.h"
#include "wincon.h"
#include "heap.h"
@@ -23,6 +37,57 @@
{80, 24}
};
+/* The console -- I chose to keep the master and slave
+ * (UNIX) file descriptors around in case they are needed for
+ * ioctls later. The pid is needed to detroy the xterm if needed.
+ */
+typedef struct _CONSOLE {
+ K32OBJ header;
+ int master; /* xterm side of pty */
+ int slave; /* wine side of pty */
+ int pid; /* xterm's pid, -1 if no xterm */
+ int flags; /* CONSOLE_STARTED_FROM */
+ K32OBJ *file_in; /* console input */
+ K32OBJ *file_out; /* console output */
+ K32OBJ *file_err; /* console error */
+} CONSOLE;
+
+#define CONSOLE_STARTED_FROM (0x1) /* FIXME: this is lame, it should have
+ something to do with sharing... */
+
+static void CONSOLE_Destroy( K32OBJ *obj );
+
+const K32OBJ_OPS CONSOLE_Ops =
+{
+ NULL, /* signaled */
+ NULL, /* satisfied */
+ NULL, /* add_wait */
+ NULL, /* remove_wait */
+ CONSOLE_Destroy /* destroy */
+};
+
+
+static int wine_openpty(int *master, int *slave, char *name,
+ struct termios *term, struct winsize *winsize);
+
+
+
+static void CONSOLE_Destroy(K32OBJ *obj)
+{
+ CONSOLE *console = (CONSOLE *)obj;
+ assert(obj->type == K32OBJ_CONSOLE);
+
+ obj->type = K32OBJ_UNKNOWN;
+
+ /* make sure a xterm exists to kill */
+ if (console->pid != -1) {
+ kill(console->pid, SIGTERM);
+ }
+ HeapFree(SystemHeap, 0, console);
+
+}
+
+
/***********************************************************************
* SetConsoleCtrlHandler (KERNEL32.459)
*/
@@ -82,6 +147,230 @@
}
/***********************************************************************
+ * FreeConsole (KERNEL32.267)
+ */
+BOOL32 WINAPI FreeConsole(VOID)
+{
+
+ PDB32 *pdb = PROCESS_Current();
+ CONSOLE *console;
+
+ SYSTEM_LOCK();
+
+ console = (CONSOLE *)pdb->console;
+
+ if (console == NULL) {
+ SetLastError(ERROR_INVALID_PARAMETER);
+ return FALSE;
+ }
+
+ if (console->file_in) K32OBJ_DecCount( console->file_in );
+ if (console->file_out) K32OBJ_DecCount( console->file_out );
+ if (console->file_err) K32OBJ_DecCount( console->file_err );
+ K32OBJ_DecCount( &console->header );
+ pdb->console = NULL;
+ SYSTEM_UNLOCK();
+ return TRUE;
+}
+
+
+/**
+ * It looks like the openpty that comes with glibc in RedHat 5.0
+ * is buggy (second call returns what looks like a dup of 0 and 1
+ * instead of a new pty), this is a generic replacement.
+ */
+static int wine_openpty(int *master, int *slave, char *name,
+ struct termios *term, struct winsize *winsize)
+{
+ int fdm, fds;
+ char *ptr1, *ptr2;
+ char pts_name[512];
+
+ strcpy (pts_name, "/dev/ptyXY");
+
+ for (ptr1 = "pqrstuvwxyzPQRST"; *ptr1 != 0; ptr1++) {
+ pts_name[8] = *ptr1;
+ for (ptr2 = "0123456789abcdef"; *ptr2 != 0; ptr2++) {
+ pts_name[9] = *ptr2;
+
+ if ((fdm = open(pts_name, O_RDWR)) < 0) {
+ if (errno == ENOENT)
+ return -1;
+ else
+ continue;
+ }
+ pts_name[5] = 't';
+ if ((fds = open(pts_name, O_RDWR)) < 0) {
+ pts_name[5] = 'p';
+ continue;
+ }
+ *master = fdm;
+ *slave = fds;
+
+ if (term != NULL)
+ tcsetattr(*slave, TCSANOW, term);
+ if (winsize != NULL)
+ ioctl(*slave, TIOCSWINSZ, winsize);
+ if (name != NULL)
+ strcpy(name, pts_name);
+ return fds;
+ }
+ }
+ return -1;
+}
+
+static BOOL32 wine_createConsole(int *master, int *slave, int *pid)
+{
+ struct termios term;
+ char buf[1024];
+ char c = '\0';
+ int status = 0;
+ int i;
+
+ if (tcgetattr(0, &term) < 0) return FALSE;
+ term.c_lflag |= ICANON;
+ term.c_lflag &= ~ECHO;
+ if (wine_openpty(master, slave, NULL, &term, NULL) < 0) return FALSE;
+
+ if ((*pid=fork()) == 0) {
+ tcsetattr(*slave, TCSADRAIN, &term);
+ sprintf(buf, "-Sxx%d", *master);
+ execlp("xterm", "xterm", buf, NULL);
+ fprintf(stderr, "error creating AllocConsole xterm\n");
+ exit(1);
+ }
+
+ /* most xterms like to print their window ID when used with -S;
+ * read it and continue before the user has a chance...
+ * NOTE: this is the reason we started xterm with ECHO off,
+ * we'll turn it back on below
+ */
+
+ for (i=0; c!='\n'; (status=read(*slave, &c, 1)), i++) {
+ if (status == -1 && c == '\0') {
+ /* wait for xterm to be created */
+ usleep(100);
+ }
+ if (i > 10000) {
+ fprintf(stderr, "can't read xterm WID\n");
+ kill(*pid, SIGKILL);
+ return FALSE;
+ }
+ }
+ term.c_lflag |= ECHO;
+ tcsetattr(*master, TCSADRAIN, &term);
+
+ return TRUE;
+
+}
+
+
+/***********************************************************************
+ * AllocConsole (KERNEL32.103)
+ *
+ * creates an xterm with a pty to our program
+ */
+BOOL32 WINAPI AllocConsole(VOID)
+{
+
+ int master;
+ int slave;
+ int pid;
+ PDB32 *pdb = PROCESS_Current();
+ CONSOLE *console;
+ HANDLE32 hIn, hOut, hErr;
+
+ SYSTEM_LOCK(); /* FIXME: really only need to lock the process */
+
+ SetLastError(ERROR_CANNOT_MAKE); /* this might not be the right
+ error, but it's a good guess :) */
+
+ console = (CONSOLE *)pdb->console;
+
+ /* we only want to be able to open a console if the process doesn't have one
+ * now or we got the one we have from our parent
+ * - invalid handle comes from when the console was closed via FreeConsole()
+ * - CONSOLE_STARTED_FROM is when this process inherits its console from
+ * its parent
+ */
+ if (console && (console->flags & CONSOLE_STARTED_FROM) == 0) {
+ SetLastError(ERROR_ACCESS_DENIED);
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+
+ if (!(console = (CONSOLE*)HeapAlloc( SystemHeap, 0, sizeof(*console))))
+ {
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+
+ console->header.type = K32OBJ_CONSOLE;
+ console->header.refcount = 1;
+ console->pid = -1;
+ console->file_in = NULL;
+ console->file_out = NULL;
+ console->file_err = NULL;
+
+ if (wine_createConsole(&master, &slave, &pid) == FALSE) {
+ K32OBJ_DecCount(&console->header);
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+
+ /* save the pid and other info for future use */
+ console->master = master;
+ console->slave = slave;
+ console->pid = pid;
+ console->flags = 0;
+
+ if ((hIn = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+ {
+ K32OBJ_DecCount(&console->header);
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+ FILE_SetFileType(hIn, FILE_TYPE_CHAR);
+
+ if ((hOut = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+ {
+ CloseHandle(hIn);
+ K32OBJ_DecCount(&console->header);
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+ FILE_SetFileType(hOut, FILE_TYPE_CHAR);
+
+ if ((hErr = FILE_DupUnixHandle(slave)) == INVALID_HANDLE_VALUE32)
+ {
+ CloseHandle(hIn);
+ CloseHandle(hOut);
+ K32OBJ_DecCount(&console->header);
+ SYSTEM_UNLOCK();
+ return FALSE;
+ }
+ FILE_SetFileType(hErr, FILE_TYPE_CHAR);
+
+ console->file_in = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
+ console->file_out = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
+ console->file_err = HANDLE_GetObjPtr( hIn, K32OBJ_FILE, 0 /*FIXME*/ );
+
+ /* associate this console with the process */
+ if (pdb->console) K32OBJ_DecCount( pdb->console );
+ pdb->console = (K32OBJ *)console;
+
+ /* NT resets the STD_*_HANDLEs on console alloc */
+ SetStdHandle(STD_INPUT_HANDLE, hIn);
+ SetStdHandle(STD_OUTPUT_HANDLE, hOut);
+ SetStdHandle(STD_ERROR_HANDLE, hErr);
+
+ SetLastError(ERROR_SUCCESS);
+ SYSTEM_UNLOCK();
+ return TRUE;
+}
+
+
+/***********************************************************************
* GetConsoleCP (KERNEL32.226)
*/
UINT32 WINAPI GetConsoleCP(VOID)
@@ -144,10 +433,21 @@
LPDWORD lpNumberOfCharsWritten,
LPVOID lpReserved )
{
- *lpNumberOfCharsWritten = fprintf( stderr, "%.*s",
- (int)nNumberOfCharsToWrite,
- (LPSTR)lpBuffer );
- return TRUE;
+ /* FIXME: should I check if this is a console handle? */
+ return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
+ lpNumberOfCharsWritten, NULL);
+
+#ifdef OLD
+ *lpNumberOfCharsWritten = fprintf(CONSOLE_console.conIO, "%.*s",
+ (int)nNumberOfCharsToWrite,
+ (LPSTR)lpBuffer );
+ if (ferror(CONSOLE_console.conIO) {
+ clearerr();
+ return FALSE;
+ }
+
+ return TRUE;
+#endif
}
/***********************************************************************
@@ -171,11 +471,25 @@
LPDWORD lpNumberOfCharsWritten,
LPVOID lpReserved )
{
- LPSTR buf = HEAP_strdupWtoA( GetProcessHeap(), 0, lpBuffer );
- *lpNumberOfCharsWritten = fprintf( stderr, "%.*s",
- (int)nNumberOfCharsToWrite, buf );
- HeapFree( GetProcessHeap(), 0, buf );
- return TRUE;
+
+ /* FIXME: should I check if this is a console handle? */
+ return WriteFile(hConsoleOutput, lpBuffer, nNumberOfCharsToWrite,
+ lpNumberOfCharsWritten, NULL);
+
+
+#ifdef OLD
+ LPSTR buf = HEAP_strdupWtoA( GetProcessHeap(), 0, lpBuffer );
+ *lpNumberOfCharsWritten = fprintf(CONSOLE_console.conIO, "%.*s",
+ (int)nNumberOfCharsToWrite, buf );
+ HeapFree( GetProcessHeap(), 0, buf );
+
+ if (ferror(CONSOLE_console.conIO) {
+ clearerr();
+ return FALSE;
+ }
+
+ return TRUE;
+#endif
}
/***********************************************************************
@@ -187,9 +501,19 @@
LPDWORD lpNumberOfCharsRead,
LPVOID lpReserved )
{
- fgets(lpBuffer,nNumberOfCharsToRead,stdin);
- *lpNumberOfCharsRead = strlen(lpBuffer);
- return TRUE;
+ return ReadFile(hConsoleInput, lpBuffer, nNumberOfCharsToRead,
+ lpNumberOfCharsRead, NULL);
+
+#ifdef OLD
+ fgets(lpBuffer,nNumberOfCharsToRead, CONSOLE_console.conIO);
+ if (ferror(CONSOLE_console.conIO) {
+ clearerr();
+ return FALSE;
+ }
+ *lpNumberOfCharsRead = strlen(lpBuffer);
+ return TRUE;
+#endif
+
}
/***********************************************************************
@@ -201,12 +525,26 @@
LPDWORD lpNumberOfCharsRead,
LPVOID lpReserved )
{
- LPSTR buf = (LPSTR)HEAP_xalloc( GetProcessHeap(), 0, nNumberOfCharsToRead);
- fgets(buf,nNumberOfCharsToRead,stdin);
- lstrcpynAtoW(lpBuffer,buf,nNumberOfCharsToRead);
- *lpNumberOfCharsRead = strlen(buf);
- HeapFree( GetProcessHeap(), 0, buf );
- return TRUE;
+ return ReadFile(hConsoleInput, lpBuffer, nNumberOfCharsToRead,
+ lpNumberOfCharsRead, NULL);
+
+#ifdef OLD
+ LPSTR buf = (LPSTR)HEAP_xalloc(GetProcessHeap(), 0,
+ nNumberOfCharsToRead);
+ fgets(buf, nNumberOfCharsToRead, CONSOLE_console.conIO);
+
+ if (ferror(CONSOLE_console.conIO) {
+ HeapFree( GetProcessHeap(), 0, buf );
+ clearerr();
+ return FALSE;
+ }
+
+ lstrcpynAtoW(lpBuffer,buf,nNumberOfCharsToRead);
+ *lpNumberOfCharsRead = strlen(buf);
+ HeapFree( GetProcessHeap(), 0, buf );
+#endif
+ return TRUE;
+
}
/***********************************************************************
@@ -244,7 +582,7 @@
if (!c.y) {
fprintf(stderr,"\r");
if (c.x)
- fprintf(stderr,"[%dC",c.x);
+ fprintf(stderr,"%c[%dC", 0x1B, c.x); /* note: 0x1b == ESC */
return TRUE;
}
/* handle rest of the cases */
diff --git a/win32/process.c b/win32/process.c
index a0085c9..459883f 100644
--- a/win32/process.c
+++ b/win32/process.c
@@ -69,7 +69,7 @@
*/
BOOL32 WINAPI SetThreadAffinityMask(HANDLE32 hThread, DWORD dwThreadAffinityMask)
{
- THDB *thdb = (THDB*)PROCESS_GetObjPtr(hThread,K32OBJ_THREAD);
+ THDB *thdb = THREAD_GetPtr( hThread, THREAD_SET_INFORMATION );
if (!thdb)
return FALSE;
diff --git a/windows/clipboard.c b/windows/clipboard.c
index ce99204..ca97837 100644
--- a/windows/clipboard.c
+++ b/windows/clipboard.c
@@ -179,9 +179,14 @@
*/
static void CLIPBOARD_DeleteRecord(LPCLIPFORMAT lpFormat, BOOL32 bChange)
{
- if( lpFormat->wFormatID >= CF_GDIOBJFIRST &&
- lpFormat->wFormatID <= CF_GDIOBJLAST )
+ if( (lpFormat->wFormatID >= CF_GDIOBJFIRST &&
+ lpFormat->wFormatID <= CF_GDIOBJLAST) || lpFormat->wFormatID == CF_BITMAP )
DeleteObject32(lpFormat->hData);
+ else if( lpFormat->wFormatID == CF_METAFILEPICT && lpFormat->hData )
+ {
+ DeleteMetaFile16( ((METAFILEPICT16 *)GlobalLock16( lpFormat->hData ))->hMF );
+ GlobalFree16(lpFormat->hData);
+ }
else if( lpFormat->hData )
GlobalFree16(lpFormat->hData);
diff --git a/windows/dialog.c b/windows/dialog.c
index f469c61..59ddae6 100644
--- a/windows/dialog.c
+++ b/windows/dialog.c
@@ -99,6 +99,7 @@
static LPCSTR DIALOG_GetControl16( LPCSTR p, DLG_CONTROL_INFO *info )
{
static char buffer[10];
+ int int_id;
info->x = GET_WORD(p); p += sizeof(WORD);
info->y = GET_WORD(p); p += sizeof(WORD);
@@ -128,28 +129,34 @@
info->className = p;
p += strlen(p) + 1;
}
- dprintf_dialog(stddeb, " %s ", info->className );
- if ((BYTE)*p == 0xff)
+ int_id = ((BYTE)*p == 0xff);
+ if (int_id)
{
/* Integer id, not documented (?). Only works for SS_ICON controls */
info->windowName = (LPCSTR)(UINT32)GET_WORD(p+1);
p += 3;
- dprintf_dialog( stddeb,"%04x", LOWORD(info->windowName) );
}
else
{
info->windowName = p;
p += strlen(p) + 1;
- dprintf_dialog(stddeb,"'%s'", info->windowName );
}
info->data = (LPVOID)(*p ? p + 1 : NULL); /* FIXME: should be a segptr */
p += *p + 1;
- dprintf_dialog( stddeb," %d, %d, %d, %d, %d, %08lx, %08lx\n",
- info->id, info->x, info->y, info->cx, info->cy,
- info->style, (DWORD)info->data);
+ if(int_id)
+ dprintf_dialog( stddeb," %s %04x %d, %d, %d, %d, %d, %08lx, %08lx\n",
+ info->className, LOWORD(info->windowName),
+ info->id, info->x, info->y, info->cx, info->cy,
+ info->style, (DWORD)info->data);
+ else
+ dprintf_dialog( stddeb," %s '%s' %d, %d, %d, %d, %d, %08lx, %08lx\n",
+ info->className, info->windowName,
+ info->id, info->x, info->y, info->cx, info->cy,
+ info->style, (DWORD)info->data);
+
return p;
}
@@ -163,6 +170,7 @@
static const WORD *DIALOG_GetControl32( const WORD *p, DLG_CONTROL_INFO *info )
{
static WCHAR buffer[10];
+ int int_id;
info->style = GET_DWORD(p); p += 2;
info->exStyle = GET_DWORD(p); p += 2;
@@ -192,19 +200,17 @@
info->className = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
}
- dprintf_dialog(stddeb, " %p ", info->className );
- if (GET_WORD(p) == 0xffff)
+ int_id = (GET_WORD(p) == 0xffff);
+ if (int_id)
{
info->windowName = (LPCSTR)(p + 1);
p += 2;
- dprintf_dialog( stddeb,"%04x", LOWORD(info->windowName) );
}
else
{
info->windowName = (LPCSTR)p;
p += lstrlen32W( (LPCWSTR)p ) + 1;
- dprintf_dialog(stddeb,"'%p'", info->windowName );
}
if (GET_WORD(p))
@@ -215,9 +221,17 @@
else info->data = NULL;
p++;
- dprintf_dialog( stddeb," %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
- info->id, info->x, info->y, info->cx, info->cy,
- info->style, info->exStyle, (DWORD)info->data);
+ if(int_id)
+ dprintf_dialog( stddeb," %p %04x %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
+ info->className, LOWORD(info->windowName),
+ info->id, info->x, info->y, info->cx, info->cy,
+ info->style, info->exStyle, (DWORD)info->data);
+ else
+ dprintf_dialog( stddeb," %p '%p' %d, %d, %d, %d, %d, %08lx, %08lx, %08lx\n",
+ info->className, info->windowName,
+ info->id, info->x, info->y, info->cx, info->cy,
+ info->style, info->exStyle, (DWORD)info->data);
+
/* Next control is on dword boundary */
return (const WORD *)((((int)p) + 3) & ~3);
}
diff --git a/windows/keyboard.c b/windows/keyboard.c
index faadc7d..b99656d 100644
--- a/windows/keyboard.c
+++ b/windows/keyboard.c
@@ -612,6 +612,14 @@
return GetAsyncKeyState32(nKey);
}
+/*********************************************************************
+ * CreateAcceleratorTable (USER.64)
+ */
+HACCEL32 WINAPI CreateAcceleratorTable32A(LPACCEL32 lpaccel, INT32 cEntries) {
+ fprintf(stderr, "CreateAcceleratorTable32A Stub\n");
+ return NULL;
+}
+
/**********************************************************************
* TranslateAccelerator [USER.178][USER32.551..]
*
diff --git a/windows/message.c b/windows/message.c
index 1668722..5ac2407 100644
--- a/windows/message.c
+++ b/windows/message.c
@@ -1132,6 +1132,16 @@
pmsg->hwnd = cwp.hwnd;
}
+/**********************************************************************
+ * PostThreadMessage32A (USER32.422)
+ */
+BOOL32 WINAPI PostThreadMessage32A(DWORD idThread , UINT32 message,
+ WPARAM32 wParam, LPARAM lParam )
+{
+ fprintf(stderr, "PostThreadMessage32A Stub\n");
+ return FALSE;
+}
+
/***********************************************************************
* SendMessage32A (USER32.453)
*/
diff --git a/windows/scroll.c b/windows/scroll.c
index efe1cc3..6b7e866 100644
--- a/windows/scroll.c
+++ b/windows/scroll.c
@@ -106,7 +106,7 @@
}
PAINT_RedrawWindow( hwnd, NULL, hrgnUpdate, RDW_ALLCHILDREN |
- RDW_INVALIDATE | RDW_ERASE | RDW_ERASENOW, RDW_C_USEHRGN );
+ RDW_INVALIDATE, RDW_C_USEHRGN );
DeleteObject32( hrgnUpdate );
if( hCaretWnd )
@@ -143,7 +143,7 @@
/*************************************************************************
* ScrollDC32 (USER32.448)
*
- * Both 'rc' and 'rLClip' are in logical units but update info is
+ * Both 'rc' and 'prLClip' are in logical units but update info is
* returned in device coordinates.
*/
BOOL32 WINAPI ScrollDC32( HDC32 hdc, INT32 dx, INT32 dy, const RECT32 *rc,
diff --git a/windows/sysmetrics.c b/windows/sysmetrics.c
index 58fd85d..9a9cff6 100644
--- a/windows/sysmetrics.c
+++ b/windows/sysmetrics.c
@@ -20,6 +20,8 @@
*/
void SYSMETRICS_Init(void)
{
+ sysMetrics[SM_CXCURSOR] = 32;
+ sysMetrics[SM_CYCURSOR] = 32;
sysMetrics[SM_CXSCREEN] = screenWidth;
sysMetrics[SM_CYSCREEN] = screenHeight;
sysMetrics[SM_CXVSCROLL] =