Release 970616

Sat Jun 14 13:05:23 1997  Andreas Mohr <100.30936@germany.net>

	* [include/mmsystem.h]
	Avoided infinite loop in audio code when accessing
 	WAVEOUTCAPS/WAVEINCAPS/MIDIOUTCAPS/AUXCAPS with rigid variable
 	offsets (I applied WINE_PACKED).

	* [*/*]
	Added "WARNING:" and "ERROR:" to some printf's.
	Just grep for them with '-debugmsg +all'.

	* [multimedia/audio.c] [multimedia/mmsystem.c]
	Implemented wave callbacks: window and function callback.
	Fixed problem with WAVE_NotifyClient().
	Misc fixes.

	* [windows/winhelp.c]
	Fixed problem with windows help telling "Help topic doesn't exist".
	But this problem still remains when using Winword.

Wed Jun 11 09:14:20 1997  Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [wine.ini]
	New 'fonts' section format. Read documentation/fonts.

	* [controls/icontitle.c] [windows/winpos.c] [windows/nonclient.c]
	  [windows/win.c] [include/win.h]
	Implemented icon titles.

	* [graphics/x11drv/xfont.c] [objects/font.c] [objects/dc.c]
	  [include/x11drv.h] [include/x11font.h] [documentation/fonts]
	Rewrote font mapper from scratch.

	* [tools/fnt2bdf.c]
	Bug fixes. REPLACE FONTS CREATED BY THE PREVIOUS VERSIONS.

	* [windows/defwnd.c] [windows/nonclient.c]
	Word document window activation fix.

	* [windows/mdi.c] [windows/win.c]
	Replaced WCL lists with WIN_BuildWinArray().

Mon Jun  9 23:51:16 1997  Andrew Taylor <andrew@riscan.com>

	* [misc/error.c] [include/windows.h] [if1632/kernel.spec]
	Implemented LogParamError, LogError functions.

Tue Jun  3 23:46:04 1997  Michiel van Loon <mfvl@xs4all.nl>

	* [include/mmsystem.h] [multimedia/audio.c]
	Constants for asynchronous play and record.

	* [multimedia/time.c]
	Filled in some empty functions.

	* [multimedia/mmsystem.c]
	Fixed bugs in waveOutOpen.

	* [multimedia/mmsystem.c] [multimedia/audio.c]
	Implemented Window Callback for wave output at least.

	* [files/file.c]
	Corrected bug in FileDosSetError.
	NULL pointer checking added.

	* [misc/spy.c]
	Added Multimedia messages to SPY_GetMsgName.

Tue Jun 3 22:34:30 1997  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [debugger/*.c][include/peexe.h][loader/*.c][tools/build.c]
	  [tools/fnt2bdf.c][library/sup.c]
	IMAGE_* structs/defines changed fit better to SDK naming
	Don't load non-i386 PE executables.
	%fs should already be initialised for the FIRST loaded PE module.

	* [if1632/advapi.spec][win32/advapi.c]
	Some small stubs added to bring win32 setup.exe a bit farther.

	* [if1632/kernel32.spec][scheduler/process.c]
	Adapted to match win95 kernel32.dll ordinals (NT doesn't use
 	ordinal import), some ordinal only exported functions added.

	* [if1632/relay.c]
	Added CallProc32W.

	* [misc/lzexpand.c]
	Fixed return values of GetExpandedName* (thanks to Andreas Mohr).

	* [objects/dib.c]
	Everything with more than 8 bit of color is a truecolor mode
	and doesn't have a colormap.

Tue Jun  3 09:24:53 1997  John Harvey <john@division.co.uk>

	* [graphics/win16drv/font.c] [graphics/win16drv/init.c]
	  [graphics/win16drv/prtdrv.c] [graphics/win16drv/text.c]
	  [include/win16drv.h]
	Changed some structures that are passed to and from the 16 bit
 	drivers to be allocated on the global heap.
	Implemented Escape(Control) 0x100 GetExtTextData properly to
	stop word from crashing.
	Postscript driver now prints on complete page instead of top
	left corner.
	Print spooling implemented.

	* [loader/module.c]
	MODULE_GetOrdinal changed char buffer to unsigned char to stop
	a loop that was happening when running the font control
	program from the control panel.

Sun Jun  1 19:05:02 1997  Peter Schlaile <up9n@rz.uni-karlsruhe.de>

	* [include/miscemu.h] [loader/main.c] [msdos/ioports.c]
	Added support for direct io port access.

Fri May 30 16:18:35 1997  David A. Cuthbert <dacut@dssc3353.ece.cmu.edu>

	* [misc/ver.c]
	Implemented VerFindFile16.

Tue May 27 22:00:39 1997  Rick Richardson <rick@dgii.com>

	* [misc/comm.c]
	Fixed GetCommError and GetCommEventMask.

Tue May 27  9:10:53 1997  Georg Beyerle <gbeyerle@awi-potsdam.de>

	* [scheduler/thread.c]
	Minor fix in thread database initialization.

Mon May 26 19:46:34 1997  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [objects/dc.c]
	In DC_SetupGCForPen, avoid to draw in GXxor mode with a 0 mask.

Mon May 26 15:22:42 1997  Bruce Milner <Bruce.Milner@genetics.utah.edu>

	* [loader/pe_image.c]
	Add code for modules that co-reference each other. Photodex's
	agds.exe (cpic32) has two dll's that make calls into each other.

Mon May 26 13:38:16 1997  Jody Goldberg <jodyg@idt.net>

	* [memory/virtual.c]
	Dont use stdio when reading /proc/self/maps.  It causes problems
	with libc6.

	* [windows/dialog.c]
	Translate messages in IsDialogMessage when DLGC_WANTMESSAGE
	is used.

Sun May 25 17:02:21 1997  Huw D M Davies <h.davies1@physics.oxford.ac.uk>

	* [objects/metafile.c]
	Resource cleanup in EnumMetaFile(). This was one reason Word was
	crashing after long periods of use. (Thanks to Chris Underhill for
	the logs)

Sun May 25 14:59:33 1997  Jimen Ching  <jching@flex.com>

	* [multimedia/mcistring.c]
	Initial support for compound MCI commands.
	Use case-insensitive compare for 'alias' and 'element' keywords.
	Fixed pointer copy of args keywords array.
This commit is contained in:
Alexandre Julliard 1997-06-16 17:43:53 +00:00
parent 7ff1c415b4
commit 23946ad264
115 changed files with 7601 additions and 3690 deletions

View File

@ -1,13 +1,16 @@
This is release 970525 of Wine, the MS Windows emulator. This is still a
This is release 970616 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-970525: (see ChangeLog for details)
- Many fixes to multimedia code.
- Better menus.
WHAT'S NEW with Wine-970616: (see ChangeLog for details)
- More improvements to multimedia code.
- New font mapper.
- Icon titles.
- Print spooling.
- Direct I/O ports access.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +19,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-970525.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970525.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970525.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970525.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-970616.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-970616.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-970616.tar.gz
ftp://ftp.progsoc.uts.edu.au/pub/Wine/development/Wine-970616.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

14
BUGS
View File

@ -5,12 +5,11 @@ done something for one of the problems. You are encouraged to
add new entries and, more importantly, remove those for the
bugs you fixed ;-)
------------------------------------------------------------
As of March 10 1997 -
As of June 1997 -
General:
* Font mapping is too generic. No soft font loading, no rotated
text support, incorrect metrics. [alex@amadeus.pharm.sunysb.edu]
* TrueType, .FON rasterizer.
* No thread/process/kernel-object support in Win32 code.
@ -32,20 +31,23 @@ General:
properties.
* No manual pages describing the various Windows calls.
- You can find information about most of the Win32 API calls
on the www.microsoft.com (go to 'search').
Miscellaneous:
* New font mapping scheme can be improved.
* "Cursor XXXX has more than 1 bpp!"
* 32-bit Freecell segfaults when started from the Progman (looks like
a problem with cards.dll).
* Edit controls are prone to show blank space when, in fact, there is a
text there.
* Margins in edit controls are too wide.
* SGI window manager treats Wine windows as topmost.
* Write shows blank space instead of Paintbrush OLE1 object.
* Write shows blank space instead of Paintbrush OLE1 object ( GetDIBits()? ).
* AllocCSToDSAlias() shouldn't alloc alias for the same segment multiple
times.

167
ChangeLog
View File

@ -1,3 +1,170 @@
----------------------------------------------------------------------
Sat Jun 14 13:05:23 1997 Andreas Mohr <100.30936@germany.net>
* [include/mmsystem.h]
Avoided infinite loop in audio code when accessing
WAVEOUTCAPS/WAVEINCAPS/MIDIOUTCAPS/AUXCAPS with rigid variable
offsets (I applied WINE_PACKED).
* [*/*]
Added "WARNING:" and "ERROR:" to some printf's.
Just grep for them with '-debugmsg +all'.
* [multimedia/audio.c] [multimedia/mmsystem.c]
Implemented wave callbacks: window and function callback.
Fixed problem with WAVE_NotifyClient().
Misc fixes.
* [windows/winhelp.c]
Fixed problem with windows help telling "Help topic doesn't exist".
But this problem still remains when using Winword.
Wed Jun 11 09:14:20 1997 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [wine.ini]
New 'fonts' section format. Read documentation/fonts.
* [controls/icontitle.c] [windows/winpos.c] [windows/nonclient.c]
[windows/win.c] [include/win.h]
Implemented icon titles.
* [graphics/x11drv/xfont.c] [objects/font.c] [objects/dc.c]
[include/x11drv.h] [include/x11font.h] [documentation/fonts]
Rewrote font mapper from scratch.
* [tools/fnt2bdf.c]
Bug fixes. REPLACE FONTS CREATED BY THE PREVIOUS VERSIONS.
* [windows/defwnd.c] [windows/nonclient.c]
Word document window activation fix.
* [windows/mdi.c] [windows/win.c]
Replaced WCL lists with WIN_BuildWinArray().
Mon Jun 9 23:51:16 1997 Andrew Taylor <andrew@riscan.com>
* [misc/error.c] [include/windows.h] [if1632/kernel.spec]
Implemented LogParamError, LogError functions.
Tue Jun 3 23:46:04 1997 Michiel van Loon <mfvl@xs4all.nl>
* [include/mmsystem.h] [multimedia/audio.c]
Constants for asynchronous play and record.
* [multimedia/time.c]
Filled in some empty functions.
* [multimedia/mmsystem.c]
Fixed bugs in waveOutOpen.
* [multimedia/mmsystem.c] [multimedia/audio.c]
Implemented Window Callback for wave output at least.
* [files/file.c]
Corrected bug in FileDosSetError.
NULL pointer checking added.
* [misc/spy.c]
Added Multimedia messages to SPY_GetMsgName.
Tue Jun 3 22:34:30 1997 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [debugger/*.c][include/peexe.h][loader/*.c][tools/build.c]
[tools/fnt2bdf.c][library/sup.c]
IMAGE_* structs/defines changed fit better to SDK naming
Don't load non-i386 PE executables.
%fs should already be initialised for the FIRST loaded PE module.
* [if1632/advapi.spec][win32/advapi.c]
Some small stubs added to bring win32 setup.exe a bit farther.
* [if1632/kernel32.spec][scheduler/process.c]
Adapted to match win95 kernel32.dll ordinals (NT doesn't use
ordinal import), some ordinal only exported functions added.
* [if1632/relay.c]
Added CallProc32W.
* [misc/lzexpand.c]
Fixed return values of GetExpandedName* (thanks to Andreas Mohr).
* [objects/dib.c]
Everything with more than 8 bit of color is a truecolor mode
and doesn't have a colormap.
Tue Jun 3 09:24:53 1997 John Harvey <john@division.co.uk>
* [graphics/win16drv/font.c] [graphics/win16drv/init.c]
[graphics/win16drv/prtdrv.c] [graphics/win16drv/text.c]
[include/win16drv.h]
Changed some structures that are passed to and from the 16 bit
drivers to be allocated on the global heap.
Implemented Escape(Control) 0x100 GetExtTextData properly to
stop word from crashing.
Postscript driver now prints on complete page instead of top
left corner.
Print spooling implemented.
* [loader/module.c]
MODULE_GetOrdinal changed char buffer to unsigned char to stop
a loop that was happening when running the font control
program from the control panel.
Sun Jun 1 19:05:02 1997 Peter Schlaile <up9n@rz.uni-karlsruhe.de>
* [include/miscemu.h] [loader/main.c] [msdos/ioports.c]
Added support for direct io port access.
Fri May 30 16:18:35 1997 David A. Cuthbert <dacut@dssc3353.ece.cmu.edu>
* [misc/ver.c]
Implemented VerFindFile16.
Tue May 27 22:00:39 1997 Rick Richardson <rick@dgii.com>
* [misc/comm.c]
Fixed GetCommError and GetCommEventMask.
Tue May 27 9:10:53 1997 Georg Beyerle <gbeyerle@awi-potsdam.de>
* [scheduler/thread.c]
Minor fix in thread database initialization.
Mon May 26 19:46:34 1997 Philippe De Muyter <phdm@info.ucl.ac.be>
* [objects/dc.c]
In DC_SetupGCForPen, avoid to draw in GXxor mode with a 0 mask.
Mon May 26 15:22:42 1997 Bruce Milner <Bruce.Milner@genetics.utah.edu>
* [loader/pe_image.c]
Add code for modules that co-reference each other. Photodex's
agds.exe (cpic32) has two dll's that make calls into each other.
Mon May 26 13:38:16 1997 Jody Goldberg <jodyg@idt.net>
* [memory/virtual.c]
Dont use stdio when reading /proc/self/maps. It causes problems
with libc6.
* [windows/dialog.c]
Translate messages in IsDialogMessage when DLGC_WANTMESSAGE
is used.
Sun May 25 17:02:21 1997 Huw D M Davies <h.davies1@physics.oxford.ac.uk>
* [objects/metafile.c]
Resource cleanup in EnumMetaFile(). This was one reason Word was
crashing after long periods of use. (Thanks to Chris Underhill for
the logs)
Sun May 25 14:59:33 1997 Jimen Ching <jching@flex.com>
* [multimedia/mcistring.c]
Initial support for compound MCI commands.
Use case-insensitive compare for 'alias' and 'element' keywords.
Fixed pointer copy of args keywords array.
----------------------------------------------------------------------
Tue May 20 19:20:23 1997 Pablo Saratxaga <srtxg@linux.chanae.stben.be>

View File

@ -239,3 +239,13 @@ not yet implemented functions.
You have to start tools/make_debug only if you introduced a new macro,
e.g. dprintf_win32s - not if you just changed one of the #define
DEBUG_XXX's in include/stddebug.h or in a specific file.
MORE INFO
=========
1. http://www.sonic.net/~undoc/bookstore.html
2. In 1993 Dr. Dobbs Journal published a column called "Undocumented Corner".
3. You might want to check out BYTE from December 1983 as well :-)

3
README
View File

@ -74,6 +74,9 @@ Note: the path of the file will also be added to the path when
Have a nice game of solitaire, but be careful. Emulation isn't perfect.
So, occasionally it may crash.
UPDATE: Windows 95 components are known to cause more crashes compared
to the equivalent Windows 3.1 libraries.
5. GETTING MORE INFORMATION

View File

@ -10,6 +10,7 @@ C_SRCS = \
combo.c \
desktop.c \
edit.c \
icontitle.c \
listbox.c \
menu.c \
scroll.c \

View File

@ -152,7 +152,8 @@ static void CBCalcPlacement( LPHEADCOMBO lphc,
if( lphc->hFont ) hPrevFont = SelectObject16( hDC, lphc->hFont );
GetTextExtentPoint16( hDC, "X", 1, &size);
GetTextExtentPoint16( hDC, "0", 1, &size);
size.cy += size.cy / 4 + 4 * SYSMETRICS_CYBORDER;
if( hPrevFont ) SelectObject16( hDC, hPrevFont );

244
controls/icontitle.c Normal file
View File

@ -0,0 +1,244 @@
/*
* Icontitle window class.
*
* Copyright 1997 Alex Korobka
*/
#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include "windows.h"
#include "sysmetrics.h"
#include "syscolor.h"
#include "win.h"
#include "desktop.h"
#include "graphics.h"
#include "heap.h"
static LPCSTR emptyTitleText = "<...>";
BOOL32 bMultiLineTitle;
HFONT32 hIconTitleFont;
/***********************************************************************
* ICONTITLE_Init
*/
BOOL32 ICONTITLE_Init(void)
{
LOGFONT16 logFont;
SystemParametersInfo16( SPI_GETICONTITLELOGFONT, 0, &logFont, 0 );
SystemParametersInfo16( SPI_GETICONTITLEWRAP, 0, &bMultiLineTitle, 0 );
hIconTitleFont = CreateFontIndirect16( &logFont );
return (hIconTitleFont) ? TRUE : FALSE;
}
/***********************************************************************
* ICONTITLE_Create
*/
HWND32 ICONTITLE_Create( WND* wnd )
{
WND* wndPtr;
HWND32 hWnd;
if( wnd->dwStyle & WS_CHILD )
hWnd = CreateWindowEx32A( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CHILD | WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->parent->hwndSelf, 0, wnd->hInstance, NULL );
else
hWnd = CreateWindowEx32A( 0, ICONTITLE_CLASS_ATOM, NULL,
WS_CLIPSIBLINGS, 0, 0, 1, 1,
wnd->hwndSelf, 0, wnd->hInstance, NULL );
wndPtr = WIN_FindWndPtr( hWnd );
if( wndPtr )
{
wndPtr->owner = wnd; /* MDI depends on this */
wndPtr->dwStyle &= ~(WS_CAPTION | WS_BORDER);
if( wnd->dwStyle & WS_DISABLED ) wndPtr->dwStyle |= WS_DISABLED;
return hWnd;
}
return 0;
}
/***********************************************************************
* ICONTITLE_GetTitlePos
*/
static BOOL32 ICONTITLE_GetTitlePos( WND* wnd, LPRECT32 lpRect )
{
LPSTR str;
int length = lstrlen32A( wnd->owner->text );
if( length )
{
str = HeapAlloc( GetProcessHeap(), 0, length + 1 );
lstrcpy32A( str, wnd->owner->text );
while( str[length - 1] == ' ' ) /* remove trailing spaces */
{
str[--length] = '\0';
if( !length )
{
HeapFree( GetProcessHeap(), 0, str );
break;
}
}
}
if( !length )
{
str = (LPSTR)emptyTitleText;
length = lstrlen32A( str );
}
if( str )
{
HDC32 hDC = GetDC32( wnd->hwndSelf );
if( hDC )
{
HFONT32 hPrevFont = SelectObject32( hDC, hIconTitleFont );
SetRect32( lpRect, 0, 0, sysMetrics[SM_CXICONSPACING] -
SYSMETRICS_CXBORDER * 2, SYSMETRICS_CYBORDER * 2 );
DrawText32A( hDC, str, length, lpRect, DT_CALCRECT |
DT_CENTER | DT_NOPREFIX | DT_WORDBREAK |
(( bMultiLineTitle ) ? 0 : DT_SINGLELINE) );
SelectObject32( hDC, hPrevFont );
ReleaseDC32( wnd->hwndSelf, hDC );
lpRect->right += 4 * SYSMETRICS_CXBORDER - lpRect->left;
lpRect->left = wnd->owner->rectWindow.left + SYSMETRICS_CXICON / 2 -
(lpRect->right - lpRect->left) / 2;
lpRect->bottom -= lpRect->top;
lpRect->top = wnd->owner->rectWindow.top + SYSMETRICS_CYICON;
}
if( str != emptyTitleText ) HeapFree( GetProcessHeap(), 0, str );
return ( hDC ) ? TRUE : FALSE;
}
return FALSE;
}
/***********************************************************************
* ICONTITLE_Paint
*/
static BOOL32 ICONTITLE_Paint( WND* wnd, HDC32 hDC, BOOL32 bActive )
{
HFONT32 hPrevFont;
HBRUSH32 hBrush = 0;
COLORREF textColor = 0;
if( bActive )
{
hBrush = sysColorObjects.hbrushActiveCaption;
textColor = GetSysColor32(COLOR_CAPTIONTEXT);
}
else
{
if( wnd->dwStyle & WS_CHILD )
{
hBrush = wnd->parent->class->hbrBackground;
if( hBrush )
{
INT32 level;
LOGBRUSH32 logBrush;
GetObject32A( hBrush, sizeof(logBrush), &logBrush );
level = GetRValue(logBrush.lbColor) +
GetGValue(logBrush.lbColor) +
GetBValue(logBrush.lbColor);
if( level < (0x7F * 3) )
textColor = RGB( 0xFF, 0xFF, 0xFF );
}
else
hBrush = GetStockObject32( WHITE_BRUSH );
}
else
{
hBrush = GetStockObject32( BLACK_BRUSH );
textColor = RGB( 0xFF, 0xFF, 0xFF );
}
}
FillWindow( wnd->parent->hwndSelf, wnd->hwndSelf, hDC, hBrush );
hPrevFont = SelectObject32( hDC, hIconTitleFont );
if( hPrevFont )
{
RECT16 rect;
INT32 length;
char buffer[80];
rect.left = rect.top = 0;
rect.right = wnd->rectWindow.right - wnd->rectWindow.left;
rect.bottom = wnd->rectWindow.bottom - wnd->rectWindow.top;
length = GetWindowText32A( wnd->owner->hwndSelf, buffer, 80 );
SetTextColor32( hDC, textColor );
SetBkMode32( hDC, TRANSPARENT );
DrawText16( hDC, buffer, length, &rect, DT_CENTER | DT_NOPREFIX |
DT_WORDBREAK | ((bMultiLineTitle) ? 0 : DT_SINGLELINE) );
SelectObject32( hDC, hPrevFont );
}
return ( hPrevFont ) ? TRUE : FALSE;
}
/***********************************************************************
* IconTitleWndProc
*/
LRESULT IconTitleWndProc( HWND32 hWnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam )
{
WND *wnd = WIN_FindWndPtr( hWnd );
switch( msg )
{
case WM_NCHITTEST:
return HTCAPTION;
case WM_NCMOUSEMOVE:
case WM_NCLBUTTONDBLCLK:
return SendMessage32A( wnd->owner->hwndSelf, msg, wParam, lParam );
case WM_ACTIVATE:
if( wParam ) SetActiveWindow32( wnd->owner->hwndSelf );
/* fall through */
case WM_CLOSE:
return 0;
case WM_SHOWWINDOW:
if( wnd && wParam )
{
RECT32 titleRect;
ICONTITLE_GetTitlePos( wnd, &titleRect );
if( wnd->owner->next != wnd ) /* keep icon title behind the owner */
SetWindowPos32( hWnd, wnd->owner->hwndSelf,
titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom, SWP_NOACTIVATE );
else
SetWindowPos32( hWnd, 0, titleRect.left, titleRect.top,
titleRect.right, titleRect.bottom,
SWP_NOACTIVATE | SWP_NOZORDER );
}
return 0;
case WM_ERASEBKGND:
if( wnd )
{
WND* iconWnd = wnd->owner;
if( iconWnd->dwStyle & WS_CHILD )
lParam = SendMessage32A( iconWnd->hwndSelf, WM_ISACTIVEICON, 0, 0 );
else
lParam = (iconWnd->hwndSelf == GetActiveWindow16());
if( ICONTITLE_Paint( wnd, (HDC32)wParam, (BOOL32)lParam ) )
ValidateRect32( hWnd, NULL );
return 1;
}
}
return DefWindowProc32A( hWnd, msg, wParam, lParam );
}

View File

@ -1731,12 +1731,9 @@ static LRESULT LISTBOX_HandleLButtonUp( WND *wnd, LB_DESCR *descr )
if (LISTBOX_Timer != LB_TIMER_NONE)
KillSystemTimer32( wnd->hwndSelf, LB_TIMER_ID );
LISTBOX_Timer = LB_TIMER_NONE;
if (GetCapture32() == wnd->hwndSelf)
{
ReleaseCapture();
if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE );
}
if (GetCapture32() == wnd->hwndSelf) ReleaseCapture();
if (descr->style & LBS_NOTIFY)
SEND_NOTIFICATION( wnd, descr, LBN_SELCHANGE );
return 0;
}

View File

@ -30,6 +30,8 @@ extern LRESULT ListBoxWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT PopupMenuWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern LRESULT IconTitleWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
/* Win16 class info */
@ -85,7 +87,10 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[BIC32_NB_CLASSES] =
0, 0, IDC_ARROW, 0, 0, DESKTOP_CLASS_NAME },
/* BIC32_DIALOG */
{ CS_GLOBALCLASS | CS_SAVEBITS, DefDlgProc32A, 0, DLGWINDOWEXTRA,
0, 0, IDC_ARROW, 0, 0, DIALOG_CLASS_NAME }
0, 0, IDC_ARROW, 0, 0, DIALOG_CLASS_NAME },
/* BIC32_ICONTITLE */
{ CS_GLOBALCLASS, IconTitleWndProc, 0, 0,
0, 0, IDC_ARROW, 0, 0, ICONTITLE_CLASS_NAME }
};
static ATOM bicAtomTable[BIC32_NB_CLASSES];

View File

@ -546,6 +546,17 @@ static void DEBUG_Main( int signal )
}
/***********************************************************************
* DebugBreak32 (KERNEL32)
*/
void DebugBreak32( CONTEXT *regs )
{
const char *module = MODULE_GetModuleName( GetExePtr(GetCurrentTask()) );
fprintf( stderr, "%s called DebugBreak\n", module ? module : "???" );
DEBUG_context = *regs;
DEBUG_Main( SIGTRAP );
}
/***********************************************************************
* DebugBreak16 (KERNEL.203)
*/

View File

@ -170,7 +170,7 @@ struct deferred_debug_info
char * module_name;
char * dbg_info;
int dbg_size;
struct PE_Debug_dir * dbgdir;
LPIMAGE_DEBUG_DIRECTORY dbgdir;
struct pe_data * pe;
LPIMAGE_SECTION_HEADER sectp;
int nsect;
@ -189,7 +189,7 @@ struct CodeViewDebug
test_pdbstuff()
{
struct deferred_debug_info deefer;
struct PE_Debug_dir dinfo;
IMAGE_DEBUG_DIRECTORY dinfo;
struct CodeViewDebug cdebug;
IMAGE_SECTION_HEADER sects[10];
@ -199,7 +199,7 @@ test_pdbstuff()
memset(&sects, 0, sizeof(sects));
deefer.dbg_info = (char *) &cdebug;
dinfo.timestamp = 812932395;
dinfo.TimeStamp = 812932395;
cdebug.cv_timestamp = 833392137 /* 841951397 */;
deefer.dbgdir = &dinfo;
deefer.sectp = sects;

View File

@ -2135,7 +2135,7 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
char * codeview;
struct CV4_DirHead * codeview_dir;
struct CV4_DirEnt * codeview_dent;
struct PE_Debug_dir * dbghdr;
LPIMAGE_DEBUG_DIRECTORY dbghdr;
struct deferred_debug_info deefer2;
int fd = -1;
int i;
@ -2187,7 +2187,7 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
fprintf(stderr, "Processing symbols from %s...\n", filename);
dbghdr = (struct PE_Debug_dir *) ( addr + sizeof(*pdbg)
dbghdr = (LPIMAGE_DEBUG_DIRECTORY) ( addr + sizeof(*pdbg)
+ pdbg->NumberOfSections * sizeof(IMAGE_SECTION_HEADER)
+ pdbg->ExportedNamesSize);
@ -2196,7 +2196,7 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
for( i=0; i < pdbg->DebugDirectorySize / sizeof(*pdbg); i++, dbghdr++ )
{
switch(dbghdr->type)
switch(dbghdr->Type)
{
case IMAGE_DEBUG_TYPE_COFF:
/*
@ -2204,8 +2204,8 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
* COFF stuff embedded within the DBG file.
*/
memset((char *) &deefer2, 0, sizeof(deefer2));
deefer2.dbg_info = (addr + dbghdr->dbgoff);
deefer2.dbg_size = dbghdr->dbgsize;
deefer2.dbg_info = (addr + dbghdr->PointerToRawData);
deefer2.dbg_size = dbghdr->SizeOfData;
deefer2.load_addr = deefer->load_addr;
DEBUG_ProcessCoff(&deefer2);
@ -2218,7 +2218,7 @@ DEBUG_ProcessDBGFile(struct deferred_debug_info * deefer, char * filename)
* have lots of internal similarities, but the overall
* format and structure is quite different.
*/
codeview = (addr + dbghdr->dbgoff);
codeview = (addr + dbghdr->PointerToRawData);
/*
* The first thing in the codeview section should be

111
documentation/fonts Normal file
View File

@ -0,0 +1,111 @@
How To Convert Windows Fonts
============================
If you have access to Windows installation you should use
fnt2bdf utility (found in the 'tools)' directory to convert
bitmap fonts (SYSTEM.FON, SSERIFE.FON, and SERIFE.FON) into
the format that X Window System can recognize.
Step 1. Extract bitmap fonts with 'fnt2bdf'.
Step 2. Convert .bdf files produced by the Step 1 into
.pcf files with 'bdftopcf'.
Step 3. Copy .pcf files to the font server directory which
is usually /usr/lib/X11/fonts/misc (you will probably
need superuser privileges).
Step 4. Run 'mkfontdir' for the directory you copied fonts to.
If you are already in X you should run 'xset fp rehash'
to make X server aware of the new fonts.
Wine can get by without these fonts but 'the look and feel'
will be quite different.
What to do with TrueType fonts? There are several commercial
font tools that can convert them to the Type1 format but the
quality of the resulting fonts is far from stellar. The other
way to use them is to get a font server capable of rendering
TrueType (Caldera has one).
However, there is a possibility of the native TrueType support
via FreeType renderer in the future (hint, hint :-)
WINE.CONF And Font Mapper
=========================
Many Windows applications assume that fonts included in original Windows 3.1
distribution (Arial, Times New Roman, MS Sans Serif, etc.) are always present.
In order to make font mapper choose a closely related font you can add aliases
to the [fonts] section.
AliasN = [Windows font], [X font] <, optional "mask X font" flag>
Example:
Alias0 = System, --international-, mask
Alias1 = Arial, -adobe-helvetica-
Alias2 = Times New Roman, -adobe-times-
...
Comments:
There must be no gaps in the sequence {0, ..., N} otherwise all aliases
after the first gap won't be read.
Usually font mapper translates X font names into font names visible to
Windows programs in the following fashion:
X font Converted name
-adobe-helvetica-... "Helvetica"
-adobe-utopia-... "Utopia"
-misc-fixed-... "Fixed"
-...
-sony-fixed-... "Sony Fixed" (already have "Fixed")
-...
Only converted names appear in the font selection dialogs. However,
if there is an alias with the "mask" flag set converted name will be
replaced by this alias.
--international- "System"
Nonmasking aliases are translated only when program asks for a font
with the name that matches an alias.
If you do not have an access to Windows fonts mentioned in the first
paragraph you should try to substitute them with similar X fonts.
Alias.. = System, ...bold font without serifs
Alias.. = MS Sans Serif, ...helvetica-like font
Also, some Windows applications request fonts without specifying the
typeface name of the font. Font table starts with Arial in most Windows
installations, however X font table starts with whatever is the first line
in the fonts.dir. Therefore WINE uses the following entry to determine
which font to check first.
Default = ...
Comments:
It is better to have a scalable font family (bolds and italics included)
as the default choice because mapper checks all available fonts until
requested height and other attributes match perfectly or the end of the
font table is reached.
Cached Font Metrics
===================
WINE stores detailed information about available fonts in the ~/.wine/.cachedmetrics
file. You can copy it elsewhere and add this entry to the [fonts] section
in the WINE.CONF:
FontMetrics = <file with metrics>
If WINE detects changes in the X font configuration it will rebuild font
metrics from scratch and then it will overwrite ~/.wine/.cachedmetrics with
the new information. This process can take a while.

View File

@ -1,3 +1,13 @@
KERNEL MODULE
=============
...
GDI MODULE
==========
...
USER MODULE
===========
@ -20,11 +30,11 @@ located in windows/, controls/, and misc/ directories.
ancestor link (wnd->parent) points to the desktop window.
Desktop window - root window
| \ '-.
| \ '-.
| \ `-.
| \ `-.
popup -> wnd1 -> wnd2 - top level windows
| \ '-. '-.
| \ '-. '-.
| \ `-. `-.
| \ `-. `-.
child1 child2 -> child3 child4 - child windows
Horizontal arrows denote sibling relationship, vertical lines
@ -36,7 +46,7 @@ located in windows/, controls/, and misc/ directories.
sibling list (they are not topmost). Child windows are confined to the
client area of their parent windows (client area is where window gets
to do its own drawing, non-client area consists of caption, menu, borders,
intrinsic scrollbars, and minimize/maximize/close buttons).
intrinsic scrollbars, and minimize/maximize/close/help buttons).
Another fairly important concept is "z-order". It is derived from
the ancestor/child hierarchy and is used to determine "above/below"
@ -50,7 +60,7 @@ located in windows/, controls/, and misc/ directories.
Wine specifics: in default and managed mode each top-level window
gets its own X counterpart with desktop window being basically a
fake stub. In desktop mode, however, only desktop window has X
fake stub. In desktop mode, however, only desktop window has an X
window associated with it.
2. Messaging subsystem
@ -214,3 +224,4 @@ located in windows/, controls/, and misc/ directories.
queue for sent messages. Another issue is what to do with messages
sent to the sender when it is blocked inside its own SendMessage.

View File

@ -809,6 +809,8 @@ static DWORD DOSFS_DoGetFullPathName( LPCSTR name, DWORD len, LPSTR result,
dprintf_dosfs( stddeb, "GetFullPathName: converting %s\n", name );
if (!name || !result) return 0;
if ((drive = DOSFS_GetPathDrive( &name )) == -1) return 0;
p = buffer;
*p++ = 'A' + drive;

View File

@ -129,8 +129,10 @@ int FILE_GetUnixHandle( HFILE32 hFile )
*/
void FILE_SetDosError(void)
{
int save_errno = errno; /* errno gets overwritten by printf */
dprintf_file(stddeb, "FILE_SetDosError: errno = %d\n", errno );
switch (errno)
switch (save_errno)
{
case EAGAIN:
DOS_ERROR( ER_ShareViolation, EC_Temporary, SA_Retry, EL_Disk );
@ -167,6 +169,7 @@ void FILE_SetDosError(void)
DOS_ERROR( ER_GeneralFailure, EC_SystemFailure, SA_Abort, EL_Unknown );
break;
}
errno = save_errno;
}
@ -239,6 +242,9 @@ HFILE32 FILE_Open( LPCSTR path, INT32 mode )
const char *unixName;
dprintf_file(stddeb, "FILE_Open: '%s' %04x\n", path, mode );
if (!path) return HFILE_ERROR32;
if ((unixName = DOSFS_IsDevice( path )) != NULL)
{
dprintf_file( stddeb, "FILE_Open: opening device '%s'\n", unixName );
@ -271,6 +277,8 @@ static HFILE32 FILE_Create( LPCSTR path, int mode, int unique )
dprintf_file(stddeb, "FILE_Create: '%s' %04x %d\n", path, mode, unique );
if (!path) return INVALID_HANDLE_VALUE32;
if ((unixName = DOSFS_IsDevice( path )) != NULL)
{
dprintf_file(stddeb, "FILE_Create: creating device '%s'!\n", unixName);
@ -338,6 +346,8 @@ BOOL32 FILE_Stat( LPCSTR unixName, BY_HANDLE_FILE_INFORMATION *info )
{
struct stat st;
if (!unixName || !info) return FALSE;
if (stat( unixName, &st ) == -1)
{
FILE_SetDosError();
@ -358,6 +368,8 @@ DWORD GetFileInformationByHandle( HFILE32 hFile,
DWORD ret = 0;
struct stat st;
if (!info) return 0;
if (!(file = FILE_GetFile( hFile ))) return 0;
if (fstat( file->unix_handle, &st ) == -1) FILE_SetDosError();
else
@ -387,6 +399,8 @@ DWORD GetFileAttributes32A( LPCSTR name )
DOS_FULL_NAME full_name;
BY_HANDLE_FILE_INFORMATION info;
if (name == NULL) return -1;
if (!DOSFS_GetFullName( name, TRUE, &full_name )) return -1;
if (!FILE_Stat( full_name.long_name, &info )) return -1;
return info.dwFileAttributes;
@ -436,6 +450,8 @@ BOOL32 GetFileTime( HFILE32 hFile, FILETIME *lpCreationTime,
*/
INT32 CompareFileTime( LPFILETIME x, LPFILETIME y )
{
if (!x || !y) return -1;
if (x->dwHighDateTime > y->dwHighDateTime)
return 1;
if (x->dwHighDateTime < y->dwHighDateTime)
@ -521,7 +537,8 @@ UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
LPSTR p;
UINT32 num = unique ? (unique & 0xffff) : time(NULL) & 0xffff;
if (!path) return 0;
if ( !path || !prefix || !buffer ) return 0;
strcpy( buffer, path );
p = buffer + strlen(buffer);
/* add a \, if there isn't one ... */
@ -604,6 +621,13 @@ static HFILE32 FILE_DoOpenFile( LPCSTR name, OFSTRUCT *ofs, UINT32 mode,
char *p;
int unixMode;
if (!name || !ofs) return HFILE_ERROR32;
if (!name) {
fprintf(stderr, "ERROR: FILE_DoOpenFile() called with `name' set to NULL ! Please debug.\n");
return HFILE_ERROR32;
}
ofs->cBytes = sizeof(OFSTRUCT);
ofs->nErrCode = 0;
if (mode & OF_REOPEN) name = ofs->szPathName;

View File

@ -116,7 +116,7 @@ static void PROFILE_Save( FILE *file, PROFILESECTION *section )
for ( ; section; section = section->next)
{
if (section->name) fprintf( file, "[%s]\r\n", section->name );
if (section->name) fprintf( file, "\r\n[%s]\r\n", section->name );
for (key = section->key; key; key = key->next)
{
fprintf( file, "%s", key->name );
@ -211,7 +211,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
}
key = HEAP_xalloc( SystemHeap, 0, sizeof(*key) );
key->name = HEAP_strdupA( SystemHeap, 0, p );
key->value = HEAP_strdupA( SystemHeap, 0, p2 );
key->value = p2 ? HEAP_strdupA( SystemHeap, 0, p2 ) : NULL;
key->next = NULL;
*prev_key = key;
prev_key = &key->next;
@ -642,6 +642,33 @@ int PROFILE_LoadWineIni(void)
}
/***********************************************************************
* PROFILE_GetStringItem
*
* Convenience function that turns a string 'xxx, yyy, zzz' into
* the 'xxx\0 yyy, zzz' and returns a pointer to the 'yyy, zzz'.
*/
char* PROFILE_GetStringItem( char* start )
{
char* lpchX, *lpch;
for (lpchX = start, lpch = NULL; *lpchX != '\0'; lpchX++ )
{
if( isspace( *lpchX ) ) lpch = lpch ? lpch : lpchX;
else lpch = NULL;
if( *lpchX == ',' )
{
if( lpch ) *lpch = '\0'; else *lpchX = '\0';
while( *(++lpchX) )
if( !isspace(*lpchX) ) return lpchX;
}
}
if( lpch ) *lpch = '\0';
return NULL;
}
/********************* API functions **********************************/
/***********************************************************************

View File

@ -478,7 +478,7 @@ void DrawFocusRect16( HDC16 hdc, const RECT16* rc )
/***********************************************************************
* DrawFocusRect32 (USER32.155)
*
* FIXME: should use Rectangle32!
* FIXME: PatBlt(PATINVERT) with background brush.
*/
void DrawFocusRect32( HDC32 hdc, const RECT32* rc )
{
@ -747,10 +747,10 @@ BOOL32 DrawEdge32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
/**********************************************************************
* DrawFrameControl16 (USER.656)
*/
BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 uType, UINT16 uState )
{
fprintf( stdnimp,"DrawFrameControl16(%x,%p,%d,%x), empty stub!\n",
hdc,rc,edge,flags );
hdc,rc,uType,uState );
return TRUE;
}
@ -758,9 +758,9 @@ BOOL16 DrawFrameControl16( HDC16 hdc, LPRECT16 rc, UINT16 edge, UINT16 flags )
/**********************************************************************
* DrawFrameControl32 (USER32.157)
*/
BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 edge, UINT32 flags )
BOOL32 DrawFrameControl32( HDC32 hdc, LPRECT32 rc, UINT32 uType, UINT32 uState )
{
fprintf( stdnimp,"DrawFrameControl32(%x,%p,%d,%x), empty stub!\n",
hdc,rc,edge,flags );
hdc,rc,uType,uState );
return TRUE;
}

View File

@ -19,11 +19,6 @@ BOOL32 WIN16DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
DWORD dwRet;
extern DRAWMODE DrawMode;
LPDRAWMODE lpDrawMode = &DrawMode;
TEXTXFORM16 TextXForm;
LPTEXTXFORM16 lpTextXForm = &TextXForm;
InitTextXForm(lpTextXForm);
printf("LPGDI_GetTextExtPoint: %04x %s %d %p\n", dc->hSelf, str, count, size);
@ -37,8 +32,8 @@ BOOL32 WIN16DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, str,
-count, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
-count, physDev->segptrFontInfo, win16drv_SegPtr_DrawMode,
win16drv_SegPtr_TextXForm, NULL, NULL, 0);
printf("LPGDI_GetTextExtPoint: cx=0x%x, cy=0x%x Ret 0x%lx\n", size->cx, size->cy, dwRet);
return TRUE;

View File

@ -7,6 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
#include <ctype.h>
#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
@ -27,19 +28,19 @@
typedef struct
{
SHORT nSize;
LPVOID lpindata;
LPVOID lpFont;
LPVOID lpXForm;
LPVOID lpDrawMode;
SEGPTR lpindata;
SEGPTR lpFont;
SEGPTR lpXForm;
SEGPTR lpDrawMode;
} EXTTEXTDATA, *LPEXTTEXTDATA;
#pragma pack(4)
#if 0
static BOOL16 windrvExtTextOut16( DC *dc, INT16 x, INT16 y, UINT16 flags, const RECT16 * lprect,
LPCSTR str, UINT16 count, const INT16 *lpDx);
#endif
SEGPTR win16drv_SegPtr_TextXForm;
LPTEXTXFORM16 win16drv_TextXFormP;
SEGPTR win16drv_SegPtr_DrawMode;
LPDRAWMODE win16drv_DrawModeP;
DRAWMODE DrawMode;
static BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
@ -222,10 +223,8 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
int nPDEVICEsize;
PDEVICE_HEADER *pPDH;
WIN16DRV_PDEVICE *physDev;
LPDRAWMODE lpDrawMode = &DrawMode;
/* Realizing fonts */
TEXTXFORM16 TextXForm;
int nSize;
char printerEnabled[20];
PROFILE_GetWineIniString( "wine", "printer", "off",
@ -339,21 +338,24 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
&pLPD->paPrinterFonts[0].tm,
sizeof(TEXTMETRIC16));
win16drv_SegPtr_TextXForm = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(TEXTXFORM16)));
win16drv_TextXFormP = PTR_SEG_TO_LIN(win16drv_SegPtr_TextXForm);
InitTextXForm(win16drv_TextXFormP);
#ifdef SUPPORT_REALIZED_FONTS
/* TTD should calculate this */
InitTextXForm(&TextXForm);
/* First get the size of the realized font */
nSize = PRTDRV_RealizeObject(physDev->segptrPDEVICE, OBJ_FONT,
&pLPD->paPrinterFonts[0], NULL,
NULL);
0);
physDev->segptrFontInfo = WIN16_GlobalLock16(GlobalAlloc16(GHND, nSize));
/* Realize the font */
PRTDRV_RealizeObject(physDev->segptrPDEVICE, OBJ_FONT,
&pLPD->paPrinterFonts[0],
(LPVOID)physDev->segptrFontInfo,
&TextXForm);
win16drv_SegPtr_TextXForm);
/* Quick look at structure */
if (physDev->segptrFontInfo)
{
@ -368,7 +370,10 @@ BOOL32 WIN16DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device, LPCSTR output,
#endif
/* TTD Lots more to do here */
InitDrawMode(lpDrawMode);
win16drv_SegPtr_DrawMode = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(DRAWMODE)));
win16drv_DrawModeP = PTR_SEG_TO_LIN(win16drv_SegPtr_DrawMode);
InitDrawMode(win16drv_DrawModeP);
return TRUE;
}
@ -389,23 +394,29 @@ static INT32 WIN16DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
{
switch(nEscape)
{
case 0x9:
case SETABORTPROC:
printf("Escape: SetAbortProc ignored\n");
break;
case 0x100:
case GETEXTENDEDTEXTMETRICS:
{
LPEXTTEXTDATA textData = PTR_SEG_TO_LIN(lpInData);
printf("Got in data 0x%lx textData 0x%p\n",lpInData, textData);
printf("size %d in 0x%p:0x%p font 0x%p:0x%p xform 0x%p:0x%p drawm 0x%p:0x%p\n",
textData->nSize,
textData->lpindata,PTR_SEG_TO_LIN(textData->lpindata),
textData->lpFont,PTR_SEG_TO_LIN(textData->lpFont),
textData->lpXForm,PTR_SEG_TO_LIN(textData->lpXForm),
textData->lpDrawMode,PTR_SEG_TO_LIN(textData->lpDrawMode));
SEGPTR newInData = WIN16_GlobalLock16(GlobalAlloc16(GHND, sizeof(EXTTEXTDATA)));
EXTTEXTDATA *textData = (EXTTEXTDATA *)(PTR_SEG_TO_LIN(newInData));
textData->nSize = cbInput;
textData->lpindata = lpInData;
textData->lpFont = physDev->segptrFontInfo;
textData->lpXForm = win16drv_SegPtr_TextXForm;
textData->lpDrawMode = win16drv_SegPtr_DrawMode;
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
newInData, lpOutData);
GlobalFree16(newInData);
}
break;
break;
default:
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
nRet = PRTDRV_Control(physDev->segptrPDEVICE, nEscape,
lpInData, lpOutData);
}
}
@ -540,19 +551,58 @@ static PPRINTJOB FindPrintJobFromHandle(HANDLE16 hHandle)
/* TTD Need to do some DOS->UNIX file conversion here */
static int CreateSpoolFile(LPSTR pszOutput)
{
int fd;
char szSpoolFile[32];
int fd=-1;
char psCmd[1024];
char *psCmdP = psCmd;
/* TTD convert the 'output device' into a spool file name */
if (pszOutput == NULL || *pszOutput == '\0')
strcpy(szSpoolFile,"lp.out");
else
strcpy(szSpoolFile, pszOutput);
return -1;
if ((fd = open(szSpoolFile, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
PROFILE_GetWineIniString( "spooler", pszOutput, "",
psCmd, sizeof(psCmd) );
printf("Got printerSpoolCOmmand \"%s\"\n",psCmd);
if (!*psCmd)
psCmdP = pszOutput;
else
{
printf("Failed to create spool file %s, errno = %d\n", szSpoolFile, errno);
while (*psCmdP && isspace(*psCmdP))
{
psCmdP++;
};
if (!*psCmdP)
return -1;
}
if (*psCmdP == '|')
{
int fds[2];
if (pipe(fds))
return -1;
if (fork() == 0)
{
psCmdP++;
printf("In child need to exec %s\n",psCmdP);
close(0);
dup2(fds[0],0);
close (fds[1]);
system(psCmdP);
exit(0);
}
close (fds[0]);
fd = fds[1];
printf("Need to execut a command and pipe the output to it\n");
}
else
{
printf("Just assume its a file\n");
if ((fd = open(psCmdP, O_CREAT | O_TRUNC | O_WRONLY , 0600)) < 0)
{
printf("Failed to create spool file %s, errno = %d\n", psCmdP, errno);
}
}
return fd;
}

View File

@ -433,8 +433,8 @@ BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle,
* RealizeObject (ordinal 10)
*/
DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
LPVOID lpInObj, LPVOID lpOutObj,
LPTEXTXFORM16 lpTextXForm)
LPVOID lpInObj, LPVOID lpOutObj,
SEGPTR lpTextXForm)
{
WORD dwRet = 0;
LOADED_PRINTER_DRIVER *pLPD = NULL;
@ -473,14 +473,7 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
lP4 = (LONG)lpOutObj;
if (lpTextXForm != NULL)
{
lP5 = SegPtr;
nSize = sizeof(TEXTXFORM16);
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP5 = 0L;
lP5 = lpTextXForm;
dwRet = CallTo16_long_lwlll(pLPD->fn[FUNC_REALIZEOBJECT],
lP1, wP2, lP3, lP4, lP5);
@ -493,8 +486,8 @@ DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
SEGPTR lpFontInfo, LPDRAWMODE lpDrawMode,
LPTEXTXFORM16 lpTextXForm, SHORT *lpCharWidths,
SEGPTR lpFontInfo, SEGPTR lpDrawMode,
SEGPTR lpTextXForm, SHORT *lpCharWidths,
RECT16 * lpOpaqueRect, WORD wOptions)
{
DWORD dwRet = 0;
@ -550,27 +543,8 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
/* This should be realized by the driver, so in 16bit data area */
lP7 = lpFontInfo;
if (lpDrawMode != NULL)
{
lP8 = SegPtr;
nSize = sizeof(DRAWMODE);
dprintf_win16drv(stddeb, "adding lpDrawMode\n");
AddData(&SegPtr, lpDrawMode, nSize, Limit);
}
else
lP8 = 0L;
if (lpTextXForm != NULL)
{
lP9 = SegPtr;
nSize = sizeof(TEXTXFORM16);
dprintf_win16drv(stddeb, "Adding TextXForm\n");
AddData(&SegPtr, lpTextXForm, nSize, Limit);
}
else
lP9 = 0L;
lP8 = lpDrawMode;
lP9 = lpTextXForm;
if (lpCharWidths != NULL)
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: Char widths not supported\n");
@ -595,9 +569,9 @@ DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
lP1, wP2, wP3, lP4,
lP5, iP6, lP7, lP8, lP9, lP10,
lP11, wP12);
if (lpDrawMode)
GetParamData(lP8, lpDrawMode, sizeof(DRAWMODE));
}
dprintf_win16drv(stddeb, "PRTDRV_ExtTextOut: return %lx\n", dwRet);
return dwRet;
}

View File

@ -22,14 +22,9 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
{
WIN16DRV_PDEVICE *physDev = (WIN16DRV_PDEVICE *)dc->physDev;
BOOL32 bRet = 1;
extern DRAWMODE DrawMode;
LPDRAWMODE lpDrawMode = &DrawMode;
TEXTXFORM16 TextXForm;
LPTEXTXFORM16 lpTextXForm = &TextXForm;
RECT16 rcClipRect;
RECT16 * lpClipRect = &rcClipRect;
RECT16 rcOpaqueRect;
RECT16 *lpOpaqueRect = &rcOpaqueRect;
RECT16 clipRect;
RECT16 opaqueRect;
RECT16 *lpOpaqueRect = NULL;
WORD wOptions = 0;
WORD wCount = count;
@ -43,7 +38,6 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut: %04x %d %d %x %p %*s %p\n", dc->hSelf, x, y,
flags, lprect, count > 0 ? count : 8, str, lpDx);
InitTextXForm(lpTextXForm);
if (bInit == FALSE)
{
@ -51,50 +45,30 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, " ",
-1, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
-1, physDev->segptrFontInfo, win16drv_SegPtr_DrawMode,
win16drv_SegPtr_TextXForm, NULL, NULL, 0);
bInit = TRUE;
}
if (dc != NULL)
{
DWORD dwRet;
/*
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, "0",
-1, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, 0, 0,
NULL, str, -wCount,
physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, 0);
*/
clipRect.left = 0;
clipRect.top = 0;
clipRect.right = dc->w.devCaps->horzRes;
clipRect.bottom = dc->w.devCaps->vertRes;
if (lprect)
{
opaqueRect.left = lprect->left;
opaqueRect.top = lprect->top;
opaqueRect.right = lprect->right;
opaqueRect.bottom = lprect->bottom;
lpOpaqueRect = &opaqueRect;
}
#ifdef NOTDEF
lpClipRect->left = lprect->left ;
lpClipRect->top = lprect->top;
lpClipRect->right = lprect->right;
lpClipRect->bottom = lprect->bottom;
dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut Clip rect left %d top %d rigt %d bottom %d\n",
lpClipRect->left,lpClipRect->top,lpClipRect->right,lpClipRect->bottom);
#endif
lpClipRect->left = 0;
lpClipRect->top = 0;
lpClipRect->right = 0x3fc;
lpClipRect->bottom = 0x630;
dprintf_win16drv(stddeb, "WIN16DRV_ExtTextOut Clip rect left %d top %d rigt %d bottom %d\n",
lpClipRect->left,lpClipRect->top,lpClipRect->right,lpClipRect->bottom);
lpOpaqueRect->left = x;
lpOpaqueRect->top = y;
lpOpaqueRect->right = 0x3a1;
lpOpaqueRect->bottom = 0x01;
printf("drawmode ropt 0x%x bkMode 0x%x bkColor 0x%lx textColor 0x%lx tbbreakExtra 0x%x breakextra 0x%x\n",
lpDrawMode->Rop2, lpDrawMode->bkMode, lpDrawMode->bkColor,
lpDrawMode->TextColor, lpDrawMode->TBreakExtra, lpDrawMode->BreakExtra);
printf("breakerr 0x%x breakrem 0x%x breakcount 0x%x chextra 0x%x lbkcolor 0x%lx ltextcolor 0x%lx\n",
lpDrawMode->BreakErr, lpDrawMode->BreakRem, lpDrawMode->BreakCount,
lpDrawMode->CharExtra, lpDrawMode->LbkColor, lpDrawMode->LTextColor);
{
RECT16 rcPageSize;
FONTINFO16 *p = (FONTINFO16 *)PTR_SEG_TO_LIN(physDev->segptrFontInfo);
@ -121,18 +95,12 @@ BOOL32 WIN16DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
}
}
#endif
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, x, y,
lpClipRect, str,
wCount, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, NULL, NULL, wOptions);
/*
dwRet = PRTDRV_ExtTextOut(physDev->segptrPDEVICE, x, y,
lpClipRect, str,
wCount, physDev->segptrFontInfo, lpDrawMode,
lpTextXForm, lpDx, NULL, flags);
*/
&clipRect, str,
wCount, physDev->segptrFontInfo, win16drv_SegPtr_DrawMode,
win16drv_SegPtr_TextXForm, NULL, lpOpaqueRect, wOptions);
}
return bRet;
}

View File

@ -10,7 +10,7 @@ C_SRCS = \
bitmap.c \
brush.c \
clipping.c \
font.c \
xfont.c \
graphics.c \
init.c \
objects.c \

View File

@ -1,522 +0,0 @@
/*
* X11 driver font functions
*
* Copyright 1996 Alexandre Julliard
*/
#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;
#define CI_NONEXISTCHAR(cs) (((cs)->width == 0) && \
(((cs)->rbearing|(cs)->lbearing| \
(cs)->ascent|(cs)->descent) == 0))
/*
* CI_GET_CHAR_INFO - return the charinfo struct for the indicated 8bit
* character. If the character is in the column and exists, then return the
* appropriate metrics (note that fonts with common per-character metrics will
* return min_bounds). If none of these hold true, try again with the default
* char.
*/
#define CI_GET_CHAR_INFO(fs,col,def,cs) \
{ \
cs = def; \
if (col >= fs->min_char_or_byte2 && col <= fs->max_char_or_byte2) { \
if (fs->per_char == NULL) { \
cs = &fs->min_bounds; \
} else { \
cs = &fs->per_char[(col - fs->min_char_or_byte2)]; \
if (CI_NONEXISTCHAR(cs)) cs = def; \
} \
} \
}
#define CI_GET_DEFAULT_INFO(fs,cs) \
CI_GET_CHAR_INFO(fs, fs->default_char, NULL, cs)
/***********************************************************************
* 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
*/
BOOL32 X11DRV_GetTextExtentPoint( DC *dc, LPCSTR str, INT32 count,
LPSIZE32 size )
{
int dir, ascent, descent;
XCharStruct info;
XTextExtents( dc->u.x.font.fstruct, str, count, &dir,
&ascent, &descent, &info );
size->cx = abs((info.width + dc->w.breakRem + count * dc->w.charExtra)
* dc->wndExtX / dc->vportExtX);
size->cy = abs((dc->u.x.font.fstruct->ascent+dc->u.x.font.fstruct->descent)
* dc->wndExtY / dc->vportExtY);
return TRUE;
}
BOOL32 X11DRV_GetTextMetrics(DC *dc, TEXTMETRIC32A *metrics)
{
metrics->tmWeight = dc->u.x.font.metrics.tmWeight;
metrics->tmOverhang = dc->u.x.font.metrics.tmOverhang;
metrics->tmDigitizedAspectX = dc->u.x.font.metrics.tmDigitizedAspectX;
metrics->tmDigitizedAspectY = dc->u.x.font.metrics.tmDigitizedAspectY;
metrics->tmFirstChar = dc->u.x.font.metrics.tmFirstChar;
metrics->tmLastChar = dc->u.x.font.metrics.tmLastChar;
metrics->tmDefaultChar = dc->u.x.font.metrics.tmDefaultChar;
metrics->tmBreakChar = dc->u.x.font.metrics.tmBreakChar;
metrics->tmItalic = dc->u.x.font.metrics.tmItalic;
metrics->tmUnderlined = dc->u.x.font.metrics.tmUnderlined;
metrics->tmStruckOut = dc->u.x.font.metrics.tmStruckOut;
metrics->tmPitchAndFamily = dc->u.x.font.metrics.tmPitchAndFamily;
metrics->tmCharSet = dc->u.x.font.metrics.tmCharSet;
metrics->tmAscent = abs( dc->u.x.font.metrics.tmAscent
* dc->wndExtY / dc->vportExtY );
metrics->tmDescent = abs( dc->u.x.font.metrics.tmDescent
* dc->wndExtY / dc->vportExtY );
metrics->tmHeight = dc->u.x.font.metrics.tmAscent + dc->u.x.font.metrics.tmDescent;
metrics->tmInternalLeading = abs( dc->u.x.font.metrics.tmInternalLeading
* dc->wndExtY / dc->vportExtY );
metrics->tmExternalLeading = abs( dc->u.x.font.metrics.tmExternalLeading
* dc->wndExtY / dc->vportExtY );
metrics->tmMaxCharWidth = abs( dc->u.x.font.metrics.tmMaxCharWidth
* dc->wndExtX / dc->vportExtX );
metrics->tmAveCharWidth = abs( dc->u.x.font.metrics.tmAveCharWidth
* dc->wndExtX / dc->vportExtX );
return TRUE;
}
/***********************************************************************
* X11DRV_FONT_SelectObject
*
* FIXME: the fonts should not be cached by hfont only, because
* metrics may be different in an other DC.
*/
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;
}
/***********************************************************************
* GetCharWidth32A (GDI32.155)
*/
BOOL32 X11DRV_GetCharWidth( DC *dc, UINT32 firstChar, UINT32 lastChar,
LPINT32 buffer )
{
int i, width;
XFontStruct *xfont;
XCharStruct *cs, *def;
xfont = dc->u.x.font.fstruct;
/* fixed font? */
if (xfont->per_char == NULL)
{
for (i = firstChar; i <= lastChar; i++)
*buffer++ = xfont->max_bounds.width;
return TRUE;
}
CI_GET_DEFAULT_INFO(xfont, def);
for (i = firstChar; i <= lastChar; i++)
{
CI_GET_CHAR_INFO( xfont, i, def, cs );
width = cs ? cs->width : xfont->max_bounds.width;
*buffer++ = MAX( width, 0 );
}
return TRUE;
}

View File

@ -6,14 +6,16 @@
#include <string.h>
#include "x11drv.h"
#include "color.h"
#include "bitmap.h"
#include "gdi.h"
static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
LPCSTR output, const DEVMODE16* initData );
static BOOL32 X11DRV_DeleteDC( DC *dc );
static INT32 X11DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
SEGPTR lpInData, SEGPTR lpOutData );
static const DC_FUNCTIONS X11DRV_Funcs =
{
X11DRV_Arc, /* pArc */
@ -23,13 +25,13 @@ static const DC_FUNCTIONS X11DRV_Funcs =
X11DRV_DeleteDC, /* pDeleteDC */
NULL, /* pDeleteObject */
X11DRV_Ellipse, /* pEllipse */
NULL, /* pEnumDeviceFonts */
NULL, /* pEscape */
X11DRV_EnumDeviceFonts, /* pEnumDeviceFonts */
X11DRV_Escape, /* pEscape */
NULL, /* pExcludeClipRect */
NULL, /* pExcludeVisRect */
X11DRV_ExtFloodFill, /* pExtFloodFill */
X11DRV_ExtTextOut, /* pExtTextOut */
NULL, /* pGetCharWidth */
X11DRV_GetCharWidth, /* pGetCharWidth */
X11DRV_GetPixel, /* pGetPixel */
X11DRV_GetTextExtentPoint, /* pGetTextExtentPoint */
X11DRV_GetTextMetrics, /* pGetTextMetrics */
@ -79,13 +81,65 @@ static const DC_FUNCTIONS X11DRV_Funcs =
NULL /* pStretchDIBits */
};
static DeviceCaps X11DRV_DevCaps;
static DeviceCaps X11DRV_DevCaps = {
/* version */ 0,
/* technology */ DT_RASDISPLAY,
/* size, resolution */ 0, 0, 0, 0, 0,
/* device objects */ 1, 16 + 6, 16, 0, 0, 100, 0,
/* curve caps */ CC_CIRCLES | CC_PIE | CC_CHORD | CC_ELLIPSES |
CC_WIDE | CC_STYLED | CC_WIDESTYLED | CC_INTERIORS | CC_ROUNDRECT,
/* line caps */ LC_POLYLINE | LC_MARKER | LC_POLYMARKER | LC_WIDE |
LC_STYLED | LC_WIDESTYLED | LC_INTERIORS,
/* polygon caps */ PC_POLYGON | PC_RECTANGLE | PC_WINDPOLYGON |
PC_SCANLINE | PC_WIDE | PC_STYLED | PC_WIDESTYLED | PC_INTERIORS,
/* text caps */ 0,
/* regions */ CP_REGION,
/* raster caps */ RC_BITBLT | RC_BANDING | RC_SCALING | RC_BITMAP64 |
RC_DI_BITMAP | RC_DIBTODEV | RC_BIGFONT | RC_STRETCHBLT | RC_STRETCHDIB | RC_DEVBITS,
/* aspects */ 36, 36, 51,
/* pad1 */ { 0 },
/* log pixels */ 0, 0,
/* pad2 */ { 0 },
/* palette size */ 0,
/* ..etc */ 0, 0 };
/**********************************************************************
* X11DRV_Init
*/
BOOL32 X11DRV_Init(void)
{
extern BOOL32 COLOR_Init();
/* FIXME: colormap management should be merged with the X11DRV */
if( !COLOR_Init() ) return FALSE;
/* Finish up device caps */
#if 0
printf("Display:\nHeight = %-4i pxl, %-4i mm\nWidth = %-4i pxl, %-4i mm\n",
HeightOfScreen(screen), HeightMMOfScreen(screen),
WidthOfScreen(screen), WidthMMOfScreen(screen) );
#endif
X11DRV_DevCaps.version = 0x300;
X11DRV_DevCaps.horzSize = WidthMMOfScreen(screen) * screenWidth / WidthOfScreen(screen);
X11DRV_DevCaps.vertSize = HeightMMOfScreen(screen) * screenHeight / HeightOfScreen(screen);
X11DRV_DevCaps.horzRes = screenWidth;
X11DRV_DevCaps.vertRes = screenHeight;
X11DRV_DevCaps.bitsPixel = screenDepth;
if( COLOR_GetSystemPaletteFlags() & COLOR_VIRTUAL )
X11DRV_DevCaps.sizePalette = 0;
else
{
X11DRV_DevCaps.rasterCaps |= RC_PALETTE;
X11DRV_DevCaps.sizePalette = DefaultVisual(display,DefaultScreen(display))->map_entries;
}
X11DRV_DevCaps.logPixelsX = (int)(X11DRV_DevCaps.horzRes * 25.4 / X11DRV_DevCaps.horzSize);
X11DRV_DevCaps.logPixelsY = (int)(X11DRV_DevCaps.vertRes * 25.4 / X11DRV_DevCaps.vertSize);
/* Create default bitmap */
if (!X11DRV_BITMAP_Init()) return FALSE;
@ -94,14 +148,13 @@ BOOL32 X11DRV_Init(void)
if (!X11DRV_BRUSH_Init()) return FALSE;
/* Initialize fonts */
/* Initialize fonts and text caps */
if (!X11DRV_FONT_Init()) return FALSE;
if (!X11DRV_FONT_Init( &X11DRV_DevCaps )) return FALSE;
return DRIVER_RegisterDriver( "DISPLAY", &X11DRV_Funcs );
}
/**********************************************************************
* X11DRV_CreateDC
*/
@ -110,8 +163,6 @@ static BOOL32 X11DRV_CreateDC( DC *dc, LPCSTR driver, LPCSTR device,
{
X11DRV_PDEVICE *physDev;
if (!X11DRV_DevCaps.version) DC_FillDevCaps( &X11DRV_DevCaps );
physDev = &dc->u.x; /* for now */
memset( physDev, 0, sizeof(*physDev) );
@ -157,3 +208,24 @@ static BOOL32 X11DRV_DeleteDC( DC *dc )
XFreeGC( display, physDev->gc );
return TRUE;
}
/**********************************************************************
* X11DRV_Escape
*/
static INT32 X11DRV_Escape( DC *dc, INT32 nEscape, INT32 cbInput,
SEGPTR lpInData, SEGPTR lpOutData )
{
switch( nEscape )
{
case GETSCALINGFACTOR:
if( lpOutData )
{
LPPOINT16 lppt = (LPPOINT16)PTR_SEG_TO_LIN(lpOutData);
lppt->x = lppt->y = 0; /* no device scaling */
return 1;
}
break;
}
return 0;
}

View File

@ -12,7 +12,7 @@
#include "gdi.h"
/*#include "callback.h"*/
#include "heap.h"
#include "x11drv.h"
#include "x11font.h"
#include "stddebug.h"
/* #define DEBUG_TEXT */
#include "debug.h"
@ -32,21 +32,29 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
const RECT32 *lprect, LPCSTR str, UINT32 count,
const INT32 *lpDx )
{
HRGN32 hRgnClip = 0;
int dir, ascent, descent, i;
XCharStruct info;
XFontStruct *font;
RECT32 rect;
HRGN32 hRgnClip = 0;
int dir, ascent, descent, i;
fontObject* pfo;
XCharStruct info;
XFontStruct* font;
RECT32 rect;
char dfBreakChar, lfUnderline, lfStrikeOut;
if (!DC_SetupGCForText( dc )) return TRUE;
font = dc->u.x.font.fstruct;
dprintf_text(stddeb,"ExtTextOut: hdc=%04x %d,%d '%.*s', %d flags=%d\n",
dc->hSelf, x, y, (int)count, str, count, flags);
pfo = XFONT_GetFontObject( dc->u.x.font );
font = pfo->fs;
dfBreakChar = (char)pfo->fi->df.dfBreakChar;
lfUnderline = (pfo->fo_flags & FO_SYNTH_UNDERLINE) ? 1 : 0;
lfStrikeOut = (pfo->fo_flags & FO_SYNTH_STRIKEOUT) ? 1 : 0;
dprintf_text(stddeb,"ExtTextOut: hdc=%04x df=%04x %d,%d '%.*s', %d flags=%d\n",
dc->hSelf, (UINT16)(dc->u.x.font), x, y, (int)count, str, count, flags);
if (lprect != NULL) dprintf_text(stddeb, "\trect=(%d,%d- %d,%d)\n",
lprect->left, lprect->top,
lprect->right, lprect->bottom );
/* Setup coordinates */
if (dc->w.textAlign & TA_UPDATECP)
@ -106,7 +114,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
/* sum lpDx array and add the width of last character */
info.width = XTextWidth( font, str + count - 1, 1) + dc->w.charExtra;
if (str[count-1] == (char)dc->u.x.font.metrics.tmBreakChar)
if (str[count-1] == dfBreakChar)
info.width += dc->w.breakExtra;
for (i = 0; i < count; i++) info.width += lpDx[i];
@ -211,7 +219,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
else
{
delta += dc->w.charExtra;
if (str[i] == (char)dc->u.x.font.metrics.tmBreakChar)
if (str[i] == (char)dfBreakChar)
delta += dc->w.breakExtra;
}
pitem->nchars++;
@ -227,9 +235,10 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
/* Draw underline and strike-out if needed */
if (dc->u.x.font.metrics.tmUnderlined)
if (lfUnderline)
{
long linePos, lineWidth;
if (!XGetFontProperty( font, XA_UNDERLINE_POSITION, &linePos ))
linePos = font->descent-1;
if (!XGetFontProperty( font, XA_UNDERLINE_THICKNESS, &lineWidth ))
@ -241,7 +250,7 @@ X11DRV_ExtTextOut( DC *dc, INT32 x, INT32 y, UINT32 flags,
dc->w.DCOrgX + x, dc->w.DCOrgY + y + linePos,
dc->w.DCOrgX + x + info.width, dc->w.DCOrgY + y + linePos );
}
if (dc->u.x.font.metrics.tmStruckOut)
if (lfStrikeOut)
{
long lineAscent, lineDescent;
if (!XGetFontProperty( font, XA_STRIKEOUT_ASCENT, &lineAscent ))

2024
graphics/x11drv/xfont.c Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,6 +1,6 @@
name advapi32
type win32
base 1
base 0
0000 stub AbortSystemShutdownA
0001 stub AbortSystemShutdownW
@ -14,7 +14,7 @@ base 1
0009 stub AdjustTokenGroups
0010 stub AdjustTokenPrivileges
0011 stdcall AllocateAndInitializeSid(ptr long long long long long long long long long ptr) AllocateAndInitializeSid
0012 stub AllocateLocallyUniqueId
0012 stdcall AllocateLocallyUniqueId(ptr) AllocateLocallyUniqueId
0013 stub AreAllAccessesGranted
0014 stub AreAnyAccessesGranted
0015 stub BackupEventLogA
@ -68,7 +68,7 @@ base 1
0063 stdcall GetSidLengthRequired(long) GetSidLengthRequired
0064 stdcall GetSidSubAuthority(ptr long) GetSidSubAuthority
0065 stdcall GetSidSubAuthorityCount(ptr) GetSidSubAuthorityCount
0066 stub GetTokenInformation
0066 stdcall GetTokenInformation(long long ptr long ptr) GetTokenInformation
0067 stdcall GetUserNameA(ptr ptr) GetUserName32A
0068 stdcall GetUserNameW(ptr ptr) GetUserName32W
0069 stub ImpersonateLoggedOnUser
@ -112,11 +112,11 @@ base 1
0107 stub OpenEventLogA
0108 stub OpenEventLogW
0109 stdcall OpenProcessToken(long long ptr) OpenProcessToken
0110 stub OpenSCManagerA
0111 stub OpenSCManagerW
0110 stdcall OpenSCManagerA(ptr ptr long) OpenSCManagerA
0111 stdcall OpenSCManagerW(ptr ptr long) OpenSCManagerW
0112 stub OpenServiceA
0113 stub OpenServiceW
0114 stub OpenThreadToken
0114 stdcall OpenThreadToken(long long long ptr) OpenThreadToken
0115 stub PrivilegeCheck
0116 stub PrivilegedServiceAuditAlarmA
0117 stub PrivilegedServiceAuditAlarmW
@ -188,7 +188,7 @@ base 1
0183 stub SetFileSecurityW
0184 stub SetKernelObjectSecurity
0185 stub SetPrivateObjectSecurity
0186 stub SetSecurityDescriptorDacl
0186 stdcall SetSecurityDescriptorDacl(ptr long ptr long) RtlSetDaclSecurityDescriptor
0187 stub SetSecurityDescriptorGroup
0188 stub SetSecurityDescriptorOwner
0189 stub SetSecurityDescriptorSacl

View File

@ -148,9 +148,9 @@ static BUILTIN_DLL BuiltinDLLs[] =
/* Win32 DLLs */
{ &ADVAPI32_Descriptor, 0 },
{ &COMCTL32_Descriptor, DLL_FLAG_NOT_USED },
{ &COMDLG32_Descriptor, 0 },
{ &COMDLG32_Descriptor, DLL_FLAG_NOT_USED },
{ &CRTDLL_Descriptor, 0 },
{ &OLE32_Descriptor, 0 },
{ &OLE32_Descriptor, DLL_FLAG_NOT_USED },
{ &GDI32_Descriptor, 0 },
{ &KERNEL32_Descriptor, DLL_FLAG_ALWAYS_USED },
{ &LZ32_Descriptor, 0 },

View File

@ -144,7 +144,7 @@ base 1
0136 stub GdiPlayScript
0137 stub GdiReleaseLocalDC
0138 stub GdiSetAttrs
0139 stub GdiSetBatchLimit
0139 return GdiSetBatchLimit 4 1
0140 stub GdiSetServerAttr
0141 stub GetArcDirection
0142 stub GetAspectRatioFilterEx

View File

@ -225,7 +225,7 @@ type win16
227 pascal RegFlushKey(long) RegFlushKey
228 stub K228
229 stub K229
230 stub GlobalSmartPageLock
230 pascal GlobalSmartPageLock(word) GlobalPageLock #?
231 stub GlobalSmartPageUnlock
232 stub RegLoadKey
233 stub RegUnloadKey
@ -243,8 +243,8 @@ type win16
319 stub FlushCachedFileHandle
320 pascal16 IsTask(word) IsTask
323 return IsRomModule 2 0
324 stub LogError
325 stub LogParamError
324 pascal16 LogError(word ptr) LogError
325 pascal16 LogParamError(word ptr ptr) LogParamError
326 return IsRomFile 2 0
327 stub KERNEL_327
328 stub _DebugOutput
@ -320,7 +320,7 @@ type win16
514 stub FreeLibrary32W
515 pascal GetProcAddress32W(long ptr) GetProcAddress32
516 stub GetVDMPointer32W
517 stub CallProc32W
517 pascal CallProc32W() WIN16_CallProc32W
518 stub CallProcEx32W
519 stub KERNEL_519
522 stub KERNEL_522

File diff suppressed because it is too large Load Diff

View File

@ -3,7 +3,7 @@ type win32
0009 stub DllCanUnloadNow
0010 stub DllGetClassObject
0025 stub MultinetGetConnectionPerformanceA
0025 stdcall MultinetGetConnectionPerformanceA(ptr ptr) MultinetGetConnectionPerformance32A
0026 stub MultinetGetConnectionPerformanceW
0027 stub MultinetGetErrorTextA
0028 stub MultinetGetErrorTextW

View File

@ -886,7 +886,7 @@ base 0
882 stub _wcsupr
883 stub abs
884 stub atan
885 stub atoi
885 stdcall atoi(ptr) CRTDLL_atoi
886 stub atol
887 stub ceil
888 stub cos

View File

@ -10,6 +10,8 @@
#include "module.h"
#include "stackframe.h"
#include "task.h"
#include "callback.h"
#include "xmalloc.h"
#include "stddebug.h"
/* #define DEBUG_RELAY */
#include "debug.h"
@ -373,3 +375,51 @@ INT16 Throw( LPCATCHBUF lpbuf, INT16 retval )
}
return retval;
}
/**********************************************************************
* CallProc32W (KERNEL.56)
*/
DWORD
WIN16_CallProc32W() {
DWORD *win_stack = (DWORD *)CURRENT_STACK16->args;
DWORD nrofargs = win_stack[0];
DWORD argconvmask = win_stack[1];
FARPROC32 proc32 = (FARPROC32)win_stack[2];
DWORD *args,ret;
int i;
fprintf(stderr,"CallProc32W(%ld,%ld,%p,args[",nrofargs,argconvmask,proc32);
args = (DWORD*)xmalloc(sizeof(DWORD)*nrofargs);
for (i=nrofargs;i--;) {
if (argconvmask & (1<<i)) {
args[nrofargs-i] = (DWORD)PTR_SEG_TO_LIN(win_stack[3+i]);
fprintf(stderr,"%08lx(%p),",win_stack[3+i],PTR_SEG_TO_LIN(win_stack[3+i]));
} else {
args[nrofargs-i] = win_stack[3+i];
fprintf(stderr,"%ld,",win_stack[3+i]);
}
}
fprintf(stderr,"]) - ");
switch (nrofargs) {
case 0: ret = CallTo32_0(proc32);
break;
case 1: ret = CallTo32_1(proc32,args[0]);
break;
case 2: ret = CallTo32_2(proc32,args[0],args[1]);
break;
case 3: ret = CallTo32_3(proc32,args[0],args[1],args[2]);
break;
case 4: ret = CallTo32_4(proc32,args[0],args[1],args[2],args[3]);
break;
case 5: ret = CallTo32_5(proc32,args[0],args[1],args[2],args[3],args[4]);
break;
default:
/* FIXME: should go up to 32 arguments */
fprintf(stderr,"CallProc32W: unsupported number of arguments %ld, please report.\n",nrofargs);
ret = 0;
break;
}
fprintf(stderr,"returns %08lx\n",ret);
free(args);
return ret;
}

View File

@ -51,7 +51,7 @@ type win16
WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
109 pascal16 WSASetBlockingHook(segptr) WSASetBlockingHook16
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook
110 pascal16 WSAUnhookBlockingHook() WSAUnhookBlockingHook16
111 pascal16 WSAGetLastError() WSAGetLastError
112 pascal WSASetLastError(word) WSASetLastError
113 pascal16 WSACancelBlockingCall() WSACancelBlockingCall

View File

@ -41,7 +41,7 @@ base 0
107 stub WSAAsyncGetServByName
108 stub WSACancelAsyncRequest
109 stdcall WSASetBlockingHook(ptr) WSASetBlockingHook32
110 stub WSAUnhookBlockingHook
110 stdcall WSAUnhookBlockingHook() WSAUnhookBlockingHook32
111 stub WSAGetLastError
112 stub WSASetLastError
113 stub WSACancelBlockingCall

View File

@ -14,7 +14,6 @@
#define PC_SYS_RESERVED 0x40 /* system palentry is not to be mapped to */
#define PC_SYS_MAPPED 0x10 /* logical palentry is a direct alias for system palentry */
extern HPALETTE16 COLOR_Init(void);
extern void COLOR_Cleanup(void);
extern COLORREF COLOR_ToLogical(int pixel);
extern int COLOR_ToPhysical( DC *dc, COLORREF color );

View File

@ -21,15 +21,9 @@ typedef struct
#pragma pack(4)
#define FONTCACHE 32 /* dynamic font cache size */
#define MAX_FONTS 256
extern LPLOGFONT16 lpLogFontList[MAX_FONTS+1];
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 int FONT_ParseFontParms(LPSTR lpFont, WORD wParmsNo, LPSTR lpRetStr, WORD wMaxSiz);
extern void FONT_GetMetrics( LOGFONT16 * logfont, XFontStruct * xfont,
TEXTMETRIC16 * metrics );
extern BOOL32 FONT_Init( UINT16* pTextCaps );
extern INT16 FONT_GetObject16( FONTOBJ * font, INT16 count, LPSTR buffer );
extern INT32 FONT_GetObject32A( FONTOBJ * font, INT32 count, LPSTR buffer );
#endif /* __WINE_FONT_H */

View File

@ -34,7 +34,7 @@ typedef struct tagGDIOBJHDR
} GDIOBJHDR;
typedef struct
typedef struct tagDeviceCaps
{
WORD version; /* 0: driver version */
WORD technology; /* 2: device technology */
@ -153,7 +153,7 @@ typedef struct tagDC_FUNCS
BOOL32 (*pDeleteDC)(DC*);
BOOL32 (*pDeleteObject)(HGDIOBJ16);
BOOL32 (*pEllipse)(DC*,INT32,INT32,INT32,INT32);
BOOL32 (*pEnumDeviceFonts)(DC*,LPLOGFONT32A,FONTENUMPROCEX32A,LPARAM);
BOOL32 (*pEnumDeviceFonts)(DC*,LPLOGFONT16,DEVICEFONTENUMPROC,LPARAM);
INT32 (*pEscape)(DC*,INT32,INT32,SEGPTR,SEGPTR);
INT32 (*pExcludeClipRect)(DC*,INT32,INT32,INT32,INT32);
INT32 (*pExcludeVisRect)(DC*,INT32,INT32,INT32,INT32);

View File

@ -23,12 +23,6 @@
extern LRESULT MDIClientWndProc(HWND16 hwnd, UINT16 message,
WPARAM16 wParam, LPARAM lParam); /* mdi.c */
typedef struct tagMDIWCL
{
HWND16 hChild;
struct tagMDIWCL *prev;
} MDIWCL;
typedef struct
{
UINT16 nActiveChildren;

View File

@ -32,6 +32,7 @@ extern FARPROC16 INT_GetHandler( BYTE intnum );
extern void INT_SetHandler( BYTE intnum, FARPROC16 handler );
/* msdos/ioports.c */
extern void IO_port_init (void);
extern DWORD IO_inport( int port, int count );
extern void IO_outport( int port, int count, DWORD value );

View File

@ -186,9 +186,9 @@ typedef struct {
UINT16 wPid; /* product ID */
VERSION vDriverVersion; /* version of the driver */
char szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
DWORD dwFormats; /* formats supported */
DWORD dwFormats WINE_PACKED; /* formats supported */
UINT16 wChannels; /* number of sources supported */
DWORD dwSupport; /* functionality supported by driver */
DWORD dwSupport WINE_PACKED; /* functionality supported by driver */
} WAVEOUTCAPS, *LPWAVEOUTCAPS;
#define WAVECAPS_PITCH 0x0001 /* supports pitch control */
@ -202,7 +202,7 @@ typedef struct {
UINT16 wPid; /* product ID */
VERSION vDriverVersion; /* version of the driver */
char szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
DWORD dwFormats; /* formats supported */
DWORD dwFormats WINE_PACKED; /* formats supported */
UINT16 wChannels; /* number of channels supported */
} WAVEINCAPS, *LPWAVEINCAPS;
@ -335,7 +335,7 @@ typedef struct {
UINT16 wVoices; /* # of voices (internal synth only) */
UINT16 wNotes; /* max # of notes (internal synth only) */
UINT16 wChannelMask; /* channels used (internal synth only) */
DWORD dwSupport; /* functionality supported by driver */
DWORD dwSupport WINE_PACKED; /* functionality supported by driver */
} MIDIOUTCAPS, *LPMIDIOUTCAPS;
#define MOD_MIDIPORT 1 /* output port */
@ -423,7 +423,7 @@ typedef struct {
VERSION vDriverVersion; /* version of the driver */
char szPname[MAXPNAMELEN]; /* product name (NULL terminated string) */
UINT16 wTechnology; /* type of device */
DWORD dwSupport; /* functionality supported by driver */
DWORD dwSupport WINE_PACKED; /* functionality supported by driver */
} AUXCAPS, *LPAUXCAPS;
#define AUXCAPS_CDAUDIO 1 /* audio from internal CD-ROM drive */
@ -1364,6 +1364,7 @@ typedef struct {
#define WODM_GETPLAYBACKRATE 18
#define WODM_SETPLAYBACKRATE 19
#define WODM_BREAKLOOP 20
#define WODM_STOP 21
#define WIDM_GETNUMDEVS 50
#define WIDM_GETDEVCAPS 51
@ -1376,6 +1377,7 @@ typedef struct {
#define WIDM_STOP 58
#define WIDM_RESET 59
#define WIDM_GETPOS 60
#define WIDM_PAUSE 61
#define MODM_GETNUMDEVS 1
#define MODM_GETDEVCAPS 2

View File

@ -7,22 +7,44 @@
#include "wintypes.h"
/*
* Old MZ header for DOS programs. Actually just a couple of fields
* from it, so that we can find the start of the NE header.
* Old MZ header for DOS programs.
* We check only the magic and the e_lfanew offset to the new executable
* header.
*/
struct mz_header_s
typedef struct
{
WORD mz_magic; /* MZ Header signature */
BYTE dont_care[0x3a]; /* MZ Header stuff */
WORD ne_offset; /* Offset to extended header */
};
WORD e_magic; /* MZ Header signature */
WORD e_cblp; /* Bytes on last page of file */
WORD e_cp; /* Pages in file */
WORD e_crlc; /* Relocations */
WORD e_cparhdr; /* Size of header in paragraphs */
WORD e_minalloc; /* Minimum extra paragraphs needed */
WORD e_maxalloc; /* Maximum extra paragraphs needed */
WORD e_ss; /* Initial (relative) SS value */
WORD e_sp; /* Initial SP value */
WORD e_csum; /* Checksum */
WORD e_ip; /* Initial IP value */
WORD e_cs; /* Initial (relative) CS value */
WORD e_lfarlc; /* File address of relocation table */
WORD e_ovno; /* Overlay number */
WORD e_res[4]; /* Reserved words */
WORD e_oemid; /* OEM identifier (for e_oeminfo) */
WORD e_oeminfo; /* OEM information; e_oemid specific */
WORD e_res2[10]; /* Reserved words */
WORD e_lfanew; /* Offset to extended header */
} IMAGE_DOS_HEADER,*LPIMAGE_DOS_HEADER;
#define MZ_SIGNATURE ('M' | ('Z' << 8))
#define IMAGE_DOS_SIGNATURE 0x5A4D /* MZ */
#define IMAGE_OS2_SIGNATURE 0x454E /* NE */
#define IMAGE_OS2_SIGNATURE_LE 0x454C /* LE */
#define IMAGE_VXD_SIGNATURE 0x454C /* LE */
#define IMAGE_NT_SIGNATURE 0x00004550 /* PE00 */
/*
* This is the Windows executable (NE) header.
* the name IMAGE_OS2_HEADER is misleading, but in the SDK this way.
*/
struct ne_header_s
typedef struct
{
WORD ne_magic; /* 00 NE signature 'NE' */
BYTE linker_version; /* 02 Linker version number */
@ -56,10 +78,7 @@ struct ne_header_s
WORD fastload_length; /* 3a Length of fast load area */
WORD reserved2; /* 3c Reserved by Microsoft */
WORD expect_version; /* 3e Expected Windows version number */
};
#define NE_SIGNATURE ('N' | ('E' << 8))
#define PE_SIGNATURE ('P' | ('E' << 8))
} IMAGE_OS2_HEADER,*LPIMAGE_OS2_HEADER;
/*
* NE Header FORMAT FLAGS

View File

@ -9,9 +9,6 @@
#include "win.h"
extern void NC_GetMinMaxInfo( WND *pWnd, POINT16 *maxSize, POINT16 *maxPos,
POINT16 *minTrack, POINT16 *maxTrack );
extern void NC_DoNCPaint( HWND32 hwnd, HRGN32 clip, BOOL32 suppress_menupaint);
extern LONG NC_HandleNCPaint( HWND32 hwnd , HRGN32 clip);
extern LONG NC_HandleNCActivate( WND *pwnd, WPARAM16 wParam );
extern LONG NC_HandleNCCalcSize( WND *pWnd, RECT16 *winRect );

View File

@ -72,5 +72,6 @@ extern int PROFILE_GetWineIniString( const char *section, const char *key_name,
const char *def, char *buffer, int len );
extern int PROFILE_GetWineIniInt( const char *section, const char *key_name,
int def );
extern char* PROFILE_GetStringItem( char* );
#endif /* __WINE_OPTIONS_H */

View File

@ -9,6 +9,8 @@
#include "gdi.h"
#define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
/* GDI logical palette object */
typedef struct
{
@ -17,6 +19,7 @@ typedef struct
LOGPALETTE logpalette; /* _MUST_ be the last field */
} PALETTEOBJ;
extern HPALETTE16 PALETTE_Init();
extern int PALETTE_GetObject( PALETTEOBJ * palette, int count, LPSTR buffer );
extern BOOL32 PALETTE_DeleteObject( HPALETTE16 hpalette, PALETTEOBJ *palette );
extern BOOL32 PALETTE_UnrealizeObject( HPALETTE16 hpalette, PALETTEOBJ *palette);

View File

@ -5,15 +5,16 @@
#define __WINE_PEEXE_H
#include "wintypes.h"
#include "neexe.h"
typedef struct _IMAGE_FILE_HEADER {
WORD Machine;
WORD NumberOfSections;
DWORD TimeDateStamp;
DWORD PointerToSymbolTable;
DWORD NumberOfSymbols;
WORD SizeOfOptionalHeader;
WORD Characteristics;
WORD Machine; /* 00 */
WORD NumberOfSections; /* 02 */
DWORD TimeDateStamp; /* 04 */
DWORD PointerToSymbolTable; /* 08 */
DWORD NumberOfSymbols; /* 0c */
WORD SizeOfOptionalHeader; /* 10 */
WORD Characteristics; /* 12 */
} IMAGE_FILE_HEADER,*LPIMAGE_FILE_HEADER;
#define IMAGE_SIZEOF_FILE_HEADER 20
@ -328,17 +329,6 @@ typedef struct _IMAGE_BASE_RELOCATION
WORD TypeOffset[1];
} IMAGE_BASE_RELOCATION,*LPIMAGE_BASE_RELOCATION;
typedef struct _IMAGE_DEBUG_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
WORD MajorVersion;
WORD MinorVersion;
DWORD Type;
DWORD SizeOfData;
DWORD AddressOfRawData;
DWORD PointerToRawData;
} IMAGE_DEBUG_DIRECTORY,*LPIMAGE_DEBUG_DIRECTORY;
typedef struct _IMAGE_LOAD_CONFIG_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
@ -373,17 +363,16 @@ typedef struct _IMAGE_TLS_DIRECTORY {
* The IMAGE_DEBUG_DIRECTORY data directory points to an array of
* these structures.
*/
struct PE_Debug_dir
{
u_long flags;
u_long timestamp;
u_short major;
u_short minor;
u_long type;
u_long dbgsize;
u_long dbgptr;
u_long dbgoff;
};
typedef struct _IMAGE_DEBUG_DIRECTORY {
DWORD Characteristics;
DWORD TimeDateStamp;
WORD MajorVersion;
WORD MinorVersion;
DWORD Type;
DWORD SizeOfData;
DWORD AddressOfRawData;
DWORD PointerToRawData;
} IMAGE_DEBUG_DIRECTORY,*LPIMAGE_DEBUG_DIRECTORY;
/*
* The type field above can take these (plus a few other

View File

@ -95,6 +95,5 @@ extern int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd,
extern void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos );
extern void hardware_event( WORD message, WORD wParam, LONG lParam,
int xPos, int yPos, DWORD time, DWORD extraInfo );
extern void QUEUE_FlushMessages( HQUEUE16 hQueue );
#endif /* __WINE_QUEUE_H */

View File

@ -53,13 +53,9 @@
#ifdef WIN_95_LOOK
#define SYSMETRICS_CXMINTRACK 112
#define SYSMETRICS_CYMINTRACK 27
#define SYSMETRICS_CXICONSPACING 75
#define SYSMETRICS_CYICONSPACING 75
#else
#define SYSMETRICS_CXMINTRACK 100
#define SYSMETRICS_CYMINTRACK 28
#define SYSMETRICS_CXICONSPACING 20
#define SYSMETRICS_CYICONSPACING 20
#endif
/* Some non-constant system metrics */
@ -73,6 +69,8 @@
#define SYSMETRICS_CXDOUBLECLK sysMetrics[SM_CXDOUBLECLK]
#define SYSMETRICS_CYDOUBLECLK sysMetrics[SM_CYDOUBLECLK]
#define SYSMETRICS_MENUDROPALIGNMENT sysMetrics[SM_MENUDROPALIGNMENT]
#define SYSMETRICS_CXICONSPACING sysMetrics[SM_CXICONSPACING]
#define SYSMETRICS_CYICONSPACING sysMetrics[SM_CYICONSPACING]
extern void SYSMETRICS_Init(void);
extern short sysMetrics[SM_CMETRICS+1];

View File

@ -274,7 +274,7 @@ BOOL16 NotifyRegister(HTASK16 htask,FARPROC16 lpfnCallback,WORD wFlags);
#define NFY_UNKNOWN 0
#define NFY_LOADSEG 1
/* DATA is a pointer to following struct: */
struct {
typedef struct {
DWORD dwSize;
WORD wSelector;
WORD wSegNum;
@ -286,7 +286,7 @@ struct {
/* called when loading/starting a DLL */
#define NFY_STARTDLL 3
struct {
typedef struct {
DWORD dwSize;
HMODULE16 hModule;
WORD wCS;
@ -304,7 +304,7 @@ struct {
/* RIP? debugevent */
#define NFY_RIP 7
struct {
typedef struct {
DWORD dwSize;
WORD wIP;
WORD wCS;
@ -331,7 +331,7 @@ struct {
/* log errors */
#define NFY_LOGERROR 12
struct {
typedef struct {
DWORD dwSize;
UINT16 wErrCode;
VOID *lpInfo; /* depends on wErrCode */
@ -339,7 +339,7 @@ struct {
/* called for parameter errors? */
#define NFY_LOGPARAMERROR 13
struct {
typedef struct {
DWORD dwSize;
UINT16 wErrCode;
FARPROC16 lpfnErrorAddr;

View File

@ -83,7 +83,7 @@
/* output (returned) */
#define VFF_CURNEDEST 0x0001
#define VFF_FILEINUSE 0x0002
#define VFF_BUFFTOSMALL 0x0003
#define VFF_BUFFTOOSMALL 0x0004
/* VerInstallFile Flags */
/* input */

View File

@ -40,6 +40,7 @@ typedef enum
BIC32_SCROLL,
BIC32_DESKTOP,
BIC32_DIALOG,
BIC32_ICONTITLE,
BIC32_NB_CLASSES
} BUILTIN_CLASS32;
@ -62,9 +63,6 @@ typedef struct tagWND
HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */
RECT16 rectClient; /* Client area rel. to parent client area */
RECT16 rectWindow; /* Whole window rel. to parent client area */
RECT16 rectNormal; /* Window rect. when in normal state */
POINT16 ptIconPos; /* Icon position */
POINT16 ptMaxPos; /* Maximized window position */
LPSTR text; /* Window text */
void *pVScroll; /* Vertical scroll-bar info */
void *pHScroll; /* Horizontal scroll-bar info */
@ -83,6 +81,14 @@ typedef struct tagWND
DWORD wExtra[1]; /* Window extra bytes */
} WND;
typedef struct
{
RECT16 rectNormal;
POINT16 ptIconPos;
POINT16 ptMaxPos;
HWND16 hwndIconTitle;
} INTERNALPOS, *LPINTERNALPOS;
/* WND flags values */
#define WIN_NEEDS_BEGINPAINT 0x0001 /* WM_PAINT sent to window */
#define WIN_NEEDS_ERASEBKGND 0x0002 /* WM_ERASEBKGND must be sent to window*/
@ -97,34 +103,42 @@ typedef struct tagWND
#define WIN_ISWIN32 0x0400 /* Understands Win32 messages */
#define WIN_SAVEUNDER_OVERRIDE 0x0800
/* BuildWinArray() flags */
#define BWA_SKIPDISABLED 0x0001
#define BWA_SKIPHIDDEN 0x0002
#define BWA_SKIPOWNED 0x0004
#define BWA_SKIPICONIC 0x0008
/* Window functions */
extern WND *WIN_FindWndPtr( HWND32 hwnd );
extern WND *WIN_GetDesktop(void);
extern void WIN_DumpWindow( HWND32 hwnd );
extern void WIN_WalkWindows( HWND32 hwnd, int indent );
extern WND* WIN_FindWndPtr( HWND32 hwnd );
extern WND* WIN_GetDesktop(void);
extern void WIN_DumpWindow( HWND32 hwnd );
extern void WIN_WalkWindows( HWND32 hwnd, int indent );
extern Window WIN_GetXWindow( HWND32 hwnd );
extern BOOL32 WIN_UnlinkWindow( HWND32 hwnd );
extern BOOL32 WIN_LinkWindow( HWND32 hwnd, HWND32 hwndInsertAfter );
extern HWND32 WIN_FindWinToRepaint( HWND32 hwnd, HQUEUE16 hQueue );
extern void WIN_SendParentNotify( HWND32 hwnd, WORD event,
WORD idChild, LPARAM lValue );
extern void WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew );
extern void WIN_SendParentNotify( HWND32 hwnd, WORD event,
WORD idChild, LPARAM lValue );
extern void WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew );
extern BOOL32 WIN_CreateDesktopWindow(void);
extern HWND32 WIN_GetTopParent( HWND32 hwnd );
extern BOOL32 WIN_IsWindowDrawable(WND*, BOOL32 );
extern HINSTANCE16 WIN_GetWindowInstance( HWND32 hwnd );
extern WND **WIN_BuildWinArray( WND *wndPtr );
extern WND** WIN_BuildWinArray( WND *wndPtr, UINT32 bwa, UINT32* pnum );
extern void DEFWND_SetText( WND *wndPtr, LPCSTR text ); /* windows/defwnd.c */
extern void DEFWND_SetText( WND *wndPtr, LPCSTR text ); /* windows/defwnd.c */
extern void PROPERTY_RemoveWindowProps( WND *pWnd ); /* windows/property.c */
extern void PROPERTY_RemoveWindowProps( WND *pWnd ); /* windows/property.c */
extern BOOL32 PAINT_RedrawWindow( HWND32 hwnd, const RECT32 *rectUpdate,
HRGN32 hrgnUpdate, UINT32 flags,
UINT32 control ); /* windows/painting.c */
UINT32 control ); /* windows/painting.c */
extern BOOL32 WIDGETS_IsControl32( WND* pWnd, BUILTIN_CLASS32 cls ); /* controls/widgets.c */
extern HWND32 ICONTITLE_Create( WND* ); /* controls/icontitle.c */
extern Display * display;
extern Screen * screen;
extern Window rootWindow;

View File

@ -165,13 +165,13 @@ extern WORD PRTDRV_EnumDFonts(LPPDEVICE lpDestDev, LPSTR lpFaceName,
FARPROC16 lpCallbackFunc, LPVOID lpClientData);
extern DWORD PRTDRV_RealizeObject(LPPDEVICE lpDestDev, WORD wStyle,
LPVOID lpInObj, LPVOID lpOutObj,
LPTEXTXFORM16 lpTextXForm);
SEGPTR lpTextXForm);
extern BOOL16 PRTDRV_EnumObj(LPPDEVICE lpDestDev, WORD iStyle, FARPROC16 lpfn, LPVOID lpb);
extern DWORD PRTDRV_ExtTextOut(LPPDEVICE lpDestDev, WORD wDestXOrg, WORD wDestYOrg,
RECT16 *lpClipRect, LPCSTR lpString, WORD wCount,
SEGPTR lpFontInfo, LPDRAWMODE lpDrawMode,
LPTEXTXFORM16 lpTextXForm, SHORT *lpCharWidths,
SEGPTR lpFontInfo,SEGPTR lpDrawMode,
SEGPTR lpTextXForm, SHORT *lpCharWidths,
RECT16 * lpOpaqueRect, WORD wOptions);
@ -191,4 +191,12 @@ extern HGDIOBJ32 WIN16DRV_SelectObject( DC *dc, HGDIOBJ32 handle );
/*
* Wine 16bit driver global variables
*/
extern SEGPTR win16drv_SegPtr_TextXForm;
extern LPTEXTXFORM16 win16drv_TextXFormP;
extern SEGPTR win16drv_SegPtr_DrawMode;
extern LPDRAWMODE win16drv_DrawModeP;
#endif /* __WINE_WIN16DRV_H */

View File

@ -235,9 +235,11 @@ typedef struct
DECL_WINELIB_TYPE_AW(MDICREATESTRUCT);
DECL_WINELIB_TYPE_AW(LPMDICREATESTRUCT);
#define MDITILE_VERTICAL 0
#define MDITILE_HORIZONTAL 1
#define MDIS_ALLCHILDSTYLES 0x0001
#define MDITILE_VERTICAL 0x0000
#define MDITILE_HORIZONTAL 0x0001
#define MDITILE_SKIPDISABLED 0x0002
#define MDIS_ALLCHILDSTYLES 0x0001
typedef struct {
DWORD styleOld;
@ -980,6 +982,10 @@ DECL_WINELIB_TYPE(LPLOGBRUSH);
#define LF_FACESIZE 32
#define LF_FULLFACESIZE 64
#define RASTER_FONTTYPE 0x0001
#define DEVICE_FONTTYPE 0x0002
#define TRUETYPE_FONTTYPE 0x0004
typedef struct
{
INT16 lfHeight;
@ -1168,7 +1174,15 @@ typedef struct
#define SYMBOL_CHARSET 2
#define SHIFTJIS_CHARSET 128
#define HANGEUL_CHARSET 129
#define GB2313_CHARSET 134
#define CHINESEBIG5_CHARSET 136
#define GREEK_CHARSET 161 /* CP1253 */
#define TURKISH_CHARSET 162 /* CP1254, -iso8859-9 */
#define HEBREW_CHARSET 177 /* CP1255 */
#define ARABIC_CHARSET 178 /* CP1256 */
#define BALTIC_CHARSET 186 /* CP1257 */
#define RUSSIAN_CHARSET 204 /* CP1251 */
#define EE_CHARSET 238 /* CP1250, -iso8859-2 */
#define OEM_CHARSET 255
/* lfOutPrecision values */
@ -1405,8 +1419,8 @@ typedef INT32 (*FONTENUMPROCEX32A)(LPENUMLOGFONTEX32A,LPNEWTEXTMETRICEX32A,UINT3
typedef INT32 (*FONTENUMPROCEX32W)(LPENUMLOGFONTEX32W,LPNEWTEXTMETRICEX32W,UINT32,LPARAM);
DECL_WINELIB_TYPE_AW(FONTENUMPROCEX);
/* tmPitchAndFamily values */
#define TMPF_FIXED_PITCH 1
/* tmPitchAndFamily bits */
#define TMPF_FIXED_PITCH 1 /* means variable pitch */
#define TMPF_VECTOR 2
#define TMPF_TRUETYPE 4
#define TMPF_DEVICE 8
@ -2304,6 +2318,7 @@ typedef struct tagCOMSTAT
#define WF_SMALLFRAME 0x0200
#define WF_80x87 0x0400
#define WF_PAGING 0x0800
#define WF_HASCPUID 0x2000
#define WF_WIN32WOW 0x4000 /* undoc */
#define WF_WLO 0x8000
@ -2917,6 +2932,50 @@ typedef struct
#define BF_DIAGONAL_ENDBOTTOMLEFT (BF_DIAGONAL | BF_BOTTOM | BF_LEFT)
#define BF_DIAGONAL_ENDBOTTOMRIGHT (BF_DIAGONAL | BF_BOTTOM | BF_RIGHT)
/* DrawFrameControl() uType's */
#define DFC_CAPTION 1
#define DFC_MENU 2
#define DFC_SCROLL 3
#define DFC_BUTTON 4
/* uState's */
#define DFCS_CAPTIONCLOSE 0x0000
#define DFCS_CAPTIONMIN 0x0001
#define DFCS_CAPTIONMAX 0x0002
#define DFCS_CAPTIONRESTORE 0x0003
#define DFCS_CAPTIONHELP 0x0004 /* Windows 95 only */
#define DFCS_MENUARROW 0x0000
#define DFCS_MENUCHECK 0x0001
#define DFCS_MENUBULLET 0x0002
#define DFCS_MENUARROWRIGHT 0x0004
#define DFCS_SCROLLUP 0x0000
#define DFCS_SCROLLDOWN 0x0001
#define DFCS_SCROLLLEFT 0x0002
#define DFCS_SCROLLRIGHT 0x0003
#define DFCS_SCROLLCOMBOBOX 0x0005
#define DFCS_SCROLLSIZEGRIP 0x0008
#define DFCS_SCROLLSIZEGRIPRIGHT 0x0010
#define DFCS_BUTTONCHECK 0x0000
#define DFCS_BUTTONRADIOIMAGE 0x0001
#define DFCS_BUTTONRADIOMASK 0x0002 /* to draw nonsquare button */
#define DFCS_BUTTONRADIO 0x0004
#define DFCS_BUTTON3STATE 0x0008
#define DFCS_BUTTONPUSH 0x0010
/* additional state of the control */
#define DFCS_INACTIVE 0x0100
#define DFCS_PUSHED 0x0200
#define DFCS_CHECKED 0x0400
#define DFCS_ADJUSTRECT 0x2000 /* exclude surrounding edge */
#define DFCS_FLAT 0x4000
#define DFCS_MONO 0x8000
/* Window Styles */
#define WS_OVERLAPPED 0x00000000L
#define WS_POPUP 0x80000000L
@ -4093,6 +4152,98 @@ typedef INT16 (*MFENUMPROC16)(HDC16,HANDLETABLE16*,METARECORD*,INT16,LPARAM);
typedef INT32 (*MFENUMPROC32)(HDC32,HANDLETABLE32*,METARECORD*,INT32,LPARAM);
DECL_WINELIB_TYPE(MFENUMPROC);
#ifndef NOLOGERROR
/* LogParamError and LogError values */
/* Error modifier bits */
#define ERR_WARNING 0x8000
#define ERR_PARAM 0x4000
#define ERR_SIZE_MASK 0x3000
#define ERR_BYTE 0x1000
#define ERR_WORD 0x2000
#define ERR_DWORD 0x3000
/* LogParamError() values */
/* Generic parameter values */
#define ERR_BAD_VALUE 0x6001
#define ERR_BAD_FLAGS 0x6002
#define ERR_BAD_INDEX 0x6003
#define ERR_BAD_DVALUE 0x7004
#define ERR_BAD_DFLAGS 0x7005
#define ERR_BAD_DINDEX 0x7006
#define ERR_BAD_PTR 0x7007
#define ERR_BAD_FUNC_PTR 0x7008
#define ERR_BAD_SELECTOR 0x6009
#define ERR_BAD_STRING_PTR 0x700a
#define ERR_BAD_HANDLE 0x600b
/* KERNEL parameter errors */
#define ERR_BAD_HINSTANCE 0x6020
#define ERR_BAD_HMODULE 0x6021
#define ERR_BAD_GLOBAL_HANDLE 0x6022
#define ERR_BAD_LOCAL_HANDLE 0x6023
#define ERR_BAD_ATOM 0x6024
#define ERR_BAD_HFILE 0x6025
/* USER parameter errors */
#define ERR_BAD_HWND 0x6040
#define ERR_BAD_HMENU 0x6041
#define ERR_BAD_HCURSOR 0x6042
#define ERR_BAD_HICON 0x6043
#define ERR_BAD_HDWP 0x6044
#define ERR_BAD_CID 0x6045
#define ERR_BAD_HDRVR 0x6046
/* GDI parameter errors */
#define ERR_BAD_COORDS 0x7060
#define ERR_BAD_GDI_OBJECT 0x6061
#define ERR_BAD_HDC 0x6062
#define ERR_BAD_HPEN 0x6063
#define ERR_BAD_HFONT 0x6064
#define ERR_BAD_HBRUSH 0x6065
#define ERR_BAD_HBITMAP 0x6066
#define ERR_BAD_HRGN 0x6067
#define ERR_BAD_HPALETTE 0x6068
#define ERR_BAD_HMETAFILE 0x6069
/* LogError() values */
/* KERNEL errors */
#define ERR_GALLOC 0x0001
#define ERR_GREALLOC 0x0002
#define ERR_GLOCK 0x0003
#define ERR_LALLOC 0x0004
#define ERR_LREALLOC 0x0005
#define ERR_LLOCK 0x0006
#define ERR_ALLOCRES 0x0007
#define ERR_LOCKRES 0x0008
#define ERR_LOADMODULE 0x0009
/* USER errors */
#define ERR_CREATEDLG 0x0040
#define ERR_CREATEDLG2 0x0041
#define ERR_REGISTERCLASS 0x0042
#define ERR_DCBUSY 0x0043
#define ERR_CREATEWND 0x0044
#define ERR_STRUCEXTRA 0x0045
#define ERR_LOADSTR 0x0046
#define ERR_LOADMENU 0x0047
#define ERR_NESTEDBEGINPAINT 0x0048
#define ERR_BADINDEX 0x0049
#define ERR_CREATEMENU 0x004a
/* GDI errors */
#define ERR_CREATEDC 0x0080
#define ERR_CREATEMETA 0x0081
#define ERR_DELOBJSELECTED 0x0082
#define ERR_SELBITMAP 0x0083
/* Debugging support (DEBUG SYSTEM ONLY) */
typedef struct
{
@ -4141,6 +4292,8 @@ typedef struct
#define DBF_APPLICATION 0x0008
#define DBF_DRIVER 0x0010
#endif /* NOLOGERROR */
/* Win32-specific structures */
typedef struct {
@ -4532,6 +4685,8 @@ typedef struct _ULARGE_INTEGER
DWORD HighPart;
} ULARGE_INTEGER,*LPULARGE_INTEGER;
typedef LARGE_INTEGER LUID,*LPLUID; /* locally unique ids */
/* SetLastErrorEx types */
#define SLE_ERROR 0x00000001
#define SLE_MINORERROR 0x00000002
@ -4814,6 +4969,39 @@ typedef struct
DECL_WINELIB_TYPE_AW(DOCINFO);
DECL_WINELIB_TYPE_AW(LPDOCINFO);
typedef struct {
DWORD dwScope;
DWORD dwType;
DWORD dwDisplayType;
DWORD dwUsage;
LPSTR lpLocalName;
LPSTR lpRemoteName;
LPSTR lpComment ;
LPSTR lpProvider;
} NETRESOURCE32A,*LPNETRESOURCE32A;
typedef struct {
DWORD dwScope;
DWORD dwType;
DWORD dwDisplayType;
DWORD dwUsage;
LPWSTR lpLocalName;
LPWSTR lpRemoteName;
LPWSTR lpComment ;
LPWSTR lpProvider;
} NETRESOURCE32W,*LPNETRESOURCE32W;
DECL_WINELIB_TYPE_AW(NETRESOURCE);
DECL_WINELIB_TYPE_AW(LPNETRESOURCE);
typedef struct {
DWORD cbStructure;
DWORD dwFlags;
DWORD dwSpeed;
DWORD dwDelay;
DWORD dwOptDataSize;
} NETCONNECTINFOSTRUCT,*LPNETCONNECTINFOSTRUCT;
#pragma pack(4)
/* Declarations for functions that exist only in Win16 */
@ -4899,6 +5087,8 @@ BOOL16 IsSharedSelector(HANDLE16);
BOOL16 IsTask(HTASK16);
HTASK16 IsTaskLocked(void);
BOOL16 IsValidMetaFile(HMETAFILE16);
VOID LogError(UINT16, LPVOID);
VOID LogParamError(UINT16,FARPROC16,LPVOID);
BOOL16 LocalInit(HANDLE16,WORD,WORD);
FARPROC16 LocalNotify(FARPROC16);
HTASK16 LockCurrentTask(BOOL16);

View File

@ -25,7 +25,11 @@ typedef struct
WINDOWPOS32 winPos[1];
} DWP;
extern void WINPOS_FindIconPos( HWND32 hwnd );
extern BOOL32 WINPOS_RedrawIconTitle( HWND32 hWnd );
extern BOOL32 WINPOS_ShowIconTitle( WND* pWnd, BOOL32 bShow );
extern void WINPOS_GetMinMaxInfo( WND* pWnd, POINT16 *maxSize, POINT16 *maxPos,
POINT16 *minTrack, POINT16 *maxTrack );
extern UINT16 WINPOS_MinMaximize( WND* pWnd, UINT16 cmd, LPRECT16 lpPos);
extern BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse,
BOOL32 fChangeFocus );
extern BOOL32 WINPOS_ChangeActiveWindow( HWND32 hwnd, BOOL32 mouseMsg );

View File

@ -30,11 +30,7 @@ typedef struct
} X_PHYSBRUSH;
/* X physical font */
typedef struct
{
XFontStruct * fstruct;
TEXTMETRIC16 metrics;
} X_PHYSFONT;
typedef UINT32 X_PHYSFONT;
/* X physical device */
typedef struct
@ -46,13 +42,18 @@ typedef struct
X_PHYSBRUSH brush;
} X11DRV_PDEVICE;
typedef INT32 (*DEVICEFONTENUMPROC)(LPENUMLOGFONT16,LPNEWTEXTMETRIC16,UINT16,LPARAM);
/* Wine driver X11 functions */
struct tagDC;
struct tagDeviceCaps;
extern BOOL32 X11DRV_BitBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
INT32 width, INT32 height, struct tagDC *dcSrc,
INT32 xSrc, INT32 ySrc, DWORD rop );
extern BOOL32 X11DRV_EnumDeviceFonts( struct tagDC *dc, LPLOGFONT16 plf,
DEVICEFONTENUMPROC dfeproc, LPARAM lp );
extern BOOL32 X11DRV_GetCharWidth( struct tagDC *dc, UINT32 firstChar,
UINT32 lastChar, LPINT32 buffer );
extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
@ -60,7 +61,7 @@ extern BOOL32 X11DRV_GetTextExtentPoint( struct tagDC *dc, LPCSTR str,
extern BOOL32 X11DRV_GetTextMetrics(struct tagDC *dc, TEXTMETRIC32A *metrics);
extern BOOL32 X11DRV_PatBlt( struct tagDC *dc, INT32 left, INT32 top,
INT32 width, INT32 height, DWORD rop );
extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
extern VOID X11DRV_SetDeviceClipping(struct tagDC *dc);
extern BOOL32 X11DRV_StretchBlt( struct tagDC *dcDst, INT32 xDst, INT32 yDst,
INT32 widthDst, INT32 heightDst,
struct tagDC *dcSrc, INT32 xSrc, INT32 ySrc,
@ -105,6 +106,6 @@ extern BOOL32 X11DRV_ExtTextOut( struct tagDC *dc, INT32 x, INT32 y,
extern BOOL32 X11DRV_BITMAP_Init(void);
extern BOOL32 X11DRV_BRUSH_Init(void);
extern BOOL32 X11DRV_FONT_Init(void);
extern BOOL32 X11DRV_FONT_Init( struct tagDeviceCaps* );
#endif /* __WINE_X11DRV_H */

178
include/x11font.h Normal file
View File

@ -0,0 +1,178 @@
/*
* X11 physical font definitions
*
* Copyright 1997 Alex Korobka
*/
#ifndef __WINE_X11FONT_H
#define __WINE_X11FONT_H
#include "gdi.h"
#pragma pack(1)
/* this is a part of the font resource header, should
* make it easier to implement dynamic softfont loading */
typedef struct
{
INT16 dfType;
INT16 dfPoints;
INT16 dfVertRes;
INT16 dfHorizRes;
INT16 dfAscent;
INT16 dfInternalLeading;
INT16 dfExternalLeading;
CHAR dfItalic;
CHAR dfUnderline;
CHAR dfStrikeOut;
INT16 dfWeight;
CHAR dfCharSet;
INT16 dfPixWidth;
INT16 dfPixHeight;
CHAR dfPitchAndFamily;
INT16 dfAvgWidth;
INT16 dfMaxWidth;
CHAR dfFirstChar;
CHAR dfLastChar;
CHAR dfDefaultChar;
CHAR dfBreakChar;
INT16 dfWidthBytes;
LPCSTR dfDevice;
LPCSTR dfFace;
} IFONTINFO16, *LPIFONTINFO16;
#pragma pack(4)
/* internal flags */
#define FI_POLYWEIGHT 0x0001
#define FI_POLYSLANT 0x0002
#define FI_OBLIQUE 0x0004
#define FI_SCALABLE 0x0008
#define FI_FW_BOOK 0x0010
#define FI_FW_DEMI 0x0020
#define FI_VARIABLEPITCH 0x0040
#define FI_FIXEDPITCH 0x0080
#define FI_ENC_ISO8859 0x0100
#define FI_ENC_ISO646 0x0200
#define FI_ENC_ANSI 0x0400
#define FI_FIXEDEX 0x1000
#define FI_NORMAL 0x2000
#define FI_SUBSET 0x4000
#define FI_TRUETYPE 0x8000
typedef struct tagFontInfo
{
struct tagFontInfo* next;
UINT16 fi_flags;
/* LFD parameters can be quite different from the actual metrics */
UINT16 lfd_height;
UINT16 lfd_width;
UINT16 lfd_decipoints;
UINT16 lfd_resolution;
IFONTINFO16 df;
} fontInfo;
/* Font resource list for EnumFont() purposes */
#define FR_SOFTFONT 0x1000 /* - .FON or .FOT file */
#define FR_SOFTRESOURCE 0x2000 /* - resource handle */
#define FR_REMOVED 0x4000 /* delayed remove */
#define FR_NAMESET 0x8000
typedef struct tagFontResource
{
struct tagFontResource* next;
UINT16 fr_flags;
UINT16 count;
fontInfo* fi;
char* resource;
CHAR lfFaceName[LF_FACESIZE];
} fontResource;
#define FO_RESOURCE_MASK 0x000F
#define FO_SYSTEM 0x0001 /* resident in cache */
#define FO_SOFTFONT 0x0002 /* installed at runtime */
#define FO_SHARED 0x0004 /* MITSHM */
#define FO_REMOVED 0x0008 /* remove when count falls to 0 */
#define FO_MATCH_MASK 0x00F0
#define FO_MATCH_NORASTER 0x0010
#define FO_MATCH_PAF 0x0020
#define FO_MATCH_XYINDEP 0x0040
#define FO_SYNTH_MASK 0xFF00
#define FO_SYNTH_HEIGHT 0x2000
#define FO_SYNTH_WIDTH 0x4000
#define FO_SYNTH_ROTATE 0x8000
#define FO_SYNTH_BOLD 0x0100
#define FO_SYNTH_ITALIC 0x0200
#define FO_SYNTH_UNDERLINE 0x0400
#define FO_SYNTH_STRIKEOUT 0x0800
/* Realized screen font */
typedef struct
{
XFontStruct* fs; /* text metrics */
fontResource* fr; /* font family */
fontInfo* fi; /* font instance info */
LPMAT2* lpXForm; /* optional transformation matrix */
Pixmap* lpPixmap; /* optional character bitmasks for synth fonts */
INT16 foInternalLeading;
INT16 foAvgCharWidth;
UINT16 fo_flags;
/* font cache housekeeping */
UINT16 count;
UINT16 lru;
UINT16 lfchecksum;
LOGFONT16 lf;
} fontObject;
typedef struct
{
fontResource* pfr;
fontInfo* pfi;
UINT16 height;
UINT16 flags;
LPLOGFONT16 plf;
} fontMatch;
typedef struct
{
LPLOGFONT16 lpLogFontParam;
FONTENUMPROC16 lpEnumFunc;
LPARAM lpData;
LPNEWTEXTMETRICEX16 lpTextMetric;
LPENUMLOGFONTEX16 lpLogFont;
SEGPTR segTextMetric;
SEGPTR segLogFont;
} fontEnum16;
typedef struct
{
LPLOGFONT32W lpLogFontParam;
FONTENUMPROC32W lpEnumFunc;
LPARAM lpData;
LPNEWTEXTMETRICEX32W lpTextMetric;
LPENUMLOGFONTEX32W lpLogFont;
DWORD dwFlags;
} fontEnum32;
extern fontObject* XFONT_GetFontObject( X_PHYSFONT pFont );
extern XFontStruct* XFONT_GetFontStruct( X_PHYSFONT pFont );
extern LPIFONTINFO16 XFONT_GetFontInfo( X_PHYSFONT pFont );
#endif __WINE_X11FONT_H

View File

@ -14,15 +14,31 @@
#define LOADSHORT(x) LOAD(x); TAB->x = CONV_SHORT (TAB->x);
#define LOADLONG(x) LOAD(x); TAB->x = CONV_LONG (TAB->x);
void load_mz_header (int fd, struct mz_header_s *mz_header)
void load_mz_header (int fd, LPIMAGE_DOS_HEADER mz_header)
{
#define TAB mz_header
LOAD (mz_magic);
LOAD (dont_care);
LOADSHORT (ne_offset);
LOAD(e_magic);
LOADSHORT(e_cblp);
LOADSHORT(e_cp);
LOADSHORT(e_crlc);
LOADSHORT(e_cparhdr);
LOADSHORT(e_minalloc);
LOADSHORT(e_maxalloc);
LOADSHORT(e_ss);
LOADSHORT(e_sp);
LOADSHORT(e_csum);
LOADSHORT(e_ip);
LOADSHORT(e_cs);
LOADSHORT(e_lfarlc);
LOADSHORT(e_ovno);
LOAD(e_res);
LOADSHORT(e_oemid);
LOADSHORT(e_oeminfo);
LOAD(e_res2);
LOADLONG(e_lfanew);
}
void load_ne_header (int fd, struct ne_header_s *ne_header)
void load_ne_header (int fd, LPIMAGE_OS2_HEADER ne_header)
{
#undef TAB
#define TAB ne_header

View File

@ -110,6 +110,9 @@ int MAIN_Init(void)
/* Initialize communications */
COMM_Init();
/* Initialize IO-port permissions */
IO_port_init();
/* registry initialisation */
SHELL_LoadRegistry();

View File

@ -38,7 +38,7 @@ static HMODULE16 hCachedModule = 0; /* Module cached by MODULE_OpenFile */
NE_MODULE *MODULE_GetPtr( HMODULE16 hModule )
{
NE_MODULE *pModule = (NE_MODULE *)GlobalLock16( hModule );
if (!pModule || (pModule->magic != NE_SIGNATURE) ||
if (!pModule || (pModule->magic != IMAGE_OS2_SIGNATURE) ||
(pModule->self != hModule)) return NULL;
return pModule;
}
@ -47,7 +47,7 @@ NE_MODULE *MODULE_GetPtr( HMODULE16 hModule )
/***********************************************************************
* MODULE_DumpModule
*/
void MODULE_DumpModule( HMODULE16 hmodule )
void MODULE_DumpModule( HMODULE16 hModule )
{
int i, ordinal;
SEGTABLEENTRY *pSeg;
@ -55,15 +55,15 @@ void MODULE_DumpModule( HMODULE16 hmodule )
WORD *pword;
NE_MODULE *pModule;
if (!(pModule = MODULE_GetPtr( hmodule )))
if (!(pModule = MODULE_GetPtr( hModule )))
{
fprintf( stderr, "**** %04x is not a module handle\n", hmodule );
fprintf( stderr, "**** %04x is not a module handle\n", hModule );
return;
}
/* Dump the module info */
printf( "Module %04x:\n", hmodule );
printf( "Module %04x:\n", hModule );
printf( "count=%d flags=%04x heap=%d stack=%d\n",
pModule->count, pModule->flags,
pModule->heap_size, pModule->stack_size );
@ -364,7 +364,7 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
HMODULE16 hModule;
NE_MODULE *pModule;
SEGTABLEENTRY *pSegment;
char *pStr;
char *pStr,*basename,*s;
INT32 of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
@ -385,7 +385,7 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
pModule = (NE_MODULE *)GlobalLock16( hModule );
/* Set all used entries */
pModule->magic = NE_SIGNATURE;
pModule->magic = IMAGE_OS2_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->flags = 0;
@ -420,7 +420,19 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
/* Module name */
pStr = (char *)pSegment;
pModule->name_table = (int)pStr - (int)pModule;
strcpy( pStr, "\x08W32SXXXX" );
/* strcpy( pStr, "\x08W32SXXXX" ); */
basename = strrchr(ofs->szPathName,'\\');
if (!basename)
basename=ofs->szPathName;
else
basename++;
basename=strdup(basename);
if ((s=strchr(basename,'.')))
*s='\0';
*pStr = strlen(basename);
if (*pStr>8) *pStr=8;
strncpy( pStr+1, basename, 8 );
free(basename);
pStr += 9;
/* All tables zero terminated */
@ -437,8 +449,8 @@ HMODULE16 MODULE_CreateDummyModule( const OFSTRUCT *ofs )
*/
static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
{
struct mz_header_s mz_header;
struct ne_header_s ne_header;
IMAGE_DOS_HEADER mz_header;
IMAGE_OS2_HEADER ne_header;
int size;
HMODULE16 hModule;
NE_MODULE *pModule;
@ -456,15 +468,15 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
_llseek32( hFile, 0, SEEK_SET );
if ((_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
(mz_header.mz_magic != MZ_SIGNATURE))
(mz_header.e_magic != IMAGE_DOS_SIGNATURE))
return (HMODULE16)11; /* invalid exe */
_llseek32( hFile, mz_header.ne_offset, SEEK_SET );
_llseek32( hFile, mz_header.e_lfanew, SEEK_SET );
if (_lread32( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
return (HMODULE16)11; /* invalid exe */
if (ne_header.ne_magic == PE_SIGNATURE) return (HMODULE16)21; /* win32 exe */
if (ne_header.ne_magic != NE_SIGNATURE) return (HMODULE16)11; /* invalid exe */
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE) return (HMODULE16)21; /* win32 exe */
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return (HMODULE16)11; /* invalid exe */
/* We now have a valid NE header */
@ -537,7 +549,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
int i;
struct ne_segment_table_entry_s *pSeg;
if (!READ( mz_header.ne_offset + ne_header.segment_tab_offset,
if (!READ( mz_header.e_lfanew + ne_header.segment_tab_offset,
ne_header.n_segment_tab * sizeof(struct ne_segment_table_entry_s),
buffer ))
{
@ -566,7 +578,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
if (ne_header.resource_tab_offset < ne_header.rname_tab_offset)
{
pModule->res_table = (int)pData - (int)pModule;
if (!READ(mz_header.ne_offset + ne_header.resource_tab_offset,
if (!READ(mz_header.e_lfanew + ne_header.resource_tab_offset,
ne_header.rname_tab_offset - ne_header.resource_tab_offset,
pData )) return (HMODULE16)11; /* invalid exe */
pData += ne_header.rname_tab_offset - ne_header.resource_tab_offset;
@ -576,7 +588,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
/* Get the resident names table */
pModule->name_table = (int)pData - (int)pModule;
if (!READ( mz_header.ne_offset + ne_header.rname_tab_offset,
if (!READ( mz_header.e_lfanew + ne_header.rname_tab_offset,
ne_header.moduleref_tab_offset - ne_header.rname_tab_offset,
pData ))
{
@ -591,7 +603,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
if (ne_header.n_mod_ref_tab > 0)
{
pModule->modref_table = (int)pData - (int)pModule;
if (!READ( mz_header.ne_offset + ne_header.moduleref_tab_offset,
if (!READ( mz_header.e_lfanew + ne_header.moduleref_tab_offset,
ne_header.n_mod_ref_tab * sizeof(WORD),
pData ))
{
@ -606,7 +618,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
/* Get the imported names table */
pModule->import_table = (int)pData - (int)pModule;
if (!READ( mz_header.ne_offset + ne_header.iname_tab_offset,
if (!READ( mz_header.e_lfanew + ne_header.iname_tab_offset,
ne_header.entry_tab_offset - ne_header.iname_tab_offset,
pData ))
{
@ -619,7 +631,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
/* Get the entry table */
pModule->entry_table = (int)pData - (int)pModule;
if (!READ( mz_header.ne_offset + ne_header.entry_tab_offset,
if (!READ( mz_header.e_lfanew + ne_header.entry_tab_offset,
ne_header.entry_tab_length,
pData ))
{
@ -685,7 +697,7 @@ static HMODULE16 MODULE_LoadExeHeader( HFILE32 hFile, OFSTRUCT *ofs )
*/
WORD MODULE_GetOrdinal( HMODULE16 hModule, const char *name )
{
char buffer[256], *cpnt;
unsigned char buffer[256], *cpnt;
BYTE len;
NE_MODULE *pModule;
@ -1452,6 +1464,8 @@ HINSTANCE32 WinExec32( LPCSTR lpCmdLine, UINT32 nCmdShow )
char *p, *cmdline, filename[256];
static int use_load_module = 1;
if (!lpCmdLine)
return 2; /* File not found */
if (!(cmdShowHandle = GlobalAlloc16( 0, 2 * sizeof(WORD) )))
return 8; /* Out of memory */
if (!(cmdLineHandle = GlobalAlloc16( 0, 256 )))

View File

@ -270,7 +270,7 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
default:
dprintf_fixup(stddeb,
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, ",
"WARNING: %d: ADDR TYPE %d, unknown TYPE %d, OFFSET %04x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
dprintf_fixup(stddeb,"TARGET %04x %04x\n",
@ -283,9 +283,9 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
/* Apparently, high bit of address_type is sometimes set; */
/* we ignore it for now */
if (rep->address_type & 0x80)
fprintf( stderr, "Warning: reloc addr type = 0x%02x\n",
rep->address_type );
if (rep->address_type > NE_RADDR_OFFSET32)
fprintf( stderr, "WARNING: module %s: unknown reloc addr type = 0x%02x. Please report.\n",
MODULE_GetModuleName(hModule), rep->address_type );
switch (rep->address_type & 0x7f)
{
@ -345,7 +345,7 @@ BOOL32 NE_LoadSegment( HMODULE16 hModule, WORD segnum )
default:
dprintf_fixup(stddeb,
"%d: ADDR TYPE %d, TYPE %d, OFFSET %04x, ",
"WARNING: %d: unknown ADDR TYPE %d, TYPE %d, OFFSET %04x, ",
i + 1, rep->address_type, rep->relocation_type,
rep->offset);
dprintf_fixup(stddeb,

View File

@ -40,7 +40,7 @@ static void PE_InitDLL(HMODULE16 hModule, DWORD type, LPVOID lpReserved);
void dump_exports(IMAGE_EXPORT_DIRECTORY * pe_exports, unsigned int load_addr)
{
char *Module,*s;
char *Module;
int i;
u_short *ordinal;
u_long *function,*functions;
@ -76,7 +76,6 @@ void dump_exports(IMAGE_EXPORT_DIRECTORY * pe_exports, unsigned int load_addr)
daddr.off=RVA(*functions);
function++;
}
while ((s=strchr(buffer,'.'))) *s='_';
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
}
}
@ -360,7 +359,7 @@ static void do_relocations(struct pe_data *pe)
* PE_LoadImage
* Load one PE format executable into memory
*/
static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset )
static void PE_LoadImage( struct pr_data **ret_pe, int fd, HMODULE16 hModule, WORD offset, OFSTRUCT *ofs )
{
struct pe_data *pe;
int i, result;
@ -368,6 +367,7 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset )
IMAGE_DATA_DIRECTORY dir;
char buffer[200];
DBG_ADDR daddr;
char *modname;
daddr.seg=0;
daddr.type = NULL;
@ -379,6 +379,30 @@ static struct pe_data *PE_LoadImage( int fd, HMODULE16 hModule, WORD offset )
lseek( fd, offset, SEEK_SET);
read( fd, pe->pe_header, sizeof(IMAGE_NT_HEADERS));
if (pe->pe_header->FileHeader.Machine != IMAGE_FILE_MACHINE_I386) {
fprintf(stderr,"trying to load PE image for unsupported architecture (");
switch (pe->pe_header->FileHeader.Machine) {
case IMAGE_FILE_MACHINE_UNKNOWN:
fprintf(stderr,"Unknown");break;
case IMAGE_FILE_MACHINE_I860:
fprintf(stderr,"I860");break;
case IMAGE_FILE_MACHINE_R3000:
fprintf(stderr,"R3000");break;
case IMAGE_FILE_MACHINE_R4000:
fprintf(stderr,"R4000");break;
case IMAGE_FILE_MACHINE_R10000:
fprintf(stderr,"R10000");break;
case IMAGE_FILE_MACHINE_ALPHA:
fprintf(stderr,"Alpha");break;
case IMAGE_FILE_MACHINE_POWERPC:
fprintf(stderr,"PowerPC");break;
default:
fprintf(stderr,"Unknown-%04x",pe->pe_header->FileHeader.Machine);break;
}
fprintf(stderr,")\n");
return;
}
/* FIXME: this is a *horrible* hack to make COMDLG32.DLL load OK. The
problem needs to be fixed properly at some stage */
@ -539,33 +563,39 @@ problem needs to be fixed properly at some stage */
dprintf_win32(stdnimp,"Unknown directory 15 ignored\n");
if(pe->pe_reloc) do_relocations(pe);
if(pe->pe_import) fixup_imports(pe, hModule);
if(pe->pe_export) dump_exports(pe->pe_export,load_addr);
if (pe->pe_export) {
char *s;
/* add start of sections as debugsymbols */
for(i=0;i<pe->pe_header->FileHeader.NumberOfSections;i++) {
sprintf(buffer,"%s_%s",
(char*)RVA(pe->pe_export->Name),
pe->pe_seg[i].Name
);
daddr.off= RVA(pe->pe_seg[i].VirtualAddress);
while ((s=strchr(buffer,'.'))) *s='_';
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
}
/* add entry point */
sprintf(buffer,"%s_EntryPoint",(char*)RVA(pe->pe_export->Name));
daddr.off=RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint);
while ((s=strchr(buffer,'.'))) *s='_';
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
/* add start of DLL */
daddr.off=load_addr;
DEBUG_AddSymbol((char*) RVA(pe->pe_export->Name),&daddr,
NULL, SYM_WIN32 | SYM_FUNC);
/* Do exports before imports because fixup_imports
* may load a module that references this module.
*/
if(pe->pe_export) dump_exports(pe->pe_export,load_addr);
*ret_pe = pe; /* make export list available for GetProcAddress */
if(pe->pe_import) fixup_imports(pe, hModule);
if (pe->pe_export)
modname = (char*)RVA(pe->pe_export->Name);
else {
char *s;
modname = s = ofs->szPathName;
while (s=strchr(modname,'\\'))
modname = s+1;
if ((s=strchr(modname,'.')))
*s='\0';
}
return pe;
/* add start of sections as debugsymbols */
for(i=0;i<pe->pe_header->FileHeader.NumberOfSections;i++) {
sprintf(buffer,"%s_%s",modname,pe->pe_seg[i].Name);
daddr.off= RVA(pe->pe_seg[i].VirtualAddress);
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
}
/* add entry point */
sprintf(buffer,"%s_EntryPoint",modname);
daddr.off=RVA(pe->pe_header->OptionalHeader.AddressOfEntryPoint);
DEBUG_AddSymbol(buffer,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
/* add start of DLL */
daddr.off=load_addr;
DEBUG_AddSymbol(modname,&daddr, NULL, SYM_WIN32 | SYM_FUNC);
}
HINSTANCE16 MODULE_CreateInstance(HMODULE16 hModule,LOADPARAMS *params);
@ -575,7 +605,7 @@ HINSTANCE16 PE_LoadModule( HFILE32 hFile, OFSTRUCT *ofs, LOADPARAMS* params )
HMODULE16 hModule;
HINSTANCE16 hInstance;
NE_MODULE *pModule;
struct mz_header_s mz_header;
IMAGE_DOS_HEADER mz_header;
int fd;
if ((hModule = MODULE_CreateDummyModule( ofs )) < 32) return hModule;
@ -588,7 +618,9 @@ HINSTANCE16 PE_LoadModule( HFILE32 hFile, OFSTRUCT *ofs, LOADPARAMS* params )
lseek( fd, 0, SEEK_SET );
read( fd, &mz_header, sizeof(mz_header) );
pModule->pe_module = PE_LoadImage( fd, hModule, mz_header.ne_offset );
PE_LoadImage( &pModule->pe_module, fd, hModule, mz_header.e_lfanew, ofs );
if (!pModule->pe_module)
return 21;
close( fd );
hInstance = MODULE_CreateInstance( hModule, params );

View File

@ -28,6 +28,7 @@
#include "thread.h"
#include "toolhelp.h"
#include "winnt.h"
#include "thread.h"
#include "stddebug.h"
#include "debug.h"
#include "dde_proc.h"
@ -71,14 +72,20 @@ static FARPROC16 TASK_RescheduleProc;
static HGLOBAL16 TASK_CreateDOSEnvironment(void);
static void TASK_YieldToSystem(TDB*);
static THDB TASK_SystemTHDB;
/***********************************************************************
* TASK_Init
*/
BOOL32 TASK_Init(void)
{
TASK_RescheduleProc = MODULE_GetWndProcEntry16( "TASK_Reschedule" );
if (!(hDOSEnvironment = TASK_CreateDOSEnvironment()))
fprintf( stderr, "Not enough memory for DOS Environment\n" );
TASK_SystemTHDB.teb_sel = SELECTOR_AllocBlock( &TASK_SystemTHDB, 0x1000, SEGMENT_DATA, TRUE, FALSE );
#ifndef WINELIB
__asm__ __volatile__("movw %w0,%%fs"::"r"(TASK_SystemTHDB.teb_sel));
#endif
return (hDOSEnvironment != 0);
}
@ -1429,13 +1436,13 @@ HMODULE16 GetExePtr( HANDLE16 handle )
/* Check for module handle */
if (!(ptr = GlobalLock16( handle ))) return 0;
if (((NE_MODULE *)ptr)->magic == NE_SIGNATURE) return handle;
if (((NE_MODULE *)ptr)->magic == IMAGE_OS2_SIGNATURE) return handle;
/* Check the owner for module handle */
owner = FarGetOwner( handle );
if (!(ptr = GlobalLock16( owner ))) return 0;
if (((NE_MODULE *)ptr)->magic == NE_SIGNATURE) return owner;
if (((NE_MODULE *)ptr)->magic == IMAGE_OS2_SIGNATURE) return owner;
/* Search for this handle and its owner inside all tasks */

View File

@ -7,6 +7,7 @@
#include <assert.h>
#include <fcntl.h>
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#include <string.h>
#include <sys/types.h>
@ -373,16 +374,28 @@ BOOL32 VIRTUAL_Init(void)
#ifdef linux
{
FILE *f = fopen( "/proc/self/maps", "r" );
if (f)
/* Do not use stdio here since it may temporarily change the size
* of some segments (ie libc6 adds 0x1000 per open FILE)
*/
int fd = open ("/proc/self/maps", O_RDONLY);
if (fd >= 0)
{
char buffer[80];
while (fgets( buffer, sizeof(buffer), f ))
for (;;)
{
int start, end, offset;
char r, w, x, p;
BYTE vprot = VPROT_COMMITTED;
char * ptr = buffer;
int count = sizeof(buffer);
while (1 == read(fd, ptr, 1) && *ptr != '\n' && --count > 0)
ptr++;
if (*ptr != '\n') break;
*ptr = '\0';
sscanf( buffer, "%x-%x %c%c%c%c %x",
&start, &end, &r, &w, &x, &p, &offset );
if (r == 'r') vprot |= VPROT_READ;
@ -392,7 +405,7 @@ BOOL32 VIRTUAL_Init(void)
VIRTUAL_CreateView( start, end - start, 0,
VFLAG_SYSTEM, vprot, NULL );
}
fclose( f );
close (fd);
}
}
#endif /* linux */

View File

@ -11,6 +11,7 @@ C_SRCS = \
compobj.c \
crtdll.c \
cpu.c \
error.c \
lstr.c \
lzexpand.c \
main.c \

View File

@ -4,6 +4,13 @@
* Copyright 1996 Marcus Meissner
* FIXME: use HFILEs instead of unixfds
* the win32 functions here get HFILEs already.
*
* May 26, 1997. Fixes and comments by Rick Richardson <rick@dgii.com> [RER]
* - ptr->fd wasn't getting cleared on close.
* - GetCommEventMask() and GetCommError() didn't do much of anything.
* IMHO, they are still wrong, but they at least implement the RXCHAR
* event and return I/O queue sizes, which makes the app I'm interested
* in (analog devices EZKIT DSP development system) work.
*/
#include <stdio.h>
@ -16,6 +23,8 @@
#include <sys/stat.h>
#if defined(__NetBSD__) || defined(__FreeBSD__)
#include <sys/ioctl.h>
#else
#include <sys/ioctl.h>
#endif
#include <unistd.h>
@ -27,6 +36,10 @@
#include "debug.h"
#include "handle32.h"
/*
* [RER] These are globals are wrong. They should be in DosDeviceStruct
* on a per port basis.
*/
int commerror = 0, eventmask = 0;
struct DosDeviceStruct COM[MAX_PORTS];
@ -445,7 +458,16 @@ INT16 OpenComm(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
*/
INT16 CloseComm(INT16 fd)
{
struct DosDeviceStruct *ptr;
dprintf_comm(stddeb,"CloseComm: fd %d\n", fd);
if ((ptr = GetDeviceStruct(fd)) == NULL) {
commerror = IE_BADID;
return -1;
}
ptr->fd = 0; /* [RER] Really, -1 would be a better value */
if (close(fd) == -1) {
commerror = WinError();
return -1;
@ -709,10 +731,26 @@ INT16 FlushComm(INT16 fd,INT16 fnQueue)
*/
INT16 GetCommError(INT16 fd,LPCOMSTAT lpStat)
{
int temperror;
int temperror;
unsigned long cnt;
int rc;
lpStat->status = 0;
rc = ioctl(fd, TIOCOUTQ, &cnt);
lpStat->cbOutQue = cnt;
rc = ioctl(fd, TIOCINQ, &cnt);
lpStat->cbInQue = cnt;
dprintf_comm(stddeb,
"GetCommError: fd %d (current error %d)\n", fd, commerror);
"GetCommError: fd %d, error %d, lpStat %d %d %d\n",
fd, commerror,
lpStat->status, lpStat->cbInQue, lpStat->cbOutQue);
/*
* [RER] I have no idea what the following is trying to accomplish.
* [RER] It is certainly not what the reference manual suggests.
*/
temperror = commerror;
commerror = 0;
return(temperror);
@ -747,10 +785,43 @@ UINT16 *SetCommEventMask(INT16 fd,UINT16 fuEvtMask)
*/
UINT16 GetCommEventMask(INT16 fd,UINT16 fnEvtClear)
{
int events = 0;
dprintf_comm(stddeb,
"GetCommEventMask: fd %d, mask %d\n", fd, fnEvtClear);
/*
* Determine if any characters are available
*/
if (fnEvtClear & EV_RXCHAR)
{
int rc;
unsigned long cnt;
rc = ioctl(fd, TIOCINQ, &cnt);
if (cnt) events |= EV_RXCHAR;
dprintf_comm(stddeb,
"GetCommEventMask: rxchar %ld\n", cnt);
}
/*
* There are other events that need to be checked for
*/
/* TODO */
dprintf_comm(stddeb,
"GetCommEventMask: return events %d\n", events);
return events;
/*
* [RER] The following was gibberish
*/
#if 0
tempmask = eventmask;
eventmask &= ~fnEvtClear;
return eventmask;
#endif
}
/*****************************************************************************

165
misc/error.c Normal file
View File

@ -0,0 +1,165 @@
/*
* Log internal errors
*
* Copyright 1997 Andrew Taylor
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "windows.h"
#include "stddebug.h"
#include "debug.h"
#ifdef DEBUG_RUNTIME
#define ErrorString(manifest) { manifest, # manifest }
const struct {
int constant;
const char *name;
} ErrorStrings[] = {
ErrorString(ERR_GALLOC),
ErrorString(ERR_GREALLOC),
ErrorString(ERR_GLOCK),
ErrorString(ERR_LALLOC),
ErrorString(ERR_LREALLOC),
ErrorString(ERR_LLOCK),
ErrorString(ERR_ALLOCRES),
ErrorString(ERR_LOCKRES),
ErrorString(ERR_LOADMODULE),
ErrorString(ERR_CREATEDLG),
ErrorString(ERR_CREATEDLG2),
ErrorString(ERR_REGISTERCLASS),
ErrorString(ERR_DCBUSY),
ErrorString(ERR_CREATEWND),
ErrorString(ERR_STRUCEXTRA),
ErrorString(ERR_LOADSTR),
ErrorString(ERR_LOADMENU),
ErrorString(ERR_NESTEDBEGINPAINT),
ErrorString(ERR_BADINDEX),
ErrorString(ERR_CREATEMENU),
ErrorString(ERR_CREATEDC),
ErrorString(ERR_CREATEMETA),
ErrorString(ERR_DELOBJSELECTED),
ErrorString(ERR_SELBITMAP)
};
#define ErrorStringCount (sizeof(ErrorStrings) / sizeof(ErrorStrings[0]))
const struct {
int constant;
const char *name;
} ParamErrorStrings[] = {
ErrorString(ERR_BAD_VALUE),
ErrorString(ERR_BAD_FLAGS),
ErrorString(ERR_BAD_INDEX),
ErrorString(ERR_BAD_DVALUE),
ErrorString(ERR_BAD_DFLAGS),
ErrorString(ERR_BAD_DINDEX),
ErrorString(ERR_BAD_PTR),
ErrorString(ERR_BAD_FUNC_PTR),
ErrorString(ERR_BAD_SELECTOR),
ErrorString(ERR_BAD_STRING_PTR),
ErrorString(ERR_BAD_HANDLE),
ErrorString(ERR_BAD_HINSTANCE),
ErrorString(ERR_BAD_HMODULE),
ErrorString(ERR_BAD_GLOBAL_HANDLE),
ErrorString(ERR_BAD_LOCAL_HANDLE),
ErrorString(ERR_BAD_ATOM),
ErrorString(ERR_BAD_HFILE),
ErrorString(ERR_BAD_HWND),
ErrorString(ERR_BAD_HMENU),
ErrorString(ERR_BAD_HCURSOR),
ErrorString(ERR_BAD_HICON),
ErrorString(ERR_BAD_HDWP),
ErrorString(ERR_BAD_CID),
ErrorString(ERR_BAD_HDRVR),
ErrorString(ERR_BAD_COORDS),
ErrorString(ERR_BAD_GDI_OBJECT),
ErrorString(ERR_BAD_HDC),
ErrorString(ERR_BAD_HPEN),
ErrorString(ERR_BAD_HFONT),
ErrorString(ERR_BAD_HBRUSH),
ErrorString(ERR_BAD_HBITMAP),
ErrorString(ERR_BAD_HRGN),
ErrorString(ERR_BAD_HPALETTE),
ErrorString(ERR_BAD_HMETAFILE)
};
#define ParamErrorStringCount (sizeof(ParamErrorStrings) / sizeof(ParamErrorStrings[0]))
#endif /* DEBUG_RUNTIME */
/***********************************************************************
* GetErrorString (internal)
*/
static const char *GetErrorString(UINT16 uErr) {
static char buffer[80];
#ifdef DEBUG_RUNTIME
int i;
for (i = 0; i < ErrorStringCount; i++) {
if (uErr == ErrorStrings[i].constant)
return ErrorStrings[i].name;
}
#endif
sprintf(buffer, "%x", uErr);
return buffer;
}
/***********************************************************************
* GetParamErrorString (internal)
*/
static const char *GetParamErrorString(UINT16 uErr) {
static char buffer[80];
if (uErr & ERR_WARNING) {
strcpy(buffer, "ERR_WARNING | ");
uErr &= ~ERR_WARNING;
} else
buffer[0] = '\0';
#ifdef DEBUG_RUNTIME
{
int i;
for (i = 0; i < ParamErrorStringCount; i++) {
if (uErr == ParamErrorStrings[i].constant) {
strcat(buffer, ParamErrorStrings[i].name);
return buffer;
}
}
}
#endif
sprintf(buffer + strlen(buffer), "%x", uErr);
return buffer;
}
/***********************************************************************
* LogError (KERNEL.324)
*/
VOID LogError(UINT16 uErr, LPVOID lpvInfo) {
fprintf(stddeb, "LogError(%s, %p)\n",
GetErrorString(uErr), lpvInfo);
}
/***********************************************************************
* LogParamError (KERNEL.325)
*/
void LogParamError(UINT16 uErr, FARPROC16 lpfn, LPVOID lpvParam) {
/* FIXME: is it possible to get the module name/function
* from the lpfn param?
*/
fprintf(stddeb, "LogParamError(%s, %p, %p)\n",
GetParamErrorString(uErr), lpfn, lpvParam);
}

View File

@ -534,10 +534,11 @@ FormatMessage32A(
while (*f) {
if (*f=='%') {
int insertnr;
char *fmtstr,*sprintfbuf,*x;
char *fmtstr,*sprintfbuf,*x,*lastf;
DWORD *argliststart;
fmtstr = NULL;
lastf = f;
f++;
if (!*f) {
ADD_TO_T('%');
@ -573,26 +574,35 @@ FormatMessage32A(
}
} else
fmtstr=HEAP_strdupA(GetProcessHeap(),0,"%s");
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1;
else
/* FIXME: not sure that this is
* correct for unix-c-varargs.
if (args) {
if (dwFlags & FORMAT_MESSAGE_ARGUMENT_ARRAY)
argliststart=args+insertnr-1;
else
/* FIXME: not sure that this is
* correct for unix-c-varargs.
*/
argliststart=((DWORD*)&args)+insertnr-1;
if (fmtstr[strlen(fmtstr)]=='s')
sprintfbuf=HeapAlloc(GetProcessHeap(),0,strlen((LPSTR)argliststart[0])+1);
else
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
/* CMF - This makes a BIG assumption about va_list */
vsprintf(sprintfbuf, fmtstr, (va_list) argliststart);
x=sprintfbuf;
while (*x) {
ADD_TO_T(*x++);
}
HeapFree(GetProcessHeap(),0,sprintfbuf);
} else {
/* NULL args - copy formatstr
* (probably wrong)
*/
argliststart=((DWORD*)&args)+insertnr-1;
if (fmtstr[strlen(fmtstr)]=='s')
sprintfbuf=HeapAlloc(GetProcessHeap(),0,strlen((LPSTR)argliststart[0])+1);
else
sprintfbuf=HeapAlloc(GetProcessHeap(),0,100);
/* CMF - This makes a BIG assumption about va_list */
vsprintf(sprintfbuf, fmtstr, (va_list) argliststart);
x=sprintfbuf;
while (*x) {
ADD_TO_T(*x++);
while (lastf<f) {
ADD_TO_T(*lastf++);
}
}
HeapFree(GetProcessHeap(),0,sprintfbuf);
HeapFree(GetProcessHeap(),0,fmtstr);
break;
case 'n':

View File

@ -204,7 +204,7 @@ void LZDone(void)
*/
INT16 GetExpandedName16( LPCSTR in, LPSTR out )
{
return GetExpandedName32A( in, out );
return (INT16)GetExpandedName32A( in, out );
}
@ -230,17 +230,16 @@ INT32 GetExpandedName32A( LPCSTR in, LPSTR out )
dprintf_file(stddeb,"GetExpandedName(%s)\n",in);
fd=OpenFile32(in,&ofs,OF_READ);
if (fd==HFILE_ERROR32)
return LZERROR_BADINHANDLE;
return (INT32)(INT16)LZERROR_BADINHANDLE;
strcpy(out,in);
ret=read_header(fd,&head);
if (ret<=0) {
/* not a LZ compressed file, so the expanded name is the same
* as the input name */
_lclose32(fd);
return LZERROR_BADINHANDLE;
return 1;
}
/* This line will crash if the caller hasn't allocated enough memory
* for us.
*/
strcpy(out,in);
/* look for directory prefix and skip it. */
s=out;

View File

@ -817,6 +817,8 @@ DWORD GetWinFlags(void)
fprintf(stderr, "Unknown mode set? This shouldn't happen. Check GetWinFlags()!\n");
break;
}
if (si.wProcessorLevel>=4)
result |= WF_HASCPUID;
if( getVersionEx.dwPlatformId == VER_PLATFORM_WIN32_NT )
result |= WF_WIN32WOW; /* undocumented WF_WINNT */
return result;
@ -1060,9 +1062,12 @@ BOOL16 SystemParametersInfo16( UINT16 uAction, UINT16 uParam,
case SPI_GETICONTITLELOGFONT:
{
/* FIXME GetProfileString32A( "?", "?", "?" ) */
LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
lpLogFont->lfHeight = 10;
GetProfileString32A("Desktop", "IconTitleFaceName", "Helvetica",
lpLogFont->lfFaceName, LF_FACESIZE );
lpLogFont->lfHeight = -GetProfileInt32A("Desktop","IconTitleSize", 8);
lpLogFont->lfWidth = 0;
lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
lpLogFont->lfWeight = FW_NORMAL;

View File

@ -21,3 +21,15 @@ WNetGetCachedPassword(
);
return 0;
}
DWORD
MultinetGetConnectionPerformance32A(
LPNETRESOURCE32A lpNetResource,
LPNETCONNECTINFOSTRUCT lpNetConnectInfoStruct
) {
fprintf(stdnimp,"MultinetGetConnectionPerformance(%p,%p)\n",
lpNetResource,
lpNetConnectInfoStruct
);
return 1;
}

View File

@ -40,7 +40,7 @@ DWORD
DrvGetPrinterData(LPSTR lpPrinter, LPSTR lpProfile, LPDWORD lpType,
LPBYTE lpPrinterData, int cbData, LPDWORD lpNeeded)
{
fprintf(stderr,"In DrvGetPrinterData printer %s profile %s lpType %p \n",
fprintf(stderr,"In DrvGetPrinterData printer %p profile %p lpType %p \n",
lpPrinter, lpProfile, lpType);
return 0;
}
@ -51,7 +51,7 @@ DWORD
DrvSetPrinterData(LPSTR lpPrinter, LPSTR lpProfile, LPDWORD lpType,
LPBYTE lpPrinterData, DWORD dwSize)
{
fprintf(stderr,"In DrvSetPrinterData printer %s profile %s lpType %p \n",
fprintf(stderr,"In DrvSetPrinterData printer %p profile %p lpType %p \n",
lpPrinter, lpProfile, lpType);
return 0;
}

View File

@ -476,23 +476,23 @@ BOOL32 ShellAbout32W( HWND32 hWnd, LPCWSTR szApp, LPCWSTR szOtherStuff,
static BYTE* SHELL_GetResourceTable(HFILE32 hFile)
{
BYTE* pTypeInfo = NULL;
struct mz_header_s mz_header;
struct ne_header_s ne_header;
IMAGE_DOS_HEADER mz_header;
IMAGE_OS2_HEADER ne_header;
int size;
_llseek32( hFile, 0, SEEK_SET );
if ((_lread32(hFile,&mz_header,sizeof(mz_header)) != sizeof(mz_header)) ||
(mz_header.mz_magic != MZ_SIGNATURE)) return (BYTE*)-1;
(mz_header.e_magic != IMAGE_DOS_SIGNATURE)) return (BYTE*)-1;
_llseek32( hFile, mz_header.ne_offset, SEEK_SET );
_llseek32( hFile, mz_header.e_lfanew, SEEK_SET );
if (_lread32( hFile, &ne_header, sizeof(ne_header) ) != sizeof(ne_header))
return NULL;
if (ne_header.ne_magic == PE_SIGNATURE)
if (ne_header.ne_magic == IMAGE_NT_SIGNATURE)
{ fprintf(stdnimp,"Win32s FIXME: file %s line %i\n", __FILE__, __LINE__ );
return NULL; }
if (ne_header.ne_magic != NE_SIGNATURE) return NULL;
if (ne_header.ne_magic != IMAGE_OS2_SIGNATURE) return NULL;
size = ne_header.rname_tab_offset - ne_header.resource_tab_offset;
@ -501,7 +501,7 @@ static BYTE* SHELL_GetResourceTable(HFILE32 hFile)
pTypeInfo = (BYTE*)HeapAlloc( GetProcessHeap(), 0, size);
if( pTypeInfo )
{
_llseek32(hFile, mz_header.ne_offset+ne_header.resource_tab_offset, SEEK_SET);
_llseek32(hFile, mz_header.e_lfanew+ne_header.resource_tab_offset, SEEK_SET);
if( _lread32( hFile, (char*)pTypeInfo, size) != size )
{
HeapFree( GetProcessHeap(), 0, pTypeInfo);

View File

@ -508,15 +508,41 @@ static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"WM_COALESCE_LAST",
/* 0x03a0 */
"MM_JOY1MOVE",
"MM_JOY2MOVE",
"MM_JOY1ZMOVE",
"MM_JOY2ZMOVE",
NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
/* 0x03b0 */
NULL, NULL, NULL, NULL, NULL,
"MM_JOY1BUTTONDOWN",
"MM_JOY2BUTTONDOWN",
"MM_JOY1BUTTONUP",
"MM_JOY2BUTTONUP",
"MM_MCINOTIFY",
NULL,
"MM_WOM_OPEN",
"MM_WOM_CLOSE",
"MM_WOM_DONE",
"MM_WIM_OPEN",
"MM_WIM_CLOSE",
/* 0x03c0 */
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
"MM_WIM_DATA",
"MM_MIM_OPEN",
"MM_MIM_CLOSE",
"MM_MIM_DATA",
"MM_MIM_LONGDATA",
"MM_MIM_ERROR",
"MM_MIM_LONGERROR",
"MM_MOM_OPEN",
"MM_MOM_CLOSE",
"MM_MOM_DONE",
NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
@ -666,7 +692,7 @@ void SPY_ExitMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg, LRESULT lReturn )
int SPY_Init(void)
{
int i;
char buffer[512];
char buffer[1024];
PROFILE_GetWineIniString( "Spy", "Include", "", buffer, sizeof(buffer) );
if (buffer[0] && strcmp( buffer, "INCLUDEALL" ))

View File

@ -7,6 +7,7 @@
#include <stdio.h>
#include <string.h>
#include <ctype.h>
#include <unistd.h>
#include "windows.h"
#include "win.h"
#include "winerror.h"
@ -24,19 +25,156 @@
if (sizeof(*what)!=LZRead32(lzfd,what,sizeof(*what))) return 0;
#define LZTELL(lzfd) LZSeek32(lzfd, 0, SEEK_CUR);
/******************************************************************************
*
* void dprintf_ver_string(
* char const * prologue,
* char const * teststring,
* char const * epilogue )
*
* This function will print via dprintf_ver to stddeb the prologue string,
* followed by the address of teststring and the string it contains if
* teststring is non-null or "(null)" otherwise, and then the epilogue
* string.
*
* Revision history
* 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation
*
*****************************************************************************/
static void dprintf_ver_string(
char const * prologue,
char const * teststring,
char const * epilogue )
{
dprintf_ver(stddeb, "%s", prologue);
if(teststring)
dprintf_ver(stddeb, "%p (\"%s\")", (void const *) teststring,
teststring);
else
dprintf_ver(stddeb, "(null)");
dprintf_ver(stddeb, "%s", epilogue);
return;
}
/******************************************************************************
*
* int testFileExistence(
* char const * path,
* char const * file )
*
* Tests whether a given path/file combination exists. If the file does
* not exist, the return value is zero. If it does exist, the return
* value is non-zero.
*
* Revision history
* 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation
*
*****************************************************************************/
static int testFileExistence(
char const * path,
char const * file )
{
char filename[1024];
int filenamelen;
OFSTRUCT fileinfo;
int retval;
fileinfo.cBytes = sizeof(OFSTRUCT);
strcpy(filename, path);
filenamelen = strlen(filename);
/* Add a trailing \ if necessary */
if(filenamelen) {
if(filename[filenamelen - 1] != '\\')
strcat(filename, "\\");
}
else /* specify the current directory */
strcpy(filename, ".\\");
/* Create the full pathname */
strcat(filename, file);
if(OpenFile32(filename, &fileinfo, OF_EXIST) == HFILE_ERROR32)
retval = 0;
else
retval = 1;
return retval;
}
/******************************************************************************
*
* int testFileExclusiveExistence(
* char const * path,
* char const * file )
*
* Tests whether a given path/file combination exists and ensures that no
* other programs have handles to the given file. If the file does not
* exist or is open, the return value is zero. If it does exist, the
* return value is non-zero.
*
* Revision history
* 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Original implementation
*
*****************************************************************************/
static int testFileExclusiveExistence(
char const * path,
char const * file )
{
char filename[1024];
int filenamelen;
OFSTRUCT fileinfo;
int retval;
fileinfo.cBytes = sizeof(OFSTRUCT);
strcpy(filename, path);
filenamelen = strlen(filename);
/* Add a trailing \ if necessary */
if(filenamelen) {
if(filename[filenamelen - 1] != '\\')
strcat(filename, "\\");
}
else /* specify the current directory */
strcpy(filename, ".\\");
/* Create the full pathname */
strcat(filename, file);
if(OpenFile32(filename, &fileinfo, OF_EXIST | OF_SHARE_EXCLUSIVE) ==
HFILE_ERROR32)
retval = 0;
else
retval = 1;
return retval;
}
int
read_ne_header(HFILE32 lzfd,struct ne_header_s *nehd) {
struct mz_header_s mzh;
read_ne_header(HFILE32 lzfd,LPIMAGE_OS2_HEADER nehd) {
IMAGE_DOS_HEADER mzh;
LZSeek32(lzfd,0,SEEK_SET);
if (sizeof(mzh)!=LZRead32(lzfd,&mzh,sizeof(mzh)))
return 0;
if (mzh.mz_magic!=MZ_SIGNATURE)
if (mzh.e_magic!=IMAGE_DOS_SIGNATURE)
return 0;
LZSeek32(lzfd,mzh.ne_offset,SEEK_SET);
LZSeek32(lzfd,mzh.e_lfanew,SEEK_SET);
LZREAD(nehd);
if (nehd->ne_magic == NE_SIGNATURE) {
LZSeek32(lzfd,mzh.ne_offset,SEEK_SET);
if (nehd->ne_magic == IMAGE_OS2_SIGNATURE) {
LZSeek32(lzfd,mzh.e_lfanew,SEEK_SET);
return 1;
}
fprintf(stderr,"misc/ver.c:read_ne_header:can't handle PE files yet.\n");
@ -47,7 +185,7 @@ read_ne_header(HFILE32 lzfd,struct ne_header_s *nehd) {
int
find_ne_resource(
HFILE32 lzfd,struct ne_header_s *nehd,SEGPTR typeid,SEGPTR resid,
HFILE32 lzfd,LPIMAGE_OS2_HEADER nehd,SEGPTR typeid,SEGPTR resid,
BYTE **resdata,int *reslen,DWORD *off
) {
NE_TYPEINFO ti;
@ -164,11 +302,11 @@ find_ne_resource(
/* GetFileResourceSize [VER.2] */
DWORD
GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid,LPDWORD off) {
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen;
struct ne_header_s nehd;
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen;
IMAGE_OS2_HEADER nehd;
dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
filename,(LONG)restype,(LONG)resid,off
@ -194,11 +332,11 @@ DWORD
GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid,
DWORD off,DWORD datalen,LPVOID data
) {
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen=datalen;
struct ne_header_s nehd;
HFILE32 lzfd;
OFSTRUCT ofs;
BYTE *resdata;
int reslen=datalen;
IMAGE_OS2_HEADER nehd;
dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
filename,(LONG)restype,(LONG)resid,off,datalen,data
);
@ -380,20 +518,175 @@ DWORD GetFileVersionInfo32W( LPCWSTR filename, DWORD handle, DWORD datasize,
return ret;
}
/* VerFindFile [VER.8] */
DWORD
VerFindFile16(
UINT16 flags,LPCSTR filename,LPCSTR windir,LPCSTR appdir,
LPSTR curdir,UINT16 *curdirlen,LPSTR destdir,UINT16 *destdirlen
) {
dprintf_ver(stddeb,"VerFindFile(%x,%s,%s,%s,%p,%d,%p,%d)\n",
flags,filename,windir,appdir,curdir,*curdirlen,destdir,*destdirlen
);
strcpy(curdir,"Z:\\ROOT\\.WINE\\");/*FIXME*/
*curdirlen=strlen(curdir);
strcpy(destdir,"Z:\\ROOT\\.WINE\\");/*FIXME*/
*destdirlen=strlen(destdir);
return 0;
/*****************************************************************************
*
* VerFindFile() [VER.8]
* Determines where to install a file based on whether it locates another
* version of the file in the system. The values VerFindFile returns are
* used in a subsequent call to the VerInstallFile function.
*
* Revision history:
* 30-May-1997 Dave Cuthbert (dacut@ece.cmu.edu)
* Reimplementation of VerFindFile from original stub.
*
****************************************************************************/
DWORD VerFindFile16(
UINT16 flags,
LPCSTR lpszFilename,
LPCSTR lpszWinDir,
LPCSTR lpszAppDir,
LPSTR lpszCurDir,
UINT16 *lpuCurDirLen,
LPSTR lpszDestDir,
UINT16 *lpuDestDirLen )
{
DWORD retval;
char curDir[256];
char destDir[256];
unsigned int curDirSizeReq;
unsigned int destDirSizeReq;
retval = 0;
/* Print out debugging information */
dprintf_ver(stddeb, "VerFindFile() called with parameters:\n"
"\tflags = %x", flags);
if(flags & VFFF_ISSHAREDFILE)
dprintf_ver(stddeb, " (VFFF_ISSHAREDFILE)\n");
else
dprintf_ver(stddeb, "\n");
dprintf_ver_string("\tlpszFilename = ", lpszFilename, "\n");
dprintf_ver_string("\tlpszWinDir = ", lpszWinDir, "\n");
dprintf_ver_string("\tlpszAppDir = ", lpszAppDir, "\n");
dprintf_ver(stddeb, "\tlpszCurDir = %p\n", lpszCurDir);
if(lpuCurDirLen)
dprintf_ver(stddeb, "\tlpuCurDirLen = %p (%u)\n",
lpuCurDirLen, *lpuCurDirLen);
else
dprintf_ver(stddeb, "\tlpuCurDirLen = (null)\n");
dprintf_ver(stddeb, "\tlpszDestDir = %p\n", lpszDestDir);
if(lpuDestDirLen)
dprintf_ver(stddeb, "\tlpuDestDirLen = %p (%u)\n",
lpuDestDirLen, *lpuDestDirLen);
/* Figure out where the file should go; shared files default to the
system directory */
strcpy(curDir, "");
strcpy(destDir, "");
if(flags & VFFF_ISSHAREDFILE && !getuid()) {
GetSystemDirectory32A(destDir, 256);
/* Were we given a filename? If so, try to find the file. */
if(lpszFilename) {
if(testFileExistence(destDir, lpszFilename)) {
strcpy(curDir, destDir);
if(!testFileExclusiveExistence(destDir, lpszFilename))
retval |= VFF_FILEINUSE;
}
else if(lpszAppDir && testFileExistence(lpszAppDir,
lpszFilename)) {
strcpy(curDir, lpszAppDir);
retval |= VFF_CURNEDEST;
if(!testFileExclusiveExistence(lpszAppDir, lpszFilename))
retval |= VFF_FILEINUSE;
}
}
}
else if(!(flags & VFFF_ISSHAREDFILE)) { /* not a shared file */
if(lpszAppDir) {
char systemDir[256];
GetSystemDirectory32A(systemDir, 256);
strcpy(destDir, lpszAppDir);
if(lpszFilename) {
if(testFileExistence(lpszAppDir, lpszFilename)) {
strcpy(curDir, lpszAppDir);
if(!testFileExclusiveExistence(lpszAppDir, lpszFilename))
retval |= VFF_FILEINUSE;
}
else if(testFileExistence(systemDir, lpszFilename)) {
strcpy(curDir, systemDir);
retval |= VFF_CURNEDEST;
if(!testFileExclusiveExistence(systemDir, lpszFilename))
retval |= VFF_FILEINUSE;
}
}
}
}
curDirSizeReq = strlen(curDir) + 1;
destDirSizeReq = strlen(destDir) + 1;
/* Make sure that the pointers to the size of the buffers are
valid; if not, do NOTHING with that buffer. If that pointer
is valid, then make sure that the buffer pointer is valid, too! */
if(lpuDestDirLen && lpszDestDir) {
if(*lpuDestDirLen < destDirSizeReq) {
retval |= VFF_BUFFTOOSMALL;
strncpy(lpszDestDir, destDir, *lpuDestDirLen - 1);
lpszDestDir[*lpuDestDirLen - 1] = '\0';
}
else
strcpy(lpszDestDir, destDir);
*lpuDestDirLen = destDirSizeReq;
}
if(lpuCurDirLen && lpszCurDir) {
if(*lpuCurDirLen < curDirSizeReq) {
retval |= VFF_BUFFTOOSMALL;
strncpy(lpszCurDir, curDir, *lpuCurDirLen - 1);
lpszCurDir[*lpuCurDirLen - 1] = '\0';
}
else
strcpy(lpszCurDir, curDir);
*lpuCurDirLen = curDirSizeReq;
}
dprintf_ver(stddeb, "VerFindFile() ret = %lu ",
retval);
if(retval) {
dprintf_ver(stddeb, "( ");
if(retval & VFF_CURNEDEST)
dprintf_ver(stddeb, "VFF_CURNEDEST ");
if(retval & VFF_FILEINUSE)
dprintf_ver(stddeb, "VFF_FILEINUSE ");
if(retval & VFF_BUFFTOOSMALL)
dprintf_ver(stddeb, "VFF_BUFFTOOSMALL ");
dprintf_ver(stddeb, ")");
}
dprintf_ver_string("\n\t(Exit) lpszCurDir = ", lpszCurDir, "\n");
if(lpuCurDirLen)
dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = %p (%u)\n",
lpuCurDirLen, *lpuCurDirLen);
else
dprintf_ver(stddeb, "\t(Exit) lpuCurDirLen = (null)\n");
dprintf_ver_string("\t(Exit) lpszDestDir = ", lpszDestDir, "\n");
if(lpuDestDirLen)
dprintf_ver(stddeb, "\t(Exit) lpuDestDirLen = %p (%u)\n",
lpuDestDirLen, *lpuDestDirLen);
return retval;
}
/* VerFindFileA [VERSION.5] */

View File

@ -3,6 +3,13 @@
* (ftp.microsoft.com:/Advsys/winsock/spec11/WINSOCK.TXT)
*
* (C) 1993,1994,1996 John Brezak, Erik Bos, Alex Korobka.
*
* TODO: Merge Async...() handling with X event loop by adding
* thread/task fdset to select(2) in windows/event.c.
* Also fork dns lookup helper during the startup (with a pipe
* for communication) and make it fork for a database request
* instead of forking the main process (i.e. something like
* Netscape 4.0).
*/
#include <stdio.h>
@ -1446,7 +1453,7 @@ FARPROC16 WSASetBlockingHook16(FARPROC16 lpBlockFunc)
FARPROC16 prev;
LPWSINFO pwsi = wsi_find(GetCurrentTask());
dprintf_winsock(stddeb, "WS_SetBlockingHook(%08x): hook %08x\n",
dprintf_winsock(stddeb, "WS_SetBlockingHook16(%08x): hook %08x\n",
(unsigned)pwsi, (unsigned) lpBlockFunc);
if( pwsi ) {
@ -1459,11 +1466,11 @@ FARPROC16 WSASetBlockingHook16(FARPROC16 lpBlockFunc)
FARPROC32 WSASetBlockingHook32(FARPROC32 lpBlockFunc)
{
fprintf( stderr, "Empty stub WSASetBlockingHook32(%p)\n", lpBlockFunc );
return NULL;
fprintf( stderr, "WSASetBlockingHook32(%p): empty stub\n", lpBlockFunc );
return NULL;
}
INT16 WSAUnhookBlockingHook(void)
INT16 WSAUnhookBlockingHook16(void)
{
LPWSINFO pwsi = wsi_find(GetCurrentTask());
@ -1472,6 +1479,12 @@ INT16 WSAUnhookBlockingHook(void)
return SOCKET_ERROR;
}
INT32 WSAUnhookBlockingHook32(void)
{
fprintf( stderr, "WSAUnhookBlockingHook32(): empty stub\n");
return NULL;
}
VOID
WsControl(DWORD x1,DWORD x2,LPDWORD x3,LPDWORD x4,LPDWORD x5,LPDWORD x6)
{

View File

@ -10,6 +10,13 @@
fix that, I guess.
*/
#ifdef linux
#include <ctype.h>
#include <unistd.h>
#include <asm/io.h>
#include <string.h>
#include "options.h"
#endif
#include <stdio.h>
#include <stdlib.h>
@ -33,6 +40,117 @@ static BYTE cmosimage[64] =
0x1b, 0x7b, 0x21, 0x00, 0x00, 0x00, 0x05, 0x5f
};
#ifdef linux
char do_direct_port_access = 0;
char port_permissions[0x10000];
#endif
/**********************************************************************
* IO_port_init
*/
/* set_IO_permissions(int val1, int val)
* Helper function for IO_port_init
*/
#ifdef linux
void set_IO_permissions(int val1, int val, char rw)
{
int j;
if (val1 != -1) {
if (val == -1) val = 0x3ff;
for (j = val1; j <= val; j++)
port_permissions[j] |= rw;
do_direct_port_access = 1;
val1 = -1;
} else if (val != -1) {
do_direct_port_access = 1;
port_permissions[val] |= rw;
}
}
/* do_IO_port_init_read_or_write(char* temp, char rw)
* Helper function for IO_port_init
*/
void do_IO_port_init_read_or_write(char* temp, char rw)
{
int val, val1, i, len;
if (!strcasecmp(temp, "all")) {
fprintf(stderr, "Warning!!! Granting FULL IO port access to"
" windoze programs!\nWarning!!! "
"*** THIS IS NOT AT ALL "
"RECOMMENDED!!! ***\n");
for (i=0; i < sizeof(port_permissions); i++)
port_permissions[i] |= rw;
} else if (!(!strcmp(temp, "*") || *temp == '\0')) {
len = strlen(temp);
val = -1;
val1 = -1;
for (i = 0; i < len; i++) {
switch (temp[i]) {
case '0':
if (temp[i+1] == 'x' || temp[i+1] == 'X') {
sscanf(temp+i, "%x", &val);
i += 2;
} else {
sscanf(temp+i, "%d", &val);
}
while (isxdigit(temp[i]))
i++;
i--;
break;
case ',':
case ' ':
case '\t':
set_IO_permissions(val1, val, rw);
val1 = -1; val = -1;
break;
case '-':
val1 = val;
if (val1 == -1) val1 = 0;
break;
default:
if (temp[i] >= '0' && temp[i] <= '9') {
sscanf(temp+i, "%d", &val);
while (isdigit(temp[i]))
i++;
}
}
}
set_IO_permissions(val1, val, rw);
}
}
#endif
void IO_port_init()
{
#ifdef linux
char temp[1024];
memset(port_permissions, 0, sizeof(port_permissions));
do_direct_port_access = 0;
/* Can we do that? */
if (!iopl(3)) {
iopl(0);
PROFILE_GetWineIniString( "ports", "read", "*",
temp, sizeof(temp) );
do_IO_port_init_read_or_write(temp, 1);
PROFILE_GetWineIniString( "ports", "write", "*",
temp, sizeof(temp) );
do_IO_port_init_read_or_write(temp, 2);
}
#endif
}
/**********************************************************************
* IO_inport
@ -40,27 +158,46 @@ static BYTE cmosimage[64] =
DWORD IO_inport( int port, int count )
{
DWORD res = 0;
BYTE b;
BYTE b;
dprintf_int(stddeb, "IO: %d bytes from port 0x%02x\n", count, port );
#ifdef linux
if (do_direct_port_access) iopl(3);
#endif
dprintf_int(stddeb, "IO: %d bytes from port 0x%02x ", count, port );
while (count-- > 0)
{
switch (port++)
{
case 0x70:
b = cmosaddress;
break;
case 0x71:
b = cmosimage[cmosaddress & 0x3f];
break;
default:
fprintf( stderr, "Direct I/O read attempted from port %x\n", port);
b = 0xff;
break;
}
res = (res << 8) | b;
#ifdef linux
if(port_permissions[port] & 1) {
b = inb(port);
} else
#endif
{
switch (port)
{
case 0x70:
b = cmosaddress;
break;
case 0x71:
b = cmosimage[cmosaddress & 0x3f];
break;
default:
fprintf( stderr,
"Direct I/O read attempted "
"from port %x\n", port);
b = 0xff;
break;
}
}
port++;
res = (res << 8) | b;
}
#ifdef linux
if (do_direct_port_access) iopl(0);
#endif
dprintf_int(stddeb, "( 0x%x )\n", res );
return res;
}
@ -75,21 +212,37 @@ void IO_outport( int port, int count, DWORD value )
dprintf_int( stddeb, "IO: 0x%lx (%d bytes) to port 0x%02x\n",
value, count, port );
#ifdef linux
if (do_direct_port_access) iopl(3);
#endif
while (count-- > 0)
{
b = value & 0xff;
value >>= 8;
switch (port++)
#ifdef linux
if (port_permissions[port] & 2) {
outb(b, port);
} else
#endif
{
case 0x70:
cmosaddress = b & 0x7f;
break;
case 0x71:
cmosimage[cmosaddress & 0x3f] = b;
break;
default:
fprintf( stderr, "Direct I/O write attempted to port %x\n", port );
break;
switch (port)
{
case 0x70:
cmosaddress = b & 0x7f;
break;
case 0x71:
cmosimage[cmosaddress & 0x3f] = b;
break;
default:
fprintf( stderr, "Direct I/O write attempted "
"to port %x\n", port );
break;
}
}
port++;
}
#ifdef linux
if (do_direct_port_access) iopl(0);
#endif
}

View File

@ -87,15 +87,39 @@ static DWORD WAVE_NotifyClient(UINT16 wDevID, WORD wMsg,
{
dprintf_mciwave(stddeb,"WAVE_NotifyClient // wDevID = %04X wMsg = %d dwParm1 = %04lX dwParam2 = %04lX\n",wDevID, wMsg, dwParam1, dwParam2);
if (wDevID > MAX_WAVOUTDRV) return MCIERR_INTERNAL;
switch (wMsg) {
case WOM_OPEN:
case WOM_CLOSE:
case WOM_DONE:
if (wDevID > MAX_WAVOUTDRV) return MCIERR_INTERNAL;
if (WOutDev[wDevID].wFlags != DCB_NULL && !DriverCallback(
WOutDev[wDevID].waveDesc.dwCallBack,
WOutDev[wDevID].wFlags,
WOutDev[wDevID].waveDesc.hWave,
wMsg,
WOutDev[wDevID].waveDesc.dwInstance,
dwParam1,
dwParam2)) {
dprintf_mciwave(stddeb,"WAVE_NotifyClient // can't notify client !\n");
return MMSYSERR_NOERROR;
}
break;
if (WInDev[wDevID].wFlags != DCB_NULL && !DriverCallback(
case WIM_OPEN:
case WIM_CLOSE:
case WIM_DATA:
if (wDevID > MAX_WAVINDRV) return MCIERR_INTERNAL;
if (WInDev[wDevID].wFlags != DCB_NULL && !DriverCallback(
WInDev[wDevID].waveDesc.dwCallBack, WInDev[wDevID].wFlags,
WInDev[wDevID].waveDesc.hWave, wMsg,
WInDev[wDevID].waveDesc.dwInstance, dwParam1, dwParam2)) {
dprintf_mciwave(stddeb,"WAVE_NotifyClient // can't notify client !\n");
return MMSYSERR_NOERROR;
}
dprintf_mciwave(stddeb,"WAVE_NotifyClient // can't notify client !\n");
return MMSYSERR_NOERROR;
}
break;
}
return 0;
}
@ -139,7 +163,7 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS lp
lpstrElementName = (LPSTR)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
dprintf_mciwave(stddeb,"WAVE_mciOpen // MCI_OPEN_ELEMENT '%s' !\n",
lpstrElementName);
if (strlen(lpstrElementName) > 0) {
if ( lpstrElementName && (strlen(lpstrElementName) > 0)) {
strcpy(str, lpstrElementName);
CharUpper32A(str);
MCIWavDev[wDevID].hFile = mmioOpen(str, NULL,
@ -156,7 +180,9 @@ static DWORD WAVE_mciOpen(UINT16 wDevID, DWORD dwFlags, LPMCI_WAVE_OPEN_PARMS lp
memcpy(&MCIWavDev[wDevID].openParms, lpParms, sizeof(MCI_WAVE_OPEN_PARMS));
MCIWavDev[wDevID].wNotifyDeviceID = lpParms->wDeviceID;
lpWaveFormat = &MCIWavDev[wDevID].WaveFormat;
hDesc = USER_HEAP_ALLOC(sizeof(WAVEOPENDESC));
if (hDesc == 0) return MCIERR_INTERNAL; /* is this right ? */
lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hDesc);
lpDesc->hWave = 0;
/*
@ -240,8 +266,8 @@ static DWORD WAVE_mciCue(UINT16 wDevID, DWORD dwParam, LPMCI_GENERIC_PARMS lpPar
MCI_WAVE_INPUT flag. No explicit check on MCI_WAVE_OUTPUT is done since that
is the default.
The flags MCI_NOTIFY (and the callback parameter in lpParms) and MCI_WAIT are
ignored
The flags MCI_NOTIFY (and the callback parameter in lpParms) and MCI_WAIT
are ignored
*/
DWORD dwRet;
@ -484,10 +510,17 @@ static DWORD WAVE_mciRecord(UINT16 wDevID, DWORD dwFlags, LPMCI_RECORD_PARMS lpP
*/
static DWORD WAVE_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{
DWORD dwRet;
dprintf_mciwave(stddeb,
"WAVE_mciStop(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_INTERNAL;
return 0;
if (MCIWavDev[wDevID].fInput)
dwRet = widMessage(wDevID, WIDM_STOP, 0, dwFlags, (DWORD)lpParms);
else
dwRet = wodMessage(wDevID, WODM_STOP, 0, dwFlags, (DWORD)lpParms);
return dwRet;
}
@ -496,10 +529,17 @@ static DWORD WAVE_mciStop(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpPa
*/
static DWORD WAVE_mciPause(UINT16 wDevID, DWORD dwFlags, LPMCI_GENERIC_PARMS lpParms)
{
DWORD dwRet;
dprintf_mciwave(stddeb,
"WAVE_mciPause(%u, %08lX, %p);\n", wDevID, dwFlags, lpParms);
if (lpParms == NULL) return MCIERR_INTERNAL;
return 0;
if (MCIWavDev[wDevID].fInput)
dwRet = widMessage(wDevID, WIDM_PAUSE, 0, dwFlags, (DWORD)lpParms);
else
dwRet = wodMessage(wDevID, WODM_PAUSE, 0, dwFlags, (DWORD)lpParms);
return dwRet;
}
@ -794,6 +834,7 @@ static DWORD wodGetDevCaps(WORD wDevID, LPWAVEOUTCAPS lpCaps, DWORD dwSize)
lpCaps->wPid = 0x0001; /* Product ID */
strcpy(lpCaps->szPname, "Linux WAVOUT Driver");
#endif
lpCaps->vDriverVersion = 0x0100;
lpCaps->dwFormats = 0x00000000;
lpCaps->dwSupport = WAVECAPS_VOLUME;
lpCaps->wChannels = (IOCTL(audio, SNDCTL_DSP_STEREO, dsp_stereo) != 0) ? 1 : 2;
@ -892,7 +933,6 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
memcpy(&WOutDev[wDevID].waveDesc, lpDesc, sizeof(WAVEOPENDESC));
dprintf_mciwave(stddeb,"Linux 'wodOpen' // lpDesc->lpFormat = %p\n",lpDesc->lpFormat);
lpFormat = (LPWAVEFORMAT) PTR_SEG_TO_LIN(lpDesc->lpFormat);
/* lpFormat = lpDesc->lpFormat; */
dprintf_mciwave(stddeb,"Linux 'wodOpen' // lpFormat = %p\n",lpFormat);
if (lpFormat->wFormatTag != WAVE_FORMAT_PCM) {
dprintf_mciwave(stddeb,"Linux 'wodOpen' // Bad format %04X !\n",
@ -941,6 +981,7 @@ static DWORD wodOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
static DWORD wodClose(WORD wDevID)
{
dprintf_mciwave(stddeb,"wodClose(%u);\n", wDevID);
if (wDevID > MAX_WAVOUTDRV) return MMSYSERR_INVALPARAM;
if (WOutDev[wDevID].unixdev == 0) {
dprintf_mciwave(stddeb,"Linux 'wodClose' // can't close !\n");
return MMSYSERR_NOTENABLED;
@ -959,10 +1000,12 @@ static DWORD wodClose(WORD wDevID)
/**************************************************************************
* wodWrite [internal]
*/
static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
static DWORD wodWrite(WORD wDevID, DWORD lpWH, DWORD dwSize)
{
int count;
LPSTR lpData;
LPSTR lpData;
LPWAVEHDR lpWaveHdr = (LPWAVEHDR)PTR_SEG_TO_LIN(lpWH);
dprintf_mciwave(stddeb,"wodWrite(%u, %p, %08lX);\n", wDevID, lpWaveHdr, dwSize);
if (WOutDev[wDevID].unixdev == 0) {
dprintf_mciwave(stddeb,"Linux 'wodWrite' // can't play !\n");
@ -988,7 +1031,7 @@ static DWORD wodWrite(WORD wDevID, LPWAVEHDR lpWaveHdr, DWORD dwSize)
WOutDev[wDevID].dwTotalPlayed += count;
lpWaveHdr->dwFlags &= ~WHDR_INQUEUE;
lpWaveHdr->dwFlags |= WHDR_DONE;
if (WAVE_NotifyClient(wDevID, WOM_DONE, 0L, 0L) != MMSYSERR_NOERROR) {
if (WAVE_NotifyClient(wDevID, WOM_DONE, lpWH, 0) != MMSYSERR_NOERROR) {
dprintf_mciwave(stddeb,"Linux 'wodWrite' // can't notify client !\n");
return MMSYSERR_INVALPARAM;
}
@ -1044,7 +1087,13 @@ static DWORD wodRestart(WORD wDevID)
if (WOutDev[wDevID].unixdev == 0) {
dprintf_mciwave(stddeb,"Linux 'wodRestart' // can't restart !\n");
return MMSYSERR_NOTENABLED;
}
}
/* FIXME: is NotifyClient with WOM_DONE right ? (Comet Busters 1.3.3 needs this notification) */
if (WAVE_NotifyClient(wDevID, WOM_DONE, 0L, 0L) != MMSYSERR_NOERROR) {
dprintf_mciwave(stddeb,"Linux 'wodRestart' // can't notify client !\n");
return MMSYSERR_INVALPARAM;
}
return MMSYSERR_NOERROR;
}
@ -1181,9 +1230,11 @@ DWORD wodMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
case WODM_CLOSE:
return wodClose(wDevID);
case WODM_WRITE:
return wodWrite(wDevID, (LPWAVEHDR)PTR_SEG_TO_LIN(dwParam1), dwParam2);
return wodWrite(wDevID, dwParam1, dwParam2);
case WODM_PAUSE:
return 0L;
case WODM_STOP:
return 0L;
case WODM_GETPOS:
return wodGetPosition(wDevID, (LPMMTIME)PTR_SEG_TO_LIN(dwParam1), dwParam2);
case WODM_BREAKLOOP:
@ -1344,7 +1395,6 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
WInDev[wDevID].dwTotalRecorded = 0;
memcpy(&WInDev[wDevID].waveDesc, lpDesc, sizeof(WAVEOPENDESC));
lpFormat = (LPWAVEFORMAT) PTR_SEG_TO_LIN(lpDesc->lpFormat);
/* lpFormat = lpDesc->lpFormat; */
if (lpFormat->wFormatTag != WAVE_FORMAT_PCM) {
dprintf_mciwave(stddeb,"Linux 'widOpen' // Bad format %04X !\n",
lpFormat->wFormatTag);
@ -1387,6 +1437,7 @@ static DWORD widOpen(WORD wDevID, LPWAVEOPENDESC lpDesc, DWORD dwFlags)
static DWORD widClose(WORD wDevID)
{
dprintf_mciwave(stddeb,"widClose(%u);\n", wDevID);
if (wDevID > MAX_WAVINDRV) return MMSYSERR_INVALPARAM;
if (WInDev[wDevID].unixdev == 0) {
dprintf_mciwave(stddeb,"Linux 'widClose' // can't close !\n");
return MMSYSERR_NOTENABLED;
@ -1521,6 +1572,9 @@ static DWORD widStart(WORD wDevID)
WInDev[wDevID].dwTotalRecorded += lpWIHdr->dwBytesRecorded;
lpWIHdr->dwFlags &= ~WHDR_INQUEUE;
lpWIHdr->dwFlags |= WHDR_DONE;
/* FIXME here should be a segmented address in stead of lpWIHdr */
if (WAVE_NotifyClient(wDevID, WIM_DATA, (DWORD)lpWIHdr, 0L) !=
MMSYSERR_NOERROR) {
dprintf_mciwave(stddeb, "Linux 'widStart' // can't notify client !\n");
@ -1530,7 +1584,7 @@ static DWORD widStart(WORD wDevID)
count++;
}
dprintf_mciwave(stddeb,"widStart // end of recording !\n");
fflush(stdout);
fflush(stddeb);
return MMSYSERR_NOERROR;
}
@ -1658,6 +1712,8 @@ DWORD widMessage(WORD wDevID, WORD wMsg, DWORD dwUser,
return widReset(wDevID);
case WIDM_START:
return widStart(wDevID);
case WIDM_PAUSE:
return widStop(wDevID);
case WIDM_STOP:
return widStop(wDevID);
default:
@ -1728,6 +1784,42 @@ LONG WAVE_DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
return WAVE_mciGetDevCaps(dwDevID, dwParam1, (LPMCI_GETDEVCAPS_PARMS)PTR_SEG_TO_LIN(dwParam2));
case MCI_INFO:
return WAVE_mciInfo(dwDevID, dwParam1, (LPMCI_INFO_PARMS)PTR_SEG_TO_LIN(dwParam2));
case MCI_LOAD:
return MMSYSERR_NOTSUPPORTED;
case MCI_SAVE:
return MMSYSERR_NOTSUPPORTED;
case MCI_SEEK:
return MMSYSERR_NOTSUPPORTED;
case MCI_FREEZE:
return MMSYSERR_NOTSUPPORTED;
case MCI_PUT:
return MMSYSERR_NOTSUPPORTED;
case MCI_REALIZE:
return MMSYSERR_NOTSUPPORTED;
case MCI_UNFREEZE:
return MMSYSERR_NOTSUPPORTED;
case MCI_UPDATE:
return MMSYSERR_NOTSUPPORTED;
case MCI_WHERE:
return MMSYSERR_NOTSUPPORTED;
case MCI_WINDOW:
return MMSYSERR_NOTSUPPORTED;
case MCI_STEP:
return MMSYSERR_NOTSUPPORTED;
case MCI_SPIN:
return MMSYSERR_NOTSUPPORTED;
case MCI_ESCAPE:
return MMSYSERR_NOTSUPPORTED;
case MCI_COPY:
return MMSYSERR_NOTSUPPORTED;
case MCI_CUT:
return MMSYSERR_NOTSUPPORTED;
case MCI_DELETE:
return MMSYSERR_NOTSUPPORTED;
case MCI_PASTE:
return MMSYSERR_NOTSUPPORTED;
default:
return DefDriverProc(dwDevID, hDriv, wMsg, dwParam1, dwParam2);
}

View File

@ -350,13 +350,13 @@ MCISTR_Open(_MCISTR_PROTO_) {
i=0;
while (i<nrofkeywords) {
FLAG1("shareable",MCI_OPEN_SHAREABLE);
if (!strcmp(keywords[i],"alias") && (i+1<nrofkeywords)) {
if (!STRCMP(keywords[i],"alias") && (i+1<nrofkeywords)) {
dwFlags |= MCI_OPEN_ALIAS;
pU->openParams.lpstrAlias=SEGPTR_GET(SEGPTR_STRDUP(keywords[i+1]));
i+=2;
continue;
}
if (!strcmp(keywords[i],"element") && (i+1<nrofkeywords)) {
if (!STRCMP(keywords[i],"element") && (i+1<nrofkeywords)) {
dwFlags |= MCI_OPEN_ELEMENT;
pU->openParams.lpstrElementName=SEGPTR_GET(SEGPTR_STRDUP(keywords[i+1]));
i+=2;
@ -2104,7 +2104,7 @@ struct _MCISTR_cmdtable {
DWORD mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
UINT16 uReturnLength, HWND16 hwndCallback)
{
char *cmd,*dev,*args,**keywords;
char *cmd,*dev,*args,**keywords,*filename;
WORD uDevTyp=0,wDevID=0;
DWORD dwFlags;
int res=0,i,nrofkeywords;
@ -2143,16 +2143,23 @@ DWORD mciSendString (LPCSTR lpstrCommand, LPSTR lpstrReturnString,
}
dwFlags = 0; /* default flags */
for (i=0;i<nrofkeywords;) {
if (!STRCMP(keywords[i],"type")) {
filename = dev;
dev = keywords[i+1];
memcpy(keywords+i,keywords+(i+2),(nrofkeywords-i-2)*sizeof(char *));
nrofkeywords -= 2;
continue;
}
if (!STRCMP(keywords[i],"wait")) {
dwFlags |= MCI_WAIT;
memcpy(keywords+i,keywords+(i+1),nrofkeywords-i-1);
memcpy(keywords+i,keywords+(i+1),(nrofkeywords-i-1)*sizeof(char *));
nrofkeywords--;
continue;
}
if (!STRCMP(keywords[i],"notify")) {
/* how should we callback? I don't know. */
/*dwFlags |= MCI_NOTIFY;*/
memcpy(keywords+i,keywords+(i+1),nrofkeywords-i-1);
memcpy(keywords+i,keywords+(i+1),(nrofkeywords-i-1)*sizeof(char *));
nrofkeywords--;
continue;
}

View File

@ -5,7 +5,10 @@
*/
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/ioctl.h>
@ -23,6 +26,7 @@
#include <linux/soundcard.h>
#elif __FreeBSD__
#include <machine/soundcard.h>
#include <sys/errno.h>
#endif
#if defined(linux) || defined(__FreeBSD__)

View File

@ -14,6 +14,7 @@
#include <fcntl.h>
#include <sys/ioctl.h>
#include "windows.h"
#include "win.h"
#include "heap.h"
#include "ldt.h"
#include "user.h"
@ -23,6 +24,7 @@
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#include "callback.h"
static int InstalledCount;
static int InstalledListLen;
@ -269,6 +271,8 @@ LRESULT DriverProc(DWORD dwDevID, HDRVR16 hDriv, WORD wMsg,
BOOL16 DriverCallback(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
WORD wMsg, DWORD dwUser, DWORD dwParam1, DWORD dwParam2)
{
LPWAVEOPENDESC lpDesc;
dprintf_mmsys(stddeb, "DriverCallback(%08lX, %04X, %04X, %04X, %08lX, %08lX, %08lX); !\n",
dwCallBack, uFlags, hDev, wMsg, dwUser, dwParam1, dwParam2);
switch(uFlags & DCB_TYPEMASK) {
@ -276,7 +280,14 @@ BOOL16 DriverCallback(DWORD dwCallBack, UINT16 uFlags, HANDLE16 hDev,
dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_NULL !\n");
break;
case DCB_WINDOW:
dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_WINDOW !\n");
dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_WINDOW = %04lX!\n",dwCallBack);
if (!IsWindow32(dwCallBack)) return FALSE;
dprintf_mmsys(stddeb, "DriverCallback() // Device Handle = %04X\n", hDev);
lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hDev);
if (lpDesc == NULL) return FALSE;
dprintf_mmsys(stddeb, "DriverCallback() // Before PostMessage16\n");
PostMessage16((HWND16)dwCallBack, wMsg, hDev, dwParam1);
break;
case DCB_TASK:
dprintf_mmsys(stddeb, "DriverCallback() // CALLBACK_TASK !\n");
@ -855,7 +866,8 @@ DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS lpParms)
/**************************************************************************
* mciSound [internal]
*/
* not used anymore ??
DWORD mciSound(UINT16 wDevID, DWORD dwParam, LPMCI_SOUND_PARMS lpParms)
{
if (lpParms == NULL) return MCIERR_INTERNAL;
@ -863,7 +875,8 @@ DWORD mciSound(UINT16 wDevID, DWORD dwParam, LPMCI_SOUND_PARMS lpParms)
dprintf_mci(stddeb, "MCI_SOUND // file='%s' !\n", lpParms->lpstrSoundName);
return MCIERR_INVALID_DEVICE_ID;
}
*
*/
static const char *_mciCommandToString(UINT16 wMsg)
{
@ -1464,6 +1477,8 @@ UINT16 waveOutGetNumDevs()
*/
UINT16 waveOutGetDevCaps(UINT16 uDeviceID, WAVEOUTCAPS * lpCaps, UINT16 uSize)
{
if (uDeviceID > waveOutGetNumDevs() - 1) return MMSYSERR_BADDEVICEID;
if (uDeviceID == (UINT16)WAVE_MAPPER) return MMSYSERR_BADDEVICEID; /* FIXME: do we have a wave mapper ? */
dprintf_mmsys(stddeb, "waveOutGetDevCaps\n");
return wodMessage(uDeviceID, WODM_GETDEVCAPS, 0L, (DWORD)lpCaps, uSize);
}
@ -1579,17 +1594,17 @@ UINT16 waveOutOpen(HWAVEOUT16 * lphWaveOut, UINT16 uDeviceID,
lpDesc->dwInstance = dwInstance;
while(uDeviceID < MAXWAVEDRIVERS) {
dwRet = wodMessage(uDeviceID, WODM_OPEN,
lpDesc->dwInstance, (DWORD)lp16Desc, 0L);
lpDesc->dwInstance, (DWORD)lp16Desc, dwFlags);
if (dwRet == MMSYSERR_NOERROR) break;
if (!bMapperFlg) break;
uDeviceID++;
dprintf_mmsys(stddeb, "waveOutOpen // WAVE_MAPPER mode ! try next driver...\n");
}
lpDesc->uDeviceID = uDeviceID; /* save physical Device ID */
if (dwFlags & WAVE_FORMAT_QUERY) {
dprintf_mmsys(stddeb, "waveOutOpen // End of WAVE_FORMAT_QUERY !\n");
waveOutClose(hWaveOut);
dwRet = waveOutClose(hWaveOut);
}
lpDesc->uDeviceID = uDeviceID; /* save physical Device ID */
return dwRet;
}
@ -1791,9 +1806,6 @@ UINT16 waveOutGetID(HWAVEOUT16 hWaveOut, UINT16 * lpuDeviceID)
lpDesc = (LPWAVEOPENDESC) USER_HEAP_LIN_ADDR(hWaveOut);
if (lpDesc == NULL) return MMSYSERR_INVALHANDLE;
if (lpuDeviceID == NULL) return MMSYSERR_INVALHANDLE;
/*
*lpuDeviceID = lpParms->wDeviceID;
*/
*lpuDeviceID = lpDesc->uDeviceID;
return 0;
}
@ -1884,6 +1896,7 @@ UINT16 waveInOpen(HWAVEIN16 * lphWaveIn, UINT16 uDeviceID,
uDeviceID++;
dprintf_mmsys(stddeb, "waveInOpen // WAVE_MAPPER mode ! try next driver...\n");
}
lpDesc->uDeviceID = uDeviceID;
if (dwFlags & WAVE_FORMAT_QUERY) {
dprintf_mmsys(stddeb, "waveInOpen // End of WAVE_FORMAT_QUERY !\n");
waveInClose(hWaveIn);
@ -2074,7 +2087,13 @@ HMMIO16 mmioOpen(LPSTR szFileName, MMIOINFO * lpmmioinfo, DWORD dwOpenFlags)
HMMIO16 hmmio;
OFSTRUCT ofs;
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
dprintf_mmio(stddeb, "mmioOpen('%s', %p, %08lX);\n", szFileName, lpmmioinfo, dwOpenFlags);
if (!szFileName)
{
/* FIXME: should load memory file if szFileName == NULL */
fprintf(stderr, "WARNING: mmioOpen(): szFileName == NULL (memory file ???)\n");
return 0;
}
hFile = OpenFile32(szFileName, &ofs, dwOpenFlags);
if (hFile == -1) return 0;
hmmio = GlobalAlloc16(GMEM_MOVEABLE, sizeof(MMIOINFO));
@ -2084,7 +2103,7 @@ HMMIO16 mmioOpen(LPSTR szFileName, MMIOINFO * lpmmioinfo, DWORD dwOpenFlags)
lpmminfo->hmmio = hmmio;
lpmminfo->dwReserved2 = hFile;
GlobalUnlock16(hmmio);
dprintf_mmsys(stddeb, "mmioOpen // return hmmio=%04X\n", hmmio);
dprintf_mmio(stddeb, "mmioOpen // return hmmio=%04X\n", hmmio);
return hmmio;
}
@ -2095,7 +2114,7 @@ HMMIO16 mmioOpen(LPSTR szFileName, MMIOINFO * lpmmioinfo, DWORD dwOpenFlags)
UINT16 mmioClose(HMMIO16 hmmio, UINT16 uFlags)
{
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
dprintf_mmio(stddeb, "mmioClose(%04X, %04X);\n", hmmio, uFlags);
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
_lclose32((HFILE32)lpmminfo->dwReserved2);
@ -2131,7 +2150,7 @@ LONG mmioWrite(HMMIO16 hmmio, HPCSTR pch, LONG cch)
{
LONG count;
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
dprintf_mmio(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
count = _lwrite32(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
@ -2146,10 +2165,10 @@ LONG mmioSeek(HMMIO16 hmmio, LONG lOffset, int iOrigin)
{
int count;
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
dprintf_mmio(stddeb, "mmioSeek(%04X, %08lX, %d);\n", hmmio, lOffset, iOrigin);
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) {
dprintf_mmsys(stddeb, "mmioSeek // can't lock hmmio=%04X !\n", hmmio);
dprintf_mmio(stddeb, "mmioSeek // can't lock hmmio=%04X !\n", hmmio);
return 0;
}
count = _llseek32((HFILE32)lpmminfo->dwReserved2, lOffset, iOrigin);
@ -2163,7 +2182,7 @@ LONG mmioSeek(HMMIO16 hmmio, LONG lOffset, int iOrigin)
UINT16 mmioGetInfo(HMMIO16 hmmio, MMIOINFO * lpmmioinfo, UINT16 uFlags)
{
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioGetInfo\n");
dprintf_mmio(stddeb, "mmioGetInfo\n");
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
memcpy(lpmmioinfo, lpmminfo, sizeof(MMIOINFO));
@ -2177,7 +2196,7 @@ UINT16 mmioGetInfo(HMMIO16 hmmio, MMIOINFO * lpmmioinfo, UINT16 uFlags)
UINT16 mmioSetInfo(HMMIO16 hmmio, const MMIOINFO * lpmmioinfo, UINT16 uFlags)
{
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioSetInfo\n");
dprintf_mmio(stddeb, "mmioSetInfo\n");
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
GlobalUnlock16(hmmio);
@ -2190,7 +2209,7 @@ UINT16 mmioSetInfo(HMMIO16 hmmio, const MMIOINFO * lpmmioinfo, UINT16 uFlags)
UINT16 mmioSetBuffer(HMMIO16 hmmio, LPSTR pchBuffer,
LONG cchBuffer, UINT16 uFlags)
{
dprintf_mmsys(stddeb, "mmioSetBuffer // empty stub \n");
dprintf_mmio(stddeb, "mmioSetBuffer // empty stub \n");
return 0;
}
@ -2200,7 +2219,7 @@ UINT16 mmioSetBuffer(HMMIO16 hmmio, LPSTR pchBuffer,
UINT16 mmioFlush(HMMIO16 hmmio, UINT16 uFlags)
{
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
dprintf_mmio(stddeb, "mmioFlush(%04X, %04X)\n", hmmio, uFlags);
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
GlobalUnlock16(hmmio);
@ -2214,7 +2233,7 @@ UINT16 mmioAdvance(HMMIO16 hmmio, MMIOINFO * lpmmioinfo, UINT16 uFlags)
{
int count = 0;
LPMMIOINFO lpmminfo;
dprintf_mmsys(stddeb, "mmioAdvance\n");
dprintf_mmio(stddeb, "mmioAdvance\n");
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
if (uFlags == MMIO_READ) {
@ -2236,7 +2255,7 @@ UINT16 mmioAdvance(HMMIO16 hmmio, MMIOINFO * lpmmioinfo, UINT16 uFlags)
*/
FOURCC mmioStringToFOURCC(LPCSTR sz, UINT16 uFlags)
{
dprintf_mmsys(stddeb, "mmioStringToFOURCC // empty stub \n");
dprintf_mmio(stddeb, "mmioStringToFOURCC // empty stub \n");
return 0;
}
@ -2246,7 +2265,7 @@ FOURCC mmioStringToFOURCC(LPCSTR sz, UINT16 uFlags)
LPMMIOPROC mmioInstallIOProc(FOURCC fccIOProc,
LPMMIOPROC pIOProc, DWORD dwFlags)
{
dprintf_mmsys(stddeb, "mmioInstallIOProc // empty stub \n");
dprintf_mmio(stddeb, "mmioInstallIOProc // empty stub \n");
return 0;
}
@ -2256,7 +2275,7 @@ LPMMIOPROC mmioInstallIOProc(FOURCC fccIOProc,
LRESULT mmioSendMessage(HMMIO16 hmmio, UINT16 uMessage,
LPARAM lParam1, LPARAM lParam2)
{
dprintf_mmsys(stddeb, "mmioSendMessage // empty stub \n");
dprintf_mmio(stddeb, "mmioSendMessage // empty stub \n");
return 0;
}
@ -2275,6 +2294,7 @@ UINT16 mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
if (lpmminfo == NULL) return 0;
dwfcc = lpck->ckid;
dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX\n", dwfcc);
dprintf_mmio(stddeb, "mmioDescend // hfile = %ld\n", lpmminfo->dwReserved2);
dwOldPos = _llseek32((HFILE32)lpmminfo->dwReserved2, 0, SEEK_CUR);
dprintf_mmio(stddeb, "mmioDescend // dwOldPos=%ld\n", dwOldPos);
if (lpckParent != NULL) {
@ -2282,14 +2302,26 @@ UINT16 mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
dwOldPos = _llseek32((HFILE32)lpmminfo->dwReserved2,
lpckParent->dwDataOffset, SEEK_SET);
}
/*
It seems to be that FINDRIFF should not be treated the same as the
other FINDxxx so I treat it as a MMIO_FINDxxx
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDRIFF) ||
(uFlags & MMIO_FINDLIST)) {
*/
if ((uFlags & MMIO_FINDCHUNK) || (uFlags & MMIO_FINDLIST)) {
dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
while (TRUE) {
if (_lread32((HFILE32)lpmminfo->dwReserved2, (LPSTR)lpck,
sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
size_t ix;
ix =_lread32((HFILE32)lpmminfo->dwReserved2, (LPSTR)lpck, sizeof(MMCKINFO));
dprintf_mmio(stddeb, "mmioDescend // after _lread32 ix = %d req = %d, errno = %d\n",ix,sizeof(MMCKINFO),errno);
if (ix < sizeof(MMCKINFO)) {
_llseek32((HFILE32)lpmminfo->dwReserved2, dwOldPos, SEEK_SET);
GlobalUnlock16(hmmio);
dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound\n");
return MMIOERR_CHUNKNOTFOUND;
}
dprintf_mmio(stddeb, "mmioDescend // dwfcc=%08lX ckid=%08lX cksize=%08lX !\n",
@ -2306,6 +2338,7 @@ UINT16 mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
_llseek32((HFILE32)lpmminfo->dwReserved2, dwOldPos, SEEK_SET);
GlobalUnlock16(hmmio);
dprintf_mmio(stddeb, "mmioDescend // return ChunkNotFound 2nd\n");
return MMIOERR_CHUNKNOTFOUND;
}
}
@ -2317,7 +2350,7 @@ UINT16 mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
GlobalUnlock16(hmmio);
dprintf_mmio(stddeb, "mmioDescend // lpck->ckid=%08lX lpck->cksize=%ld !\n",
lpck->ckid, lpck->cksize);
dprintf_mmsys(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
dprintf_mmio(stddeb, "mmioDescend // lpck->fccType=%08lX !\n", lpck->fccType);
return 0;
}
@ -2326,7 +2359,7 @@ UINT16 mmioDescend(HMMIO16 hmmio, MMCKINFO * lpck,
*/
UINT16 mmioAscend(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
{
dprintf_mmsys(stddeb, "mmioAscend // empty stub !\n");
dprintf_mmio(stddeb, "mmioAscend // empty stub !\n");
return 0;
}
@ -2335,7 +2368,7 @@ UINT16 mmioAscend(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
*/
UINT16 mmioCreateChunk(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
{
dprintf_mmsys(stddeb, "mmioCreateChunk // empty stub \n");
dprintf_mmio(stddeb, "mmioCreateChunk // empty stub \n");
return 0;
}
@ -2346,7 +2379,7 @@ UINT16 mmioCreateChunk(HMMIO16 hmmio, MMCKINFO * lpck, UINT16 uFlags)
UINT16 mmioRename(LPCSTR szFileName, LPCSTR szNewFileName,
MMIOINFO * lpmmioinfo, DWORD dwRenameFlags)
{
dprintf_mmsys(stddeb, "mmioRename('%s', '%s', %p, %08lX); // empty stub \n",
dprintf_mmio(stddeb, "mmioRename('%s', '%s', %p, %08lX); // empty stub \n",
szFileName, szNewFileName, lpmmioinfo, dwRenameFlags);
return 0;
}

View File

@ -37,6 +37,14 @@ typedef struct tagTIMERENTRY {
static LPTIMERENTRY lpTimerList = NULL;
/*
* FIXME
* is this the minimum resolution ?
*/
#define MMSYSTIME_MININTERVAL (33)
#define MMSYSTIME_MAXINTERVAL (65535)
/**************************************************************************
* TIME_MMSysTimeCallback
*/
@ -44,7 +52,7 @@ static VOID TIME_MMSysTimeCallback( HWND32 hwnd, UINT32 msg,
UINT32 id, DWORD dwTime )
{
LPTIMERENTRY lpTimer = lpTimerList;
mmSysTimeMS.u.ms += 33;
mmSysTimeMS.u.ms += MMSYSTIME_MININTERVAL;
mmSysTimeSMPTE.u.smpte.frame++;
while (lpTimer != NULL) {
lpTimer->wCurTime--;
@ -99,7 +107,7 @@ static void StartMMTime()
mmSysTimeSMPTE.u.smpte.frame = 0;
mmSysTimeSMPTE.u.smpte.fps = 0;
mmSysTimeSMPTE.u.smpte.dummy = 0;
SetTimer32( 0, 1, 33, TIME_MMSysTimeCallback );
SetTimer32( 0, 1, MMSYSTIME_MININTERVAL, TIME_MMSysTimeCallback );
}
}
@ -111,6 +119,8 @@ WORD timeGetSystemTime(LPMMTIME lpTime, WORD wSize)
dprintf_mmsys(stddeb, "timeGetSystemTime(%p, %u);\n", lpTime, wSize);
if (!mmTimeStarted)
StartMMTime();
lpTime->wType = TIME_MS;
lpTime->u.ms = mmSysTimeMS.u.ms;
return 0;
}
@ -185,7 +195,11 @@ WORD timeKillEvent(WORD wID)
*/
WORD timeGetDevCaps(LPTIMECAPS lpCaps, WORD wSize)
{
dprintf_mmsys(stddeb, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
dprintf_mmtime(stddeb, "timeGetDevCaps(%p, %u) !\n", lpCaps, wSize);
if (!mmTimeStarted)
StartMMTime();
lpCaps->wPeriodMin = MMSYSTIME_MININTERVAL;
lpCaps->wPeriodMax = MMSYSTIME_MAXINTERVAL;
return 0;
}
@ -194,9 +208,11 @@ WORD timeGetDevCaps(LPTIMECAPS lpCaps, WORD wSize)
*/
WORD timeBeginPeriod(WORD wPeriod)
{
dprintf_mmsys(stddeb, "timeBeginPeriod(%u) !\n", wPeriod);
dprintf_mmtime(stddeb, "timeBeginPeriod(%u) !\n", wPeriod);
if (!mmTimeStarted)
StartMMTime();
if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
return TIMERR_NOCANDO;
return 0;
}
@ -205,7 +221,9 @@ WORD timeBeginPeriod(WORD wPeriod)
*/
WORD timeEndPeriod(WORD wPeriod)
{
dprintf_mmsys(stddeb, "timeEndPeriod(%u) !\n", wPeriod);
dprintf_mmtime(stddeb, "timeEndPeriod(%u) !\n", wPeriod);
if (wPeriod < MMSYSTIME_MININTERVAL || wPeriod > MMSYSTIME_MAXINTERVAL)
return TIMERR_NOCANDO;
return 0;
}
@ -214,8 +232,9 @@ WORD timeEndPeriod(WORD wPeriod)
*/
DWORD timeGetTime()
{
dprintf_mmsys(stddeb, "timeGetTime(); !\n");
dprintf_mmtime(stddeb, "timeGetTime(); !\n");
if (!mmTimeStarted)
StartMMTime();
return 0;
dprintf_mmtime(stddeb, "timeGetTime() // Time = %ld\n",mmSysTimeMS.u.ms);
return mmSysTimeMS.u.ms;
}

View File

@ -31,8 +31,8 @@
* because pixel values can be calculated without X server
* assistance.
*
* For some info about general Windows palette management read
* http://198.105.232.5/MSDN/LIBRARY/TECHNOTE/CH3.HTM
* Windows palette manager is described in the
* http://premium.microsoft.com/msdn/library/techart/f30/f34/f40/d4d/sa942.htm
*/
typedef struct
@ -41,7 +41,8 @@ typedef struct
UINT16 size;
UINT16 flags;
INT32 monoPlane; /* bit plane different for white and black pixels */
BOOL32 bWhiteOn; /* monoPlane bit is 1 for the white pixel */
INT32 (*mapColor)( DC*, COLORREF );
} CSPACE;
static CSPACE cSpace = {0, 0, 0};
@ -61,7 +62,6 @@ static int COLOR_Graymax = 0;
* currently inactive window it changes only DC palette mappings.
*/
#define NB_RESERVED_COLORS 20 /* number of fixed colors in system palette */
#define NB_COLORCUBE_START_INDEX 63
Visual* visual = NULL;
@ -143,6 +143,11 @@ UINT16 COLOR_GetSystemPaletteFlags(void)
return cSpace.flags;
}
const PALETTEENTRY* COLOR_GetSystemPaletteTemplate(void)
{
return __sysPalTemplate;
}
COLORREF COLOR_GetSystemPaletteEntry(UINT32 i)
{
return *(COLORREF*)(COLOR_sysPal + i) & 0x00ffffff;
@ -176,7 +181,10 @@ BOOL32 COLOR_CheckSysColor(COLORREF c)
return 1;
}
void COLOR_FillDefaultColors(void)
/***********************************************************************
* Colormap Initialization
*/
static void COLOR_FillDefaultColors(void)
{
/* initialize unused entries to what Windows uses as a color
* cube - based on Greg Kreider's code.
@ -530,58 +538,6 @@ static BOOL32 COLOR_BuildSharedMap(CSPACE* cs)
return TRUE;
}
/***********************************************************************
* COLOR_InitPalette
*
* Create the system palette.
*/
static HPALETTE16 COLOR_InitPalette(void)
{
int i;
HPALETTE16 hpalette;
LOGPALETTE * palPtr;
PALETTEOBJ* palObj;
memset(COLOR_freeList, 0, 256*sizeof(unsigned char));
if (cSpace.flags & COLOR_PRIVATE)
COLOR_BuildPrivateMap( &cSpace );
else
COLOR_BuildSharedMap( &cSpace );
/* Build free list */
if( COLOR_firstFree != -1 )
COLOR_FormatSystemPalette();
COLOR_FillDefaultColors();
/* create default palette (20 system colors) */
palPtr = xmalloc( sizeof(LOGPALETTE) + (NB_RESERVED_COLORS-1)*sizeof(PALETTEENTRY) );
if (!palPtr) return FALSE;
palPtr->palVersion = 0x300;
palPtr->palNumEntries = NB_RESERVED_COLORS;
for( i = 0; i < NB_RESERVED_COLORS; i ++ )
{
palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed;
palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen;
palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue;
palPtr->palPalEntry[i].peFlags = 0;
}
hpalette = CreatePalette16( palPtr );
palObj = (PALETTEOBJ*) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palObj->mapping = xmalloc( sizeof(int) * 20 );
free( palPtr );
return hpalette;
}
/***********************************************************************
* COLOR_Computeshifts
*
@ -609,10 +565,9 @@ static void COLOR_Computeshifts(unsigned long maskbits, int *shift, int *max)
/***********************************************************************
* COLOR_Init
*
* Initialize color map and system palette.
*
* Initialize color management.
*/
HPALETTE16 COLOR_Init(void)
BOOL32 COLOR_Init(void)
{
int mask, white, black;
@ -680,7 +635,21 @@ HPALETTE16 COLOR_Init(void)
dprintf_palette(stddeb," visual class %i (%i)\n",
visual->class, cSpace.monoPlane);
return COLOR_InitPalette();
memset(COLOR_freeList, 0, 256*sizeof(unsigned char));
if (cSpace.flags & COLOR_PRIVATE)
COLOR_BuildPrivateMap( &cSpace );
else
COLOR_BuildSharedMap( &cSpace );
/* Build free list */
if( COLOR_firstFree != -1 )
COLOR_FormatSystemPalette();
COLOR_FillDefaultColors();
return TRUE;
}
/***********************************************************************
@ -868,31 +837,8 @@ COLORREF COLOR_ToLogical(int pixel)
int COLOR_ToPhysical( DC *dc, COLORREF color )
{
WORD index = 0;
unsigned char spec_type;
HPALETTE16 hPal = (dc)? dc->w.hPalette: STOCK_DEFAULT_PALETTE;
spec_type = color >> 24;
if( spec_type == 0xff )
{
spec_type = 0; /* 'write' seems to need that for 'Page 1' text */
color &= 0xffffff;
}
if( spec_type > 2 )
{
dprintf_palette(stddeb, "COLOR_ToPhysical : invalid RGB specifier for: %08lx\n", color);
spec_type = 0;
}
if (dc && (dc->w.bitsPerPixel == 1) && (spec_type == 0))
{
/* monochrome */
if (((color >> 16) & 0xff) +
((color >> 8) & 0xff) + (color & 0xff) > 255*3/2)
return 1; /* white */
else return 0; /* black */
}
unsigned char spec_type = color >> 24;
if ( cSpace.flags & COLOR_FIXED )
{
@ -919,7 +865,7 @@ int COLOR_ToPhysical( DC *dc, COLORREF color )
case 1: /* PALETTEINDEX */
if ( (idx = color & 0xffff) >= palPtr->logpalette.palNumEntries)
if( (idx = color & 0xffff) >= palPtr->logpalette.palNumEntries)
{
fprintf(stderr, "\tRGB(%lx) : idx %d is out of bounds, assuming black\n", color, idx);
return 0;
@ -928,11 +874,16 @@ int COLOR_ToPhysical( DC *dc, COLORREF color )
if( palPtr->mapping ) return palPtr->mapping[idx];
color = *(COLORREF*)(palPtr->logpalette.palPalEntry + idx);
break;
/* fall through and out */
default:
color &= 0xffffff;
/* fall through to RGB */
case 0: /* RGB */
default:
if( dc && (dc->w.bitsPerPixel == 1) )
return (((color >> 16) & 0xff) +
((color >> 8) & 0xff) + (color & 0xff) > 255*3/2) ? 1 : 0;
}
red = GetRValue(color); green = GetGValue(color); blue = GetBValue(color);
@ -965,7 +916,14 @@ int COLOR_ToPhysical( DC *dc, COLORREF color )
switch(spec_type) /* we have to peruse DC and system palette */
{
default:
color &= 0xffffff;
/* fall through to RGB */
case 0: /* RGB */
if( dc && (dc->w.bitsPerPixel == 1) )
return (((color >> 16) & 0xff) +
((color >> 8) & 0xff) + (color & 0xff) > 255*3/2) ? 1 : 0;
index = COLOR_PaletteLookupPixel( COLOR_sysPal, 256,
COLOR_PaletteToPixel, color, FALSE);

View File

@ -14,6 +14,7 @@
#include "color.h"
#include "debug.h"
#include "font.h"
#include "x11font.h"
extern void CLIPPING_UpdateGCRegion( DC * dc ); /* objects/clipping.c */
@ -301,17 +302,28 @@ BOOL32 DC_SetupGCForPen( DC * dc )
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
if ((screenDepth <= 8) && /* FIXME: Should check for palette instead */
((dc->w.ROPmode == R2_BLACK) || (dc->w.ROPmode == R2_WHITE)))
switch (dc->w.ROPmode)
{
val.function = GXcopy;
val.foreground = COLOR_ToPhysical( NULL, (dc->w.ROPmode == R2_BLACK) ?
RGB(0,0,0) : RGB(255,255,255) );
}
else
{
val.function = DC_XROPfunction[dc->w.ROPmode-1];
val.foreground = dc->u.x.pen.pixel;
case R2_BLACK :
val.foreground = BlackPixel(display, DefaultScreen(display));
val.function = GXcopy;
break;
case R2_WHITE :
val.foreground = WhitePixel(display, DefaultScreen(display));
val.function = GXcopy;
break;
case R2_XORPEN :
val.foreground = dc->u.x.pen.pixel;
/* It is very unlikely someone wants to XOR with 0 */
/* This fixes the rubber-drawings in paintbrush */
if (val.foreground == 0)
val.foreground = BlackPixel(display, DefaultScreen(display))
^ WhitePixel(display, DefaultScreen(display));
val.function = GXxor;
break;
default :
val.foreground = dc->u.x.pen.pixel;
val.function = DC_XROPfunction[dc->w.ROPmode-1];
}
val.background = dc->w.backgroundPixel;
val.fill_style = FillSolid;
@ -341,25 +353,27 @@ BOOL32 DC_SetupGCForPen( DC * dc )
*/
BOOL32 DC_SetupGCForText( DC * dc )
{
XGCValues val;
XFontStruct* xfs = XFONT_GetFontStruct( dc->u.x.font );
if (!dc->u.x.font.fstruct)
if( xfs )
{
fprintf( stderr, "DC_SetupGCForText: fstruct is NULL. Please report this\n" );
return FALSE;
}
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
XGCValues val;
val.function = GXcopy; /* Text is always GXcopy */
val.foreground = dc->w.textPixel;
val.background = dc->w.backgroundPixel;
val.fill_style = FillSolid;
val.font = dc->u.x.font.fstruct->fid;
XChangeGC( display, dc->u.x.gc,
GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFont, &val );
return TRUE;
if (dc->w.flags & DC_DIRTY) CLIPPING_UpdateGCRegion(dc);
val.function = GXcopy; /* Text is always GXcopy */
val.foreground = dc->w.textPixel;
val.background = dc->w.backgroundPixel;
val.fill_style = FillSolid;
val.font = xfs->fid;
XChangeGC( display, dc->u.x.gc,
GCFunction | GCForeground | GCBackground | GCFillStyle |
GCFont, &val );
return TRUE;
}
fprintf( stderr, "DC_SetupGCForText: physical font failure\n" );
return FALSE;
}

View File

@ -49,6 +49,9 @@ int DIB_GetXImageWidthBytes( int width, int depth )
{
int i;
if (!ximageDepthTable[0]) {
DIB_Init();
}
for( i = 0; bitmapDepthTable[i] ; i++ )
if( bitmapDepthTable[i] == depth )
return (4 * ((width * ximageDepthTable[i] + 31)/32));
@ -97,14 +100,14 @@ int DIB_BitmapInfoSize( BITMAPINFO * info, WORD coloruse )
if (info->bmiHeader.biSize == sizeof(BITMAPCOREHEADER))
{
BITMAPCOREHEADER *core = (BITMAPCOREHEADER *)info;
colors = (core->bcBitCount != 24) ? 1 << core->bcBitCount : 0;
colors = (core->bcBitCount <= 8) ? 1 << core->bcBitCount : 0;
return sizeof(BITMAPCOREHEADER) + colors *
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBTRIPLE) : sizeof(WORD));
}
else /* assume BITMAPINFOHEADER */
{
colors = info->bmiHeader.biClrUsed;
if (!colors && (info->bmiHeader.biBitCount != 24))
if (!colors && (info->bmiHeader.biBitCount <= 8))
colors = 1 << info->bmiHeader.biBitCount;
return sizeof(BITMAPINFOHEADER) + colors *
((coloruse == DIB_RGB_COLORS) ? sizeof(RGBQUAD) : sizeof(WORD));
@ -590,10 +593,12 @@ static int DIB_SetImageBits( DC *dc, DWORD lines, WORD depth, LPSTR bits,
/* Build the color mapping table */
if (infoBpp == 24) colorMapping = NULL;
else
if (infoBpp > 8) {
colorMapping = NULL;
} else {
if (!(colorMapping = DIB_BuildColorMap( dc, coloruse, depth, info )))
return 0;
}
if( dc->w.flags & DC_DIRTY ) CLIPPING_UpdateGCRegion(dc);

File diff suppressed because it is too large Load Diff

View File

@ -100,14 +100,14 @@ static FONTOBJ AnsiVarFont =
{
{ 0, FONT_MAGIC, 1 }, /* header */
{ 12, 0, 0, 0, FW_NORMAL, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "" }
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "MS Sans Serif" }
};
static FONTOBJ SystemFont =
{
{ 0, FONT_MAGIC, 1 }, /* header */
{ 0, FONT_MAGIC, 1 },
{ 12, 0, 0, 0, FW_BOLD, FALSE, FALSE, FALSE, ANSI_CHARSET,
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "" }
0, 0, DEFAULT_QUALITY, VARIABLE_PITCH | FF_SWISS, "System" }
};
static FONTOBJ DeviceDefaultFont =
@ -142,7 +142,7 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
(GDIOBJHDR *) &AnsiVarFont,
(GDIOBJHDR *) &SystemFont,
(GDIOBJHDR *) &DeviceDefaultFont,
NULL, /* DEFAULT_PALETTE created by COLOR_Init */
NULL, /* DEFAULT_PALETTE created by PALETTE_Init */
(GDIOBJHDR *) &SystemFixedFont
};
@ -154,21 +154,26 @@ static GDIOBJHDR * StockObjects[NB_STOCK_OBJECTS] =
*/
BOOL32 GDI_Init(void)
{
HPALETTE16 hpalette;
extern BOOL32 X11DRV_Init(void);
extern BOOL32 DIB_Init(void);
/* Initialize drivers */
if (!X11DRV_Init()) return FALSE;
if (!DIB_Init()) return FALSE;
DIB_Init(); /* always before X11DRV_Init() */
/* Create default palette */
if( X11DRV_Init() )
{
/* Create default palette */
if (!(hpalette = COLOR_Init())) return FALSE;
StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *)GDI_HEAP_LIN_ADDR( hpalette );
HPALETTE16 hpalette = PALETTE_Init();
return TRUE;
if( hpalette )
{
StockObjects[DEFAULT_PALETTE] = (GDIOBJHDR *)GDI_HEAP_LIN_ADDR( hpalette );
return TRUE;
}
}
return FALSE;
}

View File

@ -304,18 +304,29 @@ BOOL16 EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,
{
METAHEADER *mh = (METAHEADER *)GlobalLock16(hmf);
METARECORD *mr;
HANDLETABLE16 *ht;
HGLOBAL16 hHT;
SEGPTR ht, spRecord;
SEGPTR spht, spRecord;
int offset = 0;
WORD i;
HPEN32 hPen;
HBRUSH32 hBrush;
HFONT32 hFont;
DC *dc;
dprintf_metafile(stddeb,"EnumMetaFile(%04x, %04x, %08lx, %08lx)\n",
hdc, hmf, (DWORD)lpEnumFunc, lpData);
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);
ht = WIN16_GlobalLock16(hHT);
spht = WIN16_GlobalLock16(hHT);
offset = mh->mtHeaderSize * 2;
@ -325,7 +336,7 @@ BOOL16 EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,
while (offset < (mh->mtSize * 2))
{
mr = (METARECORD *)((char *)mh + offset);
if (!lpEnumFunc( hdc, (HANDLETABLE16 *)ht,
if (!lpEnumFunc( hdc, (HANDLETABLE16 *)spht,
(METARECORD *)((UINT32)spRecord + offset),
mh->mtNoObjects, (LONG)lpData))
break;
@ -333,6 +344,17 @@ BOOL16 EnumMetaFile16( HDC16 hdc, HMETAFILE16 hmf, MFENUMPROC16 lpEnumFunc,
offset += (mr->rdSize * 2);
}
SelectObject32(hdc, hBrush);
SelectObject32(hdc, hPen);
SelectObject32(hdc, hFont);
ht = (HANDLETABLE16 *)GlobalLock16(hHT);
/* free objects in handle table */
for(i = 0; i < mh->mtNoObjects; i++)
if(*(ht->objectHandle + i) != 0)
DeleteObject32(*(ht->objectHandle + i));
/* free handle table */
GlobalFree16(hHT);
@ -1165,9 +1187,13 @@ BOOL32 MF_ExtTextOut(DC*dc, short x, short y, UINT16 flags, const RECT16 *rect,
DWORD len;
HGLOBAL16 hmr;
METARECORD *mr;
if((!flags && rect) || (flags && !rect))
fprintf(stderr, "MF_ExtTextOut: Inconsistent flags and rect\n");
len = sizeof(METARECORD) + (((count + 1) >> 1) * 2) + 2 * sizeof(short)
+ sizeof(UINT16) + sizeof(RECT16);
+ sizeof(UINT16);
if(rect)
len += sizeof(RECT16);
if (lpDx)
len+=count*sizeof(INT16);
if (!(hmr = GlobalAlloc16(GMEM_MOVEABLE, len)))
@ -1182,9 +1208,10 @@ BOOL32 MF_ExtTextOut(DC*dc, short x, short y, UINT16 flags, const RECT16 *rect,
*(mr->rdParam + 2) = count;
*(mr->rdParam + 3) = flags;
if (rect) memcpy(mr->rdParam + 4, rect, sizeof(RECT16));
memcpy(mr->rdParam + 8, str, count);
memcpy(mr->rdParam + (rect ? 8 : 4), str, count);
if (lpDx)
memcpy(mr->rdParam + 8+ ((count + 1) >> 1),lpDx,count*sizeof(INT16));
memcpy(mr->rdParam + (rect ? 8 : 4) + ((count + 1) >> 1),lpDx,
count*sizeof(INT16));
ret = MF_WriteRecord( dc, mr, mr->rdSize * 2);
GlobalFree16(hmr);
return ret;

View File

@ -4,6 +4,8 @@
* Copyright 1993,1994 Alexandre Julliard
* Copyright 1996 Alex Korobka
*
* PALETTEOBJ is documented in the Dr. Dobbs Journal May 1993.
* Information in the "Undocumented Windows" is incorrect.
*/
#include <stdlib.h>
@ -27,6 +29,45 @@ static HPALETTE16 hPrimaryPalette = 0; /* used for WM_PALETTECHANGED */
static HPALETTE16 hLastRealizedPalette = 0; /* UnrealizeObject() needs it */
/***********************************************************************
* PALETTE_Init
*
* Create the system palette.
*/
HPALETTE16 PALETTE_Init(void)
{
extern const PALETTEENTRY* COLOR_GetSystemPaletteTemplate(void);
int i;
HPALETTE16 hpalette;
LOGPALETTE * palPtr;
PALETTEOBJ* palObj;
const PALETTEENTRY* __sysPalTemplate = COLOR_GetSystemPaletteTemplate();
/* create default palette (20 system colors) */
palPtr = xmalloc( sizeof(LOGPALETTE) + (NB_RESERVED_COLORS-1)*sizeof(PALETTEENTRY) );
if (!palPtr) return FALSE;
palPtr->palVersion = 0x300;
palPtr->palNumEntries = NB_RESERVED_COLORS;
for( i = 0; i < NB_RESERVED_COLORS; i ++ )
{
palPtr->palPalEntry[i].peRed = __sysPalTemplate[i].peRed;
palPtr->palPalEntry[i].peGreen = __sysPalTemplate[i].peGreen;
palPtr->palPalEntry[i].peBlue = __sysPalTemplate[i].peBlue;
palPtr->palPalEntry[i].peFlags = 0;
}
hpalette = CreatePalette16( palPtr );
palObj = (PALETTEOBJ*) GDI_GetObjPtr( hpalette, PALETTE_MAGIC );
palObj->mapping = xmalloc( sizeof(int) * 20 );
free( palPtr );
return hpalette;
}
/***********************************************************************
* PALETTE_ValidateFlags
*/

View File

@ -2,6 +2,8 @@
* GDI region objects
*
* Copyright 1993, 1994, 1995 Alexandre Julliard
*
* RGNOBJ is documented in the Dr. Dobbs Journal March 1993.
*/
#include <stdlib.h>

View File

@ -1,3 +1,8 @@
Tue Jun 3 07:34:26 1997 Marcel Baur <mbaur@g26.ethz.ch>
* [Va.rc] (new)
Added Vallader (Rumantsch Ladin) language support.
Wed Feb 12 00:58:37 1997 Elker Cavina <elker@mail.asianet.it>
* [It.rc] (new)

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 Ko Hu It
LANGUAGES = En De Fr Fi Ko Hu It Va
LICENSELANG = En
# Installation infos

124
programs/progman/Va.rc Normal file
View File

@ -0,0 +1,124 @@
/*
* Program Manager
*
* Copyright 1996 Ulrich Schmid
*
* Rumantsch Ladin (Vallader) added by mbaur@g26.ethz.ch
*
*/
#define LANGUAGE_ID Rl
#define LANGUAGE_NUMBER 2
#define LANGUAGE_MENU_ITEM "&Vallader"
/* Menu */
#define MENU_FILE "&Datoteca"
#define MENU_FILE_NEW "&Nouv..."
#define MENU_FILE_OPEN "&Rivir\tEndataziun"
#define MENU_FILE_MOVE "&Spostar...\tF7"
#define MENU_FILE_COPY "&Copchar...\tF8"
#define MENU_FILE_DELETE "S&tüder\tDel"
#define MENU_FILE_ATTRIBUTES "&Particularitads...\tAlt+Endataziun"
#define MENU_FILE_EXECUTE "&Esegnir..."
#define MENU_FILE_EXIT "&Finir WINE..."
#define MENU_OPTIONS "&Opziuns"
#define MENU_OPTIONS_AUTO_ARRANGE "Ordinar &automaticamaing"
#define MENU_OPTIONS_MIN_ON_RUN "&Simbol davo'l cummainzamaint dal program"
#define MENU_OPTIONS_SAVE_SETTINGS "Arcunar conzepziuns a la &finischina"
#define MENU_WINDOWS "&Fanestra"
#define MENU_WINDOWS_OVERLAP "&cruschond\tShift+F5"
#define MENU_WINDOWS_SIDE_BY_SIDE "ün &dasper l'oter\tShift+F4"
#define MENU_WINDOWS_ARRANGE "&ordinar ils simbols"
#define MENU_LANGUAGE "&Lingun"
#define MENU_HELP "&Agüd"
#define MENU_HELP_CONTENTS "&Cuntgnü"
#define MENU_HELP_SEARCH "&Tscherchar..."
#define MENU_HELP_HELP_ON_HELP "&Douvrar l'agüd"
#define MENU_HELP_TUTORIAL "&Program d'imprender"
#define MENU_INFO "Inf&ormaziun..."
#define MENU_INFO_LICENSE "&Liceza"
#define MENU_INFO_NO_WARRANTY "&INGUENA GARANZIA"
#define MENU_INFO_ABOUT_WINE "&Davart WINE"
/* Dialogs */
#define DIALOG_OK "OK"
#define DIALOG_CANCEL "Far giö quint"
#define DIALOG_BROWSE "&Tscherchar tras..."
#define DIALOG_HELP "&Agüd"
#define DIALOG_NEW_CAPTION "Nouv proget da program"
#define DIALOG_NEW_NEW "Nouv"
#define DIALOG_NEW_GROUP "&Gruppa da programs"
#define DIALOG_NEW_PROGRAM "&Program"
#define DIALOG_MOVE_CAPTION "Spostar il program"
#define DIALOG_MOVE_PROGRAM "Spostar il program:"
#define DIALOG_MOVE_FROM_GROUP "&Da la gruppa:"
#define DIALOG_MOVE_TO_GROUP "&In gruppa:"
#define DIALOG_COPY_CAPTION "Copchar il program"
#define DIALOG_COPY_PROGRAM "Copchar il program:"
#define DIALOG_COPY_FROM_GROUP DIALOG_MOVE_FROM_GROUP
#define DIALOG_COPY_TO_GROUP DIALOG_MOVE_TO_GROUP
#define DIALOG_GROUP_CAPTION "Particularitads da las gruppas"
#define DIALOG_GROUP_DESCRIPTION "&Descripziun:"
#define DIALOG_GROUP_FILE "Dato&teca:"
#define DIALOG_PROGRAM_CAPTION "Particularitads dal program"
#define DIALOG_PROGRAM_DESCRIPTION DIALOG_GROUP_DESCRIPTION
#define DIALOG_PROGRAM_COMMAND_LINE "&Lingia da cumonds:"
#define DIALOG_PROGRAM_DIRECTORY "&Register da lavuors:"
#define DIALOG_PROGRAM_HOT_KEY "&Cumbinaziun:"
#define DIALOG_PROGRAM_SYMBOL "Sco Si&mbol"
#define DIALOG_PROGRAM_OTHER_SYMBOL "Oter &Simbol..."
#define DIALOG_SYMBOL_CAPTION "Tscherner Simbol"
#define DIALOG_SYMBOL_FILE "&Nom da la Datoteca:"
#define DIALOG_SYMBOL_CURRENT "Simbol &actual:"
#define DIALOG_EXECUTE_CAPTION "Eseguir program"
#define DIALOG_EXECUTE_COMMAND_LINE DIALOG_PROGRAM_COMMAND_LINE
#define DIALOG_EXECUTE_SYMBOL DIALOG_PROGRAM_SYMBOL
/* Strings */
#define STRING_PROGRAM_MANAGER "Manager da programs"
#define STRING_ERROR "SBAGL"
#define STRING_WARNING "ATTENTIUN"
#define STRING_INFO "Infuormaziun"
#define STRING_DELETE "Stüder"
#define STRING_DELETE_GROUP_s "Stüder la gruppa da programs `%s' ?"
#define STRING_DELETE_PROGRAM_s "Stüder il program `%s' ?"
#define STRING_NOT_IMPLEMENTED "Na implementa"
#define STRING_FILE_READ_ERROR_s "Sbagl cun leger `%s'"
#define STRING_FILE_WRITE_ERROR_s "Sbagl cun scriver `%s'"
#define STRING_GRPFILE_READ_ERROR_s "\
La datoteca da gruppas da program '%s' nu po gnir rivida.\n\
Esa da prouar inavant da chargiar quista\n"
#define STRING_OUT_OF_MEMORY "Massa paca memoria"
#define STRING_WINHELP_ERROR "Ingün agüd a disposiziun"
#define STRING_UNKNOWN_FEATURE_s "Funcziun incuntschainta in %s"
#define STRING_FILE_NOT_OVERWRITTEN_s "Datoteca `%s' exista fingià. Ella nu vegn."
#define STRING_SAVE_GROUP_AS_s "\
La gruppa vegn sgürada cul nom '%s' per evitar \
cha la datoteca originala vegna surscritta."
#define STRING_NO_HOT_KEY "Ingiüna"
#define STRING_ALL_FILES "Tuot las datotecas (*.*)"
#define STRING_PROGRAMS "Programs"
#define STRING_LIBRARIES_DLL "Bibliotecas (*.dll)"
#define STRING_SYMBOL_FILES "Datotecas da simbols"
#define STRING_SYMBOLS_ICO "Simbols (*.ico)"
#include "Xx.rc"

View File

@ -12,6 +12,7 @@
#include "file.h"
#include "heap.h"
#include "task.h"
#include "thread.h"
#include "winerror.h"
PDB32 *pCurrentProcess = NULL;
@ -786,3 +787,123 @@ BOOL32 SetStdHandle( DWORD std_handle, HANDLE32 handle )
SetLastError( ERROR_INVALID_PARAMETER );
return FALSE;
}
/***********************************************************************
* _KERNEL32_18 (KERNEL32.18,Win95)
* 'Of course you cannot directly access Windows internal structures'
*/
extern THDB *pCurrentThread;
DWORD
_KERNEL32_18(DWORD processid,DWORD action) {
PDB32 *process;
TDB *pTask;
action+=56;
fprintf(stderr,"_KERNEL32_18(%ld,%ld+0x38)\n",processid,action);
if (action>56)
return 0;
if (!processid) {
process=pCurrentProcess;
/* check if valid process */
} else
process=(PDB32*)pCurrentProcess; /* decrypt too, if needed */
switch (action) {
case 0: /* return app compat flags */
pTask = (TDB*)GlobalLock16(process->task);
if (!pTask)
return 0;
return pTask->compat_flags;
case 4: /* returns offset 0xb8 of process struct... dunno what it is */
return 0;
case 8: /* return hinstance16 */
pTask = (TDB*)GlobalLock16(process->task);
if (!pTask)
return 0;
return pTask->hInstance;
case 12:/* return expected windows version */
pTask = (TDB*)GlobalLock16(process->task);
if (!pTask)
return 0;
return pTask->version;
case 16:/* return uncrypted pointer to current thread */
return (DWORD)pCurrentThread;
case 20:/* return uncrypted pointer to process */
return (DWORD)process;
case 24:/* return stdoutput handle from startupinfo */
return (DWORD)(process->env_db->startup_info->hStdOutput);
case 28:/* return stdinput handle from startupinfo */
return (DWORD)(process->env_db->startup_info->hStdInput);
case 32:/* get showwindow flag from startupinfo */
return (DWORD)(process->env_db->startup_info->wShowWindow);
case 36:{/* return startup x and y sizes */
LPSTARTUPINFO32A si = process->env_db->startup_info;
DWORD x,y;
x=si->dwXSize;if (x==0x80000000) x=0x8000;
y=si->dwYSize;if (y==0x80000000) y=0x8000;
return (y<<16)+x;
}
case 40:{/* return startup x and y */
LPSTARTUPINFO32A si = process->env_db->startup_info;
DWORD x,y;
x=si->dwX;if (x==0x80000000) x=0x8000;
y=si->dwY;if (y==0x80000000) y=0x8000;
return (y<<16)+x;
}
case 44:/* return startup flags */
return process->env_db->startup_info->dwFlags;
case 48:/* return uncrypted pointer to parent process (if any) */
return (DWORD)process->parent;
case 52:/* return process flags */
return process->flags;
case 56:/* unexplored */
return 0;
default:
fprintf(stderr,"_KERNEL32_18:unknown offset (%ld)\n",action);
return 0;
}
/* shouldn't come here */
}
VOID /* FIXME */
_KERNEL32_52(DWORD arg1,CONTEXT *regs) {
SEGPTR *str = SEGPTR_STRDUP("ThkBuf");
fprintf(stderr,"_KERNE32_52(arg1=%08lx,%08lx)\n",arg1,EDI_reg(regs));
EAX_reg(regs) = GetProcAddress16(EDI_reg(regs),SEGPTR_GET(str));
fprintf(stderr," GetProcAddress16(\"ThkBuf\") returns %08lx\n",
EAX_reg(regs)
);
SEGPTR_FREE(str);
}
/***********************************************************************
* GetPWinLock (KERNEL32) FIXME
*/
VOID
GetPWinLock(CRITICAL_SECTION **lock) {
static CRITICAL_SECTION plock;
fprintf(stderr,"GetPWinlock(%p)\n",lock);
*lock = &plock;
}
/***********************************************************************
* GetProcessVersion (KERNEL32)
*/
DWORD
GetProcessVersion(DWORD processid) {
PDB32 *process;
TDB *pTask;
if (!processid) {
process=pCurrentProcess;
/* check if valid process */
} else
process=(PDB32*)pCurrentProcess; /* decrypt too, if needed */
pTask = (TDB*)GlobalLock16(process->task);
if (!pTask)
return 0;
return (pTask->version&0xff) | (((pTask->version >>8) & 0xff)<<16);
}

View File

@ -63,7 +63,7 @@ THDB *THREAD_Create( PDB32 *pdb, DWORD stack_size,
/* Set a guard page at the bottom of the stack */
VirtualProtect( thdb->stack_base, 1, PAGE_EXECUTE_READWRITE | PAGE_GUARD,
&old_prot );
thdb->teb.stack_top = (char *)thdb->stack_base + stack_size - 1;
thdb->teb.stack_top = (char *)thdb->stack_base + stack_size;
thdb->teb.stack_low = thdb->stack_base;
thdb->exit_stack = thdb->teb.stack_top;

View File

@ -704,7 +704,7 @@ static int BuildModule16( FILE *outfile, int max_code_offset,
buffer = xmalloc( 0x10000 );
pModule = (NE_MODULE *)buffer;
pModule->magic = NE_SIGNATURE;
pModule->magic = IMAGE_OS2_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->flags = NE_FFLAGS_SINGLEDATA | NE_FFLAGS_BUILTIN | NE_FFLAGS_LIBMODULE;
@ -887,7 +887,7 @@ static int BuildModule32( FILE *outfile )
buffer = xmalloc( 0x10000 );
pModule = (NE_MODULE *)buffer;
pModule->magic = NE_SIGNATURE;
pModule->magic = IMAGE_OS2_SIGNATURE;
pModule->count = 1;
pModule->next = 0;
pModule->dgroup_entry = 0;

View File

@ -34,6 +34,7 @@ extern char* g_lpstrCharSet;
char* g_lpstrFileName = NULL;
char* g_lpstrCharSet = NULL;
char* g_lpstrInputFile = NULL;
int g_outputPoints = 0;
static char* errorDLLRead = "Unable to read Windows DLL.\n";
static char* errorFNTRead = "Unable to read .FNT file.\n";
@ -47,9 +48,10 @@ static char* errorEmpty = "No fonts found.\n";
void usage()
{
printf("Usage: font2bdf [-c charset] [-o basename] [input file]\n");
printf(" -c charset\tuse this charset name for OEM_CHARSET fonts\n");
printf("Usage: fnt2bdf [-t] [-c charset] [-o basename] [input file]\n");
printf(" -c charset\tcharset name for OEM_CHARSET fonts\n");
printf(" -f basename\tbasic output filename\n");
printf(" -t \t\toutput files by point size instead of pixel height\n");
printf(" input file\tMSWindows .fon, .fnt, .dll, or .exe file.\n");
printf("\nExample:\n fnt2bdf -c winsys vgasys.fnt\n\n");
exit(-1);
@ -110,7 +112,8 @@ char* lpChar;
lpChar = name + strlen( name );
sprintf(lpChar, "%d-%d.bdf", return_data_value(dfShort, cpe_font_struct->hdr.dfWeight),
return_data_value(dfShort, cpe_font_struct->hdr.dfPoints) );
(g_outputPoints) ? return_data_value(dfShort, cpe_font_struct->hdr.dfPoints)
: return_data_value(dfShort, cpe_font_struct->hdr.dfPixHeight) );
return 0;
}
@ -136,7 +139,7 @@ int parse_fnt_data(unsigned char* file_buffer, int length)
int l_fchar = return_data_value(dfChar, cpe_font_struct.hdr.dfFirstChar),
l_lchar = return_data_value(dfChar, cpe_font_struct.hdr.dfLastChar);
int l_len = l_lchar-l_fchar, l_ptr = MAP_BEG;
int l_len = l_lchar - l_fchar + 1, l_ptr = MAP_BEG;
/* malloc size = (# chars) * sizeof(WinCharS) */
@ -174,7 +177,7 @@ int dump_bdf( fnt_fontS* cpe_font_struct, unsigned char* file_buffer)
int l_fchar = return_data_value(dfChar, cpe_font_struct->hdr.dfFirstChar),
l_lchar = return_data_value(dfChar, cpe_font_struct->hdr.dfLastChar);
int l_len = l_lchar-l_fchar,
int l_len = l_lchar-l_fchar + 1,
l_hgt = return_data_value(dfChar, cpe_font_struct->hdr.dfPixHeight);
int l_ascent = return_data_value(dfShort, cpe_font_struct->hdr.dfAscent);
char l_filename[256];
@ -279,7 +282,7 @@ int dump_bdf_hdr(FILE* fs, fnt_fontS* cpe_font_struct, unsigned char* file_buffe
{
int l_fchar = return_data_value(dfChar, cpe_font_struct->hdr.dfFirstChar),
l_lchar = return_data_value(dfChar, cpe_font_struct->hdr.dfLastChar);
int l_len = l_lchar - l_fchar;
int l_len = l_lchar - l_fchar + 1;
int l_nameoffset = return_data_value(dfLong, cpe_font_struct->hdr.dfFace);
int l_cellheight = return_data_value(dfShort, cpe_font_struct->hdr.dfPixHeight);
int l_ascent = return_data_value(dfShort, cpe_font_struct->hdr.dfAscent);
@ -333,7 +336,7 @@ int l_ascent = return_data_value(dfShort, cpe_font_struct->hdr.dfAscent);
/* spacing */
if( return_data_value(dfShort, cpe_font_struct->hdr.dfPixWidth) ) fputs("c-", fs);
else fputs("m-", fs);
else fputs("p-", fs);
/* average width */
@ -343,15 +346,27 @@ int l_ascent = return_data_value(dfShort, cpe_font_struct->hdr.dfAscent);
switch( cpe_font_struct->hdr.dfCharSet[0] )
{
case ANSI_CHARSET: fputs("ansi-0\n", fs); break;
/* Microsoft just had to invent its own charsets! */
case ANSI_CHARSET: fputs("ansi-0\n", fs); break;
case GREEK_CHARSET: fputs("cp125-3\n", fs); break;
case TURKISH_CHARSET: fputs("iso8859-9", fs); break;
case HEBREW_CHARSET: fputs("cp125-5", fs); break;
case ARABIC_CHARSET: fputs("cp125-6", fs); break;
case BALTIC_CHARSET: fputs("cp125-7", fs); break;
case RUSSIAN_CHARSET: fputs("cp125-1", fs); break;
case EE_CHARSET: fputs("iso8859-2", fs); break;
case SYMBOL_CHARSET: fputs("misc-fontspecific\n", fs); break;
case SHIFTJIS_CHARSET: fputs("jisx0208.1983-0\n", fs); break;
case DEFAULT_CHARSET: fputs("iso8859-1\n", fs); break;
default:
case DEFAULT_CHARSET: fputs("iso8859-1\n", fs); break;
case SYMBOL_CHARSET: fputs("misc-fontspecific\n", fs); break;
case SHIFTJIS_CHARSET: fputs("jisx0208.1983-0\n", fs); break;
case OEM_CHARSET:
if( !g_lpstrCharSet )
{ fputs("Undefined OEM charset, use -c option.\n", stderr);
return ERROR_DATA; }
{
fputs("Undefined charset, use -c option.\n", stderr);
return ERROR_DATA;
}
fprintf(fs, "%s\n", g_lpstrCharSet);
}
}
@ -397,14 +412,24 @@ void parse_options(int argc, char **argv)
case 4:
case 5:
case 6:
case 7:
case 8:
for( i = 1; i < argc - 1; i++ )
{
if( argv[i][0] != '-' ||
strlen(argv[i]) != 2 ) break;
if( argv[i][1] == 'c' ) { g_lpstrCharSet = argv[i+1]; }
if( argv[i][1] == 'c' )
g_lpstrCharSet = argv[i+1];
else
if( argv[i][1] == 'f' ) { g_lpstrFileName = argv[i+1]; }
if( argv[i][1] == 'f' )
g_lpstrFileName = argv[i+1];
else
if( argv[i][1] == 't' )
{
g_outputPoints = 1;
continue;
}
else
usage();
@ -424,8 +449,8 @@ void parse_options(int argc, char **argv)
int get_resource_table(int fd, unsigned char** lpdata, int fsize)
{
struct mz_header_s mz_header;
struct ne_header_s ne_header;
IMAGE_DOS_HEADER mz_header;
IMAGE_OS2_HEADER ne_header;
short s, offset, size, retval;
@ -434,11 +459,11 @@ int get_resource_table(int fd, unsigned char** lpdata, int fsize)
if( read(fd, &mz_header, sizeof(mz_header)) != sizeof(mz_header) )
return FILE_ERROR;
s = return_data_value(dfShort, &mz_header.mz_magic);
s = return_data_value(dfShort, &mz_header.e_magic);
if( s == MZ_SIGNATURE) /* looks like .dll file so far... */
if( s == IMAGE_DOS_SIGNATURE) /* looks like .dll file so far... */
{
s = return_data_value(dfShort, &mz_header.ne_offset);
s = return_data_value(dfShort, &mz_header.e_lfanew);
lseek( fd, s, SEEK_SET );
if( read(fd, &ne_header, sizeof(ne_header)) != sizeof(ne_header) )
@ -446,12 +471,12 @@ int get_resource_table(int fd, unsigned char** lpdata, int fsize)
s = return_data_value(dfShort, &ne_header.ne_magic);
if( s == PE_SIGNATURE)
if( s == IMAGE_NT_SIGNATURE)
{
fprintf( stderr, "Do not know how to handle 32-bit Windows DLLs.\n");
return FILE_ERROR;
}
else if ( s != NE_SIGNATURE) return FILE_ERROR;
else if ( s != IMAGE_OS2_SIGNATURE) return FILE_ERROR;
s = return_data_value(dfShort, &ne_header.resource_tab_offset);
size = return_data_value(dfShort, &ne_header.rname_tab_offset);
@ -459,14 +484,14 @@ int get_resource_table(int fd, unsigned char** lpdata, int fsize)
if( size > fsize ) return FILE_ERROR;
size -= s;
offset = s + return_data_value(dfShort, &mz_header.ne_offset);
offset = s + return_data_value(dfShort, &mz_header.e_lfanew);
if( size <= sizeof(NE_TYPEINFO) ) return FILE_ERROR;
retval = FILE_DLL;
}
else if( s == 0x300 || s == 0x200 ) /* maybe .fnt ? */
{
size = return_data_value(dfLong, &mz_header.dont_care);
size = return_data_value(dfLong, (char*)&mz_header+2);
if( size != fsize ) return FILE_ERROR;
offset = 0;

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