Release 961201

Sat Nov 30 19:21:17 1996  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [configure]
	Re-generated with autoconf 2.11. Let me know if you have
	problems.

	* [controls/listbox.c] [controls/oldlbox.c]
	Listboxes rewritten from scratch. Moved old code still used by
	comboboxes to oldlbox.c

	* [misc/registry.c]
	Use temporary file when saving registry.

	* [windows/dialog.c]
	Implemented Win32 version of DlgDirList() and DlgDirListComboBox().

	* [windows/winproc.c]
	Added translation for listbox Win32 messages.

Sat Nov 30 21:00:00 Alex Korobka <alex@trantor.pharm.sunysb.edu>

	* [controls/widgets.c] [controls/button.c]
	Fixed some incompatibilities with CTL3D DLL.

	* [windows/dialog.c]
	Made dialog windows fit into the desktop.

	* [misc/winsock.c] [misc/winsock_async.c]
	New Winsock engine.

	* [windows/message.c]
	GetMessage() fixes.

	* [windows/queue.c] [windows/hook.c] [windows/win.c]
	SetMessageQueue() fixes.

Fri Nov 29 10:25:12 1996  Slaven Rezic  <eserte@cs.tu-berlin.de>

	* [objects/text.c]
	DrawText16(): Fixed return value.

Tue Nov 26 14:47:09 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>

	* [files/profile.c] [*/*]
	Added Win32 profile functions, updated to new naming standard.

	* [objects/font.c] [if1632/thunk.c] [include/windows.h]
	Added EnumFonts32*, EnumFontFamiliesEx*, changed prototypes and
	structures.

	* [misc/ole2nls.c] [if1632/thunk.c]
	Added EnumSystemLocales() (winhelp.exe).

	* [misc/registry.c]
	Added Windows 3.1 registry loader supplied by Tor Sjxwall, tor@sn.no

	* [win32/file.c]
	Partially fixed CreateFileMapping(), added UnmapViewOfFile().

Sat Nov 23 23:36:05 1996  Ronan Waide  <waider@waider.ie>

	* [misc/shell.c]
	Fixed some FIXMEs relating to ShellExec() and FindExecutable().

	* [misc/main.c]
	Implemented a few more of the SystemParametersInfo() cases.

Tue Nov 19 01:24:34 1996  Philippe De Muyter  <phdm@info.ucl.ac.be>

	* [include/keyboard.h]
	New file, new macro WINE_VKEY_MAPPINGS (using code taken from event.c).

	* [include/windows.h]
	New [VK_A, VK_Z] and [VK_0, VK9] macros.

	* [misc/keyboard.c]
	Fixes in KeyTable and ToAscii.

	* [objects/font.c]
	FONT_init : Give default value for MSWIN "system" font.
	FONT_MatchFont : Do not try every size of a font family if the
	family does not exist.

	* [windows/event.c]
	lastEventChar hack removed.
	KeyStateTable replaced by InputKeyStateTable (maintained in event.c)
	and QueueKeyStateTable (maintained in message.c).
	EVENT_key : Corrections to the extended bit setting.

	* [windows/message.c] [windows/keyboard.c]
	Implementation of a new QueueKeyStateTable : table of key states
	valid when messages are retrieved by GetMessage or PeekMessage,
	and valid for TranslateMessage.
	TranslateMessage : Convert WM*KEY messages using QueueKeyStateTable
	and ToAscii.
	
Mon Nov 18 16:59:01 1996  Robert Pouliot <krynos@clic.net>

	* [graphics/Makefile.in] [graphics/wing.c]
	  [if1632/wing.spec]
	Some functions for WinG support, mostly empty stubs.

	* [misc/crtdll.c] [if1632/crtdll.spec]
	Many functions added to CRTDLL, mostly calls to Unix C library.
This commit is contained in:
Alexandre Julliard 1996-12-01 17:17:47 +00:00
parent 75d86e1f06
commit da0cfb3610
85 changed files with 8794 additions and 5068 deletions

View File

@ -1,13 +1,15 @@
This is release 961117 of Wine, the MS Windows emulator. This is still a
This is release 961201 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-961117: (see ChangeLog for details)
- More Win32 functions.
- OffiX-style drag and drop.
WHAT'S NEW with Wine-961201: (see ChangeLog for details)
- Better Winsock.
- Rewritten listboxes.
- Windows 3.1 registry loader.
- Improved keyboard support.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +18,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-961117.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961117.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961117.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961117.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-961201.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-961201.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-961201.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-961201.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

106
ChangeLog
View File

@ -1,3 +1,109 @@
----------------------------------------------------------------------
Sat Nov 30 19:21:17 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [configure]
Re-generated with autoconf 2.11. Let me know if you have
problems.
* [controls/listbox.c] [controls/oldlbox.c]
Listboxes rewritten from scratch. Moved old code still used by
comboboxes to oldlbox.c
* [misc/registry.c]
Use temporary file when saving registry.
* [windows/dialog.c]
Implemented Win32 version of DlgDirList() and DlgDirListComboBox().
* [windows/winproc.c]
Added translation for listbox Win32 messages.
Sat Nov 30 21:00:00 Alex Korobka <alex@trantor.pharm.sunysb.edu>
* [controls/widgets.c] [controls/button.c]
Fixed some incompatibilities with CTL3D DLL.
* [windows/dialog.c]
Made dialog windows fit into the desktop.
* [misc/winsock.c] [misc/winsock_async.c]
New Winsock engine.
* [windows/message.c]
GetMessage() fixes.
* [windows/queue.c] [windows/hook.c] [windows/win.c]
SetMessageQueue() fixes.
Fri Nov 29 10:25:12 1996 Slaven Rezic <eserte@cs.tu-berlin.de>
* [objects/text.c]
DrawText16(): Fixed return value.
Tue Nov 26 14:47:09 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [files/profile.c] [*/*]
Added Win32 profile functions, updated to new naming standard.
* [objects/font.c] [if1632/thunk.c] [include/windows.h]
Added EnumFonts32*, EnumFontFamiliesEx*, changed prototypes and
structures.
* [misc/ole2nls.c] [if1632/thunk.c]
Added EnumSystemLocales() (winhelp.exe).
* [misc/registry.c]
Added Windows 3.1 registry loader supplied by Tor Sjxwall, tor@sn.no
* [win32/file.c]
Partially fixed CreateFileMapping(), added UnmapViewOfFile().
Sat Nov 23 23:36:05 1996 Ronan Waide <waider@waider.ie>
* [misc/shell.c]
Fixed some FIXMEs relating to ShellExec() and FindExecutable().
* [misc/main.c]
Implemented a few more of the SystemParametersInfo() cases.
Tue Nov 19 01:24:34 1996 Philippe De Muyter <phdm@info.ucl.ac.be>
* [include/keyboard.h]
New file, new macro WINE_VKEY_MAPPINGS (using code taken from event.c).
* [include/windows.h]
New [VK_A, VK_Z] and [VK_0, VK9] macros.
* [misc/keyboard.c]
Fixes in KeyTable and ToAscii.
* [objects/font.c]
FONT_init : Give default value for MSWIN "system" font.
FONT_MatchFont : Do not try every size of a font family if the
family does not exist.
* [windows/event.c]
lastEventChar hack removed.
KeyStateTable replaced by InputKeyStateTable (maintained in event.c)
and QueueKeyStateTable (maintained in message.c).
EVENT_key : Corrections to the extended bit setting.
* [windows/message.c] [windows/keyboard.c]
Implementation of a new QueueKeyStateTable : table of key states
valid when messages are retrieved by GetMessage or PeekMessage,
and valid for TranslateMessage.
TranslateMessage : Convert WM*KEY messages using QueueKeyStateTable
and ToAscii.
Mon Nov 18 16:59:01 1996 Robert Pouliot <krynos@clic.net>
* [graphics/Makefile.in] [graphics/wing.c]
[if1632/wing.spec]
Some functions for WinG support, mostly empty stubs.
* [misc/crtdll.c] [if1632/crtdll.spec]
Many functions added to CRTDLL, mostly calls to Unix C library.
----------------------------------------------------------------------
Sun Nov 17 15:01:45 1996 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -59,7 +59,7 @@ OBJS = $(GEN_C_SRCS:.c=.o) $(C_SRCS:.c=.o) $(ASM_SRCS:.S=.o) $(EXTRA_OBJS)
echo "#include \"windows.h\"" >winerctmp.c
echo WINDOWS_H_ENDS_HERE >>winerctmp.c
cat $< >>winerctmp.c
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) -c -o $* -p $*
$(CPP) $(DEFS) $(OPTIONS) $(DIVINCL) -DRC_INVOKED -P winerctmp.c | sed -e '1,/^WINDOWS_H_ENDS_HERE/d' | $(WINERC) $(RCFLAGS) -c -o $* -p $*
$(RM) winerctmp.c

828
configure vendored

File diff suppressed because it is too large Load Diff

View File

@ -7,8 +7,6 @@ AC_CONFIG_HEADER(include/config.h)
AC_CONFIG_AUX_DIR(tools)
# We want these before the checks, so the checks can modify their values.
test -z "$CFLAGS" && CFLAGS="-g -O2" AC_SUBST(CFLAGS)
test -z "$LDFLAGS" && LDFLAGS=-g AC_SUBST(LDFLAGS)
test -z "$LDLIBS" && LDLIBS=-lm AC_SUBST(LDLIBS)
dnl **** Command-line arguments ****

View File

@ -12,6 +12,7 @@ C_SRCS = \
edit.c \
listbox.c \
menu.c \
oldlbox.c \
scroll.c \
static.c \
status.c \

View File

@ -187,7 +187,8 @@ LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case WM_KILLFOCUS:
infoPtr->state &= ~BUTTON_HASFOCUS;
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
PAINT_BUTTON( wndPtr, style, ODA_FOCUS );
InvalidateRect16( hWnd, NULL, TRUE );
break;
case WM_SYSCOLORCHANGE:
@ -369,57 +370,70 @@ void PB_PaintGrayOnGray(HDC32 hDC,HFONT32 hFont,RECT32 *rc,char *text)
static void CB_Paint( WND *wndPtr, HDC32 hDC, WORD action )
{
RECT16 rc;
RECT16 rbox, rtext, client;
HBRUSH16 hBrush;
int textlen, delta, x, y;
TEXTMETRIC16 tm;
int textlen, delta;
BUTTONINFO *infoPtr = (BUTTONINFO *)wndPtr->wExtra;
GetClientRect16(wndPtr->hwndSelf, &rc);
textlen = 0;
GetClientRect16(wndPtr->hwndSelf, &client);
rbox = rtext = client;
if (infoPtr->hFont) SelectObject32( hDC, infoPtr->hFont );
hBrush = BUTTON_SEND_CTLCOLOR( wndPtr, hDC );
if (action == ODA_DRAWENTIRE) FillRect16( hDC, &rc, hBrush );
if (wndPtr->dwStyle & BS_LEFTTEXT)
{
/* magic +4 is what CTL3D expects */
GetTextMetrics16(hDC, &tm);
delta = (rc.bottom - rc.top - tm.tmHeight) >> 1;
rtext.right -= checkBoxWidth + 4;
rbox.left = rbox.right - checkBoxWidth;
}
else
{
rtext.left += checkBoxWidth + 4;
rbox.right = checkBoxWidth;
}
/* Draw the check-box bitmap */
x = y = 0;
if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) ||
((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rc.left, rc.top + delta,
x, y, checkBoxWidth, checkBoxHeight );
rc.left += checkBoxWidth + tm.tmAveCharWidth / 2;
if (!wndPtr->text) return;
textlen = strlen( wndPtr->text );
if (wndPtr->text) textlen = strlen( wndPtr->text );
if (action == ODA_DRAWENTIRE || action == ODA_SELECT)
{
int x = 0, y = 0;
delta = (rbox.bottom - rbox.top - checkBoxHeight) >> 1;
if (action == ODA_DRAWENTIRE)
{
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
DrawText16( hDC, wndPtr->text, textlen, &rc,
DT_SINGLELINE | DT_VCENTER | DT_NOCLIP );
if (action == ODA_SELECT) FillRect16( hDC, &rbox, hBrush );
else FillRect16( hDC, &client, hBrush );
if (infoPtr->state & BUTTON_HIGHLIGHTED) x += 2 * checkBoxWidth;
if (infoPtr->state & (BUTTON_CHECKED | BUTTON_3STATE)) x += checkBoxWidth;
if (((wndPtr->dwStyle & 0x0f) == BS_RADIOBUTTON) ||
((wndPtr->dwStyle & 0x0f) == BS_AUTORADIOBUTTON)) y += checkBoxHeight;
else if (infoPtr->state & BUTTON_3STATE) y += 2 * checkBoxHeight;
GRAPH_DrawBitmap( hDC, hbitmapCheckBoxes, rbox.left, rbox.top + delta,
x, y, checkBoxWidth, checkBoxHeight );
if( textlen && action != ODA_SELECT )
{
if (wndPtr->dwStyle & WS_DISABLED)
SetTextColor( hDC, GetSysColor(COLOR_GRAYTEXT) );
DrawText16( hDC, wndPtr->text, textlen, &rtext,
DT_SINGLELINE | DT_VCENTER );
}
}
if ((action == ODA_FOCUS) ||
((action == ODA_DRAWENTIRE) && (infoPtr->state & BUTTON_HASFOCUS)))
{
RECT16 rect = { 0, 0, 0, 0 };
DrawText16( hDC, wndPtr->text, textlen, &rect,
DT_SINGLELINE | DT_CALCRECT );
if (delta > 1)
{
rc.top += delta - 1;
rc.bottom -= delta + 1;
}
rc.left--;
rc.right = rc.left + rect.right + 2;
DrawFocusRect16( hDC, &rc );
/* again, this is what CTL3D expects */
DWORD tm = (textlen) ? GetTextExtent( hDC, wndPtr->text, textlen) : 0x00020002;
delta = (rtext.bottom - rtext.top - HIWORD(tm) - 1)/2;
rbox.bottom = (rbox.top = rtext.top + delta - 1) + HIWORD(tm) + 2;
rbox.right = (rbox.left = --rtext.left) + LOWORD(tm) + 2;
IntersectRect16(&rbox, &rbox, &rtext);
DrawFocusRect16( hDC, &rbox );
}
}

View File

@ -1233,68 +1233,3 @@ LRESULT ComboLBoxWndProc(HWND hwnd, UINT message, WPARAM16 wParam, LPARAM lParam
}
return DefWindowProc16(hwnd, message, wParam, lParam);
}
static INT32 COMBO_DlgDirList( HWND32 hDlg, LPARAM path, INT32 idCBox,
INT32 idStatic, UINT32 wType, BOOL32 unicode )
{
LRESULT res = 0;
if (idCBox)
{
SendDlgItemMessage32A( hDlg, idCBox, CB_RESETCONTENT16, 0, 0 );
if (unicode)
res = SendDlgItemMessage32W( hDlg, idCBox, CB_DIR16, wType, path );
else
res = SendDlgItemMessage32A( hDlg, idCBox, CB_DIR16, wType, path );
}
if (idStatic)
{
char temp[512] = "A:\\";
int drive = DRIVE_GetCurrentDrive();
temp[0] += drive;
lstrcpyn32A( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
AnsiLower( temp );
SetDlgItemText32A( hDlg, idStatic, temp );
}
return (res >= 0);
}
/***********************************************************************
* DlgDirListComboBox16 (USER.195)
*/
INT16 DlgDirListComboBox16( HWND16 hDlg, SEGPTR path, INT16 idCBox,
INT16 idStatic, UINT16 wType )
{
dprintf_combo( stddeb,"DlgDirListComboBox16(%04x,%08x,%d,%d,%04x)\n",
hDlg, (UINT32)path, idCBox, idStatic, wType );
return COMBO_DlgDirList( hDlg, (LPARAM)path, idCBox,
idStatic, wType, FALSE );
}
/***********************************************************************
* DlgDirListComboBox32A (USER32.143)
*/
INT32 DlgDirListComboBox32A( HWND32 hDlg, LPCSTR path, INT32 idCBox,
INT32 idStatic, UINT32 wType )
{
dprintf_combo( stddeb,"DlgDirListComboBox32A(%08x,'%s',%d,%d,%08X)\n",
hDlg, path, idCBox, idStatic, wType );
return COMBO_DlgDirList( hDlg, (LPARAM)path, idCBox,
idStatic, wType, FALSE );
}
/***********************************************************************
* DlgDirListComboBox32W (USER32.144)
*/
INT32 DlgDirListComboBox32W( HWND32 hDlg, LPCWSTR path, INT32 idCBox,
INT32 idStatic, UINT32 wType )
{
dprintf_combo( stddeb,"DlgDirListComboBox32W(%08x,%p,%d,%d,%08X)\n",
hDlg, path, idCBox, idStatic, wType );
return COMBO_DlgDirList( hDlg, (LPARAM)path, idCBox,
idStatic, wType, TRUE );
}

View File

@ -173,7 +173,7 @@ LRESULT DesktopWndProc( HWND32 hwnd, UINT32 message,
BOOL16 SetDeskPattern(void)
{
char buffer[100];
GetProfileString( "desktop", "Pattern", "(None)", buffer, 100 );
GetProfileString32A( "desktop", "Pattern", "(None)", buffer, 100 );
return DESKTOP_SetPattern( buffer );
}
@ -202,7 +202,7 @@ BOOL32 SetDeskWallPaper32( LPCSTR filename )
if (filename == (LPSTR)-1)
{
GetProfileString( "desktop", "WallPaper", "(None)", buffer, 256 );
GetProfileString32A( "desktop", "WallPaper", "(None)", buffer, 256 );
filename = buffer;
}
hdc = GetDC32( 0 );
@ -210,7 +210,7 @@ BOOL32 SetDeskWallPaper32( LPCSTR filename )
ReleaseDC32( 0, hdc );
if (infoPtr->hbitmapWallPaper) DeleteObject32( infoPtr->hbitmapWallPaper );
infoPtr->hbitmapWallPaper = hbitmap;
infoPtr->fTileWallPaper = GetProfileInt( "desktop", "TileWallPaper", 0 );
infoPtr->fTileWallPaper = GetProfileInt32A( "desktop", "TileWallPaper", 0 );
if (hbitmap)
{
BITMAP32 bmp;

File diff suppressed because it is too large Load Diff

View File

@ -84,8 +84,8 @@ static BOOL fEndMenuCalled = FALSE;
#define NO_SELECTED_ITEM 0xffff
#define SYSMENU_SELECTED 0xfffe /* Only valid on menu-bars */
#define IS_STRING_ITEM(flags) (!((flags) & (MF_BITMAP | MF_OWNERDRAW | \
MF_MENUBARBREAK | MF_MENUBREAK | MF_SEPARATOR)))
#define IS_STRING_ITEM(flags) \
(!((flags) & (MF_BITMAP | MF_OWNERDRAW | MF_SEPARATOR)))
extern void NC_DrawSysButton(HWND hwnd, HDC32 hdc, BOOL down); /*nonclient.c*/
extern BOOL NC_GetSysPopupPos(WND* wndPtr, RECT16* rect);
@ -1923,8 +1923,9 @@ BOOL32 TrackPopupMenu32( HMENU32 hMenu, UINT32 wFlags, INT32 x, INT32 y,
INT32 nReserved, HWND32 hWnd, const RECT32 *lpRect )
{
RECT16 r;
CONV_RECT32TO16( lpRect, &r );
return TrackPopupMenu16( hMenu, wFlags, x, y, nReserved, hWnd, &r );
if (lpRect)
CONV_RECT32TO16( lpRect, &r );
return TrackPopupMenu16(hMenu,wFlags,x,y,nReserved,hWnd,lpRect?&r:NULL);
}

843
controls/oldlbox.c Normal file
View File

@ -0,0 +1,843 @@
/*
* Listbox controls
*
* Copyright Martin Ayotte, 1993
* Constantine Sapuntzakis, 1995
* Alex Korobka, 1995, 1996
*
*/
/*
* FIXME:
* - proper scrolling for multicolumn style
* - anchor and caret for LBS_EXTENDEDSEL
* - proper selection with keyboard
* - how to handle (LBS_EXTENDEDSEL | LBS_MULTIPLESEL) style
* - support for LBS_NOINTEGRALHEIGHT and LBS_OWNERDRAWVARIABLE styles
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "win.h"
#include "gdi.h"
#include "msdos.h"
#include "listbox.h"
#include "dos_fs.h"
#include "drive.h"
#include "file.h"
#include "heap.h"
#include "stddebug.h"
#include "debug.h"
#include "xmalloc.h"
#define LIST_HEAP_ALLOC(lphl,f,size) \
LOCAL_Alloc( lphl->HeapSel, LMEM_FIXED, (size) )
#define LIST_HEAP_FREE(lphl,handle) \
LOCAL_Free( lphl->HeapSel, (handle) )
#define LIST_HEAP_ADDR(lphl,handle) \
((handle) ? PTR_SEG_OFF_TO_LIN(lphl->HeapSel, (handle)) : NULL)
#define LIST_HEAP_SIZE 0x10000
#define LBMM_EDGE 4 /* distance inside box which is same as moving mouse
outside box, to trigger scrolling of LB */
#define MATCH_SUBSTR 2
#define MATCH_EXACT 1
#define MATCH_NEAREST 0
static void ListBoxInitialize(LPHEADLIST lphl)
{
lphl->lpFirst = NULL;
lphl->ItemsCount = 0;
lphl->ItemsVisible = 0;
lphl->FirstVisible = 0;
lphl->ColumnsVisible = 1;
lphl->ItemsPerColumn = 0;
lphl->ItemFocused = -1;
lphl->PrevFocused = -1;
}
void CreateListBoxStruct(HWND hwnd, WORD CtlType, LONG styles, HWND parent)
{
LPHEADLIST lphl;
HDC32 hdc;
lphl = (LPHEADLIST)xmalloc(sizeof(HEADLIST));
SetWindowLong32A(hwnd, 0, (LONG)lphl);
ListBoxInitialize(lphl);
lphl->DrawCtlType = CtlType;
lphl->CtlID = GetWindowWord(hwnd,GWW_ID);
lphl->bRedrawFlag = TRUE;
lphl->iNumStops = 0;
lphl->TabStops = NULL;
lphl->hFont = GetStockObject32(SYSTEM_FONT);
lphl->hSelf = hwnd;
if (CtlType==ODT_COMBOBOX) /* use the "faked" style for COMBOLBOX */
/* LBS_SORT instead CBS_SORT e.g. */
lphl->dwStyle = MAKELONG(LOWORD(styles),HIWORD(GetWindowLong32A(hwnd,GWL_STYLE)));
else
lphl->dwStyle = GetWindowLong32A(hwnd,GWL_STYLE); /* use original style dword */
lphl->hParent = parent;
lphl->StdItemHeight = 15; /* FIXME: should get the font height */
lphl->OwnerDrawn = styles & (LBS_OWNERDRAWFIXED | LBS_OWNERDRAWVARIABLE);
lphl->HasStrings = (styles & LBS_HASSTRINGS) || !lphl->OwnerDrawn;
/* create dummy hdc to set text height */
if ((hdc = GetDC32(0)))
{
TEXTMETRIC16 tm;
GetTextMetrics16( hdc, &tm );
lphl->StdItemHeight = tm.tmHeight;
dprintf_listbox(stddeb,"CreateListBoxStruct: font height %d\n",
lphl->StdItemHeight);
ReleaseDC32( 0, hdc );
}
if (lphl->OwnerDrawn)
{
LISTSTRUCT dummyls;
lphl->needMeasure = TRUE;
dummyls.mis.CtlType = lphl->DrawCtlType;
dummyls.mis.CtlID = lphl->CtlID;
dummyls.mis.itemID = -1;
dummyls.mis.itemWidth = 0; /* ignored */
dummyls.mis.itemData = 0;
ListBoxAskMeasure(lphl,&dummyls);
}
lphl->HeapSel = GlobalAlloc16(GMEM_FIXED,LIST_HEAP_SIZE);
LocalInit( lphl->HeapSel, 0, LIST_HEAP_SIZE-1);
}
/* Send notification "code" as part of a WM_COMMAND-message if hwnd
has the LBS_NOTIFY style */
void ListBoxSendNotification(LPHEADLIST lphl, WORD code)
{
if (lphl->dwStyle & LBS_NOTIFY)
SendMessage32A( lphl->hParent, WM_COMMAND,
MAKEWPARAM( lphl->CtlID, code), (LPARAM)lphl->hSelf );
}
/* get the maximum value of lphl->FirstVisible */
int ListMaxFirstVisible(LPHEADLIST lphl)
{
int m = lphl->ItemsCount-lphl->ItemsVisible;
return (m < 0) ? 0 : m;
}
/* Returns: 0 if nothing needs to be changed */
/* 1 if FirstVisible changed */
int ListBoxScrollToFocus(LPHEADLIST lphl)
{
short end;
if (lphl->ItemsCount == 0) return 0;
if (lphl->ItemFocused == -1) return 0;
end = lphl->FirstVisible + lphl->ItemsVisible - 1;
if (lphl->ItemFocused < lphl->FirstVisible ) {
lphl->FirstVisible = lphl->ItemFocused;
return 1;
} else {
if (lphl->ItemFocused > end) {
WORD maxFirstVisible = ListMaxFirstVisible(lphl);
lphl->FirstVisible = lphl->ItemFocused;
if (lphl->FirstVisible > maxFirstVisible) {
lphl->FirstVisible = maxFirstVisible;
}
return 1;
}
}
return 0;
}
LPLISTSTRUCT ListBoxGetItem(LPHEADLIST lphl, UINT uIndex)
{
LPLISTSTRUCT lpls;
UINT Count = 0;
if (uIndex >= lphl->ItemsCount) return NULL;
lpls = lphl->lpFirst;
while (Count++ < uIndex) lpls = lpls->lpNext;
return lpls;
}
void ListBoxDrawItem(HWND hwnd, LPHEADLIST lphl, HDC16 hdc, LPLISTSTRUCT lpls,
RECT16 *rect, WORD itemAction, WORD itemState)
{
if (lphl->OwnerDrawn)
{
DRAWITEMSTRUCT32 dis;
dis.CtlID = lpls->mis.CtlID;
dis.CtlType = lpls->mis.CtlType;
dis.itemID = lpls->mis.itemID;
dis.hDC = hdc;
dis.hwndItem = hwnd;
dis.itemData = lpls->mis.itemData;
dis.itemAction = itemAction;
dis.itemState = itemState;
CONV_RECT16TO32( rect, &dis.rcItem );
SendMessage32A( lphl->hParent, WM_DRAWITEM, dis.CtlID, (LPARAM)&dis );
return;
}
if (itemAction == ODA_DRAWENTIRE || itemAction == ODA_SELECT) {
int OldBkMode;
DWORD dwOldTextColor = 0;
OldBkMode = SetBkMode(hdc, TRANSPARENT);
if (itemState != 0) {
dwOldTextColor = SetTextColor(hdc, 0x00FFFFFFL);
FillRect16(hdc, rect, GetStockObject32(BLACK_BRUSH));
}
if (lphl->dwStyle & LBS_USETABSTOPS) {
TabbedTextOut(hdc, rect->left + 5, rect->top + 2,
(char *)lpls->itemText, strlen((char *)lpls->itemText),
lphl->iNumStops, lphl->TabStops, 0);
} else {
TextOut16(hdc, rect->left + 5, rect->top + 2,
(char *)lpls->itemText, strlen((char *)lpls->itemText));
}
if (itemState != 0) {
SetTextColor(hdc, dwOldTextColor);
}
SetBkMode(hdc, OldBkMode);
}
else DrawFocusRect16(hdc, rect);
}
int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y)
{
LPLISTSTRUCT lpls = lphl->lpFirst;
int i, j;
POINT16 point;
point.x = X; point.y = Y;
if (lphl->ItemsCount == 0) return LB_ERR;
for(i = 0; i < lphl->FirstVisible; i++) {
if (lpls == NULL) return LB_ERR;
lpls = lpls->lpNext;
}
for(j = 0; j < lphl->ItemsVisible; i++, j++) {
if (lpls == NULL) return LB_ERR;
if (PtInRect16(&lpls->itemRect,point)) {
return i;
}
lpls = lpls->lpNext;
}
dprintf_listbox(stddeb,"ListBoxFindMouse: not found\n");
return LB_ERR;
}
BOOL32 lbDeleteItemNotify(LPHEADLIST lphl, LPLISTSTRUCT lpls)
{
/* called only for owner drawn listboxes */
BOOL32 ret;
DELETEITEMSTRUCT16 *delItem = SEGPTR_NEW(DELETEITEMSTRUCT16);
if (!delItem) return FALSE;
delItem->CtlType = lphl->DrawCtlType;
delItem->CtlID = lphl->CtlID;
delItem->itemID = lpls->mis.itemID;
delItem->hwndItem = lphl->hSelf;
delItem->itemData = lpls->mis.itemData;
ret = SendMessage16( lphl->hParent, WM_DELETEITEM, (WPARAM16)lphl->CtlID,
(LPARAM)SEGPTR_GET(delItem) );
SEGPTR_FREE(delItem);
return ret;
}
/* -------------------- strings and item data ---------------------- */
void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls)
{
MEASUREITEMSTRUCT16 *lpmeasure = SEGPTR_NEW(MEASUREITEMSTRUCT16);
if (!lpmeasure) return;
*lpmeasure = lpls->mis;
lpmeasure->itemHeight = lphl->StdItemHeight;
SendMessage16( lphl->hParent, WM_MEASUREITEM, lphl->CtlID,
(LPARAM)SEGPTR_GET(lpmeasure) );
if (lphl->dwStyle & LBS_OWNERDRAWFIXED)
{
if (lpmeasure->itemHeight > lphl->StdItemHeight)
lphl->StdItemHeight = lpmeasure->itemHeight;
lpls->mis.itemHeight = lpmeasure->itemHeight;
}
SEGPTR_FREE(lpmeasure);
}
static LPLISTSTRUCT ListBoxCreateItem(LPHEADLIST lphl, int id)
{
LPLISTSTRUCT lplsnew = (LPLISTSTRUCT)malloc(sizeof(LISTSTRUCT));
if (lplsnew == NULL) return NULL;
lplsnew->itemState = 0;
lplsnew->mis.CtlType = lphl->DrawCtlType;
lplsnew->mis.CtlID = lphl->CtlID;
lplsnew->mis.itemID = id;
lplsnew->mis.itemHeight = lphl->StdItemHeight;
lplsnew->mis.itemWidth = 0; /* ignored */
lplsnew->mis.itemData = 0;
SetRectEmpty16( &lplsnew->itemRect );
return lplsnew;
}
static int ListBoxAskCompare(LPHEADLIST lphl, int startItem, SEGPTR matchData, BOOL exactMatch )
{
/* Do binary search for sorted listboxes. Linked list item storage sort of
* defeats the purpose ( forces to traverse item list all the time ) but M$ does it this way...
*
* MATCH_NEAREST (0) - return position for insertion - for all styles
* MATCH_EXACT (1) - search for an item, return index or LB_ERR
* MATCH_SUBSTR (2) - same as exact match but with strncmp for string comparision
*/
COMPAREITEMSTRUCT16 *itemCmp;
LPLISTSTRUCT currentItem = NULL;
LPCSTR matchStr = (lphl->HasStrings)?(LPCSTR)PTR_SEG_TO_LIN(matchData):NULL;
int head, pos = -1, tail, loop = 1;
short b = 0, s_length = 0;
/* check if empty */
if( !lphl->ItemsCount )
return (exactMatch)? LB_ERR: 0;
/* set up variables */
if( exactMatch == MATCH_NEAREST )
startItem = 0;
else if( ++startItem )
{
loop = 2;
if( startItem >= lphl->ItemsCount ) startItem = lphl->ItemsCount - 1;
}
if( exactMatch == MATCH_SUBSTR && lphl->HasStrings )
{
s_length = strlen( matchStr );
if( !s_length ) return 0; /* head of the list - empty string */
}
head = startItem; tail = lphl->ItemsCount - 1;
dprintf_listbox(stddeb,"AskCompare: head = %i, tail = %i, data = %08x\n", head, tail, (unsigned)matchData );
if (!(itemCmp = SEGPTR_NEW(COMPAREITEMSTRUCT16))) return 0;
itemCmp->CtlType = lphl->DrawCtlType;
itemCmp->CtlID = lphl->CtlID;
itemCmp->hwndItem = lphl->hSelf;
/* search from startItem */
while ( loop-- )
{
while( head <= tail )
{
pos = (tail + head)/2;
currentItem = ListBoxGetItem( lphl, pos );
if( lphl->HasStrings )
{
b = ( s_length )? lstrncmpi32A( currentItem->itemText, matchStr, s_length)
: lstrcmpi32A( currentItem->itemText, matchStr);
}
else
{
itemCmp->itemID1 = pos;
itemCmp->itemData1 = currentItem->mis.itemData;
itemCmp->itemID2 = -1;
itemCmp->itemData2 = matchData;
b = SendMessage16( lphl->hParent, WM_COMPAREITEM,
(WPARAM16)lphl->CtlID,
(LPARAM)SEGPTR_GET(itemCmp) );
}
if( b == 0 )
{
SEGPTR_FREE(itemCmp);
return pos; /* found exact match */
}
else
if( b < 0 ) head = ++pos;
else
if( b > 0 ) tail = pos - 1;
}
/* reset to search from the first item */
head = 0; tail = startItem - 1;
}
dprintf_listbox(stddeb,"\t-> pos = %i\n", pos );
SEGPTR_FREE(itemCmp);
/* if we got here match is not exact */
if( pos < 0 ) pos = 0;
else if( pos > lphl->ItemsCount ) pos = lphl->ItemsCount;
return (exactMatch)? LB_ERR: pos;
}
int ListBoxInsertString(LPHEADLIST lphl, UINT uIndex, LPCSTR newstr)
{
LPLISTSTRUCT *lppls, lplsnew, lpls;
HANDLE16 hStr;
LPSTR str;
UINT Count;
dprintf_listbox(stddeb,"ListBoxInsertString(%d, %p);\n", uIndex, newstr);
if (!newstr) return -1;
if (uIndex == (UINT)-1)
uIndex = lphl->ItemsCount;
lppls = &lphl->lpFirst;
for(Count = 0; Count < uIndex; Count++) {
if (*lppls == NULL) return LB_ERR;
lppls = (LPLISTSTRUCT *) &(*lppls)->lpNext;
}
lplsnew = ListBoxCreateItem(lphl, Count);
if (lplsnew == NULL) {
fprintf(stdnimp,"ListBoxInsertString() out of memory !\n");
return LB_ERRSPACE;
}
lplsnew->lpNext = *lppls;
*lppls = lplsnew;
lphl->ItemsCount++;
hStr = 0;
if (lphl->HasStrings) {
dprintf_listbox(stddeb," string: %s\n", newstr);
hStr = LIST_HEAP_ALLOC(lphl, LMEM_MOVEABLE, strlen(newstr) + 1);
str = (LPSTR)LIST_HEAP_ADDR(lphl, hStr);
if (str == NULL) return LB_ERRSPACE;
strcpy(str, newstr);
lplsnew->itemText = str;
/* I'm not so sure about the next one */
lplsnew->mis.itemData = 0;
} else {
lplsnew->itemText = NULL;
lplsnew->mis.itemData = (DWORD)newstr;
}
lplsnew->mis.itemID = uIndex;
lplsnew->hData = hStr;
/* adjust the itemID field of the following entries */
for(lpls = lplsnew->lpNext; lpls != NULL; lpls = lpls->lpNext) {
lpls->mis.itemID++;
}
if (lphl->needMeasure) {
ListBoxAskMeasure(lphl, lplsnew);
}
dprintf_listbox(stddeb,"ListBoxInsertString // count=%d\n", lphl->ItemsCount);
return uIndex;
}
int ListBoxAddString(LPHEADLIST lphl, SEGPTR itemData)
{
UINT pos = (UINT) -1;
LPCSTR newstr = (lphl->HasStrings)?(LPCSTR)PTR_SEG_TO_LIN(itemData):(LPCSTR)itemData;
if ( lphl->dwStyle & LBS_SORT )
pos = ListBoxAskCompare( lphl, -1, itemData, MATCH_NEAREST );
return ListBoxInsertString(lphl, pos, newstr);
}
int ListBoxGetText(LPHEADLIST lphl, UINT uIndex, LPSTR OutStr)
{
LPLISTSTRUCT lpls;
if (!OutStr) {
dprintf_listbox(stddeb, "ListBoxGetText // OutStr==NULL\n");
return 0;
}
*OutStr = '\0';
lpls = ListBoxGetItem (lphl, uIndex);
if (lpls == NULL) return LB_ERR;
if (!lphl->HasStrings) {
*((long *)OutStr) = lpls->mis.itemData;
return 4;
}
strcpy(OutStr, lpls->itemText);
return strlen(OutStr);
}
DWORD ListBoxGetItemData(LPHEADLIST lphl, UINT uIndex)
{
LPLISTSTRUCT lpls;
lpls = ListBoxGetItem (lphl, uIndex);
if (lpls == NULL) return LB_ERR;
return lpls->mis.itemData;
}
int ListBoxSetItemData(LPHEADLIST lphl, UINT uIndex, DWORD ItemData)
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl, uIndex);
if (lpls == NULL) return LB_ERR;
lpls->mis.itemData = ItemData;
return 1;
}
int ListBoxDeleteString(LPHEADLIST lphl, UINT uIndex)
{
LPLISTSTRUCT lpls, lpls2;
UINT Count;
if (uIndex >= lphl->ItemsCount) return LB_ERR;
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
if (uIndex == 0)
{
if( lphl->OwnerDrawn )
lbDeleteItemNotify( lphl, lpls);
lphl->lpFirst = lpls->lpNext;
}
else
{
LPLISTSTRUCT lpls2 = NULL;
for(Count = 0; Count < uIndex; Count++) {
if (lpls->lpNext == NULL) return LB_ERR;
lpls2 = lpls;
lpls = (LPLISTSTRUCT)lpls->lpNext;
}
if( lphl->OwnerDrawn )
lbDeleteItemNotify( lphl, lpls);
lpls2->lpNext = lpls->lpNext;
}
/* adjust the itemID field of the following entries */
for(lpls2 = lpls->lpNext; lpls2 != NULL; lpls2 = lpls2->lpNext) {
lpls2->mis.itemID--;
}
lphl->ItemsCount--;
if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData);
free(lpls);
return lphl->ItemsCount;
}
static int lbFindString(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr, BOOL match)
{
/* match is either MATCH_SUBSTR or MATCH_EXACT */
LPLISTSTRUCT lpls;
UINT Count;
UINT First = nFirst + 1;
int s_length = 0;
LPSTR lpMatchStr = (LPSTR)MatchStr;
if (First > lphl->ItemsCount) return LB_ERR;
if (lphl->dwStyle & LBS_SORT )
return ListBoxAskCompare( lphl, nFirst, MatchStr, match );
if (lphl->HasStrings )
{
lpMatchStr = PTR_SEG_TO_LIN(MatchStr);
if( match == MATCH_SUBSTR )
{
s_length = strlen(lpMatchStr);
if( !s_length ) return (lphl->ItemsCount)?0:LB_ERR;
}
}
lpls = ListBoxGetItem(lphl, First);
Count = 0;
while(lpls != NULL)
{
if (lphl->HasStrings)
{
if ( ( s_length )? !lstrncmpi32A(lpls->itemText, lpMatchStr, s_length)
: !lstrcmpi32A(lpls->itemText, lpMatchStr) ) return Count;
}
else
if ( lpls->mis.itemData == (DWORD)lpMatchStr ) return Count;
lpls = lpls->lpNext;
Count++;
}
/* Start over at top */
Count = 0;
lpls = lphl->lpFirst;
while (Count < First)
{
if (lphl->HasStrings)
{
if ( ( s_length )? !lstrncmpi32A(lpls->itemText, lpMatchStr, s_length)
: !lstrcmpi32A(lpls->itemText, lpMatchStr) ) return Count;
}
else
if ( lpls->mis.itemData == (DWORD)lpMatchStr ) return Count;
lpls = lpls->lpNext;
Count++;
}
return LB_ERR;
}
int ListBoxFindString(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr)
{
return lbFindString(lphl, nFirst, MatchStr, MATCH_SUBSTR );
}
int ListBoxFindStringExact(LPHEADLIST lphl, UINT nFirst, SEGPTR MatchStr)
{
return lbFindString(lphl, nFirst, MatchStr, MATCH_EXACT );
}
int ListBoxResetContent(LPHEADLIST lphl)
{
LPLISTSTRUCT lpls;
int i;
if (lphl->ItemsCount == 0) return 0;
dprintf_listbox(stddeb, "ListBoxResetContent // ItemCount = %d\n",
lphl->ItemsCount);
for(i = 0; i < lphl->ItemsCount; i++) {
lpls = lphl->lpFirst;
if (lpls == NULL) return LB_ERR;
if (lphl->OwnerDrawn) lbDeleteItemNotify(lphl, lpls);
lphl->lpFirst = lpls->lpNext;
if (lpls->hData != 0) LIST_HEAP_FREE(lphl, lpls->hData);
free(lpls);
}
ListBoxInitialize(lphl);
return TRUE;
}
/* --------------------- selection ------------------------- */
int ListBoxSetCurSel(LPHEADLIST lphl, WORD wIndex)
{
LPLISTSTRUCT lpls;
/* use ListBoxSetSel instead */
if (lphl->dwStyle & (LBS_MULTIPLESEL | LBS_EXTENDEDSEL) ) return 0;
/* unselect previous item */
if (lphl->ItemFocused != -1) {
lphl->PrevFocused = lphl->ItemFocused;
lpls = ListBoxGetItem(lphl, lphl->ItemFocused);
if (lpls == 0) return LB_ERR;
lpls->itemState = 0;
}
if ((wIndex != (UINT)-1) && (wIndex < lphl->ItemsCount))
{
lphl->ItemFocused = wIndex;
lpls = ListBoxGetItem(lphl, wIndex);
if (lpls == 0) return LB_ERR;
lpls->itemState = ODS_SELECTED | ODS_FOCUS;
return 0;
}
return LB_ERR;
}
/* ------------------------- dir listing ------------------------ */
LONG ListBoxDirectory(LPHEADLIST lphl, UINT attrib, LPCSTR filespec)
{
char mask[13];
char* temp = NULL;
const char* ptr;
int skip, count;
LONG ret;
DOS_DIRENT entry;
char *path, *p;
dprintf_listbox(stddeb, "ListBoxDirectory: '%s' %04x\n", filespec, attrib);
if (!filespec) return LB_ERR;
if (!(ptr = DOSFS_GetUnixFileName( filespec, FALSE ))) return LB_ERR;
path = xstrdup(ptr);
p = strrchr( path, '/' );
*p++ = '\0';
if (!(ptr = DOSFS_ToDosFCBFormat( p )) ||
!(temp = SEGPTR_ALLOC( sizeof(char) * 16 )) )
{
free( path );
return LB_ERR;
}
strcpy( mask, ptr );
dprintf_listbox(stddeb, "ListBoxDirectory: path=%s mask=%s\n", path, mask);
skip = ret = 0;
attrib &= ~FA_LABEL;
while ((count = DOSFS_FindNext( path, mask, NULL, 0,
attrib, skip, &entry )) > 0)
{
skip += count;
if (entry.attr & FA_DIRECTORY)
{
if ((attrib & DDL_DIRECTORY) && strcmp(entry.name, ". "))
{
sprintf(temp, "[%s]", DOSFS_ToDosDTAFormat( entry.name ) );
AnsiLower( temp );
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
}
else /* not a directory */
{
if (!(attrib & DDL_EXCLUSIVE) ||
((attrib & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE)) ==
(entry.attr & (FA_RDONLY|FA_HIDDEN|FA_SYSTEM|FA_ARCHIVE))))
{
strcpy( temp, DOSFS_ToDosDTAFormat( entry.name ) );
AnsiLower( temp );
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
}
dprintf_listbox(stddeb,"\tn - %i, file '%s'\n", count, temp);
}
if (attrib & DDL_DRIVES)
{
int x;
DWORD oldstyle = lphl->dwStyle;
lphl->dwStyle &= ~LBS_SORT;
strcpy( temp, "[-a-]" );
for (x = 0; x < MAX_DOS_DRIVES; x++, temp[2]++)
{
if (DRIVE_IsValid(x))
if ((ret = ListBoxAddString(lphl, SEGPTR_GET(temp))) == LB_ERR) break;
}
lphl->dwStyle = oldstyle;
}
free( path );
SEGPTR_FREE( temp );
return ret;
}
/* ------------------------- dimensions ------------------------- */
int ListBoxGetItemRect(LPHEADLIST lphl, WORD wIndex, LPRECT16 lprect)
{
LPLISTSTRUCT lpls = ListBoxGetItem(lphl,wIndex);
dprintf_listbox(stddeb,"ListBox LB_GETITEMRECT %i %p", wIndex,lpls);
if (lpls == NULL)
{
if (lphl->dwStyle & LBS_OWNERDRAWVARIABLE)
return LB_ERR;
else
{
GetClientRect16(lphl->hSelf,lprect);
lprect->bottom=lphl->StdItemHeight;
if (lprect->right<0) lprect->right=0;
}
}
else
*lprect = lpls->itemRect;
dprintf_listbox(stddeb," = %d,%d %d,%d\n", lprect->left,lprect->top,
lprect->right,lprect->bottom);
return 0;
}
int ListBoxSetItemHeight(LPHEADLIST lphl, WORD wIndex, long height)
{
LPLISTSTRUCT lpls;
if (!(lphl->dwStyle & LBS_OWNERDRAWVARIABLE)) {
lphl->StdItemHeight = (short)height;
return 0;
}
lpls = ListBoxGetItem(lphl, wIndex);
if (lpls == NULL) return LB_ERR;
lpls->mis.itemHeight = height;
return 0;
}
/* -------------------------- string search ------------------------ */
int ListBoxFindNextMatch(LPHEADLIST lphl, WORD wChar)
{
LPLISTSTRUCT lpls;
UINT count,first;
if ((char)wChar < ' ') return LB_ERR;
if (!lphl->HasStrings) return LB_ERR;
lpls = lphl->lpFirst;
for (count = 0; lpls != NULL; lpls = lpls->lpNext, count++) {
if (tolower(*lpls->itemText) == tolower((char)wChar)) break;
}
if (lpls == NULL) return LB_ERR;
first = count;
for(; lpls != NULL; lpls = lpls->lpNext, count++) {
if (*lpls->itemText != (char)wChar)
break;
if ((short) count > lphl->ItemFocused)
return count;
}
return first;
}

View File

@ -54,7 +54,7 @@ static HBITMAP32 hRgArrowI = 0;
#define SCROLL_FIRST_DELAY 200
/* Delay (in ms) between scroll repetitions */
#define SCROLL_REPEAT_DELAY 100
#define SCROLL_REPEAT_DELAY 50
/* Scroll timer id */
#define SCROLL_TIMER 0

View File

@ -16,7 +16,12 @@
#include "module.h"
#include "heap.h"
#define OLD_LISTBOX
/* Window procedures */
extern LRESULT ListBoxWndProc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
/* Win16 class info */
typedef struct
{
@ -27,42 +32,39 @@ typedef struct
LPCSTR className;
} BUILTIN_CLASS_INFO16;
/* Win16 built-in classes */
static const BUILTIN_CLASS_INFO16 WIDGETS_BuiltinClasses16[] =
{
{ CS_GLOBALCLASS | CS_PARENTDC,
sizeof(STATICINFO), 0, "StaticWndProc", "STATIC" },
#ifdef OLD_LISTBOX
sizeof(STATICINFO), 0, "StaticWndProc", "Static" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
8, 0, "ListBoxWndProc", "LISTBOX" },
#endif
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
8, 0, "ComboBoxWndProc", "COMBOBOX" },
8, 0, "ComboBoxWndProc", "ComboBox" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_SAVEBITS,
8, 0, "ComboLBoxWndProc", "COMBOLBOX" },
8, 0, "ComboLBoxWndProc", "ComboLBox" },
{ CS_GLOBALCLASS | CS_PARENTDC | CS_DBLCLKS,
sizeof(DWORD), 0, "EditWndProc", "EDIT" },
sizeof(DWORD), 0, "EditWndProc", "Edit" },
{ CS_GLOBALCLASS | CS_SAVEBITS,
sizeof(HMENU32), 0, "PopupMenuWndProc", POPUPMENU_CLASS_NAME },
{ CS_GLOBALCLASS | CS_SAVEBITS,
DLGWINDOWEXTRA, 0, "DefDlgProc", DIALOG_CLASS_NAME },
{ CS_GLOBALCLASS, sizeof(MDICLIENTINFO),
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDICLIENT" }
STOCK_LTGRAY_BRUSH, "MDIClientWndProc", "MDIClient" }
};
#define NB_BUILTIN_CLASSES16 \
(sizeof(WIDGETS_BuiltinClasses16)/sizeof(WIDGETS_BuiltinClasses16[0]))
/* Win32 built-in classes */
static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
{
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "BUTTON" },
#ifndef OLD_LISTBOX
ButtonWndProc, 0, sizeof(BUTTONINFO), 0, 0, 0, 0, 0, "Button" },
{ CS_GLOBALCLASS | CS_DBLCLKS /*| CS_PARENTDC*/,
ListBoxWndProc32, 0, sizeof(void *), 0, 0, 0, 0, 0, "LISTBOX" },
#endif
ListBoxWndProc, 0, sizeof(void *), 0, 0, 0, 0, 0, "ListBox" },
{ CS_GLOBALCLASS | CS_DBLCLKS | CS_VREDRAW | CS_HREDRAW | CS_PARENTDC,
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "SCROLLBAR"},
ScrollBarWndProc, 0, sizeof(SCROLLBAR_INFO), 0, 0, 0, 0, 0, "ScrollBar"},
{ CS_GLOBALCLASS, DesktopWndProc, 0, sizeof(DESKTOPINFO),
0, 0, 0, 0, 0, DESKTOP_CLASS_NAME }
};
@ -71,6 +73,8 @@ static WNDCLASS32A WIDGETS_BuiltinClasses32[] =
(sizeof(WIDGETS_BuiltinClasses32)/sizeof(WIDGETS_BuiltinClasses32[0]))
/* Win32 common controls */
static WNDCLASS32A WIDGETS_CommonControls32[] =
{
{ CS_GLOBALCLASS | CS_VREDRAW | CS_HREDRAW, StatusWindowProc, 0,

View File

@ -5,6 +5,7 @@
* Copyright 1996 Alexandre Julliard
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <ctype.h>
#include <stdio.h>
#include <stdlib.h>
@ -13,6 +14,7 @@
#include "windows.h"
#include "dos_fs.h"
#include "xmalloc.h"
#include "string32.h"
#include "stddebug.h"
#include "debug.h"
@ -33,7 +35,7 @@ typedef struct tagPROFILESECTION
typedef struct
{
int changed;
BOOL32 changed;
PROFILESECTION *section;
char *dos_name;
} PROFILE;
@ -55,6 +57,8 @@ static const char PROFILE_WineIniName[] = "/.winerc";
#define WINE_INI_GLOBAL ETCDIR "/wine.conf"
static LPCWSTR wininiW = NULL;
/***********************************************************************
* PROFILE_CopyEntry
*
@ -227,7 +231,7 @@ static PROFILESECTION *PROFILE_Load( FILE *file )
*
* Delete a section from a profile tree.
*/
static BOOL PROFILE_DeleteSection( PROFILESECTION **section, const char *name )
static BOOL32 PROFILE_DeleteSection( PROFILESECTION **section, LPCSTR name )
{
while (*section)
{
@ -250,8 +254,8 @@ static BOOL PROFILE_DeleteSection( PROFILESECTION **section, const char *name )
*
* Delete a key from a profile tree.
*/
static BOOL PROFILE_DeleteKey( PROFILESECTION **section,
const char *section_name, const char *key_name )
static BOOL32 PROFILE_DeleteKey( PROFILESECTION **section,
LPCSTR section_name, LPCSTR key_name )
{
while (*section)
{
@ -323,7 +327,7 @@ static PROFILEKEY *PROFILE_Find( PROFILESECTION **section,
*
* Flush the current profile to disk if changed.
*/
static BOOL PROFILE_FlushFile(void)
static BOOL32 PROFILE_FlushFile(void)
{
char *p, buffer[MAX_PATHNAME_LEN];
const char *unix_name;
@ -368,7 +372,7 @@ static BOOL PROFILE_FlushFile(void)
*
* Open a profile file, checking the cached file first.
*/
static BOOL PROFILE_Open( const char *filename )
static BOOL32 PROFILE_Open( LPCSTR filename )
{
char buffer[MAX_PATHNAME_LEN];
const char *dos_name, *unix_name;
@ -443,16 +447,15 @@ static BOOL PROFILE_Open( const char *filename )
*
* Enumerate all the keys of a section.
*/
static INT PROFILE_GetSection( PROFILESECTION *section,
const char *section_name,
char *buffer, INT len, int handle_env )
static INT32 PROFILE_GetSection( PROFILESECTION *section, LPCSTR section_name,
LPSTR buffer, INT32 len, BOOL32 handle_env )
{
PROFILEKEY *key;
while (section)
{
if (section->name && !lstrcmpi32A( section->name, section_name ))
{
INT oldlen = len;
INT32 oldlen = len;
for (key = section->key; key; key = key->next)
{
if (len <= 2) break;
@ -476,8 +479,8 @@ static INT PROFILE_GetSection( PROFILESECTION *section,
*
* Get a profile string.
*/
static INT PROFILE_GetString( const char *section, const char *key_name,
const char *def_val, char *buffer, INT len )
static INT32 PROFILE_GetString( LPCSTR section, LPCSTR key_name,
LPCSTR def_val, LPSTR buffer, INT32 len )
{
PROFILEKEY *key = NULL;
@ -500,10 +503,10 @@ static INT PROFILE_GetString( const char *section, const char *key_name,
*
* Set a profile string.
*/
static BOOL PROFILE_SetString( const char *section_name, const char *key_name,
const char *value )
static BOOL32 PROFILE_SetString( LPCSTR section_name, LPCSTR key_name,
LPCSTR value )
{
BOOL ret;
BOOL32 ret;
if (!key_name) /* Delete a whole section */
{
@ -623,66 +626,156 @@ int PROFILE_LoadWineIni(void)
}
/********************* API functions **********************************/
/***********************************************************************
* GetProfileInt (KERNEL.57)
* GetProfileInt16 (KERNEL.57)
*/
UINT GetProfileInt( LPCSTR section, LPCSTR entry, INT def_val )
UINT16 GetProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val )
{
return GetPrivateProfileInt( section, entry, def_val, "win.ini" );
return GetPrivateProfileInt16( section, entry, def_val, "win.ini" );
}
/***********************************************************************
* GetProfileString (KERNEL.58)
* GetProfileInt32A (KERNEL32.264)
*/
INT GetProfileString( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT len )
UINT32 GetProfileInt32A( LPCSTR section, LPCSTR entry, INT32 def_val )
{
return GetPrivateProfileString( section, entry, def_val,
buffer, len, "win.ini" );
return GetPrivateProfileInt32A( section, entry, def_val, "win.ini" );
}
/***********************************************************************
* GetProfileInt32W (KERNEL32.264)
*/
UINT32 GetProfileInt32W( LPCWSTR section, LPCWSTR entry, INT32 def_val )
{
if (!wininiW) wininiW = STRING32_DupAnsiToUni("win.ini");
return GetPrivateProfileInt32W( section, entry, def_val, wininiW );
}
/***********************************************************************
* GetProfileString16 (KERNEL.58)
*/
INT16 GetProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT16 len )
{
return GetPrivateProfileString16( section, entry, def_val,
buffer, len, "win.ini" );
}
/***********************************************************************
* GetProfileString32A (KERNEL32.268)
*/
INT32 GetProfileString32A( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT32 len )
{
return GetPrivateProfileString32A( section, entry, def_val,
buffer, len, "win.ini" );
}
/***********************************************************************
* GetProfileString32W (KERNEL32.269)
*/
INT32 GetProfileString32W( LPCWSTR section,LPCWSTR entry,LPCWSTR def_val,
LPWSTR buffer, INT32 len )
{
if (!wininiW) wininiW = STRING32_DupAnsiToUni("win.ini");
return GetPrivateProfileString32W( section, entry, def_val,
buffer, len, wininiW );
}
/***********************************************************************
* WriteProfileString (KERNEL.59)
* WriteProfileString16 (KERNEL.59)
*/
BOOL WriteProfileString( LPCSTR section, LPCSTR entry, LPCSTR string )
BOOL16 WriteProfileString16( LPCSTR section, LPCSTR entry, LPCSTR string )
{
return WritePrivateProfileString( section, entry, string, "win.ini" );
return WritePrivateProfileString16( section, entry, string, "win.ini" );
}
/***********************************************************************
* WriteProfileString32A (KERNEL32.587)
*/
BOOL32 WriteProfileString32A( LPCSTR section, LPCSTR entry, LPCSTR string )
{
return WritePrivateProfileString32A( section, entry, string, "win.ini" );
}
/***********************************************************************
* WriteProfileString32W (KERNEL32.588)
*/
BOOL32 WriteProfileString32W( LPCWSTR section, LPCWSTR entry, LPCWSTR string )
{
if (!wininiW) wininiW = STRING32_DupAnsiToUni("win.ini");
return WritePrivateProfileString32W( section, entry, string, wininiW );
}
/***********************************************************************
* GetPrivateProfileInt (KERNEL.127)
* GetPrivateProfileInt16 (KERNEL.127)
*/
UINT GetPrivateProfileInt( LPCSTR section, LPCSTR entry, INT def_val,
LPCSTR filename )
UINT16 GetPrivateProfileInt16( LPCSTR section, LPCSTR entry, INT16 def_val,
LPCSTR filename )
{
long result=(long)GetPrivateProfileInt32A(section,entry,def_val,filename);
if (result > 65535) return 65535;
if (result >= 0) return (UINT16)result;
if (result < -32768) return -32768;
return (UINT16)(INT16)result;
}
/***********************************************************************
* GetPrivateProfileInt32A (KERNEL32.251)
*/
UINT32 GetPrivateProfileInt32A( LPCSTR section, LPCSTR entry, INT32 def_val,
LPCSTR filename )
{
char buffer[20];
char *p;
long result;
GetPrivateProfileString( section, entry, "",
buffer, sizeof(buffer), filename );
if (!buffer[0]) return (UINT)def_val;
GetPrivateProfileString32A( section, entry, "",
buffer, sizeof(buffer), filename );
if (!buffer[0]) return (UINT32)def_val;
result = strtol( buffer, &p, 0 );
if (p == buffer) return 0; /* No digits at all */
#ifdef WINELIB32
return (UINT)result;
#else
if (result > 65535) return 65535;
if (result >= 0) return (UINT)result;
if (result < -32768) return -32768;
return (UINT)(INT)result;
#endif
return (UINT32)result;
}
/***********************************************************************
* GetPrivateProfileInt32W (KERNEL32.252)
*/
UINT32 GetPrivateProfileInt32W( LPCWSTR section, LPCWSTR entry, INT32 def_val,
LPCWSTR filename )
{
LPSTR sectionA=section?STRING32_DupUniToAnsi(section):NULL;
LPSTR entryA=entry?STRING32_DupUniToAnsi(entry):NULL;
LPSTR filenameA=filename?STRING32_DupUniToAnsi(filename):NULL;
UINT32 res;
res=GetPrivateProfileInt32A(sectionA,entryA,def_val,filenameA);
if (sectionA) free(sectionA);
if (filenameA) free(filenameA);
if (entryA) free(entryA);
return res;
}
/***********************************************************************
* GetPrivateProfileString (KERNEL.128)
* GetPrivateProfileString16 (KERNEL.128)
*/
INT GetPrivateProfileString( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT len, LPCSTR filename )
INT16 GetPrivateProfileString16( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT16 len, LPCSTR filename )
{
return GetPrivateProfileString32A(section,entry,def_val,buffer,len,filename);
}
/***********************************************************************
* GetPrivateProfileString32A (KERNEL32.255)
*/
INT32 GetPrivateProfileString32A( LPCSTR section, LPCSTR entry, LPCSTR def_val,
LPSTR buffer, INT32 len, LPCSTR filename )
{
if (PROFILE_Open( filename ))
return PROFILE_GetString( section, entry, def_val, buffer, len );
@ -690,18 +783,73 @@ INT GetPrivateProfileString( LPCSTR section, LPCSTR entry, LPCSTR def_val,
return strlen( buffer );
}
/***********************************************************************
* GetPrivateProfileString32W (KERNEL32.256)
*/
INT32 GetPrivateProfileString32W( LPCWSTR section,LPCWSTR entry,LPCWSTR def_val,
LPWSTR buffer,INT32 len,LPCWSTR filename )
{
LPSTR sectionA = section?STRING32_DupUniToAnsi(section):NULL;
LPSTR entryA = entry?STRING32_DupUniToAnsi(entry):NULL;
LPSTR filenameA = filename?STRING32_DupUniToAnsi(filename):NULL;
LPSTR def_valA = def_val?STRING32_DupUniToAnsi(def_val):NULL;
LPSTR bufferA = xmalloc(len);
INT32 ret;
ret=GetPrivateProfileString32A(sectionA,entryA,def_valA,bufferA,len,filenameA);
if (sectionA) free(sectionA);
if (entryA) free(entryA);
if (filenameA) free(filenameA);
if (def_valA) free(def_valA);
lstrcpynAtoW( buffer, bufferA, len );
free(bufferA);
return ret;
}
/***********************************************************************
* WritePrivateProfileString (KERNEL.129)
* WritePrivateProfileString16 (KERNEL.129)
*/
BOOL WritePrivateProfileString( LPCSTR section, LPCSTR entry, LPCSTR string,
LPCSTR filename )
BOOL16 WritePrivateProfileString16(LPCSTR section,LPCSTR entry,LPCSTR string,
LPCSTR filename)
{
return WritePrivateProfileString32A(section,entry,string,filename);
}
/***********************************************************************
* WritePrivateProfileString32A (KERNEL32.582)
*/
BOOL32 WritePrivateProfileString32A(LPCSTR section,LPCSTR entry,LPCSTR string,
LPCSTR filename )
{
if (!PROFILE_Open( filename )) return FALSE;
if (!section) return PROFILE_FlushFile();
return PROFILE_SetString( section, entry, string );
}
/***********************************************************************
* WritePrivateProfileString32W (KERNEL32.583)
*/
BOOL32 WritePrivateProfileString32W(LPCWSTR section,LPCWSTR entry,LPCWSTR string,
LPCWSTR filename )
{
LPSTR sectionA = section?STRING32_DupUniToAnsi(section):NULL;
LPSTR entryA = entry?STRING32_DupUniToAnsi(entry):NULL;
LPSTR stringA = string?STRING32_DupUniToAnsi(string):NULL;
LPSTR filenameA = filename?STRING32_DupUniToAnsi(filename):NULL;
BOOL32 res;
res = WritePrivateProfileString32A(sectionA,entryA,stringA,filenameA);
if (sectionA) free(sectionA);
if (entryA) free(entryA);
if (stringA) free(stringA);
if (filenameA) free(filenameA);
return res;
}
/***********************************************************************
* WriteOutProfiles (KERNEL.315)

View File

@ -6,6 +6,7 @@ VPATH = @srcdir@
MODULE = graphics
C_SRCS = \
wing.c \
bitblt.c \
driver.c

67
graphics/wing.c Normal file
View File

@ -0,0 +1,67 @@
/*
* WingG support
*
* Started by Robert Pouliot <krynos@clic.net>
*/
#include "gdi.h"
#include "stddebug.h"
#include "debug.h"
/* I dunno if this structure can be put here... Maybe copyright, I'm no lawyer... */
typedef enum WING_DITHER_TYPE
{
WING_DISPERSED_4x4,
WING_DISPERSED_8x8,
WING_CLUSTERED_4x4
} WING_DITHER_TYPE;
/***********************************************************************
* WingCreateDC16 (WING.1001)
*/
HDC16 WinGCreateDC16(void)
{
/* FIXME: Probably wrong... */
return CreateDC("DISPLAY", NULL, NULL, NULL);
}
/***********************************************************************
* WinGRecommendDIBFormat16 (WING.1002)
*/
BOOL16 WinGRecommendDIBFormat16(BITMAPINFO *fmt)
{
fprintf(stdnimp,"WinGRecommendDIBFormat: empty stub!\n");
return 0;
}
/***********************************************************************
* WinGCreateBitmap16 (WING.1003)
*/
HBITMAP16 WinGCreateBitmap16(HDC16 winDC, BITMAPINFO *header, void **bits)
{
fprintf(stdnimp,"WinGCreateBitmap: empty stub! (expect failure)\n");
*bits=0;
return 0;
}
/***********************************************************************
* WinGCreateHalfTonePalette16 (WING.1007)
*/
HPALETTE16 WinGCreateHalfTonePalette16(void)
{
fprintf(stdnimp,"WinGCreateHalfTonePalette: empty stub!\n");
return 0;
}
/***********************************************************************
* WinGCreateHalfToneBrush16 (WING.1008)
*/
HPALETTE16 WinGCreateHalfToneBrush16(HDC16 winDC, COLORREF col, WING_DITHER_TYPE type)
{
fprintf(stdnimp,"WinGCreateHalfToneBrush: empty stub!\n");
return 0;
}

View File

@ -343,7 +343,7 @@ base 1
338 stub abort
339 cdecl abs(long) CRTDLL_abs
340 cdecl acos(long) CRTDLL_acos
341 stub asctime
341 cdecl asctime(ptr) asctime
342 cdecl asin(long) CRTDLL_asin
343 cdecl atan(long) CRTDLL_atan
344 cdecl atan2(long long) CRTDLL_atan2
@ -352,15 +352,15 @@ base 1
347 cdecl atoi(ptr) CRTDLL_atoi
348 cdecl atol(ptr) CRTDLL_atol
349 stub bsearch
350 stub calloc
350 cdecl calloc(long long) CRTDLL_calloc
351 stub ceil
352 stub clearerr
353 stub clock
353 cdecl clock() clock
354 cdecl cos(long) CRTDLL_cos
355 cdecl cosh(long) CRTDLL_cosh
356 stub ctime
356 cdecl ctime(ptr) ctime
357 stub difftime
358 stub div
358 cdecl div(long long) div
359 cdecl exit(long) CRTDLL_exit
360 cdecl exp(long) CRTDLL_exp
361 cdecl fabs(long) CRTDLL_fabs
@ -394,7 +394,7 @@ base 1
389 stub getchar
390 stub getenv
391 cdecl gets(ptr) CRTDLL_gets
392 stub gmtime
392 cdecl gmtime(ptr) gmtime
393 stub is_wctype
394 cdecl isalnum(long) CRTDLL_isalnum
395 cdecl isalpha(long) CRTDLL_isalpha
@ -423,9 +423,9 @@ base 1
418 cdecl isxdigit(long) CRTDLL_isxdigit
419 cdecl labs(long) CRTDLL_labs
420 stub ldexp
421 stub ldiv
421 cdecl ldiv(long long) ldiv
422 stub localeconv
423 stub localtime
423 cdecl localtime(ptr) localtime
424 cdecl log(long) CRTDLL_log
425 cdecl log10(long) CRTDLL_log10
426 stub longjmp
@ -438,7 +438,7 @@ base 1
433 cdecl memcpy(ptr ptr long) memcpy
434 cdecl memmove(ptr ptr long) memmove
435 cdecl memset(ptr long long) memset
436 stub mktime
436 cdecl mktime(ptr) mktime
437 stub modf
438 stub perror
439 cdecl pow(long long) CRTDLL_pow
@ -449,7 +449,7 @@ base 1
444 stub qsort
445 stub raise
446 cdecl rand() CRTDLL_rand
447 stub realloc
447 cdecl realloc(ptr long) CRTDLL_realloc
448 stub remove
449 stub rename
450 stub rewind
@ -464,27 +464,27 @@ base 1
459 cdecl sqrt(long) CRTDLL_sqrt
460 cdecl srand(long) CRTDLL_srand
461 stub sscanf
462 cdecl strcat(ptr ptr) lstrcat32A
462 cdecl strcat(ptr ptr) strcat
463 cdecl strchr(ptr long) strchr
464 cdecl strcmp(ptr ptr) lstrcmp32A
465 stub strcoll
466 cdecl strcpy(ptr ptr) lstrcpy32A
464 cdecl strcmp(ptr ptr) strcmp
465 cdecl strcoll(ptr ptr) strcoll
466 cdecl strcpy(ptr ptr) strcpy
467 cdecl strcspn(ptr ptr) strcspn
468 stub strerror
469 stub strftime
470 cdecl strlen(ptr) lstrlen32A
471 cdecl strncat(ptr ptr long) lstrcatn32A
472 cdecl strncmp(ptr ptr long) lstrncmp32A
473 cdecl strncpy(ptr ptr long) lstrcpyn32A
474 stub strpbrk
475 stub strrchr
469 cdecl strftime(ptr long ptr ptr) strftime
470 cdecl strlen(ptr) strlen
471 cdecl strncat(ptr ptr long) strncat
472 cdecl strncmp(ptr ptr long) strncmp
473 cdecl strncpy(ptr ptr long) strncpy
474 cdecl strpbrk(ptr ptr) strpbrk
475 cdecl strrchr(ptr long) strrchr
476 cdecl strspn(ptr ptr) strspn
477 cdecl strstr(ptr ptr) strstr
478 stub strtod
479 cdecl strtok(ptr ptr) strtok
480 cdecl strtol(ptr ptr long) strtol
481 cdecl strtoul(ptr ptr long) strtoul
482 stub strxfrm
482 cdecl strxfrm(ptr ptr long) strxfrm
483 stub swprintf
484 stub swscanf
485 stub system

View File

@ -149,7 +149,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
169 stub IsDCDirty
170 stub SetDCStatus
172 pascal16 SetRectRgn(word s_word s_word s_word s_word) SetRectRgn
173 pascal16 GetClipRgn(word) GetClipRgn
173 pascal16 GetClipRgn(word) GetClipRgn16
175 pascal16 EnumMetaFile(word word segptr long) THUNK_EnumMetaFile16
176 pascal16 PlayMetaFileRecord(word ptr ptr word) PlayMetaFileRecord
179 pascal16 GetDCState(word) GetDCState
@ -382,7 +382,7 @@ heap 65488 # 65536 - 16 (instance data) - 32 (stock objects)
610 stub GDISignalProc32
611 stub GetRandomRgn
612 stub GetTextCharSet
613 stub EnumFontFamiliesEx
613 pascal16 EnumFontFamiliesEx(word ptr segptr long long) THUNK_EnumFontFamiliesEx16
614 stub AddLpkToGDI
615 stub GetCharacterPlacement
616 stub GetFontLanguageInfo

View File

@ -86,11 +86,11 @@ base 1
0078 stub EndPath
0079 stub EnumEnhMetaFile
0080 stdcall EnumFontFamiliesA(long ptr ptr long) THUNK_EnumFontFamilies32A
0081 stub EnumFontFamiliesExA
0082 stub EnumFontFamiliesExW
0081 stdcall EnumFontFamiliesExA(long ptr ptr long long) THUNK_EnumFontFamiliesEx32A
0082 stdcall EnumFontFamiliesExW(long ptr ptr long long) THUNK_EnumFontFamiliesEx32W
0083 stdcall EnumFontFamiliesW(long ptr ptr long) THUNK_EnumFontFamilies32W
0084 stub EnumFontsA
0085 stub EnumFontsW
0084 stdcall EnumFontsA(long ptr ptr long) THUNK_EnumFonts32A
0085 stdcall EnumFontsW(long ptr ptr long) THUNK_EnumFonts32W
0086 stub EnumICMProfilesA
0087 stub EnumICMProfilesW
0088 stub EnumMetaFile
@ -153,7 +153,7 @@ base 1
0145 stdcall GetBkColor(long) GetBkColor
0146 stub GetBkMode
0147 stub GetBoundsRect
0148 stub GetBrushOrgEx
0148 stdcall GetBrushOrgEx(long ptr) GetBrushOrgEx32
0149 stub GetCharABCWidthsA
0150 stub GetCharABCWidthsFloatA
0151 stub GetCharABCWidthsFloatW
@ -168,12 +168,12 @@ base 1
0160 stub GetCharacterPlacementA
0161 stub GetCharacterPlacementW
0162 stdcall GetClipBox(long ptr) GetClipBox32
0163 stub GetClipRgn
0163 stdcall GetClipRgn(long long) GetClipRgn32
0164 stub GetColorAdjustment
0165 stub GetColorSpace
0166 stub GetCurrentObject
0167 stub GetCurrentPositionEx
0168 stub GetDCOrgEx
0167 stdcall GetCurrentPositionEx(long ptr) GetCurrentPositionEx32
0168 stdcall GetDCOrgEx(long ptr) GetDCOrgEx
0169 stub GetDIBColorTable
0170 stub GetDIBits
0171 stdcall GetDeviceCaps(long long) GetDeviceCaps
@ -239,16 +239,16 @@ base 1
0231 stub GetTextExtentPoint32W
0232 stdcall GetTextExtentPointA(long ptr long ptr) GetTextExtentPoint32A
0233 stdcall GetTextExtentPointW(long ptr long ptr) GetTextExtentPoint32W
0234 stub GetTextFaceA
0234 stdcall GetTextFaceA(long long ptr) GetTextFace
0235 stub GetTextFaceW
0236 stdcall GetTextMetricsA(long ptr) GetTextMetrics32A
0237 stdcall GetTextMetricsW(long ptr) GetTextMetrics32W
0238 stub GetTransform
0239 stub GetViewportExtEx
0240 stub GetViewportOrgEx
0239 stdcall GetViewportExtEx(long ptr) GetViewportExtEx32
0240 stdcall GetViewportOrgEx(long ptr) GetViewportOrgEx32
0241 stub GetWinMetaFileBits
0242 stub GetWindowExtEx
0243 stub GetWindowOrgEx
0242 stdcall GetWindowExtEx(long ptr) GetWindowExtEx32
0243 stdcall GetWindowOrgEx(long ptr) GetWindowOrgEx32
0244 stub GetWorldTransform
0245 stdcall IntersectClipRect(long long long long long) IntersectClipRect32
0246 stdcall InvertRgn(long long) InvertRgn32
@ -328,7 +328,7 @@ base 1
0319 stub SetICMProfileA
0320 stub SetICMProfileW
0321 stdcall SetMapMode(long long) SetMapMode
0322 stub SetMapperFlags
0322 stdcall SetMapperFlags(long long) SetMapperFlags
0323 stub SetMetaFileBitsEx
0324 stub SetMetaRgn
0325 stub SetMiterLimit

View File

@ -53,9 +53,9 @@ type win16
54 pascal16 GetInstanceData(word word word) GetInstanceData
55 pascal16 Catch(ptr) Catch
56 pascal16 Throw(ptr word) Throw
57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt
58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString
59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString
57 pascal16 GetProfileInt(ptr ptr s_word) GetProfileInt16
58 pascal16 GetProfileString(ptr ptr ptr ptr word) GetProfileString16
59 pascal16 WriteProfileString(ptr ptr ptr) WriteProfileString16
60 pascal16 FindResource(word segptr segptr) FindResource16
61 pascal16 LoadResource(word word) LoadResource16
62 pascal LockResource(word) WIN16_LockResource16
@ -123,11 +123,11 @@ type win16
124 return EnableKernel 0 0
125 return DisableKernel 0 0
126 stub MemoryFreed
127 pascal16 GetPrivateProfileInt(ptr ptr s_word ptr) GetPrivateProfileInt
127 pascal16 GetPrivateProfileInt(ptr ptr s_word ptr) GetPrivateProfileInt16
128 pascal16 GetPrivateProfileString(ptr ptr ptr ptr word ptr)
GetPrivateProfileString
GetPrivateProfileString16
129 pascal16 WritePrivateProfileString(ptr ptr ptr ptr)
WritePrivateProfileString
WritePrivateProfileString16
130 pascal FileCDR(ptr) FileCDR
131 pascal GetDOSEnvironment() GetDOSEnvironment
132 pascal GetWinFlags() GetWinFlags

View File

@ -96,8 +96,8 @@ base 1
0091 stub EnumResourceTypesW
0092 stdcall EnumSystemCodePagesA(ptr long) THUNK_EnumSystemCodePages32A
0093 stdcall EnumSystemCodePagesW(ptr long) THUNK_EnumSystemCodePages32W
0094 stub EnumSystemLocalesA
0095 stub EnumSystemLocalesW
0094 stdcall EnumSystemLocalesA(ptr long) THUNK_EnumSystemLocales32A
0095 stdcall EnumSystemLocalesW(ptr long) THUNK_EnumSystemLocales32W
0096 stub EnumTimeFormatsA
0097 stub EnumTimeFormatsW
0098 stub EraseTape
@ -253,12 +253,12 @@ base 1
0248 stdcall GetOEMCP() GetOEMCP
0249 stub GetOverlappedResult
0250 stub GetPriorityClass
0251 stdcall GetPrivateProfileIntA(ptr ptr long ptr) GetPrivateProfileInt
0252 stub GetPrivateProfileIntW
0251 stdcall GetPrivateProfileIntA(ptr ptr long ptr) GetPrivateProfileInt32A
0252 stdcall GetPrivateProfileIntW(ptr ptr long ptr) GetPrivateProfileInt32W
0253 stub GetPrivateProfileSectionA
0254 stub GetPrivateProfileSectionW
0255 stdcall GetPrivateProfileStringA(ptr ptr ptr ptr long ptr) GetPrivateProfileString
0256 stub GetPrivateProfileStringW
0255 stdcall GetPrivateProfileStringA(ptr ptr ptr ptr long ptr) GetPrivateProfileString32A
0256 stdcall GetPrivateProfileStringW(ptr ptr ptr ptr long ptr) GetPrivateProfileString32W
0257 stdcall GetProcAddress(long ptr) GetProcAddress32
0258 stdcall GetProcessAffinityMask(long ptr ptr) GetProcessAffinityMask
0259 stdcall GetProcessHeap() GetProcessHeap
@ -266,12 +266,12 @@ base 1
0261 stub GetProcessShutdownParameters
0262 stub GetProcessTimes
0263 stub GetProcessWorkingSetSize
0264 stdcall GetProfileIntA(ptr ptr long) GetProfileInt
0265 stub GetProfileIntW
0264 stdcall GetProfileIntA(ptr ptr long) GetProfileInt32A
0265 stdcall GetProfileIntW(ptr ptr long) GetProfileInt32W
0266 stub GetProfileSectionA
0267 stub GetProfileSectionW
0268 stdcall GetProfileStringA(ptr ptr ptr ptr long) GetProfileString
0269 stub GetProfileStringW
0268 stdcall GetProfileStringA(ptr ptr ptr ptr long) GetProfileString32A
0269 stdcall GetProfileStringW(ptr ptr ptr ptr long) GetProfileString32W
0270 stub GetQueuedCompletionStatus
0271 stdcall GetShortPathNameA(ptr ptr long) GetShortPathName32A
0272 stdcall GetShortPathNameW(ptr ptr long) GetShortPathName32W
@ -542,7 +542,7 @@ base 1
0537 stdcall UnhandledExceptionFilter(ptr) UnhandledExceptionFilter
0538 stub UnlockFile
0539 stub UnlockFileEx
0540 stub UnmapViewOfFile
0540 stdcall UnmapViewOfFile(ptr) UnmapViewOfFile
0541 stub UpdateResourceA
0542 stub UpdateResourceW
0543 stub VDMConsoleOperation
@ -584,13 +584,13 @@ base 1
0579 stub WriteFileEx
0580 stub WritePrivateProfileSectionA
0581 stub WritePrivateProfileSectionW
0582 stdcall WritePrivateProfileStringA(ptr ptr ptr ptr) WritePrivateProfileString
0583 stub WritePrivateProfileStringW
0582 stdcall WritePrivateProfileStringA(ptr ptr ptr ptr) WritePrivateProfileString32A
0583 stdcall WritePrivateProfileStringW(ptr ptr ptr ptr) WritePrivateProfileString32W
0584 stub WriteProcessMemory
0585 stub WriteProfileSectionA
0586 stub WriteProfileSectionW
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString
0588 stub WriteProfileStringW
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString32A
0588 stdcall WriteProfileStringW(ptr ptr ptr) WriteProfileString32W
0589 stub WriteTapemark
0590 stdcall _hread(long ptr long) _hread
0591 stdcall _hwrite(long ptr long) _hwrite

View File

@ -117,9 +117,28 @@ INT16 THUNK_EnumFonts16( HDC16 hdc, LPCSTR lpFaceName,
FONTENUMPROC16 func, LPARAM lParam )
{
DECL_THUNK( thunk, func, CallTo16_word_llwl );
return EnumFonts( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam );
return EnumFonts16( hdc, lpFaceName, (FONTENUMPROC16)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFonts32A (GDI32.84)
*/
INT32 THUNK_EnumFonts32A( HDC32 hdc, LPCSTR lpFaceName,
FONTENUMPROC32A func, LPARAM lParam )
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumFonts32A( hdc, lpFaceName, (FONTENUMPROC32A)&thunk, lParam );
}
/*************************************************************************
* THUNK_EnumFonts32W (GDI32.85)
*/
INT32 THUNK_EnumFonts32W( HDC32 hdc, LPCWSTR lpFaceName,
FONTENUMPROC32W func, LPARAM lParam )
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumFonts32W( hdc, lpFaceName, (FONTENUMPROC32W)&thunk, lParam );
}
/******************************************************************
* THUNK_EnumMetaFile16 (GDI.175)
@ -164,6 +183,44 @@ INT32 THUNK_EnumFontFamilies32W( HDC32 hdc, LPCWSTR lpszFamily,
return EnumFontFamilies32W(hdc,lpszFamily,(FONTENUMPROC32W)&thunk,lParam);
}
/*************************************************************************
* THUNK_EnumFontFamiliesEx16 (GDI.613)
*/
INT16 THUNK_EnumFontFamiliesEx16( HDC16 hdc, LPLOGFONT16 lpLF,
FONTENUMPROCEX16 func, LPARAM lParam,
DWORD reserved )
{
DECL_THUNK( thunk, func, CallTo16_word_llwl );
return EnumFontFamiliesEx16( hdc, lpLF, (FONTENUMPROCEX16)&thunk,
lParam, reserved );
}
/*************************************************************************
* THUNK_EnumFontFamiliesEx32A (GDI32.81)
*/
INT32 THUNK_EnumFontFamiliesEx32A( HDC32 hdc, LPLOGFONT32A lpLF,
FONTENUMPROCEX32A func, LPARAM lParam,
DWORD reserved)
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumFontFamiliesEx32A( hdc, lpLF, (FONTENUMPROCEX32A)&thunk,
lParam, reserved );
}
/*************************************************************************
* THUNK_EnumFontFamiliesEx32W (GDI32.82)
*/
INT32 THUNK_EnumFontFamiliesEx32W( HDC32 hdc, LPLOGFONT32W lpLF,
FONTENUMPROCEX32W func, LPARAM lParam,
DWORD reserved )
{
DECL_THUNK( thunk, func, CallTo32_4 );
return EnumFontFamiliesEx32W( hdc, lpLF, (FONTENUMPROCEX32W)&thunk,
lParam, reserved );
}
/**********************************************************************
* THUNK_LineDDA16 (GDI.100)
@ -320,6 +377,25 @@ BOOL32 THUNK_EnumSystemCodePages32W( CODEPAGE_ENUMPROC32W func, DWORD flags )
return EnumSystemCodePages32W( (CODEPAGE_ENUMPROC32W)&thunk, flags );
}
/***********************************************************************
* THUNK_EnumSystemLocales32A (KERNEL32.92)
*/
BOOL32 THUNK_EnumSystemLocales32A( LOCALE_ENUMPROC32A func, DWORD flags )
{
DECL_THUNK( thunk, func, CallTo32_1 );
return EnumSystemLocales32A( (LOCALE_ENUMPROC32A)&thunk, flags );
}
/***********************************************************************
* THUNK_EnumSystemLocales32W (KERNEL32.93)
*/
BOOL32 THUNK_EnumSystemLocales32W( LOCALE_ENUMPROC32W func, DWORD flags )
{
DECL_THUNK( thunk, func, CallTo32_1 );
return EnumSystemLocales32W( (LOCALE_ENUMPROC32W)&thunk, flags );
}
/***********************************************************************
* THUNK_GrayString16 (USER.185)

View File

@ -99,7 +99,7 @@ heap 65520
97 pascal16 CheckDlgButton(word word word) CheckDlgButton
98 pascal16 IsDlgButtonChecked(word word) IsDlgButtonChecked
99 pascal16 DlgDirSelect(word ptr word) DlgDirSelect
100 pascal16 DlgDirList(word segptr word word word) DlgDirList
100 pascal16 DlgDirList(word ptr word word word) DlgDirList16
101 pascal SendDlgItemMessage(word word word word long) SendDlgItemMessage16
102 pascal16 AdjustWindowRect(ptr long word) AdjustWindowRect16
103 pascal16 MapDialogRect(word ptr) MapDialogRect16
@ -194,7 +194,7 @@ heap 65520
192 pascal16 InSendMessage() InSendMessage
193 pascal16 IsClipboardFormatAvailable(word) IsClipboardFormatAvailable
194 pascal16 DlgDirSelectComboBox(word ptr word) DlgDirSelectComboBox
195 pascal16 DlgDirListComboBox(word segptr word word word) DlgDirListComboBox16
195 pascal16 DlgDirListComboBox(word ptr word word word) DlgDirListComboBox16
196 pascal TabbedTextOut(word s_word s_word ptr s_word s_word ptr s_word)
TabbedTextOut
197 pascal GetTabbedTextExtent(word ptr word word ptr) GetTabbedTextExtent

View File

@ -82,7 +82,7 @@ base 1
0077 stub CreateIconIndirect
0078 stub CreateMDIWindowA
0079 stub CreateMDIWindowW
0080 stub CreateMenu
0080 stdcall CreateMenu() CreateMenu
0081 stdcall CreatePopupMenu() CreatePopupMenu
0082 stdcall CreateWindowExA(long ptr ptr long long long long long
long long long ptr) CreateWindowEx32A
@ -146,10 +146,10 @@ base 1
0139 stdcall DialogBoxParamW(long ptr long ptr long) DialogBoxParam32W
0140 stdcall DispatchMessageA(ptr) USER32_DispatchMessageA
0141 stdcall DispatchMessageW(ptr) USER32_DispatchMessageA
0142 stub DlgDirListA
0142 stdcall DlgDirListA(long ptr long long long) DlgDirList32A
0143 stdcall DlgDirListComboBoxA(long ptr long long long) DlgDirListComboBox32A
0144 stdcall DlgDirListComboBoxW(long ptr long long long) DlgDirListComboBox32W
0145 stub DlgDirListW
0145 stdcall DlgDirListW(long ptr long long long) DlgDirList32W
0146 stdcall DlgDirSelectComboBoxExA(long ptr long long) DlgDirSelectComboBoxEx32A
0147 stdcall DlgDirSelectComboBoxExW(long ptr long long) DlgDirSelectComboBoxEx32W
0148 stdcall DlgDirSelectExA(long ptr long long) DlgDirSelectEx32A
@ -466,7 +466,7 @@ base 1
0459 stub SendNotifyMessageA
0460 stub SendNotifyMessageW
0461 stub ServerSetFunctionPointers
0462 stub SetActiveWindow
0462 stdcall SetActiveWindow(long) SetActiveWindow
0463 stdcall SetCapture(long) SetCapture32
0464 stdcall SetCaretBlinkTime(long) SetCaretBlinkTime
0465 stdcall SetCaretPos(long long) SetCaretPos

View File

@ -1,15 +1,16 @@
name wing
type win16
1001 stub WINGCREATEDC
1002 stub WINGRECOMMENDDIBFORMAT
1003 stub WINGCREATEBITMAP
1001 pascal16 WinGCreateDC() WinGCreateDC16
1002 pascal16 WinGRecommendDIBFormat(ptr) WinGRecommendDIBFormat16
1003 pascal16 WinGCreateBitmap(word ptr ptr) WinGCreateBitmap16
1004 stub WINGGETDIBPOINTER
1005 stub WINGGETDIBCOLORTABLE
1006 stub WINGSETDIBCOLORTABLE
1007 stub WINGCREATEHALFTONEPALETTE
1008 stub WINGCREATEHALFTONEBRUSH
1007 pascal16 WinGCreateHalfTonePalette() WinGCreateHalfTonePalette16
1008 pascal16 WinGCreateHalfToneBrush(word long word) WinGCreateHalfToneBrush16
1009 stub WINGSTRETCHBLT
# Probably much like BitBlt16... but, without the last field (what value?)
1010 stub WINGBITBLT
# Seem that 1299 is the limit... weird...

View File

@ -139,7 +139,7 @@ type win32
0138 stub timeEndPeriod
0139 stub timeGetDevCaps
0140 stub timeGetSystemTime
0141 stub timeGetTime
0141 stdcall timeGetTime() timeGetTime
0142 stub timeKillEvent
0143 stub timeSetEvent
0144 stub waveInAddBuffer

View File

@ -37,17 +37,17 @@ type win16
56 pascal getservbyport(word ptr) WINSOCK_getservbyport
57 pascal gethostname(ptr word) WINSOCK_gethostname
101 pascal16 WSAAsyncSelect(word word word long) WSAAsyncSelect
102 pascal16 WSAAsyncGetHostByAddr(word word ptr word word ptr word)
102 pascal16 WSAAsyncGetHostByAddr(word word ptr word word segptr word)
WSAAsyncGetHostByAddr
103 pascal16 WSAAsyncGetHostByName(word word ptr ptr word)
103 pascal16 WSAAsyncGetHostByName(word word ptr segptr word)
WSAAsyncGetHostByName
104 pascal16 WSAAsyncGetProtoByNumber(word word word ptr word)
104 pascal16 WSAAsyncGetProtoByNumber(word word word segptr word)
WSAAsyncGetProtoByNumber
105 pascal16 WSAAsyncGetProtoByName(word word ptr ptr word)
105 pascal16 WSAAsyncGetProtoByName(word word ptr segptr word)
WSAAsyncGetProtoByName
106 pascal16 WSAAsyncGetServByPort(word word word ptr ptr word)
106 pascal16 WSAAsyncGetServByPort(word word word ptr segptr word)
WSAAsyncGetServByPort
107 pascal16 WSAAsyncGetServByName(word word ptr ptr ptr word)
107 pascal16 WSAAsyncGetServByName(word word ptr ptr segptr word)
WSAAsyncGetServByName
108 pascal16 WSACancelAsyncRequest(word) WSACancelAsyncRequest
109 pascal16 WSASetBlockingHook() WSASetBlockingHook
@ -58,4 +58,4 @@ type win16
114 pascal16 WSAIsBlocking() WSAIsBlocking
115 pascal WSAStartup(word ptr) WSAStartup
116 pascal WSACleanup() WSACleanup
151 pascal16 __WSAFDIsSet(word ptr) WSAFDIsSet
151 pascal16 __WSAFDIsSet(word ptr) __WSAFDIsSet

View File

@ -4,7 +4,6 @@ type win16
1 pascal WINPROC_CallProc16To32A(word word word long long) WINPROC_CallProc16To32A
2 pascal StaticWndProc(word word word long) StaticWndProc
3 pascal ScrollBarWndProc(word word word long) ScrollBarWndProc
4 pascal ListBoxWndProc(word word word long) ListBoxWndProc
5 pascal ComboBoxWndProc(word word word long) ComboBoxWndProc
6 pascal EditWndProc(word word word long) EditWndProc
7 pascal PopupMenuWndProc(word word word long) PopupMenuWndProc

View File

@ -3,9 +3,6 @@
/* Define to empty if the keyword does not work. */
#undef const
/* Define if you need to in order for stat and other things to work. */
#undef _POSIX_SOURCE
/* Define to `unsigned' if <sys/types.h> doesn't define. */
#undef size_t
@ -15,6 +12,9 @@
/* Define if you have the ANSI C header files. */
#undef STDC_HEADERS
/* Define if the X Window System is missing or not being used. */
#undef X_DISPLAY_MISSING
/* Define if symbols declared in assembly code need an underscore prefix */
#undef NEED_UNDERSCORE_PREFIX

View File

@ -8,6 +8,7 @@
#define DCE_H
#include "windows.h"
#include "win.h"
/* additional DCX flags
*/
@ -44,8 +45,9 @@ typedef struct tagDCE
} DCE;
extern void DCE_Init(void);
extern DCE *DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type );
extern void DCE_FreeDCE( DCE *dce );
extern void DCE_Init(void);
extern DCE* DCE_AllocDCE( HWND32 hWnd, DCE_TYPE type );
extern void DCE_FreeDCE( DCE *dce );
extern INT16 DCE_ExcludeRgn( HDC32, WND*, HRGN32 );
#endif /* DCE_H */

View File

@ -13,6 +13,7 @@ extern HANDLE16 HOOK_GetHook( INT16 id , HQUEUE16 hQueue );
extern LRESULT HOOK_CallHooks( INT16 id, INT16 code,
WPARAM16 wParam, LPARAM lParam );
extern HOOKPROC16 HOOK_GetProc16( HHOOK hook );
extern void HOOK_ResetQueueHooks( HQUEUE16 hQueue );
extern void HOOK_FreeModuleHooks( HMODULE16 hModule );
extern void HOOK_FreeQueueHooks( HQUEUE16 hQueue );

32
include/keyboard.h Normal file
View File

@ -0,0 +1,32 @@
/*
* Keyboard definitions
*
*/
#ifndef __WINE_KEYBOARD_H
#define __WINE_KEYBOARD_H
#define WINE_VKEY_MAPPINGS\
vkcase('!', '1')\
vkcase('@', '2')\
vkcase('#', '3')\
vkcase('$', '4')\
vkcase('%', '5')\
vkcase('^', '6')\
vkcase('&', '7')\
vkcase('*', '8')\
vkcase('(', '9')\
vkcase(')', '0')\
vkcase2('`', '~', 0xc0)\
vkcase2('-', '_', 0xbd)\
vkcase2('=', '+', 0xbb)\
vkcase2('[', '{', 0xdb)\
vkcase2(']', '}', 0xdd)\
vkcase2(';', ':', 0xba)\
vkcase2('\'', '"', 0xde)\
vkcase2(',', '<', 0xbc)\
vkcase2('.', '>', 0xbe)\
vkcase2('/', '?', 0xbf)\
vkcase2('\\', '|', 0xdc)
#endif /* __WINE_KEYBOARD_H */

View File

@ -69,5 +69,3 @@ extern void ListBoxDrawItem (HWND hwnd, LPHEADLIST lphl, HDC16 hdc,
WORD itemState);
extern int ListBoxFindMouse(LPHEADLIST lphl, int X, int Y);
extern void ListBoxAskMeasure(LPHEADLIST lphl, LPLISTSTRUCT lpls);
extern LRESULT ListBoxWndProc(HWND hwnd,UINT message,WPARAM16 wParam,LPARAM lParam);

View File

@ -92,7 +92,7 @@ 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_DestroyQueueWindows( WND* wnd, HQUEUE16 hQueue );
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 );

View File

@ -920,8 +920,40 @@ typedef struct
WCHAR elfStyle[LF_FACESIZE] WINE_PACKED;
} ENUMLOGFONT32W, *LPENUMLOGFONT32W;
typedef struct
{
LOGFONT16 elfLogFont;
BYTE elfFullName[LF_FULLFACESIZE] WINE_PACKED;
BYTE elfStyle[LF_FACESIZE] WINE_PACKED;
BYTE elfScript[LF_FACESIZE] WINE_PACKED;
} ENUMLOGFONTEX16, *LPENUMLOGFONTEX16;
typedef struct
{
LOGFONT32A elfLogFont;
BYTE elfFullName[LF_FULLFACESIZE] WINE_PACKED;
BYTE elfStyle[LF_FACESIZE] WINE_PACKED;
BYTE elfScript[LF_FACESIZE] WINE_PACKED;
} ENUMLOGFONTEX32A,*LPENUMLOGFONTEX32A;
typedef struct
{
LOGFONT32W elfLogFont;
WCHAR elfFullName[LF_FULLFACESIZE] WINE_PACKED;
WCHAR elfStyle[LF_FACESIZE] WINE_PACKED;
WCHAR elfScript[LF_FACESIZE] WINE_PACKED;
} ENUMLOGFONTEX32W,*LPENUMLOGFONTEX32W;
DECL_WINELIB_TYPE_AW(ENUMLOGFONT);
DECL_WINELIB_TYPE_AW(LPENUMLOGFONT);
DECL_WINELIB_TYPE_AW(LPENUMLOGFONTEX);
typedef struct
{
DWORD fsUsb[4];
DWORD fsCsb[2];
} FONTSIGNATURE,*LPFONTSIGNATURE;
/* lfWeight values */
#define FW_DONTCARE 0
@ -1057,11 +1089,130 @@ typedef struct
DECL_WINELIB_TYPE_AW(TEXTMETRIC);
DECL_WINELIB_TYPE_AW(LPTEXTMETRIC);
/* ntmFlags field flags */
#define NTM_REGULAR 0x00000040L
#define NTM_BOLD 0x00000020L
#define NTM_ITALIC 0x00000001L
typedef struct
{
INT16 tmHeight;
INT16 tmAscent;
INT16 tmDescent;
INT16 tmInternalLeading;
INT16 tmExternalLeading;
INT16 tmAveCharWidth;
INT16 tmMaxCharWidth;
INT16 tmWeight;
BYTE tmItalic;
BYTE tmUnderlined;
BYTE tmStruckOut;
BYTE tmFirstChar;
BYTE tmLastChar;
BYTE tmDefaultChar;
BYTE tmBreakChar;
BYTE tmPitchAndFamily;
BYTE tmCharSet;
INT16 tmOverhang WINE_PACKED;
INT16 tmDigitizedAspectX WINE_PACKED;
INT16 tmDigitizedAspectY WINE_PACKED;
DWORD ntmFlags;
UINT16 ntmSizeEM;
UINT16 ntmCellHeight;
UINT16 ntmAvgWidth;
} NEWTEXTMETRIC16,*LPNEWTEXTMETRIC16;
typedef struct
{
INT32 tmHeight;
INT32 tmAscent;
INT32 tmDescent;
INT32 tmInternalLeading;
INT32 tmExternalLeading;
INT32 tmAveCharWidth;
INT32 tmMaxCharWidth;
INT32 tmWeight;
INT32 tmOverhang;
INT32 tmDigitizedAspectX;
INT32 tmDigitizedAspectY;
BYTE tmFirstChar;
BYTE tmLastChar;
BYTE tmDefaultChar;
BYTE tmBreakChar;
BYTE tmItalic;
BYTE tmUnderlined;
BYTE tmStruckOut;
BYTE tmPitchAndFamily;
BYTE tmCharSet;
DWORD ntmFlags;
UINT32 ntmSizeEM;
UINT32 ntmCellHeight;
UINT32 ntmAvgWidth;
} NEWTEXTMETRIC32A, *LPNEWTEXTMETRIC32A;
typedef struct
{
INT32 tmHeight;
INT32 tmAscent;
INT32 tmDescent;
INT32 tmInternalLeading;
INT32 tmExternalLeading;
INT32 tmAveCharWidth;
INT32 tmMaxCharWidth;
INT32 tmWeight;
INT32 tmOverhang;
INT32 tmDigitizedAspectX;
INT32 tmDigitizedAspectY;
WCHAR tmFirstChar;
WCHAR tmLastChar;
WCHAR tmDefaultChar;
WCHAR tmBreakChar;
BYTE tmItalic;
BYTE tmUnderlined;
BYTE tmStruckOut;
BYTE tmPitchAndFamily;
BYTE tmCharSet;
DWORD ntmFlags;
UINT32 ntmSizeEM;
UINT32 ntmCellHeight;
UINT32 ntmAvgWidth;
} NEWTEXTMETRIC32W, *LPNEWTEXTMETRIC32W;
DECL_WINELIB_TYPE_AW(NEWTEXTMETRIC);
DECL_WINELIB_TYPE_AW(LPNEWTEXTMETRIC);
typedef struct
{
NEWTEXTMETRIC16 ntmetm;
FONTSIGNATURE ntmeFontSignature;
} NEWTEXTMETRICEX16,*LPNEWTEXTMETRICEX16;
typedef struct
{
NEWTEXTMETRIC32A ntmetm;
FONTSIGNATURE ntmeFontSignature;
} NEWTEXTMETRICEX32A,*LPNEWTEXTMETRICEX32A;
typedef struct
{
NEWTEXTMETRIC32W ntmetm;
FONTSIGNATURE ntmeFontSignature;
} NEWTEXTMETRICEX32W,*LPNEWTEXTMETRICEX32W;
DECL_WINELIB_TYPE_AW(NEWTEXTMETRICEX);
DECL_WINELIB_TYPE_AW(LPNEWTEXTMETRICEX);
typedef INT16 (*FONTENUMPROC16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef INT32 (*FONTENUMPROC32A)(const LOGFONT32A*,const TEXTMETRIC32A*,UINT32,LPARAM);
typedef INT32 (*FONTENUMPROC32W)(const LOGFONT32W*,const TEXTMETRIC32W*,UINT32,LPARAM);
typedef INT32 (*FONTENUMPROC32A)(LPENUMLOGFONT32A,LPNEWTEXTMETRIC32A,UINT32,LPARAM);
typedef INT32 (*FONTENUMPROC32W)(LPENUMLOGFONT32W,LPNEWTEXTMETRIC32W,UINT32,LPARAM);
DECL_WINELIB_TYPE_AW(FONTENUMPROC);
typedef INT16 (*FONTENUMPROCEX16)(SEGPTR,SEGPTR,UINT16,LPARAM);
typedef INT32 (*FONTENUMPROCEX32A)(LPENUMLOGFONTEX32A,LPNEWTEXTMETRICEX32A,UINT32,LPARAM);
typedef INT32 (*FONTENUMPROCEX32W)(LPENUMLOGFONTEX32W,LPNEWTEXTMETRICEX32W,UINT32,LPARAM);
DECL_WINELIB_TYPE_AW(FONTENUMPROCEX);
/* tmPitchAndFamily values */
#define TMPF_FIXED_PITCH 1
#define TMPF_VECTOR 2
@ -2724,7 +2875,12 @@ typedef struct
#define LB_FINDSTRINGEXACT16 (WM_USER+35)
#define LB_FINDSTRINGEXACT32 0x01a2
#define LB_FINDSTRINGEXACT WINELIB_NAME(LB_FINDSTRINGEXACT)
/* Here are 2 undocumented messages used by ComboLBoxes */
#define LB_CARETON16 (WM_USER+36)
#define LB_CARETON32 0x01a3
#define LB_CARETON WINELIB_NAME(LB_CARETON)
#define LB_CARETOFF16 (WM_USER+37)
#define LB_CARETOFF32 0x01a4
#define LB_CARETOFF WINELIB_NAME(LB_CARETOFF)
#define LB_SETLOCALE16 WM_NULL /* Not in Win16 */
#define LB_SETLOCALE32 0x01a5
#define LB_SETLOCALE WINELIB_NAME(LB_SETLOCALE)
@ -3088,16 +3244,22 @@ DECL_WINELIB_TYPE(LPCOMPAREITEMSTRUCT);
#define VK_RBUTTON 0x02
#define VK_CANCEL 0x03
#define VK_MBUTTON 0x04
/* 0x05-0x07 Undefined */
#define VK_BACK 0x08
#define VK_TAB 0x09
/* 0x0A-0x0B Undefined */
#define VK_CLEAR 0x0C
#define VK_RETURN 0x0D
/* 0x0E-0x0F Undefined */
#define VK_SHIFT 0x10
#define VK_CONTROL 0x11
#define VK_MENU 0x12
#define VK_PAUSE 0x13
#define VK_CAPITAL 0x14
/* 0x15-0x19 Reserved for Kanji systems */
/* 0x1A Undefined */
#define VK_ESCAPE 0x1B
/* 0x1C-0x1F Reserved for Kanji systems */
#define VK_SPACE 0x20
#define VK_PRIOR 0x21
#define VK_NEXT 0x22
@ -3108,12 +3270,50 @@ DECL_WINELIB_TYPE(LPCOMPAREITEMSTRUCT);
#define VK_RIGHT 0x27
#define VK_DOWN 0x28
#define VK_SELECT 0x29
#define VK_PRINT 0x2A
#define VK_PRINT 0x2A /* OEM specific in Windows 3.1 SDK */
#define VK_EXECUTE 0x2B
#define VK_SNAPSHOT 0x2C
#define VK_INSERT 0x2D
#define VK_DELETE 0x2E
#define VK_HELP 0x2F
#define VK_0 0x30
#define VK_1 0x31
#define VK_2 0x32
#define VK_3 0x33
#define VK_4 0x34
#define VK_5 0x35
#define VK_6 0x36
#define VK_7 0x37
#define VK_8 0x38
#define VK_9 0x39
/* 0x3A-0x40 Undefined */
#define VK_A 0x41
#define VK_B 0x42
#define VK_C 0x43
#define VK_D 0x44
#define VK_E 0x45
#define VK_F 0x46
#define VK_G 0x47
#define VK_H 0x48
#define VK_I 0x49
#define VK_J 0x4A
#define VK_K 0x4B
#define VK_L 0x4C
#define VK_M 0x4D
#define VK_N 0x4E
#define VK_O 0x4F
#define VK_P 0x50
#define VK_Q 0x51
#define VK_R 0x52
#define VK_S 0x53
#define VK_T 0x54
#define VK_U 0x55
#define VK_V 0x56
#define VK_W 0x57
#define VK_X 0x58
#define VK_Y 0x59
#define VK_Z 0x5A
/* 0x5B-0x5F Undefined */
#define VK_NUMPAD0 0x60
#define VK_NUMPAD1 0x61
#define VK_NUMPAD2 0x62
@ -3154,8 +3354,18 @@ DECL_WINELIB_TYPE(LPCOMPAREITEMSTRUCT);
#define VK_F22 0x85
#define VK_F23 0x86
#define VK_F24 0x87
/* 0x88-0x8F Unassigned */
#define VK_NUMLOCK 0x90
#define VK_SCROLL 0x91
/* 0x92-0xB9 Unassigned */
/* 0xBA-0xC0 OEM specific */
/* 0xC1-0xDA Unassigned */
/* 0xDB-0xE4 OEM specific */
/* 0xE5 Unassigned */
/* 0xE6 OEM specific */
/* 0xE7-0xE8 Unassigned */
/* 0xE9-0xF5 OEM specific */
/* 0xF6-0xFE Unassigned */
#define LMEM_FIXED 0
@ -3705,6 +3915,10 @@ typedef BOOL32 (*CODEPAGE_ENUMPROC32A)(LPSTR);
typedef BOOL32 (*CODEPAGE_ENUMPROC32W)(LPWSTR);
DECL_WINELIB_TYPE_AW(CODEPAGE_ENUMPROC);
typedef BOOL32 (*LOCALE_ENUMPROC32A)(LPSTR);
typedef BOOL32 (*LOCALE_ENUMPROC32W)(LPWSTR);
DECL_WINELIB_TYPE_AW(LOCALE_ENUMPROC);
typedef struct tagSYSTEM_INFO
{
DWORD dwOemId;
@ -3742,10 +3956,6 @@ BOOL16 FastWindowFrame(HDC16,const RECT16*,INT16,INT16,DWORD);
VOID FillWindow(HWND16,HWND16,HDC16,HBRUSH16);
INT16 FlushComm(INT16,INT16);
WORD FreeSelector(WORD);
void GlobalFreeAll(HGLOBAL16);
HGLOBAL16 GlobalLRUNewest(HGLOBAL16);
HGLOBAL16 GlobalLRUOldest(HGLOBAL16);
VOID GlobalNotify(FARPROC16);
HANDLE16 GetAtomHandle(ATOM);
DWORD GetBitmapDimension(HBITMAP16);
HANDLE16 GetCodeHandle(FARPROC16);
@ -3755,6 +3965,7 @@ VOID GetCodeInfo(FARPROC16,LPVOID);
HANDLE16 GetCurrentPDB(void);
HTASK16 GetCurrentTask(void);
DWORD GetDCHook(HDC16,FARPROC16*);
DWORD GetDCOrg(HDC16);
HWND16 GetDesktopHwnd(void);
HMODULE16 GetExePtr(HANDLE16);
WORD GetExeVersion(void);
@ -3768,6 +3979,10 @@ HINSTANCE16 GetTaskDS(void);
HQUEUE16 GetTaskQueue(HTASK16);
DWORD GlobalDOSAlloc(DWORD);
WORD GlobalDOSFree(WORD);
void GlobalFreeAll(HGLOBAL16);
HGLOBAL16 GlobalLRUNewest(HGLOBAL16);
HGLOBAL16 GlobalLRUOldest(HGLOBAL16);
VOID GlobalNotify(FARPROC16);
WORD GlobalPageLock(HGLOBAL16);
WORD GlobalPageUnlock(HGLOBAL16);
INT16 InitApp(HINSTANCE16);
@ -3815,6 +4030,7 @@ INT16 UngetCommChar(INT16,CHAR);
VOID UserYield(void);
BOOL16 WaitEvent(HTASK16);
INT16 WriteComm(INT16,LPSTR,INT16);
VOID WriteOutProfiles(VOID);
VOID hmemcpy(LPVOID,LPCVOID,LONG);
VOID Yield(void);
@ -3835,6 +4051,9 @@ INT32 EnumPropsEx32W(HWND32,PROPENUMPROCEX32W,LPARAM);
BOOL32 EnumSystemCodePages32A(CODEPAGE_ENUMPROC32A,DWORD);
BOOL32 EnumSystemCodePages32W(CODEPAGE_ENUMPROC32W,DWORD);
#define EnumSystemCodePages WINELIB_NAME_AW(EnumSystemCodePages)
BOOL32 EnumSystemLocales32A(LOCALE_ENUMPROC32A,DWORD);
BOOL32 EnumSystemLocales32W(LOCALE_ENUMPROC32W,DWORD);
#define EnumSystemLocales WINELIB_NAME_AW(EnumSystemLocales)
BOOL32 EnumThreadWindows(DWORD,WNDENUMPROC32,LPARAM);
void ExitProcess(DWORD);
BOOL32 FileTimeToDosDateTime(LPFILETIME,LPWORD,LPWORD);
@ -3848,6 +4067,7 @@ LPCSTR GetCommandLine32A();
LPCWSTR GetCommandLine32W();
#define GetCommandLine WINELIB_NAME_AW(GetCommandLine)
BOOL32 GetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 GetDCOrgEx(HDC32,LPPOINT32);
DWORD GetFileInformationByHandle(HFILE,BY_HANDLE_FILE_INFORMATION*);
DWORD GetFileSize(HFILE,LPDWORD);
DWORD GetFileType(HFILE);
@ -3873,6 +4093,7 @@ DWORD HeapSize(HANDLE32,DWORD,LPVOID);
BOOL32 HeapUnlock(HANDLE32);
BOOL32 HeapValidate(HANDLE32,DWORD,LPVOID);
BOOL32 IsWindowUnicode(HWND32);
BOOL32 IsValidLocale(DWORD,DWORD);
BOOL32 LocalFileTimeToFileTime(LPFILETIME,LPFILETIME);
LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,DWORD);
BOOL32 MoveFile32A(LPCSTR,LPCSTR);
@ -4220,7 +4441,11 @@ INT16 DialogBoxParam16(HINSTANCE16,SEGPTR,HWND16,DLGPROC16,LPARAM);
INT32 DialogBoxParam32A(HINSTANCE32,LPCSTR,HWND32,DLGPROC32,LPARAM);
INT32 DialogBoxParam32W(HINSTANCE32,LPCWSTR,HWND32,DLGPROC32,LPARAM);
#define DialogBoxParam WINELIB_NAME_AW(DialogBoxParam)
INT16 DlgDirListComboBox16(HWND16,SEGPTR,INT16,INT16,UINT16);
INT16 DlgDirList16(HWND16,LPCSTR,INT16,INT16,UINT16);
INT32 DlgDirList32A(HWND32,LPCSTR,INT32,INT32,UINT32);
INT32 DlgDirList32W(HWND32,LPCWSTR,INT32,INT32,UINT32);
#define DlgDirList WINELIB_NAME_AW(DlgDirList)
INT16 DlgDirListComboBox16(HWND16,LPCSTR,INT16,INT16,UINT16);
INT32 DlgDirListComboBox32A(HWND32,LPCSTR,INT32,INT32,UINT32);
INT32 DlgDirListComboBox32W(HWND32,LPCWSTR,INT32,INT32,UINT32);
#define DlgDirListComboBox WINELIB_NAME_AW(DlgDirListComboBox)
@ -4264,6 +4489,14 @@ INT16 EnumFontFamilies16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
INT32 EnumFontFamilies32A(HDC32,LPCSTR,FONTENUMPROC32A,LPARAM);
INT32 EnumFontFamilies32W(HDC32,LPCWSTR,FONTENUMPROC32W,LPARAM);
#define EnumFontFamilies WINELIB_NAME_AW(EnumFontFamilies)
INT16 EnumFontFamiliesEx16(HDC16,LPLOGFONT16,FONTENUMPROCEX16,LPARAM,DWORD);
INT32 EnumFontFamiliesEx32A(HDC32,LPLOGFONT32A,FONTENUMPROCEX32A,LPARAM,DWORD);
INT32 EnumFontFamiliesEx32W(HDC32,LPLOGFONT32W,FONTENUMPROCEX32W,LPARAM,DWORD);
#define EnumFontFamiliesEx WINELIB_NAME_AW(EnumFontFamiliesEx)
INT16 EnumFonts16(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
INT32 EnumFonts32A(HDC32,LPCSTR,FONTENUMPROC32A,LPARAM);
INT32 EnumFonts32W(HDC32,LPCWSTR,FONTENUMPROC32W,LPARAM);
#define EnumFonts WINELIB_NAME_AW(EnumFonts)
INT16 EnumObjects16(HDC16,INT16,GOBJENUMPROC16,LPARAM);
INT32 EnumObjects32(HDC32,INT32,GOBJENUMPROC32,LPARAM);
#define EnumObjects WINELIB_NAME(EnumObjects)
@ -4384,6 +4617,9 @@ INT32 GetClipBox32(HDC32,LPRECT32);
void GetClipCursor16(LPRECT16);
void GetClipCursor32(LPRECT32);
#define GetClipCursor WINELIB_NAME(GetClipCursor)
HRGN16 GetClipRgn16(HDC16);
INT32 GetClipRgn32(HDC32,HRGN32);
#define GetClipRgn WINELIB_NAME(GetClipRgn)
INT16 GetCommState16(INT16,LPDCB16);
BOOL32 GetCommState32(INT32,LPDCB32);
#define GetCommState WINELIB_NAME(GetCommState)
@ -4459,9 +4695,25 @@ HWND32 GetParent32(HWND32);
COLORREF GetPixel16(HDC16,INT16,INT16);
COLORREF GetPixel32(HDC32,INT32,INT32);
#define GetPixel WINELIB_NAME(GetPixel)
UINT16 GetPrivateProfileInt16(LPCSTR,LPCSTR,INT16,LPCSTR);
UINT32 GetPrivateProfileInt32A(LPCSTR,LPCSTR,INT32,LPCSTR);
UINT32 GetPrivateProfileInt32W(LPCWSTR,LPCWSTR,INT32,LPCWSTR);
#define GetPrivateProfileInt WINELIB_NAME_AW(GetPrivateProfileInt)
INT16 GetPrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT16,LPCSTR);
INT32 GetPrivateProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT32,LPCSTR);
INT32 GetPrivateProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,INT32,LPCWSTR);
#define GetPrivateProfileString WINELIB_NAME_AW(GetPrivateProfileString)
FARPROC16 GetProcAddress16(HMODULE16,SEGPTR);
FARPROC32 GetProcAddress32(HMODULE32,LPCSTR);
#define GetProcAddress WINELIB_NAME(GetProcAddress)
UINT16 GetProfileInt16(LPCSTR,LPCSTR,INT16);
UINT32 GetProfileInt32A(LPCSTR,LPCSTR,INT32);
UINT32 GetProfileInt32W(LPCWSTR,LPCWSTR,INT32);
#define GetProfileInt WINELIB_NAME_AW(GetProfileInt)
INT16 GetProfileString16(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT16);
INT32 GetProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT32);
INT32 GetProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPWSTR,INT32);
#define GetProfileString WINELIB_NAME_AW(GetProfileString)
HANDLE16 GetProp16(HWND16,LPCSTR);
HANDLE32 GetProp32A(HWND32,LPCSTR);
HANDLE32 GetProp32W(HWND32,LPCWSTR);
@ -5099,6 +5351,14 @@ HWND32 WindowFromDC32(HDC32);
HWND16 WindowFromPoint16(POINT16);
HWND32 WindowFromPoint32(POINT32);
#define WindowFromPoint WINELIB_NAME(WindowFromPoint)
BOOL16 WritePrivateProfileString16(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL32 WritePrivateProfileString32A(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL32 WritePrivateProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR,LPCWSTR);
#define WritePrivateProfileString WINELIB_NAME_AW(WritePrivateProfileString)
BOOL16 WriteProfileString16(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WriteProfileString32A(LPCSTR,LPCSTR,LPCSTR);
BOOL32 WriteProfileString32W(LPCWSTR,LPCWSTR,LPCWSTR);
#define WriteProfileString WINELIB_NAME_AW(WriteProfileString)
SEGPTR lstrcat16(SEGPTR,SEGPTR);
LPSTR lstrcat32A(LPSTR,LPCSTR);
LPWSTR lstrcat32W(LPWSTR,LPCWSTR);
@ -5238,7 +5498,6 @@ BOOL DestroyIcon(HICON16);
BOOL DestroyMenu(HMENU16);
BOOL DestroyWindow(HWND);
LONG DispatchMessage(const MSG16*);
INT DlgDirList(HWND,SEGPTR,INT,INT,UINT);
BOOL16 DragDetect(HWND16,POINT16);
DWORD DragObject(HWND, HWND, WORD, HANDLE16, WORD, HCURSOR16);
BOOL DrawIcon(HDC16,INT,INT,HICON16);
@ -5249,7 +5508,6 @@ BOOL EnableMenuItem(HMENU16,UINT,UINT);
BOOL EnableWindow(HWND,BOOL);
BOOL EndDeferWindowPos(HDWP16);
UINT16 EnumClipboardFormats(UINT16);
INT EnumFonts(HDC16,LPCSTR,FONTENUMPROC16,LPARAM);
BOOL EnumMetaFile(HDC16,HMETAFILE16,MFENUMPROC16,LPARAM);
INT Escape(HDC16,INT,INT,SEGPTR,SEGPTR);
BOOL ExitWindows(DWORD,WORD);
@ -5271,7 +5529,6 @@ WORD GetBkMode(HDC16);
DWORD GetBrushOrg(HDC16);
BOOL GetCharABCWidths(HDC16,UINT,UINT,LPABC16);
BOOL GetCharWidth(HDC16,WORD,WORD,LPINT16);
HRGN32 GetClipRgn(HDC16);
HANDLE16 GetClipboardData(WORD);
int GetClipboardFormatName(WORD,LPSTR,short);
HWND GetClipboardOwner(void);
@ -5280,7 +5537,6 @@ HBRUSH16 GetControlBrush(HWND,HDC16,WORD);
DWORD GetCurrentPosition(HDC16);
DWORD GetCurrentTime(void);
HCURSOR16 GetCursor(void);
DWORD GetDCOrg(HDC16);
HDC16 GetDCState(HDC16);
int GetDIBits(HDC16,HBITMAP16,WORD,WORD,LPSTR,LPBITMAPINFO,WORD);
SEGPTR GetDOSEnvironment(void);
@ -5323,10 +5579,6 @@ HWND GetOpenClipboardWindow(void);
WORD GetPaletteEntries(HPALETTE16,WORD,WORD,LPPALETTEENTRY);
WORD GetPolyFillMode(HDC16);
int GetPriorityClipboardFormat(WORD*,short);
UINT GetPrivateProfileInt(LPCSTR,LPCSTR,INT,LPCSTR);
INT GetPrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT,LPCSTR);
UINT GetProfileInt(LPCSTR,LPCSTR,INT);
INT GetProfileString(LPCSTR,LPCSTR,LPCSTR,LPSTR,INT);
DWORD GetQueueStatus(UINT);
BOOL GetRasterizerCaps(LPRASTERIZER_STATUS,UINT);
WORD GetROP2(HDC16);
@ -5484,9 +5736,6 @@ void WaitMessage(void);
int WaitSoundState(int);
HINSTANCE16 WinExec(LPSTR,WORD);
BOOL WinHelp(HWND,LPSTR,WORD,DWORD);
void WriteOutProfiles(void);
BOOL WritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL WriteProfileString(LPCSTR,LPCSTR,LPCSTR);
#endif /* NO_TRANSITION_TYPES */

View File

@ -1,6 +1,9 @@
#ifndef __WINE_WINNLS_H
#define __WINE_WINNLS_H
/* When adding new defines, don't forget to add an entry to the
* locale2id map in misc/ole2nls.c
*/
#define LOCALE_ILANGUAGE 0x00000001
#define LOCALE_SLANGUAGE 0x00000002
#define LOCALE_SENGLANGUAGE 0x00001001

View File

@ -50,9 +50,9 @@ extern void WINPROC_UnmapMsg16To32A( UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern void WINPROC_UnmapMsg16To32W( UINT32 msg, WPARAM32 wParam,
LPARAM lParam );
extern void WINPROC_UnmapMsg32ATo16( UINT16 msg, WPARAM16 wParam,
extern void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam );
extern void WINPROC_UnmapMsg32WTo16( UINT16 msg, WPARAM16 wParam,
extern void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam,
LPARAM lParam );
#endif /* __WINE_WINPROC_H */

View File

@ -16,26 +16,112 @@
#include <sys/socket.h>
#include "windows.h"
/*
* The new type to be used in all
* instances which refer to sockets.
*/
typedef u_int SOCKET;
extern int __WSAFDIsSet(SOCKET, fd_set *);
/*
* Internet address (old style... should be updated)
*/
#ifdef WS_USE_OLD_STYLE
#define s_addr S_un.S_addr /* can be used for most tcp & ip code */
#define s_host S_un.S_un_b.s_b2 /* host on imp */
#define s_net S_un.S_un_b.s_b1 /* network */
#define s_imp S_un.S_un_w.s_w2 /* imp */
#define s_impno S_un.S_un_b.s_b4 /* imp # */
#define s_lh S_un.S_un_b.s_b3 /* logical host */
#ifndef WINELIB
#pragma pack(1) /* tight alignment for the emulator */
#endif
/* Win16 socket-related types */
typedef UINT16 SOCKET16;
typedef struct ws_hostent
{
SEGPTR h_name; /* official name of host */
SEGPTR h_aliases; /* alias list */
INT16 h_addrtype; /* host address type */
INT16 h_length; /* length of address */
SEGPTR h_addr_list; /* list of addresses from name server */
} _ws_hostent;
typedef struct ws_protoent
{
SEGPTR p_name; /* official protocol name */
SEGPTR p_aliases; /* alias list */
INT16 p_proto; /* protocol # */
} _ws_protoent;
typedef struct ws_servent
{
SEGPTR s_name; /* official service name */
SEGPTR s_aliases; /* alias list */
INT16 s_port; /* port # */
SEGPTR s_proto; /* protocol to use */
} _ws_servent;
typedef struct ws_netent
{
SEGPTR n_name; /* official name of net */
SEGPTR n_aliases; /* alias list */
INT16 n_addrtype; /* net address type */
INT32 n_net; /* network # */
} _ws_netent;
typedef struct sockaddr ws_sockaddr;
typedef struct
{
UINT16 fd_count; /* how many are SET? */
SOCKET16 fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} ws_fd_set;
/* ws_fd_set operations */
INT16 __WSAFDIsSet( SOCKET16, ws_fd_set * );
#define WS_FD_CLR(fd, set) do { \
UINT16 __i; \
for (__i = 0; __i < ((ws_fd_set*)(set))->fd_count ; __i++) \
{ \
if (((ws_fd_set*)(set))->fd_array[__i] == fd) \
{ \
while (__i < ((ws_fd_set*)(set))->fd_count-1) \
{ \
((ws_fd_set*)(set))->fd_array[__i] = \
((ws_fd_set*)(set))->fd_array[__i+1]; \
__i++; \
} \
((ws_fd_set*)(set))->fd_count--; \
break; \
} \
} \
} while(0)
#define WS_FD_SET(fd, set) do { \
if (((ws_fd_set*)(set))->fd_count < FD_SETSIZE) \
((ws_fd_set*)(set))->fd_array[((ws_fd_set*)(set))->fd_count++]=(fd);\
} while(0)
#define WS_FD_ZERO(set) (((ws_fd_set*)(set))->fd_count=0)
#define WS_FD_ISSET(fd, set) __WSAFDIsSet((SOCKET16)(fd), (ws_fd_set*)(set))
/*
* Internet address (old style... should be updated)
*/
typedef struct ws_addr_in
{
union {
struct { BYTE s_b1,s_b2,s_b3,s_b4; } S_un_b;
struct { UINT16 s_w1,s_w2; } S_un_w;
UINT32 S_addr;
} S_un;
#define ws_addr S_un.S_addr /* can be used for most tcp & ip code */
#define ws_host S_un.S_un_b.s_b2 /* host on imp */
#define ws_net S_un.S_un_b.s_b1 /* network */
#define ws_imp S_un.S_un_w.s_w2 /* imp */
#define ws_impno S_un.S_un_b.s_b4 /* imp # */
#define ws_lh S_un.S_un_b.s_b3 /* logical host */
} _ws_in_addr;
typedef struct ws_sockaddr_in
{
INT16 sin_family;
UINT16 sin_port;
_ws_in_addr sin_addr;
char sin_zero[8];
} _ws_sockaddr_in;
#define WSADESCRIPTION_LEN 256
#define WSASYS_STATUS_LEN 128
@ -44,24 +130,79 @@ typedef struct WSAData {
WORD wHighVersion;
char szDescription[WSADESCRIPTION_LEN+1];
char szSystemStatus[WSASYS_STATUS_LEN+1];
unsigned short iMaxSockets;
unsigned short iMaxUdpDg;
char *lpVendorInfo;
UINT16 iMaxSockets;
UINT16 iMaxUdpDg;
SEGPTR lpVendorInfo;
} WSADATA, *LPWSADATA;
#ifndef WINELIB
#pragma pack(4)
#endif
/* ----------------------------------- no Win16 structure defs beyond this line! */
/*
* This is used instead of -1, since the
* SOCKET type is unsigned.
*/
#define INVALID_SOCKET (SOCKET)(~0)
#define SOCKET_ERROR (-1)
#define INVALID_SOCKET (SOCKET16)(~0)
#define SOCKET_ERROR (-1)
/*
* Types
*/
#define WS_SOCK_STREAM 1 /* stream socket */
#define WS_SOCK_DGRAM 2 /* datagram socket */
#define WS_SOCK_RAW 3 /* raw-protocol interface */
#define WS_SOCK_RDM 4 /* reliably-delivered message */
#define WS_SOCK_SEQPACKET 5 /* sequenced packet stream */
#define WS_SOL_SOCKET (-1)
#define WS_IPPROTO_TCP 6
/*
* Option flags per-socket.
*/
#ifndef SO_DONTLINGER
#define SO_DONTLINGER (u_int)(~SO_LINGER)
#endif
#define WS_SO_DEBUG 0x0001 /* turn on debugging info recording */
#define WS_SO_ACCEPTCONN 0x0002 /* socket has had listen() */
#define WS_SO_REUSEADDR 0x0004 /* allow local address reuse */
#define WS_SO_KEEPALIVE 0x0008 /* keep connections alive */
#define WS_SO_DONTROUTE 0x0010 /* just use interface addresses */
#define WS_SO_BROADCAST 0x0020 /* permit sending of broadcast msgs */
#define WS_SO_USELOOPBACK 0x0040 /* bypass hardware when possible */
#define WS_SO_LINGER 0x0080 /* linger on close if data present */
#define WS_SO_OOBINLINE 0x0100 /* leave received OOB data in line */
#define WS_SO_DONTLINGER (UINT16)(~WS_SO_LINGER)
/*
* Additional options.
*/
#define WS_SO_SNDBUF 0x1001 /* send buffer size */
#define WS_SO_RCVBUF 0x1002 /* receive buffer size */
#define WS_SO_SNDLOWAT 0x1003 /* send low-water mark */
#define WS_SO_RCVLOWAT 0x1004 /* receive low-water mark */
#define WS_SO_SNDTIMEO 0x1005 /* send timeout */
#define WS_SO_RCVTIMEO 0x1006 /* receive timeout */
#define WS_SO_ERROR 0x1007 /* get error status and clear */
#define WS_SO_TYPE 0x1008 /* get socket type */
#define WS_IOCPARM_MASK 0x7f /* parameters must be < 128 bytes */
#define WS_IOC_VOID 0x20000000 /* no parameters */
#define WS_IOC_OUT 0x40000000 /* copy out parameters */
#define WS_IOC_IN 0x80000000 /* copy in parameters */
#define WS_IOC_INOUT (WS_IOC_IN|WS_IOC_OUT)
#define WS_IOR(x,y,t) (WS_IOC_OUT|(((UINT32)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
#define WS_IOW(x,y,t) (WS_IOC_IN|(((UINT32)sizeof(t)&WS_IOCPARM_MASK)<<16)|((x)<<8)|(y))
/*
* Socket I/O flags (supported by spec 1.1)
*/
#define WS_FIONREAD WS_IOR('f', 127, u_long)
#define WS_FIONBIO WS_IOW('f', 126, u_long)
#define WS_SIOCATMARK WS_IOR('s', 7, u_long)
/*
* Maximum queue length specifiable by listen.
@ -84,12 +225,17 @@ typedef struct WSAData {
/*
* Define flags to be used with the WSAAsyncSelect() call.
*/
#define FD_READ 0x01
#define FD_WRITE 0x02
#define FD_OOB 0x04
#define FD_ACCEPT 0x08
#define FD_CONNECT 0x10
#define FD_CLOSE 0x20
#define WS_FD_READ 0x01
#define WS_FD_WRITE 0x02
#define WS_FD_OOB 0x04
#define WS_FD_ACCEPT 0x08
#define WS_FD_CONNECT 0x10
#define WS_FD_CLOSE 0x20
#define WS_FD_NONBLOCK 0x10000000 /* internal per-socket flags */
#define WS_FD_INACTIVE 0x20000000
#define WS_FD_CONNECTED 0x40000000
#define WS_FD_INTERNAL 0xFFFF0000
/*
* All Windows Sockets error constants are biased by WSABASEERR from
@ -190,29 +336,35 @@ extern "C" {
/* Microsoft Windows Extension function prototypes */
INT WSAStartup(WORD wVersionRequired, LPWSADATA lpWSAData);
INT WSACleanup(void);
void WSASetLastError(INT iError);
INT WSAGetLastError(void);
BOOL WSAIsBlocking(void);
INT WSAUnhookBlockingHook(void);
INT16 WSAStartup(UINT16 wVersionRequired, LPWSADATA lpWSAData);
INT16 WSACleanup(void);
void WSASetLastError(INT16 iError);
INT16 WSAGetLastError(void);
BOOL16 WSAIsBlocking(void);
INT16 WSAUnhookBlockingHook(void);
FARPROC16 WSASetBlockingHook(FARPROC16 lpBlockFunc);
INT WSACancelBlockingCall(void);
HANDLE16 WSAAsyncGetServByName(HWND hWnd, u_int wMsg,
LPCSTR name, LPCSTR proto,
LPSTR buf, INT buflen);
HANDLE16 WSAAsyncGetServByPort(HWND hWnd, u_int wMsg, INT port,
LPCSTR proto, LPSTR buf, INT buflen);
HANDLE16 WSAAsyncGetProtoByName(HWND hWnd, u_int wMsg,
LPCSTR name, LPSTR buf, INT buflen);
HANDLE16 WSAAsyncGetProtoByNumber(HWND hWnd, u_int wMsg,
INT number, LPSTR buf, INT buflen);
HANDLE16 WSAAsyncGetHostByName(HWND hWnd, u_int wMsg,
LPCSTR name, LPSTR buf, INT buflen);
HANDLE16 WSAAsyncGetHostByAddr(HWND hWnd, u_int wMsg, LPCSTR addr, INT len,
INT type, LPSTR buf, INT buflen);
INT WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
INT WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent);
INT16 WSACancelBlockingCall(void);
HANDLE16 WSAAsyncGetServByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, LPCSTR proto,
SEGPTR buf, INT16 buflen);
HANDLE16 WSAAsyncGetServByPort(HWND16 hWnd, UINT16 wMsg, INT16 port,
LPCSTR proto, SEGPTR buf, INT16 buflen);
HANDLE16 WSAAsyncGetProtoByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE16 WSAAsyncGetProtoByNumber(HWND16 hWnd, UINT16 wMsg,
INT16 number, SEGPTR buf, INT16 buflen);
HANDLE16 WSAAsyncGetHostByName(HWND16 hWnd, UINT16 wMsg,
LPCSTR name, SEGPTR buf, INT16 buflen);
HANDLE16 WSAAsyncGetHostByAddr(HWND16 hWnd, UINT16 wMsg, LPCSTR addr, INT16 len,
INT16 type, SEGPTR buf, INT16 buflen);
INT16 WSACancelAsyncRequest(HANDLE16 hAsyncTaskHandle);
INT16 WSAAsyncSelect(SOCKET16 s, HWND16 hWnd, UINT16 wMsg, UINT32 lEvent);
#ifdef __cplusplus
}
@ -267,4 +419,121 @@ typedef struct timeval TIMEVAL, *PTIMEVAL, *LPTIMEVAL;
*/
#define WSAGETSELECTERROR(lParam) HIWORD(lParam)
/* ----------------------------------- internal structures */
#define WS_DUP_NATIVE 0x0
#define WS_DUP_OFFSET 0x2
#define WS_DUP_SEGPTR 0x4
#define AOP_IO 0x0000001 /* aop_control paramaters */
#define AOP_CONTROL_REMOVE 0x0000000 /* aop_control return values */
#define AOP_CONTROL_KEEP 0x0000001
typedef struct __aop
{
/* AOp header */
struct __aop *next, *prev;
int fd[2]; /* pipe */
int (*aop_control)(struct __aop*, int); /* SIGIO handler */
pid_t pid; /* child process pid */
/* custom data */
HWND16 hWnd;
UINT16 uMsg;
unsigned flags;
SEGPTR buffer_base;
int buflen;
char* init; /* parameter data - length is in the async_ctl */
} ws_async_op;
#define WSMSG_ASYNC_SELECT 0x0000001
#define WSMSG_ASYNC_HOSTBYNAME 0x0000010
#define WSMSG_ASYNC_HOSTBYADDR 0x0000020
#define WSMSG_ASYNC_PROTOBYNAME 0x0000100
#define WSMSG_ASYNC_PROTOBYNUM 0x0000200
#define WSMSG_ASYNC_SERVBYNAME 0x0001000
#define WSMSG_ASYNC_SERVBYPORT 0x0002000
#define MTYPE_PARENT 0x50505357
#define MTYPE_CLIENT 0x50435357
#pragma pack(1)
typedef struct
{
long mtype; /* WSMSG_... */
UINT32 lParam;
UINT16 wParam; /* socket handle */
} ipc_packet;
#define MTYPE_PARENT_SIZE \
(sizeof(UINT32))
#define MTYPE_CLIENT_SIZE \
(sizeof(ipc_packet) - sizeof(long))
#pragma pack(4)
typedef struct
{
int fd;
unsigned flags;
ws_async_op* p_aop;
} ws_socket;
typedef struct
{
ws_async_op* ws_aop; /* init'ed for getXbyY */
ws_socket* ws_sock; /* init'ed for AsyncSelect */
int lEvent;
int lLength;
char* buffer;
ipc_packet ip;
} ws_async_ctl;
#define WS_MAX_SOCKETS_PER_THREAD 16
#define WS_MAX_UDP_DATAGRAM 1024
#define WSI_BLOCKINGCALL 0x00000001 /* per-thread info flags */
typedef struct __WSINFO
{
struct __WSINFO* prev,*next;
unsigned flags;
int errno;
int num_startup;
int num_async_rq;
int last_free;
ws_socket sock[WS_MAX_SOCKETS_PER_THREAD];
int buflen;
char* buffer;
FARPROC16 blocking_hook;
HTASK16 tid; /* owning thread id - better switch
* to TLS when it gets fixed */
} WSINFO, *LPWSINFO;
int WS_dup_he(LPWSINFO pwsi, struct hostent* p_he, int flag);
int WS_dup_pe(LPWSINFO pwsi, struct protoent* p_pe, int flag);
int WS_dup_se(LPWSINFO pwsi, struct servent* p_se, int flag);
void WS_do_async_gethost(LPWSINFO, unsigned);
void WS_do_async_getproto(LPWSINFO, unsigned);
void WS_do_async_getserv(LPWSINFO, unsigned);
int WINSOCK_async_io(int fd, int async);
int WINSOCK_unblock_io(int fd, int noblock);
int WINSOCK_check_async_op(ws_async_op* p_aop);
void WINSOCK_link_async_op(ws_async_op* p_aop);
void WINSOCK_unlink_async_op(ws_async_op* p_aop);
void WINSOCK_cancel_async_op(HTASK16 tid);
void WINSOCK_do_async_select(void);
UINT16 wsaErrno(void);
UINT16 wsaHerrno(void);
#endif /* _WINSOCKAPI_ */

View File

@ -13,6 +13,11 @@
#include "debug.h"
#include "xmalloc.h"
void SIGNAL_MaskAsyncEvents( BOOL32 mask )
{
/* FIXME: signals don't work in the library */
}
int CallTo32_LargeStack( int (*func)(), int nbargs, ...)
{
va_list arglist;
@ -49,7 +54,6 @@ extern LRESULT EditWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT FileOpenDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT FileSaveDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT FindTextDlgProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT ListBoxWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT MDIClientWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT PopupMenuWndProc(HWND,UINT,WPARAM16,LPARAM);
extern LRESULT PrintDlgProc(HWND,UINT,WPARAM16,LPARAM);
@ -77,7 +81,6 @@ FARPROC16 MODULE_GetWndProcEntry16( char *name )
MAP_STR_TO_PROC("FileOpenDlgProc",FileOpenDlgProc);
MAP_STR_TO_PROC("FileSaveDlgProc",FileSaveDlgProc);
MAP_STR_TO_PROC("FindTextDlgProc",FindTextDlgProc);
MAP_STR_TO_PROC("ListBoxWndProc",ListBoxWndProc);
MAP_STR_TO_PROC("MDIClientWndProc",MDIClientWndProc);
MAP_STR_TO_PROC("PopupMenuWndProc",PopupMenuWndProc);
MAP_STR_TO_PROC("PrintDlgProc",PrintDlgProc);

View File

@ -149,11 +149,11 @@ int MAIN_Init(void)
if (!KERN32_Init()) return 0;
/* Create system message queue */
queueSize = GetProfileInt( "windows", "TypeAhead", 120 );
queueSize = GetProfileInt32A( "windows", "TypeAhead", 120 );
if (!QUEUE_CreateSysMsgQueue( queueSize )) return 0;
/* Set double click time */
SetDoubleClickTime( GetProfileInt( "windows", "DoubleClickSpeed", 452 ) );
SetDoubleClickTime( GetProfileInt32A("windows","DoubleClickSpeed",452) );
return 1;
}

View File

@ -1290,6 +1290,7 @@ INT16 GetModuleFileName( HINSTANCE16 hModule, LPSTR lpFileName, INT16 nSize )
{
NE_MODULE *pModule;
if (!hModule) hModule = GetCurrentTask();
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
lstrcpyn32A( lpFileName, NE_MODULE_NAME(pModule), nSize );
@ -1407,7 +1408,8 @@ HINSTANCE16 WinExec( LPSTR lpCmdLine, WORD nCmdShow )
{
/* Check that the original file name did not have a suffix */
p = strrchr(filename, '.');
if (!p || (strchr(p, '/') && strchr(p, '\\')))
/* if there is a '.', check if either \ OR / follow */
if (!p || strchr(p, '/') || strchr(p, '\\'))
{
p = filename + strlen(filename);
strcpy( p, ".exe" );

View File

@ -124,14 +124,14 @@ static void SIGNAL_fault(int signal, int code, SIGCONTEXT *context)
/**********************************************************************
* SIGNAL_SetHandler
*/
static void SIGNAL_SetHandler( int sig, void (*func)() )
static void SIGNAL_SetHandler( int sig, void (*func)(), int flags )
{
int ret;
struct sigaction sig_act;
#ifdef linux
sig_act.sa_handler = func;
sig_act.sa_flags = SA_RESTART | SA_NOMASK;
sig_act.sa_flags = SA_RESTART | (flags) ? SA_NOMASK : 0;
/* Point to the top of the stack, minus 4 just in case, and make
it aligned */
sig_act.sa_restorer =
@ -165,6 +165,7 @@ static void SIGNAL_SetHandler( int sig, void (*func)() )
}
extern void stop_wait(int a);
extern void WINSOCK_sigio(int a);
/**********************************************************************
@ -204,18 +205,19 @@ BOOL32 SIGNAL_Init(void)
}
#endif /* __svr4__ || _SCO_DS */
SIGNAL_SetHandler( SIGALRM, (void (*)())wine_timer );
SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault );
SIGNAL_SetHandler( SIGILL, (void (*)())SIGNAL_fault );
SIGNAL_SetHandler( SIGFPE, (void (*)())SIGNAL_fault );
SIGNAL_SetHandler( SIGTRAP, (void (*)())SIGNAL_trap ); /* debugger */
SIGNAL_SetHandler( SIGHUP, (void (*)())SIGNAL_trap ); /* forced break */
SIGNAL_SetHandler( SIGALRM, (void (*)())wine_timer, 1);
SIGNAL_SetHandler( SIGSEGV, (void (*)())SIGNAL_fault, 1);
SIGNAL_SetHandler( SIGILL, (void (*)())SIGNAL_fault, 1);
SIGNAL_SetHandler( SIGFPE, (void (*)())SIGNAL_fault, 1);
SIGNAL_SetHandler( SIGTRAP, (void (*)())SIGNAL_trap, 1); /* debugger */
SIGNAL_SetHandler( SIGHUP, (void (*)())SIGNAL_trap, 1); /* forced break */
#ifdef SIGBUS
SIGNAL_SetHandler( SIGBUS, (void (*)())SIGNAL_fault );
SIGNAL_SetHandler( SIGBUS, (void (*)())SIGNAL_fault, 1);
#endif
#ifdef CONFIG_IPC
SIGNAL_SetHandler( SIGUSR2, (void (*)())stop_wait ); /* For IPC */
SIGNAL_SetHandler( SIGUSR2, (void (*)())stop_wait, 1); /* For IPC */
#endif
SIGNAL_SetHandler( SIGIO, (void (*)())WINSOCK_sigio, 0);
return TRUE;
}
@ -239,4 +241,19 @@ void SIGNAL_StartBIOSTimer(void)
setitimer(ITIMER_REAL, &vt_timer, NULL);
}
/**********************************************************************
* SIGNAL_MaskAsyncEvents
*/
void SIGNAL_MaskAsyncEvents( BOOL32 flag )
{
sigset_t set;
sigemptyset(&set);
sigaddset(&set, SIGIO);
sigaddset(&set, SIGUSR1);
#ifdef CONFIG_IPC
sigaddset(&set, SIGUSR2);
#endif
sigprocmask( (flag) ? SIG_BLOCK : SIG_UNBLOCK , &set, NULL);
}
#endif /* ifndef WINELIB */

View File

@ -67,6 +67,7 @@ static FARPROC16 TASK_RescheduleProc;
#endif
static HGLOBAL16 TASK_CreateDOSEnvironment(void);
static void TASK_YieldToSystem(TDB*);
/***********************************************************************
* TASK_Init
@ -514,7 +515,7 @@ HTASK16 TASK_CreateTask( HMODULE16 hModule, HINSTANCE16 hInstance,
/* Get the compatibility flags */
pTask->compat_flags = GetProfileInt( "Compatibility", name, 0 );
pTask->compat_flags = GetProfileInt32A( "Compatibility", name, 0 );
/* Allocate a code segment alias for the TDB */
@ -685,11 +686,22 @@ void TASK_KillCurrentTask( INT16 exitCode )
/* Remove the task from the list to be sure we never switch back to it */
TASK_UnlinkTask( hCurrentTask );
if( nTaskCount )
{
TDB* p = (TDB *)GlobalLock16( hFirstTask );
while( p )
{
if( p->hYieldTo == hCurrentTask ) p->hYieldTo = 0;
p = (TDB *)GlobalLock16( p->hNext );
}
}
hTaskToKill = hCurrentTask;
hLockedTask = 0;
Yield();
pTask->nEvents = 0;
TASK_YieldToSystem(pTask);
/* We should never return from this Yield() */
fprintf(stderr,"Return of the living dead %04x!!!\n", hCurrentTask);
@ -753,8 +765,9 @@ void TASK_Reschedule(void)
/* check for DirectedYield() */
hTask = pOldTask->hYieldTo;
if (!(pNewTask = (TDB *)GlobalLock16( hTask )) || !pNewTask->nEvents)
hTask = 0;
pNewTask = (TDB *)GlobalLock16( hTask );
if( !pNewTask || !pNewTask->nEvents) hTask = 0;
pOldTask->hYieldTo = 0;
}
/* extract hardware events only! */

View File

@ -38,7 +38,8 @@ C_SRCS = \
user.c \
ver.c \
w32sys.c \
winsocket.c \
winsock.c \
winsock_async.c \
wsprintf.c \
xmalloc.c

View File

@ -166,22 +166,14 @@ static void FILEDLG_StripEditControl(HWND hwnd)
*/
static BOOL FILEDLG_ScanDir(HWND hWnd, LPSTR newPath)
{
BOOL32 ret = FALSE;
int len;
char *str = SEGPTR_ALLOC(512);
if (!str) return TRUE;
char str[512];
lstrcpyn32A( str, newPath, 512 );
len = strlen(str);
GetDlgItemText32A( hWnd, edt1, str + len, 512 - len );
if (DlgDirList(hWnd, SEGPTR_GET(str), lst1, 0, 0x0000))
{
strcpy( str, "*.*" );
DlgDirList(hWnd, SEGPTR_GET(str), lst2, stc1, 0x8010 );
ret = TRUE;
}
SEGPTR_FREE(str);
return ret;
GetDlgItemText32A( hWnd, edt1, str + len, sizeof(str) - len );
if (!DlgDirList32A( hWnd, str, lst1, 0, 0x0000 )) return FALSE;
return DlgDirList32A( hWnd, "*.*", lst2, stc1, 0x8010 );
}
/***********************************************************************
@ -388,10 +380,7 @@ static LONG FILEDLG_WMInitDialog(HWND hWnd, WPARAM16 wParam, LPARAM lParam)
lpofn->nFilterIndex, tmpstr);
SetDlgItemText32A( hWnd, edt1, tmpstr );
/* get drive list */
pstr = SEGPTR_ALLOC(1);
*pstr = 0;
DlgDirListComboBox16(hWnd, SEGPTR_GET(pstr), cmb2, 0, 0xC000);
SEGPTR_FREE(pstr);
DlgDirListComboBox32A(hWnd, "", cmb2, 0, 0xC000);
/* read initial directory */
if (PTR_SEG_TO_LIN(lpofn->lpstrInitialDir) != NULL)
{

View File

@ -615,6 +615,22 @@ VOID* CRTDLL_malloc(DWORD size)
return HeapAlloc(GetProcessHeap(),0,size);
}
/*********************************************************************
* calloc (CRTDLL.350)
*/
VOID* CRTDLL_calloc(DWORD size, DWORD count)
{
return HeapAlloc( GetProcessHeap(), HEAP_ZERO_MEMORY, size * count );
}
/*********************************************************************
* realloc (CRTDLL.447)
*/
VOID* CRTDLL_realloc( VOID *ptr, DWORD size )
{
return HeapReAlloc( GetProcessHeap(), 0, ptr, size );
}
/*********************************************************************
* free (CRTDLL.427)
*/

View File

@ -21,7 +21,7 @@ void LoadStartupDrivers(void)
char str[256];
LPSTR ptr;
if (GetPrivateProfileString( "drivers", NULL, "", str, sizeof(str),
if (GetPrivateProfileString32A( "drivers", NULL, "", str, sizeof(str),
"SYSTEM.INI" ) < 2)
{
fprintf( stderr,
@ -84,7 +84,7 @@ HDRVR16 OpenDriver(LPSTR lpDriverName, LPSTR lpSectionName, LPARAM lParam)
lpDriverName, lpSectionName, lParam );
if (lpSectionName == NULL) lpSectionName = "drivers";
GetPrivateProfileString( lpSectionName, lpDriverName, "", DrvName,
GetPrivateProfileString32A( lpSectionName, lpDriverName, "", DrvName,
sizeof(DrvName), "SYSTEM.INI" );
dprintf_driver( stddeb,"OpenDriver // DrvName='%s'\n", DrvName );
if (lstrlen32A(DrvName) < 1) return 0;

View File

@ -8,6 +8,7 @@ static char Copyright[] = "Copyright Scott A. Laird, Erik Bos 1993, 1994";
#include <string.h>
#include <ctype.h>
#include "windows.h"
#include "keyboard.h"
#include "stddebug.h"
/* #define DEBUG_KEYBOARD */
#include "debug.h"
@ -22,105 +23,110 @@ struct KeyTableEntry {
static const struct KeyTableEntry KeyTable[] =
{
{ 0x3, 0x3, 0x0, "" },
{ 0x8, 0x8, 0xe, "Backspace" },
{ 0x9, 0x9, 0xf, "Tab" },
{ 0xc, 0x0, 0x4c, "Num 5" },
{ 0xd, 0xd, 0x1c, "Enter" },
{ 0x10, 0x0, 0x2a, "Shift" },
{ 0x11, 0x0, 0x1d, "Ctrl" },
{ 0x12, 0x0, 0x38, "Alt" },
{ 0x14, 0x0, 0x3a, "Caps Lock" },
{ 0x1b, 0x1b, 0x1, "Esc" },
{ 0x20, 0x20, 0x39, "Space" },
{ 0x21, 0x0, 0x49, "Num 9" },
{ 0x22, 0x0, 0x51, "Num 3" },
{ 0x23, 0x0, 0x4f, "Num 1" },
{ 0x24, 0x0, 0x47, "Num 7" },
{ 0x25, 0x0, 0x4b, "Num 4" },
{ 0x26, 0x0, 0x48, "Num 8" },
{ 0x27, 0x0, 0x4d, "Num 6" },
{ 0x28, 0x0, 0x50, "Num 2" },
{ 0x2d, 0x0, 0x52, "Num 0" },
{ 0x2e, 0x0, 0x53, "Num Del" },
{ 0x30, 0x30, 0xb, "0" },
{ 0x31, 0x31, 0x2, "1" },
{ 0x32, 0x32, 0x3, "2" },
{ 0x33, 0x33, 0x4, "3" },
{ 0x34, 0x34, 0x5, "4" },
{ 0x35, 0x35, 0x6, "5" },
{ 0x36, 0x36, 0x7, "6" },
{ 0x37, 0x37, 0x8, "7" },
{ 0x38, 0x38, 0x9, "8" },
{ 0x39, 0x39, 0xa, "9" },
{ 0x41, 0x41, 0x1e, "A" },
{ 0x42, 0x42, 0x30, "B" },
{ 0x43, 0x43, 0x2e, "C" },
{ 0x44, 0x44, 0x20, "D" },
{ 0x45, 0x45, 0x12, "E" },
{ 0x46, 0x46, 0x21, "F" },
{ 0x47, 0x47, 0x22, "G" },
{ 0x48, 0x48, 0x23, "H" },
{ 0x49, 0x49, 0x17, "I" },
{ 0x4a, 0x4a, 0x24, "J" },
{ 0x4b, 0x4b, 0x25, "K" },
{ 0x4c, 0x4c, 0x26, "L" },
{ 0x4d, 0x4d, 0x32, "M" },
{ 0x4e, 0x4e, 0x31, "N" },
{ 0x4f, 0x4f, 0x18, "O" },
{ 0x50, 0x50, 0x19, "P" },
{ 0x51, 0x51, 0x10, "Q" },
{ 0x52, 0x52, 0x13, "R" },
{ 0x53, 0x53, 0x1f, "S" },
{ 0x54, 0x54, 0x14, "T" },
{ 0x55, 0x55, 0x16, "U" },
{ 0x56, 0x56, 0x2f, "V" },
{ 0x57, 0x57, 0x11, "W" },
{ 0x58, 0x58, 0x2d, "X" },
{ 0x59, 0x59, 0x15, "Y" },
{ 0x5a, 0x5a, 0x2c, "Z" },
{ 0x60, 0x0, 0x52, "Num 0" },
{ 0x61, 0x0, 0x4f, "Num 1" },
{ 0x62, 0x0, 0x50, "Num 2" },
{ 0x63, 0x0, 0x51, "Num 3" },
{ 0x64, 0x0, 0x4b, "Num 4" },
{ 0x65, 0x0, 0x4c, "Num 5" },
{ 0x66, 0x0, 0x4d, "Num 6" },
{ 0x67, 0x0, 0x47, "Num 7" },
{ 0x68, 0x0, 0x48, "Num 8" },
{ 0x69, 0x0, 0x49, "Num 9" },
{ 0x6a, 0x2a, 0x37, "Num *" },
{ 0x6b, 0x2b, 0x4e, "Num +" },
{ 0x6c, 0x0, 0x0, "" },
{ 0x6d, 0x2d, 0x4a, "Num -" },
{ 0x6e, 0x2e, 0x53, "Num Del" },
{ 0x6f, 0x2f, 0x0, "" },
{ 0x70, 0x0, 0x3b, "F1" },
{ 0x71, 0x0, 0x3c, "F2" },
{ 0x72, 0x0, 0x3d, "F3" },
{ 0x73, 0x0, 0x3e, "F4" },
{ 0x74, 0x0, 0x3f, "F5" },
{ 0x75, 0x0, 0x40, "F6" },
{ 0x76, 0x0, 0x41, "F7" },
{ 0x77, 0x0, 0x42, "F8" },
{ 0x78, 0x0, 0x43, "F9" },
{ 0x79, 0x0, 0x44, "F10" },
{ 0x7a, 0x0, 0x57, "F11" },
{ 0x7b, 0x0, 0x58, "F12" },
{ 0x90, 0x0, 0x45, "Pause" },
{ 0x91, 0x0, 0x46, "Scroll Lock" },
{ 0xba, 0x3b, 0x27, ";" },
{ 0xbb, 0x3d, 0xd, "=" },
{ 0xbc, 0x2c, 0x33, "," },
{ 0xbd, 0x2d, 0xc, "-" },
{ 0xbe, 0x2e, 0x34, "." },
{ 0xbf, 0x2f, 0x35, "/" },
{ 0xc0, 0x60, 0x29, "`" },
{ 0xdb, 0x5b, 0x1a, "[" },
{ 0xdc, 0x5c, 0x2b, "\\" },
{ 0xdd, 0x5d, 0x1b, "]" },
{ 0xde, 0x27, 0x28, "\'" },
{ 0xe2, 0x5c, 0x56, "\\" },
{ VK_CANCEL, 0x3, 0, "" },
{ VK_BACK, 0x8, 0xe, "Backspace" },
{ VK_TAB, 0x9, 0xf, "Tab" },
{ VK_CLEAR, 0, 0x4c, "Clear" },
{ VK_RETURN, 0xd, 0x1c, "Enter" },
{ VK_SHIFT, 0, 0x2a, "Shift" },
{ VK_CONTROL, 0, 0x1d, "Ctrl" },
{ VK_MENU, 0, 0x38, "Alt" },
{ VK_CAPITAL, 0, 0x3a, "Caps Lock" },
{ VK_ESCAPE, 0x1b, 0x1, "Esc" },
{ VK_SPACE, 0x20, 0x39, "Space" },
{ VK_PRIOR, 0, 0x49, "Page Up" },
{ VK_NEXT, 0, 0x51, "Page Down" },
{ VK_END, 0, 0x4f, "End" },
{ VK_HOME, 0, 0x47, "Home" },
{ VK_LEFT, 0, 0x4b, "Left Arrow" },
{ VK_UP, 0, 0x48, "Up Arrow" },
{ VK_RIGHT, 0, 0x4d, "Right Arrow" },
{ VK_DOWN, 0, 0x50, "Down Arrow" },
{ VK_INSERT, 0, 0x52, "Ins" },
{ VK_DELETE, 0, 0x53, "Del" },
{ VK_0, 0x30, 0xb, "0" },
{ VK_1, 0x31, 0x2, "1" },
{ VK_2, 0x32, 0x3, "2" },
{ VK_3, 0x33, 0x4, "3" },
{ VK_4, 0x34, 0x5, "4" },
{ VK_5, 0x35, 0x6, "5" },
{ VK_6, 0x36, 0x7, "6" },
{ VK_7, 0x37, 0x8, "7" },
{ VK_8, 0x38, 0x9, "8" },
{ VK_9, 0x39, 0xa, "9" },
{ VK_A, 0x41, 0x1e, "A" },
{ VK_B, 0x42, 0x30, "B" },
{ VK_C, 0x43, 0x2e, "C" },
{ VK_D, 0x44, 0x20, "D" },
{ VK_E, 0x45, 0x12, "E" },
{ VK_F, 0x46, 0x21, "F" },
{ VK_G, 0x47, 0x22, "G" },
{ VK_H, 0x48, 0x23, "H" },
{ VK_I, 0x49, 0x17, "I" },
{ VK_J, 0x4a, 0x24, "J" },
{ VK_K, 0x4b, 0x25, "K" },
{ VK_L, 0x4c, 0x26, "L" },
{ VK_M, 0x4d, 0x32, "M" },
{ VK_N, 0x4e, 0x31, "N" },
{ VK_O, 0x4f, 0x18, "O" },
{ VK_P, 0x50, 0x19, "P" },
{ VK_Q, 0x51, 0x10, "Q" },
{ VK_R, 0x52, 0x13, "R" },
{ VK_S, 0x53, 0x1f, "S" },
{ VK_T, 0x54, 0x14, "T" },
{ VK_U, 0x55, 0x16, "U" },
{ VK_V, 0x56, 0x2f, "V" },
{ VK_W, 0x57, 0x11, "W" },
{ VK_X, 0x58, 0x2d, "X" },
{ VK_Y, 0x59, 0x15, "Y" },
{ VK_Z, 0x5a, 0x2c, "Z" },
{ VK_NUMPAD0, 0, 0x52, "Num 0" },
{ VK_NUMPAD1, 0, 0x4f, "Num 1" },
{ VK_NUMPAD2, 0, 0x50, "Num 2" },
{ VK_NUMPAD3, 0, 0x51, "Num 3" },
{ VK_NUMPAD4, 0, 0x4b, "Num 4" },
{ VK_NUMPAD5, 0, 0x4c, "Num 5" },
{ VK_NUMPAD6, 0, 0x4d, "Num 6" },
{ VK_NUMPAD7, 0, 0x47, "Num 7" },
{ VK_NUMPAD8, 0, 0x48, "Num 8" },
{ VK_NUMPAD9, 0, 0x49, "Num 9" },
{ VK_MULTIPLY, 0x2a, 0x37, "Num *" },
{ VK_ADD, 0x2b, 0x4e, "Num +" },
{ VK_SEPARATOR, 0, 0, "" },
{ VK_SUBTRACT, 0x2d, 0x4a, "Num -" },
{ VK_DECIMAL, 0x2e, 0x53, "Num Del" },
{ VK_DIVIDE, 0x2f, 0, "Num /" },
{ VK_F1, 0, 0x3b, "F1" },
{ VK_F2, 0, 0x3c, "F2" },
{ VK_F3, 0, 0x3d, "F3" },
{ VK_F4, 0, 0x3e, "F4" },
{ VK_F5, 0, 0x3f, "F5" },
{ VK_F6, 0, 0x40, "F6" },
{ VK_F7, 0, 0x41, "F7" },
{ VK_F8, 0, 0x42, "F8" },
{ VK_F9, 0, 0x43, "F9" },
{ VK_F10, 0, 0x44, "F10" },
{ VK_F11, 0, 0x57, "F11" },
{ VK_F12, 0, 0x58, "F12" },
{ VK_NUMLOCK, 0, 0x45, "Num Lock" },
{ VK_SCROLL, 0, 0x46, "Scroll Lock" },
/* Allowable ranges for OEM-specific virtual-key codes */
/* - 0xBA-0xC0 OEM specific */
{ 0xba, 0x3b, 0x27, ";" },
{ 0xbb, 0x3d, 0xd, "=" },
{ 0xbc, 0x2c, 0x33, "," },
{ 0xbd, 0x2d, 0xc, "-" },
{ 0xbe, 0x2e, 0x34, "." },
{ 0xbf, 0x2f, 0x35, "/" },
{ 0xc0, 0x60, 0x29, "`" },
/* - 0xDB-0xE4 OEM specific */
{ 0xdb, 0x5b, 0x1a, "[" },
{ 0xdc, 0x5c, 0x2b, "\\" },
{ 0xdd, 0x5d, 0x1b, "]" },
{ 0xde, 0x27, 0x28, "'" },
{ 0xe2, 0x5c, 0x56, "\\" },
/* - 0xE6 OEM specific */
/* - 0xE9-0xF5 OEM specific */
};
#define KeyTableSize sizeof(KeyTable) / sizeof(struct KeyTableEntry)
@ -128,34 +134,55 @@ static const struct KeyTableEntry KeyTable[] =
int ToAscii(WORD wVirtKey, WORD wScanCode, LPSTR lpKeyState,
LPVOID lpChar, WORD wFlags)
{
char shift = lpKeyState[VK_SHIFT] < 0;
int i;
dprintf_keyboard(stddeb,"ToAscii (%d,%d)\n",wVirtKey, wScanCode);
dprintf_keyboard(stddeb, "ToAscii (%x,%x) -> ", wVirtKey, wScanCode);
/* FIXME: codepage is broken */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wVirtKey)
{
dprintf_keyboard(stddeb,"\t\tchar = %s\n", KeyTable[i].name);
if( isprint(KeyTable[i].ASCII) || isspace(KeyTable[i].ASCII) )
{
*(BYTE*)lpChar = KeyTable[i].ASCII;
*(((BYTE*)lpChar) + 1) = 0;
if( isalpha( *(BYTE*)lpChar ) )
if( (lpKeyState[VK_CAPITAL]<0 && !lpKeyState[VK_SHIFT]) ||
(!lpKeyState[VK_CAPITAL] && lpKeyState[VK_SHIFT]<0) )
*(BYTE*)lpChar = toupper( *(BYTE*)lpChar );
else
*(BYTE*)lpChar = tolower( *(BYTE*)lpChar );
return 1;
}
}
*(BYTE*)lpChar = 0;
return 0;
switch (wVirtKey)
{
#define vkcase2(k1,k2,val) case val : *(BYTE*)lpChar = shift ? k2 : k1; break;
#define vkcase(k, val) vkcase2(val, k, val)
WINE_VKEY_MAPPINGS
#undef vkcase
#undef vkcase2
default :
for (i = 0 ; ; i++)
{
if (i == KeyTableSize)
{
dprintf_keyboard(stddeb, "0\n");
return 0;
}
if (KeyTable[i].virtualkey == wVirtKey)
{
if (!isprint(KeyTable[i].ASCII) && !isspace(KeyTable[i].ASCII))
{
dprintf_keyboard(stddeb, "0\n");
return 0;
}
dprintf_keyboard(stddeb,"\"%s\" ", KeyTable[i].name);
*(BYTE*)lpChar = KeyTable[i].ASCII;
*(((BYTE*)lpChar) + 1) = 0;
if (isalpha(*(BYTE*)lpChar))
if( (lpKeyState[VK_CAPITAL]<0 && !lpKeyState[VK_SHIFT]) ||
(!lpKeyState[VK_CAPITAL] && lpKeyState[VK_SHIFT]<0) )
*(BYTE*)lpChar = toupper( *(BYTE*)lpChar );
else
*(BYTE*)lpChar = tolower( *(BYTE*)lpChar );
break;
}
}
}
if (lpKeyState[VK_CONTROL] < 0)
*(BYTE*)lpChar = *(BYTE*)lpChar & 0x1f;
dprintf_keyboard(stddeb, "1 (%x)\n", *(BYTE*)lpChar);
return 1;
}
DWORD OemKeyScan(WORD wOemChar)
@ -166,7 +193,16 @@ DWORD OemKeyScan(WORD wOemChar)
}
/* VkKeyScan translates an ANSI character to a virtual-key and shift code
* for the current keyboard. */
* for the current keyboard.
* FIXME high-order byte should yield :
* 0 Unshifted
* 1 Shift
* 2 Ctrl
* 3-5 Shift-key combinations that are not used for characters
* 6 Ctrl-Alt
* 7 Ctrl-Alt-Shift
* I.e. : Shift = 1, Ctrl = 2, Alt = 4.
*/
WORD VkKeyScan(WORD cChar)
{
@ -208,26 +244,28 @@ WORD MapVirtualKey(WORD wCode, WORD wMapType)
int i;
switch(wMapType) {
case 0:
case 0: /* vkey-code to scan-code */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].scancode;
return 0;
case 1:
case 1: /* scan-code to vkey-code */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].scancode == wCode)
return KeyTable[i].virtualkey;
return 0;
case 2:
case 2: /* vkey-code to unshifted ANSI code */
/* FIXME : what does unshifted mean ? 'a' or 'A' ? */
for (i = 0 ; i != KeyTableSize ; i++)
if (KeyTable[i].virtualkey == wCode)
return KeyTable[i].ASCII;
return 0;
default:
fprintf(stderr, "MapVirtualKey: unknown wMapType!\n");
default: /* reserved */
fprintf(stderr, "MapVirtualKey: unknown wMapType %d !\n",
wMapType);
return 0;
}
return 0;

View File

@ -804,7 +804,8 @@ LONG GetWinFlags(void)
fprintf(stderr, "Unknown mode set? This shouldn't happen. Check GetWinFlags()!\n");
break;
}
if( getVersionEx.dwPlatformId == VER_PLATFORM_WIN32_NT )
result |= 0x4000; /* undocumented WF_WINNT */
return result;
}
@ -1076,18 +1077,21 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
break;
case SPI_GETFASTTASKSWITCH:
*(BOOL *) lpvParam = FALSE;
/* FIXME GetProfileInt( "windows", "CoolSwitch", 1 ) */
if ( GetProfileInt32A( "windows", "CoolSwitch", 1 ) == 1 )
*(BOOL *) lpvParam = TRUE;
else
*(BOOL *) lpvParam = FALSE;
break;
case SPI_GETGRIDGRANULARITY:
*(INT *) lpvParam = 1;
/* FIXME GetProfileInt( "desktop", "GridGranularity", 1 ) */
break;
*(INT *) lpvParam = GetProfileInt32A( "desktop",
"GridGranularity",
1 );
break;
case SPI_GETICONTITLEWRAP:
*(BOOL *) lpvParam = FALSE;
/* FIXME GetProfileInt( "desktop", "?", True ) */
/* FIXME GetProfileInt32A( "desktop", "?", True ) */
break;
case SPI_GETKEYBOARDDELAY:
@ -1105,9 +1109,11 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
break;
case SPI_GETSCREENSAVEACTIVE:
/* FIXME GetProfileInt( "windows", "ScreenSaveActive", 1 ); */
*(BOOL *) lpvParam = FALSE;
break;
if ( GetProfileInt32A( "windows", "ScreenSaveActive", 1 ) == 1 )
*(BOOL *) lpvParam = TRUE;
else
*(BOOL *) lpvParam = FALSE;
break;
case SPI_GETSCREENSAVETIMEOUT:
/* FIXME GetProfileInt( "windows", "ScreenSaveTimeout", 300 ); */
@ -1116,18 +1122,20 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
break;
case SPI_ICONHORIZONTALSPACING:
/* FIXME Get/SetProfileInt */
if (lpvParam == NULL)
fprintf(stderr, "SystemParametersInfo: Horizontal icon spacing set to %d\n.", uParam);
else
*(INT *) lpvParam = GetSystemMetrics( SM_CXICONSPACING );
/*SetSystemMetrics( SM_CXICONSPACING, uParam )*/ ;
else
*(INT *) lpvParam = GetSystemMetrics( SM_CXICONSPACING );
break;
case SPI_ICONVERTICALSPACING:
if (lpvParam == NULL)
fprintf(stderr, "SystemParametersInfo: Vertical icon spacing set to %d\n.", uParam);
else
*(INT *) lpvParam = GetSystemMetrics( SM_CYICONSPACING );
break;
/* FIXME Get/SetProfileInt */
if (lpvParam == NULL)
/*SetSystemMetrics( SM_CYICONSPACING, uParam )*/ ;
else
*(INT *) lpvParam = GetSystemMetrics(SM_CYICONSPACING);
break;
case SPI_SETBEEP:
if (uParam == TRUE)
@ -1147,7 +1155,7 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
case SPI_SETSCREENSAVETIMEOUT:
XSetScreenSaver(display, uParam, 60, DefaultBlanking,
DefaultExposures);
DefaultExposures);
break;
case SPI_SETDESKWALLPAPER:
@ -1156,7 +1164,7 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
case SPI_SETDESKPATTERN:
if ((INT) uParam == -1) {
GetProfileString("Desktop", "Pattern",
GetProfileString32A("Desktop", "Pattern",
"170 85 170 85 170 85 170 85",
buffer, sizeof(buffer) );
return (DESKTOP_SetPattern((LPSTR) buffer));
@ -1166,19 +1174,20 @@ BOOL SystemParametersInfo (UINT uAction, UINT uParam, LPVOID lpvParam, UINT fuWi
case SPI_GETICONTITLELOGFONT:
{
/* FIXME GetProfileString( "?", "?", "?" ) */
LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
lpLogFont->lfHeight = 10;
lpLogFont->lfWidth = 0;
lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
lpLogFont->lfWeight = FW_NORMAL;
lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
lpLogFont->lfCharSet = ANSI_CHARSET;
lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
break;
}
/* FIXME GetProfileString32A( "?", "?", "?" ) */
LPLOGFONT16 lpLogFont = (LPLOGFONT16)lpvParam;
lpLogFont->lfHeight = 10;
lpLogFont->lfWidth = 0;
lpLogFont->lfEscapement = lpLogFont->lfOrientation = 0;
lpLogFont->lfWeight = FW_NORMAL;
lpLogFont->lfItalic = lpLogFont->lfStrikeOut = lpLogFont->lfUnderline = FALSE;
lpLogFont->lfCharSet = ANSI_CHARSET;
lpLogFont->lfOutPrecision = OUT_DEFAULT_PRECIS;
lpLogFont->lfClipPrecision = CLIP_DEFAULT_PRECIS;
lpLogFont->lfPitchAndFamily = DEFAULT_PITCH | FF_SWISS;
break;
}
case SPI_LANGDRIVER:
case SPI_SETBORDER:
case SPI_SETDOUBLECLKHEIGHT:

View File

@ -4,16 +4,126 @@
* Copyright 1995 Martin von Loewis
*/
/* At the moment, these are only empty stubs.
*/
#include <string.h>
#include <malloc.h>
#include "windows.h"
#include "ole.h"
#include "options.h"
#include "winnls.h"
#include "stddebug.h"
#include "debug.h"
#include "string32.h"
/* Locale name to id map. used by EnumSystemLocales, GetLocalInfoA
* MUST contain all #defines from winnls.h
* last entry has NULL name, 0 id.
*/
#define LOCALE_ENTRY(x) {#x,LOCALE_##x}
static struct tagLOCALE_NAME2ID {
char *name;
DWORD id;
} locale_name2id[]= {
LOCALE_ENTRY(ILANGUAGE),
LOCALE_ENTRY(SLANGUAGE),
LOCALE_ENTRY(SENGLANGUAGE),
LOCALE_ENTRY(SABBREVLANGNAME),
LOCALE_ENTRY(SNATIVELANGNAME),
LOCALE_ENTRY(ICOUNTRY),
LOCALE_ENTRY(SCOUNTRY),
LOCALE_ENTRY(SENGCOUNTRY),
LOCALE_ENTRY(SABBREVCTRYNAME),
LOCALE_ENTRY(SNATIVECTRYNAME),
LOCALE_ENTRY(IDEFAULTLANGUAGE),
LOCALE_ENTRY(IDEFAULTCOUNTRY),
LOCALE_ENTRY(IDEFAULTCODEPAGE),
LOCALE_ENTRY(IDEFAULTANSICODEPAGE),
LOCALE_ENTRY(SLIST),
LOCALE_ENTRY(IMEASURE),
LOCALE_ENTRY(SDECIMAL),
LOCALE_ENTRY(STHOUSAND),
LOCALE_ENTRY(SGROUPING),
LOCALE_ENTRY(IDIGITS),
LOCALE_ENTRY(ILZERO),
LOCALE_ENTRY(INEGNUMBER),
LOCALE_ENTRY(SNATIVEDIGITS),
LOCALE_ENTRY(SCURRENCY),
LOCALE_ENTRY(SINTLSYMBOL),
LOCALE_ENTRY(SMONDECIMALSEP),
LOCALE_ENTRY(SMONTHOUSANDSEP),
LOCALE_ENTRY(SMONGROUPING),
LOCALE_ENTRY(ICURRDIGITS),
LOCALE_ENTRY(IINTLCURRDIGITS),
LOCALE_ENTRY(ICURRENCY),
LOCALE_ENTRY(INEGCURR),
LOCALE_ENTRY(SDATE),
LOCALE_ENTRY(STIME),
LOCALE_ENTRY(SSHORTDATE),
LOCALE_ENTRY(SLONGDATE),
LOCALE_ENTRY(STIMEFORMAT),
LOCALE_ENTRY(IDATE),
LOCALE_ENTRY(ILDATE),
LOCALE_ENTRY(ITIME),
LOCALE_ENTRY(ITIMEMARKPOSN),
LOCALE_ENTRY(ICENTURY),
LOCALE_ENTRY(ITLZERO),
LOCALE_ENTRY(IDAYLZERO),
LOCALE_ENTRY(IMONLZERO),
LOCALE_ENTRY(S1159),
LOCALE_ENTRY(S2359),
LOCALE_ENTRY(ICALENDARTYPE),
LOCALE_ENTRY(IOPTIONALCALENDAR),
LOCALE_ENTRY(IFIRSTDAYOFWEEK),
LOCALE_ENTRY(IFIRSTWEEKOFYEAR),
LOCALE_ENTRY(SDAYNAME1),
LOCALE_ENTRY(SDAYNAME2),
LOCALE_ENTRY(SDAYNAME3),
LOCALE_ENTRY(SDAYNAME4),
LOCALE_ENTRY(SDAYNAME5),
LOCALE_ENTRY(SDAYNAME6),
LOCALE_ENTRY(SDAYNAME7),
LOCALE_ENTRY(SABBREVDAYNAME1),
LOCALE_ENTRY(SABBREVDAYNAME2),
LOCALE_ENTRY(SABBREVDAYNAME3),
LOCALE_ENTRY(SABBREVDAYNAME4),
LOCALE_ENTRY(SABBREVDAYNAME5),
LOCALE_ENTRY(SABBREVDAYNAME6),
LOCALE_ENTRY(SABBREVDAYNAME7),
LOCALE_ENTRY(SMONTHNAME1),
LOCALE_ENTRY(SMONTHNAME2),
LOCALE_ENTRY(SMONTHNAME3),
LOCALE_ENTRY(SMONTHNAME4),
LOCALE_ENTRY(SMONTHNAME5),
LOCALE_ENTRY(SMONTHNAME6),
LOCALE_ENTRY(SMONTHNAME7),
LOCALE_ENTRY(SMONTHNAME8),
LOCALE_ENTRY(SMONTHNAME9),
LOCALE_ENTRY(SMONTHNAME10),
LOCALE_ENTRY(SMONTHNAME11),
LOCALE_ENTRY(SMONTHNAME12),
LOCALE_ENTRY(SMONTHNAME13),
LOCALE_ENTRY(SABBREVMONTHNAME1),
LOCALE_ENTRY(SABBREVMONTHNAME2),
LOCALE_ENTRY(SABBREVMONTHNAME3),
LOCALE_ENTRY(SABBREVMONTHNAME4),
LOCALE_ENTRY(SABBREVMONTHNAME5),
LOCALE_ENTRY(SABBREVMONTHNAME6),
LOCALE_ENTRY(SABBREVMONTHNAME7),
LOCALE_ENTRY(SABBREVMONTHNAME8),
LOCALE_ENTRY(SABBREVMONTHNAME9),
LOCALE_ENTRY(SABBREVMONTHNAME10),
LOCALE_ENTRY(SABBREVMONTHNAME11),
LOCALE_ENTRY(SABBREVMONTHNAME12),
LOCALE_ENTRY(SABBREVMONTHNAME13),
LOCALE_ENTRY(SPOSITIVESIGN),
LOCALE_ENTRY(SNEGATIVESIGN),
LOCALE_ENTRY(IPOSSIGNPOSN),
LOCALE_ENTRY(INEGSIGNPOSN),
LOCALE_ENTRY(IPOSSYMPRECEDES),
LOCALE_ENTRY(IPOSSEPBYSPACE),
LOCALE_ENTRY(INEGSYMPRECEDES),
LOCALE_ENTRY(INEGSEPBYSPACE),
{NULL,0},
};
/***********************************************************************
* GetUserDefaultLCID (OLE2NLS.1)
@ -86,137 +196,39 @@ WORD GetSystemDefaultLangID()
*/
int GetLocaleInfoA(DWORD lcid,DWORD LCType,LPSTR buf,WORD len)
{
char *retString;
int retLen;
dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n",
char *retString;
int found,i;
dprintf_ole(stddeb,"GetLocaleInfoA(%8lX,%8lX,%p,%4X)\n",
lcid,LCType,buf,len);
#if 0
/* Wine is supporting only the default locale */
if(lcid!=GetUserDefaultLCID())
{
dprintf_ole(stdnimp,"GetLocaleInfoA: Unknown locale\n");
return 0;
}
#endif
/* As an option, we could obtain the value from win.ini.
This would not match the Wine compile-time option.
Also, not all identifiers are available from win.ini */
retString=0;
retLen=0;
/* If we are through all of this, retLen should not be zero anymore.
If it is, the value is not supported */
#define LOCVAL(type,value) if(type==LCType) \
{retLen=strlen(value)+1;\
retString=value; \
}
#define UNSUPPORTED(type) if(type==lcid)retString=#type;
i=0;
while (locale_name2id[i].name!=NULL) {
if (LCType == locale_name2id[i].id) {
retString = locale_name2id[i].name;
break;
}
i++;
}
if (!retString) {
fprintf(stderr,"Unkown LC type %lX\n",LCType);
return 0;
}
/* I really wish I would know a better way to do this */
UNSUPPORTED(LOCALE_ILANGUAGE)
UNSUPPORTED(LOCALE_SLANGUAGE)
UNSUPPORTED(LOCALE_SENGLANGUAGE)
UNSUPPORTED(LOCALE_SABBREVLANGNAME)
UNSUPPORTED(LOCALE_SNATIVELANGNAME)
UNSUPPORTED(LOCALE_ICOUNTRY)
UNSUPPORTED(LOCALE_SCOUNTRY)
UNSUPPORTED(LOCALE_SENGCOUNTRY)
UNSUPPORTED(LOCALE_SABBREVCTRYNAME)
UNSUPPORTED(LOCALE_SNATIVECTRYNAME)
UNSUPPORTED(LOCALE_IDEFAULTLANGUAGE)
UNSUPPORTED(LOCALE_IDEFAULTCOUNTRY)
UNSUPPORTED(LOCALE_IDEFAULTCODEPAGE)
UNSUPPORTED(LOCALE_IDEFAULTANSICODEPAGE)
UNSUPPORTED(LOCALE_SLIST)
UNSUPPORTED(LOCALE_IMEASURE)
UNSUPPORTED(LOCALE_SDECIMAL)
UNSUPPORTED(LOCALE_STHOUSAND)
UNSUPPORTED(LOCALE_SGROUPING)
UNSUPPORTED(LOCALE_IDIGITS)
UNSUPPORTED(LOCALE_ILZERO)
UNSUPPORTED(LOCALE_INEGNUMBER)
UNSUPPORTED(LOCALE_SNATIVEDIGITS)
UNSUPPORTED(LOCALE_SCURRENCY)
UNSUPPORTED(LOCALE_SINTLSYMBOL)
UNSUPPORTED(LOCALE_SMONDECIMALSEP)
UNSUPPORTED(LOCALE_SMONTHOUSANDSEP)
UNSUPPORTED(LOCALE_SMONGROUPING)
UNSUPPORTED(LOCALE_ICURRDIGITS)
UNSUPPORTED(LOCALE_IINTLCURRDIGITS)
UNSUPPORTED(LOCALE_ICURRENCY)
UNSUPPORTED(LOCALE_INEGCURR)
UNSUPPORTED(LOCALE_SDATE)
UNSUPPORTED(LOCALE_STIME)
UNSUPPORTED(LOCALE_SSHORTDATE)
UNSUPPORTED(LOCALE_SLONGDATE)
UNSUPPORTED(LOCALE_STIMEFORMAT)
UNSUPPORTED(LOCALE_IDATE)
UNSUPPORTED(LOCALE_ILDATE)
UNSUPPORTED(LOCALE_ITIME)
UNSUPPORTED(LOCALE_ITIMEMARKPOSN)
UNSUPPORTED(LOCALE_ICENTURY)
UNSUPPORTED(LOCALE_ITLZERO)
UNSUPPORTED(LOCALE_IDAYLZERO)
UNSUPPORTED(LOCALE_IMONLZERO)
UNSUPPORTED(LOCALE_S1159)
UNSUPPORTED(LOCALE_S2359)
UNSUPPORTED(LOCALE_ICALENDARTYPE)
UNSUPPORTED(LOCALE_IOPTIONALCALENDAR)
UNSUPPORTED(LOCALE_IFIRSTDAYOFWEEK)
UNSUPPORTED(LOCALE_IFIRSTWEEKOFYEAR)
UNSUPPORTED(LOCALE_SDAYNAME1)
UNSUPPORTED(LOCALE_SDAYNAME2)
UNSUPPORTED(LOCALE_SDAYNAME3)
UNSUPPORTED(LOCALE_SDAYNAME4)
UNSUPPORTED(LOCALE_SDAYNAME5)
UNSUPPORTED(LOCALE_SDAYNAME6)
UNSUPPORTED(LOCALE_SDAYNAME7)
UNSUPPORTED(LOCALE_SABBREVDAYNAME1)
UNSUPPORTED(LOCALE_SABBREVDAYNAME2)
UNSUPPORTED(LOCALE_SABBREVDAYNAME3)
UNSUPPORTED(LOCALE_SABBREVDAYNAME4)
UNSUPPORTED(LOCALE_SABBREVDAYNAME5)
UNSUPPORTED(LOCALE_SABBREVDAYNAME6)
UNSUPPORTED(LOCALE_SABBREVDAYNAME7)
UNSUPPORTED(LOCALE_SMONTHNAME1)
UNSUPPORTED(LOCALE_SMONTHNAME2)
UNSUPPORTED(LOCALE_SMONTHNAME3)
UNSUPPORTED(LOCALE_SMONTHNAME4)
UNSUPPORTED(LOCALE_SMONTHNAME5)
UNSUPPORTED(LOCALE_SMONTHNAME6)
UNSUPPORTED(LOCALE_SMONTHNAME7)
UNSUPPORTED(LOCALE_SMONTHNAME8)
UNSUPPORTED(LOCALE_SMONTHNAME9)
UNSUPPORTED(LOCALE_SMONTHNAME10)
UNSUPPORTED(LOCALE_SMONTHNAME11)
UNSUPPORTED(LOCALE_SMONTHNAME12)
UNSUPPORTED(LOCALE_SMONTHNAME13)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME1)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME2)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME3)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME4)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME5)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME6)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME7)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME8)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME9)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME10)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME11)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME12)
UNSUPPORTED(LOCALE_SABBREVMONTHNAME13)
UNSUPPORTED(LOCALE_SPOSITIVESIGN)
UNSUPPORTED(LOCALE_SNEGATIVESIGN)
UNSUPPORTED(LOCALE_IPOSSIGNPOSN)
UNSUPPORTED(LOCALE_INEGSIGNPOSN)
UNSUPPORTED(LOCALE_IPOSSYMPRECEDES)
UNSUPPORTED(LOCALE_IPOSSEPBYSPACE)
UNSUPPORTED(LOCALE_INEGSYMPRECEDES)
UNSUPPORTED(LOCALE_INEGSEPBYSPACE)
#define LOCVAL(type,value) case type:retString=value;break;
/* Now, the language specific definitions. They don't have to be
complete */
found=1;
switch(Options.language)
{
case LANG_De:
switch (LCType) {
/* This definitions apply to Germany only. Users in Austria
or Switzerland might want to modify them */
LOCVAL(LOCALE_ILANGUAGE,"9")
@ -339,9 +351,12 @@ LOCVAL(LOCALE_IPOSSEPBYSPACE)
LOCVAL(LOCALE_INEGSYMPRECEDES)
LOCVAL(LOCALE_INEGSEPBYSPACE)
*/
default: found=0;break;
}
break; /* LANG(De) */
case LANG_Da:
switch (LCType) {
/* LOCVAL(LOCALE_ILANGUAGE,"9") */
LOCVAL(LOCALE_SLANGUAGE,"Dansk")
LOCVAL(LOCALE_SENGLANGUAGE,"Danish")
@ -441,9 +456,12 @@ LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
/* LOCVAL(LOCALE_IPOSSEPBYSPACE) */
/* LOCVAL(LOCALE_INEGSYMPRECEDES) */
/* LOCVAL(LOCALE_INEGSEPBYSPACE) */
default: found=0;break;
}
break; /* LANG(Da) */
case LANG_En:
switch (LCType) {
/* This definitions apply to Germany only. Users in Austria
or Switzerland might want to modify them */
LOCVAL(LOCALE_ILANGUAGE,"9")
@ -566,9 +584,12 @@ LOCVAL(LOCALE_IPOSSEPBYSPACE)
LOCVAL(LOCALE_INEGSYMPRECEDES)
LOCVAL(LOCALE_INEGSEPBYSPACE)
*/
default: found=0;break;
}
break; /* LANG(En) */
case LANG_Eo:
switch (LCType) {
/* LOCVAL(LOCALE_ILANGUAGE,"9") ISO numerical ID for language TODO */
LOCVAL(LOCALE_SLANGUAGE,"Esperanto")
LOCVAL(LOCALE_SENGLANGUAGE,"Esperanto")
@ -668,9 +689,12 @@ LOCVAL(LOCALE_SABBREVMONTHNAME13,"")
/* LOCVAL(LOCALE_IPOSSEPBYSPACE) */
/* LOCVAL(LOCALE_INEGSYMPRECEDES) */
/* LOCVAL(LOCALE_INEGSEPBYSPACE) */
default: found=0;break;
}
break; /* LANG(Eo) */
case LANG_Fi:
switch (LCType) {
LOCVAL(LOCALE_ILANGUAGE,"11")
LOCVAL(LOCALE_SLANGUAGE,"Suomi")
LOCVAL(LOCALE_SENGLANGUAGE,"Finnish")
@ -791,9 +815,12 @@ LOCVAL(LOCALE_IPOSSEPBYSPACE)
LOCVAL(LOCALE_INEGSYMPRECEDES)
LOCVAL(LOCALE_INEGSEPBYSPACE)
*/
default: found=0;break;
}
break; /* LANG(Fi) */
case LANG_It:
switch (LCType) {
LOCVAL(LOCALE_ILANGUAGE,"9")
LOCVAL(LOCALE_SLANGUAGE,"Italiano")
LOCVAL(LOCALE_SENGLANGUAGE,"Italian")
@ -914,9 +941,12 @@ LOCVAL(LOCALE_IPOSSEPBYSPACE)
LOCVAL(LOCALE_INEGSYMPRECEDES)
LOCVAL(LOCALE_INEGSEPBYSPACE)
*/
default: found=0;break;
}
break; /* LANG(It) */
case 0x0409:
switch (LCType) {
LOCVAL(LOCALE_ILANGUAGE, "0409")
LOCVAL(LOCALE_SLANGUAGE, "English (United States)")
LOCVAL(LOCALE_SENGLANGUAGE, "English")
@ -1016,9 +1046,12 @@ LOCVAL(LOCALE_IPOSSYMPRECEDES, "1")
LOCVAL(LOCALE_IPOSSEPBYSPACE, "0")
LOCVAL(LOCALE_INEGSYMPRECEDES, "1")
LOCVAL(LOCALE_INEGSEPBYSPACE, "0")
default: found=0;break;
}
break; /* LANG(0x0409) (U.S. English) */
case 0x0809:
switch (LCType) {
LOCVAL(LOCALE_ILANGUAGE, "0809")
LOCVAL(LOCALE_SLANGUAGE, "English (United Kingdom)")
LOCVAL(LOCALE_SENGLANGUAGE, "English")
@ -1118,25 +1151,24 @@ LOCVAL(LOCALE_IPOSSYMPRECEDES, "1")
LOCVAL(LOCALE_IPOSSEPBYSPACE, "0")
LOCVAL(LOCALE_INEGSYMPRECEDES, "1")
LOCVAL(LOCALE_INEGSEPBYSPACE, "0")
default: found=0;break;
}
break; /* LANG(0x0809) (U.K. English) */
/*Insert other languages here*/
default:
found=0;
break;
} /* switch */
if(!retLen)
{
if(!retString)fprintf(stderr,"Unkown LC type %lX\n",LCType);
else fprintf(stderr,"'%s' not supported for your language.\n",
if(!found) {
fprintf(stderr,"'%s' not supported for your language.\n",
retString);
return 0;
}
if(retLen>len)retLen=len;
lstrcpyn32A(buf,retString,len);
return retLen;
return strlen(retString)+1;
}
/***********************************************************************
@ -1230,7 +1262,57 @@ BOOL SetLocaleInfoA(DWORD lcid, DWORD lctype, LPCSTR data) {
return TRUE;
}
BOOL IsValidLocale(DWORD lcid,DWORD flags) {
fprintf(stdnimp,"IsValidLocale(%ld,%ld)\n",lcid,flags);
/***********************************************************************
* IsValidLocale (KERNEL32.361)
*/
BOOL32 IsValidLocale(DWORD lcid,DWORD flags) {
int i;
i=0;
while (locale_name2id[i].name!=NULL)
if (locale_name2id[i].id == lcid)
return TRUE;
return FALSE;
}
/***********************************************************************
* EnumSystemLocales32W (KERNEL32.93)
*/
BOOL32
EnumSystemLocales32W(LOCALE_ENUMPROC32W lpfnLocaleEnum,DWORD flags) {
WCHAR *cp;
int i;
BOOL32 ret;
dprintf_win32(stddeb,"EnumSystemLocales32W(%p,%08lx)\n",
lpfnLocaleEnum,flags
);
i=0;
while (locale_name2id[i].name!=NULL) {
cp=(LPWSTR)STRING32_DupAnsiToUni(locale_name2id[i].name);
ret=lpfnLocaleEnum(cp);
free(cp);
if (!ret) break;
i++;
}
return TRUE;
}
/***********************************************************************
* EnumSystemLocales32A (KERNEL32.92)
*/
BOOL32
EnumSystemLocales32A(LOCALE_ENUMPROC32A lpfnLocaleEnum,DWORD flags) {
int i;
dprintf_win32(stddeb,"EnumSystemLocales32A(%p,%08lx)\n",
lpfnLocaleEnum,flags
);
i=0;
while (locale_name2id[i].name!=NULL) {
if (!lpfnLocaleEnum(locale_name2id[i].name))
break;
i++;
}
return TRUE;
}

View File

@ -450,7 +450,7 @@ _savesubreg(FILE *F,LPKEYSTRUCT lpkey,int all) {
return _savesubkey(F,lpkey->nextsub,0,all);
}
static void
static BOOL32
_savereg(LPKEYSTRUCT lpkey,char *fn,int all) {
FILE *F;
@ -459,15 +459,16 @@ _savereg(LPKEYSTRUCT lpkey,char *fn,int all) {
fprintf(stddeb,__FILE__":_savereg:Couldn't open %s for writing: %s\n",
fn,strerror(errno)
);
return;
return FALSE;
}
if (!_savesubreg(F,lpkey,all)) {
fclose(F);
unlink(fn);
fprintf(stddeb,__FILE__":_savereg:Failed to save keys, perhaps no more diskspace for %s?\n",fn);
return;
return FALSE;
}
fclose(F);
return TRUE;
}
void
@ -500,19 +501,22 @@ SHELL_SaveRegistry() {
if (lstrcmpi32A(buf,"yes"))
all=1;
pwd=getpwuid(getuid());
if (pwd!=NULL && pwd->pw_dir!=NULL) {
fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_USERS_DEFAULT)+2);
if (pwd!=NULL && pwd->pw_dir!=NULL)
{
char *tmp = tmpnam(NULL);
fn=(char*)xmalloc( strlen(pwd->pw_dir) + strlen(WINE_PREFIX) +
strlen(SAVE_CURRENT_USER) + 2 );
strcpy(fn,pwd->pw_dir);
strcat(fn,WINE_PREFIX);
/* create the directory. don't care about errorcodes. */
mkdir(fn,0755); /* drwxr-xr-x */
strcat(fn,"/"SAVE_CURRENT_USER);
_savereg(key_current_user,fn,all);
if (_savereg(key_current_user,tmp,all)) rename(tmp,fn);
free(fn);
fn=(char*)xmalloc(strlen(pwd->pw_dir)+strlen(WINE_PREFIX)+strlen(SAVE_LOCAL_MACHINE)+2);
strcpy(fn,pwd->pw_dir);
strcat(fn,WINE_PREFIX"/"SAVE_LOCAL_MACHINE);
_savereg(key_local_machine,fn,all);
if (_savereg(key_local_machine,tmp,all)) rename(tmp,fn);
free(fn);
} else
fprintf(stderr,"SHELL_SaveRegistry:failed to get homedirectory of UID %d.\n",getuid());
@ -1315,6 +1319,216 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
free(keys);
}
/* WINDOWS 31 REGISTRY LOADER, supplied by Tor Sjøwall, tor@sn.no */
/*
reghack - windows 3.11 registry data format demo program.
The reg.dat file has 3 parts, a header, a table of 8-byte entries that is
a combined hash table and tree description, and finally a text table.
The header is obvious from the struct header. The taboff1 and taboff2
fields are always 0x20, and their usage is unknown.
The 8-byte entry table has various entry types.
tabent[0] is a root index. The second word has the index of the root of
the directory.
tabent[1..hashsize] is a hash table. The first word in the hash entry is
the index of the key/value that has that hash. Data with the same
hash value are on a circular list. The other three words in the
hash entry are always zero.
tabent[hashsize..tabcnt] is the tree structure. There are two kinds of
entry: dirent and keyent/valent. They are identified by context.
tabent[freeidx] is the first free entry. The first word in a free entry
is the index of the next free entry. The last has 0 as a link.
The other three words in the free list are probably irrelevant.
Entries in text table are preceeded by a word at offset-2. This word
has the value (2*index)+1, where index is the referring keyent/valent
entry in the table. I have no suggestion for the 2* and the +1.
Following the word, there are N bytes of data, as per the keyent/valent
entry length. The offset of the keyent/valent entry is from the start
of the text table to the first data byte.
This information is not available from Microsoft. The data format is
deduced from the reg.dat file by me. Mistakes may
have been made. I claim no rights and give no guarantees for this program.
Tor Sjøwall, tor@sn.no
*/
/* reg.dat header format */
struct _w31_header {
char cookie[8]; /* 'SHCC3.10' */
unsigned long taboff1; /* offset of hash table (??) = 0x20 */
unsigned long taboff2; /* offset of index table (??) = 0x20 */
unsigned long tabcnt; /* number of entries in index table */
unsigned long textoff; /* offset of text part */
unsigned long textsize; /* byte size of text part */
unsigned short hashsize; /* hash size */
unsigned short freeidx; /* free index */
};
/* generic format of table entries */
struct _w31_tabent {
unsigned short w0, w1, w2, w3;
};
/* directory tabent: */
struct _w31_dirent {
unsigned short sibling_idx; /* table index of sibling dirent */
unsigned short child_idx; /* table index of child dirent */
unsigned short key_idx; /* table index of key keyent */
unsigned short value_idx; /* table index of value valent */
};
/* key tabent: */
struct _w31_keyent {
unsigned short hash_idx; /* hash chain index for string */
unsigned short refcnt; /* reference count */
unsigned short length; /* length of string */
unsigned short string_off; /* offset of string in text table */
};
/* value tabent: */
struct _w31_valent {
unsigned short hash_idx; /* hash chain index for string */
unsigned short refcnt; /* reference count */
unsigned short length; /* length of string */
unsigned short string_off; /* offset of string in text table */
};
/* recursive helper function to display a directory tree */
void
__w31_dumptree( unsigned short idx,
unsigned char *txt,
struct _w31_tabent *tab,
struct _w31_header *head,
LPKEYSTRUCT lpkey,
time_t lastmodified,
int level
) {
struct _w31_dirent *dir;
struct _w31_keyent *key;
struct _w31_valent *val;
LPKEYSTRUCT xlpkey;
LPWSTR name,value;
static char tail[400];
while (idx!=0) {
dir=(struct _w31_dirent*)&tab[idx];
if (dir->key_idx) {
key = (struct _w31_keyent*)&tab[dir->key_idx];
memcpy(tail,&txt[key->string_off],key->length);
tail[key->length]='\0';
/* all toplevel entries AND the entries in the
* toplevel subdirectory belong to \SOFTWARE\Classes
*/
if (!level && !lstrcmp32A(tail,".classes")) {
__w31_dumptree(dir->child_idx,txt,tab,head,lpkey,lastmodified,level+1);
idx=dir->sibling_idx;
continue;
}
name=STRING32_DupAnsiToUni(tail);
xlpkey=_find_or_add_key(lpkey,name);
/* only add if leaf node or valued node */
if (dir->value_idx!=0||dir->child_idx==0) {
if (dir->value_idx) {
val=(struct _w31_valent*)&tab[dir->value_idx];
memcpy(tail,&txt[val->string_off],val->length);
tail[val->length]='\0';
value=STRING32_DupAnsiToUni(tail);
_find_or_add_value(xlpkey,NULL,REG_SZ,(LPBYTE)value,lstrlen32W(value)*2+2,lastmodified);
}
}
} else {
dprintf_reg(stddeb,"__w31_dumptree:strange: no directory key name, idx=%04x\n", idx);
}
__w31_dumptree(dir->child_idx,txt,tab,head,xlpkey,lastmodified,level+1);
idx=dir->sibling_idx;
}
}
void
_w31_loadreg() {
HFILE hf;
struct _w31_header head;
struct _w31_tabent *tab;
unsigned char *txt;
int len;
OFSTRUCT ofs;
BY_HANDLE_FILE_INFORMATION hfinfo;
time_t lastmodified;
HKEY hkey;
LPKEYSTRUCT lpkey;
hf = OpenFile("reg.dat",&ofs,OF_READ);
if (hf==HFILE_ERROR)
return;
/* read & dump header */
if (sizeof(head)!=_lread32(hf,&head,sizeof(head))) {
dprintf_reg(stddeb,"_w31_loadreg:reg.dat is too short.\n");
_lclose(hf);
return;
}
if (memcmp(head.cookie, "SHCC3.10", sizeof(head.cookie))!=0) {
dprintf_reg(stddeb,"_w31_loadreg:reg.dat has bad signature.\n");
_lclose(hf);
return;
}
len = head.tabcnt * sizeof(struct _w31_tabent);
/* read and dump index table */
tab = xmalloc(len);
if (len!=_lread32(hf,tab,len)) {
dprintf_reg(stderr,"_w31_loadreg:couldn't read %d bytes.\n",len);
free(tab);
_lclose(hf);
return;
}
/* read text */
txt = xmalloc(head.textsize);
if (-1==_llseek(hf,head.textoff,SEEK_SET)) {
dprintf_reg(stderr,"_w31_loadreg:couldn't seek to textblock.\n");
free(tab);
free(txt);
_lclose(hf);
return;
}
if (head.textsize!=_lread32(hf,txt,head.textsize)) {
dprintf_reg(stderr,"_w31_loadreg:textblock too short (%d instead of %ld).\n",len,head.textsize);
free(tab);
free(txt);
_lclose(hf);
return;
}
if (!GetFileInformationByHandle(hf,&hfinfo)) {
dprintf_reg(stderr,"_w31_loadreg:GetFileInformationByHandle failed?.\n");
free(tab);
free(txt);
_lclose(hf);
return;
}
lastmodified = DOSFS_FileTimeToUnixTime(&(hfinfo.ftLastWriteTime));
if (RegCreateKey16(HKEY_LOCAL_MACHINE,"\\SOFTWARE\\Classes",&hkey)!=ERROR_SUCCESS)
return;
lpkey = lookup_hkey(hkey);
__w31_dumptree(tab[0].w1,txt,tab,&head,lpkey,lastmodified,0);
free(tab);
free(txt);
_lclose(hf);
return;
}
void
SHELL_LoadRegistry() {
char *fn;
@ -1326,13 +1540,13 @@ SHELL_LoadRegistry() {
if (key_classes_root==NULL)
SHELL_Init();
/* Load windows 3.1 entries */
_w31_loadreg();
/* Load windows 95 entries */
_w95_loadreg("C:\\system.1st", key_local_machine);
_w95_loadreg("system.dat", key_local_machine);
_w95_loadreg("user.dat", key_users);
/* FIXME: win3.1 reg.dat loader still missing */
/* the global user default is loaded under HKEY_USERS\\.Default */
RegCreateKey16(HKEY_USERS,".Default",&hkey);
lpkey = lookup_hkey(hkey);

View File

@ -195,29 +195,34 @@ static HINSTANCE16 SHELL_FindExecutable( LPCSTR lpFile,
/* extensions; however, it'd make sense to check the programs */
/* section first, so that's what happens here. */
/* See if it's a program */
GetProfileString("windows", "programs", "exe pif bat com",
buffer, sizeof(buffer)); /* FIXME check return code! */
/* See if it's a program - if GetProfileString fails, we skip this
* section. Actually, if GetProfileString fails, we've probably
* got a lot more to worry about than running a program... */
if ( GetProfileString32A("windows", "programs", "exe pif bat com",
buffer, sizeof(buffer)) > 0 )
{
for (i=0;i<strlen(buffer); i++) buffer[i]=tolower(buffer[i]);
for (i=0;i<strlen(buffer); i++) buffer[i]=tolower(buffer[i]);
tok = strtok(buffer, " \t"); /* ? */
while( tok!= NULL)
{
if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
{
strcpy(lpResult, xlpFile);
/* Need to perhaps check that the file has a path
* attached */
dprintf_exec(stddeb, "SHELL_FindExecutable: found %s\n",
lpResult);
return 33;
tok = strtok(buffer, " \t"); /* ? */
while( tok!= NULL)
{
if (strcmp(tok, &tmpext[1])==0) /* have to skip the leading "." */
{
strcpy(lpResult, xlpFile); /* Need to perhaps check that */
/* the file has a path attached */
dprintf_exec(stddeb, "SHELL_FindExecutable: found %s\n",
lpResult);
return 33; /* Greater than 32 to indicate success FIXME */
/* According to the docs, I should be returning */
/* a handle for the executable. Does this mean */
/* I'm supposed to open the executable file or */
/* something? More RTFM, I guess... */
}
tok=strtok(NULL, " \t");
}
/* Greater than 32 to indicate success FIXME According to the
* docs, I should be returning a handle for the
* executable. Does this mean I'm supposed to open the
* executable file or something? More RTFM, I guess... */
}
tok=strtok(NULL, " \t");
}
}
/* Check registry */
if (RegQueryValue16( (HKEY)HKEY_CLASSES_ROOT, tmpext, filetype,
@ -249,32 +254,34 @@ static HINSTANCE16 SHELL_FindExecutable( LPCSTR lpFile,
strcat( lpResult, &tok[2] );
}
}
retval=33;
retval=33; /* FIXME see above */
}
}
else /* Check win.ini */
{
/* Toss the leading dot */
extension++;
GetProfileString( "extensions", extension, "", command,
sizeof(command));
if (strlen(command)!=0)
{
strcpy( lpResult, command );
tok=strstr( lpResult, "^" ); /* should be ^.extension? */
if (tok != NULL)
{
tok[0]='\0';
strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
tok=strstr( command, "^" ); /* see above */
if ((tok != NULL) && (strlen(tok)>5))
{
strcat( lpResult, &tok[5]);
}
}
retval=33;
if ( GetProfileString32A( "extensions", extension, "", command,
sizeof(command)) > 0)
{
if (strlen(command)!=0)
{
strcpy( lpResult, command );
tok=strstr( lpResult, "^" ); /* should be ^.extension? */
if (tok != NULL)
{
tok[0]='\0';
strcat( lpResult, xlpFile ); /* what if no dir in xlpFile? */
tok=strstr( command, "^" ); /* see above */
if ((tok != NULL) && (strlen(tok)>5))
{
strcat( lpResult, &tok[5]);
}
}
retval=33; /* FIXME - see above */
}
}
}
}
dprintf_exec(stddeb, "SHELL_FindExecutable: returning %s\n", lpResult);
return retval;
@ -804,7 +811,7 @@ DWORD DoEnvironmentSubst(LPSTR str,WORD length)
*/
int RegisterShellHook(void *ptr)
{
fprintf(stdnimp, "RegisterShellHook : Empty Stub !!!\n");
fprintf(stdnimp, "RegisterShellHook( %p ) : Empty Stub !!!\n", ptr);
return 0;
}

View File

@ -296,7 +296,8 @@ static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
"LB_SETITEMHEIGHT32", /* 0x01a0 */
"LB_GETITEMHEIGHT32", /* 0x01a1 */
"LB_FINDSTRINGEXACT32", /* 0x01a2 */
NULL, NULL,
"LB_CARETON32", /* 0x01a3 */
"LB_CARETOFF32", /* 0x01a4 */
"LB_SETLOCALE32", /* 0x01a5 */
"LB_GETLOCALE32", /* 0x01a6 */
"LB_SETCOUNT32", /* 0x01a7 */

View File

@ -101,7 +101,7 @@ INT16 InitApp( HINSTANCE16 hInstance )
int queueSize;
/* Create task message queue */
queueSize = GetProfileInt( "windows", "DefaultQueueSize", 8 );
queueSize = GetProfileInt32A( "windows", "DefaultQueueSize", 8 );
if (!SetMessageQueue( queueSize )) return 0;
return 1;
@ -112,8 +112,7 @@ INT16 InitApp( HINSTANCE16 hInstance )
*/
void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
{
/* FIXME: flush send messages (which are not implemented yet),
* empty clipboard if needed, maybe destroy menus (Windows
/* FIXME: empty clipboard if needed, maybe destroy menus (Windows
* only complains about them but does nothing);
*/
@ -126,18 +125,13 @@ void USER_AppExit( HTASK16 hTask, HINSTANCE16 hInstance, HQUEUE16 hQueue )
/* Patch resident popup menu window */
MENU_SwitchTPWndTo(0);
/* Nuke timers */
TIMER_RemoveQueueTimers( hQueue );
QUEUE_FlushMessages( hQueue );
HOOK_FreeQueueHooks( hQueue );
QUEUE_SetDoomedQueue( hQueue );
/* Nuke orphaned windows */
WIN_DestroyQueueWindows( desktop->child, hQueue );
WIN_ResetQueueWindows( desktop->child, hQueue, (HQUEUE16)0);
QUEUE_SetDoomedQueue( 0 );
/* Free the message queue */

1713
misc/winsock.c Normal file

File diff suppressed because it is too large Load Diff

486
misc/winsock_async.c Normal file
View File

@ -0,0 +1,486 @@
/*
* asynchronous winsock services
*
* (C) 1996 Alex Korobka.
*
* FIXME: telftp16 (ftp part) stalls on AsyncSelect with FD_ACCEPT.
*/
#include <unistd.h>
#include <string.h>
#include <signal.h>
#include <sys/ioctl.h>
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include <sys/wait.h>
#include <errno.h>
#include "windows.h"
#include "winsock.h"
#include "debug.h"
#define __WS_ASYNC_DEBUG 0
static int _async_io_max_fd = 0;
static fd_set __async_io_fdset;
static ws_async_op* __async_op_list = NULL;
extern ws_async_ctl async_ctl;
extern int async_qid;
fd_set fd_read, fd_write, fd_excp;
/* ----------------------------------- async/non-blocking I/O */
int WINSOCK_async_io(int fd, int async)
{
int fd_flags;
fcntl(fd, F_SETOWN, getpid());
fd_flags = fcntl(fd, F_GETFL, 0);
if (fcntl(fd, F_SETFL, (async)? fd_flags | FASYNC
: fd_flags & ~FASYNC ) != -1) return 0;
return -1;
}
int WINSOCK_unblock_io(int fd, int noblock)
{
int fd_flags;
fd_flags = fcntl(fd, F_GETFL, 0);
if (fcntl(fd, F_SETFL, (noblock)? fd_flags | O_NONBLOCK
: fd_flags & ~O_NONBLOCK ) != -1) return 0;
return -1;
}
int WINSOCK_check_async_op(ws_async_op* p_aop)
{
ws_async_op* p = __async_op_list;
while( p ) if( p == p_aop ) return 1;
else p = p->next;
return 0;
}
void WINSOCK_cancel_async_op(HTASK16 hTask)
{
ws_async_op* p = __async_op_list;
while( p )
if(hTask == GetWindowTask16(p->hWnd))
p->flags = 0;
}
void WINSOCK_link_async_op(ws_async_op* p_aop)
{
if( __async_op_list ) __async_op_list->prev = p_aop;
else FD_ZERO(&__async_io_fdset);
p_aop->next = __async_op_list;
p_aop->prev = NULL;
__async_op_list = p_aop;
FD_SET(p_aop->fd[0], &__async_io_fdset);
if( p_aop->fd[0] > _async_io_max_fd )
_async_io_max_fd = p_aop->fd[0];
}
void WINSOCK_unlink_async_op(ws_async_op* p_aop)
{
if( p_aop == __async_op_list ) __async_op_list = p_aop->next;
else
{ p_aop->prev->next = p_aop->next;
if( p_aop->next ) p_aop->next->prev = p_aop->prev; }
FD_CLR(p_aop->fd[0], &__async_io_fdset);
if( p_aop->fd[0] == _async_io_max_fd )
_async_io_max_fd--;
}
/* ----------------------------------- SIGIO handler -
*
* link_async_op/unlink_async_op allow to install generic
* async IO handlers (provided that aop_control function is defined).
*
* Note: AsyncGetXbyY expilicitly raise it.
*/
void WINSOCK_sigio(int signal)
{
struct timeval timeout;
fd_set check_set;
ws_async_op* p_aop;
check_set = __async_io_fdset;
bzero(&timeout,sizeof(timeout));
while( select(_async_io_max_fd + 1,
&check_set, NULL, NULL, &timeout) > 0)
{
for( p_aop = __async_op_list;
p_aop ; p_aop = p_aop->next )
if( FD_ISSET(p_aop->fd[0], &check_set) )
if( p_aop->aop_control(p_aop, AOP_IO) == AOP_CONTROL_REMOVE )
{
if( p_aop->pid )
{
kill(p_aop->pid, SIGKILL);
waitpid(p_aop->pid, NULL, 0);
}
WINSOCK_unlink_async_op( p_aop );
}
check_set = __async_io_fdset;
}
}
/* ----------------------------------- child process IPC */
static void _sigusr1_handler_child(int sig)
{
/* read message queue to decide which
* async_ctl parameters to update
*
* Note: we don't want to have SA_RESTART on this signal
* handler, otherwise select() won't notice changed fd sets.
*/
signal( SIGUSR1, _sigusr1_handler_child );
while( msgrcv(async_qid, (struct msgbuf*)&async_ctl.ip,
MTYPE_PARENT_SIZE, MTYPE_PARENT, IPC_NOWAIT) != -1 )
{
/* only ip.lParam is updated */
#if __WS_ASYNC_DEBUG
printf("handler - event %08x\n", async_ctl.ip.lParam );
#endif
switch( async_ctl.ip.lParam )
{
/* These are events we are notified of.
*/
case WS_FD_CONNECTED: async_ctl.lEvent &= ~WS_FD_CONNECT;
FD_SET(async_ctl.ws_sock->fd, &fd_read);
FD_SET(async_ctl.ws_sock->fd, &fd_write);
break;
case WS_FD_ACCEPT: async_ctl.ws_sock->flags |= WS_FD_ACCEPT;
FD_SET(async_ctl.ws_sock->fd, &fd_read);
FD_SET(async_ctl.ws_sock->fd, &fd_write);
break;
case WS_FD_OOB: async_ctl.lEvent |= WS_FD_OOB;
FD_SET(async_ctl.ws_sock->fd, &fd_excp);
break;
case WS_FD_READ: async_ctl.lEvent |= WS_FD_READ;
FD_SET(async_ctl.ws_sock->fd, &fd_read);
break;
case WS_FD_WRITE: async_ctl.lEvent |= WS_FD_WRITE;
FD_SET(async_ctl.ws_sock->fd, &fd_write);
break;
default:
}
}
}
static int notify_parent( unsigned flag )
{
if( flag & WSMSG_ASYNC_SELECT )
{
async_ctl.ip.mtype = MTYPE_CLIENT;
while( msgsnd(async_qid, (struct msgbuf*)&(async_ctl.ip),
MTYPE_CLIENT_SIZE, 0) == -1 )
{
if( errno == EINTR ) continue;
else if( errno == EIDRM ) _exit(0);
else
{
perror("AsyncSelect(child)");
return 0;
}
}
kill(getppid(), SIGUSR1);
#if __WS_ASYNC_DEBUG
printf("handler - notify [%08x]\n", async_ctl.ip.lParam);
#endif
}
else /* use half-duplex pipe to handle variable length packets */
{
write(async_ctl.ws_aop->fd[1], &async_ctl.lLength, sizeof(unsigned) );
write(async_ctl.ws_aop->fd[1], async_ctl.buffer, async_ctl.lLength );
kill(getppid(), SIGIO); /* simulate async I/O */
#if __WS_ASYNC_DEBUG
printf("handler - notify aop [%d, buf %d]\n", async_ctl.lLength, async_ctl.ws_aop->buflen);
#endif
pause();
}
return 1;
}
/* ----------------------------------- async select */
static void setup_fd_sets()
{
FD_ZERO(&fd_read); FD_ZERO(&fd_write); FD_ZERO(&fd_excp);
if( async_ctl.lEvent & WS_FD_OOB)
FD_SET(async_ctl.ws_sock->fd, &fd_excp);
if( async_ctl.lEvent & (WS_FD_ACCEPT | WS_FD_READ |
WS_FD_CONNECT | WS_FD_CLOSE) )
FD_SET(async_ctl.ws_sock->fd, &fd_read);
if( async_ctl.lEvent & (WS_FD_WRITE | WS_FD_CONNECT) )
FD_SET(async_ctl.ws_sock->fd, &fd_write);
}
static void setup_sig_sets(sigset_t* sig_block)
{
sigemptyset(sig_block);
sigaddset(sig_block, SIGUSR1);
sigprocmask( SIG_BLOCK, sig_block, NULL);
signal( SIGUSR1, _sigusr1_handler_child );
}
void WINSOCK_do_async_select()
{
sigset_t sig_block;
int bytes;
setup_sig_sets(&sig_block);
setup_fd_sets();
while(1)
{
int val;
sigprocmask( SIG_UNBLOCK, &sig_block, NULL);
#if __WS_ASYNC_DEBUG
printf("select(2)[%i,%i,%i]... ",
FD_ISSET(async_ctl.ws_sock->fd, &fd_read),
FD_ISSET(async_ctl.ws_sock->fd, &fd_write),
FD_ISSET(async_ctl.ws_sock->fd, &fd_excp));
#endif
if( (val = select(async_ctl.ws_sock->fd + 1,
&fd_read, &fd_write, &fd_excp, NULL)) == -1 )
if( errno == EINTR ) continue;
#if __WS_ASYNC_DEBUG
printf("got %i events\n", val);
#endif
#if __WS_ASYNC_DEBUG
if( FD_ISSET(async_ctl.ws_sock->fd, &fd_read) )
printf("handler - read is READY! [%08x]\n", async_ctl.lEvent & (WS_FD_READ | WS_FD_CLOSE));
#endif
sigprocmask( SIG_BLOCK, &sig_block, NULL);
async_ctl.ip.lParam = 0;
if( async_ctl.ws_sock->flags & WS_FD_ACCEPT )
{
/* listening socket */
FD_CLR(async_ctl.ws_sock->fd, &fd_read);
FD_CLR(async_ctl.ws_sock->fd, &fd_write);
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_ACCEPT, 0 );
notify_parent( WSMSG_ASYNC_SELECT );
continue;
}
else /* I/O socket */
{
if( async_ctl.lEvent & WS_FD_CONNECT )
{
if( FD_ISSET(async_ctl.ws_sock->fd, &fd_write) )
{
/* success - reinit fd sets to start I/O */
if( async_ctl.lEvent & (WS_FD_READ | WS_FD_CLOSE))
FD_SET(async_ctl.ws_sock->fd, &fd_read);
else FD_CLR(async_ctl.ws_sock->fd, &fd_read);
if( async_ctl.lEvent & WS_FD_WRITE )
FD_SET(async_ctl.ws_sock->fd, &fd_write);
else FD_CLR(async_ctl.ws_sock->fd, &fd_write);
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_CONNECT, 0 );
async_ctl.lEvent &= ~WS_FD_CONNECT; /* one-shot */
}
else if( FD_ISSET(async_ctl.ws_sock->fd, &fd_read) )
{
/* failure - do read() to get correct errno */
if( read(async_ctl.ws_sock->fd, &bytes, 4) == -1 )
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_CONNECT, wsaErrno() );
else continue;
} else continue; /* OOB?? */
notify_parent( WSMSG_ASYNC_SELECT );
}
else /* connected socket */
{
if( async_ctl.lEvent & WS_FD_OOB )
if( FD_ISSET(async_ctl.ws_sock->fd, &fd_excp) )
{
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_OOB, 0 );
async_ctl.lEvent &= ~WS_FD_OOB;
FD_CLR(async_ctl.ws_sock->fd, &fd_excp);
notify_parent( WSMSG_ASYNC_SELECT );
}
else FD_SET(async_ctl.ws_sock->fd, &fd_excp);
if( async_ctl.lEvent & WS_FD_WRITE )
if( FD_ISSET( async_ctl.ws_sock->fd, &fd_write ) )
{
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_WRITE, 0 );
async_ctl.lEvent &= ~WS_FD_WRITE;
FD_CLR(async_ctl.ws_sock->fd, &fd_write);
notify_parent( WSMSG_ASYNC_SELECT );
}
else FD_SET(async_ctl.ws_sock->fd, &fd_write);
if( async_ctl.lEvent & (WS_FD_READ | WS_FD_CLOSE) )
if( FD_ISSET(async_ctl.ws_sock->fd, &fd_read) )
{
if( ioctl( async_ctl.ws_sock->fd, FIONREAD, (char*)&bytes) != -1 )
{
if( bytes ) /* got data */
{
#if __WS_ASYNC_DEBUG
printf("\t%i bytes pending\n", bytes );
#endif
if( async_ctl.lEvent & WS_FD_READ )
{
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_READ, 0 );
async_ctl.lEvent &= ~WS_FD_READ;
if( !(async_ctl.lEvent & WS_FD_CLOSE) )
FD_CLR( async_ctl.ws_sock->fd, &fd_read );
}
else if( !(async_ctl.lEvent & (WS_FD_WRITE | WS_FD_OOB)) )
{
sigprocmask( SIG_UNBLOCK, &sig_block, NULL);
pause();
sigprocmask( SIG_BLOCK, &sig_block, NULL);
}
else continue;
}
else /* 0 bytes to read */
{
val = read( async_ctl.ws_sock->fd, (char*)&bytes, 4);
if( errno == EWOULDBLOCK || errno == EINTR )
{
#if __WS_ASYNC_DEBUG
printf("\twould block..\n");
#endif
continue;
}
switch( val )
{
case 0: errno = ENETDOWN; /* ENETDOWN */
case -1: /* ECONNRESET */
async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_CLOSE, wsaErrno() );
break;
default: continue;
}
async_ctl.lEvent &= ~(WS_FD_CLOSE | WS_FD_READ); /* one-shot */
FD_ZERO(&fd_read); FD_ZERO(&fd_write);
}
}
else async_ctl.ip.lParam = WSAMAKESELECTREPLY( WS_FD_READ, wsaErrno() );
notify_parent( WSMSG_ASYNC_SELECT );
}
else FD_SET(async_ctl.ws_sock->fd, &fd_read);
} /* connected socket */
} /* I/O socket */
} /* while */
}
/* ----------------------------------- getXbyY requests */
static void _async_fail()
{
async_ctl.lLength =
(h_errno < 0) ? (unsigned)WSAMAKEASYNCREPLY( 0, wsaErrno() )
: (unsigned)WSAMAKEASYNCREPLY( 0, wsaHerrno() );
write(async_ctl.ws_aop->fd[1], &async_ctl.lLength, sizeof(unsigned) );
kill(getppid(), SIGIO); /* simulate async I/O */
pause();
}
void dump_ws_hostent_offset(struct ws_hostent* wshe)
{
int i;
char* base = (char*)wshe;
unsigned* ptr;
printf("h_name = %08x\t[%s]\n", (unsigned)wshe->h_name, base + (unsigned)wshe->h_name);
printf("h_aliases = %08x\t[%08x]\n", (unsigned)wshe->h_aliases,
(unsigned)(base + (unsigned)wshe->h_aliases));
ptr = (unsigned*)(base + (unsigned)wshe->h_aliases);
for(i = 0; ptr[i]; i++ )
{
printf("%i - %08x ", i + 1, ptr[i]);
printf(" [%s]\n", ((char*)base) + ptr[i]);
}
printf("h_length = %i\n", wshe->h_length);
}
void WS_do_async_gethost(LPWSINFO pwsi, unsigned flag )
{
int size = 0;
struct hostent* p_he;
close(async_ctl.ws_aop->fd[0]);
p_he = (flag & WSMSG_ASYNC_HOSTBYNAME)
? gethostbyname(async_ctl.ws_aop->init)
: gethostbyaddr(async_ctl.ws_aop->init,
async_ctl.lLength, async_ctl.lEvent);
if( p_he ) size = WS_dup_he(pwsi, p_he, WS_DUP_SEGPTR | WS_DUP_OFFSET );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.lLength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
notify_parent( flag );
}
else _async_fail();
_exit(0);
}
void WS_do_async_getproto(LPWSINFO pwsi, unsigned flag )
{
int size = 0;
struct protoent* p_pe;
close(async_ctl.ws_aop->fd[0]);
p_pe = (flag & WSMSG_ASYNC_PROTOBYNAME)
? getprotobyname(async_ctl.ws_aop->init)
: getprotobynumber(async_ctl.lEvent);
if( p_pe ) size = WS_dup_pe(pwsi, p_pe, WS_DUP_SEGPTR | WS_DUP_OFFSET );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.lLength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
notify_parent( flag );
}
else _async_fail();
_exit(0);
}
void WS_do_async_getserv(LPWSINFO pwsi, unsigned flag )
{
int size = 0;
struct servent* p_se;
close(async_ctl.ws_aop->fd[0]);
p_se = (flag & WSMSG_ASYNC_SERVBYNAME)
? getservbyname(async_ctl.ws_aop->init, async_ctl.buffer)
: getservbyport(async_ctl.lEvent, async_ctl.ws_aop->init);
if( p_se ) size = WS_dup_se(pwsi, p_se, WS_DUP_SEGPTR | WS_DUP_OFFSET );
if( size )
{
async_ctl.buffer = pwsi->buffer;
async_ctl.lLength = (unsigned)WSAMAKEASYNCREPLY( (UINT16)size, 0 );
notify_parent( flag );
}
else _async_fail();
_exit(0);
}

File diff suppressed because it is too large Load Diff

View File

@ -649,7 +649,6 @@ static int INT21_GetCurrentDirectory( SIGCONTEXT *context )
}
lstrcpyn32A( ptr, DRIVE_GetDosCwd(drive), 64 );
if (!ptr[0]) strcpy( ptr, "\\" );
return 1;
}

View File

@ -91,7 +91,7 @@ BOOL sndPlaySound(LPCSTR lpszSoundName, UINT uFlags)
MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
if (hmmio == 0) {
dprintf_mmsys(stddeb, "sndPlaySound // searching in SystemSound List !\n");
GetProfileString("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
GetProfileString32A("Sounds", (LPSTR)lpszSoundName, "", str, sizeof(str));
if (strlen(str) == 0) return FALSE;
if ( (ptr = (LPSTR)strchr(str, ',')) != NULL) *ptr = '\0';
hmmio = mmioOpen(str, NULL, MMIO_ALLOCBUF | MMIO_READ | MMIO_DENYWRITE);
@ -586,7 +586,7 @@ DWORD mciOpen(DWORD dwParam, LPMCI_OPEN_PARMS lp16Parms)
s=(char*)PTR_SEG_TO_LIN(lpParms->lpstrElementName);
t=strrchr(s,'.');
if (t) {
GetProfileString("mci extensions",t+1,"*",str,sizeof(str));
GetProfileString32A("mci extensions",t+1,"*",str,sizeof(str));
AnsiUpper(str);
if (strcmp(str, "CDAUDIO") == 0) {
uDevTyp = MCI_DEVTYPE_CD_AUDIO;
@ -745,7 +745,7 @@ DWORD mciSysInfo(DWORD dwFlags, LPMCI_SYSINFO_PARMS lpParms)
InstalledCount = 0;
InstalledListLen = 0;
ptr = lpInstallNames = xmalloc(2048);
GetPrivateProfileString("mci", NULL, "", lpInstallNames, 2000, SysFile);
GetPrivateProfileString32A("mci", NULL, "", lpInstallNames, 2000, SysFile);
while(strlen(ptr) > 0) {
dprintf_mci(stddeb, "---> '%s' \n", ptr);
len = strlen(ptr) + 1;

View File

@ -418,6 +418,24 @@ INT32 GetClipBox32( HDC32 hdc, LPRECT32 rect )
return ret;
}
/***********************************************************************
* GetClipRgn32 (GDI32.163)
*/
INT32 GetClipRgn32( HDC32 hdc, HRGN32 hRgn )
{
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if( dc && hRgn )
if( dc->w.hClipRgn )
{
/* this assumes that dc->w.hClipRgn is in coordinates
relative to the DC origin (not device) */
if( CombineRgn32(hRgn, dc->w.hClipRgn, 0, RGN_COPY) != ERROR )
return 1;
}
else return 0;
return -1;
}
/***********************************************************************
* SaveVisRgn (GDI.129)

View File

@ -718,20 +718,37 @@ WORD SetTextAlign( HDC16 hdc, WORD textAlign )
}
/***********************************************************************
* GetDCOrgEx (GDI32.168)
*/
BOOL32 GetDCOrgEx(HDC32 hDC, LPPOINT32 lpp)
{
DC * dc = (DC *) GDI_GetObjPtr( hDC, DC_MAGIC );
if (!dc || !lpp) return FALSE;
if (!(dc->w.flags & DC_MEMORY))
{
Window root;
int w, h, border, depth;
XGetGeometry( display, dc->u.x.drawable, &root,
&lpp->x, &lpp->y, &w, &h, &border, &depth );
}
else lpp->x = lpp->y = 0;
lpp->x += dc->w.DCOrgX; lpp->y += dc->w.DCOrgY;
return TRUE;
}
/***********************************************************************
* GetDCOrg (GDI.79)
*/
DWORD GetDCOrg( HDC16 hdc )
{
Window root;
int x, y, w, h, border, depth;
DC * dc = (DC *) GDI_GetObjPtr( hdc, DC_MAGIC );
if (!dc) return 0;
if (dc->w.flags & DC_MEMORY) return 0;
XGetGeometry( display, dc->u.x.drawable, &root,
&x, &y, &w, &h, &border, &depth );
return MAKELONG( dc->w.DCOrgX + (WORD)x, dc->w.DCOrgY + (WORD)y );
POINT32 pt;
if( GetDCOrgEx( hdc, &pt) )
return MAKELONG( (WORD)pt.x, (WORD)pt.y );
return 0;
}

View File

@ -86,7 +86,6 @@ DC_GET_X_Y( DWORD, GetWindowExt, WndExtX, WndExtY ) /* GDI.96 */
DC_GET_X_Y( DWORD, GetWindowOrg, WndOrgX, WndOrgY ) /* GDI.97 */
DC_GET_VAL( HRGN32, InquireVisRgn, hVisRgn ) /* GDI.131 */
DC_GET_X_Y( DWORD, GetBrushOrg, brushOrgX, brushOrgY ) /* GDI.149 */
DC_GET_VAL( HRGN32, GetClipRgn, hClipRgn ) /* GDI.173 */
DC_GET_VAL( WORD, GetTextAlign, textAlign ) /* GDI.345 */
DC_GET_VAL( HFONT16, GetCurLogFont, hFont ) /* GDI.411 */
DC_GET_VAL_EX( GetBrushOrgEx, brushOrgX, brushOrgY ) /* GDI.469 */
@ -95,3 +94,9 @@ DC_GET_VAL_EX( GetViewportExtEx, VportExtX, VportExtY ) /* GDI.472 */
DC_GET_VAL_EX( GetViewportOrgEx, VportOrgX, VportOrgY ) /* GDI.473 */
DC_GET_VAL_EX( GetWindowExtEx, WndExtX, WndExtY ) /* GDI.474 */
DC_GET_VAL_EX( GetWindowOrgEx, WndOrgX, WndOrgY ) /* GDI.475 */
/* this one is wrong - Windows returns region that
is relative to the device and not to the DC origin */
DC_GET_VAL( HRGN16, GetClipRgn16, hClipRgn ) /* GDI.173 */

View File

@ -94,7 +94,8 @@ BOOL32 FONT_Init( void )
FontNames[4].window = "arial"; FontNames[4].x11 = "*-helvetica";
FontNames[5].window = "helv"; FontNames[5].x11 = "*-helvetica";
FontNames[6].window = "roman"; FontNames[6].x11 = "*-times";
FontSize = 7;
FontNames[7].window = "system"; FontNames[7].x11 = "*-helvetica";
FontSize = 8;
}
return TRUE;
}
@ -220,6 +221,20 @@ static XFontStruct * FONT_MatchFont( LOGFONT16 * font, DC * dc )
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) {
@ -1197,133 +1212,145 @@ void InitFontsList(void)
XFreeFontNames(names);
}
/*************************************************************************
* EnumFonts [GDI.70]
* We reuse EnumFontFamilies* for the callback function get the same
* structs (+ extra stuff at the end which will be ignored by the enum funcs)
*/
INT EnumFonts(HDC16 hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
INT16 EnumFonts16(HDC16 hDC, LPCSTR lpFaceName, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
{
HLOCAL16 hLog;
HLOCAL16 hMet;
HFONT16 hFont;
HFONT16 hOldFont;
LPLOGFONT16 lpLogFont;
LPTEXTMETRIC16 lptm;
LPSTR lpOldName;
char FaceName[LF_FACESIZE];
int nRet = 0;
int i;
dprintf_font(stddeb,"EnumFonts(%04x, %p='%s', %08lx, %08lx)\n",
hDC, lpFaceName, lpFaceName, (LONG)lpEnumFunc, lpData);
if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(LOGFONT16) + LF_FACESIZE );
lpLogFont = (LPLOGFONT16) GDI_HEAP_LIN_ADDR(hLog);
if (lpLogFont == NULL) {
fprintf(stderr,"EnumFonts // can't alloc LOGFONT struct !\n");
return 0;
}
hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC16) );
lptm = (LPTEXTMETRIC16) GDI_HEAP_LIN_ADDR(hMet);
if (lptm == NULL) {
GDI_HEAP_FREE(hLog);
fprintf(stderr, "EnumFonts // can't alloc TEXTMETRIC struct !\n");
return 0;
}
if (lpFaceName != NULL) {
strcpy(FaceName, lpFaceName);
AnsiUpper(FaceName);
}
lpOldName = NULL;
if (lpLogFontList[0] == NULL) InitFontsList();
for(i = 0; lpLogFontList[i] != NULL; i++) {
if (lpFaceName == NULL) {
if (lpOldName != NULL) {
if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue;
}
lpOldName = lpLogFontList[i]->lfFaceName;
} else {
if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue;
}
dprintf_font(stddeb,"EnumFonts // enum '%s' !\n", lpLogFontList[i]->lfFaceName);
dprintf_font(stddeb,"EnumFonts // %p !\n", lpLogFontList[i]);
memcpy(lpLogFont, lpLogFontList[i], sizeof(LOGFONT16) + LF_FACESIZE);
hFont = CreateFontIndirect16(lpLogFont);
hOldFont = SelectObject32(hDC, hFont);
GetTextMetrics16(hDC, lptm);
SelectObject32(hDC, hOldFont);
DeleteObject32(hFont);
dprintf_font(stddeb,"EnumFonts // i=%d lpLogFont=%p lptm=%p\n", i, lpLogFont, lptm);
nRet = lpEnumFunc( GDI_HEAP_SEG_ADDR(hLog), GDI_HEAP_SEG_ADDR(hMet),
0, (LONG)lpData );
if (nRet == 0) {
dprintf_font(stddeb,"EnumFonts // EnumEnd requested by application !\n");
break;
}
}
GDI_HEAP_FREE(hMet);
GDI_HEAP_FREE(hLog);
return nRet;
return EnumFontFamilies16(hDC,lpFaceName,lpEnumFunc,lpData);
}
/*************************************************************************
* EnumFontsA [GDI32.84]
*/
INT32 EnumFonts32A(HDC32 hDC, LPCSTR lpFaceName, FONTENUMPROC32A lpEnumFunc, LPARAM lpData)
{
return EnumFontFamilies32A(hDC,lpFaceName,lpEnumFunc,lpData);
}
/*************************************************************************
* EnumFontsA [GDI32.84]
*/
INT32 EnumFonts32W(HDC32 hDC, LPCWSTR lpFaceName, FONTENUMPROC32W lpEnumFunc, LPARAM lpData)
{
return EnumFontFamilies32W(hDC,lpFaceName,lpEnumFunc,lpData);
}
/*************************************************************************
* EnumFontFamilies [GDI.330]
*/
INT16 EnumFontFamilies16(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc, LPARAM lpData)
{
LOGFONT16 LF;
if (lpszFamily)
strcpy(LF.lfFaceName,lpszFamily);
else
LF.lfFaceName[0]='\0';
LF.lfCharSet = DEFAULT_CHARSET;
return EnumFontFamiliesEx16(hDC,&LF,(FONTENUMPROCEX16)lpEnumFunc,lpData,0);
}
/*************************************************************************
* EnumFontFamiliesA [GDI32.80]
*/
INT32 EnumFontFamilies32A(HDC32 hDC, LPCSTR lpszFamily, FONTENUMPROC32A lpEnumFunc, LPARAM lpData)
{
LOGFONT32A LF;
if (lpszFamily)
strcpy(LF.lfFaceName,lpszFamily);
else
LF.lfFaceName[0]='\0';
LF.lfCharSet = DEFAULT_CHARSET;
return EnumFontFamiliesEx32A(hDC,&LF,(FONTENUMPROCEX32A)lpEnumFunc,lpData,0);
}
/*************************************************************************
* EnumFontFamiliesW [GDI32.83]
*/
INT32 EnumFontFamilies32W(HDC32 hDC, LPCWSTR lpszFamilyW, FONTENUMPROC32W lpEnumFunc, LPARAM lpData)
{
LOGFONT32W LF;
if (lpszFamilyW)
lstrcpy32W(LF.lfFaceName,lpszFamilyW);
else
LF.lfFaceName[0]=0;
LF.lfCharSet = DEFAULT_CHARSET;
return EnumFontFamiliesEx32W(hDC,&LF,(FONTENUMPROCEX32W)lpEnumFunc,lpData,0);
}
/*************************************************************************
* EnumFontFamiliesEx [GDI.618]
* FIXME: fill the rest of the NEWTEXTMETRICEX and ENUMLOGFONTEX structures.
* (applies to all EnumFontFamiliesEx*)
* winelib/16 support.
*/
INT16 EnumFontFamiliesEx16(HDC16 hDC, LPLOGFONT16 lpLF, FONTENUMPROCEX16 lpEnumFunc, LPARAM lpData,DWORD reserved)
{
HLOCAL16 hLog;
HLOCAL16 hMet;
HFONT16 hFont;
HFONT16 hOldFont;
LPENUMLOGFONT16 lpEnumLogFont;
LPTEXTMETRIC16 lptm;
LPENUMLOGFONTEX16 lpEnumLogFont;
LPNEWTEXTMETRICEX16 lptm;
LPSTR lpOldName;
char FaceName[LF_FACESIZE];
int nRet = 0;
int i;
dprintf_font(stddeb,"EnumFontFamilies(%04x, %p, %08lx, %08lx)\n",
hDC, lpszFamily, (DWORD)lpEnumFunc, lpData);
dprintf_font(stddeb,"EnumFontFamiliesEx(%04x, '%s', %08lx, %08lx, %08lx)\n",
hDC, lpLF->lfFaceName, (DWORD)lpEnumFunc, lpData, reserved);
if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT16) );
lpEnumLogFont = (LPENUMLOGFONT16) GDI_HEAP_LIN_ADDR(hLog);
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONTEX16) );
lpEnumLogFont = (LPENUMLOGFONTEX16) GDI_HEAP_LIN_ADDR(hLog);
if (lpEnumLogFont == NULL) {
fprintf(stderr,"EnumFontFamilies // can't alloc LOGFONT struct !\n");
fprintf(stderr,"EnumFontFamiliesEx // can't alloc LOGFONT struct !\n");
return 0;
}
hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC16) );
lptm = (LPTEXTMETRIC16) GDI_HEAP_LIN_ADDR(hMet);
hMet = GDI_HEAP_ALLOC( sizeof(NEWTEXTMETRICEX16) );
lptm = (LPNEWTEXTMETRICEX16) GDI_HEAP_LIN_ADDR(hMet);
if (lptm == NULL) {
GDI_HEAP_FREE(hLog);
fprintf(stderr,"EnumFontFamilies // can't alloc TEXTMETRIC struct !\n");
fprintf(stderr,"EnumFontFamiliesEx // can't alloc TEXTMETRIC struct !\n");
return 0;
}
lpOldName = NULL;
if (lpszFamily != NULL) {
strcpy(FaceName, lpszFamily);
AnsiUpper(FaceName);
}
strcpy(FaceName,lpLF->lfFaceName);
AnsiUpper(lpLF->lfFaceName);
if (lpLogFontList[0] == NULL) InitFontsList();
for(i = 0; lpLogFontList[i] != NULL; i++) {
if (lpszFamily == NULL) {
if (lpOldName != NULL) {
if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue;
}
lpOldName = lpLogFontList[i]->lfFaceName;
/* lfCharSet */
if (lpLF->lfCharSet!=DEFAULT_CHARSET)
if (lpLogFontList[i]->lfCharSet != lpLF->lfCharSet)
continue;
/* lfPitchAndFamily only of importance in Hebrew and Arabic versions. */
/* lfFaceName */
if (FaceName[0]) {
if (strcmp(FaceName,lpLogFontList[i]->lfFaceName))
continue;
} else {
if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue;
if ((lpOldName!=NULL)&&!strcmp(lpOldName,lpLogFontList[i]->lfFaceName))
continue;
lpOldName=lpLogFontList[i]->lfFaceName;
}
memcpy(lpEnumLogFont, lpLogFontList[i], sizeof(LOGFONT16));
strcpy(lpEnumLogFont->elfFullName,"");
strcpy(lpEnumLogFont->elfStyle,"");
hFont = CreateFontIndirect16((LPLOGFONT16)lpEnumLogFont);
hOldFont = SelectObject32(hDC, hFont);
GetTextMetrics16(hDC, lptm);
GetTextMetrics16(hDC, (LPTEXTMETRIC16)lptm);
SelectObject32(hDC, hOldFont);
DeleteObject32(hFont);
dprintf_font(stddeb, "EnumFontFamilies // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm);
dprintf_font(stddeb, "EnumFontFamiliesEx // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm);
nRet = lpEnumFunc( GDI_HEAP_SEG_ADDR(hLog), GDI_HEAP_SEG_ADDR(hMet),
0, lpData );
@ -1338,66 +1365,74 @@ INT16 EnumFontFamilies16(HDC16 hDC, LPCSTR lpszFamily, FONTENUMPROC16 lpEnumFunc
}
/*************************************************************************
* EnumFontFamiliesA [GDI32.80]
* EnumFontFamiliesExA [GDI32.81]
* FIXME: Don't use 16 bit GDI heap functions (applies to EnumFontFamiliesEx32*)
*/
INT32 EnumFontFamilies32A(HDC32 hDC, LPCSTR lpszFamily, FONTENUMPROC32A lpEnumFunc, LPARAM lpData)
INT32 EnumFontFamiliesEx32A(HDC32 hDC, LPLOGFONT32A lpLF,FONTENUMPROCEX32A lpEnumFunc, LPARAM lpData,DWORD reserved)
{
HLOCAL16 hLog;
HLOCAL16 hMet;
HFONT32 hFont;
HFONT32 hOldFont;
LPENUMLOGFONT32A lpEnumLogFont;
LPTEXTMETRIC32A lptm;
LPENUMLOGFONTEX32A lpEnumLogFont;
LPNEWTEXTMETRICEX32A lptm;
LPSTR lpOldName;
char FaceName[LF_FACESIZE];
int nRet = 0;
int i;
dprintf_font(stddeb,"EnumFontFamilies32A(%04x, %p, %08lx, %08lx)\n",
hDC, lpszFamily, (DWORD)lpEnumFunc, lpData);
dprintf_font(stddeb,"EnumFontFamilies32A(%04x, %p, %08lx, %08lx, %08lx)\n",
hDC, lpLF->lfFaceName, (DWORD)lpEnumFunc, lpData,reserved);
if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT32A) );
lpEnumLogFont = (LPENUMLOGFONT32A) GDI_HEAP_LIN_ADDR(hLog);
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONTEX32A) );
lpEnumLogFont = (LPENUMLOGFONTEX32A) GDI_HEAP_LIN_ADDR(hLog);
if (lpEnumLogFont == NULL) {
fprintf(stderr,"EnumFontFamilies // can't alloc LOGFONT struct !\n");
return 0;
}
hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC32A) );
lptm = (LPTEXTMETRIC32A) GDI_HEAP_LIN_ADDR(hMet);
hMet = GDI_HEAP_ALLOC( sizeof(NEWTEXTMETRICEX32A) );
lptm = (LPNEWTEXTMETRICEX32A) GDI_HEAP_LIN_ADDR(hMet);
if (lptm == NULL) {
GDI_HEAP_FREE(hLog);
fprintf(stderr,"EnumFontFamilies32A // can't alloc TEXTMETRIC struct !\n");
return 0;
}
lpOldName = NULL;
if (lpszFamily != NULL) {
strcpy(FaceName, lpszFamily);
AnsiUpper(FaceName);
}
strcpy(FaceName,lpLF->lfFaceName);
AnsiUpper(lpLF->lfFaceName);
if (lpLogFontList[0] == NULL) InitFontsList();
for(i = 0; lpLogFontList[i] != NULL; i++) {
if (lpszFamily == NULL) {
if (lpOldName != NULL) {
if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue;
}
lpOldName = lpLogFontList[i]->lfFaceName;
/* lfCharSet */
if (lpLF->lfCharSet!=DEFAULT_CHARSET)
if (lpLogFontList[i]->lfCharSet != lpLF->lfCharSet)
continue;
/* lfPitchAndFamily only of importance in Hebrew and Arabic versions. */
/* lfFaceName */
if (FaceName[0]) {
if (strcmp(FaceName,lpLogFontList[i]->lfFaceName))
continue;
} else {
if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue;
if ((lpOldName!=NULL)&&!strcmp(lpOldName,lpLogFontList[i]->lfFaceName))
continue;
lpOldName=lpLogFontList[i]->lfFaceName;
}
FONT_LOGFONT16ToLOGFONT32A(lpLogFontList[i],&(lpEnumLogFont->elfLogFont));
strcpy(lpEnumLogFont->elfFullName,"");
strcpy(lpEnumLogFont->elfStyle,"");
strcpy(lpEnumLogFont->elfScript,"");
hFont = CreateFontIndirect32A((LPLOGFONT32A)lpEnumLogFont);
hOldFont = SelectObject32(hDC, hFont);
GetTextMetrics32A(hDC, lptm);
GetTextMetrics32A(hDC, (LPTEXTMETRIC32A)lptm);
SelectObject32(hDC, hOldFont);
DeleteObject32(hFont);
dprintf_font(stddeb, "EnumFontFamilies32A // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm);
dprintf_font(stddeb, "EnumFontFamiliesEx32A // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm);
nRet = lpEnumFunc( GDI_HEAP_LIN_ADDR(hLog), GDI_HEAP_LIN_ADDR(hMet),
0, lpData );
nRet = lpEnumFunc(lpEnumLogFont,lptm,0,lpData);
if (nRet == 0) {
dprintf_font(stddeb,"EnumFontFamilies32A // EnumEnd requested by application !\n");
dprintf_font(stddeb,"EnumFontFamiliesEx32A // EnumEnd requested by application !\n");
break;
}
}
@ -1406,66 +1441,76 @@ INT32 EnumFontFamilies32A(HDC32 hDC, LPCSTR lpszFamily, FONTENUMPROC32A lpEnumFu
return nRet;
}
/*************************************************************************
* EnumFontFamiliesW [GDI32.83]
* EnumFontFamiliesW [GDI32.82]
*/
INT32 EnumFontFamilies32W(HDC32 hDC, LPCWSTR lpszFamilyW, FONTENUMPROC32W lpEnumFunc, LPARAM lpData)
INT32 EnumFontFamiliesEx32W(HDC32 hDC, LPLOGFONT32W lpLF, FONTENUMPROCEX32W lpEnumFunc, LPARAM lpData, DWORD reserved)
{
HLOCAL16 hLog;
HLOCAL16 hMet;
HFONT32 hFont;
HFONT32 hOldFont;
LPENUMLOGFONT32W lpEnumLogFont;
LPTEXTMETRIC32W lptm;
LPENUMLOGFONTEX32W lpEnumLogFont;
LPNEWTEXTMETRICEX32W lptm;
LPSTR lpOldName;
char FaceName[LF_FACESIZE];
int nRet = 0;
int i;
LPCSTR lpszFamily=lpszFamilyW?STRING32_DupUniToAnsi(lpszFamilyW):NULL;
LPSTR lpszFamily=STRING32_DupUniToAnsi(lpLF->lfFaceName);
dprintf_font(stddeb,"EnumFontFamilies32W(%04x, %p, %08lx, %08lx)\n",
hDC, lpszFamily, (DWORD)lpEnumFunc, lpData);
if (lpEnumFunc == 0) return 0;
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONT32W) );
lpEnumLogFont = (LPENUMLOGFONT32W) GDI_HEAP_LIN_ADDR(hLog);
if (lpEnumLogFont == NULL) {
fprintf(stderr,"EnumFontFamilies32W // can't alloc LOGFONT struct !\n");
dprintf_font(stddeb,"EnumFontFamiliesEx32W(%04x, %p, %08lx, %08lx, %08lx)\n",
hDC, lpLF, (DWORD)lpEnumFunc, lpData,reserved);
if (lpEnumFunc == 0) {
free(lpszFamily);
return 0;
}
hMet = GDI_HEAP_ALLOC( sizeof(TEXTMETRIC32W) );
lptm = (LPTEXTMETRIC32W) GDI_HEAP_LIN_ADDR(hMet);
hLog = GDI_HEAP_ALLOC( sizeof(ENUMLOGFONTEX32W) );
lpEnumLogFont = (LPENUMLOGFONTEX32W) GDI_HEAP_LIN_ADDR(hLog);
if (lpEnumLogFont == NULL) {
fprintf(stderr,"EnumFontFamilies32W // can't alloc LOGFONT struct !\n");
free(lpszFamily);
return 0;
}
hMet = GDI_HEAP_ALLOC( sizeof(NEWTEXTMETRICEX32W) );
lptm = (LPNEWTEXTMETRICEX32W) GDI_HEAP_LIN_ADDR(hMet);
if (lptm == NULL) {
GDI_HEAP_FREE(hLog);
fprintf(stderr,"EnumFontFamilies32W // can't alloc TEXTMETRIC struct !\n");
free(lpszFamily);
return 0;
}
lpOldName = NULL;
if (lpszFamily != NULL) {
strcpy(FaceName, lpszFamily);
AnsiUpper(FaceName);
}
AnsiUpper(lpszFamily);
if (lpLogFontList[0] == NULL) InitFontsList();
for(i = 0; lpLogFontList[i] != NULL; i++) {
if (lpszFamily == NULL) {
if (lpOldName != NULL) {
if (strcmp(lpOldName,lpLogFontList[i]->lfFaceName) == 0) continue;
}
lpOldName = lpLogFontList[i]->lfFaceName;
/* lfCharSet */
if (lpLF->lfCharSet!=DEFAULT_CHARSET)
if (lpLogFontList[i]->lfCharSet != lpLF->lfCharSet)
continue;
/* lfPitchAndFamily only of importance in Hebrew and Arabic versions. */
/* lfFaceName */
if (lpszFamily[0]) {
if (strcmp(lpszFamily,lpLogFontList[i]->lfFaceName))
continue;
} else {
if (strcmp(FaceName, lpLogFontList[i]->lfFaceName) != 0) continue;
if ((lpOldName!=NULL)&&!strcmp(lpOldName,lpLogFontList[i]->lfFaceName))
continue;
lpOldName=lpLogFontList[i]->lfFaceName;
}
FONT_LOGFONT16ToLOGFONT32W(lpLogFontList[i],&(lpEnumLogFont->elfLogFont));
lstrcpynAtoW(lpEnumLogFont->elfFullName,"",1);
lstrcpynAtoW(lpEnumLogFont->elfStyle,"",1);
lstrcpynAtoW(lpEnumLogFont->elfScript,"",1);
hFont = CreateFontIndirect32W((LPLOGFONT32W)lpEnumLogFont);
hOldFont = SelectObject32(hDC, hFont);
GetTextMetrics32W(hDC, lptm);
GetTextMetrics32W(hDC, (LPTEXTMETRIC32W)lptm);
SelectObject32(hDC, hOldFont);
DeleteObject32(hFont);
dprintf_font(stddeb, "EnumFontFamilies32W // i=%d lpLogFont=%p lptm=%p\n", i, lpEnumLogFont, lptm);
nRet = lpEnumFunc( GDI_HEAP_LIN_ADDR(hLog), GDI_HEAP_LIN_ADDR(hMet),
0, lpData );
nRet = lpEnumFunc(lpEnumLogFont,lptm,0,lpData);
if (nRet == 0) {
dprintf_font(stddeb,"EnumFontFamilies32W // EnumEnd requested by application !\n");
break;
@ -1473,6 +1518,7 @@ INT32 EnumFontFamilies32W(HDC32 hDC, LPCWSTR lpszFamilyW, FONTENUMPROC32W lpEnum
}
GDI_HEAP_FREE(hMet);
GDI_HEAP_FREE(hLog);
free(lpszFamily);
return nRet;
}

View File

@ -13,7 +13,7 @@
static const char PEN_dash[] = { 5,3 }; /* ----- ----- ----- */
static const char PEN_dot[] = { 2,2 }; /* -- -- -- -- -- -- */
static const char PEN_dot[] = { 1,1 }; /* -- -- -- -- -- -- */
static const char PEN_dashdot[] = { 4,3,2,3 }; /* ---- -- ---- -- */
static const char PEN_dashdotdot[] = { 4,2,2,2,2,2 }; /* ---- -- -- ---- */

View File

@ -283,7 +283,7 @@ INT16 DrawText16( HDC16 hdc, LPCSTR str, INT16 i_count,
rect->right = rect->left + max_width;
rect->bottom = y;
}
return 1;
return y - rect->top;
}

View File

@ -592,7 +592,7 @@ static LRESULT WINHELP_TextWndProc (HWND hWnd, UINT msg, WPARAM wParam, LPARAM l
{
BOOL update = TRUE;
RECT rect;
INT16 Min, Max;
INT Min, Max;
INT CurPos = GetScrollPos(hWnd, SB_VERT);
GetScrollRange(hWnd, SB_VERT, &Min, &Max);
GetClientRect(hWnd, &rect);

View File

@ -60,20 +60,16 @@ HANDLE32 CreateFileMapping32A(HANDLE32 h,LPSECURITY_ATTRIBUTES ats,
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
hfile = _lcreat(lpName,1);
if(hfile == HFILE_ERROR) {
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
filemap_obj=(FILEMAP_OBJECT *)CreateKernelObject(sizeof(FILEMAP_OBJECT));
if(filemap_obj == NULL) {
_lclose(hfile);
SetLastError(ERROR_UNKNOWN);
return 0;
}
if (h==INVALID_HANDLE_VALUE)
h=_lcreat(lpName,1);/*FIXME*/
filemap_obj->common.magic = KERNEL_OBJECT_FILEMAP;
filemap_obj->hfile = hfile;
filemap_obj->hfile = h;
filemap_obj->prot = TranslateProtectionFlags(pot);
filemap_obj->size = hlow;
return (HANDLE32)filemap_obj;;
@ -97,7 +93,6 @@ HANDLE32 CreateFileMapping32W(HANDLE32 h,LPSECURITY_ATTRIBUTES ats,
/***********************************************************************
* MapViewOfFile (KERNEL32.385)
*
*/
LPVOID MapViewOfFile(HANDLE32 handle, DWORD access, DWORD offhi,
DWORD offlo, DWORD size)
@ -112,13 +107,25 @@ LPVOID MapViewOfFile(HANDLE32 handle, DWORD access, DWORD offhi,
LPVOID MapViewOfFileEx(HANDLE32 handle, DWORD access, DWORD offhi,
DWORD offlo, DWORD size, DWORD st)
{
if (!size) size = ((FILEMAP_OBJECT *)handle)->size;
return mmap ((caddr_t)st, size, ((FILEMAP_OBJECT *)handle)->prot,
FILEMAP_OBJECT *fmap = (FILEMAP_OBJECT*)handle;
if (!size) size = fmap->size;
if (!size) size = 1;
return mmap ((caddr_t)st, size, fmap->prot,
MAP_ANON|MAP_PRIVATE,
FILE_GetUnixHandle(((FILEMAP_OBJECT *)handle)->hfile),
FILE_GetUnixHandle(fmap->hfile),
offlo);
}
/***********************************************************************
* UnmapViewOfFile (KERNEL32.385)
*/
BOOL32 UnmapViewOfFile(LPVOID address) {
munmap(address,/*hmm*/1); /* FIXME: size? */
return TRUE;
}
/***********************************************************************
* GetFileInformationByHandle (KERNEL32.219)

View File

@ -150,7 +150,7 @@ BOOL16 CreateCaret( HWND32 hwnd, HBITMAP32 bitmap, INT32 width, INT32 height )
Caret.x = 0;
Caret.y = 0;
Caret.timeout = GetProfileInt( "windows", "CursorBlinkRate", 750 );
Caret.timeout = GetProfileInt32A( "windows", "CursorBlinkRate", 750 );
return TRUE;
}

View File

@ -282,7 +282,8 @@ HRGN32 DCE_GetVisRgn( HWND hwnd, WORD flags )
/* Get visible rectangle and create a region with it.
* do we really need to calculate vis rgns for X windows?
* - yes, to clip child windows.
* - yes, to clip child windows but we should skip
* siblings in this case.
*/
if (!wndPtr || !DCE_GetVisRect( wndPtr, !(flags & DCX_WINDOW), &rect ))
@ -377,7 +378,41 @@ static void DCE_SetDrawable( WND *wndPtr, DC *dc, WORD flags )
dc->u.x.drawable = wndPtr->window;
}
}
/***********************************************************************
* DCE_ExcludeRgn
*
* Translate given region from the wnd client to the DC coordinates
* and add it to the clipping region.
*/
INT16 DCE_ExcludeRgn( HDC32 hDC, WND* wnd, HRGN32 hRgn )
{
INT16 ret;
POINT32 pt = {0, 0};
HRGN32 hRgnClip = GetClipRgn16( hDC );
DCE *dce = firstDCE;
while (dce && (dce->hDC != hDC)) dce = dce->next;
if( dce )
{
MapWindowPoints32( wnd->hwndSelf, dce->hwndCurrent, &pt, 1);
if( dce->DCXflags & DCX_WINDOW )
{
wnd = WIN_FindWndPtr(dce->hwndCurrent);
pt.x += wnd->rectClient.left - wnd->rectWindow.left;
pt.y += wnd->rectClient.top - wnd->rectWindow.top;
}
}
else return ERROR;
OffsetRgn32(hRgn, pt.x, pt.y);
if( hRgnClip ) ret = CombineRgn32( hRgnClip, hRgnClip, hRgn, RGN_DIFF );
else
{
hRgnClip = InquireVisRgn( hDC );
ret = CombineRgn32( hRgn, hRgnClip, hRgn, RGN_DIFF );
SelectClipRgn32( hDC, hRgn );
}
return ret;
}
/***********************************************************************
* GetDCEx16 (USER.359)

View File

@ -376,7 +376,7 @@ LRESULT DefWindowProc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam,
if (wParam && wndPtr->text)
{
lstrcpyn32A( (LPSTR)PTR_SEG_TO_LIN(lParam), wndPtr->text, wParam );
result = (LRESULT)strlen( (LPSTR)PTR_SEG_TO_LIN(lParam) ) + 1;
result = (LRESULT)strlen( (LPSTR)PTR_SEG_TO_LIN(lParam) );
}
break;
@ -442,7 +442,7 @@ LRESULT DefWindowProc32A( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
if (wParam && wndPtr->text)
{
lstrcpyn32A( (LPSTR)lParam, wndPtr->text, wParam );
result = (LRESULT)strlen( (LPSTR)lParam ) + 1;
result = (LRESULT)strlen( (LPSTR)lParam );
}
break;

View File

@ -4,11 +4,13 @@
* Copyright 1993, 1994, 1996 Alexandre Julliard
*/
#include <ctype.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "windows.h"
#include "dialog.h"
#include "drive.h"
#include "heap.h"
#include "win.h"
#include "ldt.h"
@ -16,6 +18,7 @@
#include "user.h"
#include "winproc.h"
#include "message.h"
#include "sysmetrics.h"
#include "stddebug.h"
#include "debug.h"
@ -534,8 +537,22 @@ static HWND DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
{
rect.left += template.x * xUnit / 4;
rect.top += template.y * yUnit / 8;
if ( !(template.style & DS_ABSALIGN) && !(template.style & WS_CHILD) )
ClientToScreen16( owner, (POINT16 *)&rect );
if ( !(template.style & WS_CHILD) )
{
INT16 dX, dY;
if( !(template.style & DS_ABSALIGN) )
ClientToScreen16( owner, (POINT16 *)&rect );
/* try to fit it into the desktop */
if( (dX = rect.left + rect.right + SYSMETRICS_CXDLGFRAME
- SYSMETRICS_CXSCREEN) > 0 ) rect.left -= dX;
if( (dY = rect.top + rect.bottom + SYSMETRICS_CYDLGFRAME
- SYSMETRICS_CYSCREEN) > 0 ) rect.top -= dY;
if( rect.left < 0 ) rect.left = 0;
if( rect.top < 0 ) rect.top = 0;
}
}
if (procType != WIN_PROC_16)
@ -569,6 +586,9 @@ static HWND DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
dlgInfo->msgResult = 0; /* This is used to store the default button id */
dlgInfo->hDialogHeap = 0;
if (dlgInfo->hUserFont)
SendMessage32A( hwnd, WM_SETFONT, (WPARAM32)dlgInfo->hUserFont, 0 );
/* Create controls */
if (!DIALOG_CreateControls( wndPtr, dlgTemplate, template.nbItems,
@ -581,8 +601,6 @@ static HWND DIALOG_CreateIndirect( HINSTANCE32 hInst, LPCSTR dlgTemplate,
/* Send initialisation messages and set focus */
dlgInfo->hwndFocus = GetNextDlgTabItem32( hwnd, 0, FALSE );
if (dlgInfo->hUserFont)
SendMessage32A( hwnd, WM_SETFONT, (WPARAM32)dlgInfo->hUserFont, 0 );
if (SendMessage32A( hwnd, WM_INITDIALOG,
(WPARAM32)dlgInfo->hwndFocus, param ))
SetFocus32( dlgInfo->hwndFocus );
@ -1390,6 +1408,96 @@ static BOOL32 DIALOG_DlgDirSelect( HWND32 hwnd, LPSTR str, INT32 len,
}
/**********************************************************************
* DIALOG_DlgDirList
*
* Helper function for DlgDirList*
*/
static INT32 DIALOG_DlgDirList( HWND32 hDlg, LPCSTR spec, INT32 idLBox,
INT32 idStatic, UINT32 attrib, BOOL32 combo )
{
int drive;
HWND32 hwnd;
#define SENDMSG(msg,wparam,lparam) \
((attrib & DDL_POSTMSGS) ? PostMessage( hwnd, msg, wparam, lparam ) \
: SendMessage32A( hwnd, msg, wparam, lparam ))
dprintf_dialog( stddeb, "DlgDirList: %04x '%s' %d %d %04x\n",
hDlg, spec ? spec : "NULL", idLBox, idStatic, attrib );
if (spec && spec[0] && (spec[1] == ':'))
{
drive = toupper( spec[0] ) - 'A';
spec += 2;
if (!DRIVE_SetCurrentDrive( drive )) return FALSE;
}
else drive = DRIVE_GetCurrentDrive();
if (idLBox && ((hwnd = GetDlgItem( hDlg, idLBox )) != 0))
{
/* If the path exists and is a directory, chdir to it */
if (!spec || !spec[0] || DRIVE_Chdir( drive, spec )) spec = "*.*";
else
{
const char *p, *p2;
p = spec;
if ((p2 = strrchr( p, '\\' ))) p = p2 + 1;
if ((p2 = strrchr( p, '/' ))) p = p2 + 1;
if (p != spec)
{
BOOL32 ret = FALSE;
char *dir = HeapAlloc( SystemHeap, 0, p - spec );
if (dir)
{
lstrcpyn32A( dir, spec, p - spec );
ret = DRIVE_Chdir( drive, dir );
HeapFree( SystemHeap, 0, dir );
}
if (!ret) return FALSE;
spec = p;
}
}
dprintf_dialog( stddeb, "ListBoxDirectory: path=%c:\\%s mask=%s\n",
'A' + drive, DRIVE_GetDosCwd(drive), spec );
SENDMSG( combo ? CB_RESETCONTENT32 : LB_RESETCONTENT32, 0, 0 );
if ((attrib & DDL_DIRECTORY) && !(attrib & DDL_EXCLUSIVE))
{
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
attrib & ~(DDL_DIRECTORY | DDL_DRIVES),
(LPARAM)spec ) == LB_ERR)
return FALSE;
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32,
(attrib & (DDL_DIRECTORY | DDL_DRIVES)) | DDL_EXCLUSIVE,
(LPARAM)"*.*" ) == LB_ERR)
return FALSE;
}
else
{
if (SENDMSG( combo ? CB_DIR32 : LB_DIR32, attrib,
(LPARAM)spec ) == LB_ERR)
return FALSE;
}
}
if (idStatic && ((hwnd = GetDlgItem( hDlg, idStatic )) != 0))
{
char temp[512];
int drive = DRIVE_GetCurrentDrive();
strcpy( temp, "A:\\" );
temp[0] += drive;
lstrcpyn32A( temp + 3, DRIVE_GetDosCwd(drive), sizeof(temp)-3 );
AnsiLower( temp );
/* Can't use PostMessage() here, because the string is on the stack */
SetDlgItemText32A( hDlg, idStatic, temp );
}
return TRUE;
#undef SENDMSG
}
/**********************************************************************
* DlgDirSelect (USER.99)
*/
@ -1460,3 +1568,73 @@ BOOL32 DlgDirSelectComboBoxEx32W( HWND32 hwnd, LPWSTR str, INT32 len, INT32 id)
{
return DIALOG_DlgDirSelect( hwnd, (LPSTR)str, len, id, TRUE, TRUE, TRUE );
}
/**********************************************************************
* DlgDirList16 (USER.100)
*/
INT16 DlgDirList16( HWND16 hDlg, LPCSTR spec, INT16 idLBox, INT16 idStatic,
UINT16 attrib )
{
return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
}
/**********************************************************************
* DlgDirList32A (USER32.142)
*/
INT32 DlgDirList32A( HWND32 hDlg, LPCSTR spec, INT32 idLBox, INT32 idStatic,
UINT32 attrib )
{
return DIALOG_DlgDirList( hDlg, spec, idLBox, idStatic, attrib, FALSE );
}
/**********************************************************************
* DlgDirList32W (USER32.145)
*/
INT32 DlgDirList32W( HWND32 hDlg, LPCWSTR spec, INT32 idLBox, INT32 idStatic,
UINT32 attrib )
{
INT32 ret;
LPSTR specA = NULL;
if (spec) specA = STRING32_DupUniToAnsi(spec);
ret = DIALOG_DlgDirList( hDlg, specA, idLBox, idStatic, attrib, FALSE );
if (specA) free( specA );
return ret;
}
/**********************************************************************
* DlgDirListComboBox16 (USER.195)
*/
INT16 DlgDirListComboBox16( HWND16 hDlg, LPCSTR spec, INT16 idCBox,
INT16 idStatic, UINT16 attrib )
{
return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
}
/**********************************************************************
* DlgDirListComboBox32A (USER32.143)
*/
INT32 DlgDirListComboBox32A( HWND32 hDlg, LPCSTR spec, INT32 idCBox,
INT32 idStatic, UINT32 attrib )
{
return DIALOG_DlgDirList( hDlg, spec, idCBox, idStatic, attrib, TRUE );
}
/**********************************************************************
* DlgDirListComboBox32W (USER32.144)
*/
INT32 DlgDirListComboBox32W( HWND32 hDlg, LPCWSTR spec, INT32 idCBox,
INT32 idStatic, UINT32 attrib )
{
INT32 ret;
LPSTR specA = NULL;
if (spec) specA = STRING32_DupUniToAnsi(spec);
ret = DIALOG_DlgDirList( hDlg, specA, idCBox, idStatic, attrib, FALSE );
if (specA) free( specA );
return ret;
}

View File

@ -37,6 +37,7 @@
#include "shell.h"
#include "registers.h"
#include "xmalloc.h"
#include "keyboard.h"
#include "stddebug.h"
#include "debug.h"
#include "dde_proc.h"
@ -62,13 +63,9 @@ static XContext winContext = 0;
/* State variables */
BOOL MouseButtonsStates[NB_BUTTONS];
BOOL AsyncMouseButtonsStates[NB_BUTTONS];
BYTE KeyStateTable[256];
BYTE AsyncKeyStateTable[256];
BYTE InputKeyStateTable[256];
WPARAM16 lastEventChar = 0; /* this will have to be changed once
* ToAscii starts working */
static HWND32 captureWnd = 0;
static BOOL32 InputEnabled = TRUE;
@ -128,8 +125,8 @@ typedef union
unsigned long count : 16;
unsigned long code : 8;
unsigned long extended : 1;
unsigned long : 2;
unsigned long reserved : 2;
unsigned long unused : 2;
unsigned long win_internal : 2;
unsigned long context : 1;
unsigned long previous : 1;
unsigned long transition : 1;
@ -188,7 +185,7 @@ void EVENT_ProcessEvent( XEvent *event )
{
WND *pWnd;
if (XFindContext( display, ((XAnyEvent *)event)->window, winContext,
if (XFindContext( display, event->xany.window, winContext,
(char **)&pWnd ) != 0)
return; /* Not for a registered window */
@ -521,8 +518,16 @@ static void EVENT_key( XKeyEvent *event )
int ascii_chars = XLookupString(event, Str, 1, &keysym, &cs);
Str[ascii_chars] = '\0';
dprintf_key(stddeb,"WM_KEY??? : keysym=%lX, ascii chars=%u / %X / '%s'\n",
keysym, ascii_chars, Str[0], Str);
if (debugging_key)
{
char *ksname;
ksname = XKeysymToString(keysym);
if (!ksname)
ksname = "No Name";
fprintf(stddeb, "WM_KEY??? : keysym=%lX (%s), ascii chars=%u / %X / '%s'\n",
keysym, ksname, ascii_chars, Str[0], Str);
}
/* Ctrl-Alt-Return enters the debugger */
if ((keysym == XK_Return) && (event->type == KeyPress) &&
@ -556,6 +561,27 @@ static void EVENT_key( XKeyEvent *event )
vkey = modifier_key[key - 0xE1];
else if (key == 0xFF) /* DEL key */
vkey = VK_DELETE;
/* extended must also be set for ALT_R, CTRL_R,
INS, DEL, HOME, END, PAGE_UP, PAGE_DOWN, ARROW keys,
keypad / and keypad ENTER (SDK 3.1 Vol.3 p 138) */
switch (keysym)
{
case XK_Control_R :
case XK_Alt_R :
case XK_Insert :
case XK_Delete :
case XK_Home :
case XK_End :
case XK_Page_Up :
case XK_Page_Down :
case XK_Left :
case XK_Up :
case XK_Right :
case XK_Down :
case XK_KP_Divide :
case XK_KP_Enter :
extended = 1;
}
}
else if (key_type == 0) /* character key */
{
@ -568,24 +594,7 @@ static void EVENT_key( XKeyEvent *event )
{
#define vkcase(k,val) case k: vkey = val; break;
#define vkcase2(k1,k2,val) case k1: case k2: vkey = val; break;
/* I wish I had a bit-paired keyboard! */
vkcase('!','1'); vkcase('@','2'); vkcase('#','3');
vkcase('$','4'); vkcase('%','5'); vkcase('^','6');
vkcase('&','7'); vkcase('*','8'); vkcase('(','9');
vkcase(')','0');
vkcase2('`','~',0xc0);
vkcase2('-','_',0xbd);
vkcase2('=','+',0xbb);
vkcase2('[','{',0xdb);
vkcase2(']','}',0xdd);
vkcase2(';',':',0xba);
vkcase2('\'','\"',0xde);
vkcase2(',','<',0xbc);
vkcase2('.','>',0xbe);
vkcase2('/','?',0xbf);
vkcase2('\\','|',0xdc);
WINE_VKEY_MAPPINGS
#undef vkcase
#undef vkcase2
default:
@ -596,50 +605,41 @@ static void EVENT_key( XKeyEvent *event )
if (event->type == KeyPress)
{
if (!(KeyStateTable[vkey] & 0x80))
KeyStateTable[vkey] ^= 0x01;
KeyStateTable[vkey] |= 0x80;
if (!(InputKeyStateTable[vkey] & 0x80))
InputKeyStateTable[vkey] ^= 0x01;
InputKeyStateTable[vkey] |= 0x80;
keylp.lp1.count = 1;
keylp.lp1.code = LOBYTE(event->keycode) - 8;
keylp.lp1.extended = (extended ? 1 : 0);
keylp.lp1.reserved = (ascii_chars ? 1 : 0);
keylp.lp1.win_internal = 0;
keylp.lp1.context = ( (event->state & Mod1Mask) ||
(KeyStateTable[VK_MENU] & 0x80)) ? 1 : 0;
(InputKeyStateTable[VK_MENU] & 0x80)) ? 1 : 0;
keylp.lp1.previous = (KeyDown ? 0 : 1);
keylp.lp1.transition = 0;
dprintf_key(stddeb," wParam=%X, lParam=%lX\n",
vkey, keylp.lp2 );
dprintf_key(stddeb," KeyState=%X\n", KeyStateTable[vkey]);
hardware_event( KeyStateTable[VK_MENU] & 0x80 ? WM_SYSKEYDOWN : WM_KEYDOWN,
dprintf_key(stddeb," InputKeyState=%X\n", InputKeyStateTable[vkey]);
hardware_event( InputKeyStateTable[VK_MENU] & 0x80 ? WM_SYSKEYDOWN : WM_KEYDOWN,
vkey, keylp.lp2,
event->x_root - desktopX, event->y_root - desktopY,
event->time - MSG_WineStartTicks, 0 );
KeyDown = TRUE;
/* Currently we use reserved field in the scan-code byte to
* make it possible for TranslateMessage to recognize character keys
* and get them from lastEventChar global variable.
*
* ToAscii should handle it.
*/
if( ascii_chars ) lastEventChar = Str[0];
}
else
{
UINT sysKey = KeyStateTable[VK_MENU];
UINT sysKey = InputKeyStateTable[VK_MENU];
KeyStateTable[vkey] &= ~0x80;
InputKeyStateTable[vkey] &= ~0x80;
keylp.lp1.count = 1;
keylp.lp1.code = LOBYTE(event->keycode) - 8;
keylp.lp1.extended = (extended ? 1 : 0);
keylp.lp1.reserved = 0;
keylp.lp1.win_internal = 0;
keylp.lp1.context = (event->state & Mod1Mask ? 1 : 0);
keylp.lp1.previous = 1;
keylp.lp1.transition = 1;
dprintf_key(stddeb," wParam=%X, lParam=%lX\n",
vkey, keylp.lp2 );
dprintf_key(stddeb," KeyState=%X\n", KeyStateTable[vkey]);
dprintf_key(stddeb," InputKeyState=%X\n", InputKeyStateTable[vkey]);
hardware_event( sysKey & 0x80 ? WM_SYSKEYUP : WM_KEYUP,
vkey, keylp.lp2,
event->x_root - desktopX, event->y_root - desktopY,

View File

@ -834,7 +834,7 @@ void DrawFocusRect16( HDC16 hdc, const RECT16* rc )
{
RECT32 rect32;
CONV_RECT16TO32( rc, &rect32 );
return DrawFocusRect32( hdc, &rect32 );
DrawFocusRect32( hdc, &rect32 );
}

View File

@ -133,7 +133,6 @@ static HANDLE16 HOOK_SetHook( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst,
data->ownerQueue = hQueue;
data->ownerModule = hInst;
data->inHookProc = 0;
dprintf_hook( stddeb, "Setting hook %d: ret=%04x\n", id, handle );
/* Insert it in the correct linked list */
@ -148,6 +147,8 @@ static HANDLE16 HOOK_SetHook( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst,
data->next = HOOK_systemHooks[id - WH_MINHOOK];
HOOK_systemHooks[id - WH_MINHOOK] = handle;
}
dprintf_hook( stddeb, "Setting hook %d: ret=%04x [next=%04x]\n",
id, handle, data->next );
return handle;
}
@ -188,7 +189,7 @@ static BOOL32 HOOK_RemoveHook( HANDLE16 hook )
while (*prevHook && *prevHook != hook)
prevHook = &((HOOKDATA *)USER_HEAP_LIN_ADDR(*prevHook))->next;
if (!*prevHook) return FALSE;
if (!*prevHook) return FALSE;
*prevHook = data->next;
USER_HEAP_FREE( hook );
return TRUE;
@ -250,6 +251,33 @@ LRESULT HOOK_CallHooks( INT16 id, INT16 code, WPARAM16 wParam, LPARAM lParam )
}
/***********************************************************************
* HOOK_ResetQueueHooks
*/
void HOOK_ResetQueueHooks( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue;
if ((queue = (MESSAGEQUEUE *)GlobalLock16( hQueue )) != NULL)
{
HOOKDATA* data;
HHOOK hook;
int id;
for( id = WH_MINHOOK; id <= WH_MAXHOOK; id++ )
{
hook = queue->hooks[id - WH_MINHOOK];
while( hook )
{
if( (data = (HOOKDATA *)USER_HEAP_LIN_ADDR(hook)) )
{
data->ownerQueue = hQueue;
hook = data->next;
} else break;
}
}
}
}
/***********************************************************************
* HOOK_FreeModuleHooks
*/

View File

@ -3,47 +3,60 @@
*
* Copyright 1993 Bob Amstadt
*/
#include <stdio.h>
#include <string.h>
#include "win.h"
#include "windows.h"
#include "debug.h"
extern BOOL MouseButtonsStates[3];
extern BOOL AsyncMouseButtonsStates[3];
extern BYTE KeyStateTable[256];
extern BYTE AsyncKeyStateTable[256];
extern BYTE InputKeyStateTable[256];
BYTE AsyncKeyStateTable[256];
extern BYTE QueueKeyStateTable[256];
/**********************************************************************
* GetKeyState [USER.106]
* An application calls the GetKeyState function in response to a
* keyboard-input message. This function retrieves the state of the key
* at the time the input message was generated. (SDK 3.1 Vol 2. p 390)
*/
INT GetKeyState(INT keycode)
{
INT retval;
if (keycode >= 'a' && keycode <= 'z')
keycode += 'A' - 'a';
switch(keycode) {
case VK_LBUTTON:
return MouseButtonsStates[0];
retval = MouseButtonsStates[0];
case VK_MBUTTON:
return MouseButtonsStates[1];
retval = MouseButtonsStates[1];
case VK_RBUTTON:
return MouseButtonsStates[2];
retval = MouseButtonsStates[2];
default:
retval = ( (INT)(KeyStateTable[keycode] & 0x80) << 8 ) |
(INT)(KeyStateTable[keycode] & 0x01);
retval = ( (INT)(QueueKeyStateTable[keycode] & 0x80) << 8 ) |
(INT)(QueueKeyStateTable[keycode] & 0x01);
}
dprintf_key(stddeb, "GetKeyState(%x) -> %x\n", keycode, retval);
return retval;
}
/**********************************************************************
* GetKeyboardState [USER.222]
* An application calls the GetKeyboardState function in response to a
* keyboard-input message. This function retrieves the state of the keyboard
* at the time the input message was generated. (SDK 3.1 Vol 2. p 387)
*/
void GetKeyboardState(BYTE *lpKeyState)
{
if (lpKeyState != NULL) {
KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] >> 8;
KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] >> 8;
KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] >> 8;
memcpy(lpKeyState, KeyStateTable, 256);
QueueKeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] >> 8;
QueueKeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] >> 8;
QueueKeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] >> 8;
memcpy(lpKeyState, QueueKeyStateTable, 256);
}
}
@ -53,10 +66,10 @@ void GetKeyboardState(BYTE *lpKeyState)
void SetKeyboardState(BYTE *lpKeyState)
{
if (lpKeyState != NULL) {
memcpy(KeyStateTable, lpKeyState, 256);
MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON]? 0x8000: 0;
MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON]? 0x8000: 0;
MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON]? 0x8000: 0;
memcpy(QueueKeyStateTable, lpKeyState, 256);
MouseButtonsStates[0] = QueueKeyStateTable[VK_LBUTTON]? 0x8000: 0;
MouseButtonsStates[1] = QueueKeyStateTable[VK_MBUTTON]? 0x8000: 0;
MouseButtonsStates[2] = QueueKeyStateTable[VK_RBUTTON]? 0x8000: 0;
}
}
@ -92,13 +105,13 @@ int GetAsyncKeyState(int nKey)
break;
default:
retval = AsyncKeyStateTable[nKey] |
(KeyStateTable[nKey] ? 0x8000 : 0);
(InputKeyStateTable[nKey] ? 0x8000 : 0);
break;
}
memset( AsyncMouseButtonsStates, 0, 3 ); /* all states to false */
memset( AsyncKeyStateTable, 0, 256 );
dprintf_key(stddeb, "GetAsyncKeyState(%x) -> %x\n", nKey, retval);
return retval;
}

View File

@ -32,16 +32,15 @@
#define HWND_BROADCAST16 ((HWND16)0xffff)
#define HWND_BROADCAST32 ((HWND32)0xffffffff)
#define ASCII_CHAR_HACK 0x0800
typedef enum { SYSQ_MSG_ABANDON, SYSQ_MSG_SKIP, SYSQ_MSG_ACCEPT } SYSQ_STATUS;
extern WPARAM16 lastEventChar; /* event.c */
extern BOOL MouseButtonsStates[3];
extern BOOL AsyncMouseButtonsStates[3];
extern BYTE KeyStateTable[256];
extern BYTE InputKeyStateTable[256];
extern BYTE AsyncKeyStateTable[256];
BYTE QueueKeyStateTable[256];
extern MESSAGEQUEUE *pCursorQueue; /* queue.c */
extern MESSAGEQUEUE *pActiveQueue;
@ -292,24 +291,10 @@ static void MSG_JournalRecordMsg( MSG16 *msg )
SEGPTR_FREE(event);
}
/*****************************************************************
* MSG_JournalPlayBackIsAscii
*/
static BOOL MSG_JournalPlayBackIsAscii(WPARAM16 wParam)
{
return ((wParam>VK_HELP && wParam<VK_F1) ||
wParam == VK_SPACE ||
wParam == VK_ESCAPE ||
wParam == VK_RETURN ||
wParam == VK_TAB ||
wParam == VK_BACK);
}
/***********************************************************************
* MSG_JournalPlayBackMsg
*
* Get an EVENTMSG struct via call JOURNALPAYBACK hook function
* Get an EVENTMSG struct via call JOURNALPLAYBACK hook function
*/
static int MSG_JournalPlayBackMsg(void)
{
@ -332,29 +317,18 @@ static int MSG_JournalPlayBackMsg(void)
if (tmpMsg->message == WM_KEYDOWN || tmpMsg->message == WM_SYSKEYDOWN)
{
for (keyDown=i=0; i<256 && !keyDown; i++)
if (KeyStateTable[i] & 0x80)
if (InputKeyStateTable[i] & 0x80)
keyDown++;
if (!keyDown)
lParam |= 0x40000000;
AsyncKeyStateTable[wParam]=KeyStateTable[wParam] |= 0x80;
if (MSG_JournalPlayBackIsAscii(wParam))
{
lastEventChar= wParam; /* control TranslateMessage() */
lParam |= (LONG)((LONG)ASCII_CHAR_HACK*0x10000L);
if (!(KeyStateTable[VK_SHIFT] & 0x80) &&
!(KeyStateTable[VK_CAPITAL] & 0x80))
lastEventChar= tolower(lastEventChar);
if (KeyStateTable[VK_CONTROL] & 0x80)
lastEventChar&=0x1f;
}
AsyncKeyStateTable[wParam]=InputKeyStateTable[wParam] |= 0x80;
}
else /* WM_KEYUP, WM_SYSKEYUP */
{
lParam |= 0xC0000000;
AsyncKeyStateTable[wParam]=KeyStateTable[wParam] &= ~0x80;
AsyncKeyStateTable[wParam]=InputKeyStateTable[wParam] &= ~0x80;
}
if (KeyStateTable[VK_MENU] & 0x80)
if (InputKeyStateTable[VK_MENU] & 0x80)
lParam |= 0x20000000;
if (tmpMsg->paramH & 0x8000) /*special_key bit*/
lParam |= 0x01000000;
@ -373,9 +347,9 @@ static int MSG_JournalPlayBackMsg(void)
case WM_RBUTTONDOWN:MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=1;break;
case WM_RBUTTONUP: MouseButtonsStates[2]=AsyncMouseButtonsStates[2]=0;break;
}
AsyncKeyStateTable[VK_LBUTTON]= KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] << 8;
AsyncKeyStateTable[VK_MBUTTON]= KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] << 8;
AsyncKeyStateTable[VK_RBUTTON]= KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] << 8;
AsyncKeyStateTable[VK_LBUTTON]= InputKeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] << 8;
AsyncKeyStateTable[VK_MBUTTON]= InputKeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] << 8;
AsyncKeyStateTable[VK_RBUTTON]= InputKeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] << 8;
SetCursorPos(tmpMsg->paramL,tmpMsg->paramH);
lParam=MAKELONG(tmpMsg->paramL,tmpMsg->paramH);
wParam=0;
@ -644,7 +618,7 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
/* First handle a message put by SendMessage() */
if (msgQueue->wakeBits & QS_SENDMESSAGE)
while (msgQueue->wakeBits & QS_SENDMESSAGE)
QUEUE_ReceiveMessage( msgQueue );
/* Now handle a WM_QUIT message
@ -661,6 +635,7 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
msg->message = WM_QUIT;
msg->wParam = msgQueue->wExitCode;
msg->lParam = 0;
if( !peek ) msgQueue->wPostQMsg = 0;
break;
}
@ -695,7 +670,7 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
/* Check again for SendMessage */
if (msgQueue->wakeBits & QS_SENDMESSAGE)
while (msgQueue->wakeBits & QS_SENDMESSAGE)
QUEUE_ReceiveMessage( msgQueue );
/* Now find a WM_PAINT message */
@ -734,7 +709,7 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
if (!(flags & PM_NOYIELD))
{
UserYield();
if (msgQueue->wakeBits & QS_SENDMESSAGE)
while (msgQueue->wakeBits & QS_SENDMESSAGE)
QUEUE_ReceiveMessage( msgQueue );
}
if ((msgQueue->wakeBits & mask) & QS_TIMER)
@ -752,6 +727,21 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
}
/* We got a message */
if (flags & PM_REMOVE)
{
WORD message = msg->message;
if (message == WM_KEYDOWN || message == WM_SYSKEYDOWN)
{
BYTE *p = &QueueKeyStateTable[msg->wParam & 0xff];
if (!(*p & 0x80))
*p ^= 0x01;
*p |= 0x80;
}
else if (message == WM_KEYUP || message == WM_SYSKEYUP)
QueueKeyStateTable[msg->wParam & 0xff] &= ~0x80;
}
if (peek) return TRUE;
else return (msg->message != WM_QUIT);
}
@ -1013,7 +1003,7 @@ LRESULT SendMessage32A(HWND32 hwnd, UINT32 msg, WPARAM32 wParam, LPARAM lParam)
if (WINPROC_MapMsg32ATo16( msg, wParam, &msg16, &wParam16, &lParam ) == -1)
return 0;
ret = SendMessage16( hwnd, msg16, wParam16, lParam );
WINPROC_UnmapMsg32ATo16( msg16, wParam16, lParam );
WINPROC_UnmapMsg32ATo16( msg, wParam16, lParam );
return ret;
}
@ -1088,32 +1078,42 @@ void WaitMessage( void )
/***********************************************************************
* TranslateMessage (USER.113)
*
* This should call ToAscii but it is currently broken
* TranlateMessage translate virtual-key messages into character-messages,
* as follows :
* WM_KEYDOWN/WM_KEYUP combinations produce a WM_CHAR or WM_DEADCHAR message.
* ditto replacing WM_* with WM_SYS*
* This produces WM_CHAR messages only for keys mapped to ASCII characters
* by the keyboard driver.
*/
BOOL TranslateMessage( LPMSG16 msg )
{
UINT message = msg->message;
/* BYTE wparam[2]; */
BYTE wparam[2];
if ((message == WM_KEYDOWN) || (message == WM_KEYUP) ||
(message == WM_SYSKEYDOWN) || (message == WM_SYSKEYUP))
if ((debugging_msg
&& message != WM_MOUSEMOVE && message != WM_TIMER)
|| (debugging_key
&& message >= WM_KEYFIRST && message <= WM_KEYLAST))
fprintf(stddeb, "TranslateMessage(%s, %04x, %08lx)\n",
SPY_GetMsgName(msg->message), msg->wParam, msg->lParam);
if ((message == WM_KEYDOWN) || (message == WM_SYSKEYDOWN))
{
dprintf_msg(stddeb, "Translating key %04x, scancode %04x\n", msg->wParam,
HIWORD(msg->lParam) );
if (debugging_msg || debugging_key)
fprintf(stddeb, "Translating key %04x, scancode %04x\n",
msg->wParam, HIWORD(msg->lParam) );
if( HIWORD(msg->lParam) & ASCII_CHAR_HACK )
/* if( ToAscii( msg->wParam, HIWORD(msg->lParam), (LPSTR)&KeyStateTable,
wparam, 0 ) )
*/
/* FIXME : should handle ToAscii yielding 2 */
if (ToAscii(msg->wParam, HIWORD(msg->lParam), (LPSTR)&QueueKeyStateTable,
wparam, 0))
{
message += 2 - (message & 0x0001);
/* Map WM_KEY* to WM_*CHAR */
message += 2 - (message & 0x0001);
PostMessage( msg->hwnd, message, lastEventChar, msg->lParam );
PostMessage( msg->hwnd, message, wparam[0], msg->lParam );
return TRUE;
return TRUE;
}
}
return FALSE;

View File

@ -590,20 +590,28 @@ INT16 GetUpdateRgn( HWND32 hwnd, HRGN32 hrgn, BOOL32 erase )
*/
INT16 ExcludeUpdateRgn( HDC32 hdc, HWND32 hwnd )
{
INT32 retval = ERROR;
HRGN32 hrgn;
RECT16 rect;
WND * wndPtr;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return ERROR;
if ((hrgn = CreateRectRgn32( 0, 0, 0, 0 )) != 0)
if (wndPtr->hrgnUpdate)
{
retval = CombineRgn32( hrgn, InquireVisRgn(hdc),
(wndPtr->hrgnUpdate>1) ? wndPtr->hrgnUpdate : 0,
(wndPtr->hrgnUpdate>1) ? RGN_DIFF : RGN_COPY );
if (retval) SelectVisRgn( hdc, hrgn );
INT16 ret;
HRGN32 hrgn = CreateRectRgn32(wndPtr->rectWindow.left - wndPtr->rectClient.left,
wndPtr->rectWindow.top - wndPtr->rectClient.top,
wndPtr->rectClient.right - wndPtr->rectClient.left,
wndPtr->rectClient.bottom - wndPtr->rectClient.top);
if( wndPtr->hrgnUpdate > 1 )
CombineRgn32(hrgn, wndPtr->hrgnUpdate, 0, RGN_COPY);
/* do ugly coordinate translations in dce.c */
ret = DCE_ExcludeRgn( hdc, wndPtr, hrgn );
DeleteObject32( hrgn );
}
return retval;
return ret;
}
return GetClipBox16(hdc, &rect);
}

View File

@ -5,10 +5,12 @@
*/
#include <stdlib.h>
#include <signal.h>
#include "module.h"
#include "queue.h"
#include "task.h"
#include "win.h"
#include "hook.h"
#include "stddebug.h"
#include "debug.h"
@ -22,6 +24,8 @@ static MESSAGEQUEUE *sysMsgQueue = NULL;
static MESSAGEQUEUE *pMouseQueue = NULL; /* Queue for last mouse message */
static MESSAGEQUEUE *pKbdQueue = NULL; /* Queue for last kbd message */
extern void SIGNAL_MaskAsyncEvents(BOOL32);
MESSAGEQUEUE *pCursorQueue = NULL;
MESSAGEQUEUE *pActiveQueue = NULL;
@ -137,6 +141,9 @@ static HQUEUE16 QUEUE_CreateMsgQueue( int size )
* QUEUE_DeleteMsgQueue
*
* Unlinks and deletes a message queue.
*
* Note: We need to mask asynchronous events to make sure PostMessage works
* even in the signal handler.
*/
BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
{
@ -165,6 +172,8 @@ BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
senderQ = sq->hPrevSendingTask;
}
SIGNAL_MaskAsyncEvents( TRUE );
pPrev = &hFirstQueue;
while (*pPrev && (*pPrev != hQueue))
{
@ -173,6 +182,9 @@ BOOL32 QUEUE_DeleteMsgQueue( HQUEUE16 hQueue )
}
if (*pPrev) *pPrev = msgQueue->next;
msgQueue->self = 0;
SIGNAL_MaskAsyncEvents( FALSE );
GlobalFree16( hQueue );
return 1;
}
@ -333,6 +345,39 @@ void QUEUE_ReceiveMessage( MESSAGEQUEUE *queue )
dprintf_msg(stddeb,"ReceiveMessage: done!\n");
}
/***********************************************************************
* QUEUE_FlushMessage
*
* Try to reply to all pending sent messages on exit.
*/
void QUEUE_FlushMessages( HQUEUE16 hQueue )
{
MESSAGEQUEUE *queue = (MESSAGEQUEUE*)GlobalLock16( hQueue );
if( queue )
{
MESSAGEQUEUE *senderQ = (MESSAGEQUEUE*)GlobalLock16( queue->hSendingTask);
QSMCTRL* CtrlPtr = queue->smResultCurrent;
while( senderQ )
{
if( !(queue->hSendingTask = senderQ->hPrevSendingTask) )
queue->wakeBits &= ~QS_SENDMESSAGE;
QUEUE_SetWakeBit( senderQ, QS_SMPARAMSFREE );
queue->smResultCurrent = CtrlPtr;
while( senderQ->wakeBits & QS_SMRESULT ) OldYield();
senderQ->SendMessageReturn = 0;
senderQ->smResult = queue->smResultCurrent;
QUEUE_SetWakeBit( senderQ, QS_SMRESULT);
if( (senderQ = (MESSAGEQUEUE*)GlobalLock16( queue->hSendingTask)) )
CtrlPtr = senderQ->smResultInit;
}
queue->InSendMessageHandle = 0;
}
}
/***********************************************************************
* QUEUE_AddMsg
@ -344,12 +389,15 @@ BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG16 * msg, DWORD extraInfo )
int pos;
MESSAGEQUEUE *msgQueue;
SIGNAL_MaskAsyncEvents( TRUE );
if (!(msgQueue = (MESSAGEQUEUE *)GlobalLock16( hQueue ))) return FALSE;
pos = msgQueue->nextFreeMessage;
/* Check if queue is full */
if ((pos == msgQueue->nextMessage) && (msgQueue->msgCount > 0))
{
SIGNAL_MaskAsyncEvents( FALSE );
fprintf(stderr,"MSG_AddMsg // queue is full !\n");
return FALSE;
}
@ -361,6 +409,9 @@ BOOL32 QUEUE_AddMsg( HQUEUE16 hQueue, MSG16 * msg, DWORD extraInfo )
else pos = 0;
msgQueue->nextFreeMessage = pos;
msgQueue->msgCount++;
SIGNAL_MaskAsyncEvents( FALSE );
QUEUE_SetWakeBit( msgQueue, QS_POSTMESSAGE );
return TRUE;
}
@ -403,6 +454,8 @@ int QUEUE_FindMsg( MESSAGEQUEUE * msgQueue, HWND32 hwnd, int first, int last )
*/
void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
{
SIGNAL_MaskAsyncEvents( TRUE );
if (pos >= msgQueue->nextMessage)
{
for ( ; pos > msgQueue->nextMessage; pos--)
@ -420,6 +473,8 @@ void QUEUE_RemoveMsg( MESSAGEQUEUE * msgQueue, int pos )
}
msgQueue->msgCount--;
if (!msgQueue->msgCount) msgQueue->wakeBits &= ~QS_POSTMESSAGE;
SIGNAL_MaskAsyncEvents( FALSE );
}
@ -633,12 +688,18 @@ BOOL SetMessageQueue( int size )
}
queuePtr = (MESSAGEQUEUE *)GlobalLock16( hNewQueue );
SIGNAL_MaskAsyncEvents( TRUE );
/* Copy data and free the old message queue */
if ((hQueue = GetTaskQueue(0)) != 0)
{
MESSAGEQUEUE *oldQ = (MESSAGEQUEUE *)GlobalLock16( hQueue );
memcpy( &queuePtr->reserved2, &oldQ->reserved2,
(int)oldQ->messages - (int)(&oldQ->reserved2) );
HOOK_ResetQueueHooks( hNewQueue );
if( WIN_GetDesktop()->hmemTaskQ == hQueue )
WIN_GetDesktop()->hmemTaskQ = hNewQueue;
WIN_ResetQueueWindows( WIN_GetDesktop()->child, hQueue, hNewQueue );
QUEUE_DeleteMsgQueue( hQueue );
}
@ -648,8 +709,9 @@ BOOL SetMessageQueue( int size )
hFirstQueue = hNewQueue;
if( !queuePtr->next ) pCursorQueue = queuePtr;
SetTaskQueue( 0, hNewQueue );
SIGNAL_MaskAsyncEvents( FALSE );
return TRUE;
}

View File

@ -162,7 +162,7 @@ BOOL32 ScrollDC32( HDC32 hdc, INT32 dx, INT32 dy, const RECT32 *rc,
if( rectClip.left >= rectClip.right || rectClip.top >= rectClip.bottom )
return FALSE;
hrgnClip = GetClipRgn(hdc);
hrgnClip = GetClipRgn16(hdc);
hrgnScrollClip = CreateRectRgnIndirect32(&rectClip);
if( hrgnClip )

View File

@ -137,7 +137,7 @@ void SYSCOLOR_Init(void)
for (i = 0, p = DefSysColors; i < NUM_SYS_COLORS; i++, p += 2)
{
GetProfileString( "colors", p[0], p[1], buffer, 100 );
GetProfileString32A( "colors", p[0], p[1], buffer, 100 );
if (!sscanf( buffer, " %d %d %d", &r, &g, &b )) r = g = b = 0;
SYSCOLOR_SetColor( i, RGB(r,g,b) );
}

View File

@ -51,15 +51,15 @@ void SYSMETRICS_Init(void)
sysMetrics[SM_CYMIN] = SYSMETRICS_CYMIN;
sysMetrics[SM_CXSIZE] = SYSMETRICS_CXSIZE;
sysMetrics[SM_CYSIZE] = SYSMETRICS_CYSIZE;
sysMetrics[SM_CXFRAME] = GetProfileInt( "windows", "BorderWidth", 4 );
sysMetrics[SM_CXFRAME] = GetProfileInt32A( "windows", "BorderWidth", 4 );
sysMetrics[SM_CYFRAME] = sysMetrics[SM_CXFRAME];
sysMetrics[SM_CXMINTRACK] = SYSMETRICS_CXMINTRACK;
sysMetrics[SM_CYMINTRACK] = SYSMETRICS_CYMINTRACK;
sysMetrics[SM_CXDOUBLECLK] = (GetProfileInt( "windows","DoubleClickWidth", 4) + 1) & ~1;
sysMetrics[SM_CYDOUBLECLK] = (GetProfileInt( "windows","DoubleClickHeight", 4) + 1) & ~1;
sysMetrics[SM_CXICONSPACING] = GetProfileInt( "desktop","IconSpacing", 75);
sysMetrics[SM_CYICONSPACING] = GetProfileInt( "desktop","IconVerticalSpacing", 72);
sysMetrics[SM_MENUDROPALIGNMENT] = GetProfileInt( "windows","MenuDropAlignment", 0 );
sysMetrics[SM_CXDOUBLECLK] = (GetProfileInt32A( "windows","DoubleClickWidth", 4) + 1) & ~1;
sysMetrics[SM_CYDOUBLECLK] = (GetProfileInt32A( "windows","DoubleClickHeight", 4) + 1) & ~1;
sysMetrics[SM_CXICONSPACING] = GetProfileInt32A( "desktop","IconSpacing", 75);
sysMetrics[SM_CYICONSPACING] = GetProfileInt32A( "desktop","IconVerticalSpacing", 72);
sysMetrics[SM_MENUDROPALIGNMENT] = GetProfileInt32A( "windows","MenuDropAlignment", 0 );
sysMetrics[SM_PENWINDOWS] = 0;
sysMetrics[SM_DBCSENABLED] = 0;
sysMetrics[SM_CMETRICS] = SM_CMETRICS;

View File

@ -374,24 +374,24 @@ static void WIN_DestroyWindow( WND* wndPtr )
USER_HEAP_FREE( hwnd );
}
/***********************************************************************
* WIN_DestroyQueueWindows
* WIN_ResetQueueWindows
*/
void WIN_DestroyQueueWindows( WND* wnd, HQUEUE16 hQueue )
void WIN_ResetQueueWindows( WND* wnd, HQUEUE16 hQueue, HQUEUE16 hNew )
{
WND* next;
while (wnd)
{
next = wnd->next;
if (wnd->hmemTaskQ == hQueue) DestroyWindow( wnd->hwndSelf );
else WIN_DestroyQueueWindows( wnd->child, hQueue );
if (wnd->hmemTaskQ == hQueue)
if( hNew ) wnd->hmemTaskQ = hNew;
else DestroyWindow( wnd->hwndSelf );
else WIN_ResetQueueWindows( wnd->child, hQueue, hNew );
wnd = next;
}
}
/***********************************************************************
* WIN_CreateDesktopWindow
*
@ -736,8 +736,12 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
}
else wndPtr->wIDmenu = (UINT)cs->hMenu;
/* Send the WM_CREATE message */
/* Send the WM_CREATE message
* Perhaps we shouldn't allow width/height changes as well.
* See p327 in "Internals".
*/
maxPos.x = wndPtr->rectWindow.left; maxPos.y = wndPtr->rectWindow.top;
if (unicode)
{
if (!SendMessage32W( hwnd, WM_NCCREATE, 0, (LPARAM)cs)) wmcreate = -1;
@ -745,6 +749,8 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
OffsetRect16(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left,
maxPos.y - wndPtr->rectWindow.top);
wmcreate = SendMessage32W( hwnd, WM_CREATE, 0, (LPARAM)cs );
}
}
@ -755,6 +761,8 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
{
WINPOS_SendNCCalcSize( hwnd, FALSE, &wndPtr->rectWindow,
NULL, NULL, 0, &wndPtr->rectClient );
OffsetRect16(&wndPtr->rectWindow, maxPos.x - wndPtr->rectWindow.left,
maxPos.y - wndPtr->rectWindow.top);
wmcreate = SendMessage32A( hwnd, WM_CREATE, 0, (LPARAM)cs );
}
}
@ -799,7 +807,6 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
{
/* MinMaximize(hwnd, SW_SHOWMAXIMIZED, 1) */
POINT16 maxSize, maxPos, minTrack, maxTrack;
NC_GetMinMaxInfo( wndPtr, &maxSize, &maxPos, &minTrack, &maxTrack );
SetWindowPos( hwnd, 0, maxPos.x, maxPos.y, maxSize.x, maxSize.y,
((GetActiveWindow())? SWP_NOACTIVATE : 0) | SWP_FRAMECHANGED );

View File

@ -964,6 +964,82 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
case BM_SETSTYLE32:
*pmsg16 = (UINT16)msg32 + (BM_GETCHECK16 - BM_GETCHECK32);
return 0;
case LB_CARETOFF32:
case LB_CARETON32:
case LB_DELETESTRING32:
case LB_GETANCHORINDEX32:
case LB_GETCARETINDEX32:
case LB_GETCOUNT32:
case LB_GETCURSEL32:
case LB_GETHORIZONTALEXTENT32:
case LB_GETITEMDATA32:
case LB_GETITEMHEIGHT32:
case LB_GETSEL32:
case LB_GETSELCOUNT32:
case LB_GETTEXTLEN32:
case LB_GETTOPINDEX32:
case LB_RESETCONTENT32:
case LB_SELITEMRANGE32:
case LB_SELITEMRANGEEX32:
case LB_SETANCHORINDEX32:
case LB_SETCARETINDEX32:
case LB_SETCOLUMNWIDTH32:
case LB_SETCURSEL32:
case LB_SETHORIZONTALEXTENT32:
case LB_SETITEMDATA32:
case LB_SETITEMHEIGHT32:
case LB_SETSEL32:
case LB_SETTOPINDEX32:
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
return 0;
case LB_ADDSTRING32:
case LB_FINDSTRING32:
case LB_FINDSTRINGEXACT32:
case LB_INSERTSTRING32:
case LB_SELECTSTRING32:
case LB_DIR32:
case LB_ADDFILE32:
/* case LB_GETTEXT32: FIXME */
{
LPSTR str = SEGPTR_STRDUP( (LPSTR)*plparam );
if (!str) return -1;
*plparam = (LPARAM)SEGPTR_GET(str);
}
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
return 1;
case LB_GETITEMRECT32:
{
RECT16 *rect;
rect = (RECT16 *)SEGPTR_ALLOC( sizeof(RECT16) + sizeof(LPARAM) );
if (!rect) return -1;
*(LPARAM *)(rect + 1) = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(rect);
}
return 1;
case LB_GETSELITEMS32:
{
LPINT16 items;
*pwparam16 = (WPARAM16)MIN( wParam32, 0x7f80 ); /* Must be < 64K */
if (!(items = SEGPTR_ALLOC( *pwparam16 * sizeof(INT16)
+ sizeof(LPARAM)))) return -1;
*((LPARAM *)items)++ = *plparam; /* Store the previous lParam */
*plparam = (LPARAM)SEGPTR_GET(items);
}
return 1;
case LB_SETTABSTOPS32:
if (wParam32)
{
INT32 i;
LPINT16 stops;
*pwparam16 = (WPARAM16)MIN( wParam32, 0x7f80 ); /* Must be < 64K */
if (!(stops = SEGPTR_ALLOC( *pwparam16 * sizeof(INT16)
+ sizeof(LPARAM)))) return -1;
for (i = 0; i < *pwparam16; i++) stops[i] = *((LPINT32)*plparam+i);
*plparam = (LPARAM)SEGPTR_GET(stops);
return 1;
}
*pmsg16 = LB_SETTABSTOPS16;
return 0;
case WM_ACTIVATE:
case WM_CHARTOITEM:
case WM_COMMAND:
@ -1173,15 +1249,41 @@ INT32 WINPROC_MapMsg32ATo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*
* Unmap a message that was mapped from 32-bit Ansi to 16-bit.
*/
void WINPROC_UnmapMsg32ATo16( UINT16 msg, WPARAM16 wParam, LPARAM lParam )
void WINPROC_UnmapMsg32ATo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
{
switch(msg)
{
case LB_ADDFILE32:
case LB_ADDSTRING32:
case LB_DIR32:
case LB_FINDSTRING32:
case LB_FINDSTRINGEXACT32:
case LB_INSERTSTRING32:
case LB_SELECTSTRING32:
case LB_SETTABSTOPS32:
case WM_COMPAREITEM:
case WM_DELETEITEM:
case WM_DRAWITEM:
case WM_SETTEXT:
SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) );
break;
case LB_GETITEMRECT32:
{
RECT16 *rect = (RECT16 *)PTR_SEG_TO_LIN(lParam);
lParam = *(LPARAM *)(rect + 1);
CONV_RECT16TO32( rect, (RECT32 *)lParam );
SEGPTR_FREE( rect );
}
break;
case LB_GETSELITEMS32:
{
INT32 i;
LPINT16 items = (LPINT16)PTR_SEG_TO_LIN(lParam);
lParam = *((LPARAM *)items - 1);
for (i = 0; i < wParam; i++) *((LPINT32)lParam + i) = items[i];
SEGPTR_FREE( (LPARAM *)items - 1 );
}
break;
case WM_MEASUREITEM:
{
MEASUREITEMSTRUCT16 *mis = (MEASUREITEMSTRUCT16 *)PTR_SEG_TO_LIN(lParam);
@ -1242,9 +1344,6 @@ void WINPROC_UnmapMsg32ATo16( UINT16 msg, WPARAM16 wParam, LPARAM lParam )
SEGPTR_FREE( cs );
}
break;
case WM_SETTEXT:
SEGPTR_FREE( PTR_SEG_TO_LIN(lParam) );
break;
case WM_WINDOWPOSCHANGING:
case WM_WINDOWPOSCHANGED:
{
@ -1269,6 +1368,22 @@ INT32 WINPROC_MapMsg32WTo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
{
switch(msg32)
{
case LB_ADDSTRING32:
case LB_FINDSTRING32:
case LB_FINDSTRINGEXACT32:
case LB_INSERTSTRING32:
case LB_SELECTSTRING32:
case LB_DIR32:
case LB_ADDFILE32:
{
LPSTR str = SEGPTR_ALLOC( lstrlen32W((LPWSTR)*plparam) + 1 );
if (!str) return -1;
STRING32_UniToAnsi( str, (LPWSTR)*plparam );
*pmsg16 = (UINT16)msg32 + (LB_ADDSTRING16 - LB_ADDSTRING32);
*pwparam16 = (WPARAM16)LOWORD(wParam32);
*plparam = (LPARAM)SEGPTR_GET(str);
}
return 1;
case WM_NCCREATE:
case WM_CREATE:
{
@ -1344,7 +1459,7 @@ INT32 WINPROC_MapMsg32WTo16( UINT32 msg32, WPARAM32 wParam32, UINT16 *pmsg16,
*
* Unmap a message that was mapped from 32-bit Unicode to 16-bit.
*/
void WINPROC_UnmapMsg32WTo16( UINT16 msg, WPARAM16 wParam, LPARAM lParam )
void WINPROC_UnmapMsg32WTo16( UINT32 msg, WPARAM16 wParam, LPARAM lParam )
{
switch(msg)
{
@ -1461,7 +1576,7 @@ static LRESULT WINPROC_CallProc32ATo16( WNDPROC16 func, HWND32 hwnd,
if (wndPtr) CURRENT_DS = wndPtr->hInstance;
result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
CURRENT_DS = ds;
WINPROC_UnmapMsg32ATo16( msg16, wParam16, lParam );
WINPROC_UnmapMsg32ATo16( msg, wParam16, lParam );
return result;
}
@ -1486,7 +1601,7 @@ static LRESULT WINPROC_CallProc32WTo16( WNDPROC16 func, HWND32 hwnd,
if (wndPtr) CURRENT_DS = wndPtr->hInstance;
result = CallWndProc16( func, hwnd, msg16, wParam16, lParam );
CURRENT_DS = ds;
WINPROC_UnmapMsg32WTo16( msg16, wParam16, lParam );
WINPROC_UnmapMsg32WTo16( msg, wParam16, lParam );
return result;
}

View File

@ -9,7 +9,7 @@ wine \- run Windows programs under Unix
]
.I program_name
[
.I arguments
.I program_name...
]
.SH DESCRIPTION
.B wine