Release 960913

Wed Sep 11 18:08:30 1996  Albrecht Kleine  <kleine@ak.sax.de>

	* [windows/event.c]
	Minor improvements in setting event time in MSG struct.

	* [windows/hook.c]
	Removed an useless 'unimplemented hook' message.

	* [windows/win.c]
	Added a WH_CBT hook call during window creation: good for CTL3D.DLL

Wed Sep 11 11:19:56 1996  Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
	* [loader/pe_image.c]
	Fixed imports with no name/ordinal list (MFC30.DLL).
	Added borland style - ordinal import (wsock32.dll).

	* [files/file.c] [win32/file.c] [if1632/kernel.spec]
	  [if1632/kernel32.spec] [include/windows.h]
	Win32 and Win16 code use the same filehandles/HFILEs.
	Added SetEndOfFile, MoveFile*, diverse *W functions.

	* [loader/pe_image.c]
	Fixed argument 2 to DllEntry.

	* [misc/comm.c]
	Adapt to filehandling changes, win32 code still broken.

	* [misc/registry.c]
	Use Wine filehandling.
	StartupRegistry to add startup-detected registry entries.

	* [miscemu/dpmi.c] [miscemu/int21.c]
	Some missing interrupt-functions added.

	* [if1632/gdi32.spec][if1632/user32.spec]
	Some thunks to 16 bit equivalent functions added.

Sat Sep  7 11:36:57 EDT 1996  Matthew Ghio <ghio@netcom.com>

	* [misc/winsocket.c]
	Rewrote WINSOCK_select() and WSAFDIsSet() to properly convert
	Windows fd_set structs.

	* [if1632/winsock.spec]
	Corrected arguments to select().
This commit is contained in:
Alexandre Julliard 1996-09-13 16:50:47 +00:00
parent d1ce8b2831
commit 8bbf8180e5
78 changed files with 1500 additions and 914 deletions

View File

@ -1,13 +1,12 @@
This is release 960902 of Wine, the MS Windows emulator. This is still a
This is release 960913 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-960902: (see ChangeLog for details)
- JOURNALPLAYBACK hook.
- Multimedia support for FreeBSD.
WHAT'S NEW with Wine-960913: (see ChangeLog for details)
- Better Win32 file handling.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
@ -16,10 +15,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-960902.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-960902.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-960902.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-960902.tar.gz
ftp://sunsite.unc.edu/pub/Linux/ALPHA/wine/development/Wine-960913.tar.gz
ftp://tsx-11.mit.edu/pub/linux/ALPHA/Wine/development/Wine-960913.tar.gz
ftp://ftp.infomagic.com/pub/mirrors/linux/wine/development/Wine-960913.tar.gz
ftp://aris.com/pub/linux/ALPHA/Wine/development/Wine-960913.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.

View File

@ -1,3 +1,50 @@
----------------------------------------------------------------------
Wed Sep 11 18:08:30 1996 Albrecht Kleine <kleine@ak.sax.de>
* [windows/event.c]
Minor improvements in setting event time in MSG struct.
* [windows/hook.c]
Removed an useless 'unimplemented hook' message.
* [windows/win.c]
Added a WH_CBT hook call during window creation: good for CTL3D.DLL
Wed Sep 11 11:19:56 1996 Marcus Meissner <msmeissn@cip.informatik.uni-erlangen.de>
* [loader/pe_image.c]
Fixed imports with no name/ordinal list (MFC30.DLL).
Added borland style - ordinal import (wsock32.dll).
* [files/file.c] [win32/file.c] [if1632/kernel.spec]
[if1632/kernel32.spec] [include/windows.h]
Win32 and Win16 code use the same filehandles/HFILEs.
Added SetEndOfFile, MoveFile*, diverse *W functions.
* [loader/pe_image.c]
Fixed argument 2 to DllEntry.
* [misc/comm.c]
Adapt to filehandling changes, win32 code still broken.
* [misc/registry.c]
Use Wine filehandling.
StartupRegistry to add startup-detected registry entries.
* [miscemu/dpmi.c] [miscemu/int21.c]
Some missing interrupt-functions added.
* [if1632/gdi32.spec][if1632/user32.spec]
Some thunks to 16 bit equivalent functions added.
Sat Sep 7 11:36:57 EDT 1996 Matthew Ghio <ghio@netcom.com>
* [misc/winsocket.c]
Rewrote WINSOCK_select() and WSAFDIsSet() to properly convert
Windows fd_set structs.
* [if1632/winsock.spec]
Corrected arguments to select().
----------------------------------------------------------------------
Sun Sep 1 19:22:46 1996 Alexandre Julliard <julliard@lrc.epfl.ch>

View File

@ -123,14 +123,14 @@ LRESULT ButtonWndProc(HWND32 hWnd, UINT32 uMsg, WPARAM32 wParam, LPARAM lParam)
case WM_LBUTTONDOWN:
SendMessage32A( hWnd, BM_SETSTATE32, TRUE, 0 );
SetFocus( hWnd );
SetFocus32( hWnd );
SetCapture( hWnd );
break;
case WM_LBUTTONUP:
ReleaseCapture();
if (!(infoPtr->state & BUTTON_HIGHLIGHTED)) break;
SendMessage16( hWnd, BM_SETSTATE16, FALSE, 0 );
SendMessage32A( hWnd, BM_SETSTATE32, FALSE, 0 );
GetClientRect16( hWnd, &rect );
if (PtInRect16( &rect, MAKEPOINT16(lParam) ))
{

View File

@ -262,7 +262,7 @@ static LRESULT CBPaint(HWND hwnd, WPARAM wParam, LPARAM lParam)
if (lpls != NULL) {
FillRect16(hdc, &rect, hBrush);
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &rect, ODA_DRAWENTIRE, 0);
if (GetFocus() == hwnd)
if (GetFocus32() == hwnd)
ListBoxDrawItem (hwnd,lphl, hdc, lpls, &rect, ODA_FOCUS, ODS_FOCUS);
}
else FillRect16(hdc, &rect, hBrush);
@ -616,7 +616,7 @@ static LRESULT CBShowDropDown(HWND hwnd, WPARAM wParam, LPARAM lParam)
SetWindowPos(lphc->hWndLBox, 0, rect.left, rect.top+lphc->LBoxTop, 0, 0,
SWP_NOSIZE | SWP_NOACTIVATE |
(wParam ? SWP_SHOWWINDOW : SWP_HIDEWINDOW));
if (!wParam) SetFocus(hwnd);
if (!wParam) SetFocus32(hwnd);
}
return 0;
}
@ -960,7 +960,7 @@ static LRESULT CBLPaint( HWND hwnd, WPARAM wParam, LPARAM lParam )
ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_DRAWENTIRE,
lpls->itemState);
}
if ((lphl->ItemFocused == i) && GetFocus() == hwnd)
if ((lphl->ItemFocused == i) && GetFocus32() == hwnd)
ListBoxDrawItem (combohwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_FOCUS, ODS_FOCUS);
top += height;
@ -1007,7 +1007,7 @@ static LRESULT CBLLButtonDown( HWND hwnd, WPARAM wParam, LPARAM lParam )
int y;
RECT16 rectsel;
/* SetFocus(hwnd); */
/* SetFocus32(hwnd); */
SetCapture(hwnd);
lphl->PrevFocused = lphl->ItemFocused;

View File

@ -1270,7 +1270,7 @@ static void EDIT_PaintLine(WND *wndPtr, HDC hdc, UINT line, BOOL rev)
s = MIN(li + ll, MAX(li, s));
e = MIN(li + ll, MAX(li, e));
if (rev && (s != e) &&
((GetFocus() == wndPtr->hwndSelf) ||
((GetFocus32() == wndPtr->hwndSelf) ||
(wndPtr->dwStyle & ES_NOHIDESEL))) {
x += EDIT_PaintText(wndPtr, hdc, x, y, line, 0, s - li, FALSE);
x += EDIT_PaintText(wndPtr, hdc, x, y, line, s - li, e - s, TRUE);
@ -1852,7 +1852,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
dx = xoff - nxoff;
dy = EDIT_WndYFromLine(wndPtr, fv) - EDIT_WndYFromLine(wndPtr, nfv);
if (dx || dy) {
if (wndPtr->hwndSelf == GetFocus())
if (wndPtr->hwndSelf == GetFocus32())
HideCaret(wndPtr->hwndSelf);
if (EDIT_GetRedraw(wndPtr))
ScrollWindow(wndPtr->hwndSelf, dx, dy, NULL, NULL);
@ -1864,7 +1864,7 @@ static LRESULT EDIT_EM_LineScroll(WND *wndPtr, WPARAM wParam, LPARAM lParam)
if (IsHScrollBar(wndPtr))
SetScrollPos(wndPtr->hwndSelf, SB_HORZ,
EDIT_WM_HScroll(wndPtr, EM_GETTHUMB, 0L), TRUE);
if (wndPtr->hwndSelf == GetFocus()) {
if (wndPtr->hwndSelf == GetFocus32()) {
GetCaretPos16(&pos);
SetCaretPos(pos.x + dx, pos.y + dy);
ShowCaret(wndPtr->hwndSelf);
@ -2023,7 +2023,7 @@ static LRESULT EDIT_EM_SetSel(WND *wndPtr, WPARAM wParam, LPARAM lParam)
}
es->SelStart = ns;
es->SelEnd = ne;
if (wndPtr->hwndSelf == GetFocus()) {
if (wndPtr->hwndSelf == GetFocus32()) {
el = (UINT)EDIT_EM_LineFromChar(wndPtr, ne, 0L);
eli = (UINT)EDIT_EM_LineIndex(wndPtr, el, 0L);
SetCaretPos(EDIT_WndXFromCol(wndPtr, el, ne - eli),
@ -2603,7 +2603,7 @@ static LRESULT EDIT_WM_LButtonDown(WND *wndPtr, WPARAM wParam, LPARAM lParam)
UINT vlc = EDIT_GetVisibleLineCount(wndPtr);
UINT li;
SetFocus(wndPtr->hwndSelf);
SetFocus32(wndPtr->hwndSelf);
SetCapture(wndPtr->hwndSelf);
l = MIN(fv + vlc - 1, MAX(fv, l));
x = MIN(EDIT_GetWndWidth(wndPtr), MAX(0, x));
@ -2684,7 +2684,7 @@ static LRESULT EDIT_WM_Paint(WND *wndPtr, WPARAM wParam, LPARAM lParam)
RECT16 rcLine;
RECT16 rcRgn;
BOOL rev = IsWindowEnabled(wndPtr->hwndSelf) &&
((GetFocus() == wndPtr->hwndSelf) ||
((GetFocus32() == wndPtr->hwndSelf) ||
(wndPtr->dwStyle & ES_NOHIDESEL));
hdc = BeginPaint16(wndPtr->hwndSelf, &ps);
@ -2791,7 +2791,7 @@ static LRESULT EDIT_WM_SetFont(WND *wndPtr, WPARAM wParam, LPARAM lParam)
EDIT_BuildLineDefs(wndPtr);
if ((BOOL)lParam && EDIT_GetRedraw(wndPtr))
InvalidateRect32( wndPtr->hwndSelf, NULL, TRUE );
if (wndPtr->hwndSelf == GetFocus()) {
if (wndPtr->hwndSelf == GetFocus32()) {
DestroyCaret();
CreateCaret(wndPtr->hwndSelf, 0, 2, EDIT_GetLineHeight(wndPtr));
EDIT_EM_SetSel(wndPtr, 1, sel);

View File

@ -1047,7 +1047,7 @@ static LONG LBLButtonDown(HWND hwnd, WORD wParam, LONG lParam)
int y,n;
RECT16 rectsel;
SetFocus(hwnd);
SetFocus32(hwnd);
SetCapture(hwnd);
lphl->PrevFocused = lphl->ItemFocused;
@ -1480,7 +1480,7 @@ static LONG LBPaint(HWND hwnd, WORD wParam, LONG lParam)
dprintf_listbox(stddeb,"LBPaint: drawing item: %d %d %d %d %d\n",
rect.left,top,rect.right,top+height,lpls->itemState);
if (lphl->OwnerDrawn && (lphl->ItemFocused == i) && GetFocus() == hwnd)
if (lphl->OwnerDrawn && (lphl->ItemFocused == i) && GetFocus32() == hwnd)
{
ListBoxDrawItem (hwnd, lphl, hdc, lpls, &lpls->itemRect, ODA_FOCUS,
lpls->itemState & ~ODS_FOCUS);

View File

@ -490,7 +490,7 @@ static void SCROLL_RefreshScrollBar( HWND hwnd, int nBar )
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbPos );
hdc = (nBar == SB_CTL) ? GetDC(hwnd) : GetWindowDC(hwnd);
hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
if (!hdc) return;
SCROLL_DrawInterior( hwnd, hdc, nBar, &rect, arrowSize, thumbPos,
infoPtr->flags, vertical, FALSE, FALSE );
@ -556,7 +556,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT16 pt )
if (!infoPtr) return;
if ((trackHitTest == SCROLL_NOWHERE) && (msg != WM_LBUTTONDOWN)) return;
hdc = (nBar == SB_CTL) ? GetDC(hwnd) : GetWindowDC(hwnd);
hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
vertical = SCROLL_GetScrollBarRect( hwnd, nBar, &rect,
&arrowSize, &thumbPos );
hwndOwner = (nBar == SB_CTL) ? GetParent32(hwnd) : hwnd;
@ -571,7 +571,7 @@ void SCROLL_HandleScrollEvent( HWND hwnd, int nBar, WORD msg, POINT16 pt )
trackThumbPos = thumbPos;
prevPt = pt;
SetCapture( hwnd );
if (nBar == SB_CTL) SetFocus( hwnd );
if (nBar == SB_CTL) SetFocus32( hwnd );
break;
case WM_MOUSEMOVE:
@ -1007,7 +1007,7 @@ BOOL EnableScrollBar( HWND hwnd, UINT nBar, UINT flags )
infoPtr->flags = flags;
/* Redraw the whole scroll bar */
hdc = (nBar == SB_CTL) ? GetDC(hwnd) : GetWindowDC(hwnd);
hdc = GetDCEx( hwnd, 0, DCX_CACHE | ((nBar == SB_CTL) ? 0 : DCX_WINDOW) );
SCROLL_DrawScrollBar( hwnd, hdc, nBar );
ReleaseDC( hwnd, hdc );
return TRUE;

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = debugger

View File

@ -21,8 +21,8 @@ typedef struct
DBG_ADDR addr;
BYTE addrlen;
BYTE opcode;
BOOL enabled;
BOOL in_use;
BOOL16 enabled;
BOOL16 in_use;
} BREAKPOINT;
static BREAKPOINT breakpoints[MAX_BREAKPOINTS];
@ -65,7 +65,7 @@ static void DEBUG_SetOpcode( const DBG_ADDR *addr, BYTE op )
* Determine if the instruction at CS:EIP is an instruction that
* we need to step over (like a call or a repetitive string move).
*/
static BOOL DEBUG_IsStepOverInstr( SIGCONTEXT *context )
static BOOL32 DEBUG_IsStepOverInstr( SIGCONTEXT *context )
{
BYTE *instr = (BYTE *)PTR_SEG_OFF_TO_LIN(CS_reg(context),EIP_reg(context));

View File

@ -69,7 +69,7 @@
/*
* Switch to disassemble 16-bit code.
*/
static BOOL db_disasm_16 = FALSE;
static BOOL32 db_disasm_16 = FALSE;
/*
* Size attributes
@ -1139,7 +1139,7 @@ void DEBUG_Disasm( DBG_ADDR *addr )
int i_size;
int i_mode;
int regmodrm = 0;
BOOL first;
BOOL32 first;
int displ;
int prefix;
int imm;

View File

@ -213,7 +213,7 @@ void DEBUG_LoadEntryPoints(void)
char buffer[256];
unsigned char *cpnt, *name;
FARPROC16 address;
BOOL ok;
BOOL32 ok;
for (ok = ModuleFirst(&entry); ok; ok = ModuleNext(&entry))
{

View File

@ -19,8 +19,8 @@
BOOL32 DEBUG_IsBadReadPtr( const DBG_ADDR *address, int size )
{
if (address->seg) /* segmented addr */
return IsBadReadPtr( (SEGPTR)MAKELONG( (WORD)address->off,
(WORD)address->seg ), size );
return IsBadReadPtr16( (SEGPTR)MAKELONG( (WORD)address->off,
(WORD)address->seg ), size );
/* FIXME: should check if resulting linear addr is readable */
else /* linear address */
return FALSE; /* FIXME: should do some checks here */
@ -37,8 +37,8 @@ BOOL32 DEBUG_IsBadWritePtr( const DBG_ADDR *address, int size )
if (address->seg) /* segmented addr */
/* Note: we use IsBadReadPtr here because we are */
/* always allowed to write to read-only segments */
return IsBadReadPtr( (SEGPTR)MAKELONG( (WORD)address->off,
(WORD)address->seg ), size );
return IsBadReadPtr16( (SEGPTR)MAKELONG( (WORD)address->off,
(WORD)address->seg ), size );
/* FIXME: should check if resulting linear addr is writable */
else /* linear address */
return FALSE; /* FIXME: should do some checks here */

View File

@ -18,8 +18,9 @@ you must...
2. Edit ./wine.man (search for -language) to show the new language
abbreviation.
3. Edit misc/main.c variable "langNames" to contain the new language
abbreviation. Also edit macro "USAGE" to show the new abbreviation.
3. Edit misc/main.c variable "Languages" to contain the new language
abbreviation and language ID. Also edit macro "USAGE" to show the
new abbreviation.
4. Edit include/options.h enum "WINE_LANGUAGE" to have a member called
LANG_XX where XX is the new abbreviation.

View File

@ -147,7 +147,13 @@ int DIR_Init(void)
&DIR_SystemDosDir, &DIR_SystemUnixDir ))) return 0;
if (!(DIR_GetPath( "temp", "c:\\windows",
&DIR_TempDosDir, &DIR_TempUnixDir ))) return 0;
if (-1==access(DIR_TempUnixDir,W_OK)) {
if (errno==EACCES)
fprintf(stderr,"Warning: The Temporary Directory (as specified in wine.conf) is NOT writeable. Please check your configuration.\n");
else
fprintf(stderr,"Warning: Access to Temporary Directory failed (%s).\n",strerror(errno));
}
if (drive == -1)
{
drive = DIR_WindowsDosDir[0] - 'A';

View File

@ -18,6 +18,7 @@
#include <utime.h>
#include "windows.h"
#include "winerror.h"
#include "directory.h"
#include "dos_fs.h"
#include "drive.h"
@ -42,6 +43,7 @@ typedef struct tagDOS_FILE
char *unix_name;
WORD filedate;
WORD filetime;
DWORD type; /* Type for win32 apps */
} DOS_FILE;
/* Global files array */
@ -72,6 +74,7 @@ static DOS_FILE *FILE_Alloc(void)
file->count = 1;
file->unix_handle = -1;
file->unix_name = NULL;
file->type = FILE_TYPE_DISK;
return file;
}
@ -217,7 +220,7 @@ int FILE_GetUnixHandle( HFILE hFile )
*
* Close all open files of a given PDB. Used on task termination.
*/
void FILE_CloseAllFiles( HANDLE hPDB )
void FILE_CloseAllFiles( HANDLE16 hPDB )
{
BYTE *files;
WORD count;
@ -314,7 +317,7 @@ static DOS_FILE *FILE_OpenUnixFile( const char *name, int mode )
struct stat st;
if (!(file = FILE_Alloc())) return NULL;
if ((file->unix_handle = open( name, mode )) == -1)
if ((file->unix_handle = open( name, mode, 0666 )) == -1)
{
if (Options.allowReadOnly && (mode == O_RDWR))
{
@ -346,9 +349,11 @@ static DOS_FILE *FILE_OpenUnixFile( const char *name, int mode )
/***********************************************************************
* FILE_Open
*/
static DOS_FILE *FILE_Open( LPCSTR path, int mode )
HFILE FILE_Open( LPCSTR path, INT32 mode )
{
const char *unixName;
DOS_FILE *file;
HFILE handle;
dprintf_file(stddeb, "FILE_Open: '%s' %04x\n", path, mode );
if ((unixName = DOSFS_IsDevice( path )) != NULL)
@ -358,11 +363,16 @@ static DOS_FILE *FILE_Open( LPCSTR path, int mode )
{
dprintf_file(stddeb, "FILE_Open: Non-existing device\n");
DOS_ERROR( ER_FileNotFound, EC_NotFound, SA_Abort, EL_Disk );
return NULL;
return HFILE_ERROR;
}
}
else if (!(unixName = DOSFS_GetUnixFileName( path, TRUE ))) return NULL;
return FILE_OpenUnixFile( unixName, mode );
else if (!(unixName = DOSFS_GetUnixFileName( path, TRUE )))
return HFILE_ERROR;
if (!(file = FILE_OpenUnixFile( unixName, mode ))) return HFILE_ERROR;
if ((handle = FILE_AllocTaskHandle( file )) == HFILE_ERROR)
FILE_Close( file );
return handle;
}
@ -434,7 +444,7 @@ int FILE_Stat( LPCSTR unixName, BYTE *pattr, DWORD *psize,
*
* Get the date and time of a file.
*/
int FILE_GetDateTime( HFILE hFile, WORD *pdate, WORD *ptime, BOOL refresh )
int FILE_GetDateTime( HFILE hFile, WORD *pdate, WORD *ptime, BOOL32 refresh )
{
DOS_FILE *file;
@ -596,6 +606,8 @@ UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
{
lstrcpyn32A( buffer, DOSFS_GetDosTrueName( buffer, FALSE ), 144 );
dprintf_file( stddeb, "GetTempFileName: returning %s\n", buffer );
if (-1==access(DOSFS_GetUnixFileName(buffer,TRUE),W_OK))
fprintf(stderr,"Warning: GetTempFileName returns '%s', which doesn't seem to be writeable. Please check your configuration file if this generates a failure.\n",buffer);
return unique;
}
@ -617,6 +629,8 @@ UINT32 GetTempFileName32A( LPCSTR path, LPCSTR prefix, UINT32 unique,
lstrcpyn32A( buffer, DOSFS_GetDosTrueName( buffer, FALSE ), 144 );
dprintf_file( stddeb, "GetTempFileName: returning %s\n", buffer );
if (-1==access(DOSFS_GetUnixFileName(buffer,TRUE),W_OK))
fprintf(stderr,"Warning: GetTempFileName returns '%s', which doesn't seem to be writeable. Please check your configuration file if this generates a failure.\n",buffer);
return num;
}
@ -965,11 +979,46 @@ HFILE _lclose( HFILE hFile )
/***********************************************************************
* _lread (KERNEL.82)
* WIN16_hread
*/
INT _lread( HFILE hFile, SEGPTR buffer, WORD count )
LONG WIN16_hread( HFILE hFile, SEGPTR buffer, LONG count )
{
return (INT)_hread( hFile, buffer, (LONG)count );
LONG maxlen;
dprintf_file( stddeb, "_hread16: %d %08lx %ld\n",
hFile, (DWORD)buffer, count );
/* Some programs pass a count larger than the allocated buffer */
maxlen = GetSelectorLimit( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
if (count > maxlen) count = maxlen;
return FILE_Read( hFile, PTR_SEG_TO_LIN(buffer), count );
}
/***********************************************************************
* WIN16_lread
*/
UINT16 WIN16_lread( HFILE hFile, SEGPTR buffer, UINT16 count )
{
return (UINT16)WIN16_hread( hFile, buffer, (LONG)count );
}
/***********************************************************************
* _lread32 (KERNEL32.596)
*/
UINT32 _lread32( HFILE hFile, LPVOID buffer, UINT32 count )
{
return (UINT32)FILE_Read( hFile, buffer, (LONG)count );
}
/***********************************************************************
* _lread16 (KERNEL.82)
*/
UINT16 _lread16( HFILE hFile, LPVOID buffer, UINT16 count )
{
return (UINT16)FILE_Read( hFile, buffer, (LONG)count );
}
@ -1010,9 +1059,9 @@ HFILE _lcreat_uniq( LPCSTR path, INT32 attr )
/***********************************************************************
* _llseek (KERNEL.84)
* _llseek (KERNEL.84) (KERNEL32.594)
*/
LONG _llseek( HFILE hFile, LONG lOffset, INT nOrigin )
LONG _llseek( HFILE hFile, LONG lOffset, INT32 nOrigin )
{
DOS_FILE *file;
int origin, result;
@ -1039,9 +1088,7 @@ LONG _llseek( HFILE hFile, LONG lOffset, INT nOrigin )
*/
HFILE _lopen( LPCSTR path, INT32 mode )
{
DOS_FILE *file;
int unixMode;
HFILE handle;
INT32 unixMode;
dprintf_file(stddeb, "_lopen('%s',%04x)\n", path, mode );
@ -1058,38 +1105,33 @@ HFILE _lopen( LPCSTR path, INT32 mode )
unixMode = O_RDONLY;
break;
}
if (!(file = FILE_Open( path, unixMode ))) return HFILE_ERROR;
if ((handle = FILE_AllocTaskHandle( file )) == HFILE_ERROR)
FILE_Close( file );
return handle;
return FILE_Open( path, unixMode );
}
/***********************************************************************
* _lwrite (KERNEL.86)
* _lwrite16 (KERNEL.86)
*/
INT _lwrite( HFILE hFile, LPCSTR buffer, WORD count )
UINT16 _lwrite16( HFILE hFile, LPCSTR buffer, UINT16 count )
{
return (INT)_hwrite( hFile, buffer, (LONG)count );
return (UINT16)_hwrite( hFile, buffer, (LONG)count );
}
/***********************************************************************
* _lwrite32 (KERNEL.86)
*/
UINT32 _lwrite32( HFILE hFile, LPCSTR buffer, UINT32 count )
{
return (UINT32)_hwrite( hFile, buffer, (LONG)count );
}
/***********************************************************************
* _hread (KERNEL.349)
*/
LONG _hread( HFILE hFile, SEGPTR buffer, LONG count )
LONG _hread( HFILE hFile, LPVOID buffer, LONG count)
{
#ifndef WINELIB
LONG maxlen;
dprintf_file( stddeb, "_hread: %d %08lx %ld\n",
hFile, (DWORD)buffer, count );
/* Some programs pass a count larger than the allocated buffer */
maxlen = GetSelectorLimit( SELECTOROF(buffer) ) - OFFSETOF(buffer) + 1;
if (count > maxlen) count = maxlen;
#endif
return FILE_Read( hFile, PTR_SEG_TO_LIN(buffer), count );
return FILE_Read( hFile, buffer, count );
}
@ -1117,9 +1159,9 @@ LONG _hwrite( HFILE hFile, LPCSTR buffer, LONG count )
/***********************************************************************
* SetHandleCount (KERNEL.199)
* SetHandleCount16 (KERNEL.199)
*/
WORD SetHandleCount( WORD count )
UINT16 SetHandleCount16( UINT16 count )
{
HANDLE hPDB = GetCurrentPDB();
PDB *pdb = (PDB *)GlobalLock16( hPDB );
@ -1345,3 +1387,31 @@ BOOL32 RemoveDirectory32W( LPCWSTR path )
free(xpath);
return ret;
}
/***********************************************************************
* FILE_SetFileType
*/
BOOL32 FILE_SetFileType( HFILE hFile, DWORD type )
{
DOS_FILE *file = FILE_GetFile(hFile);
if (!file) return FALSE;
file->type = type;
return TRUE;
}
/***********************************************************************
* GetFileType (KERNEL32.222)
*/
DWORD GetFileType( HFILE hFile )
{
DOS_FILE *file = FILE_GetFile(hFile);
if (!file)
{
SetLastError( ERROR_INVALID_HANDLE );
return FILE_TYPE_UNKNOWN; /* FIXME: correct? */
}
return file->type;
}

View File

@ -4,6 +4,7 @@
* Copyright 1996 John Harvey
*/
#include <stdio.h>
#include "windows.h"
#include "win16drv.h"
#include "gdi.h"

View File

@ -39,7 +39,7 @@ base 1
0034 stdcall CreateDIBPatternBrush(long long) CreateDIBPatternBrush
0035 stub CreateDIBPatternBrushPt
0036 stub CreateDIBSection
0037 stub CreateDIBitmap
0037 stdcall CreateDIBitmap(long ptr long ptr ptr long) CreateDIBitmap
0038 stdcall CreateDiscardableBitmap(long long long) CreateDiscardableBitmap
0039 stdcall CreateEllipticRgn(long long long long) CreateEllipticRgn
0040 stdcall CreateEllipticRgnIndirect(ptr) CreateEllipticRgnIndirect32
@ -149,7 +149,7 @@ base 1
0142 stub GetAspectRatioFilterEx
0143 stdcall GetBitmapBits(long long ptr) GetBitmapBits
0144 stdcall GetBitmapDimensionEx(long ptr) GetBitmapDimensionEx32
0145 stub GetBkColor
0145 stdcall GetBkColor(long) GetBkColor
0146 stub GetBkMode
0147 stub GetBoundsRect
0148 stub GetBrushOrgEx
@ -231,10 +231,10 @@ base 1
0224 stub GetTextAlign
0225 stub GetTextCharacterExtra
0226 stub GetTextCharset
0227 stub GetTextColor
0227 stdcall GetTextColor(long) GetTextColor
0228 stub GetTextExtentExPointA
0229 stub GetTextExtentExPointW
0230 stub GetTextExtentPoint32A
0230 stdcall GetTextExtentPoint32A(long ptr long ptr) GetTextExtentPoint32A
0231 stub GetTextExtentPoint32W
0232 stdcall GetTextExtentPointA(long ptr long ptr) GetTextExtentPoint32A
0233 stdcall GetTextExtentPointW(long ptr long ptr) GetTextExtentPoint32W
@ -250,7 +250,7 @@ base 1
0243 stub GetWindowOrgEx
0244 stub GetWorldTransform
0245 stub IntersectClipRect
0246 stub InvertRgn
0246 stdcall InvertRgn(long long) InvertRgn
0247 stdcall LPtoDP(long ptr long) LPtoDP32
0248 stdcall LineDDA(long long long long ptr long) THUNK_LineDDA32
0249 stdcall LineTo(long long long) LineTo
@ -294,9 +294,9 @@ base 1
0287 stub ResetDCA
0288 stub ResetDCW
0289 stub ResizePalette
0290 stub RestoreDC
0290 stdcall RestoreDC(long long) RestoreDC
0291 stub RoundRect
0292 stub SaveDC
0292 stdcall SaveDC(long) SaveDC
0293 stdcall ScaleViewportExtEx(long long long long long ptr) ScaleViewportExtEx32
0294 stdcall ScaleWindowExtEx(long long long long long ptr) ScaleWindowExtEx32
0295 stub SelectBrushLocal
@ -339,7 +339,7 @@ base 1
0331 stdcall SetROP2(long long) SetROP2
0332 stdcall SetRectRgn(long long long long long) SetRectRgn
0333 stub SetRelAbs
0334 stub SetStretchBltMode
0334 stdcall SetStretchBltMode(long long) SetStretchBltMode
0335 stub SetSystemPaletteUse
0336 stub SetTextAlign
0337 stub SetTextCharacterExtra
@ -363,7 +363,7 @@ base 1
0355 stdcall TextOutA(long long long ptr long) TextOut32A
0356 stdcall TextOutW(long long long ptr long) TextOut32W
0357 stub UnloadNetworkFonts
0358 stub UnrealizeObject
0358 stdcall UnrealizeObject(long) UnrealizeObject
0359 stub UpdateColors
0360 stub WidenPath
0361 stub pstackConnect

View File

@ -78,11 +78,11 @@ type win16
#79 RESERVED3
#80 RESERVED4
81 pascal16 _lclose(word) _lclose
82 pascal16 _lread(word segptr word) _lread
82 pascal16 _lread(word segptr word) WIN16_lread
83 pascal16 _lcreat(ptr word) _lcreat
84 pascal _llseek(word long word) _llseek
85 pascal16 _lopen(ptr word) _lopen
86 pascal16 _lwrite(word ptr word) _lwrite
86 pascal16 _lwrite(word ptr word) _lwrite16
87 pascal16 RESERVED5(ptr ptr) lstrcmp16
88 pascal lstrcpy(segptr segptr) lstrcpy16
89 pascal lstrcat(segptr segptr) lstrcat16
@ -196,7 +196,7 @@ type win16
196 pascal16 SelectorAccessRights(word word word) SelectorAccessRights
197 pascal16 GlobalFix(word) GlobalFix
198 pascal16 GlobalUnfix(word) GlobalUnfix
199 pascal16 SetHandleCount(word) SetHandleCount
199 pascal16 SetHandleCount(word) SetHandleCount16
200 stub ValidateFreeSpaces
201 stub ReplaceInst
202 stub RegisterPtrace
@ -241,10 +241,10 @@ type win16
328 stub _DebugOutput
#329 K329
#332 stub THHOOK
334 pascal16 IsBadReadPtr(segptr word) IsBadReadPtr
335 pascal16 IsBadWritePtr(segptr word) IsBadWritePtr
336 pascal16 IsBadCodePtr(segptr) IsBadCodePtr
337 pascal16 IsBadStringPtr(segptr word) IsBadStringPtr
334 pascal16 IsBadReadPtr(segptr word) IsBadReadPtr16
335 pascal16 IsBadWritePtr(segptr word) IsBadWritePtr16
336 pascal16 IsBadCodePtr(segptr) IsBadCodePtr16
337 pascal16 IsBadStringPtr(segptr word) IsBadStringPtr16
338 stub HasGPHandler
339 stub DiagQuery
340 stub DiagOutput
@ -253,10 +253,10 @@ type win16
343 stub RegisterWinOldApHook
344 stub GetWinOldApHooks
345 pascal16 IsSharedSelector(word) IsSharedSelector
346 pascal16 IsBadHugeReadPtr(segptr long) IsBadHugeReadPtr
347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr
346 pascal16 IsBadHugeReadPtr(segptr long) IsBadHugeReadPtr16
347 pascal16 IsBadHugeWritePtr(segptr long) IsBadHugeWritePtr16
348 pascal16 hmemcpy(ptr ptr long) hmemcpy
349 pascal _hread(word segptr long) _hread
349 pascal _hread(word segptr long) WIN16_hread
350 pascal _hwrite(word ptr long) _hwrite
#351 BUNNY_351
352 pascal lstrcatn(segptr segptr word) lstrcatn16
@ -292,3 +292,4 @@ type win16
517 stub CallProc32W
518 stub CallProcEx32W
627 stub IsBadFlatReadWritePtr
631 stub FUNC004 # shell hook

View File

@ -47,10 +47,10 @@ base 1
0042 stdcall CreateDirectoryW(ptr ptr) CreateDirectory32W
0043 stdcall CreateEventA(ptr long long ptr) CreateEventA
0044 stub CreateEventW
0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFileA
0046 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping
0047 stub CreateFileMappingW
0048 stub CreateFileW
0045 stdcall CreateFileA(ptr long long ptr long long long) CreateFile32A
0046 stdcall CreateFileMappingA(long ptr long long long ptr) CreateFileMapping32A
0047 stdcall CreateFileMappingW(long ptr long long long ptr) CreateFileMapping32W
0048 stdcall CreateFileW(ptr long long ptr long long long) CreateFile32W
0049 stub CreateIoCompletionPort
0050 stub CreateMailslotA
0051 stub CreateMailslotW
@ -121,15 +121,15 @@ base 1
0116 stub FillConsoleOutputCharacterW
0117 stub FindAtomA
0118 stub FindAtomW
0119 stdcall FindClose(long) FindClose
0119 stdcall FindClose(long) FindClose32
0120 stub FindCloseChangeNotification
0121 stub FindFirstChangeNotificationA
0122 stub FindFirstChangeNotificationW
0123 stdcall FindFirstFileA(ptr ptr) FindFirstFile32A
0124 stub FindFirstFileW
0124 stdcall FindFirstFileW(ptr ptr) FindFirstFile32W
0125 stub FindNextChangeNotification
0126 stdcall FindNextFileA(long ptr) FindNextFile32A
0127 stub FindNextFileW
0127 stdcall FindNextFileW(long ptr) FindNextFile32W
0128 stdcall FindResourceA(long ptr ptr) FindResource32A
0129 stdcall FindResourceExA(long ptr ptr long) FindResourceEx32A
0130 stdcall FindResourceExW(long ptr ptr long) FindResourceEx32W
@ -219,9 +219,9 @@ base 1
0214 stub GetEnvironmentVariableW
0215 stub GetExitCodeProcess
0216 stub GetExitCodeThread
0217 stdcall GetFileAttributesA(ptr) GetFileAttributesA
0218 stub GetFileAttributesW
0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle
0217 stdcall GetFileAttributesA(ptr) GetFileAttributes32A
0218 stdcall GetFileAttributesW(ptr) GetFileAttributes32W
0219 stdcall GetFileInformationByHandle(long ptr) GetFileInformationByHandle
0220 stub GetFileSize
0221 stub GetFileTime
0222 stdcall GetFileType(long) GetFileType
@ -388,11 +388,11 @@ base 1
0383 stub LockFileEx
0384 stdcall LockResource(long) LockResource32
0385 stub MapViewOfFile
0386 stdcall MapViewOfFileEx(long long long long long long) MapViewOfFileEx
0387 stub MoveFileA
0386 stdcall MapViewOfFileEx(long long long long long long) MapViewOfFileEx
0387 stdcall MoveFileA(ptr ptr) MoveFile32A
0388 stub MoveFileExA
0389 stub MoveFileExW
0390 stub MoveFileW
0390 stdcall MoveFileW(ptr ptr) MoveFile32W
0391 stdcall MulDiv(long long long) MulDiv32
0392 stdcall MultiByteToWideChar(long long ptr long ptr long) MultiByteToWideChar
0393 stub OpenConsoleW
@ -485,7 +485,7 @@ base 1
0480 stub SetCurrentDirectoryW
0481 stub SetDefaultCommConfigA
0482 stub SetDefaultCommConfigW
0483 stub SetEndOfFile
0483 stdcall SetEndOfFile(long) SetEndOfFile
0484 stdcall SetEnvironmentVariableA(ptr ptr) SetEnvironmentVariable32A
0485 stdcall SetEnvironmentVariableW(ptr ptr) SetEnvironmentVariable32W
0486 stdcall SetErrorMode(long) SetErrorMode
@ -493,10 +493,10 @@ base 1
0488 stub SetFileApisToANSI
0489 stub SetFileApisToOEM
0490 stdcall SetFileAttributesA(ptr long) SetFileAttributes32A
0491 stub SetFileAttributesW
0491 stdcall SetFileAttributesW(ptr long) SetFileAttributes32W
0492 stdcall SetFilePointer(long long ptr long) SetFilePointer
0493 stub SetFileTime
0494 stdcall SetHandleCount(long) W32_SetHandleCount
0494 stdcall SetHandleCount(long) SetHandleCount32
0495 stub SetHandleInformation
0496 stub SetLastConsoleEventActive
0497 stdcall SetLastError(long) SetLastError
@ -580,7 +580,7 @@ base 1
0575 stub WriteConsoleOutputCharacterW
0576 stub WriteConsoleOutputW
0577 stub WriteConsoleW
0578 stdcall WriteFile(long ptr long ptr ptr) WriteFile
0578 stdcall WriteFile(long ptr long ptr ptr) WriteFile
0579 stub WriteFileEx
0580 stub WritePrivateProfileSectionA
0581 stub WritePrivateProfileSectionW
@ -592,14 +592,14 @@ base 1
0587 stdcall WriteProfileStringA(ptr ptr ptr) WriteProfileString
0588 stub WriteProfileStringW
0589 stub WriteTapemark
0590 stub _hread
0591 stub _hwrite
0590 stdcall _hread(long ptr long) _hread
0591 stdcall _hwrite(long ptr long) _hwrite
0592 stdcall _lclose(long) _lclose
0593 stdcall _lcreat(ptr long) _lcreat
0594 stub _llseek
0594 stdcall _llseek(long long long) _llseek
0595 stdcall _lopen(ptr long) _lopen
0596 stub _lread
0597 stub _lwrite
0596 stdcall _lread(long ptr long) _lread32
0597 stdcall _lwrite(long ptr long) _lwrite32
0598 stdcall lstrcat(ptr ptr) lstrcat32A
0599 stdcall lstrcatA(ptr ptr) lstrcat32A
0600 stdcall lstrcatW(ptr ptr) lstrcat32W

View File

@ -264,7 +264,7 @@ UINT32 ThunkConnect32( struct thunkstruct *ths, LPSTR thunkfun16,
{
HINSTANCE16 hmm;
fprintf(stdnimp,"ThunkConnect32(<struct>,%s,%s,%s,%lx,%lx)\n",
fprintf(stdnimp,"ThunkConnect32(<struct>,%s,%s,%s,%x,%lx)\n",
thunkfun16,module32,module16,hmod32,dllinitarg1
);
fprintf(stdnimp," magic = %c%c%c%c\n",

View File

@ -21,8 +21,8 @@ heap 65520
19 pascal16 ReleaseCapture() ReleaseCapture
20 pascal16 SetDoubleClickTime(word) SetDoubleClickTime
21 pascal16 GetDoubleClickTime() GetDoubleClickTime
22 pascal16 SetFocus(word) SetFocus
23 pascal16 GetFocus() GetFocus
22 pascal16 SetFocus(word) SetFocus16
23 pascal16 GetFocus() GetFocus16
24 pascal16 RemoveProp(word ptr) RemoveProp16
25 pascal16 GetProp(word ptr) GetProp16
26 pascal16 SetProp(word ptr word) SetProp16

View File

@ -132,7 +132,7 @@ base 1
0125 stdcall DefWindowProcA(long long long long) DefWindowProc32A
0126 stdcall DefWindowProcW(long long long long) DefWindowProc32W
0127 stub DeferWindowPos
0128 stub DeleteMenu
0128 stdcall DeleteMenu(long) DeleteMenu
0129 stub DestroyAcceleratorTable
0130 stdcall DestroyCaret() DestroyCaret
0131 stub DestroyCursor
@ -243,7 +243,7 @@ base 1
0236 stdcall GetDlgItemTextA(long long ptr long) GetDlgItemText32A
0237 stdcall GetDlgItemTextW(long long ptr long) GetDlgItemText32W
0238 stub GetDoubleClickTime
0239 stdcall GetFocus() GetFocus
0239 stdcall GetFocus() GetFocus32
0240 stub GetForegroundWindow
0241 stub GetIconInfo
0242 stub GetInputDesktop
@ -288,9 +288,9 @@ base 1
0281 stdcall GetPropW(long ptr) GetProp32W
0282 stub GetQueueStatus
0283 stdcall GetScrollInfo(long long ptr) GetScrollInfo32
0284 stub GetScrollPos
0284 stdcall GetScrollPos(long long) GetScrollPos
0285 stub GetScrollRange
0286 stub GetShellWindow
0286 return GetShellWindow 0 0
0287 stdcall GetSubMenu(long long) GetSubMenu
0288 stdcall GetSysColor(long) GetSysColor
0289 stdcall GetSysColorBrush(long) GetSysColorBrush
@ -484,7 +484,7 @@ base 1
0477 stdcall SetDlgItemTextA(long long ptr) SetDlgItemText32A
0478 stdcall SetDlgItemTextW(long long ptr) SetDlgItemText32W
0479 stub SetDoubleClickTime
0480 stdcall SetFocus(long) SetFocus
0480 stdcall SetFocus(long) SetFocus32
0481 stub SetForegroundWindow
0482 stdcall SetInternalWindowPos(long long ptr ptr) SetInternalWindowPos32
0483 stub SetKeyboardState
@ -576,7 +576,7 @@ base 1
0569 stub UserRegisterWowHandlers
0570 stdcall ValidateRect(long ptr) ValidateRect32
0571 stdcall ValidateRgn(long long) ValidateRgn
0572 stub VkKeyScanA
0572 stdcall VkKeyScanA(long) VkKeyScan
0573 stub VkKeyScanExA
0574 stub VkKeyScanExW
0575 stub VkKeyScanW

View File

@ -23,7 +23,7 @@ type win16
15 pascal16 ntohs(word) WINSOCK_ntohs
16 pascal16 recv(word ptr word word) WINSOCK_recv
17 pascal16 recvfrom(word ptr word word ptr ptr) WINSOCK_recvfrom
18 pascal16 select(word ptr ptr ptr ptr ptr) WINSOCK_select
18 pascal16 select(word ptr ptr ptr ptr) WINSOCK_select
19 pascal16 send(word ptr word word) WINSOCK_send
20 pascal16 sendto(word ptr word word ptr ptr) WINSOCK_sendto
21 pascal16 setsockopt(word word word ptr word) WINSOCK_setsockopt

View File

@ -9,11 +9,11 @@
#include "windows.h"
extern BOOL ATOM_Init(void);
extern BOOL32 ATOM_Init(void);
typedef struct
{
HANDLE next;
HANDLE16 next;
WORD refCount;
BYTE length;
BYTE str[1];
@ -22,7 +22,7 @@ typedef struct
typedef struct
{
WORD size;
HANDLE entries[1];
HANDLE16 entries[1];
} ATOMTABLE;
#endif /* ATOM_H */

View File

@ -87,6 +87,7 @@
#undef DEBUG_TEXT
#undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_VER
#undef DEBUG_VXD
#undef DEBUG_WIN
#undef DEBUG_WIN32
@ -165,6 +166,7 @@
#define DEBUG_TEXT
#define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_VER
#define DEBUG_VXD
#define DEBUG_WIN
#define DEBUG_WIN32
@ -529,6 +531,11 @@ short debug_msg_enabled[]={
#else
0,
#endif
#ifdef DEBUG_VER
1,
#else
0,
#endif
#ifdef DEBUG_VXD
1,
#else
@ -1480,8 +1487,21 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_vxd if(!debug_msg_enabled[71]) ; else fprintf
#define debugging_vxd debug_msg_enabled[71]
#define dprintf_ver if(!debug_msg_enabled[71]) ; else fprintf
#define debugging_ver debug_msg_enabled[71]
#else
#ifdef DEBUG_VER
#define dprintf_ver fprintf
#define debugging_ver 1
#else
#define dprintf_ver while(0) fprintf
#define debugging_ver 0
#endif
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_vxd if(!debug_msg_enabled[72]) ; else fprintf
#define debugging_vxd debug_msg_enabled[72]
#else
#ifdef DEBUG_VXD
#define dprintf_vxd fprintf
@ -1493,8 +1513,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win if(!debug_msg_enabled[72]) ; else fprintf
#define debugging_win debug_msg_enabled[72]
#define dprintf_win if(!debug_msg_enabled[73]) ; else fprintf
#define debugging_win debug_msg_enabled[73]
#else
#ifdef DEBUG_WIN
#define dprintf_win fprintf
@ -1506,8 +1526,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_win32 if(!debug_msg_enabled[73]) ; else fprintf
#define debugging_win32 debug_msg_enabled[73]
#define dprintf_win32 if(!debug_msg_enabled[74]) ; else fprintf
#define debugging_win32 debug_msg_enabled[74]
#else
#ifdef DEBUG_WIN32
#define dprintf_win32 fprintf
@ -1519,8 +1539,8 @@ extern short debug_msg_enabled[];
#endif
#ifdef DEBUG_RUNTIME
#define dprintf_winsock if(!debug_msg_enabled[74]) ; else fprintf
#define debugging_winsock debug_msg_enabled[74]
#define dprintf_winsock if(!debug_msg_enabled[75]) ; else fprintf
#define debugging_winsock debug_msg_enabled[75]
#else
#ifdef DEBUG_WINSOCK
#define dprintf_winsock fprintf
@ -1606,6 +1626,7 @@ static char *debug_msg_name[] = {
"text",
"timer",
"toolhelp",
"ver",
"vxd",
"win",
"win32",

View File

@ -10,18 +10,20 @@
#include "windows.h"
extern void FILE_SetDosError(void);
extern void FILE_CloseAllFiles( HANDLE hPDB );
extern void FILE_CloseAllFiles( HANDLE16 hPDB );
extern HFILE FILE_DupUnixHandle( int fd );
extern int FILE_Stat( LPCSTR unixName, BYTE *pattr, DWORD *psize,
WORD *pdate, WORD *ptime );
extern int FILE_GetDateTime( HFILE hFile, WORD *pdate, WORD *ptime,
BOOL refresh );
BOOL32 refresh );
extern int FILE_SetDateTime( HFILE hFile, WORD date, WORD time );
extern int FILE_Fstat( HFILE hFile, BYTE *pattr, DWORD *psize,
WORD *pdate, WORD *ptime );
extern HFILE FILE_Dup( HFILE hFile );
extern HFILE FILE_Dup2( HFILE hFile1, HFILE hFile2 );
extern HFILE FILE_Open( LPCSTR path, INT32 mode );
extern INT32 FILE_Read( HFILE hFile, LPVOID buffer, UINT32 count );
extern BOOL32 FILE_SetFileType( HFILE hFile, DWORD type );
extern HFILE _lcreat_uniq( LPCSTR path, INT32 attr );
#endif /* __WINE_FILE_H */

View File

@ -29,21 +29,9 @@ typedef struct {
unsigned long main_thread_id;
} PROCESS_OBJECT;
/* The FILE object includes things like disk files, pipes, and
* character devices (com ports, consoles, ...).
*/
typedef struct {
KERNEL_OBJECT common;
int fd; /* UNIX fd */
int type; /* FILE_TYPE_* */
unsigned long misc_flags; /* special flags */
unsigned long access_flags; /* UNIX access flags */
unsigned long create_flags; /* UNIX creation flags */
} FILE_OBJECT;
typedef struct {
KERNEL_OBJECT common;
FILE_OBJECT *file_obj;
HFILE hfile;
int prot;
unsigned long size;
} FILEMAP_OBJECT;
@ -115,6 +103,6 @@ int ValidateKernelObject(KERNEL_OBJECT *ptr);
/* Prototypes for the Close*Handle functions
*/
int CloseFileHandle(FILE_OBJECT *hFile);
int CloseFileHandle(HFILE hFile);
#endif /* __WINE_HANDLE32_H */

View File

@ -13,8 +13,9 @@
extern DWORD MSG_WineStartTicks; /* Ticks at Wine startup */
/* message.c */
extern BOOL MSG_InternalGetMessage( MSG16 *msg, HWND hwnd, HWND hwndOwner,
short code, WORD flags, BOOL sendIdle );
extern BOOL32 MSG_InternalGetMessage( MSG16 *msg, HWND32 hwnd,
HWND32 hwndOwner, WPARAM32 code,
WORD flags, BOOL32 sendIdle );
/* timer.c */
extern void TIMER_RemoveWindowTimers( HWND32 hwnd );
@ -26,7 +27,7 @@ extern BOOL32 TIMER_GetTimerMsg( MSG16 *msg, HWND32 hwnd,
HQUEUE16 hQueue, BOOL32 remove );
/* event.c */
extern BOOL EVENT_WaitXEvent( BOOL sleep );
extern BOOL32 EVENT_WaitXEvent( BOOL32 sleep );
extern void EVENT_Synchronize(void);
extern void EVENT_ProcessEvent( XEvent *event );
extern void EVENT_RegisterWindow( WND *pWnd );

View File

@ -44,7 +44,7 @@ extern void LIBRES_RegisterResources(const struct resource* const * Res);
#endif
extern int NE_AccessResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle );
extern BOOL32 NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle );
extern HRSRC16 NE_FindResource(HMODULE16 hModule, SEGPTR typeId, SEGPTR resId);
extern DWORD NE_SizeofResource( HMODULE16 hModule, HRSRC16 hRsrc );
extern SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL16 handle );

View File

@ -19,6 +19,7 @@
#define SPY_RESULT_INVALIDHWND16 0x0002
#define SPY_RESULT_INVALIDHWND32 0x0003
extern const char *SPY_GetMsgName( UINT32 msg );
extern void SPY_EnterMessage( INT32 iFlag, HWND32 hwnd, UINT32 msg,
WPARAM32 wParam, LPARAM lParam );
extern void SPY_ExitMessage( INT32 iFlag, HWND32 hwnd, UINT32 msg,

View File

@ -147,6 +147,7 @@
#undef DEBUG_TEXT
#undef DEBUG_TIMER
#undef DEBUG_TOOLHELP
#undef DEBUG_VER
#undef DEBUG_VXD
#undef DEBUG_WIN
#undef DEBUG_WIN32
@ -225,6 +226,7 @@
#define DEBUG_TEXT
#define DEBUG_TIMER
#define DEBUG_TOOLHELP
#define DEBUG_VER
#define DEBUG_VXD
#define DEBUG_WIN
#define DEBUG_WIN32

View File

@ -41,7 +41,7 @@ typedef struct tagWND
CLASS *class; /* Window class */
HWINDOWPROC winproc; /* Window procedure */
DWORD dwMagic; /* Magic number (must be WND_MAGIC) */
HWND16 hwndSelf; /* Handle of this window */
HWND32 hwndSelf; /* Handle of this window */
HINSTANCE16 hInstance; /* Window hInstance (from CreateWindow) */
RECT16 rectClient; /* Client area rel. to parent client area */
RECT16 rectWindow; /* Whole window rel. to parent client area */

View File

@ -133,37 +133,6 @@ typedef struct {
DECL_WINELIB_TYPE_AW(OSVERSIONINFO);
typedef struct
{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
CHAR cFileName[260];
CHAR cAlternateFileName[14];
} WIN32_FIND_DATA32A, *LPWIN32_FIND_DATA32A;
typedef struct
{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
WCHAR cFileName[260];
WCHAR cAlternateName[14];
} WIN32_FIND_DATA32W, *LPWIN32_FIND_DATA32W;
DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA);
DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA);
#define VER_PLATFORM_WIN32s 0
#define VER_PLATFORM_WIN32_WINDOWS 1
#define VER_PLATFORM_WIN32_NT 2

View File

@ -1523,6 +1523,38 @@ typedef struct
INT32 dwHighDateTime;
} FILETIME;
/* Find* structures */
typedef struct
{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
CHAR cFileName[260];
CHAR cAlternateFileName[14];
} WIN32_FIND_DATA32A, *LPWIN32_FIND_DATA32A;
typedef struct
{
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
WCHAR cFileName[260];
WCHAR cAlternateFileName[14];
} WIN32_FIND_DATA32W, *LPWIN32_FIND_DATA32W;
DECL_WINELIB_TYPE_AW(WIN32_FIND_DATA);
DECL_WINELIB_TYPE_AW(LPWIN32_FIND_DATA);
/* comm */
#define CBR_110 0xFF10
@ -2556,20 +2588,22 @@ DECL_WINELIB_TYPE(LPSCROLLINFO);
#define SIF_ALL (SIF_RANGE | SIF_PAGE | SIF_POS | SIF_TRACKPOS)
/* Listbox styles */
#define LBS_NOTIFY 0x0001L
#define LBS_SORT 0x0002L
#define LBS_NOREDRAW 0x0004L
#define LBS_MULTIPLESEL 0x0008L
#define LBS_OWNERDRAWFIXED 0x0010L
#define LBS_OWNERDRAWVARIABLE 0x0020L
#define LBS_HASSTRINGS 0x0040L
#define LBS_USETABSTOPS 0x0080L
#define LBS_NOINTEGRALHEIGHT 0x0100L
#define LBS_MULTICOLUMN 0x0200L
#define LBS_WANTKEYBOARDINPUT 0x0400L
#define LBS_EXTENDEDSEL 0x0800L
#define LBS_DISABLENOSCROLL 0x1000L
#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
#define LBS_NOTIFY 0x0001
#define LBS_SORT 0x0002
#define LBS_NOREDRAW 0x0004
#define LBS_MULTIPLESEL 0x0008
#define LBS_OWNERDRAWFIXED 0x0010
#define LBS_OWNERDRAWVARIABLE 0x0020
#define LBS_HASSTRINGS 0x0040
#define LBS_USETABSTOPS 0x0080
#define LBS_NOINTEGRALHEIGHT 0x0100
#define LBS_MULTICOLUMN 0x0200
#define LBS_WANTKEYBOARDINPUT 0x0400
#define LBS_EXTENDEDSEL 0x0800
#define LBS_DISABLENOSCROLL 0x1000
#define LBS_NODATA 0x2000
#define LBS_NOSEL 0x4000
#define LBS_STANDARD (LBS_NOTIFY | LBS_SORT | WS_VSCROLL | WS_BORDER)
/* Listbox messages */
#define LB_ADDSTRING16 (WM_USER+1)
@ -2677,12 +2711,22 @@ DECL_WINELIB_TYPE(LPSCROLLINFO);
#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_SETLOCALE16 WM_NULL /* Not in Win16 */
#define LB_SETLOCALE32 0x01a5
#define LB_SETLOCALE WINELIB_NAME(LB_SETLOCALE)
#define LB_GETLOCALE16 WM_NULL /* Not in Win16 */
#define LB_GETLOCALE32 0x01a6
#define LB_GETLOCALE WINELIB_NAME(LB_GETLOCALE)
#define LB_SETCOUNT16 WM_NULL /* Not in Win16 */
#define LB_SETCOUNT32 0x01a7
#define LB_SETCOUNT WINELIB_NAME(LB_SETCOUNT)
#define LB_INITSTORAGE16 WM_NULL /* Not in Win16 */
#define LB_INITSTORAGE32 0x01a8
#define LB_INITSTORAGE WINELIB_NAME(LB_INITSTORAGE)
#define LB_ITEMFROMPOINT16 WM_NULL /* Not in Win16 */
#define LB_ITEMFROMPOINT32 0x01a9
#define LB_ITEMFROMPOINT WINELIB_NAME(LB_ITEMFROMPOINT)
/* Listbox notification codes */
#define LBN_ERRSPACE (-2)
@ -3537,10 +3581,19 @@ typedef struct _ULARGE_INTEGER
#define SLE_MINORERROR 0x00000002
#define SLE_WARNING 0x00000003
/* Argument 1 passed to the DllEntryProc. */
#define DLL_PROCESS_DETACH 0 /* detach process (unload library) */
#define DLL_PROCESS_ATTACH 1 /* attach process (load library) */
#define DLL_THREAD_ATTACH 2 /* attach new thread */
#define DLL_THREAD_DETACH 3 /* detach thread */
#pragma pack(4)
/* Declarations for functions that exist only in Win16 */
WORD AllocCStoDSAlias(WORD);
WORD AllocDStoCSAlias(WORD);
WORD AllocSelector(WORD);
WORD AllocSelectorArray(WORD);
INT16 Catch(LPCATCHBUF);
@ -3550,15 +3603,21 @@ VOID FarSetOwner(HGLOBAL16,HANDLE16);
VOID FillWindow(HWND16,HWND16,HDC16,HBRUSH16);
INT16 FlushComm(INT16,INT16);
WORD FreeSelector(WORD);
HANDLE16 GetAtomHandle(ATOM);
DWORD GetBitmapDimension(HBITMAP16);
INT16 GetCommError(INT16,LPCOMSTAT);
UINT16 GetCommEventMask(INT16,UINT16);
HANDLE16 GetCurrentPDB(void);
HTASK16 GetCurrentTask(void);
HMODULE16 GetExePtr(HANDLE16);
WORD GetExeVersion(void);
BOOL16 GetModuleName(HINSTANCE16,LPSTR,INT16);
DWORD GetSelectorBase(WORD);
DWORD GetSelectorLimit(WORD);
HINSTANCE16 GetTaskDS(void);
HQUEUE16 GetTaskQueue(HTASK16);
DWORD GlobalDOSAlloc(DWORD);
WORD GlobalDOSFree(WORD);
BOOL16 IsSharedSelector(HANDLE16);
BOOL16 LocalInit(HANDLE16,WORD,WORD);
DWORD OffsetViewportOrg(HDC16,INT16,INT16);
@ -3568,9 +3627,12 @@ VOID PaintRect(HWND16,HWND16,HDC16,HBRUSH16,const RECT16*);
INT16 ReadComm(INT16,LPSTR,INT16);
DWORD ScaleViewportExt(HDC16,INT16,INT16,INT16,INT16);
DWORD ScaleWindowExt(HDC16,INT16,INT16,INT16,INT16);
WORD SelectorAccessRights(WORD,WORD,WORD);
DWORD SetBitmapDimension(HBITMAP16,INT16,INT16);
DWORD SetBrushOrg(HDC16,INT16,INT16);
UINT16* SetCommEventMask(INT16,UINT16);
WORD SetSelectorBase(WORD,DWORD);
WORD SetSelectorLimit(WORD,DWORD);
FARPROC16 SetTaskSignalProc(HTASK16,FARPROC16);
DWORD SetViewportExt(HDC16,INT16,INT16);
DWORD SetViewportOrg(HDC16,INT16,INT16);
@ -3584,7 +3646,13 @@ VOID hmemcpy(LPVOID,LPCVOID,LONG);
/* Declarations for functions that exist only in Win32 */
BOOL32 Beep(DWORD,DWORD);
BOOL32 ClearCommError(HANDLE32,LPDWORD,LPCOMSTAT);
BOOL32 ClearCommError(INT32,LPDWORD,LPCOMSTAT);
HFILE CreateFile32A(LPCSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
HFILE CreateFile32W(LPCWSTR,DWORD,DWORD,LPSECURITY_ATTRIBUTES,DWORD,DWORD,HANDLE32);
#define CreateFile WINELIB_NAME_AW(CreateFile)
HANDLE32 CreateFileMapping32A(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCSTR);
HANDLE32 CreateFileMapping32W(HANDLE32,LPSECURITY_ATTRIBUTES,DWORD,DWORD,DWORD,LPCWSTR);
#define CreateFileMapping WINELIB_NAME_AW(CreateFileMapping)
INT32 EnumPropsEx32A(HWND32,PROPENUMPROCEX32A,LPARAM);
INT32 EnumPropsEx32W(HWND32,PROPENUMPROCEX32W,LPARAM);
#define EnumPropsEx WINELIB_NAME_AW(EnumPropsEx)
@ -3597,9 +3665,11 @@ BOOL32 FlushFileBuffers(HFILE);
LPCSTR GetCommandLine32A();
LPCWSTR GetCommandLine32W();
#define GetCommandLine WINELIB_NAME_AW(GetCommandLine)
BOOL32 GetCommTimeouts(HANDLE32,LPCOMMTIMEOUTS);
BOOL32 GetCommTimeouts(INT32,LPCOMMTIMEOUTS);
DWORD GetFileInformationByHandle(HFILE,BY_HANDLE_FILE_INFORMATION*);
DWORD GetLogicalDrives(void);
HANDLE32 GetProcessHeap(void);
HFILE GetStdHandle(DWORD);
VOID GlobalMemoryStatus(LPMEMORYSTATUS);
LPVOID HeapAlloc(HANDLE32,DWORD,DWORD);
DWORD HeapCompact(HANDLE32,DWORD);
@ -3612,7 +3682,12 @@ DWORD HeapSize(HANDLE32,DWORD,LPVOID);
BOOL32 HeapUnlock(HANDLE32);
BOOL32 HeapValidate(HANDLE32,DWORD,LPVOID);
BOOL32 IsWindowUnicode(HWND32);
LPVOID MapViewOfFileEx(HANDLE32,DWORD,DWORD,DWORD,DWORD,DWORD);
BOOL32 MoveFile32A(LPCSTR,LPCSTR);
BOOL32 MoveFile32W(LPCWSTR,LPCWSTR);
#define MoveFile WINELIB_NAME_AW(MoveFile)
BOOL32 QueryPerformanceCounter(LPLARGE_INTEGER);
BOOL32 ReadFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
DWORD RegCreateKeyEx32A(HKEY,LPCSTR,DWORD,LPSTR,DWORD,REGSAM,
LPSECURITY_ATTRIBUTES,LPHKEY,LPDWORD);
DWORD RegCreateKeyEx32W(HKEY,LPCWSTR,DWORD,LPWSTR,DWORD,REGSAM,
@ -3635,12 +3710,16 @@ VOID RtlZeroMemory(LPVOID,UINT32);
DWORD SearchPath32A(LPCSTR,LPCSTR,LPCSTR,DWORD,LPSTR,LPSTR*);
DWORD SearchPath32W(LPCWSTR,LPCWSTR,LPCWSTR,DWORD,LPWSTR,LPWSTR*);
#define SearchPath WINELIB_NAME(SearchPath)
BOOL32 SetCommMask(HANDLE32,DWORD);
BOOL32 SetCommTimeouts(HANDLE32,LPCOMMTIMEOUTS);
BOOL32 SetBrushOrgEx(HDC32,INT32,INT32,LPPOINT32);
BOOL32 SetCommMask(INT32,DWORD);
BOOL32 SetCommTimeouts(INT32,LPCOMMTIMEOUTS);
BOOL32 SetEndOfFile(HFILE);
DWORD SetFilePointer(HFILE,LONG,LPLONG,DWORD);
BOOL32 SetTimeZoneInformation(const LPTIME_ZONE_INFORMATION);
LPVOID VirtualAlloc(LPVOID,DWORD,DWORD,DWORD);
BOOL32 VirtualFree(LPVOID,DWORD,DWORD);
BOOL32 WriteFile(HFILE,LPVOID,DWORD,LPDWORD,LPOVERLAPPED);
/* Declarations for functions that are the same in Win16 and Win32 */
@ -3698,9 +3777,12 @@ COLORREF SetTextColor(HDC32,COLORREF);
WORD SetWindowWord(HWND32,INT32,WORD);
BOOL16 ShowCaret(HWND32);
HWND16 WindowFromDC(HDC32);
LONG _hread(HFILE,LPVOID,LONG);
HFILE _lclose(HFILE);
HFILE _lcreat(LPCSTR,INT32);
LONG _llseek(HFILE,LONG,INT32);
HFILE _lopen(LPCSTR,INT32);
LONG _hwrite(HFILE,LPCSTR,LONG);
/* Declarations for functions that change between Win16 and Win32 */
@ -3772,7 +3854,7 @@ HWND16 ChildWindowFromPoint16(HWND16,POINT16);
HWND32 ChildWindowFromPoint32(HWND32,POINT32);
#define ChildWindowFromPoint WINELIB_NAME(ChildWindowFromPoint)
INT16 ClearCommBreak16(INT16);
BOOL32 ClearCommBreak32(HANDLE32);
BOOL32 ClearCommBreak32(INT32);
#define ClearCommBreak WINELIB_NAME(ClearCommBreak)
BOOL16 ClientToScreen16(HWND16,LPPOINT16);
BOOL32 ClientToScreen32(HWND32,LPPOINT32);
@ -3935,7 +4017,7 @@ BOOL16 EqualRect16(const RECT16*,const RECT16*);
BOOL32 EqualRect32(const RECT32*,const RECT32*);
#define EqualRect WINELIB_NAME(EqualRect)
LONG EscapeCommFunction16(UINT16,UINT16);
BOOL32 EscapeCommFunction32(HANDLE32,UINT32);
BOOL32 EscapeCommFunction32(INT32,UINT32);
#define EscapeCommFunction WINELIB_NAME(EscapeCommFunction)
BOOL16 ExtTextOut16(HDC16,INT16,INT16,UINT16,const RECT16*,LPCSTR,UINT16,const INT16*);
BOOL32 ExtTextOut32A(HDC32,INT32,INT32,UINT32,const RECT32*,LPCSTR,UINT32,const INT32*);
@ -3944,6 +4026,17 @@ BOOL32 ExtTextOut32W(HDC32,INT32,INT32,UINT32,const RECT32*,LPCWSTR,UINT32,c
INT16 FillRect16(HDC16,const RECT16*,HBRUSH16);
INT32 FillRect32(HDC32,const RECT32*,HBRUSH32);
#define FillRect WINELIB_NAME(FillRect)
BOOL16 FindClose16(HANDLE16);
BOOL32 FindClose32(HANDLE32);
#define FindClose WINELIB_NAME(FindClose)
HANDLE16 FindFirstFile16(LPCSTR,LPVOID);
HANDLE32 FindFirstFile32A(LPCSTR,LPWIN32_FIND_DATA32A);
HANDLE32 FindFirstFile32W(LPCWSTR,LPWIN32_FIND_DATA32W);
#define FindFirst WINELIB_NAME_AW(FindFirst)
BOOL16 FindNextFile16(HANDLE16,LPVOID);
BOOL32 FindNextFile32A(HANDLE32,LPWIN32_FIND_DATA32A);
BOOL32 FindNextFile32W(HANDLE32,LPWIN32_FIND_DATA32W);
#define FindNext WINELIB_NAME_AW(FindNext)
HRSRC16 FindResource16(HINSTANCE16,SEGPTR,SEGPTR);
HRSRC32 FindResource32A(HINSTANCE32,LPCSTR,LPCSTR);
HRSRC32 FindResource32W(HINSTANCE32,LPCWSTR,LPCWSTR);
@ -4006,7 +4099,7 @@ void GetClipCursor16(LPRECT16);
void GetClipCursor32(LPRECT32);
#define GetClipCursor WINELIB_NAME(GetClipCursor)
INT16 GetCommState16(INT16,LPDCB16);
BOOL32 GetCommState32(HANDLE32,LPDCB32);
BOOL32 GetCommState32(INT32,LPDCB32);
#define GetCommState WINELIB_NAME(GetCommState)
UINT16 GetCurrentDirectory16(UINT16,LPSTR);
UINT32 GetCurrentDirectory32A(UINT32,LPSTR);
@ -4034,6 +4127,10 @@ INT16 GetExpandedName16(LPCSTR,LPSTR);
INT32 GetExpandedName32A(LPCSTR,LPSTR);
INT32 GetExpandedName32W(LPCWSTR,LPWSTR);
#define GetExpandedName WINELIB_NAME_AW(GetExpandedName)
DWORD GetFileAttributes16(LPCSTR);
DWORD GetFileAttributes32A(LPCSTR);
DWORD GetFileAttributes32W(LPCWSTR);
#define GetFileAttributes WINELIB_NAME_AW(GetFileAttributes)
DWORD GetFileVersionInfoSize16(LPCSTR,LPDWORD);
DWORD GetFileVersionInfoSize32A(LPCSTR,LPDWORD);
DWORD GetFileVersionInfoSize32W(LPCWSTR,LPDWORD);
@ -4042,6 +4139,9 @@ DWORD GetFileVersionInfo16(LPCSTR,DWORD,DWORD,LPVOID);
DWORD GetFileVersionInfo32A(LPCSTR,DWORD,DWORD,LPVOID);
DWORD GetFileVersionInfo32W(LPCWSTR,DWORD,DWORD,LPVOID);
#define GetFileVersionInfo WINELIB_NAME_AW(GetFileVersionInfo)
HWND16 GetFocus16(void);
HWND32 GetFocus32(void);
#define GetFocus WINELIB_NAME(GetFocus)
UINT16 GetInternalWindowPos16(HWND16,LPRECT16,LPPOINT16);
UINT32 GetInternalWindowPos32(HWND32,LPRECT32,LPPOINT32);
#define GetInternalWindowPos WINELIB_NAME(GetInternalWindowPos)
@ -4186,6 +4286,25 @@ void InvalidateRect32(HWND32,const RECT32*,BOOL32);
void InvertRect16(HDC16,const RECT16*);
void InvertRect32(HDC32,const RECT32*);
#define InvertRect WINELIB_NAME(InvertRect)
BOOL16 IsBadCodePtr16(SEGPTR);
BOOL32 IsBadCodePtr32(FARPROC32);
#define IsBadCodePtr WINELIB_NAME(IsBadCodePtr)
BOOL16 IsBadHugeReadPtr16(SEGPTR,DWORD);
BOOL32 IsBadHugeReadPtr32(LPCVOID,UINT32);
#define IsBadHugeReadPtr WINELIB_NAME(IsBadHugeReadPtr)
BOOL16 IsBadHugeWritePtr16(SEGPTR,DWORD);
BOOL32 IsBadHugeWritePtr32(LPCVOID,UINT32);
#define IsBadHugeWritePtr WINELIB_NAME(IsBadHugeWritePtr)
BOOL16 IsBadReadPtr16(SEGPTR,UINT16);
BOOL32 IsBadReadPtr32(LPCVOID,UINT32);
#define IsBadReadPtr WINELIB_NAME(IsBadReadPtr)
BOOL16 IsBadStringPtr16(SEGPTR,UINT16);
BOOL32 IsBadStringPtr32A(LPCSTR,UINT32);
BOOL32 IsBadStringPtr32W(LPCWSTR,UINT32);
#define IsBadStringPtr WINELIB_NAME_AW(IsBadStringPtr)
BOOL16 IsBadWritePtr16(SEGPTR,UINT16);
BOOL32 IsBadWritePtr32(LPVOID,UINT32);
#define IsBadWritePtr WINELIB_NAME(IsBadWritePtr)
BOOL16 IsCharAlpha16(CHAR);
BOOL32 IsCharAlpha32A(CHAR);
BOOL32 IsCharAlpha32W(WCHAR);
@ -4435,10 +4554,10 @@ LONG SetClassLong32A(HWND32,INT32,LONG);
LONG SetClassLong32W(HWND32,INT32,LONG);
#define SetClassLong WINELIB_NAME_AW(SetClassLong)
INT16 SetCommBreak16(INT16);
BOOL32 SetCommBreak32(HANDLE32);
BOOL32 SetCommBreak32(INT32);
#define SetCommBreak WINELIB_NAME(SetCommBreak)
INT16 SetCommState16(LPDCB16);
BOOL32 SetCommState32(HANDLE32,LPDCB32);
BOOL32 SetCommState32(INT32,LPDCB32);
#define SetCommState WINELIB_NAME(SetCommState)
void SetDlgItemInt16(HWND16,INT16,UINT16,BOOL16);
void SetDlgItemInt32(HWND32,INT32,UINT32,BOOL32);
@ -4450,6 +4569,16 @@ void SetDlgItemText32W(HWND32,INT32,LPCWSTR);
BOOL32 SetEnvironmentVariable32A(LPCSTR,LPCSTR);
BOOL32 SetEnvironmentVariable32W(LPCWSTR,LPCWSTR);
#define SetEnvironmentVariable WINELIB_NAME_AW(SetEnvironmentVariable)
BOOL16 SetFileAttributes16(LPCSTR,DWORD);
BOOL32 SetFileAttributes32A(LPCSTR,DWORD);
BOOL32 SetFileAttributes32W(LPCWSTR,DWORD);
#define SetFileAttributes WINELIB_NAME_AW(SetFileAttributes)
HWND16 SetFocus16(HWND16);
HWND32 SetFocus32(HWND32);
#define SetFocus WINELIB_NAME(SetFocus)
UINT16 SetHandleCount16(UINT16);
UINT32 SetHandleCount32(UINT32);
#define SetHandleCount WINELIB_NAME(SetHandleCount)
void SetInternalWindowPos16(HWND16,UINT16,LPRECT16,LPPOINT16);
void SetInternalWindowPos32(HWND32,UINT32,LPRECT32,LPPOINT32);
#define SetInternalWindowPos WINELIB_NAME(SetInternalWindowPos)
@ -4509,7 +4638,7 @@ BOOL16 TrackPopupMenu16(HMENU16,UINT16,INT16,INT16,INT16,HWND16,const RECT16
BOOL32 TrackPopupMenu32(HMENU32,UINT32,INT32,INT32,INT32,HWND32,const RECT32*);
#define TrackPopupMenu WINELIB_NAME(TrackPopupMenu)
INT16 TransmitCommChar16(INT16,CHAR);
BOOL32 TransmitCommChar32(HANDLE32,CHAR);
BOOL32 TransmitCommChar32(INT32,CHAR);
#define TransmitCommChar WINELIB_NAME(TransmitCommChar)
BOOL16 UnionRect16(LPRECT16,const RECT16*,const RECT16*);
BOOL32 UnionRect32(LPRECT32,const RECT32*,const RECT32*);
@ -4587,11 +4716,18 @@ INT16 wvsprintf16(LPSTR,LPCSTR,LPCVOID);
INT32 wvsprintf32A(LPSTR,LPCSTR,LPCVOID);
INT32 wvsprintf32W(LPWSTR,LPCWSTR,LPCVOID);
#define wvsprintf WINELIB_NAME_AW(wvsprintf)
UINT16 _lread16(HFILE,LPVOID,UINT16);
UINT32 _lread32(HFILE,LPVOID,UINT32);
#define _lread WINELIB_NAME(_lread)
UINT16 _lwrite16(HFILE,LPCSTR,UINT16);
UINT32 _lwrite32(HFILE,LPCSTR,UINT32);
#define _lwrite WINELIB_NAME(_lwrite)
/* Extra functions that don't exist in the Windows API */
INT32 LoadMessage32A(HINSTANCE32,UINT32,WORD,LPSTR,INT32);
INT32 LoadMessage32W(HINSTANCE32,UINT32,WORD,LPWSTR,INT32);
SEGPTR WIN16_GlobalLock16(HGLOBAL16);
INT32 lstrncmp32A(LPCSTR,LPCSTR,INT32);
INT32 lstrncmp32W(LPCWSTR,LPCWSTR,INT32);
INT32 lstrncmpi32A(LPCSTR,LPCSTR,INT32);
@ -4650,8 +4786,6 @@ typedef SEGPTR EDITWORDBREAKPROC;
ATOM AddAtom(SEGPTR);
INT AddFontResource(LPCSTR);
WORD AllocCStoDSAlias(WORD);
WORD AllocDStoCSAlias(WORD);
BOOL AnimatePalette(HPALETTE16,UINT,UINT,LPPALETTEENTRY);
LPSTR AnsiLower(LPSTR);
UINT AnsiLowerBuff(LPSTR,UINT);
@ -4753,7 +4887,6 @@ HPALETTE16 GDISelectPalette(HDC,HPALETTE16,WORD);
HWND GetActiveWindow(void);
DWORD GetAspectRatioFilter(HDC);
int GetAsyncKeyState(int);
HANDLE GetAtomHandle(ATOM);
WORD GetAtomName(ATOM,LPSTR,short);
COLORREF GetBkColor(HDC);
WORD GetBkMode(HDC);
@ -4769,7 +4902,6 @@ HWND GetClipboardViewer(void);
HANDLE GetCodeHandle(FARPROC16);
void GetCodeInfo(FARPROC16,LPVOID);
HBRUSH GetControlBrush(HWND,HDC,WORD);
HANDLE GetCurrentPDB(void);
DWORD GetCurrentPosition(HDC);
DWORD GetCurrentTime(void);
HCURSOR16 GetCursor(void);
@ -4788,7 +4920,6 @@ HWND GetDlgItem(HWND,WORD);
WORD GetDlgItemInt(HWND,WORD,BOOL*,BOOL);
WORD GetDoubleClickTime(void);
int GetEnvironment(LPSTR,LPSTR,WORD);
HWND GetFocus(void);
DWORD GetFreeSpace(UINT16);
DWORD GetHeapSpaces(HMODULE16);
BOOL GetInputState(void);
@ -4839,8 +4970,6 @@ WORD GetROP2(HDC);
WORD GetRelAbs(HDC);
int GetScrollPos(HWND,int);
void GetScrollRange(HWND,int,LPINT16,LPINT16);
DWORD GetSelectorBase(WORD);
DWORD GetSelectorLimit(WORD);
HANDLE GetStockObject(int);
WORD GetStretchBltMode(HDC);
HMENU GetSubMenu(HMENU,short);
@ -4870,8 +4999,6 @@ DWORD GetWindowExt(HDC);
DWORD GetWindowOrg(HDC);
int GetWindowTextLength(HWND);
UINT GetWindowsDirectory(LPSTR,UINT);
DWORD GlobalDOSAlloc(DWORD);
WORD GlobalDOSFree(WORD);
ATOM GlobalDeleteAtom(ATOM);
void GlobalFix(HGLOBAL16);
void GlobalFreeAll(HGLOBAL16);
@ -4892,12 +5019,6 @@ int IntersectClipRect(HDC,short,short,short,short);
int IntersectVisRect(HDC,short,short,short,short);
void InvalidateRgn(HWND32,HRGN32,BOOL32);
BOOL InvertRgn(HDC,HRGN);
BOOL IsBadCodePtr(SEGPTR);
BOOL IsBadHugeReadPtr(SEGPTR,DWORD);
BOOL IsBadHugeWritePtr(SEGPTR,DWORD);
BOOL IsBadReadPtr(SEGPTR,WORD);
BOOL IsBadStringPtr(SEGPTR,WORD);
BOOL IsBadWritePtr(SEGPTR,WORD);
BOOL IsChild(HWND,HWND);
BOOL IsClipboardFormatAvailable(WORD);
BOOL IsDialogMessage(HWND,LPMSG16);
@ -4972,7 +5093,6 @@ int SelectClipRgn(HDC,HRGN);
HANDLE SelectObject(HDC,HANDLE);
HPALETTE16 SelectPalette(HDC,HPALETTE16,BOOL);
int SelectVisRgn(HDC,HRGN);
WORD SelectorAccessRights(WORD,WORD,WORD);
HWND SetActiveWindow(HWND);
WORD SetBkMode(HDC,WORD);
HWND SetCapture(HWND);
@ -4990,8 +5110,6 @@ BOOL SetDeskWallPaper(LPCSTR);
void SetDoubleClickTime(WORD);
int SetEnvironment(LPCSTR,LPCSTR,WORD);
UINT SetErrorMode(UINT);
HWND SetFocus(HWND);
WORD SetHandleCount(WORD);
WORD SetHookFlags(HDC,WORD);
void SetKeyboardState(BYTE*);
WORD SetMapMode(HDC,WORD);
@ -5009,8 +5127,6 @@ WORD SetRelAbs(HDC,WORD);
FARPROC16 SetResourceHandler(HANDLE,LPSTR,FARPROC16);
int SetScrollPos(HWND,int,int,BOOL);
void SetScrollRange(HWND,int,int,int,BOOL);
WORD SetSelectorBase(WORD,DWORD);
WORD SetSelectorLimit(WORD,DWORD);
int SetSoundNoise(int,int);
WORD SetStretchBltMode(HDC,WORD);
LONG SetSwapAreaSize(WORD);
@ -5064,7 +5180,6 @@ void ValidateCodeSegments(void);
LPSTR ValidateFreeSpaces(void);
void ValidateRgn(HWND32,HRGN32);
WORD VkKeyScan(WORD);
SEGPTR WIN16_GlobalLock16(HGLOBAL16);
SEGPTR WIN16_LockResource(HANDLE);
BOOL WaitEvent(HTASK);
void WaitMessage(void);
@ -5075,11 +5190,6 @@ void WriteOutProfiles(void);
BOOL WritePrivateProfileString(LPCSTR,LPCSTR,LPCSTR,LPCSTR);
BOOL WriteProfileString(LPCSTR,LPCSTR,LPCSTR);
void Yield(void);
LONG _hread(HFILE,SEGPTR,LONG);
LONG _hwrite(HFILE,LPCSTR,LONG);
LONG _llseek(HFILE,LONG,INT);
INT _lread(HFILE,SEGPTR,WORD);
INT _lwrite(HFILE,LPCSTR,WORD);
#endif /* NO_TRANSITION_TYPES */

View File

@ -21,14 +21,15 @@ typedef struct
WORD suggestedCount;
WORD valid;
WORD wMagic;
HWND hwndParent;
HWND32 hwndParent;
WINDOWPOS16 winPos[1];
} DWP;
extern void WINPOS_FindIconPos( HWND hwnd );
extern BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus);
extern BOOL WINPOS_ChangeActiveWindow( HWND hwnd, BOOL mouseMsg );
extern LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
extern void WINPOS_FindIconPos( HWND32 hwnd );
extern BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse,
BOOL32 fChangeFocus );
extern BOOL32 WINPOS_ChangeActiveWindow( HWND32 hwnd, BOOL32 mouseMsg );
extern LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect,
RECT16 *newWindowRect, RECT16 *oldWindowRect,
RECT16 *oldClientRect, SEGPTR winpos,
RECT16 *newClientRect );

View File

@ -318,7 +318,7 @@ SEGPTR NE_LockResource( HMODULE16 hModule, HGLOBAL16 handle )
/***********************************************************************
* NE_FreeResource
*/
BOOL NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle )
BOOL32 NE_FreeResource( HMODULE16 hModule, HGLOBAL16 handle )
{
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;

View File

@ -94,11 +94,15 @@ void dump_exports(struct PE_Export_Directory * pe_exports, unsigned int load_add
name = (u_char **) (((char *) load_addr) + (int) pe_exports->AddressOfNames);
dprintf_win32(stddeb,"%-32s Ordinal Virt Addr\n", "Function Name");
for(i=0; i< pe_exports->Number_Of_Functions; i++)
{
ename = (char *) (((char *) load_addr) + (int) *name++);
dprintf_win32(stddeb,"%-32s %4d %8.8lx\n", ename, *ordinal++, *function++);
}
for(i=0; i< pe_exports->Number_Of_Functions; i++) {
if (i<pe_exports->Number_Of_Names) {
ename = (char *) (((char *) load_addr) + (int) *name++);
dprintf_win32(stddeb,"%-32s %4d %8.8lx\n", ename, *ordinal++, *function++);
} else {
/* ordinals/names no longer valid, but we still got functions */
dprintf_win32(stddeb,"%-32s %4s %8.8lx\n","","",*function++);
}
}
}
FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
@ -110,153 +114,151 @@ FARPROC32 PE_FindExportedFunction(struct pe_data *pe, LPCSTR funcName)
u_char ** name, *ename;
int i;
if (!exports) return NULL;
ordinal = (u_short *) (((char *) load_addr) + (int) exports->Address_Of_Name_Ordinals);
function = (u_long *) (((char *) load_addr) + (int) exports->AddressOfFunctions);
name = (u_char **) (((char *) load_addr) + (int) exports->AddressOfNames);
for(i=0; i<exports->Number_Of_Functions; i++)
{
if(HIWORD(funcName))
if (!exports)
return NULL;
ordinal=(u_short*)(((char*)load_addr)+(int)exports->Address_Of_Name_Ordinals);
function=(u_long*)(((char*)load_addr)+(int)exports->AddressOfFunctions);
name=(u_char **)(((char*)load_addr)+(int)exports->AddressOfNames);
if (HIWORD(funcName)) {
for(i=0; i<exports->Number_Of_Names; i++)
{
ename = (char *) (((char *) load_addr) + (int) *name);
if(strcmp(ename,funcName)==0)
return (FARPROC32)(load_addr + *function);
}else{
function++;
name++;
}
} else {
/* if we got no name directory, we use the ordinal as offset */
if (!exports->Number_Of_Names) {
i = function[(int)funcName-exports->Base];
return (FARPROC32)(load_addr+i);
}
for(i=0; i<exports->Number_Of_Names; i++) {
if((int)funcName == (int)*ordinal + exports->Base)
return (FARPROC32)(load_addr + *function);
function++;
ordinal++;
}
function++;
ordinal++;
name++;
}
return NULL;
}
void fixup_imports(struct pe_data *pe, HMODULE16 hModule)
{
struct PE_Import_Directory * pe_imp;
int fixup_failed=0;
unsigned int load_addr = pe->load_addr;
int i;
NE_MODULE *ne_mod;
HMODULE16 *mod_ptr;
void
fixup_imports (struct pe_data *pe, HMODULE16 hModule)
{
struct PE_Import_Directory *pe_imp;
int fixup_failed = 0;
unsigned int load_addr = pe->load_addr;
int i;
NE_MODULE *ne_mod;
HMODULE16 *mod_ptr;
/* OK, now dump the import list */
dprintf_win32(stddeb, "\nDumping imports list\n");
/* OK, now dump the import list */
dprintf_win32 (stddeb, "\nDumping imports list\n");
/* first, count the number of imported non-internal modules */
pe_imp = pe->pe_import;
for(i=0;pe_imp->ModuleName;pe_imp++)
i++;
/* first, count the number of imported non-internal modules */
pe_imp = pe->pe_import;
for (i = 0; pe_imp->ModuleName; pe_imp++)
i++;
/* Now, allocate memory for dlls_to_init */
ne_mod = GlobalLock16(hModule);
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT,(i+1) * sizeof(HMODULE16),
hModule, FALSE, FALSE, FALSE );
mod_ptr = GlobalLock16(ne_mod->dlls_to_init);
/* load the modules and put their handles into the list */
for(i=0,pe_imp = pe->pe_import;pe_imp->ModuleName;pe_imp++)
{
char *name = (char*)load_addr+pe_imp->ModuleName;
mod_ptr[i] = LoadModule(name,(LPVOID)-1);
if(mod_ptr[i]<=(HMODULE16)32)
{
char *p, buffer[256];
/* Now, allocate memory for dlls_to_init */
ne_mod = GlobalLock16 (hModule);
ne_mod->dlls_to_init = GLOBAL_Alloc(GMEM_ZEROINIT, (i+1)*sizeof(HMODULE16),
hModule, FALSE, FALSE, FALSE);
mod_ptr = GlobalLock16 (ne_mod->dlls_to_init);
/* load the modules and put their handles into the list */
for (i = 0, pe_imp = pe->pe_import; pe_imp->ModuleName; pe_imp++) {
char *name = (char *) load_addr + pe_imp->ModuleName;
mod_ptr[i] = LoadModule (name, (LPVOID) - 1);
if (mod_ptr[i] <= (HMODULE16) 32) {
char *p, buffer[256];
/* Try with prepending the path of the current module */
GetModuleFileName( hModule, buffer, sizeof(buffer) );
if (!(p = strrchr( buffer, '\\' ))) p = buffer;
strcpy( p + 1, name );
mod_ptr[i] = LoadModule( buffer, (LPVOID)-1 );
}
if(mod_ptr[i]<=(HMODULE16)32)
{
fprintf(stderr,"Module %s not found\n",name);
exit(0);
/* Try with prepending the path of the current module */
GetModuleFileName (hModule, buffer, sizeof (buffer));
if (!(p = strrchr (buffer, '\\')))
p = buffer;
strcpy (p + 1, name);
mod_ptr[i] = LoadModule (buffer, (LPVOID) - 1);
}
if (mod_ptr[i] <= (HMODULE16) 32) {
fprintf (stderr, "Module %s not found\n", name);
exit (0);
}
i++;
}
pe_imp = pe->pe_import;
while (pe_imp->ModuleName)
{
char * Module;
struct pe_import_name * pe_name;
unsigned int * import_list, *thunk_list;
Module = ((char *) load_addr) + pe_imp->ModuleName;
dprintf_win32(stddeb, "%s\n", Module);
if(pe_imp->Import_List != 0) { /* original microsoft style */
dprintf_win32(stddeb, "Microsoft style imports used\n");
import_list = (unsigned int *)
(((unsigned int) load_addr) + pe_imp->Import_List);
thunk_list = (unsigned int *)
(((unsigned int) load_addr) + pe_imp->Thunk_List);
while(*import_list)
{
pe_name = (struct pe_import_name *) ((int) load_addr + ((unsigned)*import_list & ~0x80000000));
if((unsigned)*import_list & 0x80000000)
{
int ordinal=*import_list & (0x80000000-1);
dprintf_win32(stddeb,"--- Ordinal %s,%d\n", Module, ordinal);
*thunk_list = GetProcAddress32(MODULE_FindModule(Module),
(LPCSTR)ordinal);
if(!*thunk_list)
{
fprintf(stderr,"No implementation for %s.%d, setting to NULL\n",
Module, ordinal);
/* fixup_failed=1; */
}
}else{ /* import by name */
dprintf_win32(stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
#ifndef WINELIB /* FIXME: JBP: Should this happen in libwine.a? */
*thunk_list = GetProcAddress32(MODULE_FindModule(Module),
pe_name->Name);
if(!*thunk_list)
{
fprintf(stderr,"No implementation for %s.%d(%s), setting to NULL\n",
Module, pe_name->Hint, pe_name->Name);
/* fixup_failed=1; */
}
#else
fprintf(stderr,"JBP: Call to RELAY32_GetEntryPoint being ignored.\n");
#endif
}
import_list++;
thunk_list++;
}
} else { /* Borland style */
dprintf_win32(stddeb, "Borland style imports used\n");
thunk_list = (unsigned int *)
(((unsigned int) load_addr) + pe_imp->Thunk_List);
while(*thunk_list) {
pe_name = (struct pe_import_name *) ((int) load_addr + *thunk_list);
if((unsigned)pe_name & 0x80000000) {
fprintf(stderr,"Import by ordinal not supported\n");
exit(0);
}
dprintf_win32(stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
#ifndef WINELIB /* FIXME: JBP: Should this happen in libwine.a? */
*thunk_list = GetProcAddress32(MODULE_FindModule(Module),
pe_name->Name);
#else
fprintf(stderr,"JBP: Call to RELAY32_GetEntryPoint being ignored.\n");
#endif
if(!*thunk_list) {
fprintf(stderr,"No implementation for %s.%d, setting to NULL\n",
Module, pe_name->Hint);
/* fixup_failed=1; */
}
thunk_list++;
}
}
pe_imp++;
}
if(fixup_failed)exit(1);
pe_imp = pe->pe_import;
while (pe_imp->ModuleName) {
char *Module;
struct pe_import_name *pe_name;
unsigned int *import_list, *thunk_list;
Module = ((char *) load_addr) + pe_imp->ModuleName;
dprintf_win32 (stddeb, "%s\n", Module);
if (pe_imp->Import_List != 0) { /* original microsoft style */
dprintf_win32 (stddeb, "Microsoft style imports used\n");
import_list = (unsigned int *)(((unsigned int)load_addr)+pe_imp->Import_List);
thunk_list = (unsigned int *)(((unsigned int)load_addr)+pe_imp->Thunk_List);
while (*import_list) {
pe_name = (struct pe_import_name *) ((int) load_addr + ((unsigned) *import_list & ~0x80000000));
if ((unsigned) *import_list & 0x80000000) {
int ordinal = *import_list & (0x80000000 - 1);
dprintf_win32 (stddeb, "--- Ordinal %s,%d\n", Module, ordinal);
*thunk_list = GetProcAddress32(MODULE_FindModule (Module),
(LPCSTR) ordinal);
if (!*thunk_list) {
fprintf(stderr,"No implementation for %s.%d, setting to NULL\n",
Module, ordinal);
/* fixup_failed=1; */
}
} else { /* import by name */
dprintf_win32 (stddeb, "--- %s %s.%d\n", pe_name->Name, Module, pe_name->Hint);
*thunk_list = GetProcAddress32(MODULE_FindModule (Module),
pe_name->Name);
if (!*thunk_list) {
fprintf(stderr, "No implementation for %s.%d(%s), setting to NULL\n",
Module, pe_name->Hint, pe_name->Name);
/* fixup_failed=1; */
}
}
import_list++;
thunk_list++;
}
} else { /* Borland style */
dprintf_win32 (stddeb, "Borland style imports used\n");
thunk_list = (unsigned int *)(((unsigned int)load_addr)+pe_imp->Thunk_List);
while (*thunk_list) {
pe_name=(struct pe_import_name *)((int)load_addr+*thunk_list);
if ((unsigned) pe_name & 0x80000000) {
/* not sure about this branch, but it seems to work */
int ordinal = *thunk_list & ~0x80000000;
dprintf_win32(stddeb,"--- Ordinal %s.%d\n",Module,ordinal);
*thunk_list = GetProcAddress32(MODULE_FindModule (Module),
(LPCSTR) ordinal);
if (!*thunk_list) {
fprintf(stderr, "No implementation for %s.%d, setting to NULL\n",
Module,ordinal);
/* fixup_failed=1; */
}
} else {
dprintf_win32(stddeb,"--- %s %s.%d\n",
pe_name->Name, Module, pe_name->Hint);
*thunk_list = GetProcAddress32(MODULE_FindModule(Module),
pe_name->Name);
if (!*thunk_list) {
fprintf(stderr, "No implementation for %s.%d, setting to NULL\n",
Module, pe_name->Hint);
/* fixup_failed=1; */
}
}
thunk_list++;
}
}
pe_imp++;
}
if (fixup_failed) exit(1);
}
static void calc_vma_size(struct pe_data *pe)
@ -558,6 +560,7 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
int USER_InitApp(HINSTANCE hInstance);
void PE_InitTEB(int hTEB);
void PE_InitializeDLLs(HMODULE16 hModule);
void PE_Win32CallToStart( SIGCONTEXT *context )
{
int fs;
@ -594,7 +597,9 @@ static void PE_InitDLL(HMODULE16 hModule)
if (!(pModule->flags & NE_FFLAGS_WIN32) || !(pe = pModule->pe_module))
return;
/* FIXME: What are the correct values for parameters 2 and 3? */
/* FIXME: What is the correct value for parameter 3?
* (the MSDN library JAN96 says 'reserved for future use')
*/
/* Is this a library? */
if (pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)
@ -602,7 +607,7 @@ static void PE_InitDLL(HMODULE16 hModule)
printf("InitPEDLL() called!\n");
CallDLLEntryProc32( (FARPROC32)(pe->load_addr +
pe->pe_header->opt_coff.AddressOfEntryPoint),
hModule, 0, 0 );
hModule, DLL_PROCESS_ATTACH, 0 );
}
}

View File

@ -152,7 +152,7 @@ static void SIGNAL_SetHandler( int sig, void (*func)() )
sigset_t sig_mask;
sigemptyset(&sig_mask);
sig_act.sa_handler = func;
sig_act.sa_flags = SA_ONSTACK | SA_SIGINFO;
sig_act.sa_flags = SA_SIGINFO | SA_ONSTACK | SA_RESTART;
sig_act.sa_mask = sig_mask;
ret = sigaction( sig, &sig_act, NULL );
#endif /* __svr4__ || _SCO_DS */

View File

@ -1181,7 +1181,7 @@ DWORD WIN16_GetCurrentTask(void)
/***********************************************************************
* GetCurrentPDB (KERNEL.37)
*/
HANDLE GetCurrentPDB(void)
HANDLE16 GetCurrentPDB(void)
{
TDB *pTask;

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = memory

View File

@ -31,7 +31,7 @@
#define MIN_STR_ATOM 0xc000
#define MAX_ATOM_LEN 255
#define ATOMTOHANDLE(atom) ((HANDLE)(atom) << 2)
#define ATOMTOHANDLE(atom) ((HANDLE16)(atom) << 2)
#define HANDLETOATOM(handle) ((ATOM)(0xc000 | ((handle) >> 2)))
#define HAS_ATOM_TABLE(sel) \
@ -53,7 +53,7 @@ static HANDLE16 ATOM_InitTable( WORD selector, WORD entries )
/* Allocate the table */
handle = LOCAL_Alloc( selector, LMEM_FIXED,
sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE) );
sizeof(ATOMTABLE) + (entries-1) * sizeof(HANDLE16) );
if (!handle) return 0;
table = (ATOMTABLE *)PTR_SEG_OFF_TO_LIN( selector, handle );
table->size = entries;
@ -71,7 +71,7 @@ static HANDLE16 ATOM_InitTable( WORD selector, WORD entries )
*
* Global table initialisation.
*/
BOOL ATOM_Init(void)
BOOL32 ATOM_Init(void)
{
return ATOM_InitTable( USER_HeapSel, DEFAULT_ATOMTABLE_SIZE ) != 0;
}
@ -83,7 +83,7 @@ BOOL ATOM_Init(void)
* Return a pointer to the atom table of a given segment, creating
* it if necessary.
*/
static ATOMTABLE * ATOM_GetTable( WORD selector, BOOL create )
static ATOMTABLE * ATOM_GetTable( WORD selector, BOOL32 create )
{
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( selector, 0 );
if (!ptr->atomtable)
@ -102,7 +102,7 @@ static ATOMTABLE * ATOM_GetTable( WORD selector, BOOL create )
*
* Make an ATOMENTRY pointer from a handle (obtained from GetAtomHandle()).
*/
static ATOMENTRY * ATOM_MakePtr( WORD selector, HANDLE handle )
static ATOMENTRY * ATOM_MakePtr( WORD selector, HANDLE16 handle )
{
return (ATOMENTRY *)PTR_SEG_OFF_TO_LIN( selector, handle );
}
@ -126,7 +126,7 @@ static WORD ATOM_Hash( WORD entries, LPCSTR str, WORD len )
static ATOM ATOM_AddAtom( WORD selector, LPCSTR str )
{
WORD hash;
HANDLE entry;
HANDLE16 entry;
ATOMENTRY * entryPtr;
ATOMTABLE * table;
int len;
@ -169,7 +169,7 @@ static ATOM ATOM_DeleteAtom( WORD selector, ATOM atom )
{
ATOMENTRY * entryPtr;
ATOMTABLE * table;
HANDLE entry, *prevEntry;
HANDLE16 entry, *prevEntry;
WORD hash;
if (atom < MIN_STR_ATOM) return 0; /* Integer atom */
@ -205,7 +205,7 @@ static ATOM ATOM_FindAtom( WORD selector, LPCSTR str )
{
ATOMTABLE * table;
WORD hash;
HANDLE entry;
HANDLE16 entry;
int len;
if (str[0] == '#') return atoi( &str[1] ); /* Check for integer atom */
@ -233,7 +233,7 @@ static UINT32 ATOM_GetAtomName( WORD selector, ATOM atom,
{
ATOMTABLE * table;
ATOMENTRY * entryPtr;
HANDLE entry;
HANDLE16 entry;
char * strPtr;
UINT32 len;
char text[8];
@ -272,7 +272,7 @@ WORD InitAtomTable( WORD entries )
/***********************************************************************
* GetAtomHandle (KERNEL.73)
*/
HANDLE GetAtomHandle( ATOM atom )
HANDLE16 GetAtomHandle( ATOM atom )
{
if (atom < MIN_STR_ATOM) return 0;
return ATOMTOHANDLE( atom );

View File

@ -4,7 +4,6 @@
* Copyright 1996 Alexandre Julliard
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdio.h>
#include <stdlib.h>
#include <string.h>

View File

@ -111,7 +111,7 @@ static LOCALHEAPINFO *LOCAL_GetHeap( HANDLE16 ds )
INSTANCEDATA *ptr = (INSTANCEDATA *)PTR_SEG_OFF_TO_LIN( ds, 0 );
dprintf_local( stddeb, "Heap at %p, %04x\n", ptr, ptr->heap );
if (!ptr || !ptr->heap) return NULL;
if (IsBadReadPtr((SEGPTR)MAKELONG( ptr->heap, ds ), sizeof(LOCALHEAPINFO)))
if (IsBadReadPtr16( (SEGPTR)MAKELONG(ptr->heap,ds), sizeof(LOCALHEAPINFO)))
return NULL;
pInfo = (LOCALHEAPINFO*)((char*)ptr + ptr->heap);
if (pInfo->magic != LOCAL_HEAP_MAGIC) return NULL;

View File

@ -365,9 +365,9 @@ WORD SelectorAccessRights( WORD sel, WORD op, WORD val )
/***********************************************************************
* IsBadCodePtr (KERNEL.336)
* IsBadCodePtr16 (KERNEL.336)
*/
BOOL IsBadCodePtr( SEGPTR lpfn )
BOOL16 IsBadCodePtr16( SEGPTR lpfn )
{
WORD sel;
ldt_entry entry;
@ -383,9 +383,9 @@ BOOL IsBadCodePtr( SEGPTR lpfn )
/***********************************************************************
* IsBadStringPtr (KERNEL.337)
* IsBadStringPtr16 (KERNEL.337)
*/
BOOL IsBadStringPtr( SEGPTR ptr, WORD size )
BOOL16 IsBadStringPtr16( SEGPTR ptr, UINT16 size )
{
WORD sel;
ldt_entry entry;
@ -402,9 +402,9 @@ BOOL IsBadStringPtr( SEGPTR ptr, WORD size )
/***********************************************************************
* IsBadHugeReadPtr (KERNEL.346)
* IsBadHugeReadPtr16 (KERNEL.346)
*/
BOOL IsBadHugeReadPtr( SEGPTR ptr, DWORD size )
BOOL16 IsBadHugeReadPtr16( SEGPTR ptr, DWORD size )
{
WORD sel;
ldt_entry entry;
@ -420,9 +420,9 @@ BOOL IsBadHugeReadPtr( SEGPTR ptr, DWORD size )
/***********************************************************************
* IsBadHugeWritePtr (KERNEL.347)
* IsBadHugeWritePtr16 (KERNEL.347)
*/
BOOL IsBadHugeWritePtr( SEGPTR ptr, DWORD size )
BOOL16 IsBadHugeWritePtr16( SEGPTR ptr, DWORD size )
{
WORD sel;
ldt_entry entry;
@ -437,20 +437,20 @@ BOOL IsBadHugeWritePtr( SEGPTR ptr, DWORD size )
}
/***********************************************************************
* IsBadReadPtr (KERNEL.334)
* IsBadReadPtr16 (KERNEL.334)
*/
BOOL IsBadReadPtr( SEGPTR ptr, WORD size )
BOOL16 IsBadReadPtr16( SEGPTR ptr, UINT16 size )
{
return IsBadHugeReadPtr( ptr, size );
return IsBadHugeReadPtr16( ptr, size );
}
/***********************************************************************
* IsBadWritePtr (KERNEL.335)
* IsBadWritePtr16 (KERNEL.335)
*/
BOOL IsBadWritePtr( SEGPTR ptr, WORD size )
BOOL16 IsBadWritePtr16( SEGPTR ptr, UINT16 size )
{
return IsBadHugeWritePtr( ptr, size );
return IsBadHugeWritePtr16( ptr, size );
}

View File

@ -5,7 +5,6 @@
* Copyright 1996 Alexandre Julliard
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <ctype.h>
#include <string.h>
#include "windows.h"

View File

@ -2,6 +2,8 @@
* DEC 93 Erik Bos <erik@xs4all.nl>
*
* Copyright 1996 Marcus Meissner
* FIXME: use HFILEs instead of unixfds
* the win32 functions here get HFILEs already.
*/
#include <stdio.h>
@ -379,7 +381,7 @@ BOOL32 BuildCommDCB32W(LPCWSTR devid,LPDCB32 lpdcb) {
*/
INT16 OpenComm(LPCSTR device,UINT16 cbInQueue,UINT16 cbOutQueue)
{
int port, fd;
int port,fd;
dprintf_comm(stddeb,
"OpenComm: %s, %d, %d\n", device, cbInQueue, cbOutQueue);
@ -474,10 +476,8 @@ INT16 SetCommBreak16(INT16 fd)
/*****************************************************************************
* SetCommBreak (KERNEL32.449)
*/
BOOL32 SetCommBreak32(HANDLE32 hfile)
BOOL32 SetCommBreak32(INT32 fd)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct DosDeviceStruct *ptr;
@ -513,10 +513,8 @@ INT16 ClearCommBreak16(INT16 fd)
/*****************************************************************************
* ClearCommBreak (KERNEL32.20)
*/
BOOL32 ClearCommBreak32(HANDLE32 hfile)
BOOL32 ClearCommBreak32(INT32 fd)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct DosDeviceStruct *ptr;
dprintf_comm(stddeb,"ClearCommBreak: fd: %d\n", fd);
@ -609,10 +607,8 @@ LONG EscapeCommFunction16(UINT16 fd,UINT16 nFunction)
/*****************************************************************************
* EscapeCommFunction (KERNEL32.214)
*/
BOOL32 EscapeCommFunction32(HANDLE32 hfile,UINT32 nFunction)
BOOL32 EscapeCommFunction32(INT32 fd,UINT32 nFunction)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct termios port;
struct DosDeviceStruct *ptr;
@ -725,11 +721,9 @@ INT16 GetCommError(INT16 fd,LPCOMSTAT lpStat)
/*****************************************************************************
* ClearCommError (KERNEL32.21)
*/
BOOL32 ClearCommError(HANDLE32 hfile,LPDWORD errors,LPCOMSTAT lpStat)
BOOL32 ClearCommError(INT32 fd,LPDWORD errors,LPCOMSTAT lpStat)
{
int temperror;
FILE_OBJECT *fob=(FILE_OBJECT*)hfile;
int fd = fob->fd;
dprintf_comm(stddeb,
"ClearCommError: fd %d (current error %d)\n", fd, commerror);
@ -762,11 +756,8 @@ UINT16 GetCommEventMask(INT16 fd,UINT16 fnEvtClear)
/*****************************************************************************
* GetCommMask (KERNEL32.156)
*/
BOOL32 GetCommMask(HANDLE32 hfile,LPDWORD evtmask)
BOOL32 GetCommMask(INT32 fd,LPDWORD evtmask)
{
FILE_OBJECT *fob=(FILE_OBJECT*)hfile;
int fd = fob->fd;
dprintf_comm(stddeb,
"GetCommMask: fd %d, mask %p\n", fd, evtmask);
*evtmask = eventmask;
@ -776,11 +767,8 @@ BOOL32 GetCommMask(HANDLE32 hfile,LPDWORD evtmask)
/*****************************************************************************
* SetCommMask (KERNEL32.451)
*/
BOOL32 SetCommMask(HANDLE32 hfile,DWORD evtmask)
BOOL32 SetCommMask(INT32 fd,DWORD evtmask)
{
FILE_OBJECT *fob=(FILE_OBJECT*)hfile;
int fd = fob->fd;
dprintf_comm(stddeb,
"SetCommMask: fd %d, mask %lx\n", fd, evtmask);
eventmask = evtmask;
@ -992,10 +980,8 @@ INT16 SetCommState16(LPDCB16 lpdcb)
/*****************************************************************************
* SetCommState32 (KERNEL32.452)
*/
BOOL32 SetCommState32(HANDLE32 hfile,LPDCB32 lpdcb)
BOOL32 SetCommState32(INT32 fd,LPDCB32 lpdcb)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct termios port;
struct DosDeviceStruct *ptr;
@ -1316,10 +1302,8 @@ INT16 GetCommState16(INT16 fd, LPDCB16 lpdcb)
/*****************************************************************************
* GetCommState (KERNEL32.159)
*/
BOOL32 GetCommState32(HANDLE32 hfile, LPDCB32 lpdcb)
BOOL32 GetCommState32(INT32 fd, LPDCB32 lpdcb)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct termios port;
@ -1461,10 +1445,8 @@ INT16 TransmitCommChar16(INT16 fd,CHAR chTransmit)
/*****************************************************************************
* TransmitCommChar (KERNEL32.535)
*/
BOOL32 TransmitCommChar32(HANDLE32 hfile,CHAR chTransmit)
BOOL32 TransmitCommChar32(INT32 fd,CHAR chTransmit)
{
FILE_OBJECT *fob = (FILE_OBJECT*)hfile;
int fd = fob->fd;
struct DosDeviceStruct *ptr;
dprintf_comm(stddeb,"TransmitCommChar32(%d,'%c')\n",fd,chTransmit);
@ -1593,9 +1575,9 @@ INT16 WriteComm(INT16 fd, LPSTR lpvBuf, INT16 cbWrite)
/*****************************************************************************
* GetCommTimeouts (KERNEL32.160)
*/
BOOL32 GetCommTimeouts(HANDLE32 hfile,LPCOMMTIMEOUTS lptimeouts) {
BOOL32 GetCommTimeouts(INT32 fd,LPCOMMTIMEOUTS lptimeouts) {
dprintf_comm(stddeb,"GetCommTimeouts(%lx,%p), empty stub.\n",
(DWORD)hfile,lptimeouts
fd,lptimeouts
);
return TRUE;
}
@ -1603,9 +1585,9 @@ BOOL32 GetCommTimeouts(HANDLE32 hfile,LPCOMMTIMEOUTS lptimeouts) {
/*****************************************************************************
* SetCommTimeouts (KERNEL32.453)
*/
BOOL32 SetCommTimeouts(HANDLE32 hfile,LPCOMMTIMEOUTS lptimeouts) {
BOOL32 SetCommTimeouts(INT32 fd,LPCOMMTIMEOUTS lptimeouts) {
dprintf_comm(stddeb,"SetCommTimeouts(%lx,%p), empty stub.\n",
(DWORD)hfile,lptimeouts
fd,lptimeouts
);
return TRUE;
}

View File

@ -2006,7 +2006,7 @@ static LRESULT CC_WMCommand(HWND hDlg, WPARAM wParam, LPARAM lParam)
case 0x2cf:
CC_SwitchToFullSize(hDlg,lpp->lpcc->rgbResult,&lpp->fullsize);
InvalidateRect32( hDlg, NULL, TRUE );
SetFocus(GetDlgItem(hDlg,0x2bf));
SetFocus32(GetDlgItem(hDlg,0x2bf));
break;
case 0x2c8: /* add colors ... column by column */

View File

@ -461,7 +461,7 @@ LZCopy(HFILE src,HFILE dest) {
return ret;
}
len += ret;
wret = _lwrite(dest,buf,ret);
wret = _lwrite32(dest,buf,ret);
if (wret!=ret)
return LZERROR_WRITE;
}

View File

@ -224,6 +224,7 @@ split_keypath(LPCWSTR wp,LPWSTR **wpv,int *wpc) {
/*
* Shell initialisation, allocates keys.
*/
void SHELL_StartupRegistry();
void
SHELL_Init() {
struct passwd *pwd;
@ -265,8 +266,69 @@ SHELL_Init() {
ADD_ROOT_KEY(key_current_config);
ADD_ROOT_KEY(key_dyn_data);
#undef ADD_ROOT_KEY
SHELL_StartupRegistry();
}
void
SHELL_StartupRegistry() {
HKEY hkey,xhkey=0;
FILE *F;
char buf[200],cpubuf[200];
RegCreateKey16(HKEY_DYN_DATA,"\\PerfStats\\StatData",&xhkey);
RegCloseKey(xhkey);
RegCreateKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System\\CentralProcessor",&hkey);
#ifdef linux
F=fopen("/proc/cpuinfo","r");
if (F) {
int procnr=-1,x;
while (NULL!=fgets(buf,200,F)) {
if (sscanf(buf,"processor\t: %d",&x)) {
sprintf(buf,"%d",x);
if (xhkey)
RegCloseKey(xhkey);
procnr=x;
RegCreateKey16(hkey,buf,&xhkey);
}
if (sscanf(buf,"cpu\t\t: %s",cpubuf)) {
sprintf(buf,"CPU %s",cpubuf);
if (xhkey)
RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,buf,strlen(buf));
}
}
fclose(F);
}
if (xhkey)
RegCloseKey(xhkey);
RegCloseKey(hkey);
#else
/* FIXME */
RegCreateKey16(hkey,"0",&xhkey);
RegSetValueEx32A(xhkey,"Identifier",0,REG_SZ,"CPU 386",strlen("CPU 386"));
#endif
RegOpenKey16(HKEY_LOCAL_MACHINE,"\\HARDWARE\\DESCRIPTION\\System",&hkey);
RegSetValueEx32A(hkey,"Identifier",0,REG_SZ,"SystemType WINE",strlen("SystemType WINE"));
RegCloseKey(hkey);
/* \\SOFTWARE\\Microsoft\\Window NT\\CurrentVersion
* CurrentVersion
* CurrentBuildNumber
* CurrentType
* string RegisteredOwner
* string RegisteredOrganization
*
*/
/* System\\CurrentControlSet\\Services\\SNMP\\Parameters\\RFC1156Agent
* string SysContact
* string SysLocation
* SysServices
*/
if (-1!=gethostname(buf,200)) {
RegCreateKey16(HKEY_LOCAL_MACHINE,"System\\CurrentControlSet\\Control\\ComputerName\\ComputerName",&xhkey);
RegSetValueEx16(xhkey,"ComputerName",0,REG_SZ,buf,strlen(buf)+1);
RegCloseKey(xhkey);
}
}
/************************ SAVE Registry Function ****************************/
#define REGISTRY_SAVE_VERSION 0x00000001
@ -992,6 +1054,8 @@ _w95dkelookup(unsigned long dkeaddr,int n,struct _w95nr2da *nr2da,struct _w95key
return NULL;
}
extern time_t FileTimeToUnixTime(FILETIME*);
static void
_w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
/* Disk Key Entry structure (RGKN part) */
@ -1028,34 +1092,33 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
struct _w95nr2da *nr2da;
HFILE hfd;
int fd,lastmodified;
int lastmodified;
char magic[5];
unsigned long nr,pos,i,where,version,rgdbsection,end,off_next_rgdb;
struct _w95key *keys;
int nrofdkes;
unsigned char *data,*curdata,*nextrgdb;
OFSTRUCT ofs;
struct stat stbuf;
BY_HANDLE_FILE_INFORMATION hfdinfo;
dprintf_reg(stddeb,"Loading Win95 registry database '%s'\n",fn);
hfd=OpenFile(fn,&ofs,OF_READ);
if (hfd==HFILE_ERROR)
return;
fd = FILE_GetUnixHandle(hfd);
magic[4]=0;
if (4!=read(fd,magic,4))
if (4!=FILE_Read(hfd,magic,4))
return;
if (strcmp(magic,"CREG")) {
fprintf(stddeb,"%s is not a w95 registry.\n",fn);
return;
}
if (4!=read(fd,&version,4))
if (4!=FILE_Read(hfd,&version,4))
return;
if (4!=read(fd,&rgdbsection,4))
if (4!=FILE_Read(hfd,&rgdbsection,4))
return;
if (-1==lseek(fd,0x20,SEEK_SET))
if (-1==_llseek(hfd,0x20,SEEK_SET))
return;
if (4!=read(fd,magic,4))
if (4!=FILE_Read(hfd,magic,4))
return;
if (strcmp(magic,"RGKN")) {
dprintf_reg(stddeb,"second IFF header not RGKN, but %s\n",magic);
@ -1063,14 +1126,14 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
}
/* STEP 1: Keylink structures */
if (-1==lseek(fd,0x40,SEEK_SET))
if (-1==_llseek(hfd,0x40,SEEK_SET))
return;
where = 0x40;
end = rgdbsection;
nrofdkes = (end-where)/sizeof(struct dke)+100;
data = (char*)xmalloc(end-where);
if ((end-where)!=read(fd,data,end-where))
if ((end-where)!=FILE_Read(hfd,data,end-where))
return;
curdata = data;
@ -1144,15 +1207,15 @@ _w95_loadreg(char* fn,LPKEYSTRUCT lpkey) {
qsort(nr2da,nrofdkes,sizeof(nr2da[0]),_w95dkecomp);
/* STEP 2: keydata & values */
if (-1==fstat(fd,&stbuf))
if (!GetFileInformationByHandle(hfd,&hfdinfo))
return;
end = stbuf.st_size;
lastmodified = stbuf.st_mtime;
end = hfdinfo.nFileSizeLow;
lastmodified = FileTimeToUnixTime(&(hfdinfo.ftLastWriteTime));
if (-1==lseek(fd,rgdbsection,SEEK_SET))
if (-1==_llseek(hfd,rgdbsection,SEEK_SET))
return;
data = (char*)xmalloc(end-rgdbsection);
if ((end-rgdbsection)!=read(fd,data,end-rgdbsection))
if ((end-rgdbsection)!=FILE_Read(hfd,data,end-rgdbsection))
return;
_lclose(hfd);
curdata = data;

View File

@ -5,6 +5,7 @@
* 1995, Alex Korobka
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@ -454,7 +455,7 @@ static const char * const MessageTypeNames[SPY_MAX_MSGNUM + 1] =
};
static BOOL SPY_Exclude[SPY_MAX_MSGNUM+1];
static BOOL16 SPY_Exclude[SPY_MAX_MSGNUM+1];
static int SPY_IndentLevel = 0;
#define SPY_EXCLUDE(msg) \
@ -463,7 +464,7 @@ static int SPY_IndentLevel = 0;
/***********************************************************************
* SPY_GetMsgName
*/
const char *SPY_GetMsgName( UINT msg )
const char *SPY_GetMsgName( UINT32 msg )
{
static char buffer[20];
@ -504,7 +505,7 @@ void SPY_EnterMessage( INT32 iFlag, HWND32 hWnd, UINT32 msg,
case SPY_SENDMESSAGE32:
{
char taskName[30];
HTASK hTask = GetWindowTask16(hWnd);
HTASK16 hTask = GetWindowTask16(hWnd);
if (hTask == GetCurrentTask()) strcpy( taskName, "self" );
else if (!hTask) strcpy( taskName, "Wine" );
else sprintf( taskName, "task %04x %s",

View File

@ -62,8 +62,8 @@ find_ne_resource(
nehdoffset = LZTELL(lzfd);
LZSeek(lzfd,nehd->resource_tab_offset,SEEK_CUR);
LZREAD(&shiftcount);
dprintf_resource(stderr,"shiftcount is %d\n",shiftcount);
dprintf_resource(stderr,"reading resource typeinfo dir.\n");
dprintf_ver(stddeb,"shiftcount is %d\n",shiftcount);
dprintf_ver(stddeb,"reading resource typeinfo dir.\n");
if (!HIWORD(typeid)) typeid = (SEGPTR)(LOWORD(typeid) | 0x8000);
if (!HIWORD(resid)) resid = (SEGPTR)(LOWORD(resid) | 0x8000);
@ -73,7 +73,7 @@ find_ne_resource(
LZREAD(&ti);
if (!ti.type_id)
return 0;
dprintf_resource(stderr," ti.typeid =%04x,count=%d\n",ti.type_id,ti.count);
dprintf_ver(stddeb," ti.typeid =%04x,count=%d\n",ti.type_id,ti.count);
skipflag=0;
if (!HIWORD(typeid)) {
if ((ti.type_id&0x8000)&&(typeid!=ti.type_id))
@ -96,7 +96,7 @@ find_ne_resource(
str=xmalloc(len);
if (len!=LZRead32(lzfd,str,len))
return 0;
dprintf_resource(stderr,"read %s to compare it with %s\n",
dprintf_ver(stddeb,"read %s to compare it with %s\n",
str,(char*)PTR_SEG_TO_LIN(typeid)
);
if (lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
@ -114,7 +114,7 @@ find_ne_resource(
int len;
LZREAD(&ni);
dprintf_resource(stderr," ni.id=%4x,offset=%d,length=%d\n",
dprintf_ver(stddeb," ni.id=%4x,offset=%d,length=%d\n",
ni.id,ni.offset,ni.length
);
skipflag=1;
@ -137,7 +137,7 @@ find_ne_resource(
str=xmalloc(len);
if (len!=LZRead32(lzfd,str,len))
return 0;
dprintf_resource(stderr,"read %s to compare it with %s\n",
dprintf_ver(stddeb,"read %s to compare it with %s\n",
str,(char*)PTR_SEG_TO_LIN(typeid)
);
if (!lstrcmpi32A(str,(char*)PTR_SEG_TO_LIN(typeid)))
@ -156,7 +156,7 @@ find_ne_resource(
free(rdata);
return 0;
}
dprintf_resource(stderr,"resource found.\n");
dprintf_ver(stddeb,"resource found.\n");
*resdata= (BYTE*)rdata;
*reslen = len;
return 1;
@ -173,7 +173,7 @@ GetFileResourceSize(LPCSTR filename,SEGPTR restype,SEGPTR resid,LPDWORD off) {
int reslen;
struct ne_header_s nehd;
fprintf(stderr,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
dprintf_ver(stddeb,"GetFileResourceSize(%s,%lx,%lx,%p)\n",
filename,(LONG)restype,(LONG)resid,off
);
lzfd=LZOpenFile16(filename,&ofs,OF_READ);
@ -202,7 +202,7 @@ GetFileResource(LPCSTR filename,SEGPTR restype,SEGPTR resid,
BYTE *resdata;
int reslen=datalen;
struct ne_header_s nehd;
fprintf(stderr,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
dprintf_ver(stddeb,"GetFileResource(%s,%lx,%lx,%ld,%ld,%p)\n",
filename,(LONG)restype,(LONG)resid,off,datalen,data
);
@ -235,7 +235,7 @@ GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) {
BYTE buf[72];
VS_FIXEDFILEINFO *vffi;
dprintf_resource(stderr,"GetFileVersionInfoSize16(%s,%p)\n",filename,handle);
dprintf_ver(stddeb,"GetFileVersionInfoSize16(%s,%p)\n",filename,handle);
len=GetFileResourceSize(filename,VS_FILE_INFO,VS_VERSION_INFO,handle);
if (!len)
return 0;
@ -250,100 +250,100 @@ GetFileVersionInfoSize16(LPCSTR filename,LPDWORD handle) {
return 0;
if (*(WORD*)buf < len)
len = *(WORD*)buf;
fprintf(stderr,"->strucver=%ld.%ld,filever=%ld.%ld,productver=%ld.%ld,flagmask=%lx,flags=%lx,OS=",
dprintf_ver(stddeb,"->strucver=%ld.%ld,filever=%ld.%ld,productver=%ld.%ld,flagmask=%lx,flags=%lx,OS=",
(vffi->dwStrucVersion>>16),vffi->dwStrucVersion&0xFFFF,
vffi->dwFileVersionMS,vffi->dwFileVersionLS,
vffi->dwProductVersionMS,vffi->dwProductVersionLS,
vffi->dwFileFlagsMask,vffi->dwFileFlags
);
switch (vffi->dwFileOS&0xFFFF0000) {
case VOS_DOS:fprintf(stderr,"DOS,");break;
case VOS_OS216:fprintf(stderr,"OS/2-16,");break;
case VOS_OS232:fprintf(stderr,"OS/2-32,");break;
case VOS_NT:fprintf(stderr,"NT,");break;
case VOS_DOS:dprintf_ver(stddeb,"DOS,");break;
case VOS_OS216:dprintf_ver(stddeb,"OS/2-16,");break;
case VOS_OS232:dprintf_ver(stddeb,"OS/2-32,");break;
case VOS_NT:dprintf_ver(stddeb,"NT,");break;
case VOS_UNKNOWN:
default:
fprintf(stderr,"UNKNOWN(%ld),",vffi->dwFileOS&0xFFFF0000);break;
dprintf_ver(stddeb,"UNKNOWN(%ld),",vffi->dwFileOS&0xFFFF0000);break;
}
switch (vffi->dwFileOS & 0xFFFF) {
case VOS__BASE:fprintf(stderr,"BASE");break;
case VOS__WINDOWS16:fprintf(stderr,"WIN16");break;
case VOS__WINDOWS32:fprintf(stderr,"WIN32");break;
case VOS__PM16:fprintf(stderr,"PM16");break;
case VOS__PM32:fprintf(stderr,"PM32");break;
default:fprintf(stderr,"UNKNOWN(%ld)",vffi->dwFileOS&0xFFFF);break;
case VOS__BASE:dprintf_ver(stddeb,"BASE");break;
case VOS__WINDOWS16:dprintf_ver(stddeb,"WIN16");break;
case VOS__WINDOWS32:dprintf_ver(stddeb,"WIN32");break;
case VOS__PM16:dprintf_ver(stddeb,"PM16");break;
case VOS__PM32:dprintf_ver(stddeb,"PM32");break;
default:dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileOS&0xFFFF);break;
}
switch (vffi->dwFileType) {
default:
case VFT_UNKNOWN:
fprintf(stderr,"filetype=Unknown(%ld)",vffi->dwFileType);
dprintf_ver(stddeb,"filetype=Unknown(%ld)",vffi->dwFileType);
break;
case VFT_APP:fprintf(stderr,"filetype=APP");break;
case VFT_DLL:fprintf(stderr,"filetype=DLL");break;
case VFT_APP:dprintf_ver(stddeb,"filetype=APP");break;
case VFT_DLL:dprintf_ver(stddeb,"filetype=DLL");break;
case VFT_DRV:
fprintf(stderr,"filetype=DRV,");
dprintf_ver(stddeb,"filetype=DRV,");
switch(vffi->dwFileSubtype) {
default:
case VFT2_UNKNOWN:
fprintf(stderr,"UNKNOWN(%ld)",vffi->dwFileSubtype);
dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileSubtype);
break;
case VFT2_DRV_PRINTER:
fprintf(stderr,"PRINTER");
dprintf_ver(stddeb,"PRINTER");
break;
case VFT2_DRV_KEYBOARD:
fprintf(stderr,"KEYBOARD");
dprintf_ver(stddeb,"KEYBOARD");
break;
case VFT2_DRV_LANGUAGE:
fprintf(stderr,"LANGUAGE");
dprintf_ver(stddeb,"LANGUAGE");
break;
case VFT2_DRV_DISPLAY:
fprintf(stderr,"DISPLAY");
dprintf_ver(stddeb,"DISPLAY");
break;
case VFT2_DRV_MOUSE:
fprintf(stderr,"MOUSE");
dprintf_ver(stddeb,"MOUSE");
break;
case VFT2_DRV_NETWORK:
fprintf(stderr,"NETWORK");
dprintf_ver(stddeb,"NETWORK");
break;
case VFT2_DRV_SYSTEM:
fprintf(stderr,"SYSTEM");
dprintf_ver(stddeb,"SYSTEM");
break;
case VFT2_DRV_INSTALLABLE:
fprintf(stderr,"INSTALLABLE");
dprintf_ver(stddeb,"INSTALLABLE");
break;
case VFT2_DRV_SOUND:
fprintf(stderr,"SOUND");
dprintf_ver(stddeb,"SOUND");
break;
case VFT2_DRV_COMM:
fprintf(stderr,"COMM");
dprintf_ver(stddeb,"COMM");
break;
case VFT2_DRV_INPUTMETHOD:
fprintf(stderr,"INPUTMETHOD");
dprintf_ver(stddeb,"INPUTMETHOD");
break;
}
break;
case VFT_FONT:
fprintf(stderr,"filetype=FONT.");
dprintf_ver(stddeb,"filetype=FONT.");
switch (vffi->dwFileSubtype) {
default:
fprintf(stderr,"UNKNOWN(%ld)",vffi->dwFileSubtype);
dprintf_ver(stddeb,"UNKNOWN(%ld)",vffi->dwFileSubtype);
break;
case VFT2_FONT_RASTER:fprintf(stderr,"RASTER");break;
case VFT2_FONT_VECTOR:fprintf(stderr,"VECTOR");break;
case VFT2_FONT_TRUETYPE:fprintf(stderr,"TRUETYPE");break;
case VFT2_FONT_RASTER:dprintf_ver(stddeb,"RASTER");break;
case VFT2_FONT_VECTOR:dprintf_ver(stddeb,"VECTOR");break;
case VFT2_FONT_TRUETYPE:dprintf_ver(stddeb,"TRUETYPE");break;
}
break;
case VFT_VXD:fprintf(stderr,"filetype=VXD");break;
case VFT_STATIC_LIB:fprintf(stderr,"filetype=STATIC_LIB");break;
case VFT_VXD:dprintf_ver(stddeb,"filetype=VXD");break;
case VFT_STATIC_LIB:dprintf_ver(stddeb,"filetype=STATIC_LIB");break;
}
fprintf(stderr,"filedata=%lx.%lx\n",vffi->dwFileDateMS,vffi->dwFileDateLS);
dprintf_ver(stddeb,"filedata=%lx.%lx\n",vffi->dwFileDateMS,vffi->dwFileDateLS);
return len;
}
/* GetFileVersionInfoSize32A [VERSION.1] */
DWORD
GetFileVersionInfoSize32A(LPCSTR filename,LPDWORD handle) {
dprintf_resource(stderr,"GetFileVersionInfoSize32A(%s,%p)\n",filename,handle);
dprintf_ver(stddeb,"GetFileVersionInfoSize32A(%s,%p)\n",filename,handle);
return GetFileVersionInfoSize16(filename,handle);
}
@ -362,7 +362,7 @@ GetFileVersionInfoSize32W(LPCWSTR filename,LPDWORD handle) {
/* GetFileVersionInfo [VER.7] */
DWORD
GetFileVersionInfo16(LPCSTR filename,DWORD handle,DWORD datasize,LPVOID data) {
dprintf_resource(stderr,"GetFileVersionInfo16(%s,%ld,%ld,%p)\n->",
dprintf_ver(stddeb,"GetFileVersionInfo16(%s,%ld,%ld,%p)\n->",
filename,handle,datasize,data
);
return GetFileResource(
@ -394,7 +394,7 @@ VerFindFile16(
UINT16 flags,LPCSTR filename,LPCSTR windir,LPCSTR appdir,
LPSTR curdir,UINT16 *curdirlen,LPSTR destdir,UINT16 *destdirlen
) {
fprintf(stderr,"VerFindFile(%x,%s,%s,%s,%p,%d,%p,%d)\n",
dprintf_ver(stddeb,"VerFindFile(%x,%s,%s,%s,%p,%d,%p,%d)\n",
flags,filename,windir,appdir,curdir,*curdirlen,destdir,*destdirlen
);
strcpy(curdir,"Z:\\ROOT\\.WINE\\");/*FIXME*/
@ -441,7 +441,7 @@ VerInstallFile16(
UINT16 flags,LPCSTR srcfilename,LPCSTR destfilename,LPCSTR srcdir,
LPCSTR destdir,LPSTR tmpfile,UINT16 *tmpfilelen
) {
fprintf(stderr,"VerInstallFile(%x,%s,%s,%s,%s,%p,%d)\n",
dprintf_ver(stddeb,"VerInstallFile(%x,%s,%s,%s,%s,%p,%d)\n",
flags,srcfilename,destfilename,srcdir,destdir,tmpfile,*tmpfilelen
);
@ -541,7 +541,7 @@ VerLanguageName16(UINT16 langid,LPSTR langname,UINT16 langnamelen) {
int i;
char *buf;
fprintf(stderr,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen);
dprintf_ver(stddeb,"VerLanguageName(%d,%p,%d)\n",langid,langname,langnamelen);
/* First, check \System\CurrentControlSet\control\Nls\Locale\<langid>
* from the registry.
*/
@ -632,13 +632,13 @@ _find_data(BYTE *block,LPCSTR str) {
while (1) {
db=(struct db*)block;
fprintf(stderr,"db=%p,db->nextoff=%d,db->datalen=%d,db->name=%s,db->data=%s\n",
dprintf_ver(stddeb,"db=%p,db->nextoff=%d,db->datalen=%d,db->name=%s,db->data=%s\n",
db,db->nextoff,db->datalen,db->name,(char*)((char*)db+4+((strlen(db->name)+4)&~3))
);
if (!db->nextoff)
return NULL;
fprintf(stderr,"comparing with %s\n",db->name);
dprintf_ver(stddeb,"comparing with %s\n",db->name);
if (!strncmp(db->name,str,substrlen)) {
if (nextslash)
return _find_data(
@ -661,7 +661,7 @@ VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer,UINT16 *buflen)
struct db *db;
char *s;
fprintf(stderr,"VerQueryValue16(%p,%s,%p,%d)\n",
dprintf_ver(stddeb,"VerQueryValue16(%p,%s,%p,%d)\n",
block,subblock,buffer,*buflen
);
s=(char*)xmalloc(strlen("VS_VERSION_INFO")+strlen(subblock)+1);
@ -677,7 +677,7 @@ VerQueryValue16(SEGPTR segblock,LPCSTR subblock,SEGPTR *buffer,UINT16 *buflen)
b = b+4+((strlen(db->name)+4)&~3);
/* now look up what the resp. SEGPTR would be ... */
*buffer = (b-block)+segblock;
fprintf(stderr," -> %s=%s\n",subblock,b);
dprintf_ver(stddeb," -> %s=%s\n",subblock,b);
return 1;
}
@ -688,7 +688,7 @@ VerQueryValue32A(LPVOID vblock,LPCSTR subblock,LPVOID *vbuffer,UINT32 *buflen)
struct db *db;
char *s;
fprintf(stderr,"VerQueryValue32A(%p,%s,%p,%d)\n",
dprintf_ver(stddeb,"VerQueryValue32A(%p,%s,%p,%d)\n",
block,subblock,buffer,*buflen
);
s=(char*)xmalloc(strlen("VS_VERSION_INFO")+strlen(subblock)+1);
@ -703,7 +703,7 @@ VerQueryValue32A(LPVOID vblock,LPCSTR subblock,LPVOID *vbuffer,UINT32 *buflen)
/* let b point to data area */
b = b+4+((strlen(db->name)+4)&~3);
*buffer = b;
fprintf(stderr," -> %s=%s\n",subblock,b);
dprintf_ver(stddeb," -> %s=%s\n",subblock,b);
return 1;
}
@ -733,7 +733,7 @@ VerQueryValue32W(LPVOID vblock,LPCWSTR subblock,LPVOID *vbuffer,UINT32 *buflen)
/* let b point to data area */
b = b+4+((strlen(db->name)+4)&~3);
*buffer = b;
fprintf(stderr," -> %s=%s\n",sb,b);
dprintf_ver(stddeb," -> %s=%s\n",sb,b);
free(sb);
return 1;
}

View File

@ -89,6 +89,11 @@ struct WIN_servent {
SEGPTR s_proto WINE_PACKED; /* protocol to use */
};
typedef struct WinSock_fd_set {
u_short fd_count; /* how many are SET? */
SOCKET fd_array[FD_SETSIZE]; /* an array of SOCKETs */
} WinSock_fd_set;
struct WinSockHeap {
char ntoa_buffer[32];
@ -686,17 +691,124 @@ INT WINSOCK_recvfrom(SOCKET s, char *buf, INT len, INT flags,
return length;
}
INT WINSOCK_select(INT nfds, fd_set *readfds, fd_set *writefds,
fd_set *exceptfds, struct timeval *timeout)
INT WINSOCK_select(INT nfds, WinSock_fd_set *ws_readfds,
WinSock_fd_set *ws_writefds, WinSock_fd_set *ws_exceptfds,
struct timeval *timeout)
{
dprintf_winsock(stddeb, "WSA_select: fd # %d, ptr %8lx, ptr %8lx, ptr %8lX\n", nfds, (unsigned long) readfds, (unsigned long) writefds, (unsigned long) exceptfds);
int ret;
int i;
int count;
int highfd;
fd_set readfds,writefds,exceptfds;
FD_ZERO(&readfds);
FD_ZERO(&writefds);
FD_ZERO(&exceptfds);
dprintf_winsock(stddeb, "WSA_select called: nfds %d (ignored), ptr %8lx, ptr %8lx, ptr %8lx\n", nfds, (unsigned long) ws_readfds, (unsigned long) ws_writefds, (unsigned long) ws_exceptfds);
if (!wsa_initted) {
WSASetLastError(WSANOTINITIALISED);
dprintf_winsock(stddeb, "WSA_select: returning error WSANOTINITIALISED\n");
return SOCKET_ERROR;
}
/* FIXME */
return(select(nfds, readfds, writefds, exceptfds, timeout));
/* In some sort of attempt to be BSD-compatible, MS-Winsock accepts and
discards the nfds parameter. However, the format of windoze's fd_sets
is totally different from the BSD standard. So much for compatibility.
Hence, we must convert the winsock array-of-ints fd_set to the UNIX
bitmapped format. */
if(ws_readfds!=NULL) {
dprintf_winsock(stddeb, "readfds: (%d) ",ws_readfds->fd_count);
for(i=0;i<(ws_readfds->fd_count);i++) {
dprintf_winsock(stddeb, " %d",( (SOCKET *)&(((char *)ws_readfds)[2]) )[i]);
/*FD_SET(((SOCKET *)&(((char *)ws_readfds)[2]))[i], &readfds);*/
FD_SET(ws_readfds->fd_array[i], &readfds);
}
dprintf_winsock(stddeb, "\n");
} else {
dprintf_winsock(stddeb, "readfds: (null)\n");
}
if(ws_writefds!=NULL) {
dprintf_winsock(stddeb, "writefds: (%d) ",ws_writefds->fd_count);
for(i=0;i<(ws_writefds->fd_count);i++) {
dprintf_winsock(stddeb, " %d",( (SOCKET *)&(((char *)ws_writefds)[2]) )[i]);
/*FD_SET(((SOCKET *)&(((char *)ws_writefds)[2]))[i], &writefds);*/
FD_SET(ws_writefds->fd_array[i], &writefds);
}
dprintf_winsock(stddeb, "\n");
} else {
dprintf_winsock(stddeb, "writefds: (null)\n");
}
if(ws_exceptfds!=NULL) {
dprintf_winsock(stddeb, "exceptfds: (%d) ",ws_exceptfds->fd_count);
for(i=0;i<(ws_exceptfds->fd_count);i++) {
dprintf_winsock(stddeb, " %d",( (SOCKET *)&(((char *)ws_exceptfds)[2]) )[i]);
/*FD_SET(((SOCKET *)&(((char *)ws_exceptfds)[2]))[i], &exceptfds);*/
FD_SET(ws_exceptfds->fd_array[i], &exceptfds);
}
dprintf_winsock(stddeb, "\n");
} else {
dprintf_winsock(stddeb, "exceptfds: (null)\n");
}
/* Make the select() call */
dprintf_winsock(stddeb, "WSA_select: calling select()\n");
highfd=256; /* We should count them, but this works */
ret=select(highfd, &readfds, &writefds, &exceptfds, timeout);
dprintf_winsock(stddeb, "WSA_select: select() returned %d\n",ret);
if(ret<0) {
errno_to_wsaerrno();
dprintf_winsock(stddeb, "WSA_select returning: Error %d\n",SOCKET_ERROR);
return SOCKET_ERROR;
}
/* update the winsock fd sets */
if(ws_readfds!=NULL) {
dprintf_winsock(stddeb, "readfds: ");
count=0;
for(i=0;i<highfd;i++) {
if(FD_ISSET(i,&readfds)) {
dprintf_winsock(stddeb, " %d",i);
ws_readfds->fd_array[count++]=i;
}
}
dprintf_winsock(stddeb, " (%d)\n",count);
ws_readfds->fd_count=count;
} else {
dprintf_winsock(stddeb, "readfds: (null)\n");
}
if(ws_writefds!=NULL) {
dprintf_winsock(stddeb, "writefds: ");
count=0;
for(i=0;i<highfd;i++) {
if(FD_ISSET(i,&writefds)) {
dprintf_winsock(stddeb, " %d",i);
ws_writefds->fd_array[count++]=i;
}
}
dprintf_winsock(stddeb, " (%d)\n",count);
ws_writefds->fd_count=count;
} else {
dprintf_winsock(stddeb, "writefds: (null)\n");
}
if(ws_exceptfds!=NULL) {
dprintf_winsock(stddeb, "exceptfds: ");
count=0;
for(i=0;i<highfd;i++) {
if(FD_ISSET(i,&exceptfds)) {
dprintf_winsock(stddeb, " %d",i);
ws_exceptfds->fd_array[count++]=i;
}
}
dprintf_winsock(stddeb, " (%d)\n",count);
ws_exceptfds->fd_count=count;
} else {
dprintf_winsock(stddeb, "exceptfds: (null)\n");
}
dprintf_winsock(stddeb, "WSA_select returning: %d\n",ret);
return(ret);
}
INT WINSOCK_send(SOCKET s, char *buf, INT len, INT flags)
@ -1363,10 +1475,23 @@ INT WSAAsyncSelect(SOCKET s, HWND hWnd, u_int wMsg, long lEvent)
}
}
INT WSAFDIsSet(INT fd, fd_set *set)
INT WSAFDIsSet(SOCKET fd, WinSock_fd_set *set)
{
return( FD_ISSET(fd, set) );
}
int i = set->fd_count;
dprintf_winsock(stddeb, "__WSAFDIsSet(%d,%8lx)\n",fd,(unsigned long)set);
while (i--)
{
if (set->fd_array[i] == fd)
{
dprintf_winsock(stddeb, "__WSAFDIsSet returning 1\n");
return 1;
}
}
dprintf_winsock(stddeb, "__WSAFDIsSet returning 0\n");
return 0;
}
INT WSACancelAsyncRequest(HANDLE hAsyncTaskHandle)
{

View File

@ -254,7 +254,7 @@ INT16 wvsnprintf16( LPSTR buffer, UINT16 maxlen, LPCSTR spec, LPCVOID args )
break;
case WPR_WSTRING: /* No Unicode in Win16 */
case WPR_STRING:
if (IsBadReadPtr( *(SEGPTR *)args, 1 )) cur_arg = (DWORD)"";
if (IsBadReadPtr16( *(SEGPTR *)args, 1 )) cur_arg = (DWORD)"";
else cur_arg = (DWORD)PTR_SEG_TO_LIN( *(SEGPTR *)args );
args = (SEGPTR *)args + 1;
break;

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = miscemu

View File

@ -12,10 +12,13 @@
#include "ldt.h"
#include "module.h"
#include "miscemu.h"
#include "drive.h"
#include "msdos.h"
#include "stddebug.h"
/* #define DEBUG_INT */
#include "debug.h"
#define DOS_GET_DRIVE(reg) ((reg) ? (reg) - 1 : DRIVE_GetCurrentDrive())
/* Structure for real-mode callbacks */
typedef struct
@ -196,26 +199,24 @@ void INT_Int31Handler( SIGCONTEXT *context )
* ES:DI points to real-mode call structure
* Currently we just print it out and return error.
*/
RESET_CFLAG(context);
{
REALMODECALL *p = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( ES_reg(context), DI_reg(context) );
fprintf(stdnimp,
"RealModeInt %02x: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
" ESI=%08lx EDI=%08lx ES=%04x DS=%04x\n",
BL_reg(context), p->eax, p->ebx, p->ecx, p->edx,
p->esi, p->edi, p->es, p->ds );
/* Compton's 1995 encyclopedia does its MSCDEX calls through
* this interrupt. Why? Who knows...
*/
if ((BL_reg(context) == 0x2f) && ((p->eax & 0xFF00) == 0x1500))
{
do_mscdex( context );
switch (BL_reg(context)) {
case 0x2f: /* int2f */
switch ((p->eax & 0xFF00)>>8) {
case 0x15:
/* MSCDEX hook */
AX_reg(context) = p->eax & 0xFFFF;
do_mscdex( context );
break;
default:
SET_CFLAG(context);
break;
}
break;
}
/* NETAPI.DLL of Win95 does AX=6506 to fetch a realmode ptr
* to the COLLATE table.
*/
if (BL_reg(context) == 0x21) {
case 0x21: /* int21 */
switch ((p->eax & 0xFF00)>>8) {
case 0x65:
switch (p->eax & 0xFF) {
@ -235,16 +236,76 @@ void INT_Int31Handler( SIGCONTEXT *context )
default:
SET_CFLAG(context);
}
break;
case 0x44:
switch (p->eax & 0xFF) {
case 0x0D:{/* generic block device request */
BYTE *dataptr = DOSMEM_RealMode2Linear((p->ds)*0x1000+(p->edx & 0xFFFF));
int drive = DOS_GET_DRIVE(p->ebx&0xFF);
if ((p->ecx & 0xFF00) != 0x0800) {
SET_CFLAG(context);
break;
}
switch (p->ecx & 0xFF) {
case 0x66:{
char label[12],fsname[9],path[4];
DWORD serial;
strcpy(path,"x:\\");path[0]=drive+'A';
GetVolumeInformation32A(path,label,12,&serial,NULL,NULL,fsname,9);
*(WORD*)dataptr = 0;
memcpy(dataptr+2,&serial,4);
memcpy(dataptr+6,label ,11);
memcpy(dataptr+17,fsname,8);
break;
}
case 0x60: /* get device parameters */
/* used by defrag.exe of win95 */
memset(dataptr, 0, 0x26);
dataptr[0] = 0x04;
dataptr[6] = 0; /* media type */
if (drive > 1) {
dataptr[1] = 0x05; /* fixed disk */
setword(&dataptr[2], 0x01); /* non removable */
setword(&dataptr[4], 0x300); /* # of cylinders */
} else {
dataptr[1] = 0x07; /* block dev, floppy */
setword(&dataptr[2], 0x02); /* removable */
setword(&dataptr[4], 80); /* # of cylinders */
}
CreateBPB(drive, &dataptr[7]);
break;
default:
SET_CFLAG(context);
break;
}
}
break;
default:
SET_CFLAG(context);
break;
}
default:
SET_CFLAG(context);
break;
}
break;
default:
SET_CFLAG(context);
break;
}
if (EFL_reg(context)&1) {
fprintf(stdnimp,
"RealModeInt %02x: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
" ESI=%08lx EDI=%08lx ES=%04x DS=%04x\n",
BL_reg(context), p->eax, p->ebx, p->ecx, p->edx,
p->esi, p->edi, p->es, p->ds
);
}
SET_CFLAG(context);
}
break;
case 0x0301: /* Call real mode procedure with far return */
{
REALMODECALL *p = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( ES_reg(context), DI_reg(context) );
@ -274,9 +335,12 @@ void INT_Int31Handler( SIGCONTEXT *context )
REALMODECALL *p = (REALMODECALL *)PTR_SEG_OFF_TO_LIN( ES_reg(context), DI_reg(context) );
fprintf(stdnimp,
"AllocRMCB: EAX=%08lx EBX=%08lx ECX=%08lx EDX=%08lx\n"
" ESI=%08lx EDI=%08lx ES=%04x DS=%04x CS:IP=%04x:%04x\n",
" ESI=%08lx EDI=%08lx ES=%04x DS=%04x CS:IP=%04x:%04x\n"
" Function to call: %04x:%04x\n",
p->eax, p->ebx, p->ecx, p->edx,
p->esi, p->edi, p->es, p->ds, p->cs, p->ip );
p->esi, p->edi, p->es, p->ds, p->cs, p->ip,
DS_reg(context),SI_reg(context)
);
SET_CFLAG(context);
}
break;

View File

@ -195,8 +195,8 @@ static BYTE *INSTR_GetOperandAddr( SIGCONTEXT *context, BYTE *instr,
*
* Emulate the LDS (and LES,LFS,etc.) instruction.
*/
static BOOL INSTR_EmulateLDS( SIGCONTEXT *context, BYTE *instr, int long_op,
int long_addr, int segprefix, int *len )
static BOOL32 INSTR_EmulateLDS( SIGCONTEXT *context, BYTE *instr, int long_op,
int long_addr, int segprefix, int *len )
{
WORD seg;
BYTE *regmodrm = instr + 1 + (*instr == 0x0f);

View File

@ -98,7 +98,7 @@ void ChopOffWhiteSpace(char *string)
string[length] = '\0';
}
static void CreateBPB(int drive, BYTE *data)
void CreateBPB(int drive, BYTE *data)
{
if (drive > 1) {
setword(data, 512);
@ -232,6 +232,9 @@ static void ioctlGenericBlkDevReq( SIGCONTEXT *context )
return;
}
switch (CL_reg(context)) {
case 0x4a: /* lock logical volume */
dprintf_int(stddeb,"int21: lock logical volume (%d) level %d mode %d\n",drive,BH_reg(context),DX_reg(context));
return;
case 0x60: /* get device parameters */
/* used by w4wgrp's winfile */
memset(dataptr, 0, 0x26);
@ -252,6 +255,23 @@ static void ioctlGenericBlkDevReq( SIGCONTEXT *context )
CreateBPB(drive, &dataptr[7]);
RESET_CFLAG(context);
return;
case 0x66:/* get disk serial number */
{ char label[12],fsname[9],path[4];
DWORD serial;
strcpy(path,"x:\\");path[0]=drive+'A';
GetVolumeInformation32A(
path,label,12,&serial,NULL,NULL,fsname,9
);
*(WORD*)dataptr = 0;
memcpy(dataptr+2,&serial,4);
memcpy(dataptr+6,label ,11);
memcpy(dataptr+17,fsname,8);
return;
}
case 0x6a:
dprintf_int(stddeb,"int21: logical volume %d unlocked.\n",drive);
return;
default:
INT_BARF( context, 0x21 );
}
@ -285,7 +305,7 @@ static void INT21_GetSystemTime( SIGCONTEXT *context )
/* Note hundredths of seconds */
}
static void CreateFile( SIGCONTEXT *context )
static void INT21_CreateFile( SIGCONTEXT *context )
{
AX_reg(context) = _lcreat( PTR_SEG_OFF_TO_LIN( DS_reg(context),
DX_reg(context) ), CX_reg(context) );
@ -439,7 +459,7 @@ void ExtendedOpenCreateFile(SIGCONTEXT *context )
AL_reg(context) = BL_reg(context);
/* CX is still the same */
DX_reg(context) = SI_reg(context);
CreateFile(context);
INT21_CreateFile(context);
if (EFL_reg(context) & 0x0001) { /*no file open, flags set */
dprintf_int(stddeb, "int21: extended open/create: truncfailed");
return;
@ -466,7 +486,7 @@ void ExtendedOpenCreateFile(SIGCONTEXT *context )
AL_reg(context) = BL_reg(context);
/* CX should still be the same */
DX_reg(context) = SI_reg(context);
CreateFile(context);
INT21_CreateFile(context);
if (EFL_reg(context) & 0x0001) { /*no file open, flags set */
dprintf_int(stddeb, "int21: extended open/create: create failed\n");
return;
@ -1172,10 +1192,10 @@ void DOS3Call( SIGCONTEXT *context )
case 0x3f: /* "READ" - READ FROM FILE OR DEVICE */
{
LONG result = _hread( BX_reg(context),
PTR_SEG_OFF_TO_SEGPTR( DS_reg(context),
DX_reg(context) ),
CX_reg(context) );
LONG result = WIN16_hread( BX_reg(context),
PTR_SEG_OFF_TO_SEGPTR( DS_reg(context),
DX_reg(context) ),
CX_reg(context) );
if (result == -1)
{
AX_reg(context) = DOS_ExtendedError;
@ -1250,7 +1270,18 @@ void DOS3Call( SIGCONTEXT *context )
case 0x01:
break;
case 0x05:{ /* IOCTL - WRITE TO BLOCK DEVICE CONTROL CHANNEL */
BYTE *dataptr = PTR_SEG_OFF_TO_LIN(DS_reg(context),DX_reg(context));
int i;
int drive = DOS_GET_DRIVE(BL_reg(context));
fprintf(stdnimp,"int21: program tried to write to block device control channel of drive %d:\n",drive);
for (i=0;i<CX_reg(context);i++)
fprintf(stdnimp,"%02x ",dataptr[i]);
fprintf(stdnimp,"\n");
AX_reg(context)=CX_reg(context);
break;
}
case 0x08: /* Check if drive is removable. */
switch(GetDriveType16( DOS_GET_DRIVE( BL_reg(context) )))
{
@ -1521,11 +1552,34 @@ void DOS3Call( SIGCONTEXT *context )
case 0x61: /* UNUSED */
case 0x63: /* UNUSED */
case 0x64: /* OS/2 DOS BOX */
case 0x65: /* GET EXTENDED COUNTRY INFORMATION */
INT_BARF( context, 0x21 );
SET_CFLAG(context);
break;
break;
case 0x65:{/* GET EXTENDED COUNTRY INFORMATION */
extern WORD WINE_LanguageId;
BYTE *dataptr=PTR_SEG_OFF_TO_LIN(ES_reg(context),DI_reg(context));;
switch (AL_reg(context)) {
case 0x01:
dataptr[0] = 0x1;
*(WORD*)(dataptr+1) = 41;
*(WORD*)(dataptr+3) = WINE_LanguageId;
*(WORD*)(dataptr+5) = CodePage;
break;
case 0x06: {
extern DWORD DOSMEM_CollateTable;
dataptr[0] = 0x06;
*(DWORD*)(dataptr+1) = MAKELONG(DOSMEM_CollateTable & 0xFFFF,DOSMEM_AllocSelector(DOSMEM_CollateTable>>16));
CX_reg(context) = 258;/*FIXME: size of table?*/
break;
}
default:
INT_BARF( context, 0x21 );
SET_CFLAG(context);
break;
}
break;
}
case 0x66: /* GLOBAL CODE PAGE TABLE */
switch (AL_reg(context))
{
@ -1541,7 +1595,7 @@ void DOS3Call( SIGCONTEXT *context )
break;
case 0x67: /* SET HANDLE COUNT */
SetHandleCount( BX_reg(context) );
SetHandleCount16( BX_reg(context) );
if (DOS_ExtendedError)
{
AX_reg(context) = DOS_ExtendedError;
@ -1603,6 +1657,8 @@ void DOS3Call( SIGCONTEXT *context )
SET_CFLAG(context);
}
break;
case 0xa0:
break;
case 0x3b: /* Change directory */
case 0x41: /* Delete file */
case 0x43: /* Get/Set file attributes */

View File

@ -1929,7 +1929,7 @@ LONG mmioWrite(HMMIO16 hmmio, HPCSTR pch, LONG cch)
dprintf_mmsys(stddeb, "mmioWrite(%04X, %p, %ld);\n", hmmio, pch, cch);
lpmminfo = (LPMMIOINFO)GlobalLock16(hmmio);
if (lpmminfo == NULL) return 0;
count = _lwrite(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
count = _lwrite32(LOWORD(lpmminfo->dwReserved2), (LPSTR)pch, cch);
GlobalUnlock16(hmmio);
return count;
}
@ -2017,7 +2017,7 @@ UINT mmioAdvance(HMMIO16 hmmio, MMIOINFO * lpmmioinfo, UINT uFlags)
lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
}
if (uFlags == MMIO_WRITE) {
count = _lwrite(LOWORD(lpmminfo->dwReserved2),
count = _lwrite32(LOWORD(lpmminfo->dwReserved2),
lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
}
lpmmioinfo->pchNext += count;

View File

@ -120,7 +120,7 @@ HANDLE CreateMetaFile(LPCSTR lpFilename)
{
mh->mtType = 1; /* disk */
hFile = _lcreat(lpFilename, 0);
if (_lwrite(hFile, (char *)mh, MFHEADERSIZE) == -1)
if (_lwrite32(hFile, (char *)mh, MFHEADERSIZE) == -1)
{
GlobalFree16(dc->w.hMetaFile);
return 0;
@ -165,7 +165,7 @@ HMETAFILE16 CopyMetaFile(HMETAFILE16 hSrcMetaFile, LPCSTR lpFilename)
hFile = _lcreat(lpFilename, 0);
j=mh->mtType;
mh->mtType=1; /* disk file version stores 1 here */
i=_lwrite(hFile, (char *)mh, mh->mtSize * 2) ;
i=_lwrite32(hFile, (char *)mh, mh->mtSize * 2) ;
mh->mtType=j; /* restore old value [0 or 1] */
_lclose(hFile);
if (i == -1)
@ -241,7 +241,7 @@ HMETAFILE16 CloseMetaFile(HDC hdc)
GlobalFree16(dc->w.hMetaFile);
return 0;
}
if (_lwrite(hFile, (char *)mh, MFHEADERSIZE) == -1)
if (_lwrite32(hFile, (char *)mh, MFHEADERSIZE) == -1)
{
GlobalFree16(dc->w.hMetaFile);
return 0;
@ -806,7 +806,7 @@ HMETAFILE16 MF_WriteRecord(HMETAFILE16 hmf, METARECORD *mr, WORD rlen)
else if (mh->mtType == 1) /* disk based metafile */
{
dprintf_metafile(stddeb,"Writing record to disk\n");
if (_lwrite(mh->mtNoParameters, (char *)mr, rlen) == -1)
if (_lwrite32(mh->mtNoParameters, (char *)mr, rlen) == -1)
{
GlobalUnlock16(hmf);
return 0;

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
PROGRAM = winerc

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = resources

View File

@ -1,4 +1,4 @@
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
PROGRAM = build

View File

@ -16,118 +16,111 @@
#include "windows.h"
#include "winbase.h"
#include "winerror.h"
#include "file.h"
#include "handle32.h"
#include "string32.h"
#include "dos_fs.h"
#include "xmalloc.h"
#include "stddebug.h"
#define DEBUG_WIN32
#include "debug.h"
extern FILE_OBJECT *hstdin;
extern FILE_OBJECT *hstdout;
extern FILE_OBJECT *hstderr;
static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime);
static int TranslateCreationFlags(DWORD create_flags);
static int TranslateAccessFlags(DWORD access_flags);
int TranslateProtectionFlags(DWORD);
#ifndef MAP_ANON
#define MAP_ANON 0
#endif
/***********************************************************************
* OpenFileMappingA (KERNEL32.397)
* FIXME: stub
*
*/
HANDLE32 OpenFileMapping(DWORD access, BOOL inherit,const char *fname)
{
return 0;
}
/***********************************************************************
* CreateFileMappingA (KERNEL32.46)
*
*/
int TranslateProtectionFlags(DWORD);
HANDLE32 CreateFileMapping(HANDLE32 h,SECURITY_ATTRIBUTES *ats,
DWORD pot, DWORD sh, DWORD hlow, const char * lpName )
{
FILE_OBJECT *file_obj;
FILEMAP_OBJECT *filemap_obj;
int fd;
if (sh)
{
/***********************************************************************
* CreateFileMapping32A (KERNEL32.46)
*/
HANDLE32 CreateFileMapping32A(HANDLE32 h,LPSECURITY_ATTRIBUTES ats,
DWORD pot, DWORD sh, DWORD hlow, LPCSTR lpName )
{
HFILE hfile;
FILEMAP_OBJECT *filemap_obj;
if (sh) {
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
fd = open(lpName, O_CREAT, 0666);
if(fd == -1)
{
hfile = _lcreat(lpName,1);
if(hfile == HFILE_ERROR) {
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
file_obj = (FILE_OBJECT *)
CreateKernelObject(sizeof(FILE_OBJECT));
if(file_obj == NULL)
{
filemap_obj=(FILEMAP_OBJECT *)CreateKernelObject(sizeof(FILEMAP_OBJECT));
if(filemap_obj == NULL) {
_lclose(hfile);
SetLastError(ERROR_UNKNOWN);
return 0;
}
filemap_obj = (FILEMAP_OBJECT *)
CreateKernelObject(sizeof(FILEMAP_OBJECT));
if(filemap_obj == NULL)
{
ReleaseKernelObject(file_obj);
SetLastError(ERROR_UNKNOWN);
return 0;
}
file_obj->common.magic = KERNEL_OBJECT_FILE;
file_obj->fd = fd;
file_obj->type = FILE_TYPE_DISK;
filemap_obj->common.magic = KERNEL_OBJECT_FILEMAP;
filemap_obj->file_obj = file_obj;
filemap_obj->hfile = hfile;
filemap_obj->prot = TranslateProtectionFlags(pot);
filemap_obj->size = hlow;
return (HANDLE32)filemap_obj;;
}
/***********************************************************************
* CreateFileMapping32W (KERNEL32.47)
*
*/
HANDLE32 CreateFileMapping32W(HANDLE32 h,LPSECURITY_ATTRIBUTES ats,
DWORD pot, DWORD sh, DWORD hlow, LPCWSTR lpName)
{
HANDLE32 res;
LPSTR aname = STRING32_DupUniToAnsi(lpName);
res = CreateFileMapping32A(h,ats,pot,sh,hlow,aname);
free(aname);
return res;
}
/***********************************************************************
* MapViewOfFileEx (KERNEL32.386)
*
*/
void *MapViewOfFileEx(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,
MAP_ANON|MAP_PRIVATE,
((FILEMAP_OBJECT *)handle)->file_obj->fd,
FILE_GetUnixHandle(((FILEMAP_OBJECT *)handle)->hfile),
offlo);
}
/***********************************************************************
* GetFileInformationByHandle (KERNEL32.219)
*
*/
DWORD GetFileInformationByHandle(FILE_OBJECT *hFile,
BY_HANDLE_FILE_INFORMATION *lpfi)
DWORD GetFileInformationByHandle(HFILE hFile,BY_HANDLE_FILE_INFORMATION *lpfi)
{
struct stat file_stat;
int rc;
struct stat file_stat;
int rc;
int unixfd = FILE_GetUnixHandle(hFile);
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
rc = fstat(hFile->fd, &file_stat);
if(rc == -1)
{
if (unixfd==-1)
return 0;
rc = fstat(unixfd,&file_stat);
if(rc == -1) {
SetLastError(ErrnoToLastError(errno));
return 0;
}
@ -162,7 +155,6 @@ DWORD GetFileInformationByHandle(FILE_OBJECT *hFile,
return 1;
}
static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime)
{
/* This isn't anywhere close to being correct, but should
@ -172,91 +164,68 @@ static void UnixTimeToFileTime(time_t unix_time, FILETIME *filetime)
filetime->dwHighDateTime = (unix_time & 0xFFFF0000) >> 16;
}
/***********************************************************************
* GetFileType (KERNEL32.222)
*
* GetFileType currently only supports stdin, stdout, and stderr, which
* are considered to be of type FILE_TYPE_CHAR.
*/
DWORD GetFileType(FILE_OBJECT *hFile)
time_t FileTimeToUnixTime(FILETIME *filetime)
{
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_UNKNOWN);
return FILE_TYPE_UNKNOWN;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_UNKNOWN);
return FILE_TYPE_UNKNOWN;
}
return hFile->type;
/* reverse of UnixTimeToFileTime */
return filetime->dwLowDateTime+(filetime->dwHighDateTime<<16);
}
/***********************************************************************
* GetStdHandle (KERNEL32.276)
* FIXME: We should probably allocate filehandles for stdin/stdout/stderr
* at task creation (with HFILE-handle 0,1,2 respectively) and
* return them here. Or at least look, if we created them already.
*/
HANDLE32 GetStdHandle(DWORD nStdHandle)
HFILE GetStdHandle(DWORD nStdHandle)
{
HANDLE32 rc;
HFILE hfile;
int unixfd;
switch(nStdHandle)
{
case STD_INPUT_HANDLE:
rc = (HANDLE32)hstdin;
unixfd = 0;
break;
case STD_OUTPUT_HANDLE:
rc = (HANDLE32)hstdout;
unixfd = 1;
break;
case STD_ERROR_HANDLE:
rc = (HANDLE32)hstderr;
unixfd = 2;
break;
default:
rc = INVALID_HANDLE_VALUE;
SetLastError(ERROR_INVALID_HANDLE);
break;
return HFILE_ERROR;
}
return rc;
hfile = FILE_DupUnixHandle(unixfd);
if (hfile == HFILE_ERROR)
return HFILE_ERROR;
FILE_SetFileType( hfile, FILE_TYPE_CHAR );
return hfile;
}
/***********************************************************************
* SetFilePointer (KERNEL32.492)
*
* Luckily enough, this function maps almost directly into an lseek
* call, the exception being the use of 64-bit offsets.
*/
DWORD SetFilePointer(FILE_OBJECT *hFile, LONG distance, LONG *highword,
DWORD SetFilePointer(HFILE hFile, LONG distance, LONG *highword,
DWORD method)
{
int rc;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return ((DWORD)0xFFFFFFFF);
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_INVALID_HANDLE);
return ((DWORD)0xFFFFFFFF);
}
LONG rc;
if(highword != NULL)
{
if(*highword != 0)
{
dprintf_win32(stddeb, "SetFilePointer: 64-bit offsets not yet supported.\n");
dprintf_file(stddeb, "SetFilePointer: 64-bit offsets not yet supported.\n");
return -1;
}
}
rc = lseek(hFile->fd, distance, method);
rc = _llseek(hFile, distance, method);
if(rc == -1)
SetLastError(ErrnoToLastError(errno));
return rc;
@ -265,74 +234,52 @@ DWORD SetFilePointer(FILE_OBJECT *hFile, LONG distance, LONG *highword,
/***********************************************************************
* WriteFile (KERNEL32.578)
*/
BOOL WriteFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
LPDWORD numberOfBytesWritten, LPOVERLAPPED lpOverlapped)
BOOL32 WriteFile(HFILE hFile, LPVOID lpBuffer, DWORD numberOfBytesToWrite,
LPDWORD numberOfBytesWritten, LPOVERLAPPED lpOverlapped)
{
int written;
LONG res;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
res = _lwrite32(hFile,lpBuffer,numberOfBytesToWrite);
if (res==-1) {
SetLastError(ErrnoToLastError(errno));
return FALSE;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
written = write(hFile->fd, lpBuffer, numberOfBytesToWrite);
if(numberOfBytesWritten)
*numberOfBytesWritten = written;
return 1;
*numberOfBytesWritten = res;
return TRUE;
}
/***********************************************************************
* ReadFile (KERNEL32.428)
*/
BOOL ReadFile(FILE_OBJECT *hFile, LPVOID lpBuffer, DWORD numtoread,
LPDWORD numread, LPOVERLAPPED lpOverlapped)
BOOL32 ReadFile(HFILE hFile, LPVOID lpBuffer, DWORD numtoread,
LPDWORD numread, LPOVERLAPPED lpOverlapped)
{
int actual_read;
if(ValidateKernelObject((HANDLE32)hFile) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if(hFile->common.magic != KERNEL_OBJECT_FILE)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
actual_read = read(hFile->fd, lpBuffer, numtoread);
if(actual_read == -1)
{
actual_read = _lread32(hFile,lpBuffer,numtoread);
if(actual_read == -1) {
SetLastError(ErrnoToLastError(errno));
return 0;
return FALSE;
}
if(numread)
*numread = actual_read;
return 1;
return TRUE;
}
/*************************************************************************
* CreateFile (KERNEL32.45)
* CreateFile32A (KERNEL32.45)
*
* Doesn't support character devices, pipes, template files, or a
* lot of the 'attributes' flags yet.
*/
HANDLE32 CreateFileA(LPSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES security, DWORD creation,
DWORD attributes, HANDLE32 template)
HFILE CreateFile32A(LPCSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES security, DWORD creation,
DWORD attributes, HANDLE32 template)
{
int access_flags, create_flags;
int fd;
FILE_OBJECT *file_obj;
int type;
/* Translate the various flags to Unix-style.
*/
@ -340,7 +287,7 @@ HANDLE32 CreateFileA(LPSTR filename, DWORD access, DWORD sharing,
create_flags = TranslateCreationFlags(creation);
if(template)
dprintf_win32(stddeb, "CreateFile: template handles not supported.\n");
dprintf_file(stddeb, "CreateFile: template handles not supported.\n");
/* If the name starts with '\\?' or '\\.', ignore the first 3 chars.
*/
@ -351,76 +298,48 @@ HANDLE32 CreateFileA(LPSTR filename, DWORD access, DWORD sharing,
*/
if(!strncmp(filename, "\\\\", 2))
{
dprintf_win32(stddeb, "CreateFile: UNC names not supported.\n");
dprintf_file(stddeb, "CreateFile: UNC names not supported.\n");
SetLastError(ERROR_CALL_NOT_IMPLEMENTED);
return INVALID_HANDLE_VALUE;
return HFILE_ERROR;
}
/* If the name is either CONIN$ or CONOUT$, give them stdin
* or stdout, respectively.
*/
if(!strcmp(filename, "CONIN$"))
{
type = FILE_TYPE_CHAR;
fd = 0;
}
else if(!strcmp(filename, "CONOUT$"))
{
type = FILE_TYPE_CHAR;
fd = 1;
}
else
{
const char *unixName = DOSFS_GetUnixFileName( filename, FALSE );
type = FILE_TYPE_DISK;
if(!strcmp(filename, "CONIN$")) return GetStdHandle( STD_INPUT_HANDLE );
if(!strcmp(filename, "CONOUT$")) return GetStdHandle( STD_OUTPUT_HANDLE );
/* Try to open the file.
*/
if (!unixName ||
((fd = open(unixName, access_flags | create_flags, 0666)) == -1))
{
SetLastError(ErrnoToLastError(errno));
return INVALID_HANDLE_VALUE;
}
}
return FILE_Open( filename, access_flags | create_flags );
}
/* We seem to have succeeded, so allocate a kernel object
* and set it up.
*/
file_obj = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(file_obj == NULL)
{
SetLastError(ERROR_INVALID_HANDLE);
return INVALID_HANDLE_VALUE;
}
file_obj->common.magic = KERNEL_OBJECT_FILE;
file_obj->fd = fd;
file_obj->type = type;
file_obj->misc_flags = attributes;
file_obj->access_flags = access_flags;
file_obj->create_flags = create_flags;
return (HANDLE32)file_obj;
/*************************************************************************
* CreateFile32W (KERNEL32.48)
*/
HFILE CreateFile32W(LPCWSTR filename, DWORD access, DWORD sharing,
LPSECURITY_ATTRIBUTES security, DWORD creation,
DWORD attributes, HANDLE32 template)
{
HFILE res;
LPSTR afn = STRING32_DupUniToAnsi(filename);
res = CreateFile32A(afn,access,sharing,security,creation,attributes,template);
free(afn);
return res;
}
/*************************************************************************
* W32_SetHandleCount (KERNEL32.??)
*
* SetHandleCount32 (KERNEL32.494)
*/
UINT W32_SetHandleCount(UINT cHandles)
UINT32 SetHandleCount32( UINT32 cHandles )
{
return SetHandleCount(cHandles);
return SetHandleCount16(cHandles);
}
int CloseFileHandle(FILE_OBJECT *hFile)
{
/* If it's one of the 3 standard handles, don't really
* close it.
*/
if(hFile->fd > 2)
close(hFile->fd);
return 1;
int CloseFileHandle(HFILE hFile)
{
return _lclose(hFile);
}
static int TranslateAccessFlags(DWORD access_flags)
@ -475,17 +394,18 @@ static int TranslateCreationFlags(DWORD create_flags)
return rc;
}
/**************************************************************************
* GetFileAttributes
* GetFileAttributes32A (KERNEL32.217)
*/
DWORD GetFileAttributesA(LPCSTR lpFileName)
DWORD GetFileAttributes32A(LPCSTR lpFileName)
{
struct stat buf;
DWORD res=0;
char *fn;
dprintf_win32(stddeb,"GetFileAttributesA(%s)\n",lpFileName);
fn=DOSFS_GetUnixFileName(lpFileName,FALSE);
dprintf_file(stddeb,"GetFileAttributesA(%s)\n",lpFileName);
fn=(LPSTR)DOSFS_GetUnixFileName(lpFileName,FALSE);
/* fn points to a static buffer, don't free it */
if(stat(fn,&buf)==-1) {
SetLastError(ErrnoToLastError(errno));
@ -501,16 +421,119 @@ DWORD GetFileAttributesA(LPCSTR lpFileName)
}
/**************************************************************************
* SetFileAttributes
* GetFileAttributes32W (KERNEL32.218)
*/
BOOL SetFileAttributes32A(LPCSTR lpFileName, DWORD attributes)
DWORD GetFileAttributes32W(LPCWSTR lpFileName)
{
LPSTR afn = STRING32_DupUniToAnsi(lpFileName);
DWORD res;
res = GetFileAttributes32A(afn);
free(afn);
return res;
}
/**************************************************************************
* SetFileAttributes32A (KERNEL32.490)
*/
BOOL32 SetFileAttributes32A(LPCSTR lpFileName, DWORD attributes)
{
struct stat buf;
DWORD res=0;
char *fn;
LPSTR fn=(LPSTR)DOSFS_GetUnixFileName(lpFileName,FALSE);
fprintf(stdnimp,"Call to stub function SetFileAttributesA(%s, %08x)\n",lpFileName, attributes);
dprintf_file(stddeb,"SetFileAttributes(%s,%lx)\n",lpFileName,attributes);
if(stat(fn,&buf)==-1) {
SetLastError(ErrnoToLastError(errno));
return FALSE;
}
if (attributes & FILE_ATTRIBUTE_READONLY) {
buf.st_mode &= ~0222; /* octal!, clear write permission bits */
attributes &= ~FILE_ATTRIBUTE_READONLY;
}
if (attributes)
fprintf(stdnimp,"SetFileAttributesA(%s):%lx attribute(s) not implemented.\n",lpFileName,attributes);
if (-1==chmod(fn,buf.st_mode)) {
SetLastError(ErrnoToLastError(errno));
return FALSE;
}
return TRUE;
}
/**************************************************************************
* SetFileAttributes32W (KERNEL32.491)
*/
BOOL32 SetFileAttributes32W(LPCWSTR lpFileName, DWORD attributes)
{
LPSTR afn = STRING32_DupUniToAnsi(lpFileName);
BOOL32 res;
res = SetFileAttributes32A(afn,attributes);
free(afn);
return res;
}
/**************************************************************************
* SetEndOfFile (KERNEL32.483)
*/
BOOL32 SetEndOfFile(HFILE hFile)
{
int unixfd = FILE_GetUnixHandle(hFile);
dprintf_file(stddeb,"SetEndOfFile(%lx)\n",(LONG)hFile);
if (!unixfd)
return 0;
if (-1==ftruncate(unixfd,lseek(unixfd,0,SEEK_CUR))) {
SetLastError(ErrnoToLastError(errno));
return FALSE;
}
return TRUE;
}
/**************************************************************************
* MoveFileA (KERNEL32.387)
*/
BOOL32 MoveFile32A(LPCSTR fn1,LPCSTR fn2)
{
LPSTR ufn1;
LPSTR ufn2;
dprintf_file(stddeb,"MoveFileA(%s,%s)\n",fn1,fn2);
ufn1 = (LPSTR)DOSFS_GetUnixFileName(fn1,FALSE);
if (!ufn1) {
SetLastError(ErrnoToLastError(ENOENT));
return FALSE;
}
ufn1 = xstrdup(ufn1);
ufn2 = (LPSTR)DOSFS_GetUnixFileName(fn2,FALSE);
if (!ufn2) {
SetLastError(ErrnoToLastError(ENOENT));
return FALSE;
}
ufn2 = xstrdup(ufn2);
if (-1==rename(ufn1,ufn2)) {
SetLastError(ErrnoToLastError(errno));
free(ufn1);
free(ufn2);
return FALSE;
}
free(ufn1);
free(ufn2);
return TRUE;
}
/**************************************************************************
* MoveFileW (KERNEL32.390)
*/
BOOL32 MoveFile32W(LPCWSTR fn1,LPCWSTR fn2)
{
LPSTR afn1 = STRING32_DupUniToAnsi(fn1);
LPSTR afn2 = STRING32_DupUniToAnsi(fn2);
BOOL32 res;
res = MoveFile32A(afn1,afn2);
free(afn1);
free(afn2);
return res;
}

View File

@ -1,12 +1,13 @@
#include <sys/types.h>
#include <dirent.h>
#include <string.h>
#include <ctype.h>
#include <malloc.h>
#include "xmalloc.h"
#include "windows.h"
#include "winbase.h"
#include "dos_fs.h"
#include "heap.h"
#include <ctype.h>
#include "string32.h"
#define PATH_LEN 260
@ -55,7 +56,6 @@ static BOOL32 MatchWildCard(LPCSTR file, LPCSTR mask)
/*************************************************************************
* FindNextFile32A (KERNEL32.126)
*/
BOOL32 FindNextFile32A(HANDLE32 handle, LPWIN32_FIND_DATA32A data)
{
FindFileContext32 *context;
@ -88,6 +88,26 @@ BOOL32 FindNextFile32A(HANDLE32 handle, LPWIN32_FIND_DATA32A data)
return (FALSE);
}
/*************************************************************************
* FindNextFile32W (KERNEL32.127)
*/
BOOL32 FindNextFile32W(HANDLE32 handle, LPWIN32_FIND_DATA32W data)
{
WIN32_FIND_DATA32A adata;
adata.dwFileAttributes = data->dwFileAttributes;
adata.ftCreationTime = data->ftCreationTime;
adata.ftLastAccessTime = data->ftLastAccessTime;
adata.ftLastWriteTime = data->ftLastWriteTime;
adata.nFileSizeHigh = data->nFileSizeHigh;
adata.nFileSizeLow = data->nFileSizeLow;
adata.dwReserved0 = data->dwReserved0;
adata.dwReserved1 = data->dwReserved1;
STRING32_UniToAnsi(adata.cFileName,data->cFileName);
STRING32_UniToAnsi(adata.cAlternateFileName,data->cAlternateFileName);
return FindNextFile32A(handle,&adata);
}
/*************************************************************************
* FindFirstFile32A (KERNEL32.123)
*/
@ -140,9 +160,33 @@ HANDLE32 FindFirstFile32A(LPCSTR lpfilename,
}
/*************************************************************************
* FindClose (KERNEL32.119)
* FindFirstFile32W (KERNEL32.124)
*/
BOOL32 FindClose(HANDLE32 handle)
HANDLE32 FindFirstFile32W(LPCWSTR filename,LPWIN32_FIND_DATA32W data)
{
WIN32_FIND_DATA32A adata;
LPSTR afn = STRING32_DupUniToAnsi(filename);
HANDLE32 res;
adata.dwFileAttributes = data->dwFileAttributes;
adata.ftCreationTime = data->ftCreationTime;
adata.ftLastAccessTime = data->ftLastAccessTime;
adata.ftLastWriteTime = data->ftLastWriteTime;
adata.nFileSizeHigh = data->nFileSizeHigh;
adata.nFileSizeLow = data->nFileSizeLow;
adata.dwReserved0 = data->dwReserved0;
adata.dwReserved1 = data->dwReserved1;
STRING32_UniToAnsi(adata.cFileName,data->cFileName);
STRING32_UniToAnsi(adata.cAlternateFileName,data->cAlternateFileName);
res=FindFirstFile32A(afn,&adata);
free(afn);
return res;
}
/*************************************************************************
* FindClose32 (KERNEL32.119)
*/
BOOL32 FindClose32(HANDLE32 handle)
{
FindFileContext32 *context;

View File

@ -20,34 +20,29 @@
*/
int WIN32_LastError;
/* Standard system handles for stdin, stdout, and stderr.
*/
FILE_OBJECT *hstdin, *hstdout, *hstderr;
static int CreateStdHandles(void);
/*********************************************************************
* CloseHandle (KERNEL32.23)
*/
BOOL CloseHandle(KERNEL_OBJECT *handle)
{
int rc;
if(ValidateKernelObject(handle) != 0)
{
SetLastError(ERROR_INVALID_HANDLE);
return 0;
}
if (handle<0x1000) /* FIXME: hack */
return CloseFileHandle(handle);
switch(handle->magic)
{
case KERNEL_OBJECT_UNUSED:
SetLastError(ERROR_INVALID_HANDLE);
return 0;
/* FIXME
case KERNEL_OBJECT_FILE:
rc = CloseFileHandle((FILE_OBJECT *)handle);
break;
*/
default:
dprintf_win32(stddeb, "CloseHandle: type %ld not implemented yet.\n",
@ -114,54 +109,5 @@ int KERN32_Init(void)
/* Initialize exception handling */
EXC_Init();
#endif
/* Create the standard system handles
*/
if(CreateStdHandles() != 0)
return 0;
return 1;
}
/* CreateStdHandles creates the standard input, output, and error handles.
* These handles aren't likely to be used since they're generally used for
* console output, but startup code still likes to mess with them. They're
* also useful for debugging since apps and runtime libraries might write
* errors to stderr.
*
* Returns 0 on success, nonzero on failure.
*/
static int CreateStdHandles(void)
{
/* Create the standard input handle.
*/
hstdin = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstdin == NULL)
return 1;
hstdin->common.magic = KERNEL_OBJECT_FILE;
hstdin->fd = 0;
hstdin->type = FILE_TYPE_CHAR;
hstdin->misc_flags = 0;
/* Create the standard output handle
*/
hstdout = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstdout == NULL)
return 1;
hstdout->common.magic = KERNEL_OBJECT_FILE;
hstdout->fd = 1;
hstdout->type = FILE_TYPE_CHAR;
hstdout->misc_flags = 0;
/* Create the standard error handle
*/
hstderr = (FILE_OBJECT *)CreateKernelObject(sizeof(FILE_OBJECT));
if(hstderr == NULL)
return 1;
hstderr->common.magic = KERNEL_OBJECT_FILE;
hstderr->fd = 2;
hstderr->type = FILE_TYPE_CHAR;
hstderr->misc_flags = 0;
return 0;
}

View File

@ -19,7 +19,7 @@
*/
static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
{
HWND hwndPrev = GetFocus();
HWND32 hwndPrev = GetFocus32();
if (IsChild( hwndDlg, hwndPrev ))
{
@ -28,7 +28,7 @@ static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
}
if (SendMessage16( hwndCtrl, WM_GETDLGCODE, 0, 0 ) & DLGC_HASSETSEL)
SendMessage16( hwndCtrl, EM_SETSEL, FALSE, MAKELONG( 0, -1 ) );
SetFocus( hwndCtrl );
SetFocus32( hwndCtrl );
}
@ -37,7 +37,7 @@ static void DEFDLG_SetFocus( HWND hwndDlg, HWND hwndCtrl )
*/
static BOOL DEFDLG_SaveFocus( HWND hwnd, DIALOGINFO *infoPtr )
{
HWND hwndFocus = GetFocus();
HWND32 hwndFocus = GetFocus32();
if (!hwndFocus || !IsChild( hwnd, hwndFocus )) return FALSE;
infoPtr->hwndFocus = hwndFocus;
@ -189,7 +189,7 @@ static LRESULT DEFDLG_Proc( HWND32 hwnd, UINT32 msg, WPARAM32 wParam,
HWND hwndDest = (HWND)wParam;
if (!lParam)
{
HWND hwndPrev = GetFocus();
HWND32 hwndPrev = GetFocus32();
if (!hwndPrev) /* Set focus to the first item */
hwndDest = DIALOG_GetFirstTabItem( hwnd );
else

View File

@ -171,7 +171,7 @@ static LRESULT DEFWND_DefWinProc( WND *wndPtr, UINT32 msg, WPARAM32 wParam,
return MA_ACTIVATE;
case WM_ACTIVATE:
if (LOWORD(wParam) != WA_INACTIVE) SetFocus( wndPtr->hwndSelf );
if (LOWORD(wParam) != WA_INACTIVE) SetFocus32( wndPtr->hwndSelf );
break;
case WM_ERASEBKGND:

View File

@ -599,7 +599,7 @@ static HWND DIALOG_CreateIndirect( HINSTANCE hInst, LPCSTR dlgTemplate,
if (dlgInfo->hUserFont)
SendMessage32A( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
if (SendMessage32A(hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param))
SetFocus( dlgInfo->hwndFocus );
SetFocus32( dlgInfo->hwndFocus );
if (template.style & WS_VISIBLE) ShowWindow( hwnd, SW_SHOW );
return hwnd;
}
@ -906,7 +906,7 @@ BOOL IsDialogMessage( HWND hwndDlg, LPMSG16 msg )
case VK_DOWN:
if (!(dlgCode & DLGC_WANTARROWS))
{
SetFocus(GetNextDlgGroupItem(hwndDlg,GetFocus(),FALSE));
SetFocus32( GetNextDlgGroupItem(hwndDlg,GetFocus32(),FALSE) );
return TRUE;
}
break;
@ -915,7 +915,7 @@ BOOL IsDialogMessage( HWND hwndDlg, LPMSG16 msg )
case VK_UP:
if (!(dlgCode & DLGC_WANTARROWS))
{
SetFocus(GetNextDlgGroupItem(hwndDlg,GetFocus(),TRUE));
SetFocus32( GetNextDlgGroupItem(hwndDlg,GetFocus32(),TRUE) );
return TRUE;
}
break;

View File

@ -26,6 +26,7 @@
#include "class.h"
#include "clipboard.h"
#include "debugger.h"
#include "hook.h"
#include "message.h"
#include "module.h"
#include "options.h"
@ -36,7 +37,6 @@
#include "debug.h"
#include "dde_proc.h"
#define NB_BUTTONS 3 /* Windows can handle 3 buttons */
/* X context to associate a hwnd to an X window */
@ -287,7 +287,7 @@ void EVENT_RegisterWindow( WND *pWnd )
* Return TRUE if an event is pending, FALSE on timeout or error
* (for instance lost connection with the server).
*/
BOOL EVENT_WaitXEvent( BOOL sleep )
BOOL32 EVENT_WaitXEvent( BOOL32 sleep )
{
fd_set read_set;
struct timeval timeout;
@ -542,7 +542,7 @@ static void EVENT_key( XKeyEvent *event )
hardware_event( KeyStateTable[VK_MENU] & 0x80 ? WM_SYSKEYDOWN : WM_KEYDOWN,
vkey, keylp.lp2,
event->x_root - desktopX, event->y_root - desktopY,
event->time, 0 );
event->time - MSG_WineStartTicks, 0 );
KeyDown = TRUE;
/* Currently we use reserved field in the scan-code byte to
@ -572,7 +572,7 @@ static void EVENT_key( XKeyEvent *event )
hardware_event( sysKey & 0x80 ? WM_SYSKEYUP : WM_KEYUP,
vkey, keylp.lp2,
event->x_root - desktopX, event->y_root - desktopY,
event->time, 0 );
event->time - MSG_WineStartTicks, 0 );
KeyDown = FALSE;
}
}
@ -585,7 +585,7 @@ static void EVENT_MotionNotify( XMotionEvent *event )
{
hardware_event( WM_MOUSEMOVE, EVENT_XStateToKeyState( event->state ), 0L,
event->x_root - desktopX, event->y_root - desktopY,
event->time, 0 );
event->time - MSG_WineStartTicks, 0 );
}
@ -624,7 +624,7 @@ static void EVENT_ButtonPress( XButtonEvent *event )
hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L,
event->x_root - desktopX, event->y_root - desktopY,
event->time, 0 );
event->time - MSG_WineStartTicks, 0 );
}
@ -642,7 +642,7 @@ static void EVENT_ButtonRelease( XButtonEvent *event )
hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L,
event->x_root - desktopX, event->y_root - desktopY,
event->time, 0 );
event->time - MSG_WineStartTicks, 0 );
}
@ -653,7 +653,8 @@ static void EVENT_FocusIn (HWND hwnd, XFocusChangeEvent *event )
{
if (event->detail == NotifyPointer) return;
if (hwnd != GetActiveWindow()) WINPOS_ChangeActiveWindow( hwnd, FALSE );
if ((hwnd != GetFocus()) && !IsChild( hwnd, GetFocus())) SetFocus( hwnd );
if ((hwnd != GetFocus32()) && !IsChild( hwnd, GetFocus32()))
SetFocus32( hwnd );
}
@ -666,7 +667,8 @@ static void EVENT_FocusOut( HWND hwnd, XFocusChangeEvent *event )
{
if (event->detail == NotifyPointer) return;
if (hwnd == GetActiveWindow()) WINPOS_ChangeActiveWindow( 0, FALSE );
if ((hwnd == GetFocus()) || IsChild( hwnd, GetFocus())) SetFocus( 0 );
if ((hwnd == GetFocus32()) || IsChild( hwnd, GetFocus32()))
SetFocus32( 0 );
}
@ -850,7 +852,7 @@ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event )
void EVENT_EnterNotify( WND *pWnd, XCrossingEvent *event )
{
if( !Options.managed && rootWindow == DefaultRootWindow(display) &&
(COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE) && GetFocus() )
(COLOR_GetSystemPaletteFlags() & COLOR_PRIVATE) && GetFocus32() )
XInstallColormap( display, COLOR_GetColormap() );
}
*/
@ -860,10 +862,10 @@ static void EVENT_ClientMessage( WND *pWnd, XClientMessageEvent *event )
*/
void EVENT_MapNotify( HWND hWnd, XMapEvent *event )
{
HWND hwndFocus = GetFocus();
HWND32 hwndFocus = GetFocus32();
if (hwndFocus && IsChild( hWnd, hwndFocus ))
FOCUS_SetXFocus(hwndFocus);
FOCUS_SetXFocus( hwndFocus );
return;
}

View File

@ -7,6 +7,7 @@
*
*/
#define NO_TRANSITION_TYPES /* This file is Win32-clean */
#include "win.h"
#include "winpos.h"
#include "hook.h"
@ -14,7 +15,7 @@
#include "message.h"
#include "options.h"
static HWND hwndFocus = 0;
static HWND32 hwndFocus = 0;
/*****************************************************************
* FOCUS_SetXFocus
@ -22,7 +23,7 @@ static HWND hwndFocus = 0;
* Set the X focus.
* Explicit colormap management seems to work only with OLVWM.
*/
void FOCUS_SetXFocus( HWND hwnd )
void FOCUS_SetXFocus( HWND32 hwnd )
{
XWindowAttributes win_attr;
Window win;
@ -55,25 +56,34 @@ void FOCUS_SetXFocus( HWND hwnd )
/*****************************************************************
* FOCUS_SwitchFocus
*/
void FOCUS_SwitchFocus(HWND hFocusFrom, HWND hFocusTo)
void FOCUS_SwitchFocus( HWND32 hFocusFrom, HWND32 hFocusTo )
{
hwndFocus = hFocusTo;
if (hFocusFrom) SendMessage16( hFocusFrom, WM_KILLFOCUS, (WPARAM)hFocusTo, 0L);
if (hFocusFrom) SendMessage32A( hFocusFrom, WM_KILLFOCUS, hFocusTo, 0 );
if( !hFocusTo || hFocusTo != hwndFocus )
return;
SendMessage16( hFocusTo, WM_SETFOCUS, (WPARAM)hFocusFrom, 0L);
SendMessage32A( hFocusTo, WM_SETFOCUS, hFocusFrom, 0 );
FOCUS_SetXFocus( hFocusTo );
}
/*****************************************************************
* SetFocus (USER.22)
* SetFocus16 (USER.22)
*/
HWND SetFocus(HWND hwnd)
HWND16 SetFocus16( HWND16 hwnd )
{
HWND hWndPrevFocus, hwndTop = hwnd;
return (HWND16)SetFocus32( hwnd );
}
/*****************************************************************
* SetFocus32 (USER32.480)
*/
HWND32 SetFocus32( HWND32 hwnd )
{
HWND32 hWndPrevFocus, hwndTop = hwnd;
WND *wndPtr = WIN_FindWndPtr( hwnd );
if (wndPtr)
@ -91,7 +101,8 @@ HWND SetFocus(HWND hwnd)
if( hwnd == hwndFocus ) return hwnd;
/* call hooks */
if( HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM)hwnd, (LPARAM)hwndFocus) )
if( HOOK_CallHooks( WH_CBT, HCBT_SETFOCUS, (WPARAM16)hwnd,
(LPARAM)hwndFocus) )
return 0;
/* activate hwndTop if needed. */
@ -115,11 +126,18 @@ HWND SetFocus(HWND hwnd)
/*****************************************************************
* GetFocus (USER.23)
* GetFocus16 (USER.23)
*/
HWND GetFocus(void)
HWND16 GetFocus16(void)
{
return hwndFocus;
return (HWND16)hwndFocus;
}
/*****************************************************************
* GetFocus32 (USER32.239)
*/
HWND32 GetFocus32(void)
{
return hwndFocus;
}

View File

@ -83,8 +83,7 @@ static HANDLE16 HOOK_SetHook( INT16 id, HOOKPROC16 proc, HINSTANCE16 hInst,
if (!(hQueue = GetTaskQueue( hTask ))) return 0;
}
if (id == WH_JOURNALPLAYBACK || id == WH_CBT ||
id == WH_DEBUG || id == WH_SHELL)
if (id == WH_CBT || id == WH_DEBUG || id == WH_SHELL)
{
fprintf( stdnimp, "Unimplemented hook set: (%d,%08lx,%04x,%04x)!\n",
id, (DWORD)proc, hInst, hTask );

View File

@ -573,7 +573,7 @@ LONG MDI_ChildActivate(WND *clientPtr, HWND hWndChild)
if( !hWndChild )
{
if( isActiveFrameWnd )
SetFocus( clientInfo->self );
SetFocus32( clientInfo->self );
return 0;
}
@ -588,11 +588,11 @@ LONG MDI_ChildActivate(WND *clientPtr, HWND hWndChild)
if( isActiveFrameWnd )
{
SendMessage16( hWndChild, WM_NCACTIVATE, TRUE, 0L);
if( GetFocus() == clientInfo->self )
if( GetFocus32() == clientInfo->self )
SendMessage16( clientInfo->self, WM_SETFOCUS,
(WPARAM)clientInfo->self, 0L );
else
SetFocus( clientInfo->self );
SetFocus32( clientInfo->self );
}
#ifdef WINELIB32
@ -1096,7 +1096,7 @@ LRESULT MDIClientWndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
w = WIN_FindWndPtr( ci->hwndActiveChild );
if( !(w->dwStyle & WS_MINIMIZE) )
SetFocus( ci->hwndActiveChild );
SetFocus32( ci->hwndActiveChild );
}
return 0;
@ -1214,7 +1214,7 @@ LRESULT DefFrameProc16( HWND16 hwnd, HWND16 hwndMDIClient, UINT16 message,
return 0;
case WM_SETFOCUS:
SetFocus(hwndMDIClient);
SetFocus32(hwndMDIClient);
break;
case WM_SIZE:

View File

@ -215,7 +215,7 @@ static BOOL MSG_TranslateKeyboardMsg( MSG16 *msg, BOOL remove )
/* Should check Ctrl-Esc and PrintScreen here */
msg->hwnd = GetFocus();
msg->hwnd = GetFocus16();
if (!msg->hwnd)
{
/* Send the message to the active window instead, */
@ -695,8 +695,8 @@ static BOOL MSG_PeekMessage( LPMSG16 msg, HWND hwnd, WORD first, WORD last,
* 'hwnd' must be the handle of the dialog or menu window.
* 'code' is the message filter value (MSGF_??? codes).
*/
BOOL MSG_InternalGetMessage( MSG16 *msg, HWND hwnd, HWND hwndOwner, short code,
WORD flags, BOOL sendIdle )
BOOL32 MSG_InternalGetMessage( MSG16 *msg, HWND32 hwnd, HWND32 hwndOwner,
WPARAM32 code, WORD flags, BOOL32 sendIdle )
{
for (;;)
{

View File

@ -142,7 +142,7 @@ LRESULT SystemMessageBoxProc(HWND hwnd,UINT message,WPARAM wParam,LPARAM lParam)
hItem = GetDlgItem(hwnd, (i + 5) % 7 + 1);
if (GetWindowLong32A(hItem, GWL_STYLE) & WS_VISIBLE) {
if (buttons++ == ((lpmb->type & MB_DEFMASK) >> 8)) {
SetFocus(hItem);
SetFocus32(hItem);
SendMessage32A( hItem, BM_SETSTYLE32, BS_DEFPUSHBUTTON, TRUE );
}
SetWindowPos(hItem, 0, bpos, tiheight, 0, 0,

View File

@ -411,7 +411,7 @@ static void QUEUE_WakeSomeone( UINT message )
{
if (wakeBit == QS_KEY)
{
if (!(hwnd = GetFocus())) hwnd = GetActiveWindow();
if (!(hwnd = GetFocus32())) hwnd = GetActiveWindow();
}
else hwnd = GetCapture();
}

View File

@ -549,6 +549,47 @@ static HWND WIN_CreateWindowEx( CREATESTRUCT32A *cs, ATOM classAtom,
WIN_LinkWindow( hwnd, (cs->style & WS_CHILD) ? HWND_BOTTOM : HWND_TOP );
/* Call the WH_CBT hook */
if (HOOK_GetHook( WH_CBT, GetTaskQueue(0) ))
{
CBT_CREATEWND16* cbtc;
if ((cbtc = SEGPTR_NEW(CBT_CREATEWND16)))
{
/* Dummy message params to use WINPROC_MapMsg functions */
UINT16 msg;
WPARAM16 wparam;
LPARAM lparam;
HWND hwndZnew = (cs->style & WS_CHILD) ? HWND_BOTTOM : HWND_TOP;
/* Map the CREATESTRUCT to 16-bit format */
lparam = (LPARAM)cs;
if (unicode)
WINPROC_MapMsg32WTo16( WM_CREATE, 0, &msg, &wparam, &lparam );
else
WINPROC_MapMsg32ATo16( WM_CREATE, 0, &msg, &wparam, &lparam );
cbtc->lpcs = (CREATESTRUCT16 *)lparam;
cbtc->hwndInsertAfter = hwndZnew;
wmcreate = !HOOK_CallHooks( WH_CBT, HCBT_CREATEWND, hwnd,
(LPARAM)SEGPTR_GET(cbtc) );
WINPROC_UnmapMsg32ATo16( WM_CREATE, 0, lparam );
if (hwndZnew != cbtc->hwndInsertAfter)
{
WIN_UnlinkWindow( hwnd );
WIN_LinkWindow( hwnd, cbtc->hwndInsertAfter );
}
SEGPTR_FREE(cbtc);
if (!wmcreate)
{
dprintf_win(stddeb,"CreateWindowEx: CBT-hook returned 0\n" );
WIN_DestroyWindow( hwnd );
return 0;
}
}
}
/* Send the WM_GETMINMAXINFO message and fix the size if needed */
if ((cs->style & WS_THICKFRAME) || !(cs->style & (WS_POPUP | WS_CHILD)))
@ -1143,8 +1184,8 @@ BOOL EnableWindow( HWND hwnd, BOOL enable )
{
/* Disable window */
wndPtr->dwStyle |= WS_DISABLED;
if ((hwnd == GetFocus()) || IsChild( hwnd, GetFocus() ))
SetFocus( 0 ); /* A disabled window can't have the focus */
if ((hwnd == GetFocus32()) || IsChild( hwnd, GetFocus32() ))
SetFocus32( 0 ); /* A disabled window can't have the focus */
if ((hwnd == GetCapture()) || IsChild( hwnd, GetCapture() ))
ReleaseCapture(); /* A disabled window can't capture the mouse */
SendMessage16( hwnd, WM_ENABLE, FALSE, 0 );

View File

@ -54,7 +54,7 @@ static HWND hwndPrevActive = 0; /* Previously active window */
* Find a suitable place for an iconic window.
* The new position is stored into wndPtr->ptIconPos.
*/
void WINPOS_FindIconPos( HWND hwnd )
void WINPOS_FindIconPos( HWND32 hwnd )
{
RECT16 rectParent;
short x, y, xspacing, yspacing;
@ -711,12 +711,6 @@ BOOL ShowWindow( HWND hwnd, int cmd )
MAKELONG(wndPtr->rectClient.left, wndPtr->rectClient.top) );
}
if (hwnd == GetFocus())
{
SetFocus( (wndPtr->dwStyle & WS_CHILD)? wndPtr->parent->hwndSelf: 0 );
if (hwnd == CARET_GetHwnd()) DestroyCaret();
}
return wasVisible;
}
@ -867,7 +861,7 @@ BOOL32 SetWindowPlacement32( HWND32 hwnd, const WINDOWPLACEMENT32 *wndpl )
*
* back-end to SetActiveWindow
*/
BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus )
BOOL32 WINPOS_SetActiveWindow( HWND32 hWnd, BOOL32 fMouse, BOOL32 fChangeFocus)
{
WND *wndPtr = WIN_FindWndPtr(hWnd);
WND *wndTemp = WIN_FindWndPtr(hwndActive);
@ -1010,9 +1004,9 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus )
}
/* change focus if possible */
if( fChangeFocus && GetFocus() )
if( WIN_GetTopParent(GetFocus()) != hwndActive )
FOCUS_SwitchFocus( GetFocus(),
if( fChangeFocus && GetFocus32() )
if( WIN_GetTopParent(GetFocus32()) != hwndActive )
FOCUS_SwitchFocus( GetFocus32(),
(wndPtr->dwStyle & WS_MINIMIZE)? 0: hwndActive);
/* if active wnd is minimized redraw icon title
@ -1031,7 +1025,7 @@ BOOL WINPOS_SetActiveWindow( HWND hWnd, BOOL fMouse, BOOL fChangeFocus )
* WINPOS_ChangeActiveWindow
*
*/
BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg )
BOOL32 WINPOS_ChangeActiveWindow( HWND32 hWnd, BOOL32 mouseMsg )
{
WND *wndPtr = WIN_FindWndPtr(hWnd);
@ -1072,7 +1066,7 @@ BOOL WINPOS_ChangeActiveWindow( HWND hWnd, BOOL mouseMsg )
* oldWindowRect, oldClientRect and winpos must be non-NULL only
* when calcValidRect is TRUE.
*/
LONG WINPOS_SendNCCalcSize( HWND hwnd, BOOL calcValidRect,
LONG WINPOS_SendNCCalcSize( HWND32 hwnd, BOOL32 calcValidRect,
RECT16 *newWindowRect, RECT16 *oldWindowRect,
RECT16 *oldClientRect, SEGPTR winpos,
RECT16 *newClientRect )
@ -1831,8 +1825,13 @@ BOOL SetWindowPos( HWND hwnd, HWND hwndInsertAfter, INT x, INT y,
uFlags |= SMC_NOPARENTERASE;
}
if ((winpos->hwnd == GetFocus()) || IsChild(winpos->hwnd, GetFocus()))
SetFocus( GetParent32(winpos->hwnd) ); /* Revert focus to parent */
if ((winpos->hwnd == GetFocus32()) ||
IsChild( winpos->hwnd, GetFocus32()))
{
/* Revert focus to parent */
SetFocus32( GetParent32(winpos->hwnd) );
}
if (hwnd == CARET_GetHwnd()) DestroyCaret();
if (winpos->hwnd == hwndActive)
{

View File

@ -144,7 +144,7 @@ static WINDOWPROC *WINPROC_GetPtr( WNDPROC16 handle )
/* Check for a segmented pointer */
if (!IsBadReadPtr( (SEGPTR)handle, sizeof(WINDOWPROC)-sizeof(proc->thunk)))
if (!IsBadReadPtr16((SEGPTR)handle,sizeof(WINDOWPROC)-sizeof(proc->thunk)))
{
ptr = (BYTE *)PTR_SEG_TO_LIN(handle);
if (!HEAP_IsInsideHeap( WinProcHeap, 0, ptr )) return NULL;