Commit 8bbf8180 authored by Alexandre Julliard's avatar Alexandre Julliard

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().
parent d1ce8b28
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.
......
----------------------------------------------------------------------
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>
* [misc/commdlg.c] [if1632/commdlg.spec]
......
......@@ -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) ))
{
......
......@@ -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;
......
......@@ -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);
......
......@@ -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);
......
......@@ -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;
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = debugger
......
......@@ -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));
......
......@@ -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;
......
......@@ -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))
{
......
......@@ -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 */
......
......@@ -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.
......
......@@ -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';
......
......@@ -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
*/
LONG WIN16_hread( HFILE hFile, SEGPTR 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
*/
INT _lread( HFILE hFile, SEGPTR buffer, WORD count )
UINT16 WIN16_lread( HFILE hFile, SEGPTR buffer, UINT16 count )
{
return (INT)_hread( hFile, buffer, (LONG)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 );
}
/***********************************************************************
* _hread (KERNEL.349)
* _lwrite32 (KERNEL.86)
*/
LONG _hread( HFILE hFile, SEGPTR buffer, LONG count )
UINT32 _lwrite32( HFILE hFile, LPCSTR buffer, UINT32 count )
{
#ifndef WINELIB
LONG maxlen;
return (UINT32)_hwrite( hFile, buffer, (LONG)count );
}
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 );
/***********************************************************************
* _hread (KERNEL.349)
*/
LONG _hread( HFILE hFile, LPVOID buffer, LONG 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;
}
......@@ -4,6 +4,7 @@
* Copyright 1996 John Harvey
*/
#include <stdio.h>
#include "windows.h"
#include "win16drv.h"
#include "gdi.h"
......
......@@ -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
......
......@@ -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
......@@ -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
......
......@@ -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",
......
......@@ -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
......
......@@ -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
......
......@@ -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
......
......@@ -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 */
......@@ -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",
......
......@@ -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 */
......@@ -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 */
......@@ -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 );
......
......@@ -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 );
......
......@@ -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,
......
......@@ -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
......
......@@ -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 */
......
......@@ -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
......
......@@ -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 );
......
......@@ -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;
......
......@@ -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 */
......
......@@ -1181,7 +1181,7 @@ DWORD WIN16_GetCurrentTask(void)
/***********************************************************************
* GetCurrentPDB (KERNEL.37)
*/
HANDLE GetCurrentPDB(void)
HANDLE16 GetCurrentPDB(void)
{
TDB *pTask;
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = memory
......
......@@ -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 );
......
......@@ -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>
......
......@@ -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;
......
......@@ -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 );
}
......
......@@ -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"
......
......@@ -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;
}
......@@ -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 */
......
......@@ -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;
}
......
......@@ -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;
......
......@@ -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",
......
......@@ -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)
{
......
......@@ -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;
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = miscemu
......
......@@ -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;
......
......@@ -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);
......
......@@ -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 */
......
......@@ -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;
......
......@@ -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;
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
PROGRAM = winerc
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
MODULE = resources
......
DEFS = -D__WINE__
DEFS = -D__WINE__ -DNO_TRANSITION_TYPES
TOPSRC = @top_srcdir@
PROGRAM = build
......
#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;
......@@ -89,6 +89,26 @@ BOOL32 FindNextFile32A(HANDLE32 handle, LPWIN32_FIND_DATA32A data)
}
/*************************************************************************
* 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)
*/
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 FindClose(HANDLE32 handle)
BOOL32 FindClose32(HANDLE32 handle)
{
FindFileContext32 *context;
......
......@@ -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;
}
......@@ -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
......
......@@ -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:
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......@@ -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 );
......
......@@ -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:
......
......@@ -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 (;;)
{
......
......@@ -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,
......
......@@ -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();
}
......
......@@ -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 );
......
......@@ -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)
{
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment