Commit 329f0680 authored by Alexandre Julliard's avatar Alexandre Julliard

Release 960414

Sun Apr 14 12:51:27 1996 Alexandre Julliard <julliard@lrc.epfl.ch> * [controls/menu.c] [include/dialog.h] [windows/dialog.c] Made the resource loading code always use the correct Windows layout for Winelib on other CPUs. * [include/module.h] [loader/module.c] Added self handle in NE_MODULE structure, so we can use a pointer instead of a handle. Added function MODULE_GetPtr() to validate a HMODULE. * [memory/heap.c] Implemented Win32 heap management. * [memory/selector.c] Fix selector limit for huge blocks. Sat Apr 13 00:19:12 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk> * [objects/metafile.c] Fixed memcpy bug to allow memory based metafiles to work. Fri Apr 12 19:25:41 1996 Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl> * [controls/edit.c] [controls/EDIT.TODO] Complete rewrite. Everything changed: new features, new bugs. Main addition: WordWrap. Fri Apr 12 20:29:55 1996 Tristan Tarrant <tst@dcs.ed.ac.uk> * [resources/sysres_It.rc] Fixed a few mistakes in the file and resized some of the controls. Fri Apr 12 09:55:13 1996 John Harvey <john@division.co.uk> * [misc/winsocket.c] Fixed broken #if defined that stopped unixware compiling. * [win32/resource.c] Added missing return to end of FindResource32. Thu Apr 11 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu> * [windows/keyboard.c] [windows/event.c] Fixed GetKeyState for mouse buttons. * [windows/message.c] WM_MOUSEACTIVATE wasn't sent in some cases. Wed Apr 10 18:59:53 1996 Niels de Carpentier <niels@cindy.et.tudelft.nl> * [objects/font.c] Match slightly bigger font if height negative. Mon Apr 8 13:46:15 1996 Deano Calver <deano@rattie.demon.co.uk> * [multimedia/mmsystem.c] Changed read's to FILE_read's in mmsystem to fix mmio bug. Sun Apr 7 21:40:29 1996 Albrecht Kleine <kleine@ak.sax.de> * [misc/commdlg.c] [resources/sysres_En.rc] [resources/sysres_De.rc] Introduced ColorDlgProc() for ChooseColor() and replaced fitting En-,De- resources. As written in TODO: some national language support is needed here.
parent 8664b890
This is release 960405 of Wine the MS Windows emulator. This is still a
This is release 960414 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.
Patches should be submitted to "julliard@lrc.epfl.ch". Please don't
forget to include a ChangeLog entry.
WHAT'S NEW with Wine-960405: (see ChangeLog for details)
- Faster text display.
- Support for SCO OpenServer 5.
- Cleaner Win32 module handling.
WHAT'S NEW with Wine-960414: (see ChangeLog for details)
- Complete rewrite of the edit control.
- Better color selection dialog.
- Win32 heap management.
- Lots of bug fixes.
See the README file in the distribution for installation instructions.
......@@ -17,10 +17,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:
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960405.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960405.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960405.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960405.tar.gz
sunsite.unc.edu:/pub/Linux/ALPHA/wine/development/Wine-960414.tar.gz
tsx-11.mit.edu:/pub/linux/ALPHA/Wine/development/Wine-960414.tar.gz
ftp.infomagic.com:/pub/mirrors/linux/wine/development/Wine-960414.tar.gz
aris.com:/pub/linux/ALPHA/Wine/development/Wine-960414.tar.gz
It should also be available from any site that mirrors tsx-11 or sunsite.
......
----------------------------------------------------------------------
Sun Apr 14 12:51:27 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/menu.c] [include/dialog.h] [windows/dialog.c]
Made the resource loading code always use the correct Windows
layout for Winelib on other CPUs.
* [include/module.h] [loader/module.c]
Added self handle in NE_MODULE structure, so we can use a pointer
instead of a handle.
Added function MODULE_GetPtr() to validate a HMODULE.
* [memory/heap.c]
Implemented Win32 heap management.
* [memory/selector.c]
Fix selector limit for huge blocks.
Sat Apr 13 00:19:12 1996 Huw D. M. Davies <h.davies1@physics.oxford.ac.uk>
* [objects/metafile.c]
Fixed memcpy bug to allow memory based metafiles to work.
Fri Apr 12 19:25:41 1996 Frans van Dorsselaer <dorssel@rulhm1.leidenuniv.nl>
* [controls/edit.c] [controls/EDIT.TODO]
Complete rewrite. Everything changed: new features, new bugs.
Main addition: WordWrap.
Fri Apr 12 20:29:55 1996 Tristan Tarrant <tst@dcs.ed.ac.uk>
* [resources/sysres_It.rc]
Fixed a few mistakes in the file and resized some of the controls.
Fri Apr 12 09:55:13 1996 John Harvey <john@division.co.uk>
* [misc/winsocket.c]
Fixed broken #if defined that stopped unixware compiling.
* [win32/resource.c]
Added missing return to end of FindResource32.
Thu Apr 11 18:00:00 1996 Alex Korobka <alex@phm30.pharm.sunysb.edu>
* [windows/keyboard.c] [windows/event.c]
Fixed GetKeyState for mouse buttons.
* [windows/message.c]
WM_MOUSEACTIVATE wasn't sent in some cases.
Wed Apr 10 18:59:53 1996 Niels de Carpentier <niels@cindy.et.tudelft.nl>
* [objects/font.c]
Match slightly bigger font if height negative.
Mon Apr 8 13:46:15 1996 Deano Calver <deano@rattie.demon.co.uk>
* [multimedia/mmsystem.c]
Changed read's to FILE_read's in mmsystem to fix mmio bug.
Sun Apr 7 21:40:29 1996 Albrecht Kleine <kleine@ak.sax.de>
* [misc/commdlg.c] [resources/sysres_En.rc] [resources/sysres_De.rc]
Introduced ColorDlgProc() for ChooseColor() and replaced fitting
En-,De- resources.
As written in TODO: some national language support is needed here.
----------------------------------------------------------------------
Fri Apr 5 15:22:55 1996 Alexandre Julliard <julliard@lrc.epfl.ch>
* [controls/button.c] [controls/static.c]
......
- Find all the remaining bugs!
This file gives some information about the code in edit.c. If you want to
change, add, or fix code, please read this text. If you're not interested
in doing actual work on edit.c only C & D will be of interest to you.
- ES_LEFT, ES_RIGHT and ES_CENTER. ES_RIGHT and ES_CENTER cannot be
used with single line edit controls or be combined with ES_AUTOHSCROLL.
A) basic policy
B) special functions
C) not implemented
D) known bugs
- Hide selection when window loses focus and ES_NOHIDESEL to disable
this functionality.
A) Basic Policy
- ES_LOWERCASE and ES_UPPERCASE.
The code has been made in such a way, that functions try to call other
(documented) functions if that is sufficient. This might sometimes not be
the most efficient way, but it keeps the code clear. This way I tried to keep
the number of functions that rely on the internal EDITSTATE structure as
low as possible. For instance EDIT_WM_Cut() simply calls EDIT_WM_Copy() and
EDIT_WM_Clear(). The latter two are well documented message handlers, so
as long as they are right EDIT_WM_Cut() will never have to change again.
- ES_OEMCONVERT. Probably won't do anything very much.
Example:
The best thing to do, when you want to know the offset of line 3, is calling
EDIT_EM_LineIndex(). Again this is a well documented message handler. Don't
look at es->LineDefs[2].offset. It would just be another reference to the
internal structure, and that would make it more difficult to change things.
Refer to EDIT_WM_???? and EDIT_EM_????? functions as much as possible.
- ES_WANTRETURN and Ctrl-Enter to move to next line when this
functionality is enabled.
The WND * pointer is used internally whenever possible. Although it is not
the real HWND, it improves performance enough to use it.
- Implement undo buffer correctly. Windows allows the user to undo
entered text as well as deleted text. You can also undo an undo.
All displaying is done by invalidating regions / rects. Only
EDIT_EM_LineScroll() uses direct painting. This way things become much
faster. Although sometimes the response time might appear to be slow, it
would be much slower even, when everything would be painted instantly. This
is especially true for scrollbar tracking and selection changes..
- Add word wrap - this is a very big change!
I'm doing a rewrite on edit.c. Please e-mail me if you want
to work on edit.c as well, so we can synchronize.
Bugs in the current version, known to me:
- An empty document still contains "\r\n"
- UNDO is unstable (incomplete, and it can cause a segfault)
- WM_LBUTTONDBLCLK lets you select whole words, but doesn't set
the caret at the end of the selection
- Scrolling (left-right) works, but the scrollbar doesn't
B) Special functions
The edit control needs to use local heap memory because applications may
rely on EM_GETHANDLE. This is bad, but it can't be helped, we have to live
with that. For this reason there is a nice EDIT_GetPointer() function,
which locks the heap buffer *only once*, no matter how often it is called.
Only at the end of the message handler EDIT_ReleasePointer() is called. You
don't have to worry about unlocking the heap. Calling EDIT_GetPointer() is
very fast if the buffer is already locked.
This way, the buffer gets locked / unlock only once every message, although
EDIT_GetPointer() may actually have been called a hundred times.
Only when the actual HLOCAL is needed (for example to ReAlloc), a call to
EDIT_ReleasePointer() is needed. Look for instance in EDIT_MakeFit().
This brings us to EDIT_MakeFit(). It automatically re-allocates the buffer
if the size parameter > buffersize. If everything is successful TRUE is
returned, otherwise FALSE. Only when the buffer contents may grow you need
to call EDIT_MakeFit(). Currently this is only in EDIT_ReplaceSel() and
EDIT_WM_SetText().
EDIT_BuildLineDefs() is the most important function in edit.c. It builds
the internal EDITSTATE structure. As soon as text *might* have changed, or
when the appearance of the text on the screen *might* have changed, call
this function ! This includes changes of screen size, change of the font,
clipboard actions, etc. etc. Most other functions that rely on EDITSTATE,
rely on the stuff this function builds.
C) Not Implemented
- ES_PASSWORD
- ES_CENTER
- ES_RIGHT
- EM_SETRECT
- EM_SETRECTNP
- EM_FMTLINES
- ES_AUTOVSCROLL (every multi line *is* auto vscroll)
- ES_AUTOHSCROLL (multi line can be yes or no, but single line only yes)
- WM_UNDO (=EM_UNDO)
- EM_CANUNDO
- EM_SCROLL (scrolling works, but this appears to be an undocumented message)
- ES_LOWERCASE
- ES_UPPERCASE
- ES_OEMCONVERT
- ES_WANTRETURN
- probably much, MUCH more
I encountered several undocumented messages, or message parameters.
EditWndProc() reports any unknown message with an id > WM_USER.
D) Known bugs.
- Scrolling is weird, sometimes. The current code makes the scrollbar
of Notepad work, but the scrollbar code itself is broken. Currently
the scroll code of edit.c is *not* according to specs. Instead, it
is according to the broken scrollbar code. If that gets fixed, this
should be fixed, too.
- The clipboard is broken. Whenever things go wrong with
cut/copy/paste, it is probably the clipboard that messes up things,
not edit.c.
- With Notepad, if you select New File a couple of times and enter
text, the buffer is sometimes corrupted.
- Switching on/off WordWrap with Notepad sometimes corrupts the buffer.
I am still very actively changing things. Especially I am working
on Undo capabilities. If you want to do things, other than bug fixes,
please mail me so we can synchronize.
Frans van Dorsselaer
dorssel@rulhm1.LeidenUniv.nl
......@@ -1013,7 +1013,8 @@ INT DlgDirListComboBox( HWND hDlg, SEGPTR path, INT idCBox,
if (idCBox)
{
SendDlgItemMessage( hDlg, idCBox, CB_RESETCONTENT, 0, 0 );
ret = (SendDlgItemMessage( hDlg, idCBox, CB_DIR, wType, path ) >= 0);
ret = (SendDlgItemMessage( hDlg, idCBox, CB_DIR,
wType, (LPARAM)path ) >= 0);
}
if (idStatic)
{
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2050,7 +2050,7 @@ BOOL DlgDirSelect( HWND hDlg, LPSTR lpStr, INT id )
dprintf_listbox( stddeb, "DlgDirSelect: %04x '%s' %d\n", hDlg, lpStr, id );
if ((i = SendDlgItemMessage( hDlg, id, LB_GETCURSEL, 0, 0 )) == LB_ERR)
return FALSE;
SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, MAKE_SEGPTR(buffer) );
SendDlgItemMessage( hDlg, id, LB_GETTEXT, i, (LPARAM)MAKE_SEGPTR(buffer) );
if (buffer[0] == '[') /* drive or directory */
{
if (buffer[1] == '-') /* drive */
......
......@@ -1017,11 +1017,11 @@ static SEGPTR MENU_ParseResource( SEGPTR res, HMENU hMenu )
do
{
flags = *(WORD *)PTR_SEG_TO_LIN( res );
flags = GET_WORD( PTR_SEG_TO_LIN( res ) );
res += sizeof(WORD);
if (!(flags & MF_POPUP))
{
id = *(WORD *)PTR_SEG_TO_LIN( res );
id = GET_WORD( PTR_SEG_TO_LIN( res ) );
res += sizeof(WORD);
}
data = res;
......@@ -2315,7 +2315,7 @@ HMENU LoadMenu( HINSTANCE instance, SEGPTR name )
/* check for Win32 module */
instance = GetExePtr( instance );
if(((NE_MODULE*)GlobalLock(instance))->flags & NE_FFLAGS_WIN32)
if (MODULE_GetPtr(instance)->flags & NE_FFLAGS_WIN32)
return WIN32_LoadMenuA(instance,PTR_SEG_TO_LIN(name));
if (!(hRsrc = FindResource( instance, name, RT_MENU ))) return 0;
......
......@@ -217,6 +217,18 @@ void mode_command(int newmode)
}
/***********************************************************************
* DEBUG_EnterDebugger
*
* Force an entry into the debugger.
*/
void DEBUG_EnterDebugger(void)
{
kill( getpid(), SIGHUP );
}
void wine_debug( int signal, struct sigcontext_struct *regs )
{
static int loaded_symbols = 0;
......@@ -248,6 +260,12 @@ void wine_debug( int signal, struct sigcontext_struct *regs )
addr.off = EIP_reg(DEBUG_context);
DBG_FIX_ADDR_SEG( &addr, 0 );
/* Put the display in a correct state */
XUngrabPointer( display, CurrentTime );
XUngrabServer( display );
XFlush( display );
if (!addr.seg) newmode = 32;
else newmode = (GET_SEL_FLAGS(addr.seg) & LDT_FLAGS_32BIT) ? 32 : 16;
......
......@@ -217,7 +217,7 @@ void DEBUG_LoadEntryPoints(void)
for (ok = ModuleFirst(&entry); ok; ok = ModuleNext(&entry))
{
if (!(pModule = (NE_MODULE *)GlobalLock( entry.hModule ))) continue;
if (!(pModule = MODULE_GetPtr( entry.hModule ))) continue;
name = (unsigned char *)pModule + pModule->name_table;
......
......@@ -261,7 +261,7 @@ base 1
0256 stub GetPrivateProfileStringW
0257 stdcall GetProcAddress(long long) WIN32_GetProcAddress
0258 stub GetProcessAffinityMask
0259 return GetProcessHeap 0 0
0259 stdcall GetProcessHeap() GetProcessHeap
0260 stub GetProcessHeaps
0261 stub GetProcessShutdownParameters
0262 stub GetProcessTimes
......@@ -338,16 +338,16 @@ base 1
0332 stub GlobalUnlock
0333 stub GlobalWire
0334 stdcall HeapAlloc(long long long) HeapAlloc
0335 stub HeapCompact
0335 stdcall HeapCompact(long long) HeapCompact
0336 stdcall HeapCreate(long long long) HeapCreate
0337 stub HeapDestroy
0338 stub HeapFree
0339 stub HeapLock
0340 stub HeapReAlloc
0341 stub HeapSize
0342 stub HeapUnlock
0343 stub HeapValidate
0344 stub HeapWalk
0337 stdcall HeapDestroy(long) HeapDestroy
0338 stdcall HeapFree(long long ptr) HeapFree
0339 stdcall HeapLock(long) HeapLock
0340 stdcall HeapReAlloc(long long ptr long) HeapReAlloc
0341 stdcall HeapSize(long long ptr) HeapSize
0342 stdcall HeapUnlock(long) HeapUnlock
0343 stdcall HeapValidate(long long ptr) HeapValidate
0344 stdcall HeapWalk(long ptr) HeapWalk
0345 stub InitAtomTable
0346 stdcall InitializeCriticalSection(ptr) InitializeCriticalSection
0347 stub InterlockedDecrement
......
......@@ -111,6 +111,7 @@ extern void DEBUG_InfoStack(void);
extern void DEBUG_BackTrace(void);
/* debugger/dbg.y */
extern void DEBUG_EnterDebugger(void);
extern void wine_debug( int signal, struct sigcontext_struct * regs );
#endif /* DEBUGGER_H */
......@@ -33,34 +33,27 @@ typedef struct
} DIALOGINFO;
/* Dialog template header */
typedef struct
{
DWORD style;
BYTE nbItems WINE_PACKED;
WORD x WINE_PACKED;
WORD y WINE_PACKED;
WORD cx WINE_PACKED;
WORD cy WINE_PACKED;
} DLGTEMPLATEHEADER;
/* Dialog control header */
typedef struct
{
DWORD style;
WORD x;
WORD y;
WORD cx;
WORD cy;
WORD id;
DWORD style WINE_PACKED;
} DLGCONTROLHEADER;
/* Dialog template */
typedef struct
{
DLGTEMPLATEHEADER header;
DWORD style;
WORD nbItems;
WORD x;
WORD y;
WORD cx;
WORD cy;
SEGPTR menuName;
SEGPTR className;
SEGPTR caption;
......
......@@ -15,7 +15,7 @@
typedef struct {
unsigned long magic;
} KERNEL_OBJECT, *HANDLE32;
} KERNEL_OBJECT;
typedef struct {
KERNEL_OBJECT common;
......
......@@ -8,6 +8,7 @@
#define _WINE_MODULE_H
#include "wintypes.h"
#include "pe_image.h"
#ifndef WINELIB
#pragma pack(1)
......@@ -16,49 +17,45 @@
/* In-memory module structure. See 'Windows Internals' p. 219 */
typedef struct
{
WORD magic; /* 'NE' signature */
WORD count; /* Usage count */
WORD entry_table; /* Near ptr to entry table */
HMODULE next; /* Selector to next module */
WORD dgroup_entry; /* Near ptr to segment entry for DGROUP */
WORD fileinfo; /* Near ptr to file info (OFSTRUCT) */
WORD flags; /* Module flags */
WORD dgroup; /* Logical segment for DGROUP */
WORD heap_size; /* Initial heap size */
WORD stack_size; /* Initial stack size */
WORD ip; /* Initial ip */
WORD cs; /* Initial cs (logical segment) */
WORD sp; /* Initial stack pointer */
WORD ss; /* Initial ss (logical segment) */
WORD seg_count; /* Number of segments in segment table */
WORD modref_count; /* Number of module references */
WORD nrname_size; /* Size of non-resident names table */
WORD seg_table; /* Near ptr to segment table */
WORD res_table; /* Near ptr to resource table */
WORD name_table; /* Near ptr to resident names table */
WORD modref_table; /* Near ptr to module reference table */
WORD import_table; /* Near ptr to imported names table */
DWORD nrname_fpos; /* File offset of non-resident names table */
WORD moveable_entries; /* Number of moveable entries in entry table */
WORD alignment; /* Alignment shift count */
WORD truetype; /* Set to 2 if TrueType font */
BYTE os_flags; /* Operating system flags */
BYTE misc_flags; /* Misc. flags */
HANDLE dlls_to_init; /* List of DLLs to initialize */
HANDLE nrname_handle; /* Handle to non-resident name table in memory */
WORD min_swap_area; /* Min. swap area size */
WORD expected_version; /* Expected Windows version */
WORD self_loading_sel; /* Selector used for self-loading apps. procs */
WORD magic; /* 00 'NE' signature */
WORD count; /* 02 Usage count */
WORD entry_table; /* 04 Near ptr to entry table */
HMODULE next; /* 06 Selector to next module */
WORD dgroup_entry; /* 08 Near ptr to segment entry for DGROUP */
WORD fileinfo; /* 0a Near ptr to file info (OFSTRUCT) */
WORD flags; /* 0c Module flags */
WORD dgroup; /* 0e Logical segment for DGROUP */
WORD heap_size; /* 10 Initial heap size */
WORD stack_size; /* 12 Initial stack size */
WORD ip; /* 14 Initial ip */
WORD cs; /* 16 Initial cs (logical segment) */
WORD sp; /* 18 Initial stack pointer */
WORD ss; /* 1a Initial ss (logical segment) */
WORD seg_count; /* 1c Number of segments in segment table */
WORD modref_count; /* 1e Number of module references */
WORD nrname_size; /* 20 Size of non-resident names table */
WORD seg_table; /* 22 Near ptr to segment table */
WORD res_table; /* 24 Near ptr to resource table */
WORD name_table; /* 26 Near ptr to resident names table */
WORD modref_table; /* 28 Near ptr to module reference table */
WORD import_table; /* 2a Near ptr to imported names table */
DWORD nrname_fpos; /* 2c File offset of non-resident names table */
WORD moveable_entries; /* 30 Number of moveable entries in entry table*/
WORD alignment; /* 32 Alignment shift count */
WORD truetype; /* 34 Set to 2 if TrueType font */
BYTE os_flags; /* 36 Operating system flags */
BYTE misc_flags; /* 37 Misc. flags */
HANDLE dlls_to_init; /* 38 List of DLLs to initialize */
HANDLE nrname_handle; /* 3a Handle to non-resident name table */
WORD min_swap_area; /* 3c Min. swap area size */
WORD expected_version; /* 3e Expected Windows version */
/* From here, these are extra fields not present in normal Windows */
PE_MODULE *pe_module; /* 40 PE module handle for Win32 modules */
HMODULE self; /* 44 Handle for this module */
WORD self_loading_sel; /* 46 Selector used for self-loading apps. */
} NE_MODULE;
/* Extra module info appended to NE_MODULE for Win32 modules */
typedef struct
{
DWORD pe_module;
} NE_WIN32_EXTRAINFO;
/* In-memory segment table */
typedef struct
{
......@@ -115,6 +112,7 @@ typedef struct
#endif
extern BOOL MODULE_Init(void);
extern NE_MODULE *MODULE_GetPtr( HMODULE hModule );
extern void MODULE_DumpModule( HMODULE hmodule );
extern void MODULE_WalkModules(void);
extern int MODULE_OpenFile( HMODULE hModule );
......@@ -128,7 +126,7 @@ extern FARPROC MODULE_GetWndProcEntry16( const char *name );
extern FARPROC MODULE_GetWndProcEntry32( const char *name );
extern BOOL NE_LoadSegment( HMODULE hModule, WORD segnum );
extern void NE_FixupPrologs( HMODULE hModule );
extern void NE_FixupPrologs( NE_MODULE *pModule );
extern void NE_InitializeDLLs( HMODULE hModule );
#endif /* _WINE_MODULE_H */
......@@ -18,6 +18,8 @@ struct pe_data {
int resource_offset; /* offset to resource typedirectory in file */
};
typedef struct pe_data PE_MODULE;
extern int PE_unloadImage(HMODULE hModule);
extern void my_wcstombs(char * result, u_short * source, int len);
......
......@@ -107,6 +107,7 @@
#undef DEBUG_GDI
#undef DEBUG_GLOBAL
#undef DEBUG_GRAPHICS
#undef DEBUG_HEAP
#undef DEBUG_HOOK
#undef DEBUG_ICON
#undef DEBUG_INT
......@@ -186,6 +187,7 @@
#define DEBUG_GDI
#define DEBUG_GLOBAL
#define DEBUG_GRAPHICS
#define DEBUG_HEAP
#define DEBUG_HOOK
#define DEBUG_ICON
#define DEBUG_INT
......
#ifndef _WINBASE_H
#define _WINBASE_H
#ifndef __WINE_WINBASE_H
#define __WINE_WINBASE_H
......@@ -19,12 +19,6 @@
#define WAIT_ABANDONED_0 STATUS_ABANDONED_WAIT_0
#define WAIT_TIMEOUT STATUS_TIMEOUT
#define MEM_COMMIT 0x1000
#define MEM_RESERVE 0x2000
#define MEM_TOPDOWN 0x100000
#define MEM_RELEASE 0x8000
#define PAGE_NOACCESS 0x01
#define PAGE_READONLY 0x02
#define PAGE_READWRITE 0x04
......@@ -36,11 +30,14 @@
#define PAGE_GUARD 0x100
#define PAGE_NOCACHE 0x200
HANDLE WINAPI OpenProcess(DWORD access, BOOL inherit, DWORD id);
int WINAPI GetCurrentProcessId(void);
int WINAPI TerminateProcess(HANDLE h, int ret);
WINAPI void * VirtualAlloc (void *addr,DWORD size,DWORD type,DWORD protect);
#define MEM_COMMIT 0x00001000
#define MEM_RESERVE 0x00002000
#define MEM_DECOMMIT 0x00004000
#define MEM_RELEASE 0x00008000
#define MEM_FREE 0x00010000
#define MEM_PRIVATE 0x00020000
#define MEM_MAPPED 0x00040000
#define MEM_TOP_DOWN 0x00100000
struct _EXCEPTION_POINTERS;
......@@ -105,8 +102,6 @@ typedef struct
int ss;
} exception_info;
#endif
/*DWORD WINAPI GetVersion( void );*/
......@@ -122,3 +117,27 @@ HACCEL WINAPI LoadAcceleratorsA( HINSTANCE, const char *);
#define FreeModule(hLibModule) FreeLibrary((hLibModule))
#define MakeProcInstance(lpProc,hInstance) (lpProc)
#define FreeProcInstance(lpProc) (lpProc)
WINAPI void DeleteCriticalSection(CRITICAL_SECTION *lpCrit);
WINAPI void EnterCriticalSection(CRITICAL_SECTION *lpCrit);
WINAPI int GetCurrentProcessId(void);
WINAPI HANDLE32 GetProcessHeap(void);
WINAPI LPVOID HeapAlloc(HANDLE32,DWORD,DWORD);
WINAPI DWORD HeapCompact(HANDLE32,DWORD);
WINAPI HANDLE32 HeapCreate(DWORD,DWORD,DWORD);
WINAPI BOOL HeapDestroy(HANDLE32);
WINAPI BOOL HeapFree(HANDLE32,DWORD,LPVOID);
WINAPI BOOL HeapLock(HANDLE32);
WINAPI LPVOID HeapReAlloc(HANDLE32,DWORD,LPVOID,DWORD);
WINAPI DWORD HeapSize(HANDLE32,DWORD,LPVOID);
WINAPI BOOL HeapUnlock(HANDLE32);
WINAPI BOOL HeapValidate(HANDLE32,DWORD,LPVOID);
WINAPI void InitializeCriticalSection(CRITICAL_SECTION *lpCrit);
WINAPI void LeaveCriticalSection(CRITICAL_SECTION *lpCrit);
WINAPI HANDLE OpenProcess(DWORD access, BOOL inherit, DWORD id);
WINAPI int TerminateProcess(HANDLE h, int ret);
WINAPI LPVOID VirtualAlloc(LPVOID addr,DWORD size,DWORD type,DWORD protect);
WINAPI BOOL VirtualFree( LPVOID addr, DWORD size, DWORD type );
#endif /* __WINE_WINBASE_H */
/*
* Win32 definitions for Windows NT
*
* Copyright 1996 Alexandre Julliard
*/
#ifndef __WINE_WINNT_H
#define __WINE_WINNT_H
/* Heap flags */
#define HEAP_NO_SERIALIZE 0x00000001
#define HEAP_GROWABLE 0x00000002
#define HEAP_GENERATE_EXCEPTIONS 0x00000004
#define HEAP_ZERO_MEMORY 0x00000008
#define HEAP_REALLOC_IN_PLACE_ONLY 0x00000010
#define HEAP_TAIL_CHECKING_ENABLED 0x00000020
#define HEAP_FREE_CHECKING_ENABLED 0x00000040
#define HEAP_DISABLE_COALESCE_ON_FREE 0x00000080
#define HEAP_CREATE_ALIGN_16 0x00010000
#define HEAP_CREATE_ENABLE_TRACING 0x00020000
#endif /* __WINE_WINNT_H */
......@@ -43,6 +43,7 @@ typedef DWORD SEGPTR;
#endif /* WINELIB32 */
typedef UINT HANDLE;
typedef DWORD HANDLE32;
typedef UINT WPARAM;
typedef LONG LPARAM;
typedef LONG LRESULT;
......@@ -163,6 +164,23 @@ typedef FARPROC HOOKPROC;
#define SELECTOROF(ptr) (HIWORD(ptr))
#define OFFSETOF(ptr) (LOWORD(ptr))
#if !defined(WINELIB) || defined(__i386__)
#define PUT_WORD(ptr,w) (*(WORD *)(ptr) = (w))
#define GET_WORD(ptr) (*(WORD *)(ptr))
#define PUT_DWORD(ptr,dw) (*(DWORD *)(ptr) = (dw))
#define GET_DWORD(ptr) (*(DWORD *)(ptr))
#else
#define PUT_WORD(ptr,w) (*(BYTE *)(ptr) = LOBYTE(w), \
*((BYTE *)(ptr) + 1) = HIBYTE(w))
#define GET_WORD(ptr) ((WORD)(*(BYTE *)(ptr) | \
(WORD)(*((BYTE *)(ptr)+1) << 8)))
#define PUT_DWORD(ptr,dw) (PUT_WORD((ptr),LOWORD(dw)), \
PUT_WORD((WORD *)(ptr)+1,HIWORD(dw)))
#define GET_DWORD(ptr) ((DWORD)(GET_WORD(ptr) | \
((DWORD)GET_WORD((WORD *)(ptr)+1) << 16)))
#endif /* !WINELIB || __i386__ */
#ifndef MAX
#define MAX(a,b) (((a) > (b)) ? (a) : (b))
#endif
......@@ -171,13 +189,4 @@ typedef FARPROC HOOKPROC;
#define MIN(a,b) (((a) < (b)) ? (a) : (b))
#endif
#ifndef DONT_DEFINE_min_AND_max
#ifndef min
#define min(a,b) MIN(a,b)
#endif
#ifndef max
#define max(a,b) MAX(a,b)
#endif
#endif
#endif /* __WINE_WINTYPES_H */
......@@ -207,3 +207,8 @@ WNDPROC MODULE_GetWndProcEntry32( char *name )
{
return MODULE_GetWndProcEntry16( name );
}
void DEBUG_EnterDebugger(void)
{
}
......@@ -49,7 +49,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
int ordinal, additive;
unsigned short *sp;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return FALSE;
if (!(pModule = MODULE_GetPtr( hModule ))) return FALSE;
pSegTable = NE_SEG_TABLE( pModule );
pSeg = pSegTable + segnum - 1;
pModuleTable = NE_MODULE_TABLE( pModule );
......@@ -171,7 +171,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
address = MODULE_GetEntryPoint( module, ordinal );
if (!address)
{
NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module );
NE_MODULE *pTarget = MODULE_GetPtr( module );
if (!pTarget)
fprintf( stderr, "Module not found: %04x, reference %d of module %*.*s\n",
module, rep->target1,
......@@ -187,7 +187,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
}
if (debugging_fixup)
{
NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module );
NE_MODULE *pTarget = MODULE_GetPtr( module );
fprintf( stddeb,"%d: %*.*s.%d=%04x:%04x\n", i + 1,
*((BYTE *)pTarget + pTarget->name_table),
*((BYTE *)pTarget + pTarget->name_table),
......@@ -208,7 +208,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
if (!address)
{
NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module );
NE_MODULE *pTarget = MODULE_GetPtr( module );
fprintf( stderr, "Warning: no handler for %*.*s.%s, setting to 0:0\n",
*((BYTE *)pTarget + pTarget->name_table),
*((BYTE *)pTarget + pTarget->name_table),
......@@ -216,7 +216,7 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
}
if (debugging_fixup)
{
NE_MODULE *pTarget = (NE_MODULE *)GlobalLock( module );
NE_MODULE *pTarget = MODULE_GetPtr( module );
fprintf( stddeb,"%d: %*.*s.%s=%04x:%04x\n", i + 1,
*((BYTE *)pTarget + pTarget->name_table),
*((BYTE *)pTarget + pTarget->name_table),
......@@ -347,23 +347,21 @@ BOOL NE_LoadSegment( HMODULE hModule, WORD segnum )
*
* Fixup the exported functions prologs.
*/
void NE_FixupPrologs( HMODULE hModule )
void NE_FixupPrologs( NE_MODULE *pModule )
{
#ifdef WINELIB
fprintf(stderr,"NE_FixupPrologs should not be called for libwine\n");
#else
NE_MODULE *pModule;
SEGTABLEENTRY *pSegTable;
WORD dgroup = 0;
WORD sel;
BYTE *p, *fixup_ptr, count;
pModule = (NE_MODULE *)GlobalLock( hModule );
pSegTable = NE_SEG_TABLE(pModule);
if (pModule->flags & NE_FFLAGS_SINGLEDATA)
dgroup = pSegTable[pModule->dgroup-1].selector;
dprintf_module( stddeb, "MODULE_FixupPrologs(%04x)\n", hModule );
dprintf_module( stddeb, "MODULE_FixupPrologs(%04x)\n", pModule->self );
p = (BYTE *)pModule + pModule->entry_table;
while (*p)
{
......@@ -455,10 +453,11 @@ static BOOL NE_InitDLL( HMODULE hModule )
* es:si command line (always 0)
*/
pModule = (NE_MODULE *)GlobalLock( hModule );
if (!(pModule = MODULE_GetPtr( hModule ))) return FALSE;
pSegTable = NE_SEG_TABLE( pModule );
if (!(pModule->flags & NE_FFLAGS_LIBMODULE)) return TRUE; /*not a library*/
if (!(pModule->flags & NE_FFLAGS_LIBMODULE) ||
(pModule->flags & NE_FFLAGS_WIN32)) return TRUE; /*not a library*/
if (!pModule->cs) return TRUE; /* no initialization code */
if (!(pModule->flags & NE_FFLAGS_SINGLEDATA))
......@@ -509,7 +508,7 @@ void NE_InitializeDLLs( HMODULE hModule )
NE_MODULE *pModule;
HMODULE *pDLL;
pModule = (NE_MODULE *)GlobalLock( hModule );
if (!(pModule = MODULE_GetPtr( hModule ))) return;
if (pModule->flags & NE_FFLAGS_WIN32)
{
PE_InitializeDLLs(hModule);
......
......@@ -43,7 +43,7 @@ static DWORD NE_FindNameTableId( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
DWORD ret = 0;
int count;
pModule = (NE_MODULE *)GlobalLock( hModule );
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
for (; pTypeInfo->type_id != 0;
pTypeInfo = (NE_TYPEINFO *)((char*)(pTypeInfo+1) +
......@@ -139,11 +139,10 @@ static HRSRC NE_FindResourceFromType( NE_MODULE *pModule,
*/
HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
{
NE_MODULE *pModule;
NE_TYPEINFO *pTypeInfo;
HRSRC hRsrc;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return 0;
pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
......@@ -217,11 +216,10 @@ HRSRC NE_FindResource( HMODULE hModule, SEGPTR typeId, SEGPTR resId )
*/
HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
{
NE_MODULE *pModule;
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return 0;
sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
#ifndef WINELIB
......@@ -238,11 +236,10 @@ HGLOBAL NE_AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
*/
int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
{
NE_MODULE *pModule;
NE_NAMEINFO *pNameInfo=NULL;
int fd;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return -1;
#ifndef WINELIB
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
......@@ -262,11 +259,10 @@ int NE_AccessResource( HMODULE hModule, HRSRC hRsrc )
*/
DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
{
NE_MODULE *pModule;
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return 0;
sizeShift = *(WORD *)((char *)pModule + pModule->res_table);
#ifndef WINELIB
......@@ -281,12 +277,11 @@ DWORD NE_SizeofResource( HMODULE hModule, HRSRC hRsrc )
*/
HGLOBAL NE_LoadResource( HMODULE hModule, HRSRC hRsrc )
{
NE_MODULE *pModule;
NE_NAMEINFO *pNameInfo=NULL;
WORD sizeShift;
int fd;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return 0;
#ifndef WINELIB
pNameInfo = (NE_NAMEINFO*)((char*)pModule + hRsrc);
......@@ -328,12 +323,11 @@ SEGPTR NE_LockResource( HMODULE hModule, HGLOBAL handle )
*/
BOOL NE_FreeResource( HMODULE hModule, HGLOBAL handle )
{
NE_MODULE *pModule;
NE_TYPEINFO *pTypeInfo;
NE_NAMEINFO *pNameInfo;
WORD count;
pModule = (NE_MODULE *)GlobalLock( hModule );
NE_MODULE *pModule = MODULE_GetPtr( hModule );
if (!pModule || !pModule->res_table) return FALSE;
pTypeInfo = (NE_TYPEINFO *)((char *)pModule + pModule->res_table + 2);
while (pTypeInfo->type_id)
......
......@@ -34,6 +34,8 @@
#include "debug.h"
#include "xmalloc.h"
static HANDLE32 ProcessHeap; /* FIXME: should be in process database */
void my_wcstombs(char * result, u_short * source, int len)
{
while(len--) {
......@@ -136,20 +138,19 @@ static DWORD PE_FindExportedFunction(struct pe_data *pe, char* funcName)
DWORD PE_GetProcAddress(HMODULE hModule, char* function)
{
NE_MODULE *pModule;
struct pe_data *pe;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0;
if (pModule->flags & NE_FFLAGS_BUILTIN)
{
BUILTIN_DLL *dll = (BUILTIN_DLL *)NE_WIN32_MODULE(pModule);
BUILTIN_DLL *dll = (BUILTIN_DLL *)pModule->pe_module;
if(HIWORD(function))
return RELAY32_GetEntryPoint(dll,function,0);
else
return RELAY32_GetEntryPoint(dll,0,(int)function);
}
if (!(pe = NE_WIN32_MODULE(pModule))) return 0;
return PE_FindExportedFunction( pe, function );
if (!pModule->pe_module) return 0;
return PE_FindExportedFunction( pModule->pe_module, function );
}
void fixup_imports(struct pe_data *pe, HMODULE hModule)
......@@ -286,7 +287,7 @@ static void calc_vma_size(struct pe_data *pe)
pe->pe_seg[i].NumberOfRelocations,
pe->pe_seg[i].NumberOfLinenumbers,
pe->pe_seg[i].Characteristics);
pe->vma_size = max(pe->vma_size,
pe->vma_size = MAX(pe->vma_size,
pe->pe_seg[i].Virtual_Address +
pe->pe_seg[i].Size_Of_Raw_Data);
}
......@@ -535,10 +536,9 @@ void InitTask(struct sigcontext_struct context);
HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
{
struct pe_data *pe;
PE_MODULE *pe;
int size, of_size;
NE_MODULE *pModule;
NE_WIN32_EXTRAINFO *pExtraInfo;
SEGTABLEENTRY *pSegment;
char *pStr;
DWORD cts;
......@@ -554,8 +554,6 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
of_size = sizeof(OFSTRUCT) - sizeof(ofs->szPathName)
+ strlen(ofs->szPathName) + 1;
size = sizeof(NE_MODULE) +
/* extra module info */
sizeof(NE_WIN32_EXTRAINFO) +
/* loaded file info */
of_size +
/* segment table: DS,CS */
......@@ -586,18 +584,16 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
pModule->seg_count=1;
pModule->modref_count=0;
pModule->nrname_size=0;
pModule->fileinfo=sizeof(NE_MODULE) + sizeof(NE_WIN32_EXTRAINFO);
pModule->fileinfo=sizeof(NE_MODULE);
pModule->os_flags=NE_OSFLAGS_WINDOWS;
pModule->expected_version=0x30A;
/* Set extra info */
pExtraInfo = (NE_WIN32_EXTRAINFO *)(pModule + 1);
pModule->self = hModule;
/* Set loaded file information */
memcpy( pExtraInfo + 1, ofs, of_size );
((OFSTRUCT *)(pExtraInfo+1))->cBytes = of_size - 1;
memcpy( pModule + 1, ofs, of_size );
((OFSTRUCT *)(pModule+1))->cBytes = of_size - 1;
pSegment=(SEGTABLEENTRY*)((char*)(pExtraInfo + 1) + of_size);
pSegment=(SEGTABLEENTRY*)((char*)(pModule + 1) + of_size);
pModule->seg_table=pModule->dgroup_entry=(int)pSegment-(int)pModule;
pSegment->size=0;
pSegment->flags=NE_SEGFLAGS_DATA;
......@@ -627,7 +623,7 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
pe = PE_LoadImage( fd, hModule, mz_header.ne_offset );
pExtraInfo->pe_module = (DWORD)pe;
pModule->pe_module = pe;
pModule->heap_size=0x1000;
pModule->stack_size=0xE000;
......@@ -638,6 +634,7 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
if ((pe->pe_header->coff.Characteristics & IMAGE_FILE_DLL)) {
/* PE_InitDLL(hModule); */
} else {
ProcessHeap = HeapCreate( 0, 0x10000, 0 );
TASK_CreateTask(hModule,hInstance,0,
params->hEnvironment,(LPSTR)PTR_SEG_TO_LIN(params->cmdLine),
*((WORD*)PTR_SEG_TO_LIN(params->showCmd)+1));
......@@ -646,6 +643,11 @@ HINSTANCE PE_LoadModule( int fd, OFSTRUCT *ofs, LOADPARAMS* params )
return hInstance;
}
HANDLE32 GetProcessHeap(void)
{
return ProcessHeap;
}
int USER_InitApp(HINSTANCE hInstance);
void PE_InitTEB(int hTEB);
......@@ -653,19 +655,19 @@ void PE_Win32CallToStart(struct sigcontext_struct context)
{
int fs;
HMODULE hModule;
NE_MODULE *pModule;
struct pe_data *pe;
dprintf_win32(stddeb,"Going to start Win32 program\n");
InitTask(context);
hModule = GetExePtr( GetCurrentTask() );
pModule = MODULE_GetPtr( hModule );
USER_InitApp( hModule );
fs=(int)GlobalAlloc(GHND,0x10000);
PE_InitTEB(fs);
pe = NE_WIN32_MODULE( (NE_MODULE *)GlobalLock(hModule) );
__asm__ __volatile__("movw %w0,%%fs"::"r" (fs));
/* ((void(*)())(pe->load_addr+pe->pe_header->opt_coff.AddressOfEntryPoint))(); */
CallTaskStart32( (FARPROC)(pe->load_addr +
pe->pe_header->opt_coff.AddressOfEntryPoint) );
CallTaskStart32( (FARPROC)(pModule->pe_module->load_addr +
pModule->pe_module->pe_header->opt_coff.AddressOfEntryPoint) );
}
int PE_UnloadImage( HMODULE hModule )
......@@ -678,11 +680,13 @@ int PE_UnloadImage( HMODULE hModule )
static void PE_InitDLL(HMODULE hModule)
{
NE_MODULE *pModule;
struct pe_data *pe;
PE_MODULE *pe;
hModule = GetExePtr(hModule);
if (!(pModule = (NE_MODULE *)GlobalLock(hModule))) return;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return;
if (!(pe = NE_WIN32_MODULE(pModule))) return;
if (!(pModule = MODULE_GetPtr(hModule))) return;
if (!(pModule->flags & NE_FFLAGS_WIN32) || !(pe = pModule->pe_module))
return;
/* FIXME: What are the correct values for parameters 2 and 3? */
/* Is this a library? */
......@@ -726,7 +730,7 @@ void PE_InitializeDLLs(HMODULE hModule)
{
NE_MODULE *pModule;
HMODULE *pDLL;
pModule = (NE_MODULE *)GlobalLock( GetExePtr(hModule) );
pModule = MODULE_GetPtr( GetExePtr(hModule) );
if (pModule->dlls_to_init)
{
HANDLE to_init = pModule->dlls_to_init;
......
......@@ -52,7 +52,7 @@ HRSRC FindResource( HMODULE hModule, SEGPTR name, SEGPTR type )
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
......@@ -77,7 +77,7 @@ HGLOBAL LoadResource( HMODULE hModule, HRSRC hRsrc )
dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
......@@ -104,7 +104,7 @@ SEGPTR WIN16_LockResource( HGLOBAL handle )
dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
if (!handle) return (SEGPTR)0;
hModule = GetExePtr( handle );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to LockResource() for Win32 module\n");
......@@ -126,7 +126,7 @@ LPVOID LockResource( HGLOBAL handle )
dprintf_resource(stddeb, "LockResource: handle=%04x\n", handle );
if (!handle) return NULL;
hModule = GetExePtr( handle );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to LockResource() for Win32 module\n");
......@@ -151,7 +151,7 @@ BOOL FreeResource( HGLOBAL handle )
dprintf_resource(stddeb, "FreeResource: handle=%04x\n", handle );
if (!handle) return FALSE;
hModule = GetExePtr( handle );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (pModule->flags & NE_FFLAGS_WIN32)
{
fprintf(stderr,"Don't know how to FreeResource() for Win32 module\n");
......@@ -175,7 +175,7 @@ INT AccessResource( HINSTANCE hModule, HRSRC hRsrc )
dprintf_resource(stddeb, "AccessResource: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
......@@ -199,7 +199,7 @@ DWORD SizeofResource( HMODULE hModule, HRSRC hRsrc )
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "SizeofResource: module=%04x res=%04x\n",
hModule, hRsrc );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
......@@ -224,7 +224,7 @@ HGLOBAL AllocResource( HMODULE hModule, HRSRC hRsrc, DWORD size )
dprintf_resource(stddeb, "AllocResource: module=%04x res=%04x size=%ld\n",
hModule, hRsrc, size );
if (!hRsrc) return 0;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
#ifndef WINELIB
if (pModule->flags & NE_FFLAGS_WIN32)
{
......
......@@ -113,9 +113,6 @@ static void win_fault(int signal, int code, struct sigcontext *context)
}
}
XUngrabPointer(display, CurrentTime);
XUngrabServer(display);
XFlush(display);
wine_debug( signal, context ); /* Enter our debugger */
}
......
......@@ -162,7 +162,7 @@ static HANDLE TASK_CreateDOSEnvironment(void)
/* Now add the program name */
*p++ = '\0';
*(WORD *)p = 1;
PUT_WORD( p, 1 );
p += sizeof(WORD);
GetSystemDirectory( p, sysdirlen );
strcat( p, "\\" );
......@@ -329,7 +329,7 @@ static void TASK_CallToStart(void)
{
int cs_reg, ds_reg, ip_reg;
TDB *pTask = (TDB *)GlobalLock( hCurrentTask );
NE_MODULE *pModule = (NE_MODULE *)GlobalLock( pTask->hModule );
NE_MODULE *pModule = MODULE_GetPtr( pTask->hModule );
SEGTABLEENTRY *pSegTable = NE_SEG_TABLE( pModule );
/* Registers at initialization must be:
......@@ -387,7 +387,7 @@ HTASK TASK_CreateTask( HMODULE hModule, HANDLE hInstance, HANDLE hPrevInstance,
extern DWORD CALLTO16_RetAddr_word;
#endif
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
pSegTable = NE_SEG_TABLE( pModule );
/* Allocate the task structure */
......@@ -759,7 +759,7 @@ void InitTask( struct sigcontext_struct context )
EAX_reg(&context) = 0;
#endif
if (!(pTask = (TDB *)GlobalLock( hCurrentTask ))) return;
if (!(pModule = (NE_MODULE *)GlobalLock( pTask->hModule ))) return;
if (!(pModule = MODULE_GetPtr( pTask->hModule ))) return;
if (firstTask)
{
......
......@@ -4,6 +4,7 @@ MODULE = memory
C_SRCS = \
atom.c \
global.c \
heap.c \
ldt.c \
local.c \
selector.c
......
......@@ -198,7 +198,9 @@ HGLOBAL GLOBAL_Alloc( WORD flags, DWORD size, HGLOBAL hOwner,
ptr = DDE_malloc(flags, size, &shmdata);
else
#endif /* CONFIG_IPC */
{
ptr = malloc( size );
}
if (!ptr) return 0;
/* Allocate the selector(s) */
......
This diff is collapsed. Click to expand it.
......@@ -313,7 +313,7 @@ BOOL LocalInit( HANDLE selector, WORD start, WORD end )
if (start == 0) {
/* Check if the segment is the DGROUP of a module */
if ((pModule = (NE_MODULE *)GlobalLock( GetExePtr( selector ) )))
if ((pModule = MODULE_GetPtr( GetExePtr( selector ) )))
{
SEGTABLEENTRY *pSeg = NE_SEG_TABLE( pModule ) + pModule->dgroup - 1;
if (pModule->dgroup && (pSeg->selector == selector)) {
......
......@@ -121,9 +121,9 @@ static void SELECTOR_SetEntries( WORD sel, const void *base, DWORD size,
{
LDT_SetEntry( SELECTOR_TO_ENTRY(sel) + i, &entry );
entry.base += 0x10000;
size -= 0x10000;
entry.limit = (size > 0x10000) ? 0xffff : size-1;
entry.limit_in_pages = 0;
/* Apparently the next selectors should *not* get a 64k limit. */
/* Can't remember where I read they should... --AJ */
entry.limit -= entry.limit_in_pages ? 0x10 : 0x10000;
}
}
......
......@@ -11,7 +11,7 @@
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/ioctl.h>
#if defined__svr4__
#if defined(__svr4__)
#include <sys/filio.h>
#include <sys/ioccom.h>
#endif
......
......@@ -1900,7 +1900,7 @@ LONG mmioRead(HMMIO hmmio, HPSTR pch, LONG cch)
dprintf_mmio(stddeb, "mmioRead(%04X, %p, %ld);\n", hmmio, pch, cch);
lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
if (lpmminfo == NULL) return 0;
count = read(LOWORD(lpmminfo->dwReserved2), pch, cch);
count = FILE_Read(LOWORD(lpmminfo->dwReserved2), pch, cch);
GlobalUnlock(hmmio);
dprintf_mmio(stddeb, "mmioRead // count=%ld\n", count);
return count;
......@@ -2002,7 +2002,7 @@ UINT mmioAdvance(HMMIO hmmio, MMIOINFO FAR* lpmmioinfo, UINT uFlags)
lpmminfo = (LPMMIOINFO)GlobalLock(hmmio);
if (lpmminfo == NULL) return 0;
if (uFlags == MMIO_READ) {
count = read(LOWORD(lpmminfo->dwReserved2),
count = FILE_Read(LOWORD(lpmminfo->dwReserved2),
lpmmioinfo->pchBuffer, lpmmioinfo->cchBuffer);
}
if (uFlags == MMIO_WRITE) {
......@@ -2070,7 +2070,7 @@ UINT mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
(uFlags & MMIO_FINDLIST)) {
dprintf_mmio(stddeb, "mmioDescend // MMIO_FINDxxxx dwfcc=%08lX !\n", dwfcc);
while (TRUE) {
if (read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
if (FILE_Read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
_llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
GlobalUnlock(hmmio);
......@@ -2086,7 +2086,7 @@ UINT mmioDescend(HMMIO hmmio, MMCKINFO FAR* lpck,
}
}
else {
if (read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
if (FILE_Read(LOWORD(lpmminfo->dwReserved2), (LPSTR)lpck,
sizeof(MMCKINFO)) < sizeof(MMCKINFO)) {
_llseek(LOWORD(lpmminfo->dwReserved2), dwOldPos, SEEK_SET);
GlobalUnlock(hmmio);
......
......@@ -152,7 +152,9 @@ static XFontStruct * FONT_MatchFont( LOGFONT * font, DC * dc )
height = 10 * (-height * 9 / 8);
* may be we have to use an non linear function
*/
height *= -10;
/* assume internal leading is 2 pixels. Else small fonts will become
* very small. */
height = (height-2) * -10;
}
else height *= 10;
width = 10 * (font->lfWidth * dc->w.VportExtY / dc->w.WndExtY);
......
......@@ -648,7 +648,7 @@ BOOL MF_WriteRecord(HMETAFILE hmf, METARECORD *mr, WORD rlen)
GlobalUnlock(mf->hMetaHdr);
mf->hMetaHdr = GlobalReAlloc(mf->hMetaHdr, len, GMEM_MOVEABLE);
mh = (METAHEADER *)GlobalLock(mf->hMetaHdr);
memcpy(mh + mh->mtSize * 2, mr, rlen);
memcpy((WORD *)mh + mh->mtSize, mr, rlen);
}
else if (mh->mtType == 1) /* disk based metafile */
{
......
......@@ -62,8 +62,8 @@ int PASCAL WinMain (HANDLE hInstance, HANDLE prev, LPSTR cmdline, int show)
}
#endif
/* Select Language */
#ifdef WINELIB
/* Select Language (FIXME) */
#ifndef WINELIB
Globals.lpszLanguage = langNames[Options.language];
#else
Globals.lpszLanguage = "En";
......
......@@ -120,8 +120,8 @@ VOID STRING_SelectLanguageByNumber(UINT num)
if (Globals.hMainMenu) DestroyMenu(Globals.hMainMenu);
Globals.hMainMenu = hMainMenu;
#ifdef WINELIB
/* Update system menus */
#ifndef WINELIB
/* Update system menus (FIXME) */
for (i = 0; langNames[i] && lstrcmp(lang, langNames[i]);) i++;
if (langNames[i]) Options.language = i;
......
......@@ -105,7 +105,3 @@ void set_out_file(char*);
extern int verbose;
#ifdef __sun__
#define strtoul strtol
#endif
......@@ -27,3 +27,27 @@ flags (WS_??? etc): They control how the dialog behaves. Things like:
Frans van Dorsselaer
dorssel@rulhm1.LeidenUniv.nl
***************************************************************
1996, April, 7th
Subject: ChooseColor
===========
Today I introduced ChooseColor() to commdlg.c.
Because this old resource was insufficient I wrote a new one
(including some new static contols).
Please delete the old CHOOSECOLOR in YOUR sysres_??.rc
and insert the new CHOOSECOLOR from sysres_En.rc to YOUR
language file and translate this as you like it -
otherwise you'll get an undefined behavour.
Today it works well for:
* English
* German
...to be continued......
Thank you.
Albrecht Kleine
kleine@ak.sax.de
......@@ -144,24 +144,37 @@ FONT 8, "Helv"
}
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Farbe"
FONT 8, "Helv"
{
LTEXT "&Standardfarben:", 1088, 6, 6, 40, 9
LTEXT "S&elbstdefinierte Farben:", 1089, 6, 126, 40, 9
LTEXT "Farbe|Re&in", 1090, 100, 146, 40, 9
LTEXT "&Ton:", 1091, 150, 126, 40, 9
LTEXT "&Sttigung:", 1092, 150, 146, 40, 9
LTEXT "&Helligkeit:", 1093, 150, 166, 40, 9
LTEXT "&Rot:", 1094, 150, 126, 40, 9
LTEXT "&Grn:", 1095, 150, 146, 40, 9
LTEXT "Bl&au:", 1096, 150, 166, 40, 9
DEFPUSHBUTTON "Ok", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Selbstdefinierte Farbe &hinzufgen", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Selbstdefinierte Farbe &entfernen", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Abbrechen", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
LTEXT "Gr&undfarben:", 1088, 4, 4, 140, 10
LTEXT "Selbs&tdefinierte Farben:", 1089, 4, 106, 140, 10
LTEXT "Farbe | B&asis", 1090, 150, 151, 48, 10
LTEXT "&Rot:", 726 ,249,126,24,10
EDITTEXT 706, 275,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Grn:",727/*1095*/,249,140,24,10
EDITTEXT 707, 275,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Blau:",728 /*1096*/,249,154,24,10
EDITTEXT 708, 275,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Farbe:" ,723 /*1091*/,202,126,22,10
EDITTEXT 703, 226,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Stt:" ,724 /*1092*/,202,140,22,10
EDITTEXT 704, 226,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "H&ell:" ,725 /*1093*/,202,154,22,10
EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Abbrechen", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Hilfe", 1038,100,166, 44, 14
PUSHBUTTON "Farbe hin&zufgen", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Farben &definieren >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&a",713,300,200,4,14 /* just a dummy: 'a' is like &a in "B&asis" */
}
......
......@@ -144,24 +144,37 @@ FONT 8, "Helv"
}
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 200
CHOOSE_COLOR DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 300, 200
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Color"
FONT 8, "Helv"
{
LTEXT "&Basic Colors:", 1088, 6, 6, 40, 9
LTEXT "&Custom Colors:", 1089, 6, 126, 40, 9
LTEXT "Color|Sol&id", 1090, 100, 146, 40, 9
LTEXT "&Hue:", 1091, 150, 126, 40, 9
LTEXT "&Sat:", 1092, 150, 146, 40, 9
LTEXT "&Lum:", 1093, 150, 166, 40, 9
LTEXT "&Red:", 1094, 150, 126, 40, 9
LTEXT "&Green:", 1095, 150, 146, 40, 9
LTEXT "Bl&ue:", 1096, 150, 166, 40, 9
DEFPUSHBUTTON "Ok", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Add to Custom Colors", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Delete Custom Colors", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
LTEXT "&Basic Colors:", 1088, 4, 4, 140, 10
LTEXT "&Custom Colors:", 1089, 4, 106, 140, 10
LTEXT "Color | Sol&id", 1090, 150, 151, 48, 10
LTEXT "&Red:", 726 /*1094*/,249,126,24,10
EDITTEXT 706, 275,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Green:",727/*1095*/,249,140,24,10
EDITTEXT 707, 275,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Blue:",728 /*1096*/,249,154,24,10
EDITTEXT 708, 275,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Hue:" ,723 /*1091*/,202,126,22,10
EDITTEXT 703, 226,124,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Sat:" ,724 /*1092*/,202,140,22,10
EDITTEXT 704, 226,138,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "&Lum:" ,725 /*1093*/,202,154,22,10
EDITTEXT 705, 226,152,18,12, WS_BORDER | WS_GROUP | WS_TABSTOP
CONTROL "" ,720,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,14,140,86
CONTROL "" ,721,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP,4,116,140,28
CONTROL "" ,710,"STATIC",WS_BORDER|SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,4,118,116
CONTROL "" ,702,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 278,4,8,116
CONTROL "" ,709,"STATIC",SS_SIMPLE|WS_TABSTOP|WS_GROUP, 152,124,40,26
DEFPUSHBUTTON "Ok", 1, 4, 166, 44, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", 2, 52, 166, 44, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Help", 1038,100,166, 44, 14
PUSHBUTTON "&Add to Custom Colors", 712/*1024*/, 152, 166, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Define Custom Colors >>", 719/*1025*/, 4, 150, 142, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&i",713,300,200,4,14 /* just a dummy: 'i' is like &i in "sol&id" */
}
......
......@@ -30,7 +30,7 @@ END
SHELL_ABOUT_MSGBOX DIALOG LOADONCALL MOVEABLE DISCARDABLE 50, 44, 223, 200
STYLE DS_LOCALEDIT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU
CAPTION "Informazioni su %s"
FONT 10, "Sistema"
FONT 10, "System"
{
DEFPUSHBUTTON "OK", 1, 91, 180, 40, 14
CONTROL "", -1, "STATIC", SS_BLACKFRAME | WS_CHILD | WS_VISIBLE | WS_DISABLED, 4, 35, 215, 140
......@@ -44,10 +44,10 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Apri"
FONT 8, "Helv"
{
LTEXT "File &Nome:", 1090, 6, 6, 76, 9
LTEXT "&Nome file:", 1090, 6, 6, 76, 9
EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "&Directories:", -1, 110, 6, 92, 9
LTEXT "&Percorso:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "Files di &Tipo:", 1089, 6, 104, 90, 9
......@@ -57,7 +57,7 @@ FONT 8, "Helv"
DEFPUSHBUTTON "Apri", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annulla", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Aiuto", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
CHECKBOX "Solo &Lettura", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "Solo &Lettura", 1040, 208, 68, 52, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
}
......@@ -66,17 +66,17 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Salva con nome ..."
FONT 8, "Helv"
{
LTEXT "File &Nome:", 1090, 6, 6, 76, 9
LTEXT "&Nome file:", 1090, 6, 6, 76, 9
EDITTEXT 1152, 6, 16, 90, 12, ES_AUTOHSCROLL | ES_OEMCONVERT | WS_BORDER | WS_TABSTOP
LISTBOX 1120, 6, 32, 90, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "&Directories:", -1, 110, 6, 92, 9
LTEXT "&Percorso:", -1, 110, 6, 92, 9
LTEXT "", 1088, 110, 18, 92, 9, SS_NOPREFIX | WS_GROUP
LISTBOX 1121, 110, 32, 92, 68, LBS_STANDARD | LBS_OWNERDRAWFIXED | LBS_HASSTRINGS | LBS_DISABLENOSCROLL | WS_TABSTOP
LTEXT "Files di &Tipo:", 1089, 6, 104, 90, 9
COMBOBOX 1136, 6, 114, 90, 36, CBS_DROPDOWNLIST | CBS_AUTOHSCROLL | WS_BORDER | WS_VSCROLL | WS_TABSTOP
LTEXT "&Unita':", 1091, 110, 104, 92, 9
COMBOBOX 1137, 110, 114, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Save As", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
DEFPUSHBUTTON "Salva come", 1, 208, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Cancel", 2, 208, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Help", 1038, 208, 46, 56, 14, WS_GROUP | WS_TABSTOP
CHECKBOX "&Read Only", 1040, 208, 68, 50, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
......@@ -106,29 +106,29 @@ FONT 8, "Helv"
}
PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 264, 134
PRINT_SETUP DIALOG LOADONCALL MOVEABLE DISCARDABLE 36, 24, 274, 154
STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Configurazione Stampante"
FONT 8, "Helv"
{
GROUPBOX "Stampante", 1072, 6, 10, 180, 65, BS_GROUPBOX
RADIOBUTTON "Stampante &Preferita", 1056, 16, 20, 80, 12
GROUPBOX "Stampante", 1072, 6, 10, 180, 72, BS_GROUPBOX
RADIOBUTTON "Stampante &Preferita", 1056, 16, 20, 78, 12
LTEXT "[none]", 1088, 35, 35, 120, 9
RADIOBUTTON "Stampante &Specifica", 1057, 16, 50, 80, 12
RADIOBUTTON "Stampante &Specifica", 1057, 16, 50, 78, 12
COMBOBOX 1136, 35, 65, 149, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
DEFPUSHBUTTON "Ok", 1, 206, 6, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annulla", 2, 206, 24, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Installa", 1024, 206, 46, 56, 14, WS_GROUP | WS_TABSTOP
GROUPBOX "Orientamento", 1073, 6, 85, 100, 50, BS_GROUPBOX
RADIOBUTTON "&Verticale", 1058, 50, 100, 40, 12
RADIOBUTTON "&Orizzontale", 1059, 50, 115, 40, 12
RADIOBUTTON "&Verticale", 1058, 50, 100, 42, 12
RADIOBUTTON "&Orizzontale", 1059, 50, 115, 50, 12
ICON "LANDSCAP", 1097, 10, 95, 32, 32
ICON "PORTRAIT", 1098, 10, 95, 32, 32
GROUPBOX "Carta", 1074, 120, 85, 180, 50, BS_GROUPBOX
LTEXT "&Dimensione", 1089, 130, 95, 30, 9
LTEXT "&Sorgente", 1090, 130, 110, 30, 9
COMBOBOX 1137, 155, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
COMBOBOX 1138, 155, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
GROUPBOX "Carta", 1074, 120, 85, 150, 50, BS_GROUPBOX
LTEXT "&Dimensione", 1089, 130, 100, 30, 9
LTEXT "&Sorgente", 1090, 130, 115, 30, 9
COMBOBOX 1137, 168, 95, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
COMBOBOX 1138, 168, 110, 92, 68, CBS_DROPDOWNLIST | CBS_OWNERDRAWFIXED | CBS_AUTOHSCROLL | CBS_SORT | CBS_HASSTRINGS | WS_BORDER | WS_VSCROLL | WS_TABSTOP
}
......@@ -159,7 +159,7 @@ FONT 8, "Helv"
LTEXT "&Verde:", 1095, 150, 146, 40, 9
LTEXT "Bl&u:", 1096, 150, 166, 40, 9
DEFPUSHBUTTON "Ok", 1, 6, 182, 56, 14, BS_DEFPUSHBUTTON | WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Aggiugni ai Colori Utente", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Aggiungi ai Colori Utente", 1024, 120, 182, 100, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Cancella Colori Utente", 1025, 6, 164, 56, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annulla", 2, 76, 182, 56, 14, WS_GROUP | WS_TABSTOP
}
......@@ -170,14 +170,14 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Trova"
FONT 8, "Helv"
{
LTEXT "Tro&va cosa:", -1, 4, 8, 42, 8
LTEXT "Tro&va:", -1, 4, 8, 42, 8
EDITTEXT 1152, 47, 7, 128, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
CHECKBOX "&Parola Intera", 1040, 4, 26, 100, 12, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
CHECKBOX "&Maiuscole/Minuscole", 1041, 4, 42, 64, 12, BS_AUTOCHECKBOX | WS_TABSTOP
CHECKBOX "&Maiuscole/Minuscole", 1041, 4, 42, 74, 12, BS_AUTOCHECKBOX | WS_TABSTOP
GROUPBOX "Direzione", 1072, 107, 26, 68, 28
CONTROL "&Su", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 20, 12
CONTROL "&Giu'", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 138, 38, 30, 12
DEFPUSHBUTTON "&Trova Prossimo", 1, 182, 5, 50, 14, WS_GROUP | WS_TABSTOP
CONTROL "&Su", 1056, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_GROUP | WS_TABSTOP, 111, 38, 24, 12
CONTROL "&Giu'", 1057, "BUTTON", BS_AUTORADIOBUTTON | WS_CHILD | WS_VISIBLE | WS_TABSTOP, 142, 38, 28, 12
DEFPUSHBUTTON "&Trova Prossimo", 1, 180, 5, 54, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "Annulla", 2, 182, 23, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON "&Aiuto", 1038, 182, 45, 50, 14, WS_GROUP | WS_TABSTOP
}
......@@ -188,7 +188,7 @@ STYLE DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Cambia"
FONT 8, "Helv"
{
LTEXT "Tro&va cosa:", -1, 4, 9, 48, 8
LTEXT "Tro&va:", -1, 4, 9, 48, 8
EDITTEXT 1152, 54, 7, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
LTEXT "Ca&mbia con:", -1, 4, 26, 48, 8
EDITTEXT 1153, 54, 24, 114, 12, ES_AUTOHSCROLL | WS_BORDER | WS_GROUP | WS_TABSTOP
......
......@@ -635,6 +635,9 @@ static void BuildModule16( int max_code_offset, int max_data_offset )
pModule->nrname_handle = 0;
pModule->min_swap_area = 0;
pModule->expected_version = 0x030a;
pModule->pe_module = NULL;
pModule->self = 0;
pModule->self_loading_sel = 0;
/* File information */
......@@ -772,14 +775,12 @@ static void BuildModule32(void)
{
char *buffer;
NE_MODULE *pModule;
NE_WIN32_EXTRAINFO *pExtraInfo;
OFSTRUCT *pFileInfo;
BYTE *pstr;
WORD *pword;
/* Module layout:
* NE_MODULE Module
* NE_WIN32_EXTRAINFO Win32 module extra info
* OFSTRUCT File information
* SEGTABLEENTRY Segment table (empty)
* WORD[2] Resource table (empty)
......@@ -817,15 +818,13 @@ static void BuildModule32(void)
pModule->nrname_handle = 0;
pModule->min_swap_area = 0;
pModule->expected_version = 0x030a;
/* Win32 extra info */
pExtraInfo = (NE_WIN32_EXTRAINFO *)(pModule + 1);
pExtraInfo->pe_module = 0;
pModule->pe_module = NULL;
pModule->self = 0;
pModule->self_loading_sel = 0;
/* File information */
pFileInfo = (OFSTRUCT *)(pExtraInfo + 1);
pFileInfo = (OFSTRUCT *)(pModule + 1);
pModule->fileinfo = (int)pFileInfo - (int)pModule;
memset( pFileInfo, 0, sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName) );
pFileInfo->cBytes = sizeof(*pFileInfo) - sizeof(pFileInfo->szPathName)
......
......@@ -11,7 +11,6 @@ C_SRCS = \
except.c \
file.c \
gdi32.c \
heap.c \
init.c \
memory.c \
newfns.c \
......
/*
* Win32 kernel functions
*
* Copyright 1995 Thomas Sandford <t.d.g.sandford@prds-grn.demon.co.uk>
* Copyright 1995 Martin von Lwis
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/mman.h>
#include "windows.h"
#include "winerror.h"
#include "kernel32.h"
#include "handle32.h"
#include "winbase.h"
#include "stddebug.h"
#include "debug.h"
#define HEAP_ZERO_MEMORY 0x8
/* FIXME: these functions do *not* implement the win32 API properly. They
are here merely as "get you going" aids */
/***********************************************************************
* HeapAlloc (KERNEL32.222)
*
*/
LPVOID SIMPLE_HeapAlloc(HANDLE hHeap, DWORD dwFlags, DWORD dwBytes)
{
void *result;
result = malloc(dwBytes);
if(result && (dwFlags & HEAP_ZERO_MEMORY))
memset(result, 0, dwBytes);
return result;
}
HANDLE32 HeapCreate(DWORD flOptions, DWORD dwInitialSize, DWORD dwMaximumSize)
{
LPVOID start;
HEAP_OBJECT *ret;
HEAPITEM_OBJECT *item;
if(dwInitialSize<4096)
return 0;
start = VirtualAlloc(0,dwMaximumSize, MEM_RESERVE, PAGE_READWRITE);
if(!start)
return 0;
if(!VirtualAlloc(start,dwInitialSize, MEM_COMMIT, PAGE_READWRITE))
{
VirtualFree(start,dwMaximumSize,MEM_RELEASE);
return 0;
}
ret=CreateKernelObject(sizeof(HEAP_OBJECT));
ret->common.magic=KERNEL_OBJECT_HEAP;
ret->start=start;
ret->size=dwInitialSize;
ret->maximum=dwMaximumSize;
ret->flags=flOptions;
item=start;
item->common.magic=KERNEL_OBJECT_HEAPITEM;
item->next=item->prev=0;
item->heap=ret;
ret->first=ret->last=item;
return (HANDLE32)ret;
}
BOOL HeapDestroy(HEAP_OBJECT *h)
{
/* FIXME: last error */
if(h->common.magic!=KERNEL_OBJECT_HEAP)
return 0;
h->common.magic=0;
VirtualFree(h->start,h->size,MEM_RELEASE);
ReleaseKernelObject(h);
return 1;
}
static BOOL HEAP_GrowHeap(HEAP_OBJECT *h,DWORD size)
{
HEAPITEM_OBJECT *last;
/* FIXME: last error */
if(size > h->maximum-h->size)
return 0;
if(!VirtualAlloc(h->start+h->size,size,MEM_COMMIT,PAGE_READWRITE))
return 0;
/* FIXME: consolidate with previous item */
last=h->start+size;
h->size+=size;
h->last->next=last;
last->prev=h->last;
last->next=0;
h->last=last;
last->common.magic=KERNEL_OBJECT_HEAPITEM;
last->heap=h;
return 1;
}
LPVOID HeapAlloc(HEAP_OBJECT *h,DWORD dwFlags,DWORD dwBytes)
{
HEAPITEM_OBJECT *it,*next,*prev;
/* FIXME: last error */
if(!h)
return SIMPLE_HeapAlloc(h,dwFlags,dwBytes);
if(h->common.magic!=KERNEL_OBJECT_HEAP)
return 0;
/* align to DWORD */
dwBytes = (dwBytes + 3) & ~3;
for(it=h->first;it;it=it->next)
{
if(it->size>dwBytes+sizeof(HEAPITEM_OBJECT))
break;
}
if(!it)
{
if(!HEAP_GrowHeap(h,dwBytes))
return 0;
it=h->last;
}
next = it->next;
prev = it->prev;
if(it->size > dwBytes+2*sizeof(HEAPITEM_OBJECT))
{ /* split item */
HEAPITEM_OBJECT *next=(HEAPITEM_OBJECT*)((char*)(it+1)+dwBytes);
next->common.magic=KERNEL_OBJECT_HEAPITEM;
next->size=it->size-sizeof(HEAPITEM_OBJECT)-dwBytes;
next->next = it->next;
}
if(next)
next->prev=prev;
else
h->last=prev;
if(prev)
prev->next=next;
else
h->first=next;
/* Allocated item is denoted by self-referencing */
it->next=it->prev=it;
return (LPVOID)(it+1);
}
BOOL HeapFree(HEAP_OBJECT *h,DWORD dwFlags,LPVOID lpMem)
{
HEAPITEM_OBJECT *item,*prev,*next;
item = (HEAPITEM_OBJECT*)lpMem - 1;
if(item->common.magic != KERNEL_OBJECT_HEAP)
return 0;
for(next=item;(caddr_t)next<(caddr_t)h->start+h->size;
next=(HEAPITEM_OBJECT*)((char*)next+next->size))
if(next!=next->next)
break;
if((caddr_t)next>=(caddr_t)h->start+h->size)
next=0;
if(next)
prev=next->prev;
else
prev=h->last;
/* consolidate with previous */
if(prev && (char*)prev+prev->size==(char*)item)
{
prev->size+=item->size;
item=prev;
prev=item->prev;
}
/* consolidate with next */
if(next && (char*)item+item->size==(char*)next)
{
item->size+=next->size;
next=next->next;
}
if(prev)
{
item->prev=prev;
prev->next=item;
} else
h->first=item;
if(next)
{
item->next=next;
next->prev=item;
}else
h->last=item;
return 1;
}
......@@ -30,7 +30,7 @@ static int CreateStdHandles(void);
/*********************************************************************
* CloseHandle (KERNEL32.23)
*/
BOOL CloseHandle(HANDLE32 handle)
BOOL CloseHandle(KERNEL_OBJECT *handle)
{
int rc;
......
......@@ -93,7 +93,7 @@ PIMAGE_RESOURCE_DIRECTORY GetResDirEntry(PIMAGE_RESOURCE_DIRECTORY resdirptr,
HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
{
#ifndef WINELIB
struct pe_data *pe;
PE_MODULE *pe;
NE_MODULE *pModule;
PIMAGE_RESOURCE_DIRECTORY resdirptr;
DWORD root;
......@@ -105,9 +105,9 @@ HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
dprintf_resource( stddeb, " name=" );
PrintId( name );
dprintf_resource( stddeb, "\n" );
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = NE_WIN32_MODULE(pModule)) || !pe->pe_resource) return 0;
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
resdirptr = (PIMAGE_RESOURCE_DIRECTORY) pe->pe_resource;
root = (DWORD) resdirptr;
......@@ -119,6 +119,8 @@ HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
/* Try LANG_NEUTRAL, too */
if(!result)
return GetResDirEntry(resdirptr, (LPCWSTR)0, root);
return result;
#else
return LIBRES_FindResource( hModule, name, type );
#endif
......@@ -131,17 +133,17 @@ HANDLE32 FindResource32( HINSTANCE hModule, LPCWSTR name, LPCWSTR type )
HANDLE32 LoadResource32( HINSTANCE hModule, HANDLE32 hRsrc )
{
#ifndef WINELIB
struct pe_data *pe;
NE_MODULE *pModule;
PE_MODULE *pe;
hModule = GetExePtr( hModule ); /* In case we were passed an hInstance */
dprintf_resource(stddeb, "LoadResource: module=%04x res=%04x\n",
hModule, hRsrc );
if (!hRsrc) return 0;
if (!(pModule = (NE_MODULE *)GlobalLock( hModule ))) return 0;
if (!(pModule = MODULE_GetPtr( hModule ))) return 0;
if (!(pModule->flags & NE_FFLAGS_WIN32)) return 0; /* FIXME? */
if (!(pe = NE_WIN32_MODULE(pModule)) || !pe->pe_resource) return 0;
if (!(pe = pModule->pe_module) || !pe->pe_resource) return 0;
return (HANDLE32) (pe->load_addr+((PIMAGE_RESOURCE_DATA_ENTRY)hRsrc)->OffsetToData);
#else
return LIBRES_LoadResource( hModule, hRsrc );
......
......@@ -48,12 +48,18 @@ void WINAPI InitializeCriticalSection(CRITICAL_SECTION *lpCrit)
void WINAPI EnterCriticalSection(CRITICAL_SECTION* lpCrit)
{
return;
if (lpCrit->LockCount)
fprintf( stderr, "Error: re-entering critical section %08lx\n",
(DWORD)lpCrit );
lpCrit->LockCount++;
}
void WINAPI LeaveCriticalSection(CRITICAL_SECTION* lpCrit)
{
return;
if (!lpCrit->LockCount)
fprintf( stderr, "Error: leaving critical section %08lx again\n",
(DWORD)lpCrit );
lpCrit->LockCount--;
}
void WINAPI DeleteCriticalSection(CRITICAL_SECTION* lpCrit)
......
......@@ -84,6 +84,6 @@ DWORD GetTimeZoneInformation(LPTIME_ZONE_INFORMATION tzinfo)
VOID Sleep(DWORD cMilliseconds)
{
if(cMilliseconds == INFINITE)
while(1) { /* Spin forever */ }
while(1) sleep(1000); /* Spin forever */
usleep(cMilliseconds*1000);
}
......@@ -69,14 +69,20 @@ HWND DIALOG_GetFirstTabItem( HWND hwndDlg )
* DIALOG_GetControl
*
* Return the class and text of the control pointed to by ptr,
* and return a pointer to the next control.
* fill the header structure and return a pointer to the next control.
*/
static SEGPTR DIALOG_GetControl( SEGPTR ptr, SEGPTR *class, SEGPTR *text )
static SEGPTR DIALOG_GetControl( SEGPTR ptr, DLGCONTROLHEADER *header,
SEGPTR *class, SEGPTR *text )
{
unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN( ptr );
unsigned char *p = base;
p += 14; /* size of control header */
header->x = GET_WORD(p); p += sizeof(WORD);
header->y = GET_WORD(p); p += sizeof(WORD);
header->cx = GET_WORD(p); p += sizeof(WORD);
header->cy = GET_WORD(p); p += sizeof(WORD);
header->id = GET_WORD(p); p += sizeof(WORD);
header->style = GET_DWORD(p); p += sizeof(DWORD);
if (*p & 0x80)
{
......@@ -92,7 +98,7 @@ static SEGPTR DIALOG_GetControl( SEGPTR ptr, SEGPTR *class, SEGPTR *text )
if (*p == 0xff)
{
/* Integer id, not documented (?). Only works for SS_ICON controls */
*text = MAKEINTRESOURCE( p[1] + 256 * p[2] );
*text = MAKEINTRESOURCE( GET_WORD(p+1) );
p += 4;
}
else
......@@ -115,14 +121,18 @@ static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result )
unsigned char *base = (unsigned char *)PTR_SEG_TO_LIN(template);
unsigned char * p = base;
result->header = *(DLGTEMPLATEHEADER *)p;
p += 13;
result->style = GET_DWORD(p); p += sizeof(DWORD);
result->nbItems = *p++;
result->x = GET_WORD(p); p += sizeof(WORD);
result->y = GET_WORD(p); p += sizeof(WORD);
result->cx = GET_WORD(p); p += sizeof(WORD);
result->cy = GET_WORD(p); p += sizeof(WORD);
/* Get the menu name */
if (*p == 0xff)
{
result->menuName = MAKEINTRESOURCE( p[1] + 256 * p[2] );
result->menuName = MAKEINTRESOURCE( GET_WORD(p+1) );
p += 3;
}
else if (*p)
......@@ -149,9 +159,9 @@ static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result )
/* Get the font name */
if (result->header.style & DS_SETFONT)
if (result->style & DS_SETFONT)
{
result->pointSize = *(WORD *)p;
result->pointSize = GET_WORD(p);
p += sizeof(WORD);
result->faceName = template + (WORD)(p - base);
p += strlen(p) + 1;
......@@ -166,9 +176,9 @@ static SEGPTR DIALOG_ParseTemplate( SEGPTR template, DLGTEMPLATE * result )
*/
static void DIALOG_DisplayTemplate( DLGTEMPLATE * result )
{
dprintf_dialog(stddeb, "DIALOG %d, %d, %d, %d\n", result->header.x, result->header.y,
result->header.cx, result->header.cy );
dprintf_dialog(stddeb, " STYLE %08lx\n", result->header.style );
dprintf_dialog(stddeb, "DIALOG %d, %d, %d, %d\n", result->x, result->y,
result->cx, result->cy );
dprintf_dialog(stddeb, " STYLE %08lx\n", result->style );
dprintf_dialog( stddeb, " CAPTION '%s'\n",
(char *)PTR_SEG_TO_LIN(result->caption) );
......@@ -184,7 +194,7 @@ static void DIALOG_DisplayTemplate( DLGTEMPLATE * result )
else if (LOWORD(result->menuName))
dprintf_dialog(stddeb, " MENU %04x\n", LOWORD(result->menuName) );
if (result->header.style & DS_SETFONT)
if (result->style & DS_SETFONT)
dprintf_dialog( stddeb, " FONT %d,'%s'\n", result->pointSize,
(char *)PTR_SEG_TO_LIN(result->faceName) );
}
......@@ -264,7 +274,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
/* Create custom font if needed */
if (template.header.style & DS_SETFONT)
if (template.style & DS_SETFONT)
{
/* The font height must be negative as it is a point size */
/* (see CreateFont() documentation in the Windows SDK). */
......@@ -293,26 +303,26 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
/* Create dialog main window */
rect.left = rect.top = 0;
rect.right = template.header.cx * xUnit / 4;
rect.bottom = template.header.cy * yUnit / 8;
if (template.header.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx( &rect, template.header.style,
rect.right = template.cx * xUnit / 4;
rect.bottom = template.cy * yUnit / 8;
if (template.style & DS_MODALFRAME) exStyle |= WS_EX_DLGMODALFRAME;
AdjustWindowRectEx( &rect, template.style,
hMenu ? TRUE : FALSE , exStyle );
rect.right -= rect.left;
rect.bottom -= rect.top;
if ((INT)template.header.x == CW_USEDEFAULT)
if ((INT)template.x == CW_USEDEFAULT)
rect.left = rect.top = CW_USEDEFAULT;
else
{
rect.left += template.header.x * xUnit / 4;
rect.top += template.header.y * yUnit / 8;
if (!(template.header.style & DS_ABSALIGN))
rect.left += template.x * xUnit / 4;
rect.top += template.y * yUnit / 8;
if (!(template.style & DS_ABSALIGN))
ClientToScreen( owner, (POINT *)&rect );
}
hwnd = CreateWindowEx( exStyle, template.className, template.caption,
template.header.style & ~WS_VISIBLE,
template.style & ~WS_VISIBLE,
rect.left, rect.top, rect.right, rect.bottom,
owner, hMenu, hInst, (SEGPTR)0 );
if (!hwnd)
......@@ -348,15 +358,15 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
dlgInfo->msgResult = 0; /* This is used to store the default button id */
dlgInfo->hDialogHeap = 0;
for (i = 0; i < template.header.nbItems; i++)
for (i = 0; i < template.nbItems; i++)
{
DLGCONTROLHEADER *header;
DLGCONTROLHEADER header;
SEGPTR className, winName;
HWND hwndDefButton = 0;
char buffer[10];
header = (DLGCONTROLHEADER *)PTR_SEG_TO_LIN( headerPtr );
headerPtr = DIALOG_GetControl( headerPtr, &className, &winName );
headerPtr = DIALOG_GetControl( headerPtr, &header,
&className, &winName );
if (!HIWORD(className))
{
......@@ -381,12 +391,12 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
else dprintf_dialog(stddeb,"%04x", LOWORD(winName) );
dprintf_dialog(stddeb," %d, %d, %d, %d, %d, %08lx\n",
header->id, header->x, header->y,
header->cx, header->cy, header->style );
header.id, header.x, header.y,
header.cx, header.cy, header.style );
if (HIWORD(className) &&
!strcmp( (char *)PTR_SEG_TO_LIN(className), "EDIT") &&
((header->style & DS_LOCALEDIT) != DS_LOCALEDIT))
((header.style & DS_LOCALEDIT) != DS_LOCALEDIT))
{
if (!dlgInfo->hDialogHeap)
{
......@@ -399,23 +409,23 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
LocalInit(dlgInfo->hDialogHeap, 0, 0xffff);
}
hwndCtrl = CreateWindowEx(WS_EX_NOPARENTNOTIFY, className, winName,
header->style | WS_CHILD,
header->x * xUnit / 4,
header->y * yUnit / 8,
header->cx * xUnit / 4,
header->cy * yUnit / 8,
hwnd, (HMENU)header->id,
header.style | WS_CHILD,
header.x * xUnit / 4,
header.y * yUnit / 8,
header.cx * xUnit / 4,
header.cy * yUnit / 8,
hwnd, (HMENU)header.id,
dlgInfo->hDialogHeap, (SEGPTR)0 );
}
else
{
hwndCtrl = CreateWindowEx(WS_EX_NOPARENTNOTIFY, className, winName,
header->style | WS_CHILD,
header->x * xUnit / 4,
header->y * yUnit / 8,
header->cx * xUnit / 4,
header->cy * yUnit / 8,
hwnd, (HMENU)header->id,
header.style | WS_CHILD,
header.x * xUnit / 4,
header.y * yUnit / 8,
header.cx * xUnit / 4,
header.cy * yUnit / 8,
hwnd, (HMENU)header.id,
hInst, (SEGPTR)0 );
}
......@@ -454,7 +464,7 @@ HWND CreateDialogIndirectParam( HINSTANCE hInst, SEGPTR dlgTemplate,
SendMessage( hwnd, WM_SETFONT, (WPARAM)dlgInfo->hUserFont, 0 );
if (SendMessage( hwnd, WM_INITDIALOG, (WPARAM)dlgInfo->hwndFocus, param ))
SetFocus( dlgInfo->hwndFocus );
if (template.header.style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
if (template.style & WS_VISIBLE) ShowWindow(hwnd, SW_SHOW);
return hwnd;
}
......
......@@ -6,7 +6,6 @@
*/
#include <ctype.h>
#include <signal.h>
#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
......@@ -20,6 +19,7 @@
#include "win.h"
#include "class.h"
#include "clipboard.h"
#include "debugger.h"
#include "options.h"
#include "queue.h"
#include "winpos.h"
......@@ -317,7 +317,7 @@ static void EVENT_key( XKeyEvent *event )
/* Ctrl-Alt-Return enters the debugger */
if ((keysym == XK_Return) && (event->type == KeyPress) &&
(event->state & ControlMask) && (event->state & Mod1Mask))
kill( getpid(), SIGHUP );
DEBUG_EnterDebugger();
xkey = LOWORD(keysym);
key_type = HIBYTE(xkey);
......@@ -451,8 +451,8 @@ static void EVENT_ButtonPress( XButtonEvent *event )
int buttonNum = event->button - 1;
if (buttonNum >= NB_BUTTONS) return;
MouseButtonsStates[buttonNum] = TRUE;
AsyncMouseButtonsStates[buttonNum] = TRUE;
MouseButtonsStates[buttonNum] = 0x8000;
AsyncMouseButtonsStates[buttonNum] = 0x8000;
hardware_event( messages[buttonNum],
EVENT_XStateToKeyState( event->state ), 0L,
event->x_root - desktopX, event->y_root - desktopY,
......
......@@ -40,9 +40,9 @@ INT GetKeyState(INT keycode)
void GetKeyboardState(BYTE FAR *lpKeyState)
{
if (lpKeyState != NULL) {
KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0];
KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1];
KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2];
KeyStateTable[VK_LBUTTON] = MouseButtonsStates[0] >> 8;
KeyStateTable[VK_MBUTTON] = MouseButtonsStates[1] >> 8;
KeyStateTable[VK_RBUTTON] = MouseButtonsStates[2] >> 8;
memcpy(lpKeyState, KeyStateTable, 256);
}
}
......@@ -54,9 +54,9 @@ void SetKeyboardState(BYTE FAR *lpKeyState)
{
if (lpKeyState != NULL) {
memcpy(KeyStateTable, lpKeyState, 256);
MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON];
MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON];
MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON];
MouseButtonsStates[0] = KeyStateTable[VK_LBUTTON]? 0x8000: 0;
MouseButtonsStates[1] = KeyStateTable[VK_MBUTTON]? 0x8000: 0;
MouseButtonsStates[2] = KeyStateTable[VK_RBUTTON]? 0x8000: 0;
}
}
......@@ -80,15 +80,15 @@ int GetAsyncKeyState(int nKey)
switch (nKey) {
case VK_LBUTTON:
retval = AsyncMouseButtonsStates[0] |
(MouseButtonsStates[0] << 8);
MouseButtonsStates[0]? 0x0001: 0;
break;
case VK_MBUTTON:
retval = AsyncMouseButtonsStates[1] |
(MouseButtonsStates[1] << 8);
MouseButtonsStates[1]? 0x0001: 0;
break;
case VK_RBUTTON:
retval = AsyncMouseButtonsStates[2] |
(MouseButtonsStates[2] << 8);
MouseButtonsStates[2]? 0x0001: 0;
break;
default:
retval = AsyncKeyStateTable[nKey] |
......
......@@ -81,34 +81,30 @@ static BOOL MSG_TranslateMouseMsg( MSG *msg, BOOL remove )
hittest = WINPOS_WindowFromPoint( msg->pt, &pWnd );
msg->hwnd = pWnd->hwndSelf;
if (hittest != HTERROR)
if ((hittest != HTERROR) && mouseClick)
{
HWND hwndTop = WIN_GetTopParent( msg->hwnd );
/* Send the WM_PARENTNOTIFY message */
if (mouseClick) WIN_SendParentNotify( msg->hwnd, msg->message, 0,
WIN_SendParentNotify( msg->hwnd, msg->message, 0,
MAKELONG( msg->pt.x, msg->pt.y ) );
/* Activate the window if needed */
if (mouseClick)
{
HWND hwndTop = WIN_GetTopParent( msg->hwnd );
if (hwndTop != GetActiveWindow())
if (msg->hwnd != GetActiveWindow() && msg->hwnd != GetDesktopWindow())
{
LONG ret = SendMessage( msg->hwnd, WM_MOUSEACTIVATE,
(WPARAM)hwndTop,
LONG ret = SendMessage( msg->hwnd, WM_MOUSEACTIVATE, hwndTop,
MAKELONG( hittest, msg->message ) );
if ((ret == MA_ACTIVATEANDEAT) || (ret == MA_NOACTIVATEANDEAT))
eatMsg = TRUE;
if ((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT))
{
SetWindowPos( hwndTop, HWND_TOP, 0, 0, 0, 0,
SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE );
if (((ret == MA_ACTIVATE) || (ret == MA_ACTIVATEANDEAT))
&& hwndTop != GetActiveWindow() )
WINPOS_ChangeActiveWindow( hwndTop, TRUE );
}
}
}
}
/* Send the WM_SETCURSOR message */
......
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