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 Backstrm <karl_b@geocities.com>

	* [programs/winhelp/Sw.rc] [resources/sysres_Sw.rc]
	Minor update of Swedish language support.
This commit is contained in:
Alexandre Julliard 1998-02-15 19:40:49 +00:00
parent 60ce85c965
commit 03468f7d4b
120 changed files with 2943 additions and 1467 deletions

View File

@ -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 @@ Because of lags created by using mirror, this message may reach you before
the release is available at the ftp sites. The sources will be available
from the following locations:
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.

View File

@ -8,6 +8,7 @@ Wine is available thanks to the work of:
Bob Amstadt,
Dag Asheim,
Martin Ayotte,
Karl Backström,
Peter Bajusz,
Georg Beyerle,
Ross Biro,
@ -72,6 +73,7 @@ David Metcalfe,
Bruce Milner,
Steffen Moeller,
Andreas Mohr,
James Moody,
Philippe De Muyter,
Itai Nahshon,
Kristian Nielsen,

View File

@ -1,3 +1,102 @@
----------------------------------------------------------------------
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>

View File

@ -119,7 +119,7 @@ libwine.a: $(LIBOBJS)
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

View File

@ -1141,6 +1141,7 @@ static LRESULT LISTBOX_SelectItemRange( WND *wnd, LB_DESCR *descr, INT32 first,
/* 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;

View File

@ -164,26 +164,33 @@ static BOOL32 fEndMenu = FALSE;
* 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 @@ static void debug_print_menuitem(const char *prefix, MENUITEM * mp, const char *
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 @@ static void debug_print_menuitem(const char *prefix, MENUITEM * mp, const char *
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 @@ static void MENU_CalcItemSize( HDC32 hdc, MENUITEM *lpitem, HWND32 hwndOwner,
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 @@ static void MENU_MenuBarCalcSize( HDC32 hdc, LPRECT32 lprect,
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 @@ static void MENU_DrawMenuItem( HWND32 hwnd, HDC32 hdc, MENUITEM *lpitem,
{
RECT32 rect;
debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "\n");
debug_print_menuitem("MENU_DrawMenuItem: ", lpitem, "");
if (lpitem->fType & MF_SYSMENU)
{
@ -1408,7 +1417,7 @@ static BOOL32 MENU_SetItemData( MENUITEM *item, UINT32 flags, UINT32 id,
{
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 @@ static BOOL32 MENU_SetItemData( MENUITEM *item, UINT32 flags, UINT32 id,
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 @@ UINT32 WINAPI GetMenuState32( HMENU32 hMenu, UINT32 wItemID, UINT32 wFlags )
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 @@ static BOOL32 GetMenuItemInfo32_common ( HMENU32 hmenu, UINT32 item,
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 @@ static BOOL32 SetMenuItemInfo32_common(MENUITEM * menu,
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 @@ BOOL32 WINAPI SetMenuDefaultItem32(HMENU32 hmenu, UINT32 item, BOOL32 bypos)
{
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;

View File

@ -973,11 +973,14 @@ INT32 WINAPI SetScrollInfo32( HWND32 hwnd, INT32 nBar, const SCROLLINFO *info,
/* Check if the scrollbar should be hidden or disabled */
if (info->fMask & (SIF_RANGE | SIF_PAGE | SIF_DISABLENOSCROLL))
{
new_flags = infoPtr->flags;
if (infoPtr->MinVal >= infoPtr->MaxVal - MAX( infoPtr->Page-1, 0 ))
{
/* Hide or disable scroll-bar */
if (info->fMask & SIF_DISABLENOSCROLL) new_flags = ESB_DISABLE_BOTH;
if (info->fMask & SIF_DISABLENOSCROLL)
new_flags = ESB_DISABLE_BOTH;
else if (nBar != SB_CTL)
{
ShowScrollBar32( hwnd, nBar, FALSE );
@ -995,6 +998,7 @@ INT32 WINAPI SetScrollInfo32( HWND32 hwnd, INT32 nBar, const SCROLLINFO *info,
infoPtr->flags = new_flags;
repaint_arrows = TRUE;
}
}
if (bRedraw || repaint_arrows)
SCROLL_RefreshScrollBar( hwnd, nBar, repaint_arrows );

42
documentation/console Normal file
View File

@ -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).

View File

@ -24,13 +24,13 @@ functions (or do their own synchronization that is compatible with the
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

View File

@ -2,7 +2,7 @@ This file documents the necessary procedure for adding a new language
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

View File

@ -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>

View File

@ -84,7 +84,8 @@ static HFILE32 FILE_Alloc( FILE_OBJECT **file )
(*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 void FILE_Destroy( K32OBJ *ptr )
*/
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 @@ HFILE32 FILE_Dup( HFILE32 hFile )
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 @@ HFILE32 FILE_Dup2( HFILE32 hFile1, HFILE32 hFile2 )
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;
}

View File

@ -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 @@ WORD WINAPI EngineEnumerateFont(LPSTR fontname, FARPROC16 proc, DWORD data )
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);
}
#endif
return 1;
}
/* GDI 302 */
WORD WINAPI EngineRealizeFont(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform, LPFONTINFO16 lpfontInfo)
{
@ -27,27 +46,33 @@ WORD WINAPI EngineRealizeFont(LPLOGFONT16 lplogFont, LPTEXTXFORM16 lptextxform,
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)
{
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(LPFONTINFO16 lpFontInfo, WORD data)
{
return 0;
}
/* GDI 304 */
WORD WINAPI EngineSetFontContext(LPFONTINFO lpFontInfo, WORD data)
{
}
/* 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 @@ DWORD WINAPI EngineMakeFontDir(HDC16 hdc, LPFONTDIR fontdir, LPCSTR string)
WORD WINAPI EngineExtTextOut()
{
return 0;
}
#endif

View File

@ -74,8 +74,8 @@ BOOL32 WINAPI DPtoLP32( HDC32 hdc, LPPOINT32 points, INT32 count )
{
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 @@ BOOL32 WINAPI DPtoLP32( HDC32 hdc, LPPOINT32 points, INT32 count )
}
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 @@ BOOL32 WINAPI LPtoDP32( HDC32 hdc, LPPOINT32 points, INT32 count )
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++;
}

View File

@ -471,7 +471,7 @@ static int CreateSpoolFile(LPSTR pszOutput)
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

View File

@ -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 @@ static void BITBLT_GetRow( XImage *image, int *pdata, INT32 row,
{
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 @@ static void BITBLT_GetRow( XImage *image, int *pdata, INT32 row,
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 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
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 @@ static void BITBLT_StretchImage( XImage *srcImage, XImage *dstImage,
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 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
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 @@ static void BITBLT_GetSrcAreaStretch( DC *dcSrc, DC *dcDst,
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 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
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 @@ static void BITBLT_GetSrcArea( DC *dcSrc, DC *dcDst, Pixmap pixmap, GC gc,
{
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 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
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 @@ static void BITBLT_GetDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
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 @@ static void BITBLT_PutDstArea(DC *dc, Pixmap pixmap, GC gc, RECT32 *visRectDst)
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 @@ static BOOL32 BITBLT_GetVisRectangles( DC *dcDst, INT32 xDst, INT32 yDst,
*
* Implementation of PatBlt(), BitBlt() and StretchBlt().
*/
BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 )
INT32 widthSrc, INT32 heightSrc,
DWORD rop )
{
BOOL32 usePat, useSrc, useDst, destUsed, fStretch, fNullBrush;
RECT32 visRectDst, visRectSrc;
@ -1171,14 +1172,14 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
{
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
/* 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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 BITBLT_InternalStretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
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 @@ BOOL32 X11DRV_PatBlt( DC *dc, INT32 left, INT32 top,
{
struct StretchBlt_params params = { dc, left, top, width, height,
NULL, 0, 0, 0, 0, rop };
return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
BOOL32 result;
EnterCriticalSection( &X11DRV_CritSection );
result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
LeaveCriticalSection( &X11DRV_CritSection );
return result;
}
@ -1393,7 +1398,11 @@ BOOL32 X11DRV_BitBlt( DC *dcDst, INT32 xDst, INT32 yDst,
{
struct StretchBlt_params params = { dcDst, xDst, yDst, width, height,
dcSrc, xSrc, ySrc, width, height, rop};
return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
BOOL32 result;
EnterCriticalSection( &X11DRV_CritSection );
result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
LeaveCriticalSection( &X11DRV_CritSection );
return result;
}
@ -1408,5 +1417,9 @@ BOOL32 X11DRV_StretchBlt( DC *dcDst, INT32 xDst, INT32 yDst,
struct StretchBlt_params params = { dcDst, xDst, yDst, widthDst, heightDst,
dcSrc, xSrc, ySrc, widthSrc, heightSrc,
rop };
return (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
BOOL32 result;
EnterCriticalSection( &X11DRV_CritSection );
result = (BOOL32)CALL_LARGE_STACK( BITBLT_DoStretchBlt, &params );
LeaveCriticalSection( &X11DRV_CritSection );
return result;
}

View File

@ -107,6 +107,7 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
unsigned int x, y;
Pixmap pixmap;
EnterCriticalSection( &X11DRV_CritSection );
if (color != prevColor)
{
int r = GetRValue( color ) * DITHER_LEVELS;
@ -122,16 +123,17 @@ static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
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,
pixmap = XCreatePixmap( display, rootWindow,
MATRIX_SIZE, MATRIX_SIZE, screenDepth );
TSXPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
LeaveCriticalSection( &X11DRV_CritSection );
return pixmap;
}

View File

@ -408,23 +408,25 @@ X11DRV_GetPixel( DC *dc, INT32 x, INT32 y )
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 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
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 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
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 @@ static void X11DRV_InternalFloodFill(XImage *image, DC *dc,
* X11DRV_DoFloodFill
*
* Main flood-fill routine.
*
* The Xlib critical section must be entered before calling this function.
*/
struct FloodFill_params
@ -656,7 +660,7 @@ static BOOL32 X11DRV_DoFloodFill( const struct FloodFill_params *params )
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 @@ static BOOL32 X11DRV_DoFloodFill( const struct FloodFill_params *params )
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 @@ static BOOL32 X11DRV_DoFloodFill( const struct FloodFill_params *params )
params->fillType );
}
TSXDestroyImage( image );
XDestroyImage( image );
return TRUE;
}
@ -688,11 +692,15 @@ BOOL32
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, &params );
EnterCriticalSection( &X11DRV_CritSection );
result = CALL_LARGE_STACK( X11DRV_DoFloodFill, &params );
LeaveCriticalSection( &X11DRV_CritSection );
return result;
}

View File

@ -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 @@ static DeviceCaps X11DRV_DevCaps = {
*/
BOOL32 X11DRV_Init(void)
{
if (!TSX11_Init()) return FALSE;
/* FIXME: colormap management should be merged with the X11DRV */
if( !COLOR_Init() ) return FALSE;

View File

@ -242,7 +242,8 @@ HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force )
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 );

View File

@ -211,9 +211,9 @@ file gdi.exe
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 @@ file gdi.exe
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

View File

@ -58,6 +58,20 @@ BOOL32 RELAY_Init(void)
}
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,7 +90,47 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
frame->entry_ip,
&ordinal ));
VA_START16( args16 );
for (i = 0; i < strlen(args); i++)
if (func_type & 4) /* cdecl */
{
while (*args)
{
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])
{
@ -109,25 +163,8 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
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);
}
if (HIWORD(*(SEGPTR *)args16))
RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
break;
case 'p':
args16 -= 4;
@ -136,34 +173,19 @@ void RELAY_DebugCallFrom16( int func_type, char *args,
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);
}
if (HIWORD( *(SEGPTR *)args16 ))
RELAY_dumpstr( (LPBYTE)PTR_SEG_TO_LIN(*(SEGPTR *)args16 ));
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 @@ void RELAY_DebugCallTo16( int* stack, int nb_args )
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 @@ void RELAY_DebugCallTo16( int* stack, int nb_args )
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 @@ void WINAPI Catch( CONTEXT *context )
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 @@ void WINAPI Throw( CONTEXT *context )
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;

View File

@ -133,7 +133,7 @@ static BOOL32 WINAPI THUNK_WOWCallback16Ex( FARPROC16,DWORD,DWORD,
/* 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 @@ static const CALLBACKS_TABLE CALLBACK_EmulatorTable =
(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 */

View File

@ -26,8 +26,8 @@ type win16
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

View File

@ -18,6 +18,39 @@ typedef struct
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 */

View File

@ -59,7 +59,7 @@ extern void K32OBJ_DecCount( K32OBJ *ptr );
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 );

View File

@ -64,6 +64,8 @@ extern ldt_copy_entry ldt_copy[LDT_SIZE];
(__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];

View File

@ -25,5 +25,6 @@ extern UINT16 LOCAL_CountFree( HANDLE16 ds );
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 */

View File

@ -148,6 +148,7 @@ extern void NE_FixupPrologs( NE_MODULE *pModule );
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 */

View File

@ -29,7 +29,8 @@ struct _PDB32;
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);

View File

@ -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 @@ typedef struct _PDB32
#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 */

View File

@ -122,6 +122,7 @@ extern THDB *pCurrentThread;
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 );

View File

@ -67,6 +67,7 @@ extern int TSXFillPolygon(Display*, Drawable, GC, XPoint*, int, int, int);
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*);

View File

@ -23,6 +23,7 @@ extern int TSXDestroyRegion(Region);
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 TSXUnionRectWithRegion(XRectangle*, Region, Region);
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);

View File

@ -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 */

View File

@ -1 +1 @@
#define WINE_RELEASE_INFO "Wine release 980201"
#define WINE_RELEASE_INFO "Wine release 980215"

View File

@ -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;

View File

@ -4698,8 +4698,6 @@ typedef struct {
/* 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 @@ typedef struct {
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 @@ VOID WINAPI hmemcpy(LPVOID,LPCVOID,LONG);
/* 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 @@ BOOL32 WINAPI FlushFileBuffers(HFILE32);
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 GetFullPathName32A(LPCSTR,DWORD,LPSTR,LPSTR*);
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 @@ DWORD WINAPI SetFilePointer(HFILE32,LONG,LPLONG,DWORD);
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*);

View File

@ -31,6 +31,7 @@ extern int WIN32_LastError;
#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

View File

@ -318,4 +318,86 @@ WINAPI SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
#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 */

View File

@ -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_BITMAP_Init(void);
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 */

View File

@ -13,8 +13,7 @@ HMODULE32 BUILTIN_LoadModule( LPCSTR name, BOOL32 force ) {
}
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 @@ int main( int argc, char *argv [] )
_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 @@ int main( int argc, char *argv [] )
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 );

View File

@ -3,7 +3,7 @@ TOPOBJDIR = ..
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)

View File

@ -1,4 +1,5 @@
#include <windows.h>
#include <resource.h>
#include "hello3res.h"
#include <commdlg.h>

View File

@ -7,6 +7,8 @@ MAIN MENU
}
}
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"

View File

@ -48,18 +48,6 @@ int __winelib = 1; /* Winelib run-time flag */
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 @@ BOOL32 MAIN_UserInit(void)
/***********************************************************************
* 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;
}

View File

@ -1800,7 +1800,8 @@ FARPROC32 WINAPI GetProcAddress32( HMODULE32 hModule, LPCSTR function )
);
return (FARPROC32)0;
}
return PE_FindExportedFunction( pModule->module32, function );
return PE_FindExportedFunction( PROCESS_Current(), pModule->module32,
function );
}
/***********************************************************************

View File

@ -90,7 +90,8 @@ void dump_exports( HMODULE32 hModule )
* 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 @@ FARPROC32 PE_FindExportedFunction( HMODULE32 hModule, LPCSTR funcName)
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 @@ FARPROC32 PE_FindExportedFunction( HMODULE32 hModule, LPCSTR funcName)
}
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 @@ DWORD fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
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 @@ DWORD fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
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 @@ DWORD fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
} 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 @@ DWORD fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
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 @@ DWORD fixup_imports (PDB32 *process,PE_MODREF *pem,HMODULE32 hModule)
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 @@ static HMODULE32 PE_MapImage( HMODULE32 hModule, PDB32 *process,
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 @@ HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, PDB32 *process,
* 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 @@ HMODULE32 PE_LoadLibraryEx32A (LPCSTR name, PDB32 *process,
} 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 );
}

View File

@ -800,7 +800,20 @@ BOOL16 WINAPI GlobalInfo( GLOBALINFO *pInfo )
*/
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;
}

View File

@ -289,7 +289,7 @@ void LDT_Print( int start, int length )
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,

View File

@ -638,7 +638,7 @@ static WORD LOCAL_GetFreeSpace(WORD ds, WORD countdiscard)
/***********************************************************************
* 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;

View File

@ -659,7 +659,7 @@ BOOL32 WINAPI VirtualProtectEx( HANDLE32 handle, LPVOID addr, DWORD size,
{
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 WINAPI VirtualQueryEx( HANDLE32 handle, LPCVOID addr,
{
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 @@ HANDLE32 WINAPI CreateFileMapping32A(HFILE32 hFile, LPSECURITY_ATTRIBUTES attr,
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 @@ HANDLE32 WINAPI CreateFileMapping32A(HFILE32 hFile, LPSECURITY_ATTRIBUTES attr,
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 @@ HANDLE32 WINAPI CreateFileMapping32A(HFILE32 hFile, LPSECURITY_ATTRIBUTES attr,
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 @@ HANDLE32 WINAPI OpenFileMapping32A( DWORD access, BOOL32 inherit, LPCSTR name )
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 @@ LPVOID WINAPI MapViewOfFileEx(HANDLE32 handle, DWORD access, DWORD offset_high,
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)

View File

@ -1701,3 +1701,11 @@ VOID __cdecl CRTDLL_signal(int sig, sig_handler_type ptr)
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);
}

View File

@ -509,7 +509,7 @@ static void MAIN_RestoreSetup(void)
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 @@ BOOL32 MAIN_WineInit( int *argc, char *argv[] )
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 @@ BOOL32 WINAPI SystemParametersInfo32A( UINT32 uAction, UINT32 uParam,
#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);
}

View File

@ -32,6 +32,7 @@ static const char * const SHELL_People[] =
"Bob Amstadt",
"Dag Asheim",
"Martin Ayotte",
"Karl Backstr\366m",
"Peter Bajusz",
"Georg Beyerle",
"Ross Biro",
@ -96,6 +97,7 @@ static const char * const SHELL_People[] =
"Bruce Milner",
"Steffen Moeller",
"Andreas Mohr",
"James Moody",
"Philippe De Muyter",
"Itai Nahshon",
"Kristian Nielsen",

View File

@ -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 @@ BOOL16 WINAPI NotifyRegister( HTASK16 htask, FARPROC16 lpfnCallback,
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 @@ BOOL16 WINAPI NotifyUnregister( HTASK16 htask )
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;

View File

@ -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 @@ static void ver_dstring(
char const * teststring,
char const * epilogue )
{
dprintf_ver(stddeb, "%s", prologue);
dprintf_ver(stddeb, "%s %p (\"%s\") %s\n", prologue,
(void const *) teststring,
teststring ? teststring : "(null)",
epilogue);
}
if(teststring)
dprintf_ver(stddeb, "%p (\"%s\")", (void const *) teststring,
teststring);
else
dprintf_ver(stddeb, "(null)");
/******************************************************************************
*
* 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;
dprintf_ver(stddeb, "%s", epilogue);
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," : ""
);
return;
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 @@ DWORD WINAPI GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle)
}
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 @@ DWORD WINAPI VerFindFile16(
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 @@ DWORD WINAPI VerFindFile16(
*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);

View File

@ -6,6 +6,7 @@
*/
#include <stdio.h>
#include <string.h>
#include "windows.h"
#include "winbase.h"
#include "process.h"

View File

@ -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;
}

View File

@ -20,7 +20,7 @@ void BootTask()
*
* Written without any docu.
*/
SEGPTR WINAPI StackLinearToSegmented()
SEGPTR WINAPI StackLinearToSegmented(WORD w1, WORD w2)
{
fprintf(stderr, "StackLinearToSegmented(), stub !\n");
return (SEGPTR)NULL;

View File

@ -396,8 +396,6 @@ INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, LPWSINFO pwsi )
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 @@ INT32 WINSOCK_DeleteTaskWSI( TDB* pTask, LPWSINFO pwsi )
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;

View File

@ -44,6 +44,7 @@ BOOL32 MAIN_EmulatorInit(void)
*/
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 @@ int main( int argc, char *argv[] )
*/
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) */

View File

@ -518,6 +518,20 @@ void WINAPI INT_Int31Handler( CONTEXT *context )
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 */

View File

@ -159,14 +159,13 @@ static HRESULT WINAPI IDirectSoundBuffer_SetFormat(
) {
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;
}

View File

@ -293,7 +293,7 @@ MMRESULT16 WINAPI joyGetPos16(UINT16 wID, LPJOYINFO16 lpInfo)
{
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 @@ MMRESULT16 WINAPI joyGetPos16(UINT16 wID, LPJOYINFO16 lpInfo)
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;
}

View File

@ -42,7 +42,7 @@ struct XPutImage_descr
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 @@ HBITMAP32 WINAPI CreateBitmapIndirect32( const BITMAP32 * bmp )
*/
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
{
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
{
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
{
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
{
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 @@ LONG WINAPI GetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPVOID buffer )
tbuf += pad;
}
}
TSXDestroyImage( image );
XDestroyImage( image );
LeaveCriticalSection( &X11DRV_CritSection );
GDI_HEAP_UNLOCK( hbitmap );
return height * bmp->bitmap.bmWidthBytes;
}
@ -411,10 +415,11 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
widthbytes = DIB_GetXImageWidthBytes(bmp->bitmap.bmWidth,bmp->bitmap.bmBitsPixel);
tmpbuffer = (LPBYTE)xmalloc(widthbytes*height);
image = TSXCreateImage( display, DefaultVisualOfScreen(screen),
EnterCriticalSection( &X11DRV_CritSection );
image = XCreateImage( display, DefaultVisualOfScreen(screen),
bmp->bitmap.bmBitsPixel, ZPixmap, 0, tmpbuffer,
bmp->bitmap.bmWidth,height,32,widthbytes
);
bmp->bitmap.bmWidth,height,32,widthbytes );
/* copy 16 bit padded image buffer with real bitsperpixel to XImage */
sbuf = (LPBYTE)buffer;
@ -425,7 +430,7 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
{
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 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
{
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 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
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 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
{
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 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
{
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 @@ LONG WINAPI SetBitmapBits32( HBITMAP32 hbitmap, LONG count, LPCVOID buffer )
descr.width = bmp->bitmap.bmWidth;
descr.height = height;
CALL_LARGE_STACK( XPutImage_wrapper, &descr );
XDestroyImage( image ); /* frees tmpbuffer too */
LeaveCriticalSection( &X11DRV_CritSection );
TSXDestroyImage( image ); /* frees tmpbuffer too */
GDI_HEAP_UNLOCK( hbitmap );
return height * bmp->bitmap.bmWidthBytes;
}

View File

@ -969,6 +969,7 @@ DWORD WINAPI DumpIcon( SEGPTR pInfo, WORD *lpLen,
* 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 BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
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 @@ static BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
* 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 @@ static BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
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 @@ static BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
* 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 @@ static BOOL32 CURSORICON_SetCursor( HCURSOR16 hCursor )
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 @@ HCURSOR32 WINAPI SetCursor32( HCURSOR32 hCursor )
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 @@ INT32 WINAPI ShowCursor32( BOOL32 bShow )
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 @@ INT32 WINAPI ShowCursor32( BOOL32 bShow )
if (--CURSOR_ShowCount == -1) /* Hide it */
CALL_LARGE_STACK( CURSORICON_SetCursor, 0 );
}
LeaveCriticalSection( &X11DRV_CritSection );
return CURSOR_ShowCount;
}

View File

@ -276,15 +276,17 @@ BOOL32 DC_SetupGCForPatBlt( DC * dc, GC gc, BOOL32 fMapColors )
{
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;

View File

@ -252,25 +252,25 @@ static void DIB_SetImageBits_1_Line(DWORD dstwidth, int left, int *colors,
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 @@ static void DIB_SetImageBits_4( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_4( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_RLE4( int lines, const BYTE *bits, DWORD width,
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 @@ static void DIB_SetImageBits_RLE4( int lines, const BYTE *bits, DWORD width,
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 @@ static void DIB_SetImageBits_8( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_8( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_RLE8( int lines, const BYTE *bits, DWORD width,
color = colors[color_index];
while(length--)
TSXPutPixel(bmpImage, x++, line, color);
XPutPixel(bmpImage, x++, line, color);
}
else
{
@ -595,7 +595,7 @@ static void DIB_SetImageBits_RLE8( int lines, const BYTE *bits, DWORD width,
while(length--)
{
color_index = (*pIn++);
TSXPutPixel(bmpImage, x++, line,
XPutPixel(bmpImage, x++, line,
colors[color_index]);
}
@ -662,7 +662,7 @@ static void DIB_SetImageBits_16( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_16( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_24( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_24( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_32( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_32( int lines, const BYTE *srcbits,
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 @@ static void DIB_SetImageBits_32( int lines, const BYTE *srcbits,
*
* 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 @@ static int DIB_SetImageBits( const DIB_SETIMAGEBITS_DESCR *descr )
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 @@ INT32 WINAPI SetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
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 @@ INT32 WINAPI SetDIBitsToDevice32(HDC32 hdc, INT32 xDest, INT32 yDest, DWORD cx,
DIB_SETIMAGEBITS_DESCR descr;
DC * dc;
DWORD width, oldcy = cy;
INT32 result;
int height, tmpheight;
/* Check parameters */
@ -1018,7 +1023,10 @@ INT32 WINAPI SetDIBitsToDevice32(HDC32 hdc, INT32 xDest, INT32 yDest, DWORD cx,
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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
xend = info->bmiHeader.biWidth;
}
EnterCriticalSection( &X11DRV_CritSection );
bmpImage = (XImage *)CALL_LARGE_STACK( BITMAP_GetXImage, bmp );
switch( info->bmiHeader.biBitCount )
@ -1209,7 +1218,7 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
*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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
*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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
{
*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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
{
*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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
{
*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 @@ INT32 WINAPI GetDIBits32( HDC32 hdc, HBITMAP32 hbitmap, UINT32 startscan,
break;
}
TSXDestroyImage( bmpImage );
XDestroyImage( bmpImage );
LeaveCriticalSection( &X11DRV_CritSection );
info->bmiHeader.biCompression = 0;
}

View File

@ -1136,11 +1136,9 @@ BOOL16 WINAPI GetRasterizerCaps16( LPRASTERIZER_STATUS lprs, UINT16 cbNumBytes)
*/
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;
}

View File

@ -849,6 +849,28 @@ DWORD WINAPI GdiSetBatchLimit( DWORD limit )
}
/***********************************************************************
* 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)
*/

View File

@ -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 @@ BOOL16 WINAPI EnumMetaFile16(
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,17 +390,18 @@ BOOL16 WINAPI EnumMetaFile16(
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)) {
(METARECORD *) PTR_SEG_OFF_TO_HUGEPTR(seg, offset),
mh->mtNoObjects, (LONG)lpData ))
{
result = FALSE;
break;
}
@ -421,7 +423,7 @@ BOOL16 WINAPI EnumMetaFile16(
/* free handle table */
GlobalFree16(hHT);
GlobalUnlock16(hmf);
return result;
}
@ -1025,7 +1027,7 @@ static BOOL32 MF_Meta_CreateRegion( METARECORD *mr, HRGN32 hrgn )
* 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;

View File

@ -322,6 +322,8 @@ static HBITMAP16 OBM_MakeBitmap( WORD width, WORD height,
* 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 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
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 @@ static BOOL32 OBM_CreateBitmaps( OBM_BITMAP_DESCR *descr )
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 @@ HBITMAP16 OBM_LoadBitmap( WORD id )
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 @@ HGLOBAL16 OBM_LoadCursorIcon( WORD id, BOOL32 fCursor )
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 );

View File

@ -547,9 +547,7 @@ LOCVAL(LOCALE_SLIST,";")
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 @@ Is this "0123456789" ??
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_ITLZERO,"1")
/*
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_ITLZERO,"1")
/*
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_SABBREVMONTHNAME10,"loka")
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_ICENTURY, "0")
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")

View File

@ -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.

View File

@ -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."

View File

@ -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."

View File

@ -13,7 +13,8 @@ LICENSELANG = En
MOSTSRCS = \
license.c \
main.c
main.c \
dialog.c
# Some strings need addresses >= 0x10000
STRINGSRCS = \

View File

@ -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."

298
programs/notepad/dialog.c Normal file
View File

@ -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: */

41
programs/notepad/dialog.h Normal file
View File

@ -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: */

View File

@ -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 @@ void NOTEPAD_RegisterLanguages(void) {
if (langnum > MAX_LANGUAGE_NUMBER)
{
MessageBox(0, "No language found", "FATAL ERROR", MB_OK);
return(1);
PostQuitMessage(0);
}
}
@ -65,61 +159,42 @@ void NOTEPAD_RegisterLanguages(void) {
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 @@ LRESULT NOTEPAD_WndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
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,20 +263,28 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
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";
/* 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 =
@ -228,12 +311,14 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
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);

View File

@ -38,9 +38,12 @@ extern NOTEPAD_GLOBALS Globals;
/* 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)
@ -52,6 +55,10 @@ extern NOTEPAD_GLOBALS Globals;
/* string table index */
#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 @@ extern NOTEPAD_GLOBALS Globals;
/* 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: */

View File

@ -60,3 +60,48 @@ CONCAT(MENU_, LANGUAGE_ID) MENU
}
/* 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)
}

View File

@ -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]

View File

@ -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)

View File

@ -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..."

View File

@ -106,7 +106,7 @@ static BUILTIN32_DLL BuiltinDLLs[] =
*
* 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 @@ static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll )
DEBUG_ENTRY_POINT *debug;
REG_ENTRY_POINT *regs;
PE_MODREF *pem;
PDB32 *pdb = PROCESS_Current();
INT32 i, size;
BYTE *addr;
@ -279,8 +278,7 @@ static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll )
/* 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 @@ static HMODULE32 BUILTIN32_DoLoadModule( BUILTIN32_DLL *dll )
* 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 @@ HMODULE32 BUILTIN32_LoadModule( LPCSTR name, BOOL32 force )
if (!table->descr) return 0;
if (!table->used && !force) return 0;
return BUILTIN32_DoLoadModule( table );
return BUILTIN32_DoLoadModule( table, process );
}

View File

@ -268,7 +268,7 @@ type win32
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

View File

@ -91,7 +91,7 @@ type win32
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 @@ type win32
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 @@ type win32
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 @@ type win32
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

View File

@ -64,7 +64,7 @@ type win32
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 @@ type win32
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

View File

@ -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 @@ BEGIN
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 @@ FONT 10, "System"
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 @@ FONT 8, "Helv"
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 @@ FONT 8, "Helv"
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 @@ FONT 8, "Helv"
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 @@ FONT 8, "Helv"
{
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 @@ FONT 8, "Helv"
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 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
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 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
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 @@ FONT 8, "Helv"
PUSHBUTTON "&Hjälp", 1038, 174, 75, 50, 14, WS_GROUP | WS_TABSTOP
}

View File

@ -8,6 +8,7 @@ MODULE = scheduler
C_SRCS = \
critsection.c \
event.c \
handle.c \
k32obj.c \
mutex.c \
process.c \

View File

@ -86,7 +86,7 @@ HANDLE32 WINAPI CreateEvent32A( SECURITY_ATTRIBUTES *sa, BOOL32 manual_reset,
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 @@ HANDLE32 WINAPI OpenEvent32A( DWORD access, BOOL32 inherit, LPCSTR name )
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 @@ BOOL32 WINAPI PulseEvent( HANDLE32 handle )
{
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 @@ BOOL32 WINAPI SetEvent( HANDLE32 handle )
{
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 @@ BOOL32 WINAPI ResetEvent( HANDLE32 handle )
{
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;

235
scheduler/handle.c Normal file
View File

@ -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;
}

View File

@ -20,6 +20,7 @@ extern const K32OBJ_OPS PROCESS_Ops;
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 @@ const K32OBJ_OPS * const K32OBJ_Ops[K32OBJ_NBOBJECTS] =
&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 @@ BOOL32 K32OBJ_AddName( K32OBJ *obj, LPCSTR name )
* 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 @@ K32OBJ *K32OBJ_Create( K32OBJ_TYPE type, DWORD size, LPCSTR name,
if (obj->type == type)
{
SetLastError( ERROR_ALREADY_EXISTS );
*handle = PROCESS_AllocHandle( obj, 0 );
*handle = HANDLE_Alloc( obj, access, FALSE );
}
else
{
@ -206,7 +207,7 @@ K32OBJ *K32OBJ_Create( K32OBJ_TYPE type, DWORD size, LPCSTR name,
/* Allocate a handle */
*handle = PROCESS_AllocHandle( obj, 0 );
*handle = HANDLE_Alloc( obj, access, FALSE );
SYSTEM_UNLOCK();
return obj;
}

View File

@ -84,7 +84,7 @@ HANDLE32 WINAPI CreateMutex32A( SECURITY_ATTRIBUTES *sa, BOOL32 owner,
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 @@ HANDLE32 WINAPI OpenMutex32A( DWORD access, BOOL32 inherit, LPCSTR name )
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 @@ BOOL32 WINAPI ReleaseMutex( HANDLE32 handle )
{
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;

View File

@ -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 );
@ -37,42 +37,6 @@ const K32OBJ_OPS PROCESS_Ops =
};
/***********************************************************************
* 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
*/
@ -82,6 +46,25 @@ PDB32 *PROCESS_Current(void)
}
/***********************************************************************
* 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
*
@ -102,124 +85,6 @@ PDB32 *PROCESS_IdToPDB( DWORD id )
}
/***********************************************************************
* 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 @@ static BOOL32 PROCESS_FillEnvDB( PDB32 *pdb, TDB *pTask, LPCSTR cmd_line )
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 @@ error:
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 @@ static PDB32 *PROCESS_CreatePDB( PDB32 *parent )
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 @@ static PDB32 *PROCESS_CreatePDB( PDB32 *parent )
/* 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 @@ error:
*/
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 @@ HANDLE32 WINAPI OpenProcess( DWORD access, BOOL32 inherit, DWORD id )
SetLastError( ERROR_INVALID_HANDLE );
return 0;
}
return PROCESS_AllocHandle( &pdb->header, 0 );
return HANDLE_Alloc( &pdb->header, access, inherit );
}
@ -805,9 +680,7 @@ LCID WINAPI GetThreadLocale(void)
*/
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 @@ BOOL32 WINAPI SetPriorityClass( HANDLE32 hprocess, DWORD priorityclass )
fprintf(stderr,"SetPriorityClass: unknown priority class %ld\n",priorityclass);
break;
}
K32OBJ_DecCount((K32OBJ*)pdb);
K32OBJ_DecCount( &pdb->header );
return TRUE;
}
@ -837,11 +710,8 @@ BOOL32 WINAPI SetPriorityClass( HANDLE32 hprocess, DWORD priorityclass )
*/
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 @@ DWORD WINAPI GetPriorityClass(HANDLE32 hprocess)
default:
fprintf(stderr,"GetPriorityClass: unknown priority %ld\n",pdb->priority);
}
K32OBJ_DecCount((K32OBJ*)pdb);
K32OBJ_DecCount( &pdb->header );
}
return ret;
}
@ -918,6 +788,7 @@ HANDLE32 WINAPI GetStdHandle( DWORD std_handle )
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:

View File

@ -55,7 +55,7 @@ HANDLE32 WINAPI CreateSemaphore32A( SECURITY_ATTRIBUTES *sa, LONG initial,
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 @@ HANDLE32 WINAPI OpenSemaphore32A( DWORD access, BOOL32 inherit, LPCSTR name )
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 @@ BOOL32 WINAPI ReleaseSemaphore( HANDLE32 handle, LONG count, LONG *previous )
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;

View File

@ -32,7 +32,8 @@ static BOOL32 SYNC_BuildWaitStruct( DWORD count, const HANDLE32 *handles,
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)
{

Some files were not shown because too many files have changed in this diff Show More