Release 970202

Sun Feb  2 12:31:03 1997  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [files/drive.c]
	Fixed SetCurrentDirectory() to also change the current drive.

	* [win32/except.c] [tools/build.c]
	Use Win32 register functions to implement exception handling.
	Fixed UnhandledExceptionFilter.

Fri Jan 31 15:42:41  1997  David Faure  <david.faure@ihamy.insa-lyon.fr>

	* [windows/keyboard.c]
	Added KEYBOARD_GenerateMsg to generate Caps Lock and NumLock events
	Added calls to KEYBOARD_GenerateMsg when the key is pressed/released
	or when the state has changed, out of wine.
	Changed type 3-state 'ToggleKeyState' to boolean. The On/Off is given
	by InputKeyStateTable.

Wed Jan 29 21:53:04 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [loader/*resource.c][if1632/thunk.c]
	EnumResource* added.

	* [loader/pe_resource.] [loader/resource.c]
	SizeofResource32(), LoadAccelerators32() added.

	* [misc/lstr.c]
	FormatMessage %n added.

	* [misc/crtdll.c][include/ctrdll.h][if1632/crtdll.spec]
	_chdrive,_errno,_isctype added.

	* [misc/cpu.c]
	Replaced runtime_cpu by GetSystemInfo().

	* [windows/hook.c][include/hook.h]
	Fixed mapping of hooks to win32/unicode.

	* [windows/keyboard.c] [windows/defwnd.c]
	Updated to win32 standard.
	ALT-<Menukey> fixed.

	* [windows/queue.c]
	GetWindowThreadProcessId() implemented.

Mon Jan 27 16:42:49 1997  John Harvey <john@division.co.uk>

	* [graphics/metafiledrv/*] [graphics/x11drv/*]
	  [objects/bitmap.c] [objects/brush.c] [objects/font.c]
	  [objects/gdiobj.c] [objects/pen.c]
	Moved SelectObject to graphics drivers. Printer support now works
	in a few cases but is definitely not complete. Generic/text driver
	works. The postscript driver works if true type fonts are disabled
	from the control panel. To enable printer support add Printer=on
	to the wine section of your wine.conf file. This causes write not
	to work properly. I know that several other printer drivers do not
	work.

	* [tools/build.c]
	Make .stabs not used for svr4 since it doesn't use GNU assembler.

	* [misc/fontengine.c]
	Make sure a printf doesn't crash the system.

Sat Jan 25 15:53:35 1997  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/metafile.c]
	Fixed some problems with PlayMetaFileRecord().

	* [objects/dc.c]
	hClipRgn gets initialized in GetDCState().

Fri Jan 24 21:22:26 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [debugger/stabs.c]
	Handle file names beginning with '/'.

Fri Jan 24 18:33:04 1997  Robert Pouliot <krynos@clic.net>

	* [*/*]
	Some more patches for OS/2 support.

Fri Jan 24 11:30:41 1997  Bang Jun-Young  <bangjy@nownuri.nowcom.co.kr>

	* [resources/sysres_Ko.rc]
	Updated support for Korean (Ko) language.
This commit is contained in:
Alexandre Julliard 1997-02-02 19:01:52 +00:00
parent 01d6346a23
commit 349a95315b
113 changed files with 3083 additions and 2239 deletions

View File

@ -1,15 +1,13 @@
This is release 970120 of Wine, the MS Windows emulator. This is still a
This is release 970202 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-970120: (see ChangeLog for details)
- More keyboard improvements.
- Some new printer driver functions.
- Many fixes to Win32 loader.
- Better edit control.
WHAT'S NEW with Wine-970202: (see ChangeLog for details)
- More printer support.
- Some new Win32 functions.
- 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-970120.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970120.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970120.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970120.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970202.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970202.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970202.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-970202.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

View File

@ -1,3 +1,91 @@
----------------------------------------------------------------------
Sun Feb 2 12:31:03 1997 Alexandre Julliard <julliard@lrc.epfl.ch>
* [files/drive.c]
Fixed SetCurrentDirectory() to also change the current drive.
* [win32/except.c] [tools/build.c]
Use Win32 register functions to implement exception handling.
Fixed UnhandledExceptionFilter.
Fri Jan 31 15:42:41 1997 David Faure <david.faure@ihamy.insa-lyon.fr>
* [windows/keyboard.c]
Added KEYBOARD_GenerateMsg to generate Caps Lock and NumLock events
Added calls to KEYBOARD_GenerateMsg when the key is pressed/released
or when the state has changed, out of wine.
Changed type 3-state 'ToggleKeyState' to boolean. The On/Off is given
by InputKeyStateTable.
Wed Jan 29 21:53:04 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [loader/*resource.c][if1632/thunk.c]
EnumResource* added.
* [loader/pe_resource.] [loader/resource.c]
SizeofResource32(), LoadAccelerators32() added.
* [misc/lstr.c]
FormatMessage %n added.
* [misc/crtdll.c][include/ctrdll.h][if1632/crtdll.spec]
_chdrive,_errno,_isctype added.
* [misc/cpu.c]
Replaced runtime_cpu by GetSystemInfo().
* [windows/hook.c][include/hook.h]
Fixed mapping of hooks to win32/unicode.
* [windows/keyboard.c] [windows/defwnd.c]
Updated to win32 standard.
ALT-<Menukey> fixed.
* [windows/queue.c]
GetWindowThreadProcessId() implemented.
Mon Jan 27 16:42:49 1997 John Harvey <john@division.co.uk>
* [graphics/metafiledrv/*] [graphics/x11drv/*]
[objects/bitmap.c] [objects/brush.c] [objects/font.c]
[objects/gdiobj.c] [objects/pen.c]
Moved SelectObject to graphics drivers. Printer support now works
in a few cases but is definitely not complete. Generic/text driver
works. The postscript driver works if true type fonts are disabled
from the control panel. To enable printer support add Printer=on
to the wine section of your wine.conf file. This causes write not
to work properly. I know that several other printer drivers do not
work.
* [tools/build.c]
Make .stabs not used for svr4 since it doesn't use GNU assembler.
* [misc/fontengine.c]
Make sure a printf doesn't crash the system.
Sat Jan 25 15:53:35 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [objects/metafile.c]
Fixed some problems with PlayMetaFileRecord().
* [objects/dc.c]
hClipRgn gets initialized in GetDCState().
Fri Jan 24 21:22:26 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [debugger/stabs.c]
Handle file names beginning with '/'.
Fri Jan 24 18:33:04 1997 Robert Pouliot <krynos@clic.net>
* [*/*]
Some more patches for OS/2 support.
Fri Jan 24 11:30:41 1997 Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>
* [resources/sysres_Ko.rc]
Updated support for Korean (Ko) language.
----------------------------------------------------------------------
Sun Jan 19 11:46:48 1997 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -932,9 +932,14 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM16 wParam, LPARAM lParam )
int i, top, height;
top = 0;
if (!lphl)
return 0;
hdc = BeginPaint16( hwnd, &ps );
if (!IsWindowVisible16(hwnd) || !lphl->bRedrawFlag) {
if (!lphl) {
fprintf(stdnimp,"CBLPaint: CLBoxGetListHeader returned NULL!\n");
}
if (!IsWindowVisible16(hwnd) || !lphl || !lphl->bRedrawFlag) {
EndPaint16(hwnd, &ps);
return 0;
}

View File

@ -3450,11 +3450,11 @@ static LRESULT EDIT_WM_KeyDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
BOOL32 shift;
BOOL32 control;
if (GetKeyState(VK_MENU) & 0x8000)
if (GetKeyState32(VK_MENU) & 0x8000)
return 0;
shift = GetKeyState(VK_SHIFT) & 0x8000;
control = GetKeyState(VK_CONTROL) & 0x8000;
shift = GetKeyState32(VK_SHIFT) & 0x8000;
control = GetKeyState32(VK_CONTROL) & 0x8000;
EDIT_GetSel(wndPtr, &s, &e);
switch (wParam) {
@ -3599,7 +3599,7 @@ static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM32 wParam, LPARAM lParam)
c = EDIT_ColFromWndX(wndPtr, l, x);
li = (INT32)EDIT_EM_LineIndex(wndPtr, l, 0);
e = li + c;
if (GetKeyState(VK_SHIFT) & 0x8000)
if (GetKeyState32(VK_SHIFT) & 0x8000)
EDIT_GetSel(wndPtr, &s, NULL);
else
s = e;

View File

@ -349,6 +349,9 @@ static LRESULT LISTBOX_GetItemRect( WND *wnd, LB_DESCR *descr, INT32 index,
else if (descr->style & LBS_OWNERDRAWVARIABLE)
{
INT32 i;
rect->right += descr->horz_pos;
if ((index >= 0) && (index < descr->nb_items))
{
if (index < descr->top_item)
{
for (i = descr->top_item-1; i >= index; i--)
@ -360,7 +363,8 @@ static LRESULT LISTBOX_GetItemRect( WND *wnd, LB_DESCR *descr, INT32 index,
rect->top += descr->items[i].height;
}
rect->bottom = rect->top + descr->items[index].height;
rect->right += descr->horz_pos;
}
}
else
{
@ -1892,7 +1896,7 @@ static LRESULT LISTBOX_HandleKeyDown( WND *wnd, LB_DESCR *descr,
if (caret >= 0)
{
if ((descr->style & LBS_EXTENDEDSEL) &&
!(GetKeyState( VK_SHIFT ) & 0x8000))
!(GetKeyState32( VK_SHIFT ) & 0x8000))
descr->anchor_item = caret;
LISTBOX_MoveCaret( wnd, descr, caret, TRUE );
if (descr->style & LBS_NOTIFY)

View File

@ -208,10 +208,24 @@ void DEBUG_AddBreakpoint( const DBG_ADDR *address )
{
DBG_ADDR addr = *address;
int num;
unsigned int seg2;
BYTE *p;
DBG_FIX_ADDR_SEG( &addr, CS_reg(&DEBUG_context) );
if( addr.type != NULL && addr.type == DEBUG_TypeIntConst )
{
/*
* We know that we have the actual offset stored somewhere
* else in 32-bit space. Grab it, and we
* should be all set.
*/
seg2 = addr.seg;
addr.seg = 0;
addr.off = DEBUG_GetExprValue(&addr, NULL);
addr.seg = seg2;
}
if (next_bp < MAX_BREAKPOINTS)
num = next_bp++;
else /* try to find an empty slot */

View File

@ -14,6 +14,7 @@
#include "options.h"
#include "queue.h"
#include "win.h"
#include "winnt.h"
#include "debugger.h"
#include "expr.h"
@ -289,7 +290,7 @@ type_expr:
| tENUM tIDENTIFIER { $$ = DEBUG_TypeCast(ENUM, $2); }
expr_addr:
expr { $$ = DEBUG_EvalExpr($1) }
expr { $$ = DEBUG_EvalExpr($1); }
expr_value:
expr { DBG_ADDR addr = DEBUG_EvalExpr($1);
@ -348,7 +349,7 @@ expr:
* of expression that is suitable to be used as an lvalue.
*/
lval_addr:
lval { $$ = DEBUG_EvalExpr($1) }
lval { $$ = DEBUG_EvalExpr($1); }
lval:
lvalue { $$ = $1; }
@ -534,17 +535,6 @@ static void DEBUG_Main( int signal )
}
/***********************************************************************
* DEBUG_EnterDebugger
*
* Force an entry into the debugger.
*/
void DEBUG_EnterDebugger(void)
{
kill( getpid(), SIGHUP );
}
/***********************************************************************
* DebugBreak16 (KERNEL.203)
*/
@ -560,6 +550,17 @@ void DebugBreak16( CONTEXT *regs )
void wine_debug( int signal, SIGCONTEXT *regs )
{
DEBUG_SetSigContext( regs );
#if 0
DWORD *stack = (DWORD *)ESP_reg(&DEBUG_context);
*(--stack) = 0;
*(--stack) = 0;
*(--stack) = EH_NONCONTINUABLE;
*(--stack) = EXCEPTION_ACCESS_VIOLATION;
*(--stack) = EIP_reg(&DEBUG_context);
ESP_reg(&DEBUG_context) = (DWORD)stack;
EIP_reg(&DEBUG_context) = GetProcAddress32( GetModuleHandle("KERNEL32"),
"RaiseException" );
#endif
DEBUG_Main( signal );
DEBUG_GetSigContext( regs );
}

View File

@ -418,7 +418,14 @@ DEBUG_EvalExpr(struct expr * exp)
rtn.type = DEBUG_TypeIntConst;
exp->un.rgister.result = DEBUG_GetRegister(exp->un.rgister.reg);
rtn.off = (unsigned int) &exp->un.rgister.result;
rtn.seg = 0;
if( exp->un.rgister.reg == REG_EIP )
{
rtn.seg = CS_reg(&DEBUG_context);
}
else
{
rtn.seg = DS_reg(&DEBUG_context);
}
break;
case EXPR_TYPE_BINOP:
exp1 = DEBUG_EvalExpr(exp->un.binop.exp1);

View File

@ -751,17 +751,20 @@ void DEBUG_LoadEntryPoints(void)
for (ok = ModuleFirst(&entry); ok; ok = ModuleNext(&entry))
{
if (!(pModule = MODULE_GetPtr( entry.hModule ))) continue;
if (pModule->flags & NE_FFLAGS_WIN32) continue;
name = (unsigned char *)pModule + pModule->name_table;
fprintf( stderr, "Loading symbols from Win16 module %.*s...\n",
*name, name + 1 );
/* First search the resident names */
cpnt = (unsigned char *)pModule + pModule->name_table;
while (*cpnt)
{
cpnt += *cpnt + 1 + sizeof(WORD);
sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1,
*cpnt, *cpnt, cpnt + 1 );
sprintf( buffer, "%.*s_%.*s", *name, name + 1, *cpnt, cpnt + 1 );
if ((address = MODULE_GetEntryPoint( entry.hModule,
*(WORD *)(cpnt + *cpnt + 1) )))
{
@ -779,8 +782,7 @@ void DEBUG_LoadEntryPoints(void)
while (*cpnt)
{
cpnt += *cpnt + 1 + sizeof(WORD);
sprintf( buffer, "%*.*s.%*.*s", *name, *name, name + 1,
*cpnt, *cpnt, cpnt + 1 );
sprintf( buffer, "%.*s_%.*s", *name, name + 1, *cpnt, cpnt + 1 );
if ((address = MODULE_GetEntryPoint( entry.hModule,
*(WORD *)(cpnt + *cpnt + 1) )))
{

View File

@ -146,6 +146,7 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
unsigned int * dump;
int i;
unsigned char * pnt;
unsigned int seg2;
struct datatype * testtype;
unsigned short int * wdump;
@ -158,6 +159,20 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
* and hope that this is a sensible thing to do.
*/
if( addr.type != NULL )
{
if( addr.type == DEBUG_TypeIntConst )
{
/*
* We know that we have the actual offset stored somewhere
* else in 32-bit space. Grab it, and we
* should be all set.
*/
seg2 = addr.seg;
addr.seg = 0;
addr.off = DEBUG_GetExprValue(&addr, NULL);
addr.seg = seg2;
}
else
{
if (!DBG_CHECK_READ_PTR( &addr, 1 )) return;
DEBUG_TypeDerefPointer(&addr, &testtype);
@ -166,6 +181,12 @@ void DEBUG_ExamineMemory( const DBG_ADDR *address, int count, char format )
addr.off = DEBUG_GetExprValue(&addr, NULL);
}
}
}
else if (!addr.seg && !addr.off)
{
fprintf(stderr,"Invalid expression\n");
return;
}
if (format != 'i' && count > 1)
{

View File

@ -895,7 +895,7 @@ DEBUG_RegisterDebugInfo(int fd, struct pe_data * pe,
orig_size = size;
dbgptr = (LPIMAGE_DEBUG_DIRECTORY) (load_addr + v_addr);
for(; size > 0; size -= sizeof(*dbgptr), dbgptr++ )
for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
{
switch(dbgptr->Type)
{
@ -908,7 +908,7 @@ DEBUG_RegisterDebugInfo(int fd, struct pe_data * pe,
size = orig_size;
dbgptr = (LPIMAGE_DEBUG_DIRECTORY) (load_addr + v_addr);
for(; size > 0; size -= sizeof(*dbgptr), dbgptr++ )
for(; size >= sizeof(*dbgptr); size -= sizeof(*dbgptr), dbgptr++ )
{
switch(dbgptr->Type)
{

View File

@ -12,7 +12,7 @@
#include <fcntl.h>
#include <sys/stat.h>
#include <limits.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>

View File

@ -11,7 +11,9 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <sys/mman.h>
#ifndef PATH_MAX
#define PATH_MAX _MAX_PATH
#endif
#include "win.h"
#include "debugger.h"
@ -24,6 +26,9 @@
#ifdef __ELF__
#include <elf.h>
#include <link.h>
#include <sys/mman.h>
#elif defined(__EMX__)
#include <a_out.h>
#else
#include <a.out.h>
#endif
@ -883,7 +888,10 @@ DEBUG_ParseStabs(char * addr, unsigned int load_offset,
}
else
{
if (*ptr != '/')
strcat(currpath, ptr);
else
strcpy(currpath, ptr);
subpath = ptr;
}
last_nso = i;

View File

@ -11,14 +11,11 @@
#include <stdlib.h>
#include <assert.h>
#ifndef __EMX__
#include <sys/mman.h>
#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <strings.h>
#include <string.h>
#include <unistd.h>
#include <malloc.h>

View File

@ -593,7 +593,8 @@ DWORD SearchPath32A( LPCSTR path, LPCSTR name, LPCSTR ext, DWORD buflen,
lstrcpyn32A( buffer, full_name.short_name, buflen );
res = full_name.long_name +
strlen(DRIVE_GetRoot( full_name.short_name[0] - 'A' ));
if (*res && (buflen > 3)) lstrcpyn32A( buffer + 3, res + 1, buflen - 3 );
while (*res == '/') res++;
if (buflen > 3) lstrcpyn32A( buffer + 3, res, buflen - 3 );
for (p = buffer; *p; p++) if (*p == '/') *p = '\\';
if (lastpart) *lastpart = strrchr( buffer, '\\' ) + 1;
return *res ? strlen(res) + 2 : 3;
@ -622,7 +623,8 @@ DWORD SearchPath32W( LPCWSTR path, LPCWSTR name, LPCWSTR ext, DWORD buflen,
lstrcpynAtoW( buffer, full_name.short_name, buflen );
res = full_name.long_name +
strlen(DRIVE_GetRoot( full_name.short_name[0] - 'A' ));
if (*res && (buflen > 3)) lstrcpynAtoW( buffer + 3, res + 1, buflen - 3 );
while (*res == '/') res++;
if (buflen > 3) lstrcpynAtoW( buffer + 3, res + 1, buflen - 3 );
for (p = buffer; *p; p++) if (*p == '/') *p = '\\';
if (lastpart)
{

View File

@ -678,36 +678,38 @@ UINT32 GetCurrentDirectory32W( UINT32 buflen, LPWSTR buf )
*/
BOOL16 SetCurrentDirectory16( LPCSTR dir )
{
if (dir[0] && (dir[1]==':'))
{
int drive = tolower( *dir ) - 'a';
if (!DRIVE_IsValid(drive))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return 0;
}
dir += 2;
}
/* FIXME: what about empty strings? Add a \\ ? */
return DRIVE_Chdir( DRIVE_GetCurrentDrive(), dir );
return SetCurrentDirectory32A( dir );
}
/***********************************************************************
* SetCurrentDirectory32A (KERNEL32.479)
*/
BOOL32 SetCurrentDirectory32A( LPCSTR dir )
{
/* FIXME: Unauthorized Windows 95 mentions that SetCurrentDirectory
* may change drive and current directory for there is no drive based
* currentdir table?
*/
return SetCurrentDirectory16(dir);
int drive = DRIVE_GetCurrentDrive();
if (dir[0] && (dir[1]==':'))
{
drive = tolower( *dir ) - 'a';
if (!DRIVE_IsValid( drive ))
{
DOS_ERROR( ER_InvalidDrive, EC_MediaError, SA_Abort, EL_Disk );
return FALSE;
}
dir += 2;
}
/* FIXME: what about empty strings? Add a \\ ? */
if (!DRIVE_Chdir( drive, dir )) return FALSE;
if (drive == DRIVE_GetCurrentDrive()) return TRUE;
return DRIVE_SetCurrentDrive( drive );
}
/***********************************************************************
* SetCurrentDirectory32W (KERNEL32.480)
*/
BOOL32 SetCurrentDirectory32W( LPCWSTR dirW)
BOOL32 SetCurrentDirectory32W( LPCWSTR dirW )
{
LPSTR dir = HEAP_strdupWtoA( GetProcessHeap(), 0, dirW );
BOOL32 res = SetCurrentDirectory32A( dir );

View File

@ -435,6 +435,21 @@ BOOL32 GetFileTime( HFILE32 hFile, FILETIME *lpCreationTime,
return TRUE;
}
/***********************************************************************
* CompareFileTime (KERNEL32.28)
*/
INT32 CompareFileTime( LPFILETIME x, LPFILETIME y )
{
if (x->dwHighDateTime > y->dwHighDateTime)
return 1;
if (x->dwHighDateTime < y->dwHighDateTime)
return -1;
if (x->dwLowDateTime > y->dwLowDateTime)
return 1;
if (x->dwLowDateTime < y->dwLowDateTime)
return -1;
return 0;
}
/***********************************************************************
* FILE_Dup

View File

@ -10,6 +10,7 @@ C_SRCS = \
graphics.c \
init.c \
mapping.c \
objects.c \
text.c
all: $(MODULE).o

View File

@ -52,7 +52,7 @@ static const DC_FUNCTIONS MFDRV_Funcs =
MFDRV_ScaleViewportExt, /* pScaleViewportExt */
MFDRV_ScaleWindowExt, /* pScaleWindowExt */
NULL, /* pSelectClipRgn */
NULL, /* pSelectObject */
MFDRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */

View File

@ -0,0 +1,104 @@
/*
* GDI objects
*
* Copyright 1993 Alexandre Julliard
*/
#include <stdlib.h>
#include <stdio.h>
#include "bitmap.h"
#include "brush.h"
#include "font.h"
#include "metafile.h"
#include "metafiledrv.h"
#include "pen.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* MFDRV_BITMAP_SelectObject
*/
static HBITMAP16 MFDRV_BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap,
BITMAPOBJ * bmp )
{
return 0;
}
/***********************************************************************
* MFDRV_BRUSH_SelectObject
*/
static HBRUSH32 MFDRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
BRUSHOBJ * brush )
{
LOGBRUSH16 logbrush = { brush->logbrush.lbStyle,
brush->logbrush.lbColor,
brush->logbrush.lbHatch };
switch (brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_HATCHED:
case BS_HOLLOW:
if (!MF_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MF_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
break;
}
return 1; /* FIXME? */
}
/***********************************************************************
* MFDRV_FONT_SelectObject
*/
static HFONT16 MFDRV_FONT_SelectObject( DC * dc, HFONT16 hfont,
FONTOBJ * font )
{
HFONT16 prevHandle = dc->w.hFont;
if (MF_CreateFontIndirect(dc, hfont, &(font->logfont))) return prevHandle;
return 0;
}
/***********************************************************************
* MFDRV_PEN_SelectObject
*/
static HPEN32 MFDRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
HPEN32 prevHandle = dc->w.hPen;
LOGPEN16 logpen = { pen->logpen.lopnStyle,
{ pen->logpen.lopnWidth.x, pen->logpen.lopnWidth.y },
pen->logpen.lopnColor };
if (MF_CreatePenIndirect( dc, hpen, &logpen )) return prevHandle;
return 0;
}
/***********************************************************************
* MFDRV_SelectObject
*/
HGDIOBJ32 MFDRV_SelectObject( DC *dc, HGDIOBJ32 handle )
{
GDIOBJHDR * ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
if (!ptr) return 0;
dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
switch(ptr->wMagic)
{
case PEN_MAGIC:
return MFDRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
case BRUSH_MAGIC:
return MFDRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
case BITMAP_MAGIC:
return MFDRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
case FONT_MAGIC:
return MFDRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
case REGION_MAGIC:
return (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
}
return 0;
}

View File

@ -7,10 +7,14 @@ MODULE = x11drv
C_SRCS = \
bitblt.c \
bitmap.c \
brush.c \
clipping.c \
font.c \
graphics.c \
init.c \
objects.c \
pen.c \
text.c
all: $(MODULE).o

81
graphics/x11drv/bitmap.c Normal file
View File

@ -0,0 +1,81 @@
/*
* GDI bitmap objects
*
* Copyright 1993 Alexandre Julliard
*/
#include <stdio.h>
#include <stdlib.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include "gdi.h"
#include "callback.h"
#include "dc.h"
#include "bitmap.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
/***********************************************************************
* X11DRV_BITMAP_Init
*/
BOOL32 X11DRV_BITMAP_Init(void)
{
Pixmap tmpPixmap;
/* Create the necessary GCs */
if ((tmpPixmap = XCreatePixmap( display, rootWindow, 1, 1, 1 )))
{
BITMAP_monoGC = XCreateGC( display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( display, BITMAP_monoGC, False );
XFreePixmap( display, tmpPixmap );
}
if (screenDepth != 1)
{
if ((tmpPixmap = XCreatePixmap(display, rootWindow, 1,1,screenDepth)))
{
BITMAP_colorGC = XCreateGC( display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( display, BITMAP_colorGC, False );
XFreePixmap( display, tmpPixmap );
}
}
return TRUE;
}
/***********************************************************************
* X11DRV_BITMAP_SelectObject
*/
HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
BITMAPOBJ * bmp )
{
HRGN32 hrgn;
HBITMAP32 prevHandle = dc->w.hBitmap;
if (!(dc->w.flags & DC_MEMORY)) return 0;
if (dc->w.hVisRgn)
SetRectRgn(dc->w.hVisRgn, 0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight );
else
{
hrgn = CreateRectRgn32(0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight);
if (!hrgn) return 0;
dc->w.hVisRgn = hrgn;
}
dc->u.x.drawable = bmp->pixmap;
dc->w.hBitmap = hbitmap;
/* Change GC depth if needed */
if (dc->w.bitsPerPixel != bmp->bitmap.bmBitsPixel)
{
XFreeGC( display, dc->u.x.gc );
dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL );
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
DC_InitDC( dc );
}
else CLIPPING_UpdateGCRegion( dc ); /* Just update GC clip region */
return prevHandle;
}

270
graphics/x11drv/brush.c Normal file
View File

@ -0,0 +1,270 @@
/*
* GDI brush objects
*
* Copyright 1993, 1994 Alexandre Julliard
*/
#include <stdlib.h>
#include "brush.h"
#include "bitmap.h"
#include "color.h"
#include "x11drv.h"
#include "stddebug.h"
#include "debug.h"
static const char HatchBrushes[NB_HATCH_STYLES][8] =
{
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HS_VERTICAL */
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HS_FDIAGONAL */
{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HS_BDIAGONAL */
{ 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HS_CROSS */
{ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 } /* HS_DIAGCROSS */
};
/* Levels of each primary for dithering */
#define PRIMARY_LEVELS 3
#define TOTAL_LEVELS (PRIMARY_LEVELS*PRIMARY_LEVELS*PRIMARY_LEVELS)
/* Dithering matrix size */
#define MATRIX_SIZE 8
#define MATRIX_SIZE_2 (MATRIX_SIZE*MATRIX_SIZE)
/* Total number of possible levels for a dithered primary color */
#define DITHER_LEVELS (MATRIX_SIZE_2 * (PRIMARY_LEVELS-1) + 1)
/* Dithering matrix */
static const int dither_matrix[MATRIX_SIZE_2] =
{
0, 32, 8, 40, 2, 34, 10, 42,
48, 16, 56, 24, 50, 18, 58, 26,
12, 44, 4, 36, 14, 46, 6, 38,
60, 28, 52, 20, 62, 30, 54, 22,
3, 35, 11, 43, 1, 33, 9, 41,
51, 19, 59, 27, 49, 17, 57, 25,
15, 47, 7, 39, 13, 45, 5, 37,
63, 31, 55, 23, 61, 29, 53, 21
};
/* Mapping between (R,G,B) triples and EGA colors */
static const int EGAmapping[TOTAL_LEVELS] =
{
0, /* 000000 -> 000000 */
4, /* 00007f -> 000080 */
12, /* 0000ff -> 0000ff */
2, /* 007f00 -> 008000 */
6, /* 007f7f -> 008080 */
6, /* 007fff -> 008080 */
10, /* 00ff00 -> 00ff00 */
6, /* 00ff7f -> 008080 */
14, /* 00ffff -> 00ffff */
1, /* 7f0000 -> 800000 */
5, /* 7f007f -> 800080 */
5, /* 7f00ff -> 800080 */
3, /* 7f7f00 -> 808000 */
8, /* 7f7f7f -> 808080 */
7, /* 7f7fff -> c0c0c0 */
3, /* 7fff00 -> 808000 */
7, /* 7fff7f -> c0c0c0 */
7, /* 7fffff -> c0c0c0 */
9, /* ff0000 -> ff0000 */
5, /* ff007f -> 800080 */
13, /* ff00ff -> ff00ff */
3, /* ff7f00 -> 808000 */
7, /* ff7f7f -> c0c0c0 */
7, /* ff7fff -> c0c0c0 */
11, /* ffff00 -> ffff00 */
7, /* ffff7f -> c0c0c0 */
15 /* ffffff -> ffffff */
};
#define PIXEL_VALUE(r,g,b) \
COLOR_mapEGAPixel[EGAmapping[((r)*PRIMARY_LEVELS+(g))*PRIMARY_LEVELS+(b)]]
/* X image for building dithered pixmap */
static XImage *ditherImage = NULL;
/***********************************************************************
* BRUSH_Init
*
* Create the X image used for dithering.
*/
BOOL32 X11DRV_BRUSH_Init(void)
{
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, screenDepth );
return (ditherImage != NULL);
}
/***********************************************************************
* BRUSH_DitherColor
*/
static Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
{
static COLORREF prevColor = 0xffffffff;
unsigned int x, y;
Pixmap pixmap;
if (color != prevColor)
{
int r = GetRValue( color ) * DITHER_LEVELS;
int g = GetGValue( color ) * DITHER_LEVELS;
int b = GetBValue( color ) * DITHER_LEVELS;
const int *pmatrix = dither_matrix;
for (y = 0; y < MATRIX_SIZE; y++)
{
for (x = 0; x < MATRIX_SIZE; x++)
{
int d = *pmatrix++ * 256;
int dr = ((r + d) / MATRIX_SIZE_2) / 256;
int dg = ((g + d) / MATRIX_SIZE_2) / 256;
int db = ((b + d) / MATRIX_SIZE_2) / 256;
XPutPixel( ditherImage, x, y, PIXEL_VALUE(dr,dg,db) );
}
}
prevColor = color;
}
pixmap = XCreatePixmap( display, rootWindow,
MATRIX_SIZE, MATRIX_SIZE, screenDepth );
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
return pixmap;
}
/***********************************************************************
* BRUSH_SelectSolidBrush
*/
static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
{
if ((dc->w.bitsPerPixel > 1) && (screenDepth <= 8) && !COLOR_IsSolid( color ))
{
/* Dithered brush */
dc->u.x.brush.pixmap = BRUSH_DitherColor( dc, color );
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0;
}
else
{
/* Solid brush */
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, color );
dc->u.x.brush.fillStyle = FillSolid;
}
}
/***********************************************************************
* BRUSH_SelectPatternBrush
*/
static BOOL32 BRUSH_SelectPatternBrush( DC * dc, HBITMAP32 hbitmap )
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
dc->u.x.brush.pixmap = XCreatePixmap( display, rootWindow,
8, 8, bmp->bitmap.bmBitsPixel );
XCopyArea( display, bmp->pixmap, dc->u.x.brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
if (bmp->bitmap.bmBitsPixel > 1)
{
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0; /* Ignored */
}
else
{
dc->u.x.brush.fillStyle = FillOpaqueStippled;
dc->u.x.brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
}
return TRUE;
}
/***********************************************************************
* BRUSH_SelectObject
*/
HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
{
HBITMAP16 hBitmap;
BITMAPINFO * bmpInfo;
HBRUSH16 prevHandle = dc->w.hBrush;
dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
dc->hSelf,hbrush);
#ifdef NOTDEF
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
LOGBRUSH16 logbrush = { brush->logbrush.lbStyle,
brush->logbrush.lbColor,
brush->logbrush.lbHatch };
switch (brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_HATCHED:
case BS_HOLLOW:
if (!MF_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MF_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
break;
}
return 1; /* FIXME? */
}
#endif
dc->w.hBrush = hbrush;
if (dc->u.x.brush.pixmap)
{
XFreePixmap( display, dc->u.x.brush.pixmap );
dc->u.x.brush.pixmap = 0;
}
dc->u.x.brush.style = brush->logbrush.lbStyle;
switch(brush->logbrush.lbStyle)
{
case BS_NULL:
dprintf_gdi( stddeb,"BS_NULL\n" );
break;
case BS_SOLID:
dprintf_gdi( stddeb,"BS_SOLID\n" );
BRUSH_SelectSolidBrush( dc, brush->logbrush.lbColor );
break;
case BS_HATCHED:
dprintf_gdi( stddeb, "BS_HATCHED\n" );
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
dc->u.x.brush.pixmap = XCreateBitmapFromData( display, rootWindow,
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
dc->u.x.brush.fillStyle = FillStippled;
break;
case BS_PATTERN:
dprintf_gdi( stddeb, "BS_PATTERN\n");
BRUSH_SelectPatternBrush( dc, (HBRUSH16)brush->logbrush.lbHatch );
break;
case BS_DIBPATTERN:
dprintf_gdi( stddeb, "BS_DIBPATTERN\n");
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)brush->logbrush.lbHatch )))
{
int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
hBitmap = CreateDIBitmap32( dc->hSelf, &bmpInfo->bmiHeader,
CBM_INIT, ((char *)bmpInfo) + size,
bmpInfo,
(WORD)brush->logbrush.lbColor );
BRUSH_SelectPatternBrush( dc, hBitmap );
DeleteObject16( hBitmap );
GlobalUnlock16( (HGLOBAL16)brush->logbrush.lbHatch );
}
break;
}
return prevHandle;
}

View File

@ -4,9 +4,250 @@
* Copyright 1996 Alexandre Julliard
*/
#include "windows.h"
#include "x11drv.h"
#include "gdi.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <X11/Xatom.h>
#include "font.h"
#include "heap.h"
#include "metafile.h"
#include "options.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
struct FontStructure {
char *window;
char *x11;
} FontNames[32];
int FontSize;
/***********************************************************************
* X11DRV_FONT_Init
*/
BOOL32 X11DRV_FONT_Init( void )
{
char temp[1024];
LPSTR ptr;
int i;
if (PROFILE_GetWineIniString( "fonts", NULL, "*", temp, sizeof(temp) ) > 2 )
{
for( ptr = temp, i = 1; strlen(ptr) != 0; ptr += strlen(ptr) + 1 )
if( strcmp( ptr, "default" ) )
FontNames[i++].window = xstrdup( ptr );
FontSize = i;
for( i = 1; i < FontSize; i++ )
{
PROFILE_GetWineIniString( "fonts", FontNames[i].window, "*",
temp, sizeof(temp) );
FontNames[i].x11 = xstrdup( temp );
}
PROFILE_GetWineIniString( "fonts", "default", "*", temp, sizeof(temp) );
FontNames[0].x11 = xstrdup( temp );
} else {
FontNames[0].window = NULL; FontNames[0].x11 = "*-helvetica";
FontNames[1].window = "ms sans serif"; FontNames[1].x11 = "*-helvetica";
FontNames[2].window = "ms serif"; FontNames[2].x11 = "*-times";
FontNames[3].window = "fixedsys"; FontNames[3].x11 = "*-fixed";
FontNames[4].window = "arial"; FontNames[4].x11 = "*-helvetica";
FontNames[5].window = "helv"; FontNames[5].x11 = "*-helvetica";
FontNames[6].window = "roman"; FontNames[6].x11 = "*-times";
FontNames[7].window = "system"; FontNames[7].x11 = "*-helvetica";
FontSize = 8;
}
return TRUE;
}
/***********************************************************************
* FONT_ChkX11Family
*
* returns a valid X11 equivalent if a Windows face name
* is like a X11 family - or NULL if translation is needed
*/
static char *FONT_ChkX11Family(char *winFaceName )
{
static char x11fam[32+2]; /* will be returned */
int i;
for(i = 0; lpLogFontList[i] != NULL; i++)
if( !lstrcmpi32A(winFaceName, lpLogFontList[i]->lfFaceName) )
{
strcpy(x11fam,"*-");
return strcat(x11fam,winFaceName);
}
return NULL; /* a FONT_TranslateName() call is needed */
}
/***********************************************************************
* FONT_TranslateName
*
* Translate a Windows face name to its X11 equivalent.
* This will probably have to be customizable.
*/
static const char *FONT_TranslateName( char *winFaceName )
{
int i;
for (i = 1; i < FontSize; i ++)
if( !lstrcmpi32A( winFaceName, FontNames[i].window ) ) {
dprintf_font(stddeb, "---- Mapped %s to %s\n", winFaceName, FontNames[i].x11 );
return FontNames[i].x11;
}
return FontNames[0].x11;
}
/***********************************************************************
* FONT_MatchFont
*
* Find a X font matching the logical font.
*/
static XFontStruct * FONT_MatchFont( LOGFONT16 * font, DC * dc )
{
char pattern[100];
const char *family, *weight, *charset;
char **names;
char slant, oldspacing, spacing;
int width, height, oldheight, count;
XFontStruct * fontStruct;
dprintf_font(stddeb,
"FONT_MatchFont(H,W = %d,%d; Weight = %d; Italic = %d; FaceName = '%s'\n",
font->lfHeight, font->lfWidth, font->lfWeight, font->lfItalic, font->lfFaceName);
weight = (font->lfWeight > 550) ? "bold" : "medium";
slant = font->lfItalic ? 'i' : 'r';
if (font->lfHeight == -1)
height = 0;
else
height = font->lfHeight * dc->vportExtX / dc->wndExtX;
if (height == 0) height = 120; /* Default height = 12 */
else if (height < 0)
{
/* If height is negative, it means the height of the characters */
/* *without* the internal leading. So we adjust it a bit to */
/* compensate. 5/4 seems to give good results for small fonts. */
/*
* J.M.: This causes wrong font size for bigger fonts e.g. in Winword & Write
height = 10 * (-height * 9 / 8);
* may be we have to use an non linear function
*/
/* assume internal leading is 2 pixels. Else small fonts will become
* very small. */
height = (height-2) * -10;
}
else height *= 10;
width = 10 * (font->lfWidth * dc->vportExtY / dc->wndExtY);
if (width < 0) {
dprintf_font( stddeb, "FONT_MatchFont: negative width %d(%d)\n",
width, font->lfWidth );
width = -width;
}
spacing = (font->lfPitchAndFamily & FIXED_PITCH) ? 'm' :
(font->lfPitchAndFamily & VARIABLE_PITCH) ? 'p' : '*';
charset = (font->lfCharSet == ANSI_CHARSET) ? "iso8859-1" : "*-*";
if (*font->lfFaceName) {
family = FONT_ChkX11Family(font->lfFaceName);
/*--do _not_ translate if lfFaceName is family from X11 A.K.*/
if (!family)
family = FONT_TranslateName( font->lfFaceName );
/* FIX ME: I don't if that's correct but it works J.M. */
spacing = '*';
}
else switch(font->lfPitchAndFamily & 0xf0)
{
case FF_ROMAN:
family = FONT_TranslateName( "roman" );
break;
case FF_SWISS:
family = FONT_TranslateName( "swiss" );
break;
case FF_MODERN:
family = FONT_TranslateName( "modern" );
break;
case FF_SCRIPT:
family = FONT_TranslateName( "script" );
break;
case FF_DECORATIVE:
family = FONT_TranslateName( "decorative" );
break;
default:
family = "*-*";
break;
}
sprintf( pattern, "-%s-%s-*-normal-*-*-*-*-*-*-*-%s",
family, weight, charset);
dprintf_font(stddeb, "FONT_MatchFont: '%s'\n", pattern );
names = XListFonts( display, pattern, 1, &count );
if (names) XFreeFontNames( names );
else
{
if (strcmp(family, "*-*") == 0)
{
fprintf(stderr, "FONT_MatchFont(%s) : returning NULL\n", pattern);
return NULL;
}
else family = "*-*";
}
oldheight = height;
oldspacing = spacing;
while (TRUE) {
/* Width==0 seems not to be a valid wildcard on SGI's, using * instead */
if ( width == 0 )
sprintf( pattern, "-%s-%s-%c-normal-*-*-%d-*-*-%c-*-%s",
family, weight, slant, height, spacing, charset);
else
sprintf( pattern, "-%s-%s-%c-normal-*-*-%d-*-*-%c-%d-%s",
family, weight, slant, height, spacing, width, charset);
dprintf_font(stddeb, "FONT_MatchFont: '%s'\n", pattern );
names = XListFonts( display, pattern, 1, &count );
if (count > 0) break;
if (spacing == 'm') /* try 'c' if no 'm' found */ {
spacing = 'c';
continue;
} else if (spacing == 'p') /* try '*' if no 'p' found */ {
spacing = '*';
continue;
}
spacing = oldspacing;
height -= 10;
if (height < 10) {
if (slant == 'i') {
/* try oblique if no italic font */
slant = 'o';
height = oldheight;
continue;
}
if (spacing == 'm' && strcmp(family, "*-*") != 0) {
/* If a fixed spacing font could not be found, ignore
* the family */
family = "*-*";
height = oldheight;
continue;
}
fprintf(stderr, "FONT_MatchFont(%s) : returning NULL\n", pattern);
return NULL;
}
}
dprintf_font(stddeb," Found '%s'\n", *names );
if (!*font->lfFaceName)
FONT_ParseFontParms(*names, 2, font->lfFaceName , LF_FACESIZE-1);
/* we need a font name for function GetTextFace() even if there isn't one ;-) */
fontStruct = XLoadQueryFont( display, *names );
XFreeFontNames( names );
return fontStruct;
}
/***********************************************************************
* X11DRV_GetTextExtentPoint
@ -62,4 +303,156 @@ BOOL32 X11DRV_GetTextMetrics(DC *dc, TEXTMETRIC32A *metrics)
}
/***********************************************************************
* X11DRV_FONT_SelectObject
*/
HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont, FONTOBJ * font )
{
static X_PHYSFONT stockFonts[LAST_STOCK_FONT-FIRST_STOCK_FONT+1];
static struct {
HFONT32 id;
LOGFONT16 logfont;
int access;
int used;
X_PHYSFONT cacheFont; } cacheFonts[FONTCACHE], *cacheFontsMin;
int i;
X_PHYSFONT * stockPtr;
HFONT32 prevHandle = dc->w.hFont;
XFontStruct * fontStruct;
dprintf_font(stddeb,"FONT_SelectObject(%p, %04x, %p)\n", dc, hfont, font);
#if 0 /* From the code in SelectObject, this can not happen */
/* Load font if necessary */
if (!font)
{
HFONT16 hnewfont;
hnewfont = CreateFont16(10, 7, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, "*" );
font = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hnewfont );
}
#endif
if ((hfont >= FIRST_STOCK_FONT) && (hfont <= LAST_STOCK_FONT))
stockPtr = &stockFonts[hfont - FIRST_STOCK_FONT];
else {
stockPtr = NULL;
/*
* Ok, It's not a stock font but
* may be it's cached in dynamic cache
*/
for(i=0; i<FONTCACHE; i++) /* search for same handle */
if (cacheFonts[i].id==hfont) { /* Got the handle */
/*
* Check if Handle matches the font
*/
if(memcmp(&cacheFonts[i].logfont,&(font->logfont), sizeof(LOGFONT16))) {
/* No: remove handle id from dynamic font cache */
cacheFonts[i].access=0;
cacheFonts[i].used=0;
cacheFonts[i].id=0;
/* may be there is an unused handle which contains the font */
for(i=0; i<FONTCACHE; i++) {
if((cacheFonts[i].used == 0) &&
(memcmp(&cacheFonts[i].logfont,&(font->logfont), sizeof(LOGFONT16)))== 0) {
/* got it load from cache and set new handle id */
stockPtr = &cacheFonts[i].cacheFont;
cacheFonts[i].access=1;
cacheFonts[i].used=1;
cacheFonts[i].id=hfont;
dprintf_font(stddeb,"FONT_SelectObject: got font from unused handle\n");
break;
}
}
}
else {
/* Yes: load from dynamic font cache */
stockPtr = &cacheFonts[i].cacheFont;
cacheFonts[i].access++;
cacheFonts[i].used++;
}
break;
}
}
if (!stockPtr || !stockPtr->fstruct)
{
if (!(fontStruct = FONT_MatchFont( &font->logfont, dc )))
{
/* If it is not a stock font, we can simply return 0 */
if (!stockPtr) return 0;
/* Otherwise we must try to find a substitute */
dprintf_font(stddeb,"Loading font 'fixed' for %04x\n", hfont );
font->logfont.lfPitchAndFamily &= ~VARIABLE_PITCH;
font->logfont.lfPitchAndFamily |= FIXED_PITCH;
fontStruct = XLoadQueryFont( display, "fixed" );
if (!fontStruct)
{
fprintf( stderr, "No system font could be found. Please check your font path.\n" );
exit( 1 );
}
}
}
else
{
fontStruct = stockPtr->fstruct;
dprintf_font(stddeb,
"FONT_SelectObject: Loaded font from cache %04x %p\n",
hfont, fontStruct );
}
/* Unuse previous font */
for (i=0; i < FONTCACHE; i++) {
if (cacheFonts[i].id == prevHandle) {
if(cacheFonts[i].used == 0)
fprintf(stderr, "Trying to decrement a use count of 0.\n");
else
cacheFonts[i].used--;
}
}
/* Store font */
dc->w.hFont = hfont;
if (stockPtr)
{
if (!stockPtr->fstruct)
{
stockPtr->fstruct = fontStruct;
FONT_GetMetrics( &font->logfont, fontStruct, &stockPtr->metrics );
}
memcpy( &dc->u.x.font, stockPtr, sizeof(*stockPtr) );
}
else
{
/*
* Check in cacheFont
*/
cacheFontsMin=NULL;
for (i=0; i < FONTCACHE; i++) {
if (cacheFonts[i].used==0)
if ((!cacheFontsMin) || ((cacheFontsMin) && (cacheFontsMin->access > cacheFonts[i].access)))
cacheFontsMin=&cacheFonts[i];
}
if (!cacheFontsMin) {
fprintf(stderr,"No unused font cache entry !!!!\n" );
return prevHandle;
}
if (cacheFontsMin->id!=0) {
dprintf_font(stddeb,
"FONT_SelectObject: Freeing %04x \n",cacheFontsMin->id );
XFreeFont( display, cacheFontsMin->cacheFont.fstruct );
}
cacheFontsMin->cacheFont.fstruct = fontStruct;
FONT_GetMetrics( &font->logfont, fontStruct, &cacheFontsMin->cacheFont.metrics );
cacheFontsMin->access=1;
cacheFontsMin->used=1;
cacheFontsMin->id=hfont;
memcpy( &dc->u.x.font, &(cacheFontsMin->cacheFont), sizeof(cacheFontsMin->cacheFont) );
memcpy(&cacheFontsMin->logfont,&(font->logfont), sizeof(LOGFONT16));
}
return prevHandle;
}

View File

@ -52,7 +52,7 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL, /* pScaleViewportExt (optional) */
NULL, /* pScaleWindowExt (optional) */
NULL, /* pSelectClipRgn */
NULL, /* pSelectObject */
X11DRV_SelectObject, /* pSelectObject */
NULL, /* pSelectPalette */
NULL, /* pSetBkColor */
NULL, /* pSetBkMode */
@ -84,6 +84,18 @@ static DeviceCaps X11DRV_DevCaps;
*/
BOOL32 X11DRV_Init(void)
{
/* Create default bitmap */
if (!X11DRV_BITMAP_Init()) return FALSE;
/* Initialize brush dithering */
if (!X11DRV_BRUSH_Init()) return FALSE;
/* Initialize fonts */
if (!X11DRV_FONT_Init()) return FALSE;
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
}

50
graphics/x11drv/objects.c Normal file
View File

@ -0,0 +1,50 @@
/*
* GDI objects
*
* Copyright 1993 Alexandre Julliard
*/
#include <stdlib.h>
#include <stdio.h>
#include "bitmap.h"
#include "brush.h"
#include "font.h"
#include "pen.h"
#include "stddebug.h"
#include "debug.h"
extern HBITMAP32 X11DRV_BITMAP_SelectObject( DC * dc, HBITMAP32 hbitmap,
BITMAPOBJ * bmp );
extern HBRUSH32 X11DRV_BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush,
BRUSHOBJ * brush );
extern HFONT32 X11DRV_FONT_SelectObject( DC * dc, HFONT32 hfont,
FONTOBJ * font );
extern HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
/***********************************************************************
* X11DRV_SelectObject
*/
HGDIOBJ32 X11DRV_SelectObject( DC *dc, HGDIOBJ32 handle )
{
GDIOBJHDR *ptr = GDI_GetObjPtr( handle, MAGIC_DONTCARE );
if (!ptr) return 0;
dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", dc->hSelf, handle );
switch(ptr->wMagic)
{
case PEN_MAGIC:
return X11DRV_PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
case BRUSH_MAGIC:
return X11DRV_BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
case BITMAP_MAGIC:
return X11DRV_BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
case FONT_MAGIC:
return X11DRV_FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
case REGION_MAGIC:
return (HGDIOBJ16)SelectClipRgn16( dc->hSelf, handle );
}
return 0;
}

51
graphics/x11drv/pen.c Normal file
View File

@ -0,0 +1,51 @@
/*
* GDI pen objects
*
* Copyright 1993 Alexandre Julliard
*/
#include "pen.h"
#include "color.h"
#include "stddebug.h"
#include "debug.h"
static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
/***********************************************************************
* PEN_SelectObject
*/
HPEN32 X11DRV_PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
HPEN32 prevHandle = dc->w.hPen;
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle;
dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->vportExtX / dc->wndExtX;
if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
switch(pen->logpen.lopnStyle)
{
case PS_DASH:
dc->u.x.pen.dashes = (char *)PEN_dash;
dc->u.x.pen.dash_len = 2;
break;
case PS_DOT:
dc->u.x.pen.dashes = (char *)PEN_dot;
dc->u.x.pen.dash_len = 2;
break;
case PS_DASHDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdot;
dc->u.x.pen.dash_len = 4;
break;
case PS_DASHDOTDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
dc->u.x.pen.dash_len = 6;
break;
}
return prevHandle;
}

View File

@ -60,9 +60,6 @@ C_SRCS = \
relay.c \
thunk.c
ASM_SRCS = \
except.S
GEN_ASM_SRCS = \
$(SPEC_FILES) \
callfrom16.s \
@ -93,7 +90,4 @@ callto16.s: $(TOPSRCDIR)/include/callback.h $(BUILD)
callto32.s: $(TOPSRCDIR)/include/callback.h $(BUILD)
$(BUILD) -o $@ -callto32 `cat $(TOPSRCDIR)/include/callback.h | grep "extern.*CallTo32_" | sed 's/.*CallTo32_\(.*\)(.*/\1/' | sort | uniq`
except.o: except.S $(TOPOBJDIR)/include/config.h
$(CC) -c $(DIVINCL) -o $*.o $(SRCDIR)/except.S
### Dependencies:

View File

@ -54,7 +54,7 @@ base 1
049 stub _cexit
050 stub _cgets
051 stub _chdir
052 stub _chdrive
052 cdecl _chdrive(long) CRTDLL__chdrive
053 stub _chgsign
054 stub _chmod
055 stub _chsize
@ -79,7 +79,7 @@ base 1
074 stub _endthread
075 extern _environ_dll CRTDLL_environ_dll
076 stub _eof
077 stub _errno
077 cdecl _errno() CRTDLL__errno
078 stub _except_handler2
079 stub _execl
080 stub _execle
@ -140,7 +140,7 @@ base 1
135 cdecl _initterm(ptr ptr) CRTDLL__initterm
136 stub _iob
137 cdecl _isatty(long) CRTDLL__isatty
138 stub _isctype
138 cdecl _isctype(long long) CRTDLL__isctype
139 stub _ismbbalnum
140 stub _ismbbalpha
141 stub _ismbbgraph
@ -432,7 +432,7 @@ base 1
427 cdecl malloc(ptr) CRTDLL_malloc
428 stub mblen
429 stub mbstowcs
430 stub mbtowc
430 cdecl mbtowc(long) CRTDLL_mbtowc
431 cdecl memchr(ptr long long) memchr
432 cdecl memcmp(ptr ptr long) memcmp
433 cdecl memcpy(ptr ptr long) memcpy
@ -510,7 +510,7 @@ base 1
505 stub wcscmp
506 cdecl wcscoll(ptr ptr) CRTDLL_wcscoll
507 cdecl wcscpy(ptr ptr) lstrcpy32W
508 stub wcscspn
508 cdecl wcscspn(ptr ptr) CRTDLL_wcscspn
509 stub wcsftime
510 cdecl wcslen(ptr) lstrlen32W
511 cdecl wcsncat(ptr ptr long) lstrcatn32W

View File

@ -1,191 +0,0 @@
/*
* Win32 exception assembly functions
*
* Copyright (c) 1996 Onno Hovers, (onno@stack.urc.tue.nl)
*
*/
#include "config.h"
#ifdef NEED_UNDERSCORE_PREFIX
.globl _EXC_CallUnhandledExceptionFilter
_EXC_CallUnhandledExceptionFilter:
#else
.globl EXC_CallUnhandledExceptionFilter
EXC_CallUnhandledExceptionFilter:
#endif /* NEED_UNDERSCORE_PREFIX */
leal 4(%esp),%eax
pushl %eax
#ifdef NEED_UNDERSCORE_PREFIX
call *_pTopExcHandler
#else
call *pTopExcHandler
#endif /* NEED_UNDERSCORE_PREFIX */
movl %ebp,%esp
ret
/*******************************************************************
*
* RaiseException (KERNEL32. 418 )
* RtlUnwind (KERNEL32. 443 )
*
* we need to save our context before a call to
*
* -RaiseException
* -RtlUnwind
*
* after these functions we need to restore that context structure as
* the actual context so changes made to the context structure in an
* exception-handler will be reflected in the context after these
* functions return. Fortunately both functions have 4 DWORD params.
* we pass the function to be called as a fifth parameter to ContextCall
*
*/
#define CONTEXT_SegSs -4
#define CONTEXT_Esp -8
#define CONTEXT_EFlags -12
#define CONTEXT_SegCs -16
#define CONTEXT_Eip -20
#define CONTEXT_Ebp -24
#define CONTEXT_Eax -28
#define CONTEXT_Ecx -32
#define CONTEXT_Edx -36
#define CONTEXT_Ebx -40
#define CONTEXT_Esi -44
#define CONTEXT_Edi -48
#define CONTEXT_SegDs -52
#define CONTEXT_SegEs -56
#define CONTEXT_SegFs -60
#define CONTEXT_SegGs -64
#define FLOAT_Cr0NpxState -68
#define FLOAT_RegisterArea -148
#define FLOAT_DataSelector -152
#define FLOAT_DataOffset -156
#define FLOAT_ErrorSelector -160
#define FLOAT_ErrorOffset -164
#define FLOAT_TagWord -168
#define FLOAT_StatusWord -172
#define FLOAT_ControlWord -176
#define CONTEXT_FloatSave -176
#define CONTEXT_Dr7 -180
#define CONTEXT_Dr6 -184
#define CONTEXT_Dr3 -188
#define CONTEXT_Dr2 -192
#define CONTEXT_Dr1 -196
#define CONTEXT_Dr0 -200
#define CONTEXT_ContextFlags -204
#define CONTEXT -204
#define CONTEXTSIZE 204
#define CONTEXTFLAGS 0x10007
#define ORIG_ESP 16 /** cdecl !!! **/
#define PARM_ARG4 28
#define PARM_ARG3 24
#define PARM_ARG2 20
#define PARM_ARG1 16
#define PARM_RETURN 12
#define PARM_CALLFUNC 8
#define PARM_EBP 4
#define PARM_EFLAGS 0
#ifdef NEED_UNDERSCORE_PREFIX
.globl _RaiseException
_RaiseException:
push $_EXC_RaiseException
jmp ContextCall
.globl _RtlUnwind
_RtlUnwind:
push $_EXC_RtlUnwind
#else /* NEED_UNDERSCORE_PREFIX */
.globl RaiseException
RaiseException:
push $EXC_RaiseException
jmp ContextCall
.globl RtlUnwind
RtlUnwind:
push $EXC_RtlUnwind
#endif /* NEED_UNDERSCORE_PREFIX */
ContextCall:
pushl %ebp
pushfl
movl %esp, %ebp
subl $CONTEXTSIZE, %esp
movl %eax, CONTEXT_Eax(%ebp)
leal ORIG_ESP(%ebp), %eax
movl %eax, CONTEXT_Esp(%ebp)
movl PARM_EFLAGS(%ebp), %eax
movl %eax, CONTEXT_EFlags(%ebp)
movl PARM_EBP(%ebp), %eax
movl %eax, CONTEXT_Ebp(%ebp)
movl PARM_RETURN(%ebp), %eax
movl %eax, CONTEXT_Eip(%ebp)
movl %edi, CONTEXT_Edi(%ebp)
movl %esi, CONTEXT_Esi(%ebp)
movl %ebx, CONTEXT_Ebx(%ebp)
movl %edx, CONTEXT_Edx(%ebp)
movl %ecx, CONTEXT_Ecx(%ebp)
xorl %eax, %eax
movw %ss, %ax
movl %eax, CONTEXT_SegSs(%ebp)
movw %cs, %ax
movl %eax, CONTEXT_SegCs(%ebp)
movw %gs, %ax
movl %eax, CONTEXT_SegGs(%ebp)
movw %fs, %ax
movl %eax, CONTEXT_SegFs(%ebp)
movw %es, %ax
movl %eax, CONTEXT_SegEs(%ebp)
movw %ds, %ax
movl %eax, CONTEXT_SegDs(%ebp)
fsave CONTEXT_FloatSave(%ebp)
movl $CONTEXTFLAGS, %eax
movl %eax, CONTEXT_ContextFlags(%ebp)
pushl %ebp
leal CONTEXT(%ebp), %eax
pushl %eax
pushl PARM_ARG4(%ebp)
pushl PARM_ARG3(%ebp)
pushl PARM_ARG2(%ebp)
pushl PARM_ARG1(%ebp)
call *PARM_CALLFUNC(%ebp)
addl $20,%esp
popl %ebp
lds CONTEXT_Esp(%ebp),%edi
movl CONTEXT_Eip(%ebp),%eax
movl %eax,-4(%edi)
movl CONTEXT_EFlags(%ebp),%eax
movl %eax,-8(%edi)
movl CONTEXT_Edi(%ebp),%eax
movl %eax,-12(%edi)
movl CONTEXT_SegDs(%ebp),%eax
movw %ax,%ds
movl CONTEXT_SegEs(%ebp),%eax
movw %ax,%es
movl CONTEXT_SegFs(%ebp),%eax
movw %ax,%fs
movl CONTEXT_SegGs(%ebp),%eax
movw %ax,%gs
frstor CONTEXT_FloatSave(%ebp)
movl CONTEXT_Ecx(%ebp),%ecx
movl CONTEXT_Edx(%ebp),%edx
movl CONTEXT_Ebx(%ebp),%ebx
movl CONTEXT_Esi(%ebp),%esi
movl CONTEXT_Eax(%ebp),%eax
movl CONTEXT_Ebp(%ebp),%ebp
lea -12(%edi),%esp
popl %edi
popfl
ret

View File

@ -209,9 +209,9 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
281 pascal DrvSetPrinterData(ptr ptr ptr ptr long) DrvSetPrinterData
282 pascal DrvGetPrinterData(ptr ptr ptr ptr long ptr) DrvGetPrinterData
299 stub ENGINEGETCHARWIDTHEX
300 pascal EnginEnumerateFont(ptr segptr long) EngineEnumerateFont
300 pascal EngineEnumerateFont(ptr segptr long) EngineEnumerateFont
301 stub ENGINEDELETEFONT
302 pascal EnginRealizeFont(ptr ptr ptr) EngineRealizeFont
302 pascal EngineRealizeFont(ptr ptr ptr) EngineRealizeFont
303 stub ENGINEGETCHARWIDTH
304 stub ENGINESETFONTCONTEXT
305 stub ENGINEGETGLYPHBMP

View File

@ -294,7 +294,7 @@ base 1
0286 stub RemoveFontResourceW
0287 stdcall ResetDCA(long ptr) ResetDC32A
0288 stdcall ResetDCW(long ptr) ResetDC32W
0289 stub ResizePalette
0289 stdcall ResizePalette(long long) ResizePalette
0290 stdcall RestoreDC(long long) RestoreDC32
0291 stdcall RoundRect(long long long long long long long) RoundRect32
0292 stdcall SaveDC(long) SaveDC32
@ -332,7 +332,7 @@ base 1
0323 stub SetMetaFileBitsEx
0324 stub SetMetaRgn
0325 stub SetMiterLimit
0326 stub SetPaletteEntries
0326 stdcall SetPaletteEntries(long long long ptr) SetPaletteEntries
0327 stdcall SetPixel(long long long long) SetPixel32
0328 stub SetPixelFormat
0329 stub SetPixelV
@ -341,7 +341,7 @@ base 1
0332 stdcall SetRectRgn(long long long long long) SetRectRgn
0333 stdcall SetRelAbs(long long) SetRelAbs32
0334 stdcall SetStretchBltMode(long long) SetStretchBltMode32
0335 stub SetSystemPaletteUse
0335 stdcall SetSystemPaletteUse(long long) SetSystemPaletteUse
0336 stdcall SetTextAlign(long long) SetTextAlign32
0337 stdcall SetTextCharacterExtra(long long) SetTextCharacterExtra32
0338 stdcall SetTextColor(long long) SetTextColor

View File

@ -103,7 +103,7 @@ type win16
104 stub GetCodeInfo
105 pascal16 GetExeVersion() GetExeVersion
106 pascal SetSwapAreaSize(word) SetSwapAreaSize
107 pascal16 SetErrorMode(word) SetErrorMode
107 pascal16 SetErrorMode(word) SetErrorMode16
108 pascal16 SwitchStackTo(word word word) SwitchStackTo
109 register SwitchStackBack() SwitchStackBack
110 pascal16 PatchCodeHandle(word) PatchCodeHandle

View File

@ -30,7 +30,7 @@ base 1
0025 stub CmdBatNotification
0026 stub CommConfigDialogA
0027 stub CommConfigDialogW
0028 stub CompareFileTime
0028 stdcall CompareFileTime(ptr ptr) CompareFileTime
0029 stdcall CompareStringA(long long ptr long ptr long) CompareString32A
0030 stdcall CompareStringW(long long ptr long ptr long) CompareString32W
0031 stub ConnectNamedPipe
@ -65,7 +65,7 @@ base 1
0060 stub CreateSemaphoreA
0061 stub CreateSemaphoreW
0062 stub CreateTapePartition
0063 stub CreateThread
0063 stdcall CreateThread(ptr long ptr long long ptr) CreateThread
0064 stub CreateVirtualBuffer
0065 stub DebugActiveProcess
0066 stub DebugBreak
@ -88,12 +88,12 @@ base 1
0083 stub EnumCalendarInfoW
0084 stub EnumDateFormatsA
0085 stub EnumDateFormatsW
0086 stub EnumResourceLanguagesA
0087 stub EnumResourceLanguagesW
0088 stub EnumResourceNamesA
0089 stub EnumResourceNamesW
0090 stub EnumResourceTypesA
0091 stub EnumResourceTypesW
0086 stdcall EnumResourceLanguagesA(long ptr ptr ptr long) THUNK_EnumResourceLanguages32A
0087 stdcall EnumResourceLanguagesW(long ptr ptr ptr long) THUNK_EnumResourceLanguages32W
0088 stdcall EnumResourceNamesA(long ptr ptr long) THUNK_EnumResourceNames32A
0089 stdcall EnumResourceNamesW(long ptr ptr long) THUNK_EnumResourceNames32W
0090 stdcall EnumResourceTypesA(long ptr long) THUNK_EnumResourceTypes32A
0091 stdcall EnumResourceTypesW(long ptr long) THUNK_EnumResourceTypes32W
0092 stdcall EnumSystemCodePagesA(ptr long) THUNK_EnumSystemCodePages32A
0093 stdcall EnumSystemCodePagesW(ptr long) THUNK_EnumSystemCodePages32W
0094 stdcall EnumSystemLocalesA(ptr long) THUNK_EnumSystemLocales32A
@ -407,7 +407,7 @@ base 1
0402 stub OpenProfileUserMapping
0403 stub OpenSemaphoreA
0404 stub OpenSemaphoreW
0405 stub OutputDebugStringA
0405 stdcall OutputDebugStringA(ptr) OutputDebugString
0406 stub OutputDebugStringW
0407 stub PeekConsoleInputA
0408 stub PeekConsoleInputW
@ -420,7 +420,7 @@ base 1
0415 stdcall QueryPerformanceCounter(ptr) QueryPerformanceCounter
0416 stub QueryPerformanceFrequency
0417 stub QueryWin31IniFilesMappedToRegistry
0418 stdcall RaiseException(long long long ptr) RaiseException
0418 register RaiseException(long long long ptr) RaiseException
0419 stdcall ReadConsoleA(long ptr long ptr ptr) ReadConsole32A
0420 stub ReadConsoleInputA
0421 stub ReadConsoleInputW
@ -445,7 +445,7 @@ base 1
0440 stub ResumeThread
0441 stdcall RtlFillMemory(ptr long long) RtlFillMemory
0442 stdcall RtlMoveMemory(ptr ptr long) RtlMoveMemory
0443 stdcall RtlUnwind(ptr long ptr long) RtlUnwind
0443 register RtlUnwind(ptr long ptr long) RtlUnwind
0444 stdcall RtlZeroMemory(ptr long) RtlZeroMemory
0445 stub ScrollConsoleScreenBufferA
0446 stub ScrollConsoleScreenBufferW
@ -488,7 +488,7 @@ base 1
0483 stdcall SetEndOfFile(long) SetEndOfFile
0484 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariable32A
0485 stdcall SetEnvironmentVariableW(ptr ptr) SetEnvironmentVariable32W
0486 stdcall SetErrorMode(long) SetErrorMode
0486 stdcall SetErrorMode(long) SetErrorMode32
0487 stdcall SetEvent(long) SetEvent
0488 stdcall SetFileApisToANSI() SetFileApisToANSI
0489 stdcall SetFileApisToOEM() SetFileApisToOEM
@ -518,7 +518,7 @@ base 1
0513 stub SetThreadLocale
0514 stdcall SetThreadPriority(long long) SetThreadPriority
0515 stdcall SetTimeZoneInformation(ptr) SetTimeZoneInformation
0516 stdcall SetUnhandledExceptionFilter(ptr) SetUnhandledExceptionFilter
0516 stdcall SetUnhandledExceptionFilter(ptr) THUNK_SetUnhandledExceptionFilter
0517 stub SetVDMCurrentDirectories
0518 stub SetVolumeLabelA
0519 stub SetVolumeLabelW

View File

@ -4,7 +4,7 @@ type win16
#1 pascal Inquire
#2 pascal Enable
#3 pascal Disable
4 pascal16 ToAscii(word word ptr ptr word) ToAscii
4 pascal16 ToAscii(word word ptr ptr word) ToAscii16
5 pascal16 AnsiToOem(ptr ptr) AnsiToOem16
6 pascal16 OemToAnsi(ptr ptr) OemToAnsi16
7 return SetSpeed 2 65535
@ -12,9 +12,9 @@ type win16
#126 pascal GetTableSeg
#127 pascal NewTable
128 pascal OemKeyScan(word) OemKeyScan
129 pascal16 VkKeyScan(byte) VkKeyScan
130 pascal16 GetKeyboardType(byte) GetKeyboardType
131 pascal16 MapVirtualKey(word word) MapVirtualKey
129 pascal16 VkKeyScan(byte) VkKeyScan16
130 pascal16 GetKeyboardType(byte) GetKeyboardType16
131 pascal16 MapVirtualKey(word word) MapVirtualKey16
132 pascal16 GetKbCodePage() GetKbCodePage
133 pascal16 GetKeyNameText(long ptr word) GetKeyNameText16
134 pascal16 AnsiToOemBuff(ptr ptr word) AnsiToOemBuff16

View File

@ -863,7 +863,7 @@ base 0
859 stub __eFYL2XP1
860 stub __eGetStatusWord
861 stub _alloca_probe
862 stub _chkstk
862 return _chkstk 0 0
863 stub _fltused
864 stub _ftol
865 stub _itoa

View File

@ -217,28 +217,26 @@ void RELAY_DebugCallTo16( int* stack, int nbargs )
*/
void RELAY_DebugCallFrom32( int *stack, int nb_args )
{
int *parg;
int *parg, i;
if (!debugging_relay) return;
printf( "Call %s(", BUILTIN_GetEntryPoint32( (void *)stack[-2] ));
if (nb_args > 0)
{
for (parg = &stack[2]; nb_args; parg++, nb_args--)
for (i = nb_args & 0x7fffffff, parg = &stack[2]; i; parg++, i--)
{
printf( "%08x", *parg );
if (nb_args > 1) printf( "," );
}
if (i > 1) printf( "," );
}
printf( ") ret=%08x\n", stack[1] );
if (nb_args == -1) /* Register function */
if (nb_args & 0x80000000) /* Register function */
{
CONTEXT *context = (CONTEXT *)((BYTE *)stack - sizeof(CONTEXT) - 8);
printf( " EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
context->Eax, context->Ebx, context->Ecx, context->Edx,
context->Esi, context->Edi );
printf( " EBP=%08lx ESP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->SegDs, context->SegEs,
context->SegFs, context->SegGs, context->EFlags );
printf( " EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->Eip, context->SegDs,
context->SegEs, context->SegFs, context->SegGs,
context->EFlags );
}
}
@ -261,15 +259,16 @@ void RELAY_DebugCallFrom32Ret( int *stack, int nb_args, int ret_val )
if (!debugging_relay) return;
printf( "Ret %s() retval=%08x ret=%08x\n",
BUILTIN_GetEntryPoint32( (void *)stack[-2] ), ret_val, stack[1] );
if (nb_args == -1) /* Register function */
if (nb_args & 0x80000000) /* Register function */
{
CONTEXT *context = (CONTEXT *)((BYTE *)stack - sizeof(CONTEXT) - 8);
printf( " EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx ESI=%08lx EDI=%08lx\n",
context->Eax, context->Ebx, context->Ecx, context->Edx,
context->Esi, context->Edi );
printf( " EBP=%08lx ESP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->SegDs, context->SegEs,
context->SegFs, context->SegGs, context->EFlags );
printf( " EBP=%08lx ESP=%08lx EIP=%08lx DS=%04lx ES=%04lx FS=%04lx GS=%04lx EFL=%08lx\n",
context->Ebp, context->Esp, context->Eip, context->SegDs,
context->SegEs, context->SegFs, context->SegGs,
context->EFlags );
}
}

View File

@ -11,6 +11,7 @@
#include "module.h"
#include "stddebug.h"
#include "debug.h"
#include "except.h"
typedef void (*RELAY)();
@ -41,7 +42,7 @@ static THUNK *firstThunk = NULL;
*/
static THUNK *THUNK_Alloc( FARPROC32 func, RELAY relay )
{
THUNK *thunk = HeapAlloc( SystemHeap, 0, sizeof(*thunk) );
THUNK *thunk = HeapAlloc( GetProcessHeap(), 0, sizeof(*thunk) );
if (thunk)
{
thunk->popl_eax = 0x58;
@ -73,14 +74,14 @@ static THUNK *THUNK_Find( FARPROC32 func )
*/
void THUNK_Free( THUNK *thunk )
{
if (HEAP_IsInsideHeap( SystemHeap, 0, thunk ))
if (HEAP_IsInsideHeap( GetProcessHeap(), 0, thunk ))
{
THUNK **prev = &firstThunk;
while (*prev && (*prev != thunk)) prev = &(*prev)->next;
if (*prev)
{
*prev = thunk->next;
HeapFree( SystemHeap, 0, thunk );
HeapFree( GetProcessHeap(), 0, thunk );
return;
}
}
@ -396,6 +397,60 @@ BOOL32 THUNK_EnumSystemLocales32W( LOCALE_ENUMPROC32W func, DWORD flags )
return EnumSystemLocales32W( (LOCALE_ENUMPROC32W)&thunk, flags );
}
/***********************************************************************
* THUNK_EnumResourceLanguages32W (KERNEL32.87)
*/
BOOL32 THUNK_EnumResourceLanguages32W( HMODULE32 hmod,LPCWSTR type,LPCWSTR name,ENUMRESLANGPROC32W func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_5 );
return EnumResourceLanguages32W( hmod,type,name,(ENUMRESLANGPROC32W)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumResourceLanguages32A (KERNEL32.86)
*/
BOOL32 THUNK_EnumResourceLanguages32A( HMODULE32 hmod,LPCSTR type,LPCSTR name,ENUMRESLANGPROC32A func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_5 );
return EnumResourceLanguages32A( hmod,type,name,(ENUMRESLANGPROC32A)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumResourceNames32A (KERNEL32.88)
*/
BOOL32 THUNK_EnumResourceNames32A( HMODULE32 hmod,LPCWSTR type,ENUMRESNAMEPROC32A func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumResourceNames32A( hmod,type,(ENUMRESNAMEPROC32A)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumResourceNames32W (KERNEL32.89)
*/
BOOL32 THUNK_EnumResourceNames32W( HMODULE32 hmod,LPCWSTR type,ENUMRESNAMEPROC32W func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumResourceNames32W( hmod,type,(ENUMRESNAMEPROC32W)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumResourceTypes32A (KERNEL32.90)
*/
BOOL32 THUNK_EnumResourceTypes32A( HMODULE32 hmod,ENUMRESTYPEPROC32A func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_3 );
return EnumResourceTypes32A( hmod,(ENUMRESTYPEPROC32A)&thunk, lParam );
}
/***********************************************************************
* THUNK_EnumResourceTypes32W (KERNEL32.91)
*/
BOOL32 THUNK_EnumResourceTypes32W( HMODULE32 hmod,ENUMRESTYPEPROC32W func, LONG lParam )
{
DECL_THUNK( thunk, func, CallTo32_3 );
return EnumResourceTypes32W( hmod,(ENUMRESTYPEPROC32W)&thunk, lParam );
}
/***********************************************************************
* THUNK_GrayString16 (USER.185)
@ -464,6 +519,24 @@ BOOL16 THUNK_UnhookWindowsHookEx16( HHOOK hhook )
}
/*************************************************************
* THUNK_SetUnhandledExceptionFilter (KERNEL32.516)
*/
LPTOP_LEVEL_EXCEPTION_FILTER THUNK_SetUnhandledExceptionFilter(
LPTOP_LEVEL_EXCEPTION_FILTER filter )
{
LPTOP_LEVEL_EXCEPTION_FILTER old;
THUNK *thunk = THUNK_Alloc( (FARPROC16)filter, (RELAY)CallTo32_1 );
if (!thunk) return NULL;
old = SetUnhandledExceptionFilter( (LPTOP_LEVEL_EXCEPTION_FILTER)thunk );
if (!old) return NULL;
thunk = (THUNK *)old;
old = (LPTOP_LEVEL_EXCEPTION_FILTER)thunk->proc;
THUNK_Free( thunk );
return old;
}
static FARPROC16 defDCHookProc = NULL;
/***********************************************************************

View File

@ -105,7 +105,7 @@ heap 65520
103 pascal16 MapDialogRect(word ptr) MapDialogRect16
104 pascal16 MessageBeep(word) MessageBeep
105 pascal16 FlashWindow(word word) FlashWindow
106 pascal16 GetKeyState(word) GetKeyState
106 pascal16 GetKeyState(word) GetKeyState16
107 pascal DefWindowProc(word word word long) DefWindowProc16
108 pascal16 GetMessage(segptr word word word) GetMessage
109 pascal16 PeekMessage(ptr word word word word) PeekMessage16
@ -177,7 +177,7 @@ heap 65520
175 pascal16 LoadBitmap(word segptr) LoadBitmap16
176 pascal16 LoadString(word word ptr s_word) LoadString16
177 pascal16 LoadAccelerators(word segptr) LoadAccelerators16
178 pascal16 TranslateAccelerator(word word ptr) TranslateAccelerator
178 pascal16 TranslateAccelerator(word word ptr) TranslateAccelerator16
179 pascal16 GetSystemMetrics(word) GetSystemMetrics
180 pascal GetSysColor(word) GetSysColor
181 pascal16 SetSysColors(word ptr ptr) SetSysColors
@ -251,7 +251,7 @@ heap 65520
246 stub ExitWindowsExec
247 pascal16 GetCursor() GetCursor
248 pascal16 GetOpenClipboardWindow() GetOpenClipboardWindow
249 pascal16 GetAsyncKeyState(word) GetAsyncKeyState
249 pascal16 GetAsyncKeyState(word) GetAsyncKeyState16
250 pascal16 GetMenuState(word word word) GetMenuState16
251 pascal SendDriverMessage(word word long long) SendDriverMessage
252 pascal16 OpenDriver(ptr ptr long) OpenDriver

View File

@ -104,7 +104,7 @@ base 1
0097 stub DdeDisconnectList
0098 stub DdeEnableCallback
0099 stub DdeFreeDataHandle
0100 stub DdeFreeStringHandle
0100 return DdeFreeStringHandle 8 0
0101 stub DdeGetData
0102 return DdeGetLastError 4 0
0103 stub DdeGetQualityOfService
@ -122,7 +122,7 @@ base 1
0115 stub DdeSetQualityOfService
0116 stub DdeSetUserHandle
0117 stub DdeUnaccessData
0118 stub DdeUninitialize
0118 return DdeUninitialize 4 0
0119 stdcall DefDlgProcA(long long long long) DefDlgProc32A
0120 stdcall DefDlgProcW(long long long long) DefDlgProc32W
0121 stdcall DefFrameProcA(long long long long long) DefFrameProc32A
@ -210,7 +210,7 @@ base 1
0203 stub FreeDDElParam
0204 stdcall GetActiveWindow() GetActiveWindow32
0205 stdcall GetAppCompatFlags(long) GetAppCompatFlags
0206 stdcall GetAsyncKeyState(long) GetAsyncKeyState
0206 stdcall GetAsyncKeyState(long) GetAsyncKeyState32
0207 stdcall GetCapture() GetCapture32
0208 stdcall GetCaretBlinkTime() GetCaretBlinkTime32
0209 stdcall GetCaretPos(ptr) GetCaretPos32
@ -250,15 +250,15 @@ base 1
0243 stub GetInputState
0244 stdcall GetInternalWindowPos(long ptr ptr) GetInternalWindowPos32
0245 stub GetKBCodePage
0246 stub GetKeyNameTextA
0247 stub GetKeyNameTextW
0248 stdcall GetKeyState(long) GetKeyState
0246 stdcall GetKeyNameTextA(long ptr long) GetKeyNameText32A
0247 stdcall GetKeyNameTextW(long ptr long) GetKeyNameText32W
0248 stdcall GetKeyState(long) GetKeyState32
0249 stub GetKeyboardLayout
0250 stub GetKeyboardLayoutList
0251 stub GetKeyboardLayoutNameA
0252 stub GetKeyboardLayoutNameW
0253 stub GetKeyboardState
0254 stub GetKeyboardType
0253 stdcall GetKeyboardState(ptr) GetKeyboardState
0254 stdcall GetKeyboardType(long) GetKeyboardType32
0255 stdcall GetLastActivePopup(long) GetLastActivePopup
0256 stdcall GetMenu(long) GetMenu32
0257 stdcall GetMenuCheckMarkDimensions() GetMenuCheckMarkDimensions
@ -275,7 +275,7 @@ base 1
0268 stdcall GetMenuStringW(long long ptr long long) GetMenuString32W
0269 stdcall GetMessageA(ptr long long long) USER32_GetMessageA
0270 stub GetMessageExtraInfo
0271 stub GetMessagePos
0271 stdcall GetMessagePos() GetMessagePos
0272 stub GetMessageTime
0273 stdcall GetMessageW(ptr long long long) USER32_GetMessageA
0274 stdcall GetNextDlgGroupItem(long long long) GetNextDlgGroupItem32
@ -313,10 +313,10 @@ base 1
0306 stdcall GetWindowPlacement(long ptr) GetWindowPlacement32
0307 stdcall GetWindowRect(long ptr) GetWindowRect32
0308 stdcall GetWindowTextA(long ptr long) GetWindowText32A
0309 stub GetWindowTextLengthA
0310 stub GetWindowTextLengthW
0309 stdcall GetWindowTextLengthA(long) GetWindowTextLength32A
0310 stdcall GetWindowTextLengthW(long) GetWindowTextLength32W
0311 stdcall GetWindowTextW(long ptr long) GetWindowText32W
0312 stub GetWindowThreadProcessId
0312 stdcall GetWindowThreadProcessId(long ptr) GetWindowThreadProcessId
0313 stdcall GetWindowWord(long long) GetWindowWord
0314 stub GrayStringA
0315 stub GrayStringW
@ -346,7 +346,7 @@ base 1
0339 stdcall IsClipboardFormatAvailable(long) IsClipboardFormatAvailable
0340 stub IsDialogMessage
0341 stdcall IsDialogMessageA(long ptr) IsDialogMessage32A
0342 stub IsDialogMessageW
0342 stdcall IsDialogMessageW(long ptr) IsDialogMessage32W
0343 stdcall IsDlgButtonChecked(long long) IsDlgButtonChecked32
0344 stdcall IsIconic(long) IsIconic32
0345 stdcall IsMenu(long) IsMenu32
@ -386,17 +386,17 @@ base 1
0379 stub LookupIconIdFromDirectoryEx
0380 stub MBToWCSEx
0381 stdcall MapDialogRect(long ptr) MapDialogRect32
0382 stub MapVirtualKeyA
0382 stdcall MapVirtualKeyA(long long) MapVirtualKey32A
0383 stub MapVirtualKeyExA
0384 stub MapVirtualKeyW
0384 stdcall MapVirtualKeyW(long long) MapVirtualKey32A
0385 stdcall MapWindowPoints(long long ptr long) MapWindowPoints32
0386 stub MenuItemFromPoint
0387 stub MenuWindowProcA
0388 stub MenuWindowProcW
0389 stdcall MessageBeep(long) MessageBeep
0390 stdcall MessageBoxA(long ptr ptr long) MessageBox32A
0391 stub MessageBoxExA
0392 stub MessageBoxExW
0391 stdcall MessageBoxExA(long ptr ptr long long) MessageBoxEx32A
0392 stdcall MessageBoxExW(long ptr ptr long long) MessageBoxEx32W
0393 stub MessageBoxIndirectA
0394 stub MessageBoxIndirectW
0395 stdcall MessageBoxW(long ptr ptr long) MessageBox32W
@ -404,7 +404,7 @@ base 1
0397 stdcall ModifyMenuW(long long long long ptr) ModifyMenu32W
0398 stdcall MoveWindow(long long long long long long) MoveWindow32
0399 stub MsgWaitForMultipleObjects
0400 stub OemKeyScan
0400 stdcall OemKeyScan(long) OemKeyScan
0401 stdcall OemToCharA(ptr ptr) OemToChar32A
0402 stdcall OemToCharBuffA(ptr ptr long) OemToCharBuff32A
0403 stdcall OemToCharBuffW(ptr ptr long) OemToCharBuff32W
@ -487,7 +487,7 @@ base 1
0480 stdcall SetFocus(long) SetFocus32
0481 return SetForegroundWindow 4 0
0482 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32
0483 stub SetKeyboardState
0483 stdcall SetKeyboardState(ptr) SetKeyboardState
0484 stdcall SetLastErrorEx(long long) SetLastErrorEx
0485 stub SetLogonNotifyWindow
0486 stdcall SetMenu(long long) SetMenu32
@ -549,14 +549,14 @@ base 1
0542 stub TabbedTextOutW
0543 stub TileChildWindows
0544 stub TileWindows
0545 stub ToAscii
0545 stdcall ToAscii32(long long ptr ptr long) ToAscii32
0546 stub ToAsciiEx
0547 stub ToUnicode
0548 stdcall TrackPopupMenu(long long long long long long ptr) TrackPopupMenu32
0549 stdcall TrackPopupMenuEx(long long long long long ptr) TrackPopupMenuEx
0550 stdcall TranslateAccelerator(long long ptr) TranslateAccelerator
0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator
0552 stdcall TranslateAcceleratorW(long long ptr) TranslateAccelerator
0550 stdcall TranslateAccelerator(long long ptr) TranslateAccelerator32
0551 stdcall TranslateAcceleratorA(long long ptr) TranslateAccelerator32
0552 stdcall TranslateAcceleratorW(long long ptr) TranslateAccelerator32
0553 stub TranslateCharsetInfo
0554 stub TranslateMDISysAccel
0555 stdcall TranslateMessage(ptr) USER32_TranslateMessage
@ -576,10 +576,10 @@ base 1
0569 stub UserRegisterWowHandlers
0570 stdcall ValidateRect(long ptr) ValidateRect32
0571 stdcall ValidateRgn(long long) ValidateRgn32
0572 stdcall VkKeyScanA(long) VkKeyScan
0572 stdcall VkKeyScanA(long) VkKeyScan32A
0573 stub VkKeyScanExA
0574 stub VkKeyScanExW
0575 stub VkKeyScanW
0575 stdcall VkKeyScanW(long) VkKeyScan32W
0576 stub WaitForInputIdle
0577 stub WaitMessage
0578 stdcall WinHelpA(long ptr long long) WinHelp32A

View File

@ -7,11 +7,12 @@
#ifndef __WINE_BITMAP_H
#define __WINE_BITMAP_H
#include <X11/extensions/XShm.h>
#include "gdi.h"
#include "xmalloc.h"
#ifdef PRELIMINARY_WING16_SUPPORT
/* FIXME: this doesn't belong here */
#include <X11/extensions/XShm.h>
typedef struct
{
@ -52,8 +53,6 @@ extern BOOL32 BITMAP_Init(void);
extern INT16 BITMAP_GetObject16( BITMAPOBJ * bmp, INT16 count, LPVOID buffer );
extern INT32 BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer );
extern BOOL32 BITMAP_DeleteObject( HBITMAP16 hbitmap, BITMAPOBJ * bitmap );
extern HBITMAP16 BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap,
BITMAPOBJ * bmp );
/* objects/dib.c */
extern int DIB_GetImageWidthBytes( int width, int depth );

View File

@ -16,10 +16,10 @@ typedef struct
LOGBRUSH32 logbrush;
} BRUSHOBJ;
extern BOOL32 BRUSH_Init(void);
#define NB_HATCH_STYLES 6
extern INT16 BRUSH_GetObject16( BRUSHOBJ * brush, INT16 count, LPSTR buffer );
extern INT32 BRUSH_GetObject32( BRUSHOBJ * brush, INT32 count, LPSTR buffer );
extern BOOL32 BRUSH_DeleteObject( HBRUSH16 hbrush, BRUSHOBJ * brush );
extern HBRUSH32 BRUSH_SelectObject(DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush);
#endif /* __WINE_BRUSH_H */

View File

@ -77,6 +77,7 @@ extern LONG CallTo32_1( FARPROC32, DWORD );
extern LONG CallTo32_2( FARPROC32, DWORD, DWORD );
extern LONG CallTo32_3( FARPROC32, DWORD, DWORD, DWORD );
extern LONG CallTo32_4( FARPROC32, DWORD, DWORD, DWORD, DWORD );
extern LONG CallTo32_5( FARPROC32, DWORD, DWORD, DWORD, DWORD, DWORD );
#define CallTaskStart32( func ) \
CallTo32_0( func )

View File

@ -10,4 +10,16 @@
#define CRTDLL_LC_MIN LC_ALL
#define CRTDLL_LC_MAX LC_TIME
/* ctype defines */
#define CRTDLL_UPPER 0x1
#define CRTDLL_LOWER 0x2
#define CRTDLL_DIGIT 0x4
#define CRTDLL_SPACE 0x8
#define CRTDLL_PUNCT 0x10
#define CRTDLL_CONTROL 0x20
#define CRTDLL_BLANK 0x40
#define CRTDLL_HEX 0x80
#define CRTDLL_LEADBYTE 0x8000
#define CRTDLL_ALPHA (0x0100|CRTDLL_UPPER|CRTDLL_LOWER)
#endif

View File

@ -309,7 +309,6 @@ extern void DEBUG_List(struct list_id * line1, struct list_id * line2,
extern void DEBUG_NukePath(void);
/* debugger/dbg.y */
extern void DEBUG_EnterDebugger(void);
extern void wine_debug( int signal, SIGCONTEXT *regs );
#endif /* __WINE_DEBUGGER_H */

View File

@ -7,129 +7,6 @@
#define __WINE_EXCEPT_H
#include "winnt.h"
/*
* exception codes
*/
#define STATUS_WAIT_0 0x00000000
#define STATUS_ABANDONED_WAIT_0 0x00000080
#define STATUS_USER_APC 0x000000C0
#define STATUS_TIMEOUT 0x00000102
#define STATUS_PENDING 0x00000103
#define STATUS_DATATYPE_MISALIGNMENT 0x80000002
#define STATUS_BREAKPOINT 0x80000003
#define STATUS_SINGLE_STEP 0x80000004
#define STATUS_ACCESS_VIOLATION 0xC0000005
#define STATUS_IN_PAGE_ERROR 0xC0000006
#define STATUS_NO_MEMORY 0xC0000017
#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
#define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
#define STATUS_INVALID_DISPOSITION 0xC0000026
#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
#define STATUS_FLOAT_OVERFLOW 0xC0000091
#define STATUS_FLOAT_STACK_CHECK 0xC0000092
#define STATUS_FLOAT_UNDERFLOW 0xC0000093
#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
#define STATUS_INTEGER_OVERFLOW 0xC0000095
#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
#define STATUS_STACK_OVERFLOW 0xC00000FD
#define STATUS_CONTROL_C_EXIT 0xC000013A
#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
/*
* return values from the actual exception handlers
*/
#define ExceptionContinueExecution 0
#define ExceptionContinueSearch 1
#define ExceptionNestedException 2
#define ExceptionCollidedUnwind 3
/*
* return values from filters in except() and from UnhandledExceptionFilter
*/
#define EXCEPTION_EXECUTE_HANDLER 1
#define EXCEPTION_CONTINUE_SEARCH 0
#define EXCEPTION_CONTINUE_EXECUTION -1
/*
* from OS/2 2.0 exception handling
* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
*/
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
#define EXCEPTION_CONTINUABLE 0
#define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
/*
* The exception record used by Win32 to give additional information
* about exception to exception handlers.
*/
#define EXCEPTION_MAXIMUM_PARAMETERS 15
typedef struct __EXCEPTION_RECORD
{
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct __EXCEPTION_RECORD *ExceptionRecord;
LPVOID ExceptionAddress;
DWORD NumberParameters;
DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
} EXCEPTION_RECORD;
typedef struct __EXCEPTION_RECORD_MIN
{
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct __EXCEPTION_RECORD *ExceptionRecord;
LPVOID ExceptionAddress;
DWORD NumberParameters;
DWORD ExceptionInformation[0];
} EXCEPTION_RECORD_MIN;
typedef struct __EXCEPTION_RECORD *PEXCEPTION_RECORD;
/*
* The exception pointers structure passed to exception filters
* in except() and the UnhandledExceptionFilter().
*/
typedef struct __EXCEPTION_POINTERS
{
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS;
typedef struct __EXCEPTION_POINTERS *PEXCEPTION_POINTERS;
/*
* the function pointer to a exception handler
@ -143,16 +20,6 @@ typedef DWORD ( *PEXCEPTION_HANDLER)( PEXCEPTION_RECORD pexcrec,
PCONTEXT pcontext,
LPVOID pdispatcher);
/*
* function pointer to a UnhandledExceptionFilter();
*/
typedef long (*__PTOP_EXCFILTER)
(PEXCEPTION_POINTERS ExceptionInfo);
typedef __PTOP_EXCFILTER PTOP_LEVER_EXCEPTION_FILTER;
typedef __PTOP_EXCFILTER LPTOP_LEVEL_EXCEPTION_FILTER;
/*
* The exception frame, used for registering exception handlers
* Win32 cares only about this, but compilers generally emit
@ -163,36 +30,15 @@ typedef struct __EXCEPTION_FRAME
{
struct __EXCEPTION_FRAME *Prev;
PEXCEPTION_HANDLER Handler;
} EXCEPTION_FRAME;
typedef struct __EXCEPTION_FRAME *PEXCEPTION_FRAME;
extern PEXCEPTION_FRAME TebExceptionFrame asm("%fs:0");
#define EXC_GetFrame() TebExceptionFrame
#define EXC_SetFrame(a) (TebExceptionFrame=(a))
} EXCEPTION_FRAME, *PEXCEPTION_FRAME;
/*
* Function definitions
*/
void EXC_RaiseException(DWORD exccode, DWORD excflags,
void RaiseException(DWORD exccode, DWORD excflags,
DWORD nargs, const LPDWORD pargs,
PCONTEXT pcontext);
void EXC_RtlUnwind( PEXCEPTION_FRAME pestframe,
LPVOID unusedEIP,
PEXCEPTION_RECORD pexcrec,
DWORD contextEAX,
PCONTEXT pcontext );
DWORD EXC_CallUnhandledExceptionFilter( PEXCEPTION_RECORD precord,
PCONTEXT pcontext);
void EXC_Init(void);
BOOL RaiseException(DWORD exccode, DWORD excflags,
DWORD nargs, const LPDWORD pargs);
PCONTEXT pcontext /* Wine additional parameter */ );
/*
* this undocumented function is called when an exception
@ -208,11 +54,10 @@ BOOL RaiseException(DWORD exccode, DWORD excflags,
* context.
*/
BOOL RtlUnwind( PEXCEPTION_FRAME pestframe,
void RtlUnwind( PEXCEPTION_FRAME pestframe,
LPVOID unusedEIP,
PEXCEPTION_RECORD pexcrec,
DWORD contextEAX );
DWORD UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers);
DWORD contextEAX,
PCONTEXT pcontext /* Wine additional parameter */ );
#endif /* __WINE_EXCEPT_H */

View File

@ -20,6 +20,10 @@ typedef struct
#pragma pack(4)
#define FONTCACHE 32 /* dynamic font cache size */
#define MAX_FONTS 256
extern LPLOGFONT16 lpLogFontList[MAX_FONTS+1];
/* may be switched... */
#define GGO_BITMAP 0x4F4D
#define GGO_NATIVE 0x4F50
@ -43,6 +47,9 @@ typedef struct
extern BOOL32 FONT_Init( void );
extern INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer );
extern INT32 FONT_GetObject32A( FONTOBJ * font, INT32 count, LPSTR buffer );
extern HFONT16 FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font );
extern int FONT_ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz);
extern void FONT_GetMetrics( LOGFONT16 * logfont, XFontStruct * xfont,
TEXTMETRIC16 * metrics );
#endif /* __WINE_FONT_H */

View File

@ -10,10 +10,11 @@
#include "windows.h"
#define HOOK_WIN16 0x0
#define HOOK_WIN32 0x1
#define HOOK_UNICODE 0x2
#define HOOK_WIN32A 0x1
#define HOOK_WIN32W 0x2
#define HOOK_MAPTYPE (HOOK_WIN32 | HOOK_UNICODE)
/* hook type mask */
#define HOOK_MAPTYPE (3)
extern HOOKPROC16 HOOK_GetProc16( HHOOK hhook );
extern BOOL32 HOOK_IsHooked( INT16 id );

View File

@ -66,6 +66,7 @@ extern BOOL32 MFDRV_Polyline( struct tagDC *dc, const LPPOINT32 pt,INT32 count);
extern BOOL32 MFDRV_Polygon( struct tagDC *dc, LPPOINT32 pt, INT32 count );
extern BOOL32 MFDRV_PolyPolygon( struct tagDC *dc, LPPOINT32 pt, LPINT32 counts,
UINT32 polygons);
extern HGDIOBJ32 MFDRV_SelectObject( DC *dc, HGDIOBJ32 handle );
extern BOOL32 MFDRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y,
COLORREF color, UINT32 fillType );
extern BOOL32 MFDRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,

View File

@ -35,9 +35,6 @@ extern void IO_outport( int port, int count, DWORD value );
/* msdos/int1a.c */
extern DWORD INT1A_GetTicksSinceMidnight(void);
/* misc/cpu.c */
extern int runtime_cpu(void);
#define INT_BARF(context,num) \
fprintf( stderr, "int%x: unknown/not implemented parameters:\n" \
"int%x: AX %04x, BX %04x, CX %04x, DX %04x, " \

View File

@ -23,5 +23,15 @@ typedef struct pe_data PE_MODULE;
extern int PE_unloadImage(HMODULE32 hModule);
extern FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName);
extern void my_wcstombs(char * result, u_short * source, int len);
extern PE_EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
extern PE_EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
extern PE_EnumResourceNames32A(HMODULE32,LPCSTR,ENUMRESNAMEPROC32A,LONG);
extern PE_EnumResourceNames32W(HMODULE32,LPCWSTR,ENUMRESNAMEPROC32W,LONG);
extern PE_EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPROC32A,LONG);
extern PE_EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG);
extern HRSRC32 PE_FindResourceEx32W(HINSTANCE32,LPCWSTR,LPCWSTR,WORD);
extern DWORD PE_SizeofResource32(HINSTANCE32,HRSRC32);
extern HGLOBAL32 PE_LoadResource32(HINSTANCE32,HRSRC32);
extern void PE_InitializeDLLs(HMODULE16);
#endif /* __WINE_PE_IMAGE_H */

View File

@ -18,6 +18,5 @@ typedef struct
extern INT16 PEN_GetObject16( PENOBJ * pen, INT16 count, LPSTR buffer );
extern INT32 PEN_GetObject32( PENOBJ * pen, INT32 count, LPSTR buffer );
extern HPEN32 PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen );
#endif /* __WINE_PEN_H */

View File

@ -9,6 +9,7 @@
#include "windows.h"
#include "winbase.h"
#include "winnt.h"
#include "handle32.h"
#include "task.h"
@ -82,7 +83,7 @@ typedef struct _PDB32
DWORD process_dword; /* 90 Unknown */
struct _PDB32 *group; /* 94 Process group */
void *exe_modref; /* 98 MODREF for the process EXE */
void *top_exc_filter; /* 9c Top exception filter */
LPTOP_LEVEL_EXCEPTION_FILTER top_filter; /* 9c Top exception filter */
DWORD priority; /* a0 Priority level */
HANDLE32 heap_list; /* a4 Head of process heap list */
void *heap_handles; /* a8 Head of heap handles list */

View File

@ -40,9 +40,9 @@ extern void SELECTOR_FreeBlock( WORD sel, WORD count );
#define WINE_CODE_SELECTOR 0x17
#endif /* svr4 || SCO_DS */
#ifdef __EMX__
#define WINE_DATA_SELECTOR 0x00 /* FIXME: This is wrong */
#define WINE_CODE_SELECTOR 0x00
#ifdef __EMX__ /* Is this always true? */
#define WINE_DATA_SELECTOR 0x53
#define WINE_CODE_SELECTOR 0x5b
#endif /* OS/2 */
#else /* WINELIB */

View File

@ -59,7 +59,40 @@ typedef struct ucontext SIGCONTEXT;
#endif /* svr4 || SCO_DS */
#ifdef __EMX__
typedef struct CONTEXTRECORD SIGCONTEXT;
typedef unsigned long ULONG;
typedef unsigned short USHORT;
typedef struct _fpreg /* Note 1 */
{
ULONG losig;
ULONG hisig;
USHORT signexp;
} FPREG;
typedef FPREG *PFPREG;
typedef struct _CONTEXT /* Note 1 */
{
ULONG ContextFlags;
ULONG ctx_env[7];
FPREG ctx_stack[8];
ULONG ctx_SegGs;
ULONG ctx_SegFs;
ULONG ctx_SegEs;
ULONG ctx_SegDs;
ULONG ctx_RegEdi;
ULONG ctx_RegEsi;
ULONG ctx_RegEax;
ULONG ctx_RegEbx;
ULONG ctx_RegEcx;
ULONG ctx_RegEdx;
ULONG ctx_RegEbp;
ULONG ctx_RegEip;
ULONG ctx_SegCs;
ULONG ctx_EFlags;
ULONG ctx_RegEsp;
ULONG ctx_SegSs;
} SIGCONTEXT;
/*typedef CONTEXTRECORD *PCONTEXTRECORD;*/
#endif /* __EMX__ */
@ -138,12 +171,12 @@ typedef struct CONTEXTRECORD SIGCONTEXT;
#define EDI_sig(context) ((context)->ctx_RegEdi)
#define EBP_sig(context) ((context)->ctx_RegEbp)
#define ESP_sig(context) ((context)->ctx_RegEsp)
#define CS_sig(context) ((context)->ctx_SegCS)
#define DS_sig(context) ((context)->ctx_SegDS)
#define ES_sig(context) ((context)->ctx_SegES)
#define SS_sig(context) ((context)->ctx_SegSS)
#define FS_sig(context) ((context)->ctx_SegFS)
#define GS_sig(context) ((context)->ctx_SegGS)
#define CS_sig(context) ((context)->ctx_SegCs)
#define DS_sig(context) ((context)->ctx_SegDs)
#define ES_sig(context) ((context)->ctx_SegEs)
#define SS_sig(context) ((context)->ctx_SegSs)
#define FS_sig(context) ((context)->ctx_SegFs)
#define GS_sig(context) ((context)->ctx_SegGs)
#define EFL_sig(context) ((context)->ctx_EFlags)
#define EIP_sig(context) ((context)->ctx_RegEip)

View File

@ -8,6 +8,7 @@
#define __WINE_THREAD_H
#include "process.h"
#include "winnt.h"
/* Thread exception block */
typedef struct _TEB
@ -35,7 +36,7 @@ typedef struct _THDB
K32OBJ header; /* 00 Kernel object header */
PDB32 *process; /* 08 Process owning this thread */
K32OBJ *event; /* 0c Thread event */
TEB teb; /* 10 Thread information block */
TEB teb; /* 10 Thread exception block */
PDB32 *process2; /* 40 Same as offset 08 (?) */
DWORD flags; /* 44 Flags */
DWORD exit_code; /* 48 Termination status */
@ -52,7 +53,7 @@ typedef struct _THDB
DWORD last_error; /* 70 Last error code */
void *debugger_CB; /* 74 Debugger context block */
DWORD debug_thread; /* 78 Thread debugging this one (?) */
void *context; /* 7c Thread register context */
void *pcontext; /* 7c Thread register context */
DWORD unknown3[3]; /* 80 Unknown */
WORD current_ss; /* 8c Another 16-bit stack selector */
WORD pad2; /* 8e */
@ -69,11 +70,14 @@ typedef struct _THDB
K32OBJ *win16_mutex; /* 1e8 Pointer to Win16 mutex */
K32OBJ *win32_mutex; /* 1ec Pointer to KERNEL32 mutex */
K32OBJ *crit_section2; /* 1f0 Another critical section */
DWORD unknown6[2]; /* 1f4 Unknown */
DWORD unknown6[3]; /* 1f4 Unknown */
/* The following are Wine-specific fields */
CONTEXT context; /* 200 Thread context */
} THDB;
extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size );
extern THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size,
LPTHREAD_START_ROUTINE start_addr );
extern void THREAD_Destroy( K32OBJ *ptr );
extern THDB *pCurrentThread;

View File

@ -38,12 +38,6 @@
#define FS_CASE_IS_PRESERVED FILE_CASE_PRESERVED_NAMES
#define FS_UNICODE_STORED_ON_DISK FILE_UNICODE_ON_DISK
struct _EXCEPTION_POINTERS;
typedef LONG (TOP_LEVEL_EXCEPTION_FILTER)(struct _EXCEPTION_POINTERS *);
TOP_LEVEL_EXCEPTION_FILTER *SetUnhandledExceptionFilter(TOP_LEVEL_EXCEPTION_FILTER *func);
/*WINAPI int SetErrorMode(int);*/
#define STATUS_SUCCESS 0x00000000

View File

@ -1825,6 +1825,12 @@ typedef struct
#define OF_EXIST 0x4000
#define OF_REOPEN 0x8000
/* SetErrorMode values */
#define SEM_FAILCRITICALERRORS 0x0001
#define SEM_NOGPFAULTERRORBOX 0x0002
#define SEM_NOALIGNMENTFAULTEXCEPT 0x0004
#define SEM_NOOPENFILEERRORBOX 0x8000
/* GetTempFileName() Flags */
#define TF_FORCEDRIVE 0x80
@ -3667,7 +3673,11 @@ DECL_WINELIB_TYPE(LPCOMPAREITEMSTRUCT);
#define VK_X 0x58
#define VK_Y 0x59
#define VK_Z 0x5A
/* 0x5B-0x5F Undefined */
#define VK_LWIN 0x5B
#define VK_RWIN 0x5C
#define VK_APPS 0x5D
/* 0x5E-0x5F Unassigned */
#define VK_NUMPAD0 0x60
#define VK_NUMPAD1 0x61
#define VK_NUMPAD2 0x62
@ -3711,16 +3721,37 @@ DECL_WINELIB_TYPE(LPCOMPAREITEMSTRUCT);
/* 0x88-0x8F Unassigned */
#define VK_NUMLOCK 0x90
#define VK_SCROLL 0x91
/* 0x92-0xB9 Unassigned */
/* 0x92-0x9F Unassigned */
/*
* differencing between right and left shift/control/alt key.
* Used only by GetAsyncKeyState() and GetKeyState().
*/
#define VK_LSHIFT 0xA0
#define VK_RSHIFT 0xA1
#define VK_LCONTROL 0xA2
#define VK_RCONTROL 0xA3
#define VK_LMENU 0xA4
#define VK_RMENU 0xA5
/* 0xA6-0xB9 Unassigned */
/* 0xBA-0xC0 OEM specific */
/* 0xC1-0xDA Unassigned */
/* 0xDB-0xE4 OEM specific */
/* 0xE5 Unassigned */
#define VK_PROCESSKEY 0xE5
/* 0xE6 OEM specific */
/* 0xE7-0xE8 Unassigned */
/* 0xE9-0xF5 OEM specific */
/* 0xF6-0xFE Unassigned */
#define VK_ATTN 0xF6
#define VK_CRSEL 0xF7
#define VK_EXSEL 0xF8
#define VK_EREOF 0xF9
#define VK_PLAY 0xFA
#define VK_ZOOM 0xFB
#define VK_NONAME 0xFC
#define VK_PA1 0xFD
#define VK_OEM_CLEAR 0xFE
#define LMEM_FIXED 0
#define LMEM_MOVEABLE 0x0002
@ -4597,6 +4628,21 @@ typedef struct _UNICODE_STRING {
#define PR_JOBSTATUS 0x0000
typedef BOOL32 (*ENUMRESTYPEPROC32A)(HMODULE32 hModule, LPSTR type,LONG lParam);
typedef BOOL32 (*ENUMRESTYPEPROC32W)(HMODULE32 hModule, LPWSTR type,LONG lParam);
typedef BOOL32 (*ENUMRESNAMEPROC32A)(HMODULE32 hModule, LPCSTR type,
LPSTR name,LONG lParam);
typedef BOOL32 (*ENUMRESNAMEPROC32W)(HMODULE32 hModule, LPCWSTR type,
LPWSTR name,LONG lParam);
typedef BOOL32 (*ENUMRESLANGPROC32A)(HMODULE32 hModule, LPCSTR type,
LPCSTR name,WORD lang,LONG lParam);
typedef BOOL32 (*ENUMRESLANGPROC32W)(HMODULE32 hModule, LPCWSTR type,
LPCWSTR name,WORD lang,LONG lParam);
DECL_WINELIB_TYPE_AW(ENUMRESTYPEPROC);
DECL_WINELIB_TYPE_AW(ENUMRESNAMEPROC);
DECL_WINELIB_TYPE_AW(ENUMRESLANGPROC);
#pragma pack(4)
/* Declarations for functions that exist only in Win16 */
@ -4637,6 +4683,7 @@ HDC16 GetDCState(HDC16);
HWND16 GetDesktopHwnd(void);
HMODULE16 GetExePtr(HANDLE16);
WORD GetExeVersion(void);
INT16 GetKbCodePage(VOID);
INT16 GetInstanceData(HINSTANCE16,WORD,INT16);
BOOL16 GetModuleName(HINSTANCE16,LPSTR,INT16);
FARPROC16 GetMouseEventProc(void);
@ -4650,6 +4697,7 @@ DWORD GetViewportExt(HDC16);
DWORD GetViewportOrg(HDC16);
DWORD GetWindowExt(HDC16);
DWORD GetWindowOrg(HDC16);
DWORD GetWinFlags(void);
DWORD GlobalDOSAlloc(DWORD);
WORD GlobalDOSFree(WORD);
void GlobalFreeAll(HGLOBAL16);
@ -4720,6 +4768,7 @@ BOOL32 CloseHandle(HANDLE32);
BOOL32 CopyFile32A(LPCSTR,LPCSTR,BOOL32);
BOOL32 CopyFile32W(LPCWSTR,LPCWSTR,BOOL32);
#define CopyFile WINELIB_NAME_AW(CopyFile)
INT32 CompareFileTime(LPFILETIME,LPFILETIME);
HFILE32 CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
HFILE32 CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
#define CreateFile WINELIB_NAME_AW(CreateFile)
@ -4730,6 +4779,15 @@ BOOL32 DosDateTimeToFileTime(WORD,WORD,LPFILETIME);
INT32 EnumPropsEx32A(HWND32,PROPENUMPROCEX32A,LPARAM);
INT32 EnumPropsEx32W(HWND32,PROPENUMPROCEX32W,LPARAM);
#define EnumPropsEx WINELIB_NAME_AW(EnumPropsEx)
BOOL32 EnumResourceLanguages32A(HMODULE32,LPCSTR,LPCSTR,ENUMRESLANGPROC32A,LONG);
BOOL32 EnumResourceLanguages32W(HMODULE32,LPCWSTR,LPCWSTR,ENUMRESLANGPROC32W,LONG);
#define EnumResourceLanguages WINELIB_NAME_AW(EnumResourceLanguages)
BOOL32 EnumResourceNames32A(HMODULE32,LPCSTR,ENUMRESNAMEPROC32A,LONG);
BOOL32 EnumResourceNames32W(HMODULE32,LPCWSTR,ENUMRESNAMEPROC32W,LONG);
#define EnumResourceNames WINELIB_NAME_AW(EnumResourceNames)
BOOL32 EnumResourceTypes32A(HMODULE32,ENUMRESTYPEPROC32A,LONG);
BOOL32 EnumResourceTypes32W(HMODULE32,ENUMRESTYPEPROC32W,LONG);
#define EnumResourceTypes WINELIB_NAME_AW(EnumResourceTypes)
BOOL32 EnumSystemCodePages32A(CODEPAGE_ENUMPROC32A,DWORD);
BOOL32 EnumSystemCodePages32W(CODEPAGE_ENUMPROC32W,DWORD);
#define EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages)
@ -4787,6 +4845,7 @@ BOOL32 GetSystemPowerStatus(LPSYSTEM_POWER_STATUS);
VOID GetSystemTime(LPSYSTEMTIME);
LCID GetThreadLocale();
INT32 GetThreadPriority(HANDLE32);
DWORD GetWindowThreadProcessId(HWND32,LPDWORD);
VOID GlobalMemoryStatus(LPMEMORYSTATUS);
LPVOID HeapAlloc(HANDLE32,DWORD,DWORD);
DWORD HeapCompact(HANDLE32,DWORD);
@ -4803,6 +4862,9 @@ BOOL32 IsWindowUnicode(HWND32);
BOOL32 IsValidLocale(DWORD,DWORD);
BOOL32 LocalFileTimeToFileTime(const FILETIME*,LPFILETIME);
LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,DWORD);
INT32 MessageBoxEx32A(HWND32,LPCSTR,LPCSTR,UINT32,WORD);
INT32 MessageBoxEx32W(HWND32,LPCWSTR,LPCWSTR,UINT32,WORD);
#define MessageBoxEx WINELIB_NAME_AW(MessageBoxEx)
BOOL32 MoveFile32A(LPCSTR,LPCSTR);
BOOL32 MoveFile32W(LPCWSTR,LPCWSTR);
#define MoveFile WINELIB_NAME_AW(MoveFile)
@ -4883,6 +4945,7 @@ DWORD GetAppCompatFlags(HTASK32);
LONG GetBitmapBits(HBITMAP32,LONG,LPVOID);
WORD GetClassWord(HWND32,INT32);
DWORD GetDialogBaseUnits(void);
VOID GetKeyboardState(LPBYTE);
DWORD GetLastError(void);
DWORD GetMenuCheckMarkDimensions(void);
COLORREF GetSysColor(INT32);
@ -4891,7 +4954,8 @@ INT16 GetUpdateRgn(HWND32,HRGN32,BOOL32);
WORD GetWindowWord(HWND32,INT32);
BOOL16 HideCaret(HWND32);
BOOL16 IsWindow(HWND32);
void LZDone(void);
VOID LZDone(void);
DWORD OemKeyScan(WORD);
UINT16 RealizePalette(HDC32);
DWORD RegCloseKey(HKEY);
DWORD RegFlushKey(HKEY);
@ -4901,6 +4965,7 @@ COLORREF SetBkColor(HDC32,COLORREF);
BOOL16 SetCaretBlinkTime(UINT32);
BOOL16 SetCaretPos(INT32,INT32);
WORD SetClassWord(HWND32,INT32,WORD);
VOID SetKeyboardState(LPBYTE);
VOID SetLastError(DWORD);
VOID SetRectRgn(HRGN32,INT32,INT32,INT32,INT32);
COLORREF SetTextColor(HDC32,COLORREF);
@ -5419,6 +5484,9 @@ BOOL32 FreeResource32(HGLOBAL32);
HWND16 GetActiveWindow16(void);
HWND32 GetActiveWindow32(void);
#define GetActiveWindow WINELIB_NAME(GetActiveWindow)
WORD GetAsyncKeyState16(INT16);
WORD GetAsyncKeyState32(INT32);
#define GetAsyncKeyState WINELIB_NAME(GetAsyncKeyState)
BOOL16 GetBitmapDimensionEx16(HBITMAP16,LPSIZE16);
BOOL32 GetBitmapDimensionEx32(HBITMAP32,LPSIZE32);
#define GetBitmapDimensionEx WINELIB_NAME(GetBitmapDimensionEx)
@ -5544,10 +5612,16 @@ HWND32 GetFocus32(void);
UINT16 GetInternalWindowPos16(HWND16,LPRECT16,LPPOINT16);
UINT32 GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32);
#define GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos)
INT16 GetKeyboardType16(INT16);
INT32 GetKeyboardType32(INT32);
#define GetKeyboardType WINELIB_NAME(GetKeyboardType)
INT16 GetKeyNameText16(LONG,LPSTR,INT16);
INT32 GetKeyNameText32A(LONG,LPSTR,INT32);
INT32 GetKeyNameText32W(LONG,LPWSTR,INT32);
#define GetKeyNameText WINELIB_NAME_AW(GetKeyNameText)
WORD GetKeyState16(INT16);
WORD GetKeyState32(INT32);
#define GetKeyState WINELIB_NAME(GetKeyState)
UINT32 GetLogicalDriveStrings32A(UINT32,LPSTR);
UINT32 GetLogicalDriveStrings32W(UINT32,LPWSTR);
#define GetLogicalDriveStrings WINELIB_NAME_AW(GetLogicalDriveStrings)
@ -5979,6 +6053,10 @@ HFILE32 LZInit32(HFILE32);
LONG LZSeek16(HFILE16,LONG,INT16);
LONG LZSeek32(HFILE32,LONG,INT32);
#define LZSeek WINELIB_NAME(LZSeek)
UINT16 MapVirtualKey16(UINT16,UINT16);
UINT32 MapVirtualKey32A(UINT32,UINT32);
UINT32 MapVirtualKey32W(UINT32,UINT32);
#define MapVirtualKey WINELIB_NAME_AW(MapVirtualKey)
FARPROC16 MakeProcInstance16(FARPROC16,HANDLE16);
#define MakeProcInstance32(proc,inst) (proc)
#define MakeProcInstance WINELIB_NAME(MakeProcInstance)
@ -6227,6 +6305,10 @@ BOOL32 SetCommBreak32(INT32);
INT16 SetCommState16(LPDCB16);
BOOL32 SetCommState32(INT32,LPDCB32);
#define SetCommState WINELIB_NAME(SetCommState)
BOOL16 SetCurrentDirectory16(LPCSTR);
BOOL32 SetCurrentDirectory32A(LPCSTR);
BOOL32 SetCurrentDirectory32W(LPCWSTR);
#define SetCurrentDirectory WINELIB_NAME_AW(SetCurrentDirectory)
BOOL16 SetDeskWallPaper16(LPCSTR);
BOOL32 SetDeskWallPaper32(LPCSTR);
#define SetDeskWallPaper WINELIB_NAME(SetDeskWallPaper)
@ -6245,6 +6327,9 @@ void SetDlgItemText16(HWND16,INT16,SEGPTR);
void SetDlgItemText32A(HWND32,INT32,LPCSTR);
void SetDlgItemText32W(HWND32,INT32,LPCWSTR);
#define SetDlgItemText WINELIB_NAME_AW(SetDlgItemText)
UINT16 SetErrorMode16(UINT16);
UINT32 SetErrorMode32(UINT32);
#define SetErrorMode WINELIB_NAME(SetErrorMode)
BOOL16 SetFileAttributes16(LPCSTR,DWORD);
BOOL32 SetFileAttributes32A(LPCSTR,DWORD);
BOOL32 SetFileAttributes32W(LPCWSTR,DWORD);
@ -6366,6 +6451,9 @@ BOOL32 ShowScrollBar32(HWND32,INT32,BOOL32);
BOOL16 ShowWindow16(HWND16,INT16);
BOOL32 ShowWindow32(HWND32,INT32);
#define ShowWindow WINELIB_NAME(ShowWindow)
DWORD SizeofResource16(HMODULE16,HRSRC16);
DWORD SizeofResource32(HMODULE32,HRSRC32);
#define SizeofResource WINELIB_NAME(SizeofResource)
BOOL16 StretchBlt16(HDC16,INT16,INT16,INT16,INT16,HDC16,INT16,INT16,
INT16,INT16,DWORD);
BOOL32 StretchBlt32(HDC32,INT32,INT32,INT32,INT32,HDC32,INT32,INT32,
@ -6387,9 +6475,15 @@ BOOL16 TextOut16(HDC16,INT16,INT16,LPCSTR,INT16);
BOOL32 TextOut32A(HDC32,INT32,INT32,LPCSTR,INT32);
BOOL32 TextOut32W(HDC32,INT32,INT32,LPCWSTR,INT32);
#define TextOut WINELIB_NAME_AW(TextOut)
INT16 ToAscii16(UINT16,UINT16,LPBYTE,LPVOID,UINT16);
INT32 ToAscii32(UINT32,UINT32,LPBYTE,LPWORD,UINT32);
#define ToAscii WINELIB_NAME(ToAscii)
BOOL16 TrackPopupMenu16(HMENU16,UINT16,INT16,INT16,INT16,HWND16,const RECT16*);
BOOL32 TrackPopupMenu32(HMENU32,UINT32,INT32,INT32,INT32,HWND32,const RECT32*);
#define TrackPopupMenu WINELIB_NAME(TrackPopupMenu)
INT16 TranslateAccelerator16(HWND16,HACCEL16,LPMSG16);
INT32 TranslateAccelerator32(HWND32,HACCEL32,LPMSG32);
#define TranslateAccelerator WINELIB_NAME(TranslateAccelerator)
INT16 TransmitCommChar16(INT16,CHAR);
BOOL32 TransmitCommChar32(INT32,CHAR);
#define TransmitCommChar WINELIB_NAME(TransmitCommChar)
@ -6434,6 +6528,10 @@ DWORD VerQueryValue16(SEGPTR,LPCSTR,SEGPTR*,UINT16*);
DWORD VerQueryValue32A(LPVOID,LPCSTR,LPVOID*,UINT32*);
DWORD VerQueryValue32W(LPVOID,LPCWSTR,LPVOID*,UINT32*);
#define VerQueryValue WINELIB_NAME_AW(VerQueryValue)
WORD VkKeyScan16(CHAR);
WORD VkKeyScan32A(CHAR);
WORD VkKeyScan32W(WCHAR);
#define VkKeyScan WINELIB_NAME_AW(VkKeyScan)
HWND16 WindowFromDC16(HDC16);
HWND32 WindowFromDC32(HDC32);
#define WindowFromDC WINELIB_NAME(WindowFromDC)
@ -6529,6 +6627,7 @@ UINT32 _lwrite32(HFILE32,LPCSTR,UINT32);
INT32 LoadMessage32A(HINSTANCE32,UINT32,WORD,LPSTR,INT32);
INT32 LoadMessage32W(HINSTANCE32,UINT32,WORD,LPWSTR,INT32);
SEGPTR WIN16_GlobalLock16(HGLOBAL16);
SEGPTR WIN16_LockResource(HGLOBAL16);
INT32 lstrncmp32A(LPCSTR,LPCSTR,INT32);
INT32 lstrncmp32W(LPCWSTR,LPCWSTR,INT32);
INT32 lstrncmpi32A(LPCSTR,LPCSTR,INT32);
@ -6604,7 +6703,6 @@ void FreeLibrary(HINSTANCE16);
UINT GDIRealizePalette(HDC16);
HPALETTE16 GDISelectPalette(HDC16,HPALETTE16,WORD);
DWORD GetAspectRatioFilter(HDC16);
int GetAsyncKeyState(int);
WORD GetAtomName(ATOM,LPSTR,short);
HANDLE16 GetClipboardData(WORD);
int GetClipboardFormatName(WORD,LPSTR,short);
@ -6622,9 +6720,6 @@ DWORD GetHeapSpaces(HMODULE16);
BOOL GetInputState(void);
int GetKBCodePage(void);
int GetKerningPairs(HDC16,int,LPKERNINGPAIR16);
INT GetKeyState(INT);
void GetKeyboardState(BYTE*);
int GetKeyboardType(int);
HWND GetLastActivePopup(HWND);
BOOL GetMessage(SEGPTR,HWND,UINT,UINT);
LONG GetMessageExtraInfo(void);
@ -6649,7 +6744,6 @@ BYTE GetTempDrive(BYTE);
LPINT16 GetThresholdEvent(void);
int GetThresholdStatus(void);
BOOL GetWinDebugInfo(LPWINDEBUGINFO,UINT);
LONG GetWinFlags(void);
ATOM GlobalDeleteAtom(ATOM);
void GlobalFix(HGLOBAL16);
BOOL16 GlobalUnWire(HGLOBAL16);
@ -6663,9 +6757,7 @@ BOOL16 IsDialogMessage(HWND16,LPMSG16);
BOOL IsValidMetaFile(HMETAFILE16);
HINSTANCE16 LoadModule(LPCSTR,LPVOID);
FARPROC16 LocalNotify(FARPROC16);
WORD MapVirtualKey(WORD,WORD);
void MessageBeep(WORD);
DWORD OemKeyScan(WORD);
BOOL OpenClipboard(HWND);
BOOL OpenIcon(HWND);
int OpenSound(void);
@ -6692,14 +6784,11 @@ HANDLE16 SetClipboardData(WORD,HANDLE16);
HWND SetClipboardViewer(HWND);
void SetConvertHook(BOOL);
BOOL SetConvertParams(int,int);
BOOL32 SetCurrentDirectory(LPCSTR);
HCURSOR16 SetCursor(HCURSOR16);
void SetCursorPos(short,short);
void SetDoubleClickTime(WORD);
int SetEnvironment(LPCSTR,LPCSTR,WORD);
UINT SetErrorMode(UINT);
WORD SetHookFlags(HDC16,WORD);
void SetKeyboardState(BYTE*);
DWORD SetMapperFlags(HDC16,DWORD);
BOOL SetMessageQueue(int);
HMETAFILE16 SetMetaFileBits(HGLOBAL16);
@ -6719,20 +6808,15 @@ BOOL SetWinDebugInfo(LPWINDEBUGINFO);
HINSTANCE16 ShellExecute(HWND,LPCSTR,LPCSTR,LPSTR,LPCSTR,INT);
int ShowCursor(BOOL);
void ShowOwnedPopups(HWND,BOOL);
DWORD SizeofResource(HMODULE16,HRSRC16);
int StartSound(void);
int StopSound(void);
BOOL SwapMouseButton(BOOL);
void SwapRecording(WORD);
int SyncAllVoices(void);
LONG TabbedTextOut(HDC16,short,short,LPSTR,short,short,LPINT16,short);
int ToAscii(WORD,WORD,LPSTR,LPVOID,WORD);
INT16 TranslateAccelerator(HWND,HACCEL16,LPMSG16);
BOOL TranslateMDISysAccel(HWND,LPMSG16);
BOOL TranslateMessage(LPMSG16);
int UpdateColors(HDC16);
WORD VkKeyScan(WORD);
SEGPTR WIN16_LockResource(HGLOBAL16);
void WaitMessage(void);
int WaitSoundState(int);

View File

@ -139,6 +139,126 @@ typedef struct
#endif /* __WINE__ */
/*
* Exception codes
*/
#define STATUS_WAIT_0 0x00000000
#define STATUS_ABANDONED_WAIT_0 0x00000080
#define STATUS_USER_APC 0x000000C0
#define STATUS_TIMEOUT 0x00000102
#define STATUS_PENDING 0x00000103
#define STATUS_DATATYPE_MISALIGNMENT 0x80000002
#define STATUS_BREAKPOINT 0x80000003
#define STATUS_SINGLE_STEP 0x80000004
#define STATUS_ACCESS_VIOLATION 0xC0000005
#define STATUS_IN_PAGE_ERROR 0xC0000006
#define STATUS_NO_MEMORY 0xC0000017
#define STATUS_ILLEGAL_INSTRUCTION 0xC000001D
#define STATUS_NONCONTINUABLE_EXCEPTION 0xC0000025
#define STATUS_INVALID_DISPOSITION 0xC0000026
#define STATUS_ARRAY_BOUNDS_EXCEEDED 0xC000008C
#define STATUS_FLOAT_DENORMAL_OPERAND 0xC000008D
#define STATUS_FLOAT_DIVIDE_BY_ZERO 0xC000008E
#define STATUS_FLOAT_INEXACT_RESULT 0xC000008F
#define STATUS_FLOAT_INVALID_OPERATION 0xC0000090
#define STATUS_FLOAT_OVERFLOW 0xC0000091
#define STATUS_FLOAT_STACK_CHECK 0xC0000092
#define STATUS_FLOAT_UNDERFLOW 0xC0000093
#define STATUS_INTEGER_DIVIDE_BY_ZERO 0xC0000094
#define STATUS_INTEGER_OVERFLOW 0xC0000095
#define STATUS_PRIVILEGED_INSTRUCTION 0xC0000096
#define STATUS_STACK_OVERFLOW 0xC00000FD
#define STATUS_CONTROL_C_EXIT 0xC000013A
#define EXCEPTION_ACCESS_VIOLATION STATUS_ACCESS_VIOLATION
#define EXCEPTION_DATATYPE_MISALIGNMENT STATUS_DATATYPE_MISALIGNMENT
#define EXCEPTION_BREAKPOINT STATUS_BREAKPOINT
#define EXCEPTION_SINGLE_STEP STATUS_SINGLE_STEP
#define EXCEPTION_ARRAY_BOUNDS_EXCEEDED STATUS_ARRAY_BOUNDS_EXCEEDED
#define EXCEPTION_FLT_DENORMAL_OPERAND STATUS_FLOAT_DENORMAL_OPERAND
#define EXCEPTION_FLT_DIVIDE_BY_ZERO STATUS_FLOAT_DIVIDE_BY_ZERO
#define EXCEPTION_FLT_INEXACT_RESULT STATUS_FLOAT_INEXACT_RESULT
#define EXCEPTION_FLT_INVALID_OPERATION STATUS_FLOAT_INVALID_OPERATION
#define EXCEPTION_FLT_OVERFLOW STATUS_FLOAT_OVERFLOW
#define EXCEPTION_FLT_STACK_CHECK STATUS_FLOAT_STACK_CHECK
#define EXCEPTION_FLT_UNDERFLOW STATUS_FLOAT_UNDERFLOW
#define EXCEPTION_INT_DIVIDE_BY_ZERO STATUS_INTEGER_DIVIDE_BY_ZERO
#define EXCEPTION_INT_OVERFLOW STATUS_INTEGER_OVERFLOW
#define EXCEPTION_PRIV_INSTRUCTION STATUS_PRIVILEGED_INSTRUCTION
#define EXCEPTION_IN_PAGE_ERROR STATUS_IN_PAGE_ERROR
/*
* Return values from the actual exception handlers
*/
#define ExceptionContinueExecution 0
#define ExceptionContinueSearch 1
#define ExceptionNestedException 2
#define ExceptionCollidedUnwind 3
/*
* Return values from filters in except() and from UnhandledExceptionFilter
*/
#define EXCEPTION_EXECUTE_HANDLER 1
#define EXCEPTION_CONTINUE_SEARCH 0
#define EXCEPTION_CONTINUE_EXECUTION -1
/*
* From OS/2 2.0 exception handling
* Win32 seems to use the same flags as ExceptionFlags in an EXCEPTION_RECORD
*/
#define EH_NONCONTINUABLE 0x01
#define EH_UNWINDING 0x02
#define EH_EXIT_UNWIND 0x04
#define EH_STACK_INVALID 0x08
#define EH_NESTED_CALL 0x10
#define EXCEPTION_CONTINUABLE 0
#define EXCEPTION_NONCONTINUABLE EH_NONCONTINUABLE
/*
* The exception record used by Win32 to give additional information
* about exception to exception handlers.
*/
#define EXCEPTION_MAXIMUM_PARAMETERS 15
typedef struct __EXCEPTION_RECORD
{
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct __EXCEPTION_RECORD *ExceptionRecord;
LPVOID ExceptionAddress;
DWORD NumberParameters;
DWORD ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
} EXCEPTION_RECORD, *PEXCEPTION_RECORD;
/*
* The exception pointers structure passed to exception filters
* in except() and the UnhandledExceptionFilter().
*/
typedef struct _EXCEPTION_POINTERS
{
PEXCEPTION_RECORD ExceptionRecord;
PCONTEXT ContextRecord;
} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS;
/*
* function pointer to a exception filter
*/
typedef LONG (*PTOP_LEVEL_EXCEPTION_FILTER)(PEXCEPTION_POINTERS ExceptionInfo);
typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
DWORD UnhandledExceptionFilter( PEXCEPTION_POINTERS epointers );
LPTOP_LEVEL_EXCEPTION_FILTER
SetUnhandledExceptionFilter( LPTOP_LEVEL_EXCEPTION_FILTER filter );
/* Language IDs */
#define LANG_NEUTRAL 0x00

View File

@ -90,6 +90,8 @@ extern BOOL32 X11DRV_Polygon( struct tagDC *dc, LPPOINT32 pt, INT32 count );
extern BOOL32 X11DRV_PolyPolygon( struct tagDC *dc, LPPOINT32 pt,
LPINT32 counts, UINT32 polygons);
extern HGDIOBJ32 X11DRV_SelectObject( struct tagDC *dc, HGDIOBJ32 handle );
extern BOOL32 X11DRV_ExtFloodFill( struct tagDC *dc, INT32 x, INT32 y,
COLORREF color, UINT32 fillType );
extern BOOL32 X11DRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,
@ -97,4 +99,10 @@ extern BOOL32 X11DRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,
LPCSTR str, UINT32 count, const INT32 *lpDx );
/* X11 driver internal functions */
extern BOOL32 X11DRV_BITMAP_Init(void);
extern BOOL32 X11DRV_BRUSH_Init(void);
extern BOOL32 X11DRV_FONT_Init(void);
#endif /* __WINE_X11DRV_H */

View File

@ -84,7 +84,3 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name )
return NULL;
}
void DEBUG_EnterDebugger(void)
{
}

View File

@ -61,7 +61,6 @@ int MAIN_Init(void)
extern BOOL32 WIN16DRV_Init(void);
extern BOOL32 SIGNAL_Init(void);
extern BOOL32 WIDGETS_Init(void);
extern int KERN32_Init(void);
int queueSize;
@ -144,9 +143,6 @@ int MAIN_Init(void)
/* Initialize message spying */
if (!SPY_Init()) return 0;
/* Initialize Win32 data structures */
if (!KERN32_Init()) return 0;
/* Create system message queue */
queueSize = GetProfileInt32A( "windows", "TypeAhead", 120 );
if (!QUEUE_CreateSysMsgQueue( queueSize )) return 0;

View File

@ -17,9 +17,6 @@
#include <string.h>
#include <unistd.h>
#include <sys/types.h>
#ifndef __EMX__
#include <sys/mman.h>
#endif
#include "windows.h"
#include "winbase.h"
#include "callback.h"
@ -65,14 +62,14 @@ void dump_exports(IMAGE_EXPORT_DIRECTORY * pe_exports, unsigned int load_addr)
if (i<pe_exports->NumberOfNames) {
ename=(char*)RVA(*name++);
dprintf_win32(stddeb,"%-32s %4d %8.8lx (%8.8lx)\n",ename,*ordinal,functions[*ordinal],*function);
sprintf(buffer,"%s.%s",Module,ename);
sprintf(buffer,"%s_%s",Module,ename);
daddr.off=RVA(functions[*ordinal]);
ordinal++;
function++;
} else {
/* ordinals/names no longer valid, but we still got functions */
dprintf_win32(stddeb,"%-32s %4s %8s %8.8lx\n","","","",*function);
sprintf(buffer,"%s.%d",Module,i);
sprintf(buffer,"%s_%d",Module,i);
daddr.off=RVA(*functions);
function++;
}
@ -541,7 +538,7 @@ problem needs to be fixed properly at some stage */
if (pe->pe_export) {
/* add start of sections as debugsymbols */
for(i=0;i<pe->pe_header->FileHeader.NumberOfSections;i++) {
sprintf(buffer,"%s.%s",
sprintf(buffer,"%s_%s",
(char*)RVA(pe->pe_export->Name),
pe->pe_seg[i].Name
);
@ -549,7 +546,7 @@ problem needs to be fixed properly at some stage */
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
}
/* add entry point */
sprintf(buffer,"%s.EntryPoint",(char*)RVA(pe->pe_export->Name));
sprintf(buffer,"%s_EntryPoint",(char*)RVA(pe->pe_export->Name));
daddr.off=RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint);
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
/* add start of DLL */

View File

@ -8,8 +8,7 @@
* Based on the Win16 resource handling code in loader/resource.c
* Copyright 1993 Robert J. Amstadt
* Copyright 1995 Alexandre Julliard
*
* This is not even at ALPHA level yet. Don't expect it to work!
* Copyright 1997 Marcus Meissner
*/
#include <sys/types.h>
@ -18,22 +17,28 @@
#include "pe_image.h"
#include "module.h"
#include "heap.h"
#include "handle32.h"
#include "libres.h"
#include "stackframe.h"
#include "neexe.h"
#include "accel.h"
#include "xmalloc.h"
#include "stddebug.h"
#include "debug.h"
#define PrintIdA(name) \
if (HIWORD((DWORD)name)) \
dprintf_resource( stddeb, "'%s'", name); \
else \
dprintf_resource( stddeb, "#%04x", LOWORD(name));
#define PrintIdW(name)
#define PrintId(name)
/**********************************************************************
* HMODULE32toPE_MODULE
*
* small helper function to get a PE_MODULE from a passed HMODULE32
*/
static PE_MODULE*
HMODULE32toPE_MODULE(HMODULE32 hmod) {
NE_MODULE *pModule;
if (!hmod) hmod = GetTaskDS(); /* FIXME: correct? */
hmod = GetExePtr( hmod ); /* In case we were passed an hInstance */
if (!(pModule = MODULE_GetPtr( hmod ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
return pModule->pe_module;
}
/**********************************************************************
* GetResDirEntryW
@ -86,51 +91,19 @@ LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryW(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
}
}
/**********************************************************************
* GetResDirEntryA
*
* Helper function - goes down one level of PE resource tree
*
*/
LPIMAGE_RESOURCE_DIRECTORY GetResDirEntryA(LPIMAGE_RESOURCE_DIRECTORY resdirptr,
LPCSTR name,
DWORD root)
{
LPWSTR xname;
LPIMAGE_RESOURCE_DIRECTORY ret;
if (HIWORD((DWORD)name))
xname = HEAP_strdupAtoW( GetProcessHeap(), 0, name );
else
xname = (LPWSTR)name;
ret=GetResDirEntryW(resdirptr,xname,root);
if (HIWORD((DWORD)name))
HeapFree( GetProcessHeap(), 0, xname );
return ret;
}
/**********************************************************************
* PE_FindResourceEx32W
*/
HANDLE32 PE_FindResourceEx32W(
HINSTANCE32 hModule,LPCWSTR name,LPCWSTR type,WORD lang
) {
PE_MODULE *pe;
NE_MODULE *pModule;
LPIMAGE_RESOURCE_DIRECTORY resdirptr;
DWORD root;
HANDLE32 result;
PE_MODULE *pe = HMODULE32toPE_MODULE(hModule);
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "FindResource: module=%08x type=", hModule );
PrintId( type );
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
if (!pe || !pe->pe_resource)
return 0;
resdirptr = pe->pe_resource;
root = (DWORD) resdirptr;
@ -151,18 +124,287 @@ HANDLE32 PE_FindResourceEx32W(
*/
HANDLE32 PE_LoadResource32( HINSTANCE32 hModule, HANDLE32 hRsrc )
{
NE_MODULE *pModule;
PE_MODULE *pe;
PE_MODULE *pe = HMODULE32toPE_MODULE(hModule);
if (!hModule) hModule = GetTaskDS(); /* FIXME: see FindResource32W */
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "PE_LoadResource32: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
if (!pe || !pe->pe_resource)
return 0;
if (!hRsrc)
return 0;
return (HANDLE32) (pe->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
}
/**********************************************************************
* PE_SizeofResource32
*/
void
_check_ptr(DWORD x,DWORD start,LPDWORD lastmax) {
if ((x>start) && (x<*lastmax))
*lastmax=x;
}
static void
walk_resdir(DWORD loadaddr,DWORD rootresdir,DWORD xres,DWORD data,DWORD lvl,LPDWORD max){
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DATA_ENTRY dataent;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
int i;
if (lvl==3) {
dataent = (LPIMAGE_RESOURCE_DATA_ENTRY)(rootresdir+xres);
_check_ptr(loadaddr+dataent->OffsetToData,data,max);
return;
}
resdir = (LPIMAGE_RESOURCE_DIRECTORY)(rootresdir+xres);
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++)
walk_resdir(loadaddr,rootresdir,(lvl==2)?et[i].u2.OffsetToData:et[i].u2.s.OffsetToDirectory,data,lvl+1,max);
}
DWORD PE_SizeofResource32( HINSTANCE32 hModule, HANDLE32 hRsrc )
{
PE_MODULE *pe = HMODULE32toPE_MODULE(hModule);
DWORD max,data;
IMAGE_DATA_DIRECTORY dir;
if (!pe || !pe->pe_resource)
return 0;
if (!hRsrc) return 0;
max=(DWORD)-1;
dir=pe->pe_header->OptionalHeader.DataDirectory[IMAGE_DIRECTORY_ENTRY_RESOURCE];
if(dir.Size)
max=(DWORD)pe->pe_resource+dir.Size;
data=((DWORD)pe->load_addr+((LPIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
walk_resdir(pe->load_addr,(DWORD)pe->pe_resource,0,data,0,&max);
return max-data;
}
/**********************************************************************
* PE_EnumResourceTypes32A
*/
BOOL32
PE_EnumResourceTypes32A(HMODULE32 hmod,ENUMRESTYPEPROC32A lpfun,LONG lparam) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
HANDLE32 heap = GetProcessHeap();
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
LPSTR name;
if (HIWORD(et[i].u1.Name))
name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name));
else
name = (LPSTR)et[i].u1.Name;
ret = lpfun(hmod,name,lparam);
if (HIWORD(name))
HeapFree(heap,0,name);
if (!ret)
break;
}
return ret;
}
/**********************************************************************
* PE_EnumResourceTypes32W
*/
BOOL32
PE_EnumResourceTypes32W(HMODULE32 hmod,ENUMRESTYPEPROC32W lpfun,LONG lparam) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
LPWSTR type;
if (HIWORD(et[i].u1.Name))
type = (LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name);
else
type = (LPWSTR)et[i].u1.Name;
ret = lpfun(hmod,type,lparam);
if (!ret)
break;
}
return ret;
}
/**********************************************************************
* PE_EnumResourceNames32A
*/
BOOL32
PE_EnumResourceNames32A(
HMODULE32 hmod,LPCSTR type,ENUMRESNAMEPROC32A lpfun,LONG lparam
) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
HANDLE32 heap = GetProcessHeap();
LPWSTR typeW;
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
if (HIWORD(type))
typeW = HEAP_strdupAtoW(heap,0,type);
else
typeW = (LPWSTR)type;
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pe->pe_resource);
if (HIWORD(typeW))
HeapFree(heap,0,typeW);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
LPSTR name;
if (HIWORD(et[i].u1.Name))
name = HEAP_strdupWtoA(heap,0,(LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name));
else
name = (LPSTR)et[i].u1.Name;
ret = lpfun(hmod,type,name,lparam);
if (HIWORD(name)) HeapFree(heap,0,name);
if (!ret)
break;
}
return ret;
}
/**********************************************************************
* PE_EnumResourceNames32W
*/
BOOL32
PE_EnumResourceNames32W(
HMODULE32 hmod,LPCWSTR type,ENUMRESNAMEPROC32W lpfun,LONG lparam
) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
resdir = GetResDirEntryW(resdir,type,(DWORD)pe->pe_resource);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
LPWSTR name;
if (HIWORD(et[i].u1.Name))
name = (LPWSTR)((LPBYTE)pe->pe_resource+et[i].u1.Name);
else
name = (LPWSTR)et[i].u1.Name;
ret = lpfun(hmod,type,name,lparam);
if (!ret)
break;
}
return ret;
}
/**********************************************************************
* PE_EnumResourceNames32A
*/
BOOL32
PE_EnumResourceLanguages32A(
HMODULE32 hmod,LPCSTR name,LPCSTR type,ENUMRESLANGPROC32A lpfun,
LONG lparam
) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
HANDLE32 heap = GetProcessHeap();
LPWSTR nameW,typeW;
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
if (HIWORD(name))
nameW = HEAP_strdupAtoW(heap,0,name);
else
nameW = (LPWSTR)name;
resdir = GetResDirEntryW(resdir,nameW,(DWORD)pe->pe_resource);
if (HIWORD(nameW))
HeapFree(heap,0,nameW);
if (!resdir)
return FALSE;
if (HIWORD(type))
typeW = HEAP_strdupAtoW(heap,0,type);
else
typeW = (LPWSTR)type;
resdir = GetResDirEntryW(resdir,typeW,(DWORD)pe->pe_resource);
if (HIWORD(typeW))
HeapFree(heap,0,typeW);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
/* languages are just ids... I hope */
ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
if (!ret)
break;
}
return ret;
}
/**********************************************************************
* PE_EnumResourceLanguages32W
*/
BOOL32
PE_EnumResourceLanguages32W(
HMODULE32 hmod,LPCWSTR name,LPCWSTR type,ENUMRESLANGPROC32W lpfun,
LONG lparam
) {
PE_MODULE *pe = HMODULE32toPE_MODULE(hmod);
int i;
LPIMAGE_RESOURCE_DIRECTORY resdir;
LPIMAGE_RESOURCE_DIRECTORY_ENTRY et;
BOOL32 ret;
if (!pe || !pe->pe_resource)
return FALSE;
resdir = (LPIMAGE_RESOURCE_DIRECTORY)pe->pe_resource;
resdir = GetResDirEntryW(resdir,name,(DWORD)pe->pe_resource);
if (!resdir)
return FALSE;
resdir = GetResDirEntryW(resdir,type,(DWORD)pe->pe_resource);
if (!resdir)
return FALSE;
et =(LPIMAGE_RESOURCE_DIRECTORY_ENTRY)((LPBYTE)resdir+sizeof(IMAGE_RESOURCE_DIRECTORY));
ret = FALSE;
for (i=0;i<resdir->NumberOfNamedEntries+resdir->NumberOfIdEntries;i++) {
ret = lpfun(hmod,name,type,et[i].u1.Id,lparam);
if (!ret)
break;
}
return ret;
}
#endif

View File

@ -345,8 +345,12 @@ DWORD SizeofResource32( HINSTANCE32 hModule, HRSRC32 hRsrc )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource32: module=%04x res=%04x\n",
hModule, hRsrc );
#ifndef WINELIB
return PE_SizeofResource32(hModule,hRsrc);
#else
fprintf(stderr,"SizeofResource32: not implemented\n");
return 0;
#endif
}
@ -441,10 +445,15 @@ HACCEL16 LoadAccelerators16(HINSTANCE16 instance, SEGPTR lpTableName)
/**********************************************************************
* LoadAccelerators32W [USER.177]
* The image layout seems to look like this (not 100% sure):
* 00: BYTE type type of accelerator
* 01: BYTE pad (to WORD boundary)
* 02: WORD event
* 04: WORD IDval
* 06: WORD pad (to DWORD boundary)
*/
HACCEL32 LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
{
#if 0
HACCEL32 hAccel;
HGLOBAL32 rsc_mem;
HRSRC32 hRsrc;
@ -471,11 +480,12 @@ HACCEL32 LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
lpAccelTbl = (LPACCELHEADER)GlobalLock16(hAccel);
lpAccelTbl->wCount = 0;
for (i = 0; i < n; i++) {
lpAccelTbl->tbl[i].type = *(lp++);
lpAccelTbl->tbl[i].type = *lp;
lp += 2;
lpAccelTbl->tbl[i].wEvent = *((WORD *)lp);
lp += 2;
lpAccelTbl->tbl[i].wIDval = *((WORD *)lp);
lp += 2;
lp += 4;
if (lpAccelTbl->tbl[i].wEvent == 0) break;
dprintf_accel(stddeb,
"Accelerator #%u / event=%04X id=%04X type=%02X \n",
@ -486,10 +496,6 @@ HACCEL32 LoadAccelerators32W(HINSTANCE32 instance,LPCWSTR lpTableName)
GlobalUnlock16(hAccel);
FreeResource32(rsc_mem);
return hAccel;
#else
fprintf(stderr,"LoadAcceleratorsW: not implemented\n");
return 0x100; /* Return something anyway */
#endif
}
HACCEL32 LoadAccelerators32A(HINSTANCE32 instance,LPCSTR lpTableName)
@ -744,3 +750,51 @@ SetResourceHandler(HINSTANCE16 instance,LPSTR s,FARPROC16 farproc)
fprintf(stderr,"SetResourceHandler(%04x,0x%04x,%p), empty STUB!\n",instance,LOWORD(s),farproc);
return NULL;
}
#ifndef WINELIB
/**********************************************************************
* EnumResourceTypesA (KERNEL32.90)
*/
BOOL32
EnumResourceTypes32A(HMODULE32 hmodule,ENUMRESTYPEPROC32A lpfun,LONG lParam) {
return PE_EnumResourceTypes32A(hmodule,lpfun,lParam);
}
/**********************************************************************
* EnumResourceTypesW (KERNEL32.91)
*/
BOOL32
EnumResourceTypes32W(HMODULE32 hmodule,ENUMRESTYPEPROC32W lpfun,LONG lParam) {
return PE_EnumResourceTypes32W(hmodule,lpfun,lParam);
}
/**********************************************************************
* EnumResourceNamesA (KERNEL32.88)
*/
BOOL32
EnumResourceNames32A(HMODULE32 hmodule,LPCSTR type,ENUMRESNAMEPROC32A lpfun,LONG lParam) {
return PE_EnumResourceNames32A(hmodule,type,lpfun,lParam);
}
/**********************************************************************
* EnumResourceNamesW (KERNEL32.89)
*/
BOOL32
EnumResourceNames32W(HMODULE32 hmodule,LPCWSTR type,ENUMRESNAMEPROC32W lpfun,LONG lParam) {
return PE_EnumResourceNames32W(hmodule,type,lpfun,lParam);
}
/**********************************************************************
* EnumResourceLanguagesA (KERNEL32.86)
*/
BOOL32
EnumResourceLanguages32A(HMODULE32 hmodule,LPCSTR type,LPCSTR name,ENUMRESLANGPROC32A lpfun,LONG lParam) {
return PE_EnumResourceLanguages32A(hmodule,type,name,lpfun,lParam);
}
/**********************************************************************
* EnumResourceLanguagesW (KERNEL32.87)
*/
BOOL32
EnumResourceLanguages32W(HMODULE32 hmodule,LPCWSTR type,LPCWSTR name,ENUMRESLANGPROC32W lpfun,LONG lParam) {
return PE_EnumResourceLanguages32W(hmodule,type,name,lpfun,lParam);
}
#endif /* WINELIB */

View File

@ -143,7 +143,6 @@ static void SIGNAL_fault(int signal, void *siginfo, SIGCONTEXT *context)
static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context)
{
#endif
#ifndef __EMX__ /* FIXME: XX_sig(constext)=pointer to incomplete type (EMX) */
if (CS_sig(context) == WINE_CODE_SELECTOR)
{
fprintf( stderr, "Segmentation fault in Wine program (%x:%lx)."
@ -157,7 +156,6 @@ static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context)
CS_sig(context), EIP_sig(context) );
}
wine_debug( signal, context );
#endif
}

View File

@ -361,7 +361,6 @@ static void TASK_CallToStart(void)
/* FIXME: all this is an ugly hack */
extern void InitTask( CONTEXT *context );
extern void PE_InitializeDLLs( HMODULE16 hModule );
InitTask( NULL );
InitApp( pTask->hModule );
@ -536,7 +535,15 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
/* Create the Win32 part of the task */
pdb32 = PROCESS_Create( pTask );
pTask->thdb = THREAD_Create( pdb32, 0 );
if (pModule->flags & NE_FFLAGS_WIN32)
{
LPTHREAD_START_ROUTINE start =
(LPTHREAD_START_ROUTINE)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->OptionalHeader.AddressOfEntryPoint);
pTask->thdb = THREAD_Create( pdb32, 0, start );
}
else
pTask->thdb = THREAD_Create( pdb32, 0, NULL );
/* Create the 32-bit stack frame */
@ -1274,20 +1281,30 @@ WORD GetExeVersion(void)
/***********************************************************************
* SetErrorMode (KERNEL.107)
* SetErrorMode16 (KERNEL.107)
*/
UINT SetErrorMode( UINT mode )
UINT16 SetErrorMode16( UINT16 mode )
{
TDB *pTask;
UINT oldMode;
UINT16 oldMode;
if (!(pTask = (TDB *)GlobalLock16( hCurrentTask ))) return 0;
oldMode = pTask->error_mode;
pTask->error_mode = mode;
pTask->thdb->process->error_mode = mode;
return oldMode;
}
/***********************************************************************
* SetErrorMode32 (KERNEL32.486)
*/
UINT32 SetErrorMode32( UINT32 mode )
{
return SetErrorMode16( (UINT16)mode );
}
/***********************************************************************
* GetDOSEnvironment (KERNEL.131)
*/

View File

@ -13,7 +13,7 @@
#include "debug.h"
#define FIRST_LDT_ENTRY_TO_ALLOC 6
#define FIRST_LDT_ENTRY_TO_ALLOC 17
/***********************************************************************

View File

@ -858,7 +858,7 @@ INT16 SetCommState16(LPDCB16 lpdcb)
commerror = IE_BAUDRATE;
return -1;
}
#else
#elif !defined(__EMX__)
switch (lpdcb->BaudRate) {
case 110:
case CBR_110:
@ -1059,7 +1059,7 @@ BOOL32 SetCommState32(INT32 fd,LPDCB32 lpdcb)
commerror = IE_BAUDRATE;
return FALSE;
}
#else
#elif !defined(__EMX__)
switch (lpdcb->BaudRate) {
case 110:
case CBR_110:
@ -1194,6 +1194,7 @@ INT16 GetCommState16(INT16 fd, LPDCB16 lpdcb)
return -1;
}
lpdcb->Id = fd;
#ifndef __EMX__
#ifdef CBAUD
switch (port.c_cflag & CBAUD) {
#else
@ -1227,7 +1228,7 @@ INT16 GetCommState16(INT16 fd, LPDCB16 lpdcb)
lpdcb->BaudRate = 38400;
break;
}
#endif
switch (port.c_cflag & CSIZE) {
case CS5:
lpdcb->ByteSize = 5;
@ -1312,6 +1313,7 @@ BOOL32 GetCommState32(INT32 fd, LPDCB32 lpdcb)
commerror = WinError();
return FALSE;
}
#ifndef __EMX__
#ifdef CBAUD
switch (port.c_cflag & CBAUD) {
#else
@ -1345,7 +1347,7 @@ BOOL32 GetCommState32(INT32 fd, LPDCB32 lpdcb)
lpdcb->BaudRate = 38400;
break;
}
#endif
switch (port.c_cflag & CSIZE) {
case CS5:
lpdcb->ByteSize = 5;

View File

@ -2,6 +2,7 @@
* What processor?
*
* Copyright 1995 Morten Welinder
* Copyright 1997 Marcus Meissner
*/
#include <stdio.h>
@ -9,39 +10,93 @@
#include <string.h>
#include "windows.h"
int runtime_cpu (void)
VOID
GetSystemInfo(LPSYSTEM_INFO si)
{
#ifndef __i386__
return 5; /* Might as well pretend to be a Pentium... */
#else /* __i386__ */
static int cache = 0;
static SYSTEM_INFO cachedsi;
if (cache) {
memcpy(si,&cachedsi,sizeof(*si));
return;
}
/* choose sensible defaults ...
* FIXME: perhaps overrideable with precompiler flags?
*/
cachedsi.u.x.wProcessorArchitecture = PROCESSOR_ARCHITECTURE_INTEL;
cachedsi.dwPageSize = 4096;
/* FIXME: better values for the two entries below... */
cachedsi.lpMinimumApplicationAddress = (void *)0x40000000;
cachedsi.lpMaximumApplicationAddress = (void *)0x80000000;
cachedsi.dwActiveProcessorMask = 1;
cachedsi.dwNumberOfProcessors = 1;
cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
cachedsi.dwAllocationGranularity = 8;
cachedsi.wProcessorLevel = 3; /* 386 */
cachedsi.wProcessorRevision = 0;
cache = 1; /* even if there is no more info, we now have a cacheentry */
memcpy(si,&cachedsi,sizeof(*si));
#ifdef linux
if (!cache)
{
char line[200],info[200],value[200],junk[200];
FILE *f = fopen ("/proc/cpuinfo", "r");
cache = 3; /* Default. */
if (f)
{
char info[5], value[5];
while (fscanf (f, " %4s%*s : %4s%*s", info, value) == 2)
if (!lstrcmpi32A(info, "cpu"))
{
if (isdigit (value[0]) && value[1] == '8'
&& value[2] == '6' && value[3] == 0)
{
cache = value[0] - '0';
if (!f)
return;
while (fgets(line,200,f)!=NULL) {
if (sscanf(line,"%s%[ \t:]%s",info,junk,value)!=3)
continue;
if (!lstrncmpi32A(line, "cpu",3)) {
if ( isdigit (value[0]) && value[1] == '8' &&
value[2] == '6' && value[3] == 0
) {
switch (value[0] - '0') {
case 3:
cachedsi.dwProcessorType = PROCESSOR_INTEL_386;
cachedsi.wProcessorLevel= 3;
break;
case 4:
cachedsi.dwProcessorType = PROCESSOR_INTEL_486;
cachedsi.wProcessorLevel= 4;
break;
case 5:
cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
cachedsi.wProcessorLevel= 5;
break;
case 6: /* FIXME does the PPro have a special type? */
cachedsi.dwProcessorType = PROCESSOR_INTEL_PENTIUM;
cachedsi.wProcessorLevel= 5;
break;
default:
break;
}
}
}
if (!lstrncmpi32A(info,"processor",9)) {
/* processor number counts up...*/
int x;
if (sscanf(value,"%d",&x))
if (x+1>cachedsi.dwNumberOfProcessors)
cachedsi.dwNumberOfProcessors=x+1;
}
if (!lstrncmpi32A(info,"stepping",8)) {
int x;
if (sscanf(value,"%d",&x))
cachedsi.wProcessorRevision = x;
}
}
fclose (f);
}
}
return cache;
#endif /* linux */
memcpy(si,&cachedsi,sizeof(*si));
return;
#else /* linux */
/* FIXME: how do we do this on other systems? */
return 3;
#endif /* __i386__ */
return;
#endif /* linux */
}

View File

@ -22,6 +22,7 @@
#include "xmalloc.h"
#include "heap.h"
#include "crtdll.h"
#include "drive.h"
UINT32 CRTDLL_argc_dll; /* CRTDLL.23 */
LPSTR *CRTDLL_argv_dll; /* CRTDLL.24 */
@ -763,6 +764,23 @@ INT32 CRTDLL_wcsspn(LPWSTR str,LPWSTR accept)
return s-str; /* nr of wchars */
}
/*********************************************************************
* wcscspn (CRTDLL.508)
*/
INT32 CRTDLL_wcscspn(LPWSTR str,LPWSTR reject)
{
LPWSTR s,t;
s=str;
do {
t=reject;
while (*t) { if (*t==*s) break;t++;}
if (*t) break;
s++;
} while (*s);
return s-str; /* nr of wchars */
}
/*********************************************************************
* wcschr (CRTDLL.504)
*/
@ -868,3 +886,58 @@ CRTDLL_atexit(LPVOID x) {
fprintf(stdnimp,"CRTDLL.atexit(%p), STUB.\n",x);
return 0; /* successful */
}
/*********************************************************************
* mbtowc (CRTDLL.430)
* FIXME: check multibyte support
*/
WCHAR
CRTDLL_mbtowc(CHAR a) {
return a;
}
/*********************************************************************
* _isctype (CRTDLL.138)
*/
BOOL32
CRTDLL__isctype(CHAR x,CHAR type) {
if ((type & CRTDLL_SPACE) && isspace(x))
return TRUE;
if ((type & CRTDLL_PUNCT) && ispunct(x))
return TRUE;
if ((type & CRTDLL_LOWER) && islower(x))
return TRUE;
if ((type & CRTDLL_UPPER) && isupper(x))
return TRUE;
if ((type & CRTDLL_ALPHA) && isalpha(x))
return TRUE;
if ((type & CRTDLL_DIGIT) && isdigit(x))
return TRUE;
if ((type & CRTDLL_CONTROL) && iscntrl(x))
return TRUE;
/* check CRTDLL_LEADBYTE */
return FALSE;
}
/*********************************************************************
* _chdrive (CRTDLL.52)
*/
BOOL32
CRTDLL__chdrive(INT32 newdrive) {
/* FIXME: generates errnos */
return DRIVE_SetCurrentDrive(newdrive);
}
/*********************************************************************
* _errno (CRTDLL.52)
* Yes, this is a function.
*/
LPINT32
CRTDLL__errno() {
static int crtdllerrno;
extern int LastErrorToErrno(DWORD);
/* FIXME: we should set the error at the failing function call time */
crtdllerrno = LastErrorToErrno(GetLastError());
return &crtdllerrno;
}

View File

@ -11,7 +11,7 @@
WORD
EngineEnumerateFont(LPSTR fontname, FARPROC16 proc, DWORD data )
{
printf("In engineEnumerateFont for %s\n",fontname);
printf("In engineEnumerateFont for %s\n",(fontname)?fontname:"NULL");
return 0;
}
#ifdef NOTDEF

View File

@ -1,332 +0,0 @@
/*
static char RCSId[] = "$Id: keyboard.c,v 1.2 1993/09/13 18:52:02 scott Exp $";
static char Copyright[] = "Copyright Scott A. Laird, Erik Bos 1993, 1994";
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "keyboard.h"
#include "stddebug.h"
/* #define DEBUG_KEYBOARD */
#include "debug.h"
#include "xmalloc.h"
struct KeyTableEntry {
int virtualkey;
int ASCII;
int scancode;
const char *name;
};
static const struct KeyTableEntry KeyTable[] =
{
{ VK_CANCEL, 0x3, 0, "" },
{ VK_BACK, 0x8, 0xe, "Backspace" },
{ VK_TAB, 0x9, 0xf, "Tab" },
{ VK_CLEAR, 0, 0x4c, "Clear" },
{ VK_RETURN, 0xd, 0x1c, "Enter" },
{ VK_SHIFT, 0, 0x2a, "Shift" },
{ VK_CONTROL, 0, 0x1d, "Ctrl" },
{ VK_MENU, 0, 0x38, "Alt" },
{ VK_CAPITAL, 0, 0x3a, "Caps Lock" },
{ VK_ESCAPE, 0x1b, 0x1, "Esc" },
{ VK_SPACE, 0x20, 0x39, "Space" },
{ VK_PRIOR, 0, 0x49, "Page Up" },
{ VK_NEXT, 0, 0x51, "Page Down" },
{ VK_END, 0, 0x4f, "End" },
{ VK_HOME, 0, 0x47, "Home" },
{ VK_LEFT, 0, 0x4b, "Left Arrow" },
{ VK_UP, 0, 0x48, "Up Arrow" },
{ VK_RIGHT, 0, 0x4d, "Right Arrow" },
{ VK_DOWN, 0, 0x50, "Down Arrow" },
{ VK_INSERT, 0, 0x52, "Ins" },
{ VK_DELETE, 0, 0x53, "Del" },
{ VK_0, 0x30, 0xb, "0" },
{ VK_1, 0x31, 0x2, "1" },
{ VK_2, 0x32, 0x3, "2" },
{ VK_3, 0x33, 0x4, "3" },
{ VK_4, 0x34, 0x5, "4" },
{ VK_5, 0x35, 0x6, "5" },
{ VK_6, 0x36, 0x7, "6" },
{ VK_7, 0x37, 0x8, "7" },
{ VK_8, 0x38, 0x9, "8" },
{ VK_9, 0x39, 0xa, "9" },
{ VK_A, 0x41, 0x1e, "A" },
{ VK_B, 0x42, 0x30, "B" },
{ VK_C, 0x43, 0x2e, "C" },
{ VK_D, 0x44, 0x20, "D" },
{ VK_E, 0x45, 0x12, "E" },
{ VK_F, 0x46, 0x21, "F" },
{ VK_G, 0x47, 0x22, "G" },
{ VK_H, 0x48, 0x23, "H" },
{ VK_I, 0x49, 0x17, "I" },
{ VK_J, 0x4a, 0x24, "J" },
{ VK_K, 0x4b, 0x25, "K" },
{ VK_L, 0x4c, 0x26, "L" },
{ VK_M, 0x4d, 0x32, "M" },
{ VK_N, 0x4e, 0x31, "N" },
{ VK_O, 0x4f, 0x18, "O" },
{ VK_P, 0x50, 0x19, "P" },
{ VK_Q, 0x51, 0x10, "Q" },
{ VK_R, 0x52, 0x13, "R" },
{ VK_S, 0x53, 0x1f, "S" },
{ VK_T, 0x54, 0x14, "T" },
{ VK_U, 0x55, 0x16, "U" },
{ VK_V, 0x56, 0x2f, "V" },
{ VK_W, 0x57, 0x11, "W" },
{ VK_X, 0x58, 0x2d, "X" },
{ VK_Y, 0x59, 0x15, "Y" },
{ VK_Z, 0x5a, 0x2c, "Z" },
{ VK_NUMPAD0, 0, 0x52, "Num 0" },
{ VK_NUMPAD1, 0, 0x4f, "Num 1" },
{ VK_NUMPAD2, 0, 0x50, "Num 2" },
{ VK_NUMPAD3, 0, 0x51, "Num 3" },
{ VK_NUMPAD4, 0, 0x4b, "Num 4" },
{ VK_NUMPAD5, 0, 0x4c, "Num 5" },
{ VK_NUMPAD6, 0, 0x4d, "Num 6" },
{ VK_NUMPAD7, 0, 0x47, "Num 7" },
{ VK_NUMPAD8, 0, 0x48, "Num 8" },
{ VK_NUMPAD9, 0, 0x49, "Num 9" },
{ VK_MULTIPLY, 0x2a, 0x37, "Num *" },
{ VK_ADD, 0x2b, 0x4e, "Num +" },
{ VK_SEPARATOR, 0, 0, "" },
{ VK_SUBTRACT, 0x2d, 0x4a, "Num -" },
{ VK_DECIMAL, 0x2e, 0x53, "Num Del" },
{ VK_DIVIDE, 0x2f, 0, "Num /" },
{ VK_F1, 0, 0x3b, "F1" },
{ VK_F2, 0, 0x3c, "F2" },
{ VK_F3, 0, 0x3d, "F3" },
{ VK_F4, 0, 0x3e, "F4" },
{ VK_F5, 0, 0x3f, "F5" },
{ VK_F6, 0, 0x40, "F6" },
{ VK_F7, 0, 0x41, "F7" },
{ VK_F8, 0, 0x42, "F8" },
{ VK_F9, 0, 0x43, "F9" },
{ VK_F10, 0, 0x44, "F10" },
{ VK_F11, 0, 0x57, "F11" },
{ VK_F12, 0, 0x58, "F12" },
{ VK_NUMLOCK, 0, 0x45, "Num Lock" },
{ VK_SCROLL, 0, 0x46, "Scroll Lock" },
/* Allowable ranges for OEM-specific virtual-key codes */
/* - 0xBA-0xC0 OEM specific */
{ 0xba, 0x3b, 0x27, ";" },
{ 0xbb, 0x3d, 0xd, "=" },
{ 0xbc, 0x2c, 0x33, "," },
{ 0xbd, 0x2d, 0xc, "-" },
{ 0xbe, 0x2e, 0x34, "." },
{ 0xbf, 0x2f, 0x35, "/" },
{ 0xc0, 0x60, 0x29, "`" },
/* - 0xDB-0xE4 OEM specific */
{ 0xdb, 0x5b, 0x1a, "[" },
{ 0xdc, 0x5c, 0x2b, "\\" },
{ 0xdd, 0x5d, 0x1b, "]" },
{ 0xde, 0x27, 0x28, "'" },
{ 0xe2, 0x5c, 0x56, "\\" },
/* - 0xE6 OEM specific */
/* - 0xE9-0xF5 OEM specific */
};
#define KeyTableSize sizeof(KeyTable) / sizeof(struct KeyTableEntry)
int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
LPVOID lpChar, WORD wFlags)
{
#if 1
return EVENT_ToAscii(wVirtKey, wScanCode, lpKeyState, lpChar, wFlags);
#else
char shift = lpKeyState[VK_SHIFT] < 0;
int i;
dprintf_keyboard(stddeb, "ToAscii (%x,%x) -> ", wVirtKey, wScanCode);
/* FIXME: codepage is broken */
*(BYTE*)lpChar = 0;
switch (wVirtKey)
{
#define vkcase2(k1,k2,val) case val : *(BYTE*)lpChar = shift ? k2 : k1; break;
#define vkcase(k, val) vkcase2(val, k, val)
WINE_VKEY_MAPPINGS
#undef vkcase
#undef vkcase2
default :
for (i = 0 ; ; i++)
{
if (i == KeyTableSize)
{
dprintf_keyboard(stddeb, "0\n");
return 0;
}
if (KeyTable[i].virtualkey == wVirtKey)
{
if (!isprint(KeyTable[i].ASCII) && !isspace(KeyTable[i].ASCII))
{
dprintf_keyboard(stddeb, "0\n");
return 0;
}
dprintf_keyboard(stddeb,"\"%s\" ", KeyTable[i].name);
*(BYTE*)lpChar = KeyTable[i].ASCII;
*(((BYTE*)lpChar) + 1) = 0;
if (isalpha(*(BYTE*)lpChar))
if( (lpKeyState[VK_CAPITAL]<0 && !lpKeyState[VK_SHIFT]) ||
(!lpKeyState[VK_CAPITAL] && lpKeyState[VK_SHIFT]<0) )
*(BYTE*)lpChar = toupper( *(BYTE*)lpChar );
else
*(BYTE*)lpChar = tolower( *(BYTE*)lpChar );
break;
}
}
}
if (lpKeyState[VK_CONTROL] < 0)
*(BYTE*)lpChar = *(BYTE*)lpChar & 0x1f;
dprintf_keyboard(stddeb, "1 (%x)\n", *(BYTE*)lpChar);
return 1;
#endif
}
DWORD OemKeyScan(WORD wOemChar)
{
dprintf_keyboard(stddeb,"*OemKeyScan (%d)\n",wOemChar);
return wOemChar;
}
/* VkKeyScan translates an ANSI character to a virtual-key and shift code
* for the current keyboard.
* FIXME high-order byte should yield :
* 0 Unshifted
* 1 Shift
* 2 Ctrl
* 3-5 Shift-key combinations that are not used for characters
* 6 Ctrl-Alt
* 7 Ctrl-Alt-Shift
* I.e. : Shift = 1, Ctrl = 2, Alt = 4.
*/
WORD VkKeyScan(WORD cChar)
{
int i;
dprintf_keyboard(stddeb,"VkKeyScan (%d)\n",cChar);
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].ASCII == cChar)
return KeyTable[i].virtualkey;
return -1;
}
WORD VkKeyScan32W(WORD cChar)
{
/* lower part of cChar is used anyway */
return VkKeyScan(cChar);
}
int GetKeyboardType(int nTypeFlag)
{
dprintf_keyboard(stddeb,"GetKeyboardType(%d)\n",nTypeFlag);
switch(nTypeFlag)
{
case 0: /* Keyboard type */
return 4; /* AT-101 */
break;
case 1: /* Keyboard Subtype */
return 0; /* There are no defined subtypes */
break;
case 2: /* Number of F-keys */
return 12; /* We're doing an 101 for now, so return 12 F-keys */
break;
default:
fprintf(stderr, "Unknown type on GetKeyboardType\n");
return 0; /* The book says 0 here, so 0 */
}
}
/* MapVirtualKey translates keycodes from one format to another. */
WORD MapVirtualKey(WORD wCode, WORD wMapType)
{
int i;
switch(wMapType) {
case 0: /* vkey-code to scan-code */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].scancode;
return 0;
case 1: /* scan-code to vkey-code */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == wCode)
return KeyTable[i].virtualkey;
return 0;
case 2: /* vkey-code to unshifted ANSI code */
/* FIXME : what does unshifted mean ? 'a' or 'A' ? */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].ASCII;
return 0;
default: /* reserved */
fprintf(stderr, "MapVirtualKey: unknown wMapType %d !\n",
wMapType);
return 0;
}
return 0;
}
int GetKbCodePage(void)
{
dprintf_keyboard(stddeb,"GetKbCodePage()\n");
return 850;
}
/****************************************************************************
* GetKeyNameText32W (USER32.247)
*/
INT32 GetKeyNameText32W(LONG lParam, LPWSTR lpBuffer, INT32 nSize)
{
LPSTR buf = xmalloc(nSize);
int res = GetKeyNameText32A(lParam,buf,nSize);
lstrcpynAtoW(lpBuffer,buf,nSize);
free(buf);
return res;
}
/****************************************************************************
* GetKeyNameText32A (USER32.246)
*/
INT32 GetKeyNameText32A(LONG lParam, LPSTR lpBuffer, INT32 nSize)
{
return GetKeyNameText16(lParam,lpBuffer,nSize);
}
/****************************************************************************
* GetKeyNameText16 (KEYBOARD.133)
*/
INT16 GetKeyNameText16(LONG lParam, LPSTR lpBuffer, INT16 nSize)
{
int i;
dprintf_keyboard(stddeb,"GetKeyNameText(%ld,<ptr>,%d)\n",lParam,nSize);
lParam >>= 16;
lParam &= 0xff;
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == lParam) {
lstrcpyn32A( lpBuffer, KeyTable[i].name, nSize );
return strlen(lpBuffer);
}
*lpBuffer = 0;
return 0;
}

View File

@ -567,6 +567,11 @@ FormatMessage32A(
HeapFree(GetProcessHeap(),0,sprintfbuf);
HeapFree(GetProcessHeap(),0,fmtstr);
break;
case 'n':
/* FIXME: perhaps add \r too? */
ADD_TO_T('\n');
f++;
break;
case '0':
nolinefeed=1;
f++;
@ -760,6 +765,11 @@ FormatMessage32W(
HeapFree(GetProcessHeap(),0,sprintfbuf);
HeapFree(GetProcessHeap(),0,fmtstr);
break;
case 'n':
/* FIXME: perhaps add \r too? */
ADD_TO_T('\n');
f++;
break;
case '0':
nolinefeed=1;
f++;

View File

@ -774,15 +774,17 @@ BOOL32 GetVersionEx32W(OSVERSIONINFO32W *v)
/***********************************************************************
* GetWinFlags (KERNEL.132)
*/
LONG GetWinFlags(void)
DWORD GetWinFlags(void)
{
static const long cpuflags[5] =
{ WF_CPU086, WF_CPU186, WF_CPU286, WF_CPU386, WF_CPU486 };
SYSTEM_INFO si;
long result = 0,cpuflag;
long result = 0;
GetSystemInfo(&si);
/* There doesn't seem to be any Pentium flag. */
long cpuflag = cpuflags[MIN (runtime_cpu (), 4)];
cpuflag = cpuflags[MIN (si.wProcessorLevel, 4)];
switch(Options.mode) {
case MODE_STANDARD:

View File

@ -1273,6 +1273,7 @@ LOCVAL(LOCALE_INEGSEPBYSPACE,"0")
retString);
return 0;
}
if (buf)
lstrcpyn32A(buf,retString,len);
return strlen(retString)+1;
}
@ -1286,9 +1287,9 @@ INT32 GetLocaleInfo32W(LCID lcid,LCTYPE LCType,LPWSTR wbuf,INT32 len)
int i;
LPSTR abuf = (LPSTR) wbuf;
INT32 n = GetLocaleInfoA(lcid, LCType, abuf, len);
for (i = n; i > 0; --i) {
if (wbuf)
for (i = n; i > 0; --i)
wbuf[i] = abuf[i];
}
return n;
}

View File

@ -9,6 +9,9 @@
#include <sys/time.h>
#ifndef HAVE_USLEEP
#ifdef __EMX__
unsigned int usleep (unsigned int useconds) { DosSleep(useconds); }
#else
unsigned int usleep (unsigned int useconds)
{
struct timeval delay;
@ -19,6 +22,7 @@ unsigned int usleep (unsigned int useconds)
select( 0, 0, 0, 0, &delay );
return 0;
}
#endif
#endif /* HAVE_USLEEP */
#ifndef HAVE_MEMMOVE

View File

@ -18,6 +18,7 @@
#endif
#if defined(__EMX__)
#include <sys/so_ioctl.h>
#include <sys/param.h>
#endif
#include <sys/msg.h>
#include <sys/wait.h>
@ -1741,8 +1742,12 @@ UINT16 wsaErrno(void)
#ifdef EDQUOT
case EDQUOT: return WSAEDQUOT;
#endif
#ifdef ESTALE
case ESTALE: return WSAESTALE;
#endif
#ifdef EREMOTE
case EREMOTE: return WSAEREMOTE;
#endif
/* just in case we ever get here and there are no problems */
case 0: return 0;

View File

@ -14,6 +14,13 @@
#include <sys/msg.h>
#include <sys/wait.h>
#include <errno.h>
#ifdef __EMX__
#include <sys/so_ioctl.h>
#include <sys/param.h>
#endif
#ifndef FASYNC
#define FASYNC FIOASYNC
#endif
#ifdef __svr4__
#include <sys/file.h>
#include <sys/filio.h>
@ -42,7 +49,9 @@ int WINSOCK_async_io(int fd, int async)
{
int fd_flags;
#ifndef __EMX__
fcntl(fd, F_SETOWN, getpid());
#endif
fd_flags = fcntl(fd, F_GETFL, 0);
if (fcntl(fd, F_SETFL, (async)? fd_flags | FASYNC
@ -213,7 +222,9 @@ static int notify_parent( unsigned flag )
{
write(async_ctl.ws_aop->fd[1], &async_ctl.lLength, sizeof(unsigned) );
write(async_ctl.ws_aop->fd[1], async_ctl.buffer, async_ctl.lLength );
#ifndef __EMX__
kill(getppid(), SIGIO); /* simulate async I/O */
#endif
#if __WS_ASYNC_DEBUG
printf("handler - notify aop [%d, buf %d]\n", async_ctl.lLength, async_ctl.ws_aop->buflen);
#endif
@ -419,7 +430,9 @@ static void _async_fail()
(h_errno < 0) ? (unsigned)WSAMAKEASYNCREPLY( 0, wsaErrno() )
: (unsigned)WSAMAKEASYNCREPLY( 0, wsaHerrno() );
write(async_ctl.ws_aop->fd[1], &async_ctl.lLength, sizeof(unsigned) );
#ifndef __EMX__
kill(getppid(), SIGIO); /* simulate async I/O */
#endif
pause();
}

View File

@ -354,12 +354,16 @@ void INT_Int31Handler( CONTEXT *context )
break;
case 0x0400: /* Get DPMI version */
{
SYSTEM_INFO si;
GetSystemInfo(&si);
AX_reg(context) = 0x005a; /* DPMI version 0.90 */
BX_reg(context) = 0x0005; /* Flags: 32-bit, virtual memory */
CL_reg(context) = runtime_cpu ();
CL_reg(context) = si.wProcessorLevel;
DX_reg(context) = 0x0102; /* Master/slave interrupt controller base*/
break;
}
case 0x0500: /* Get free memory information */
{
MEMMANINFO mmi;

View File

@ -122,15 +122,19 @@ static void do_int2f_16( CONTEXT *context )
/* FIXME: is this right? Specs say that this should only be callable
in real (v86) mode which we never enter. */
case 0x87: /* DPMI installation check */
{
SYSTEM_INFO si;
GetSystemInfo(&si);
AX_reg(context) = 0x0000; /* DPMI Installed */
BX_reg(context) = 0x0001; /* 32bits available */
CL_reg(context) = runtime_cpu();
CL_reg(context) = si.wProcessorLevel;
DX_reg(context) = 0x005a; /* DPMI major/minor 0.90 */
SI_reg(context) = 0; /* # of para. of DOS extended private data */
ES_reg(context) = 0; /* ES:DI is DPMI switch entry point */
DI_reg(context) = 0;
break;
}
case 0x8a: /* DPMI get vendor-specific API entry point. */
/* The 1.0 specs say this should work with all 0.9 hosts. */
break;

View File

@ -27,33 +27,6 @@ GC BITMAP_monoGC = 0, BITMAP_colorGC = 0;
extern void CLIPPING_UpdateGCRegion( DC * dc ); /* objects/clipping.c */
/***********************************************************************
* BITMAP_Init
*/
BOOL32 BITMAP_Init(void)
{
Pixmap tmpPixmap;
/* Create the necessary GCs */
if ((tmpPixmap = XCreatePixmap( display, rootWindow, 1, 1, 1 )))
{
BITMAP_monoGC = XCreateGC( display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( display, BITMAP_monoGC, False );
XFreePixmap( display, tmpPixmap );
}
if (screenDepth != 1)
{
if ((tmpPixmap = XCreatePixmap(display, rootWindow, 1,1,screenDepth)))
{
BITMAP_colorGC = XCreateGC( display, tmpPixmap, 0, NULL );
XSetGraphicsExposures( display, BITMAP_colorGC, False );
XFreePixmap( display, tmpPixmap );
}
}
return TRUE;
}
/***********************************************************************
@ -441,41 +414,6 @@ INT32 BITMAP_GetObject32( BITMAPOBJ * bmp, INT32 count, LPVOID buffer )
}
/***********************************************************************
* BITMAP_SelectObject
*/
HBITMAP16 BITMAP_SelectObject( DC * dc, HBITMAP16 hbitmap,
BITMAPOBJ * bmp )
{
HRGN32 hrgn;
HBITMAP16 prevHandle = dc->w.hBitmap;
if (!(dc->w.flags & DC_MEMORY)) return 0;
if (dc->w.hVisRgn)
SetRectRgn(dc->w.hVisRgn, 0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight );
else
{
hrgn = CreateRectRgn32(0, 0, bmp->bitmap.bmWidth, bmp->bitmap.bmHeight);
if (!hrgn) return 0;
dc->w.hVisRgn = hrgn;
}
dc->u.x.drawable = bmp->pixmap;
dc->w.hBitmap = hbitmap;
/* Change GC depth if needed */
if (dc->w.bitsPerPixel != bmp->bitmap.bmBitsPixel)
{
XFreeGC( display, dc->u.x.gc );
dc->u.x.gc = XCreateGC( display, dc->u.x.drawable, 0, NULL );
dc->w.bitsPerPixel = bmp->bitmap.bmBitsPixel;
DC_InitDC( dc );
}
else CLIPPING_UpdateGCRegion( dc ); /* Just update GC clip region */
return prevHandle;
}
/***********************************************************************
* CreateDiscardableBitmap (GDI.156) (GDI32.38)

View File

@ -13,130 +13,6 @@
#include "stddebug.h"
#include "debug.h"
#define NB_HATCH_STYLES 6
static const char HatchBrushes[NB_HATCH_STYLES][8] =
{
{ 0x00, 0x00, 0x00, 0xff, 0x00, 0x00, 0x00, 0x00 }, /* HS_HORIZONTAL */
{ 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08 }, /* HS_VERTICAL */
{ 0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80 }, /* HS_FDIAGONAL */
{ 0x80, 0x40, 0x20, 0x10, 0x08, 0x04, 0x02, 0x01 }, /* HS_BDIAGONAL */
{ 0x08, 0x08, 0x08, 0xff, 0x08, 0x08, 0x08, 0x08 }, /* HS_CROSS */
{ 0x81, 0x42, 0x24, 0x18, 0x18, 0x24, 0x42, 0x81 } /* HS_DIAGCROSS */
};
/* Levels of each primary for dithering */
#define PRIMARY_LEVELS 3
#define TOTAL_LEVELS (PRIMARY_LEVELS*PRIMARY_LEVELS*PRIMARY_LEVELS)
/* Dithering matrix size */
#define MATRIX_SIZE 8
#define MATRIX_SIZE_2 (MATRIX_SIZE*MATRIX_SIZE)
/* Total number of possible levels for a dithered primary color */
#define DITHER_LEVELS (MATRIX_SIZE_2 * (PRIMARY_LEVELS-1) + 1)
/* Dithering matrix */
static const int dither_matrix[MATRIX_SIZE_2] =
{
0, 32, 8, 40, 2, 34, 10, 42,
48, 16, 56, 24, 50, 18, 58, 26,
12, 44, 4, 36, 14, 46, 6, 38,
60, 28, 52, 20, 62, 30, 54, 22,
3, 35, 11, 43, 1, 33, 9, 41,
51, 19, 59, 27, 49, 17, 57, 25,
15, 47, 7, 39, 13, 45, 5, 37,
63, 31, 55, 23, 61, 29, 53, 21
};
/* Mapping between (R,G,B) triples and EGA colors */
static const int EGAmapping[TOTAL_LEVELS] =
{
0, /* 000000 -> 000000 */
4, /* 00007f -> 000080 */
12, /* 0000ff -> 0000ff */
2, /* 007f00 -> 008000 */
6, /* 007f7f -> 008080 */
6, /* 007fff -> 008080 */
10, /* 00ff00 -> 00ff00 */
6, /* 00ff7f -> 008080 */
14, /* 00ffff -> 00ffff */
1, /* 7f0000 -> 800000 */
5, /* 7f007f -> 800080 */
5, /* 7f00ff -> 800080 */
3, /* 7f7f00 -> 808000 */
8, /* 7f7f7f -> 808080 */
7, /* 7f7fff -> c0c0c0 */
3, /* 7fff00 -> 808000 */
7, /* 7fff7f -> c0c0c0 */
7, /* 7fffff -> c0c0c0 */
9, /* ff0000 -> ff0000 */
5, /* ff007f -> 800080 */
13, /* ff00ff -> ff00ff */
3, /* ff7f00 -> 808000 */
7, /* ff7f7f -> c0c0c0 */
7, /* ff7fff -> c0c0c0 */
11, /* ffff00 -> ffff00 */
7, /* ffff7f -> c0c0c0 */
15 /* ffffff -> ffffff */
};
#define PIXEL_VALUE(r,g,b) \
COLOR_mapEGAPixel[EGAmapping[((r)*PRIMARY_LEVELS+(g))*PRIMARY_LEVELS+(b)]]
/* X image for building dithered pixmap */
static XImage *ditherImage = NULL;
/***********************************************************************
* BRUSH_Init
*
* Create the X image used for dithering.
*/
BOOL32 BRUSH_Init(void)
{
XCREATEIMAGE( ditherImage, MATRIX_SIZE, MATRIX_SIZE, screenDepth );
return (ditherImage != NULL);
}
/***********************************************************************
* BRUSH_DitherColor
*/
Pixmap BRUSH_DitherColor( DC *dc, COLORREF color )
{
static COLORREF prevColor = 0xffffffff;
unsigned int x, y;
Pixmap pixmap;
if (color != prevColor)
{
int r = GetRValue( color ) * DITHER_LEVELS;
int g = GetGValue( color ) * DITHER_LEVELS;
int b = GetBValue( color ) * DITHER_LEVELS;
const int *pmatrix = dither_matrix;
for (y = 0; y < MATRIX_SIZE; y++)
{
for (x = 0; x < MATRIX_SIZE; x++)
{
int d = *pmatrix++ * 256;
int dr = ((r + d) / MATRIX_SIZE_2) / 256;
int dg = ((g + d) / MATRIX_SIZE_2) / 256;
int db = ((b + d) / MATRIX_SIZE_2) / 256;
XPutPixel( ditherImage, x, y, PIXEL_VALUE(dr,dg,db) );
}
}
prevColor = color;
}
pixmap = XCreatePixmap( display, rootWindow,
MATRIX_SIZE, MATRIX_SIZE, screenDepth );
XPutImage( display, pixmap, BITMAP_colorGC, ditherImage, 0, 0,
0, 0, MATRIX_SIZE, MATRIX_SIZE );
return pixmap;
}
/***********************************************************************
* CreateBrushIndirect16 (GDI.50)
@ -418,134 +294,3 @@ INT32 BRUSH_GetObject32( BRUSHOBJ * brush, INT32 count, LPSTR buffer )
}
/***********************************************************************
* BRUSH_SelectSolidBrush
*/
static void BRUSH_SelectSolidBrush( DC *dc, COLORREF color )
{
if ((dc->w.bitsPerPixel > 1) && (screenDepth <= 8) && !COLOR_IsSolid( color ))
{
/* Dithered brush */
dc->u.x.brush.pixmap = BRUSH_DitherColor( dc, color );
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0;
}
else
{
/* Solid brush */
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, color );
dc->u.x.brush.fillStyle = FillSolid;
}
}
/***********************************************************************
* BRUSH_SelectPatternBrush
*/
static BOOL32 BRUSH_SelectPatternBrush( DC * dc, HBITMAP32 hbitmap )
{
BITMAPOBJ * bmp = (BITMAPOBJ *) GDI_GetObjPtr( hbitmap, BITMAP_MAGIC );
if (!bmp) return FALSE;
dc->u.x.brush.pixmap = XCreatePixmap( display, rootWindow,
8, 8, bmp->bitmap.bmBitsPixel );
XCopyArea( display, bmp->pixmap, dc->u.x.brush.pixmap,
BITMAP_GC(bmp), 0, 0, 8, 8, 0, 0 );
if (bmp->bitmap.bmBitsPixel > 1)
{
dc->u.x.brush.fillStyle = FillTiled;
dc->u.x.brush.pixel = 0; /* Ignored */
}
else
{
dc->u.x.brush.fillStyle = FillOpaqueStippled;
dc->u.x.brush.pixel = -1; /* Special case (see DC_SetupGCForBrush) */
}
return TRUE;
}
/***********************************************************************
* BRUSH_SelectObject
*/
HBRUSH32 BRUSH_SelectObject( DC * dc, HBRUSH32 hbrush, BRUSHOBJ * brush )
{
HBITMAP16 hBitmap;
BITMAPINFO * bmpInfo;
HBRUSH16 prevHandle = dc->w.hBrush;
dprintf_gdi(stddeb, "Brush_SelectObject: hdc=%04x hbrush=%04x\n",
dc->hSelf,hbrush);
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
LOGBRUSH16 logbrush = { brush->logbrush.lbStyle,
brush->logbrush.lbColor,
brush->logbrush.lbHatch };
switch (brush->logbrush.lbStyle)
{
case BS_SOLID:
case BS_HATCHED:
case BS_HOLLOW:
if (!MF_CreateBrushIndirect( dc, hbrush, &logbrush )) return 0;
break;
case BS_PATTERN:
case BS_DIBPATTERN:
if (!MF_CreatePatternBrush( dc, hbrush, &logbrush )) return 0;
break;
}
return 1; /* FIXME? */
}
dc->w.hBrush = hbrush;
if (dc->u.x.brush.pixmap)
{
XFreePixmap( display, dc->u.x.brush.pixmap );
dc->u.x.brush.pixmap = 0;
}
dc->u.x.brush.style = brush->logbrush.lbStyle;
switch(brush->logbrush.lbStyle)
{
case BS_NULL:
dprintf_gdi( stddeb,"BS_NULL\n" );
break;
case BS_SOLID:
dprintf_gdi( stddeb,"BS_SOLID\n" );
BRUSH_SelectSolidBrush( dc, brush->logbrush.lbColor );
break;
case BS_HATCHED:
dprintf_gdi( stddeb, "BS_HATCHED\n" );
dc->u.x.brush.pixel = COLOR_ToPhysical( dc, brush->logbrush.lbColor );
dc->u.x.brush.pixmap = XCreateBitmapFromData( display, rootWindow,
HatchBrushes[brush->logbrush.lbHatch], 8, 8 );
dc->u.x.brush.fillStyle = FillStippled;
break;
case BS_PATTERN:
dprintf_gdi( stddeb, "BS_PATTERN\n");
BRUSH_SelectPatternBrush( dc, (HBRUSH16)brush->logbrush.lbHatch );
break;
case BS_DIBPATTERN:
dprintf_gdi( stddeb, "BS_DIBPATTERN\n");
if ((bmpInfo = (BITMAPINFO *) GlobalLock16( (HGLOBAL16)brush->logbrush.lbHatch )))
{
int size = DIB_BitmapInfoSize( bmpInfo, brush->logbrush.lbColor );
hBitmap = CreateDIBitmap32( dc->hSelf, &bmpInfo->bmiHeader,
CBM_INIT, ((char *)bmpInfo) + size,
bmpInfo,
(WORD)brush->logbrush.lbColor );
BRUSH_SelectPatternBrush( dc, hBitmap );
DeleteObject16( hBitmap );
GlobalUnlock16( (HGLOBAL16)brush->logbrush.lbHatch );
}
break;
}
return prevHandle;
}

View File

@ -432,6 +432,8 @@ HDC16 GetDCState( HDC16 hdc )
newdc->w.hClipRgn = CreateRectRgn32( 0, 0, 0, 0 );
CombineRgn32( newdc->w.hClipRgn, dc->w.hClipRgn, 0, RGN_COPY );
}
else
newdc->w.hClipRgn = 0;
return handle;
}

View File

@ -21,11 +21,8 @@
#include "stddebug.h"
#include "debug.h"
#define FONTCACHE 32 /* dynamic font cache size */
#define MAX_FONTS 256
static LPLOGFONT16 lpLogFontList[MAX_FONTS+1];
LPLOGFONT16 lpLogFontList[MAX_FONTS+1];
static int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz);
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
@ -54,238 +51,8 @@ static int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMax
#define CI_GET_DEFAULT_INFO(fs,cs) \
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
struct FontStructure {
char *window;
char *x11;
} FontNames[32];
int FontSize;
/***********************************************************************
* FONT_Init
*/
BOOL32 FONT_Init( void )
{
char temp[1024];
LPSTR ptr;
int i;
if (PROFILE_GetWineIniString( "fonts", NULL, "*", temp, sizeof(temp) ) > 2 )
{
for( ptr = temp, i = 1; strlen(ptr) != 0; ptr += strlen(ptr) + 1 )
if( strcmp( ptr, "default" ) )
FontNames[i++].window = xstrdup( ptr );
FontSize = i;
for( i = 1; i < FontSize; i++ )
{
PROFILE_GetWineIniString( "fonts", FontNames[i].window, "*",
temp, sizeof(temp) );
FontNames[i].x11 = xstrdup( temp );
}
PROFILE_GetWineIniString( "fonts", "default", "*", temp, sizeof(temp) );
FontNames[0].x11 = xstrdup( temp );
} else {
FontNames[0].window = NULL; FontNames[0].x11 = "*-helvetica";
FontNames[1].window = "ms sans serif"; FontNames[1].x11 = "*-helvetica";
FontNames[2].window = "ms serif"; FontNames[2].x11 = "*-times";
FontNames[3].window = "fixedsys"; FontNames[3].x11 = "*-fixed";
FontNames[4].window = "arial"; FontNames[4].x11 = "*-helvetica";
FontNames[5].window = "helv"; FontNames[5].x11 = "*-helvetica";
FontNames[6].window = "roman"; FontNames[6].x11 = "*-times";
FontNames[7].window = "system"; FontNames[7].x11 = "*-helvetica";
FontSize = 8;
}
return TRUE;
}
/***********************************************************************
* FONT_ChkX11Family
*
* returns a valid X11 equivalent if a Windows face name
* is like a X11 family - or NULL if translation is needed
*/
static char *FONT_ChkX11Family(char *winFaceName )
{
static char x11fam[32+2]; /* will be returned */
int i;
for(i = 0; lpLogFontList[i] != NULL; i++)
if( !lstrcmpi32A(winFaceName, lpLogFontList[i]->lfFaceName) )
{
strcpy(x11fam,"*-");
return strcat(x11fam,winFaceName);
}
return NULL; /* a FONT_TranslateName() call is needed */
}
/***********************************************************************
* FONT_TranslateName
*
* Translate a Windows face name to its X11 equivalent.
* This will probably have to be customizable.
*/
static const char *FONT_TranslateName( char *winFaceName )
{
int i;
for (i = 1; i < FontSize; i ++)
if( !lstrcmpi32A( winFaceName, FontNames[i].window ) ) {
dprintf_font(stddeb, "---- Mapped %s to %s\n", winFaceName, FontNames[i].x11 );
return FontNames[i].x11;
}
return FontNames[0].x11;
}
/***********************************************************************
* FONT_MatchFont
*
* Find a X font matching the logical font.
*/
static XFontStruct * FONT_MatchFont( LOGFONT16 * font, DC * dc )
{
char pattern[100];
const char *family, *weight, *charset;
char **names;
char slant, oldspacing, spacing;
int width, height, oldheight, count;
XFontStruct * fontStruct;
dprintf_font(stddeb,
"FONT_MatchFont(H,W = %d,%d; Weight = %d; Italic = %d; FaceName = '%s'\n",
font->lfHeight, font->lfWidth, font->lfWeight, font->lfItalic, font->lfFaceName);
weight = (font->lfWeight > 550) ? "bold" : "medium";
slant = font->lfItalic ? 'i' : 'r';
if (font->lfHeight == -1)
height = 0;
else
height = font->lfHeight * dc->vportExtX / dc->wndExtX;
if (height == 0) height = 120; /* Default height = 12 */
else if (height < 0)
{
/* If height is negative, it means the height of the characters */
/* *without* the internal leading. So we adjust it a bit to */
/* compensate. 5/4 seems to give good results for small fonts. */
/*
* J.M.: This causes wrong font size for bigger fonts e.g. in Winword & Write
height = 10 * (-height * 9 / 8);
* may be we have to use an non linear function
*/
/* assume internal leading is 2 pixels. Else small fonts will become
* very small. */
height = (height-2) * -10;
}
else height *= 10;
width = 10 * (font->lfWidth * dc->vportExtY / dc->wndExtY);
if (width < 0) {
dprintf_font( stddeb, "FONT_MatchFont: negative width %d(%d)\n",
width, font->lfWidth );
width = -width;
}
spacing = (font->lfPitchAndFamily & FIXED_PITCH) ? 'm' :
(font->lfPitchAndFamily & VARIABLE_PITCH) ? 'p' : '*';
charset = (font->lfCharSet == ANSI_CHARSET) ? "iso8859-1" : "*-*";
if (*font->lfFaceName) {
family = FONT_ChkX11Family(font->lfFaceName);
/*--do _not_ translate if lfFaceName is family from X11 A.K.*/
if (!family)
family = FONT_TranslateName( font->lfFaceName );
/* FIX ME: I don't if that's correct but it works J.M. */
spacing = '*';
}
else switch(font->lfPitchAndFamily & 0xf0)
{
case FF_ROMAN:
family = FONT_TranslateName( "roman" );
break;
case FF_SWISS:
family = FONT_TranslateName( "swiss" );
break;
case FF_MODERN:
family = FONT_TranslateName( "modern" );
break;
case FF_SCRIPT:
family = FONT_TranslateName( "script" );
break;
case FF_DECORATIVE:
family = FONT_TranslateName( "decorative" );
break;
default:
family = "*-*";
break;
}
sprintf( pattern, "-%s-%s-*-normal-*-*-*-*-*-*-*-%s",
family, weight, charset);
dprintf_font(stddeb, "FONT_MatchFont: '%s'\n", pattern );
names = XListFonts( display, pattern, 1, &count );
if (names) XFreeFontNames( names );
else
{
if (strcmp(family, "*-*") == 0)
{
fprintf(stderr, "FONT_MatchFont(%s) : returning NULL\n", pattern);
return NULL;
}
else family = "*-*";
}
oldheight = height;
oldspacing = spacing;
while (TRUE) {
/* Width==0 seems not to be a valid wildcard on SGI's, using * instead */
if ( width == 0 )
sprintf( pattern, "-%s-%s-%c-normal-*-*-%d-*-*-%c-*-%s",
family, weight, slant, height, spacing, charset);
else
sprintf( pattern, "-%s-%s-%c-normal-*-*-%d-*-*-%c-%d-%s",
family, weight, slant, height, spacing, width, charset);
dprintf_font(stddeb, "FONT_MatchFont: '%s'\n", pattern );
names = XListFonts( display, pattern, 1, &count );
if (count > 0) break;
if (spacing == 'm') /* try 'c' if no 'm' found */ {
spacing = 'c';
continue;
} else if (spacing == 'p') /* try '*' if no 'p' found */ {
spacing = '*';
continue;
}
spacing = oldspacing;
height -= 10;
if (height < 10) {
if (slant == 'i') {
/* try oblique if no italic font */
slant = 'o';
height = oldheight;
continue;
}
if (spacing == 'm' && strcmp(family, "*-*") != 0) {
/* If a fixed spacing font could not be found, ignore
* the family */
family = "*-*";
height = oldheight;
continue;
}
fprintf(stderr, "FONT_MatchFont(%s) : returning NULL\n", pattern);
return NULL;
}
}
dprintf_font(stddeb," Found '%s'\n", *names );
if (!*font->lfFaceName)
ParseFontParms(*names, 2, font->lfFaceName , LF_FACESIZE-1);
/* we need a font name for function GetTextFace() even if there isn't one ;-) */
fontStruct = XLoadQueryFont( display, *names );
XFreeFontNames( names );
return fontStruct;
}
/***********************************************************************
* FONT_LOGFONT32AToLOGFONT16
@ -604,165 +371,6 @@ INT32 FONT_GetObject32A( FONTOBJ *font, INT32 count, LPSTR buffer )
}
/***********************************************************************
* FONT_SelectObject
*/
HFONT16 FONT_SelectObject( DC * dc, HFONT16 hfont, FONTOBJ * font )
{
static X_PHYSFONT stockFonts[LAST_STOCK_FONT-FIRST_STOCK_FONT+1];
static struct {
HFONT16 id;
LOGFONT16 logfont;
int access;
int used;
X_PHYSFONT cacheFont; } cacheFonts[FONTCACHE], *cacheFontsMin;
int i;
X_PHYSFONT * stockPtr;
HFONT16 prevHandle = dc->w.hFont;
XFontStruct * fontStruct;
dprintf_font(stddeb,"FONT_SelectObject(%p, %04x, %p)\n", dc, hfont, font);
#if 0 /* From the code in SelectObject, this can not happen */
/* Load font if necessary */
if (!font)
{
HFONT16 hnewfont;
hnewfont = CreateFont16(10, 7, 0, 0, FW_DONTCARE,
FALSE, FALSE, FALSE, DEFAULT_CHARSET, 0, 0,
DEFAULT_QUALITY, FF_DONTCARE, "*" );
font = (FONTOBJ *) GDI_HEAP_LIN_ADDR( hnewfont );
}
#endif
if (dc->header.wMagic == METAFILE_DC_MAGIC)
if (MF_CreateFontIndirect(dc, hfont, &(font->logfont)))
return prevHandle;
else
return 0;
if ((hfont >= FIRST_STOCK_FONT) && (hfont <= LAST_STOCK_FONT))
stockPtr = &stockFonts[hfont - FIRST_STOCK_FONT];
else {
stockPtr = NULL;
/*
* Ok, It's not a stock font but
* may be it's cached in dynamic cache
*/
for(i=0; i<FONTCACHE; i++) /* search for same handle */
if (cacheFonts[i].id==hfont) { /* Got the handle */
/*
* Check if Handle matches the font
*/
if(memcmp(&cacheFonts[i].logfont,&(font->logfont), sizeof(LOGFONT16))) {
/* No: remove handle id from dynamic font cache */
cacheFonts[i].access=0;
cacheFonts[i].used=0;
cacheFonts[i].id=0;
/* may be there is an unused handle which contains the font */
for(i=0; i<FONTCACHE; i++) {
if((cacheFonts[i].used == 0) &&
(memcmp(&cacheFonts[i].logfont,&(font->logfont), sizeof(LOGFONT16)))== 0) {
/* got it load from cache and set new handle id */
stockPtr = &cacheFonts[i].cacheFont;
cacheFonts[i].access=1;
cacheFonts[i].used=1;
cacheFonts[i].id=hfont;
dprintf_font(stddeb,"FONT_SelectObject: got font from unused handle\n");
break;
}
}
}
else {
/* Yes: load from dynamic font cache */
stockPtr = &cacheFonts[i].cacheFont;
cacheFonts[i].access++;
cacheFonts[i].used++;
}
break;
}
}
if (!stockPtr || !stockPtr->fstruct)
{
if (!(fontStruct = FONT_MatchFont( &font->logfont, dc )))
{
/* If it is not a stock font, we can simply return 0 */
if (!stockPtr) return 0;
/* Otherwise we must try to find a substitute */
dprintf_font(stddeb,"Loading font 'fixed' for %04x\n", hfont );
font->logfont.lfPitchAndFamily &= ~VARIABLE_PITCH;
font->logfont.lfPitchAndFamily |= FIXED_PITCH;
fontStruct = XLoadQueryFont( display, "fixed" );
if (!fontStruct)
{
fprintf( stderr, "No system font could be found. Please check your font path.\n" );
exit( 1 );
}
}
}
else
{
fontStruct = stockPtr->fstruct;
dprintf_font(stddeb,
"FONT_SelectObject: Loaded font from cache %04x %p\n",
hfont, fontStruct );
}
/* Unuse previous font */
for (i=0; i < FONTCACHE; i++) {
if (cacheFonts[i].id == prevHandle) {
if(cacheFonts[i].used == 0)
fprintf(stderr, "Trying to decrement a use count of 0.\n");
else
cacheFonts[i].used--;
}
}
/* Store font */
dc->w.hFont = hfont;
if (stockPtr)
{
if (!stockPtr->fstruct)
{
stockPtr->fstruct = fontStruct;
FONT_GetMetrics( &font->logfont, fontStruct, &stockPtr->metrics );
}
memcpy( &dc->u.x.font, stockPtr, sizeof(*stockPtr) );
}
else
{
/*
* Check in cacheFont
*/
cacheFontsMin=NULL;
for (i=0; i < FONTCACHE; i++) {
if (cacheFonts[i].used==0)
if ((!cacheFontsMin) || ((cacheFontsMin) && (cacheFontsMin->access > cacheFonts[i].access)))
cacheFontsMin=&cacheFonts[i];
}
if (!cacheFontsMin) {
fprintf(stderr,"No unused font cache entry !!!!\n" );
return prevHandle;
}
if (cacheFontsMin->id!=0) {
dprintf_font(stddeb,
"FONT_SelectObject: Freeing %04x \n",cacheFontsMin->id );
XFreeFont( display, cacheFontsMin->cacheFont.fstruct );
}
cacheFontsMin->cacheFont.fstruct = fontStruct;
FONT_GetMetrics( &font->logfont, fontStruct, &cacheFontsMin->cacheFont.metrics );
cacheFontsMin->access=1;
cacheFontsMin->used=1;
cacheFontsMin->id=hfont;
memcpy( &dc->u.x.font, &(cacheFontsMin->cacheFont), sizeof(cacheFontsMin->cacheFont) );
memcpy(&cacheFontsMin->logfont,&(font->logfont), sizeof(LOGFONT16));
}
return prevHandle;
}
/***********************************************************************
@ -1277,7 +885,10 @@ BOOL32 GetCharWidth32W( HDC32 hdc, UINT32 firstChar, UINT32 lastChar,
*/
INT AddFontResource( LPCSTR str )
{
if (HIWORD(str))
fprintf( stdnimp, "STUB: AddFontResource('%s')\n", str );
else
fprintf( stdnimp, "STUB: AddFontResource(%04x)\n", LOWORD(str) );
return 1;
}
@ -1287,15 +898,17 @@ INT AddFontResource( LPCSTR str )
*/
BOOL RemoveFontResource( LPSTR str )
{
if (HIWORD(str))
fprintf( stdnimp, "STUB: RemoveFontResource('%s')\n", str );
else
fprintf( stdnimp, "STUB: RemoveFontResource(%04x)\n", LOWORD(str) );
return TRUE;
}
/*************************************************************************
* ParseFontParms [internal]
* FONT_ParseFontParms [internal]
*/
int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
int FONT_ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
{
int i;
if (lpFont == NULL) return 0;
@ -1318,6 +931,7 @@ int ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz)
}
/*************************************************************************
* InitFontsList [internal]
*/
@ -1362,11 +976,11 @@ void InitFontsList(void)
for (i = 0; i < count; i++) {
dprintf_font(stddeb,"InitFontsList // names[%d]='%s' \n", i, names[i]);
ParseFontParms(names[i], 2, str, sizeof(str));
FONT_ParseFontParms(names[i], 2, str, sizeof(str));
strcpy(lpNewFont->lfFaceName, str);
ParseFontParms(names[i], 8, str, sizeof(str));
FONT_ParseFontParms(names[i], 8, str, sizeof(str));
lpNewFont->lfHeight = atoi(str) / 10;
ParseFontParms(names[i], 12, str, sizeof(str));
FONT_ParseFontParms(names[i], 12, str, sizeof(str));
lpNewFont->lfWidth = atoi(str) / 10;
lpNewFont->lfEscapement = 0;
lpNewFont->lfOrientation = 0;
@ -1374,7 +988,7 @@ void InitFontsList(void)
lpNewFont->lfItalic = 0;
lpNewFont->lfUnderline = 0;
lpNewFont->lfStrikeOut = 0;
ParseFontParms(names[i], 13, str, sizeof(str));
FONT_ParseFontParms(names[i], 13, str, sizeof(str));
if (strcmp(str, "iso8859") == 0) {
lpNewFont->lfCharSet = ANSI_CHARSET;
} else {
@ -1383,7 +997,7 @@ void InitFontsList(void)
lpNewFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
lpNewFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lpNewFont->lfQuality = DEFAULT_QUALITY;
ParseFontParms(names[i], 11, str, sizeof(str));
FONT_ParseFontParms(names[i], 11, str, sizeof(str));
switch(str[0]) {
case 'p':
lpNewFont->lfPitchAndFamily = VARIABLE_PITCH | FF_SWISS;
@ -1570,6 +1184,7 @@ INT16 EnumFontFamiliesEx16(HDC16 hDC, LPLOGFONT16 lpLF, FONTENUMPROCEX16 lpEnumF
return nRet;
}
/*************************************************************************
* EnumFontFamiliesExA [GDI32.81]
* FIXME: Don't use 16 bit GDI heap functions (applies to EnumFontFamiliesEx32*)
@ -1755,3 +1370,4 @@ int GetKerningPairs(HDC16 hDC,int cPairs,LPKERNINGPAIR16 lpKerningPairs)
for (i = 0; i < cPairs; i++) lpKerningPairs[i].iKernAmount = 0;
return 0;
}

View File

@ -167,18 +167,6 @@ BOOL32 GDI_Init(void)
if (!(hpalette = COLOR_Init())) return FALSE;
StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *)GDI_HEAP_LIN_ADDR( hpalette );
/* Create default bitmap */
if (!BITMAP_Init()) return FALSE;
/* Initialize brush dithering */
if (!BRUSH_Init()) return FALSE;
/* Initialize fonts */
if (!FONT_Init()) return FALSE;
return TRUE;
}
@ -388,37 +376,10 @@ HGDIOBJ16 SelectObject16( HDC16 hdc, HGDIOBJ16 handle )
*/
HGDIOBJ32 SelectObject32( HDC32 hdc, HGDIOBJ32 handle )
{
GDIOBJHDR * ptr = NULL;
DC * dc;
DC * dc = DC_GetDCPtr( hdc );
if (!dc || !dc->funcs->pSelectObject) return 0;
dprintf_gdi(stddeb, "SelectObject: hdc=%04x %04x\n", hdc, handle );
if ((handle >= FIRST_STOCK_HANDLE) && (handle <= LAST_STOCK_HANDLE))
ptr = StockObjects[handle - FIRST_STOCK_HANDLE];
else
ptr = (GDIOBJHDR *) GDI_HEAP_LIN_ADDR( handle );
if (!ptr) return 0;
dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc)
{
dc = (DC *)GDI_GetObjPtr(hdc, METAFILE_DC_MAGIC);
if (!dc) return 0;
}
switch(ptr->wMagic)
{
case PEN_MAGIC:
return PEN_SelectObject( dc, handle, (PENOBJ *)ptr );
case BRUSH_MAGIC:
return BRUSH_SelectObject( dc, handle, (BRUSHOBJ *)ptr );
case BITMAP_MAGIC:
return BITMAP_SelectObject( dc, handle, (BITMAPOBJ *)ptr );
case FONT_MAGIC:
return FONT_SelectObject( dc, handle, (FONTOBJ *)ptr );
case REGION_MAGIC:
return (HGDIOBJ16)SelectClipRgn16( hdc, handle );
}
return 0;
return dc->funcs->pSelectObject( dc, handle );
}

View File

@ -262,9 +262,18 @@ BOOL PlayMetaFile(HDC16 hdc, HMETAFILE16 hmf)
HGLOBAL16 hHT;
int offset = 0;
WORD i;
HPEN32 hPen;
HBRUSH32 hBrush;
HFONT32 hFont;
DC *dc;
dprintf_metafile(stddeb,"PlayMetaFile(%04x %04x)\n",hdc,hmf);
if (!(dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC ))) return 0;
hPen = dc->w.hPen;
hBrush = dc->w.hBrush;
hFont = dc->w.hFont;
/* create the handle table */
hHT = GlobalAlloc16(GMEM_MOVEABLE|GMEM_ZEROINIT,
sizeof(HANDLETABLE16) * mh->mtNoObjects);
@ -281,6 +290,10 @@ BOOL PlayMetaFile(HDC16 hdc, HMETAFILE16 hmf)
PlayMetaFileRecord(hdc, ht, mr, mh->mtNoObjects);
}
SelectObject32(hdc, hBrush);
SelectObject32(hdc, hPen);
SelectObject32(hdc, hFont);
/* free objects in handle table */
for(i = 0; i < mh->mtNoObjects; i++)
if(*(ht->objectHandle + i) != 0)
@ -364,7 +377,7 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_SETBKCOLOR:
SetBkColor(hdc, *(mr->rdParam));
SetBkColor(hdc, MAKELONG(*(mr->rdParam), *(mr->rdParam + 1)));
break;
case META_SETBKMODE:
@ -429,7 +442,7 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_LINETO:
LineTo32(hdc, *(mr->rdParam + 1), *(mr->rdParam));
LineTo32(hdc, (INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_MOVETO:
@ -447,36 +460,38 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_ARC:
Arc32(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam + 5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
Arc32(hdc, (INT16)*(mr->rdParam + 7), (INT16)*(mr->rdParam + 6),
(INT16)*(mr->rdParam + 5), (INT16)*(mr->rdParam + 4),
(INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_ELLIPSE:
Ellipse32(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
Ellipse32(hdc, (INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_FLOODFILL:
FloodFill32(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
MAKELONG(*(mr->rdParam + 1), *(mr->rdParam)));
FloodFill32(hdc, (INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
MAKELONG(*(mr->rdParam), *(mr->rdParam + 1)));
break;
case META_PIE:
Pie32(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam + 5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
Pie32(hdc, (INT16)*(mr->rdParam + 7), (INT16)*(mr->rdParam + 6),
(INT16)*(mr->rdParam + 5), (INT16)*(mr->rdParam + 4),
(INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_RECTANGLE:
Rectangle32(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
Rectangle32(hdc, (INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_ROUNDRECT:
RoundRect32(hdc, *(mr->rdParam + 5), *(mr->rdParam + 4),
*(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
RoundRect32(hdc, (INT16)*(mr->rdParam + 5), (INT16)*(mr->rdParam + 4),
(INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_PATBLT:
@ -490,8 +505,8 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_SETPIXEL:
SetPixel32(hdc, *(mr->rdParam + 3), *(mr->rdParam + 2),
MAKELONG(*(mr->rdParam + 1), *(mr->rdParam)));
SetPixel32(hdc, (INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
MAKELONG(*(mr->rdParam), *(mr->rdParam + 1)));
break;
case META_OFFSETCLIPRGN:
@ -519,7 +534,7 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_RESTOREDC:
RestoreDC32(hdc, *(mr->rdParam));
RestoreDC32(hdc, (INT16)*(mr->rdParam));
break;
case META_SELECTOBJECT:
@ -527,9 +542,10 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
break;
case META_CHORD:
Chord32(hdc, *(mr->rdParam + 7), *(mr->rdParam + 6), *(mr->rdParam+5),
*(mr->rdParam + 4), *(mr->rdParam + 3), *(mr->rdParam + 2),
*(mr->rdParam + 1), *(mr->rdParam));
Chord32(hdc, (INT16)*(mr->rdParam + 7), (INT16)*(mr->rdParam + 6),
(INT16)*(mr->rdParam+5), (INT16)*(mr->rdParam + 4),
(INT16)*(mr->rdParam + 3), (INT16)*(mr->rdParam + 2),
(INT16)*(mr->rdParam + 1), (INT16)*(mr->rdParam));
break;
case META_CREATEPATTERNBRUSH:
@ -677,9 +693,9 @@ void PlayMetaFileRecord(HDC16 hdc, HANDLETABLE16 *ht, METARECORD *mr,
mr->rdParam[10]/*Planes*/,mr->rdParam[11]/*BitsPixel*/,
(LPSTR)&mr->rdParam[12]/*bits*/);
SelectObject32(hdcSrc,hbitmap);
BitBlt32(hdc,mr->rdParam[6],mr->rdParam[5],
mr->rdParam[4],mr->rdParam[3],
hdcSrc, mr->rdParam[2],mr->rdParam[1],
BitBlt32(hdc,(INT16)mr->rdParam[6],(INT16)mr->rdParam[5],
(INT16)mr->rdParam[4],(INT16)mr->rdParam[3],
hdcSrc, (INT16)mr->rdParam[2],(INT16)mr->rdParam[1],
MAKELONG(0,mr->rdParam[0]));
DeleteDC32(hdcSrc);
}
@ -771,7 +787,7 @@ static BOOL32 MF_WriteRecord( DC *dc, METARECORD *mr, WORD rlen)
return FALSE;
break;
default:
fprintf( stderr, "Uknown metafile type %d\n", physDev->mh->mtType );
fprintf( stderr, "Unknown metafile type %d\n", physDev->mh->mtType );
return FALSE;
}

View File

@ -12,10 +12,6 @@
#include "debug.h"
static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */
/***********************************************************************
* CreatePen16 (GDI.61)
@ -102,50 +98,3 @@ INT32 PEN_GetObject32( PENOBJ * pen, INT32 count, LPSTR buffer )
return count;
}
/***********************************************************************
* PEN_SelectObject
*/
HPEN32 PEN_SelectObject( DC * dc, HPEN32 hpen, PENOBJ * pen )
{
HPEN32 prevHandle = dc->w.hPen;
if (dc->header.wMagic == METAFILE_DC_MAGIC)
{
LOGPEN16 logpen = { pen->logpen.lopnStyle,
{ pen->logpen.lopnWidth.x,
pen->logpen.lopnWidth.y },
pen->logpen.lopnColor };
if (MF_CreatePenIndirect( dc, hpen, &logpen )) return prevHandle;
else return 0;
}
dc->w.hPen = hpen;
dc->u.x.pen.style = pen->logpen.lopnStyle;
dc->u.x.pen.width = pen->logpen.lopnWidth.x * dc->vportExtX / dc->wndExtX;
if (dc->u.x.pen.width < 0) dc->u.x.pen.width = -dc->u.x.pen.width;
if (dc->u.x.pen.width == 1) dc->u.x.pen.width = 0; /* Faster */
dc->u.x.pen.pixel = COLOR_ToPhysical( dc, pen->logpen.lopnColor );
switch(pen->logpen.lopnStyle)
{
case PS_DASH:
dc->u.x.pen.dashes = (char *)PEN_dash;
dc->u.x.pen.dash_len = 2;
break;
case PS_DOT:
dc->u.x.pen.dashes = (char *)PEN_dot;
dc->u.x.pen.dash_len = 2;
break;
case PS_DASHDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdot;
dc->u.x.pen.dash_len = 4;
break;
case PS_DASHDOTDOT:
dc->u.x.pen.dashes = (char *)PEN_dashdotdot;
dc->u.x.pen.dash_len = 6;
break;
}
return prevHandle;
}

View File

@ -1,3 +1,8 @@
Fri Jan 24 11:21:30 1997 Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>
* [Ko.rc] (new)
Added Korean language support.
Mon Jul 22 20:30:11 1996 Jussi Tirkkonen <jt@modeemi.cs.tut.fi>
* [Fi.rc] (new)

119
programs/progman/Ko.rc Normal file
View File

@ -0,0 +1,119 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
*/
#define LANGUAGE_ID Ko
#define LANGUAGE_NUMBER 6
#define LANGUAGE_MENU_ITEM "&Korean"
/* Menu */
#define MENU_FILE "파일(&F)"
#define MENU_FILE_NEW "새 파일(&N)..."
#define MENU_FILE_OPEN "열기(&P)\tEnter"
#define MENU_FILE_MOVE "이동(&M)...\tF7"
#define MENU_FILE_COPY "복사(&C)...\tF8"
#define MENU_FILE_DELETE "삭제(&D)\tEntf"
#define MENU_FILE_ATTRIBUTES "속성(&A)...\tAlt+Enter"
#define MENU_FILE_EXECUTE "실행(&E)..."
#define MENU_FILE_EXIT "윈도우 종료(&X)..."
#define MENU_OPTIONS "옵션(&O)"
#define MENU_OPTIONS_AUTO_ARRANGE "자동 정렬(&A)"
#define MENU_OPTIONS_MIN_ON_RUN "실행시 아이콘으로 됨(&M)"
#define MENU_OPTIONS_SAVE_SETTINGS "종료시 설정 내용 저장(&S)"
#define MENU_WINDOWS "창(&W)"
#define MENU_WINDOWS_OVERLAP "중첩(&O)\tShift+F5"
#define MENU_WINDOWS_SIDE_BY_SIDE "분할(&S)\tShift+F4"
#define MENU_WINDOWS_ARRANGE "아이콘 정렬(&A)"
#define MENU_LANGUAGE "언어(&L)"
#define MENU_HELP "도움말(&H)"
#define MENU_HELP_CONTENTS "목차(&C)"
#define MENU_HELP_SEARCH "찾기(&S)..."
#define MENU_HELP_HELP_ON_HELP "도움말 사용법(&H)"
#define MENU_HELP_TUTORIAL "자습서(&T)"
#define MENU_INFO "정보(&I)..."
#define MENU_INFO_LICENSE "라이센스(&L)"
#define MENU_INFO_NO_WARRANTY "무보증(&N)"
#define MENU_INFO_ABOUT_WINE "와인에 관하여(&A)"
/* Dialogs */
#define DIALOG_OK "확인"
#define DIALOG_CANCEL "취소"
#define DIALOG_BROWSE "검색(&B)"
#define DIALOG_HELP "도움말(&H)"
#define DIALOG_NEW_CAPTION "새 프로그램 개체"
#define DIALOG_NEW_NEW "새 개체"
#define DIALOG_NEW_GROUP "프로그램 그룹(&G)"
#define DIALOG_NEW_PROGRAM "프로그램(&P)"
#define DIALOG_MOVE_CAPTION "프로그램 이동"
#define DIALOG_MOVE_PROGRAM "프로그램 이동:"
#define DIALOG_MOVE_FROM_GROUP "이동 전:"
#define DIALOG_MOVE_TO_GROUP "이동 후(&T):"
#define DIALOG_COPY_CAPTION "프로그램 복사"
#define DIALOG_COPY_PROGRAM "프로그램 복사:"
#define DIALOG_COPY_FROM_GROUP DIALOG_MOVE_FROM_GROUP
#define DIALOG_COPY_TO_GROUP DIALOG_MOVE_TO_GROUP
#define DIALOG_GROUP_CAPTION "프로그램 그룹 속성"
#define DIALOG_GROUP_DESCRIPTION "설명(&D):"
#define DIALOG_GROUP_FILE "그룹 파일(&G):"
#define DIALOG_PROGRAM_CAPTION "프로그램 속성"
#define DIALOG_PROGRAM_DESCRIPTION DIALOG_GROUP_DESCRIPTION
#define DIALOG_PROGRAM_COMMAND_LINE "명령행(&C):"
#define DIALOG_PROGRAM_DIRECTORY "작업 디렉토리(&W):"
#define DIALOG_PROGRAM_HOT_KEY "키 조합(&K):"
#define DIALOG_PROGRAM_SYMBOL "아이콘으로(&S)"
#define DIALOG_PROGRAM_OTHER_SYMBOL "다른 아이콘(&O)..."
#define DIALOG_SYMBOL_CAPTION "아이콘 선택"
#define DIALOG_SYMBOL_FILE "파일명(&F):"
#define DIALOG_SYMBOL_CURRENT "현재 아이콘(&C):"
#define DIALOG_EXECUTE_CAPTION "프로그램 실행"
#define DIALOG_EXECUTE_COMMAND_LINE DIALOG_PROGRAM_COMMAND_LINE
#define DIALOG_EXECUTE_SYMBOL DIALOG_PROGRAM_SYMBOL
/* Strings */
#define STRING_PROGRAM_MANAGER "프로그램 관리자"
#define STRING_ERROR "오류"
#define STRING_WARNING "경고"
#define STRING_INFO "정보"
#define STRING_DELETE "삭제"
#define STRING_DELETE_GROUP_s "그룹 `%s'를 삭제할까요?"
#define STRING_DELETE_PROGRAM_s "프로그램 `%s'를 삭제할까요?"
#define STRING_NOT_IMPLEMENTED "구현되지 않았음"
#define STRING_FILE_READ_ERROR_s "`%s' 읽기 오류"
#define STRING_FILE_WRITE_ERROR_s "`%s' 쓰기 오류"
#define STRING_GRPFILE_READ_ERROR_s "\
그룹 파일 `%s'를 열 수 없습니다.\n\
한번 더 시도해 볼까요?"
#define STRING_OUT_OF_MEMORY "메모리 부족"
#define STRING_WINHELP_ERROR "도움말이 없습니다"
#define STRING_UNKNOWN_FEATURE_s "%s에 알 수 없는 기능이 있음"
#define STRING_FILE_NOT_OVERWRITTEN_s "파일 `%s'가 존재합니다. 덮어쓰지 않습니다."
#define STRING_SAVE_GROUP_AS_s "원래 파일을 덮어쓰는 것을 막기 위해 그룹을 `%s'로 저장합니다"
#define STRING_NO_HOT_KEY "없음"
#define STRING_ALL_FILES "모든 파일 (*.*)"
#define STRING_PROGRAMS "프로그램"
#define STRING_LIBRARIES_DLL "라이브러리 (*.dll)"
#define STRING_SYMBOL_FILES "아이콘 파일"
#define STRING_SYMBOLS_ICO "아이콘 (*.ico)"
#include "Xx.rc"

View File

@ -8,7 +8,7 @@ ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
DEFS = -I$(SRCDIR)
RCFLAGS = -w32
LANGUAGES = En De Fr Fi
LANGUAGES = En De Fr Fi Ko
LICENSELANG = En
# Installation infos

View File

@ -1,3 +1,8 @@
Fri Jan 24 11:27:37 1997 Bang Jun-Young <bangjy@nownuri.nowcom.co.kr>
* [Ko.rc] (new)
Added Korean language support.
Mon Jul 22 20:30:11 1996 Jussi Tirkkonen <jt@modeemi.cs.tut.fi>
* [Fi.rc] (new)

48
programs/winhelp/Ko.rc Normal file
View File

@ -0,0 +1,48 @@
/*
* Help Viewer
*
* Copyright 1996 Ulrich Schmid
*/
/* This file is not yet complete !! */
#define LANGUAGE_ID Ko
#define LANGUAGE_NUMBER 6
/* Menu */
#define MENU_FILE "파일(&F)"
#define MENU_FILE_OPEN "열기(&O)..."
#define MENU_FILE_PRINT "인쇄(&P)"
#define MENU_FILE_PRINTER_SETUP "프린터 설정(&S)..."
#define MENU_FILE_EXIT "종료(&E)"
#define MENU_EDIT "편집(&E)"
#define MENU_EDIT_COPY_DIALOG "복사(&C)..."
#define MENU_EDIT_ANNOTATE "주석(&A)..."
#define MENU_BOOKMARK "책갈피(&B)"
#define MENU_BOOKMARK_DEFINE "정의(&D)..."
#define MENU_HELP "도움말(&H)"
#define MENU_HELP_ON_HELP "도움말 사용법(&O)"
#define MENU_HELP_ON_TOP "항상 위(&T)"
#define MENU_HELP_INFO "정보(&I)..."
#define MENU_HELP_ABOUT_WINE "와인에 관하여(&A)"
/* Strings */
#define STRING_WINE_HELP "와인 도움말"
#define STRING_ERROR "오류"
#define STRING_WARNING "경고"
#define STRING_INFO "정보"
#define STRING_NOT_IMPLEMENTED "구현되지 않았음"
#define STRING_HLPFILE_ERROR_s "도움말 파일 `%s'를 읽는 도중 오류 발생"
#define STRING_CONTENTS "목차(&C)"
#define STRING_SEARCH "찾기(&S)"
#define STRING_BACK "뒤로(&B)"
#define STRING_HISTORY "히스토리(&H)"
#define STRING_ALL_FILES "모든 파일 (*.*)"
#define STRING_HELP_FILES_HLP "도움말 파일 (*.hlp)"
#include "Xx.rc"

View File

@ -7,7 +7,7 @@ PROGRAMS = winhelp hlp2sgml
ALL_LIBS = $(WINELIB) $(X_LIBS) $(XPM_LIB) $(XLIB) $(LDLIBS)
RCFLAGS = -w32
LANGUAGES = En De Fr Fi
LANGUAGES = En De Fr Fi Ko
# Installation infos

View File

@ -17,14 +17,14 @@ EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
POPUP ""
BEGIN
MENUITEM "&Undo", EM_UNDO32
MENUITEM "&Annulla", EM_UNDO32
MENUITEM SEPARATOR
MENUITEM "Cu&t", WM_CUT
MENUITEM "&Copy", WM_COPY
MENUITEM "&Paste", WM_PASTE
MENUITEM "&Delete", WM_CLEAR
MENUITEM "&Taglia", WM_CUT
MENUITEM "&Copia", WM_COPY
MENUITEM "&Incolla", WM_PASTE
MENUITEM "&Elimina", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Select &All", EM_SETSEL32
MENUITEM "Sele&ziona tutto", EM_SETSEL32
END
}
@ -91,7 +91,7 @@ FONT 8, "Helv"
LTEXT "&Unita':", 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 "Salva come", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annulla", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
}

View File

@ -3,8 +3,8 @@ SYSMENU MENU LOADONCALL MOVEABLE DISCARDABLE
MENUITEM "복귀(&R)", 61728
MENUITEM "이동(&M)", 61456
MENUITEM "크기 변경(&S)", 61440
MENUITEM "축소(&N)", 61472
MENUITEM "확대(&M)", 61488
MENUITEM "아이콘 표시(&N)", 61472
MENUITEM "전체 화면 표시(&M)", 61488
MENUITEM SEPARATOR
MENUITEM "닫기(&C)\tAlt-F4", 61536
MENUITEM SEPARATOR
@ -17,14 +17,14 @@ EDITMENU MENU LOADONCALL MOVEABLE DISCARDABLE
{
POPUP ""
BEGIN
MENUITEM "&Undo", EM_UNDO32
MENUITEM "실행 취소(&U)", EM_UNDO32
MENUITEM SEPARATOR
MENUITEM "Cu&t", WM_CUT
MENUITEM "&Copy", WM_COPY
MENUITEM "&Paste", WM_PASTE
MENUITEM "&Delete", WM_CLEAR
MENUITEM "잘라내기(&T)", WM_CUT
MENUITEM "복사(&C)", WM_COPY
MENUITEM "붙여넣기(&P)", WM_PASTE
MENUITEM "삭제(&D)", WM_CLEAR
MENUITEM SEPARATOR
MENUITEM "Select &All", EM_SETSEL32
MENUITEM "전체 선택(&A)", EM_SETSEL32
END
}
@ -33,7 +33,7 @@ STYLE DS_SYSMODAL | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSM
BEGIN
ICON "", 1088, 8, 20, 16, 16, WS_CHILD | WS_VISIBLE
LTEXT "", 100, 32, 4, 176, 48, WS_CHILD | WS_VISIBLE | WS_GROUP
PUSHBUTTON "인(&O)", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "인(&O)", 1, 16, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "취소(&C)", 2, 64, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "중단(&A)", 3, 112, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
PUSHBUTTON "재시도(&R)", 4, 160, 56, 40, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP
@ -47,7 +47,7 @@ STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYS
CAPTION "%s에 관하여"
FONT 10, "System"
{
DEFPUSHBUTTON "인", 1, 91, 250, 40, 14
DEFPUSHBUTTON "인", 1, 91, 250, 40, 14
CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 210
LTEXT "Text", 100, 11, 40, 200, 200, SS_NOPREFIX | WS_GROUP
ICON "", 1088, 195, 10, 18, 20
@ -131,7 +131,7 @@ FONT 8, "Helv"
LTEXT "[없음]", 1088, 35, 35, 120, 9
RADIOBUTTON "지정된 인쇄기(&P)", 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 "인", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "인", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "취소", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "설정(&S)", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
GROUPBOX "방향", 1073, 6, 85, 100, 50, BS_GROUPBOX
@ -154,7 +154,7 @@ FONT 8, "Helv"
{
LTEXT "글자체:", 1088, 6, 6, 40, 9
LTEXT "", 1089, 60, 6, 150, 9
DEFPUSHBUTTON "인", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "인", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "취소", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
}
@ -184,7 +184,7 @@ FONT 8, "Helv"
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "인", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "인", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "취소", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "도움말", 1038,100,166, 44, 14
PUSHBUTTON "사용자색에 추가(&A)", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP

View File

@ -5,6 +5,7 @@
*/
#include <assert.h>
#include <stdio.h>
#include "thread.h"
#include "winerror.h"
#include "heap.h"
@ -13,11 +14,31 @@
THDB *pCurrentThread = NULL;
/***********************************************************************
* THREAD_GetPtr
*
* Return a pointer to a thread object. The object count must be decremented
* when no longer used.
*/
static THDB *THREAD_GetPtr( HANDLE32 handle )
{
THDB *thread;
if (handle == 0xfffffffe) /* Self-thread handle */
{
thread = (THDB *)GetCurrentThreadId();
K32OBJ_IncCount( &thread->header );
}
else thread = (THDB *)PROCESS_GetObjPtr( handle, K32OBJ_THREAD );
return thread;
}
/***********************************************************************
* THREAD_Create
*/
THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size )
THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size,
LPTHREAD_START_ROUTINE start_addr )
{
THDB *thdb = HeapAlloc( SystemHeap, HEAP_ZERO_MEMORY, sizeof(THDB) );
if (!thdb) return NULL;
@ -49,6 +70,19 @@ THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size )
thdb->teb_sel = SELECTOR_AllocBlock( &thdb->teb, 0x1000, SEGMENT_DATA,
TRUE, FALSE );
if (!thdb->teb_sel) goto error;
/* Initialize the thread context */
thdb->pcontext = &thdb->context;
thdb->context.SegCs = WINE_CODE_SELECTOR;
thdb->context.SegDs = WINE_DATA_SELECTOR;
thdb->context.SegEs = WINE_DATA_SELECTOR;
thdb->context.SegFs = thdb->teb_sel;
thdb->context.SegGs = WINE_DATA_SELECTOR;
thdb->context.SegSs = WINE_DATA_SELECTOR;
thdb->context.Eip = (DWORD)start_addr;
thdb->context.Esp = (DWORD)thdb->teb.stack_top;
return thdb;
error:
@ -72,6 +106,30 @@ void THREAD_Destroy( K32OBJ *ptr )
}
/***********************************************************************
* CreateThread (KERNEL32.63)
*
* The only thing missing here is actually getting the thread to run ;-)
*/
HANDLE32 CreateThread( LPSECURITY_ATTRIBUTES attribs, DWORD stack,
LPTHREAD_START_ROUTINE start, LPVOID param,
DWORD flags, LPDWORD id )
{
HANDLE32 handle;
THDB *thread = THREAD_Create( pCurrentProcess, stack, start );
if (!thread) return INVALID_HANDLE_VALUE32;
handle = PROCESS_AllocHandle( &thread->header, 0 );
if (handle == INVALID_HANDLE_VALUE32)
{
THREAD_Destroy( &thread->header );
return INVALID_HANDLE_VALUE32;
}
*id = (DWORD)thread;
fprintf( stderr, "CreateThread: stub\n" );
return handle;
}
/***********************************************************************
* GetCurrentThread (KERNEL32.200)
*/
@ -219,7 +277,11 @@ BOOL32 TlsSetValue( DWORD index, LPVOID value )
*/
BOOL32 GetThreadContext( HANDLE32 handle, CONTEXT *context )
{
return FALSE;
THDB *thread = (THDB*)PROCESS_GetObjPtr( handle, K32OBJ_THREAD );
if (!thread) return FALSE;
*context = thread->context;
K32OBJ_DecCount( &thread->header );
return TRUE;
}
@ -231,34 +293,31 @@ void NtCurrentTeb( CONTEXT *context )
EAX_reg(context) = GetSelectorBase( FS_reg(context) );
}
/**********************************************************************
* GetThreadPriority (KERNEL32.296)
*/
INT32
GetThreadPriority(HANDLE32 hthread) {
INT32 GetThreadPriority(HANDLE32 hthread)
{
THDB *thread;
INT32 ret;
ret = 0;
thread = (THDB*)PROCESS_GetObjPtr(hthread,K32OBJ_THREAD);
if (thread) {
if (!(thread = THREAD_GetPtr( hthread ))) return 0;
ret = thread->delta_priority;
K32OBJ_DecCount((K32OBJ*)thread);
}
K32OBJ_DecCount( &thread->header );
return ret;
}
/**********************************************************************
* SetThreadPriority (KERNEL32.514)
*/
BOOL32
SetThreadPriority(HANDLE32 hthread,INT32 priority) {
BOOL32 SetThreadPriority(HANDLE32 hthread,INT32 priority)
{
THDB *thread;
thread = (THDB*)PROCESS_GetObjPtr(hthread,K32OBJ_THREAD);
if (thread) {
if (!(thread = THREAD_GetPtr( hthread ))) return FALSE;
thread->delta_priority = priority;
K32OBJ_DecCount((K32OBJ*)thread);
}
K32OBJ_DecCount( &thread->header );
return TRUE;
}

View File

@ -26,6 +26,12 @@
# define PREFIX
#endif
#if defined(__GNUC__) && !defined(__svr4__)
# define USE_STABS
#else
# undef USE_STABS
#endif
typedef enum
{
TYPE_INVALID,
@ -980,7 +986,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "/* File generated automatically; do not edit! */\n" );
fprintf( outfile, "\t.file\t\"%s\"\n", specfile );
#ifdef __GNUC__
#ifdef USE_STABS
getcwd(buffer, sizeof(buffer));
/*
@ -1008,14 +1014,14 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
case TYPE_STUB:
case TYPE_REGISTER:
fprintf( outfile, "/* %s.%d (%s) */\n", DLLName, i, odp->name);
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"%s_%d:F1\",36,0,%d,%s_%d\n",
DLLName, i,
odp->lineno, DLLName, i);
#endif
fprintf( outfile, "%s_%d:\n", DLLName, i );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabn 68,0,%d,0\n", odp->lineno);
#endif
@ -1138,7 +1144,7 @@ static int BuildSpec32File( char * specfile, FILE *outfile )
fprintf( outfile, "\t.long Code_Start\n" ); /* Code start */
fprintf( outfile, "\t.long Functions\n" ); /* Functions */
fprintf( outfile, "\t.long FuncNames\n" ); /* Function names */
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");
@ -1324,7 +1330,7 @@ static void BuildCall32LargeStack( FILE *outfile )
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallTo32_LargeStack:F1\",36,0,0," PREFIX "CallTo32_LargeStack\n");
#endif
fprintf( outfile, "\t.globl " PREFIX "CallTo32_LargeStack\n" );
@ -1603,7 +1609,7 @@ static void BuildCallFrom16Func( FILE *outfile, char *profile )
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallFrom16_%s:F1\",36,0,0," PREFIX "CallFrom16_%s\n",
profile, profile);
#endif
@ -1822,7 +1828,7 @@ static void BuildCallTo16Func( FILE *outfile, char *profile )
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallTo16_%s:F1\",36,0,0," PREFIX "CallTo16_%s\n",
profile, profile);
#endif
@ -2067,7 +2073,8 @@ static void BuildContext32( FILE *outfile )
/*******************************************************************
* RestoreContext32
*
* Restore the registers from the context structure
* Restore the registers from the context structure.
* All registers except %cs and %ss are restored.
*/
static void RestoreContext32( FILE *outfile )
{
@ -2076,15 +2083,23 @@ static void RestoreContext32( FILE *outfile )
fprintf( outfile, "\tleal %d(%%ebp),%%esp\n", -sizeof(CONTEXT)-8 );
fprintf( outfile, "\tfrstor %d(%%esp)\n", CONTEXTOFFSET(FloatSave) );
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Eip) );
fprintf( outfile, "\tmovl %%eax,4(%%ebp)\n" ); /* %eip at time of call */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Ebp) );
fprintf( outfile, "\tmovl %%eax,0(%%ebp)\n" ); /* %ebp at time of call */
/* Store flags over the relay addr */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(EFlags) );
fprintf( outfile, "\tmovl %%eax,%d(%%esp)\n", sizeof(CONTEXT) );
/* Get the new stack addr */
fprintf( outfile, "\tmovl %d(%%esp),%%ebx\n", CONTEXTOFFSET(Esp) );
/* Set eip and ebp value onto the new stack */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Eip) );
fprintf( outfile, "\tmovl %%eax,-4(%%ebx)\n" ); /* %eip at time of call */
fprintf( outfile, "\tmovl %d(%%esp),%%eax\n", CONTEXTOFFSET(Ebp) );
fprintf( outfile, "\tmovl %%eax,-8(%%ebx)\n" ); /* %ebp at time of call */
/* Set ebp to point to the new stack */
fprintf( outfile, "\tleal -8(%%ebx),%%ebp\n" );
/* Restore all registers */
fprintf( outfile, "\taddl $%d,%%esp\n",
sizeof(FLOATING_SAVE_AREA) + 7 * sizeof(DWORD) );
fprintf( outfile, "\tpopl %%eax\n" );
@ -2153,7 +2168,7 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile )
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallFrom32_%s:F1\",36,0,0," PREFIX "CallFrom32_%s\n",
profile, profile);
#endif
@ -2182,11 +2197,17 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile )
fprintf( outfile, "\tpushl %%eax\n" );
}
/* Set %es = %ds */
fprintf( outfile, "\tmovw %%ds,%%ax\n" );
fprintf( outfile, "\tmovw %%ax,%%es\n" );
/* Print the debugging info */
if (debugging)
{
fprintf( outfile, "\tpushl $%d\n", reg_func ? -1 : args); /* Nb args */
fprintf( outfile, "\tpushl $%d\n", /* Nb args */
reg_func ? args | 0x80000000 : args);
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom32\n" );
fprintf( outfile, "\tadd $8, %%esp\n" );
@ -2194,8 +2215,6 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile )
/* Call the function */
fprintf( outfile, "\tpushw %%ds\n" );
fprintf( outfile, "\tpopw %%es\n" ); /* Set %es = %ds */
fprintf( outfile, "\tcall -4(%%ebp)\n" );
/* Print the debugging info */
@ -2203,7 +2222,8 @@ static void BuildCallFrom32Func( FILE *outfile, const char *profile )
if (debugging)
{
fprintf( outfile, "\tpushl %%eax\n" );
fprintf( outfile, "\tpushl $%d\n", reg_func ? -1 : args); /* Nb args */
fprintf( outfile, "\tpushl $%d\n", /* Nb args */
reg_func ? args | 0x80000000 : args);
fprintf( outfile, "\tpushl %%ebp\n" );
fprintf( outfile, "\tcall " PREFIX "RELAY_DebugCallFrom32Ret\n" );
fprintf( outfile, "\tpopl %%eax\n" );
@ -2244,7 +2264,7 @@ static void BuildCallTo32Func( FILE *outfile, int args )
/* Function header */
fprintf( outfile, "\n\t.align 4\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, ".stabs \"CallTo32_%d:F1\",36,0,0," PREFIX "CallTo32_%d\n",
args, args);
#endif
@ -2316,7 +2336,7 @@ static int BuildCallFrom16( FILE *outfile, char * outname, int argc, char *argv[
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.file\t\"%s\"\n", outname );
getcwd(buffer, sizeof(buffer));
@ -2351,7 +2371,7 @@ static int BuildCallFrom16( FILE *outfile, char * outname, int argc, char *argv[
}
}
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");
@ -2376,7 +2396,7 @@ static int BuildCallTo16( FILE *outfile, char * outname, int argc, char *argv[]
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.file\t\"%s\"\n", outname );
getcwd(buffer, sizeof(buffer));
@ -2405,7 +2425,7 @@ static int BuildCallTo16( FILE *outfile, char * outname, int argc, char *argv[]
fprintf( outfile, "\t.globl " PREFIX "CALLTO16_End\n" );
fprintf( outfile, PREFIX "CALLTO16_End:\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");
@ -2430,7 +2450,7 @@ static int BuildCallFrom32( FILE *outfile, char * outname, int argc, char *argv[
fprintf( outfile, "/* File generated automatically. Do not edit! */\n\n" );
fprintf( outfile, "\t.text\n" );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.file\t\"%s\"\n", outname );
getcwd(buffer, sizeof(buffer));
@ -2449,7 +2469,7 @@ static int BuildCallFrom32( FILE *outfile, char * outname, int argc, char *argv[
for (i = 2; i < argc; i++) BuildCallFrom32Func( outfile, argv[i] );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");
@ -2481,7 +2501,7 @@ static int BuildCallTo32( FILE *outfile, char * outname,
* names as an indication that we should just step through it to whatever
* is on the other side.
*/
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.file\t\"%s\"\n", outname );
getcwd(buffer, sizeof(buffer));
@ -2500,7 +2520,7 @@ static int BuildCallTo32( FILE *outfile, char * outname,
for (i = 2; i < argc; i++) BuildCallTo32Func( outfile, atoi(argv[i]) );
#ifdef __GNUC__
#ifdef USE_STABS
fprintf( outfile, "\t.text\n");
fprintf( outfile, "\t.stabs \"\",100,0,0,.Letext\n");
fprintf( outfile, ".Letext:\n");

View File

@ -109,3 +109,20 @@ DWORD ErrnoToLastError(int errno_num)
return rc;
}
int LastErrorToErrno(DWORD lasterror)
{
int rc = 0; /* no error */
int i = 0;
while(errno_xlat_table[i].errno != -1)
{
if(errno_xlat_table[i].win32err == lasterror )
{
rc = errno_xlat_table[i].errno;
break;
}
i++;
}
return rc;
}

View File

@ -30,35 +30,31 @@
* information in UnhandledExceptionFilter.
*
*/
#ifndef WINELIB
#include <assert.h>
#include <stdio.h>
#include "windows.h"
#include "winerror.h"
#include "ldt.h"
#include "process.h"
#include "thread.h"
#include "stddebug.h"
#include "debug.h"
#include "except.h"
LPTOP_LEVEL_EXCEPTION_FILTER pTopExcHandler = NULL;
#define TEB_EXCEPTION_FRAME(pcontext) \
((PEXCEPTION_FRAME)((TEB *)GET_SEL_BASE((pcontext)->SegFs))->except)
void EXC_Init(void)
{
pTopExcHandler = (LPTOP_LEVEL_EXCEPTION_FILTER)GetProcAddress32(
GetModuleHandle("KERNEL32"),
"UnhandledExceptionFilter" );
}
/*
* EXC_RtlUnwind
/*******************************************************************
* RtlUnwind (KERNEL32.443)
*
* This function is undocumented. This is the general idea of
* RtlUnwind, though. Note that error handling is not yet implemented
*
* RtlUnwind, though. Note that error handling is not yet implemented.
*/
void EXC_RtlUnwind(PEXCEPTION_FRAME pEndFrame,LPVOID unusedEip,
void RtlUnwind( PEXCEPTION_FRAME pEndFrame, LPVOID unusedEip,
PEXCEPTION_RECORD pRecord, DWORD returnEax,
PCONTEXT pcontext)
PCONTEXT pcontext /* Wine additional parameter */ )
{
EXCEPTION_RECORD record;
DWORD dispatch;
@ -69,12 +65,12 @@ void EXC_RtlUnwind(PEXCEPTION_FRAME pEndFrame,LPVOID unusedEip,
/* build an exception record, if we do not have one */
if(!pRecord)
{
record.ExceptionCode= 0xC0000026; /* invalid disposition */
record.ExceptionFlags= 0;
record.ExceptionRecord= NULL;
record.ExceptionAddress=(LPVOID) pcontext->Eip;
record.NumberParameters= 0;
pRecord=&record;
record.ExceptionCode = STATUS_INVALID_DISPOSITION;
record.ExceptionFlags = 0;
record.ExceptionRecord = NULL;
record.ExceptionAddress = (LPVOID)pcontext->Eip;
record.NumberParameters = 0;
pRecord = &record;
}
if(pEndFrame)
@ -83,39 +79,39 @@ void EXC_RtlUnwind(PEXCEPTION_FRAME pEndFrame,LPVOID unusedEip,
pRecord->ExceptionFlags|=EH_UNWINDING | EH_EXIT_UNWIND;
/* get chain of exception frames */
while((TebExceptionFrame!=NULL)&&
(TebExceptionFrame!=((void *)-1)) &&
(TebExceptionFrame!=pEndFrame))
while ((TEB_EXCEPTION_FRAME(pcontext) != NULL) &&
(TEB_EXCEPTION_FRAME(pcontext) != ((void *)0xffffffff)) &&
(TEB_EXCEPTION_FRAME(pcontext) != pEndFrame))
{
dprintf_win32(stddeb,"calling exception handler at 0x%x\n",
(int) TebExceptionFrame->Handler);
dprintf_win32( stddeb, "calling exception handler at 0x%x\n",
(int)TEB_EXCEPTION_FRAME(pcontext)->Handler );
dispatch=0;
retval=TebExceptionFrame->Handler(pRecord, TebExceptionFrame,
retval = TEB_EXCEPTION_FRAME(pcontext)->Handler( pRecord,
TEB_EXCEPTION_FRAME(pcontext),
pcontext, &dispatch);
dprintf_win32(stddeb,"exception handler returns 0x%x, dispatch=0x%x\n",
retval, (int) dispatch);
if(retval==ExceptionCollidedUnwind)
TebExceptionFrame=(LPVOID) dispatch;
else if(TebExceptionFrame!=pEndFrame)
TebExceptionFrame=TebExceptionFrame->Prev;
if (retval == ExceptionCollidedUnwind)
TEB_EXCEPTION_FRAME(pcontext) = (LPVOID)dispatch;
else if (TEB_EXCEPTION_FRAME(pcontext) != pEndFrame)
TEB_EXCEPTION_FRAME(pcontext) = TEB_EXCEPTION_FRAME(pcontext)->Prev;
else
break;
}
}
/*
* EXC_RaiseException
*
*/
VOID EXC_RaiseException(DWORD dwExceptionCode,
/*******************************************************************
* RaiseException (KERNEL32.418)
*/
void RaiseException(DWORD dwExceptionCode,
DWORD dwExceptionFlags,
DWORD cArguments,
const LPDWORD lpArguments,
PCONTEXT pcontext)
PCONTEXT pcontext /* Wine additional parameter */ )
{
PEXCEPTION_FRAME pframe;
EXCEPTION_RECORD record;
@ -131,13 +127,13 @@ VOID EXC_RaiseException(DWORD dwExceptionCode,
record.NumberParameters = cArguments;
record.ExceptionAddress = (LPVOID) pcontext->Eip;
for(i=0;i<cArguments;i++)
record.ExceptionInformation[i]=lpArguments[i];
if (lpArguments) for( i = 0; i < cArguments; i++)
record.ExceptionInformation[i] = lpArguments[i];
/* get chain of exception frames */
retval=ExceptionContinueSearch;
pframe=TebExceptionFrame;
retval = ExceptionContinueSearch;
pframe = TEB_EXCEPTION_FRAME( pcontext );
while((pframe!=NULL)&&(pframe!=((void *)0xFFFFFFFF)))
{
@ -154,62 +150,47 @@ VOID EXC_RaiseException(DWORD dwExceptionCode,
pframe=pframe->Prev;
}
if(retval!=ExceptionContinueExecution)
if (retval!=ExceptionContinueExecution)
{
retval=EXC_CallUnhandledExceptionFilter(&record,pcontext);
if(retval!=EXCEPTION_CONTINUE_EXECUTION)
{
dprintf_win32(stddeb,"no handler wanted to handle "
"the exception, exiting\n" );
/* FIXME: what should we do here? */
dprintf_win32(stddeb,"no handler wanted to handle the exception, exiting\n");
ExitProcess(dwExceptionCode); /* what status should be used here ? */
}
}
}
/*******************************************************************
* UnhandledExceptionFilter (KERNEL32.537)
*
* This is the unhandled exception code.
* Actually, this should show up a dialog box, with all kinds of
* fancy debugging information. It does nothing now!
*/
DWORD UnhandledExceptionFilter(PEXCEPTION_POINTERS epointers)
{
PEXCEPTION_RECORD pRecord;
PCONTEXT pContext;
char message[80];
pRecord=epointers->ExceptionRecord;
pContext=epointers->ContextRecord;
/* FIXME: Should check if the process is being debugged */
if(pRecord->ExceptionFlags & (EH_UNWINDING | EH_EXIT_UNWIND) )
if (pCurrentProcess && pCurrentProcess->top_filter)
{
dprintf_win32(stddeb,"UnhandledExceptionFilter: exiting\n");
ExitProcess(pRecord->ExceptionCode);
}
else
{
RtlUnwind(0,pRecord,0,-1 );
DWORD ret = pCurrentProcess->top_filter( epointers );
if (ret != EXCEPTION_CONTINUE_SEARCH) return ret;
}
/*
* This is just to avoid a warning, code should not get here
* if it does, EXC_RaiseException will terminate it.
*/
return EXCEPTION_CONTINUE_SEARCH;
/* FIXME: Should check the current error mode */
sprintf( message, "Unhandled exception 0x%08lx at address 0x%08lx.",
epointers->ExceptionRecord->ExceptionCode,
(DWORD)epointers->ExceptionRecord->ExceptionAddress );
MessageBox32A( 0, message, "Error", MB_OK | MB_ICONHAND );
return EXCEPTION_EXECUTE_HANDLER;
}
/*************************************************************
* SetUnhandledExceptionFilter (KERNEL32.516)
*
*
*/
LPTOP_LEVEL_EXCEPTION_FILTER
SetUnhandledExceptionFilter(LPTOP_LEVEL_EXCEPTION_FILTER efilter)
LPTOP_LEVEL_EXCEPTION_FILTER SetUnhandledExceptionFilter(
LPTOP_LEVEL_EXCEPTION_FILTER filter )
{
pTopExcHandler=efilter;
return efilter;
LPTOP_LEVEL_EXCEPTION_FILTER old = pCurrentProcess->top_filter;
pCurrentProcess->top_filter = filter;
return old;
}
#endif /* WINELIB */

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