Alexandre Julliard e2991ea7bd Release 950727
Sat Jul 22 22:39:09 IDT 1995 Michael Veksler <e1678223@tochnapc2.technion.ac.il>

	* [ipc/*]
	New directory. This directory contains the new inter-wine
 	communications support. It enables DDE protocols between two wine
 	instances.  Currently it is limited to DDE, but can be enhanced to
 	support OLE between 2 different wine instances.  This is very
 	important for libwine.a DDE/OLE support.

	* [tools/ipcl]
    	A script to delete garbage IPC handles (shared memory, semaphores
 	and message queues).  The current inter-wine communication is not
 	perfect, and sometimes leaves garbage behind.

	* [if1632/relay.c] [include/atom.h] [include/global.h]
 	[loader/selector.c] [loader/task.c] [loader/module.c]
 	[loader/signal.c] [memory/global.c] [misc/atom.c]
 	[windows/class.c] [windows/message.c] [windows/win.c]
	[Imakefile]
    	Hooks for inter-wine DDE support, current Global.*Atom functions
 	renamed to Local.*Atom since Global.*Atom are used for Inter-Wine
 	DDE communication. (The first call to these functions sets up the
 	IPC structures - which otherwise cause unneeded overhead.

Mon Jul 17 19:55:21 1995  Alexandre Julliard  <julliard@sunsite.unc.edu>

	* [controls/menu.c]
	Don't crash if a NULL string is passed to menu functions.

	* [memory/selector.c]
	We now use a bit in ldt_flags_copy to indicate free LDT entries.
	Fixed a bug in SELECTOR_ReallocBlock that could cause it to
	overwrite valid LDT entries when growing a block.

	* [miscemu/instr.c]
	Emulate int xx instruction by storing the interrupt vector in
	CS:IP and returning directly. This allows a program to install an
	interrupt vector.

	* [windows/win.c]
	Added function WIN_GetTopParent to get the top-level parent of a
	window.

Sun Jul  16 18:17:17 1995  Gregory Trubetskoy <grisha@mira.com>

        * [loader/resource.c]
        Added LoadIconHandler. It doesn't do anything yet, but now you
        can use borland help files with winhelp.exe.

Sun Jul 16 11:58:45 1995 Anand Kumria <akumria@ozemail.com.au>

	* [misc/main.c]
	Fixed to return 386 Enhanced mode correctly. Also return the same
 	type of CPU, for both Enhanced and Standard mode, namely a 386.

Sun Jul 16 00:02:04 1995    Martin von Loewis <loewis@informatik.hu-berlin.de>

	* [Configure] [include/options.h] [include/wineopts.h]
	  [misc/main.c][misc/spy.c]
	  Removed support of spy file. Redirected spy messages to stddeb.
	  Removed -spy option. Added -debugmsg +spy option.

	* [debugger/dbg.y][debugger/debug.l]
	Enabled segmented addresses (seg:offs) for break and x commands.

	* [if1632/gdi.spec] [objects/region.c] [windows/graphics.c]
	  [include/region.h]
	FrameRgn, REGION_FrameRgn: New functions

	* [if1632/kernel.spec]
	IsWinOldApTask: Return false

	* [if1632/mouse.spec]
	CplApplet: Removed

	* [if1632/user.spec] [windows/win.c]
	ShowOwnedPopups: New function

	* [if1632/winsock.spec] [misc/winsocket.c]
	inet_addr, select: New prototypes in relay code
	Fixed memory layout for netdb functions (getXbyY).
	WINSOCK_ioctlsocket: Translated FIONREAD, FIONBIO, and FIOASYNC

	* [objects/clipping.c]
	RectVisible: Fixed call to LPToDP

	* [rc/winerc.c]
	main: Removed extra argument to getopt for Linux.

Tue Jul 11 00:14:41 1995   Bernd Schmidt <crux@pool.informatik.rwth-aachen.de>

        * [controls/listbox.c]
	Yet another fix for ListBoxDirectory().
	
	* [loader/module.c] [if1632/kernel.spec]
	Make GetModuleHandle() accept instance handles as parameter.

        * [if1632/relay.c] [loader/task.c]
	Put a magic cookie at the bottom of the 32 bit stack, and check on
	each return from a 32 bit function whether it's still there. Complain
	if it's not.

        * [if1632/user.spec]
	Wrong entry for CloseDriver().

	* [misc/dos_fs.c] [loader/task.c] [include/dos_fs.h] [misc/file.c]
	[miscemu/int21.c]
	Large parts of dos_fs.c simplified. Changed it to use one
	current drive/directory per task, which is set to the module path on
	task creation.
	Prevent CorelPaint from closing stdin.
	open() with O_CREAT set must be passed three parameters.
	DOS FindFirst()/FindNext() could crash when FA_LABEL was set. Fixed,
	it's in DOS_readdir() now.

	* [misc/profile.c]
	Some badly written software (Lotus Freelance Graphics) passes a bogus
	size parameter that caused Wine to write off the end of a segment.
	Fixed. (It's probably too paranoid now.)
	
	* [multimedia/mmsystem.c] [multimedia/time.c] [multimedia/joystick.c]
	[multimedia/Imakefile] [if1632/winprocs.spec]
	16 bit entry point for MMSysTimeCallback.
	Split off time.c and joystick.c from mmsystem.c.
	
	* [objects/dib.c]
	GetDIBits(): call XGetImage() via CallTo32_LargeStack.

        * [windows/cursor.c]
	DestroyCursor(): do nothing for builtin cursors.
	
	* [windows/mdi.c]
	Half of WM_MDISETMENU implemented.
	
	* [windows/win.c]
	EnumWindows() and EnumTaskWindows() never enumerated any windows.
	Fixed.

	* [windows/*.c]
	Fixed GetParent() to return correct values for owned windows.

	* [windows/message.c]
	Don't try to activate disabled top-level windows.

        * [windows/nonclient.c]
	Work around a bug in gcc-2.7.0.
	
	* [tools/build.c] [include/stackframe.h] [memory/global.c] 
	[loader/task.c] [memory/selector.c]
	Some Visual Basic programs (and possibly others, too) expect ES to be 
	preserved by a call to an API function, so we have to save it.
	In GlobalFree() and FreeSelector(), we must clear CURRENT_STACK16->es 
	to prevent segfaults if ES contained the selector to be freed.

Sun Jul  9 20:21:20 1995  Jon Tombs  <jon@gtex02.us.es>

	* [*/*]
	Added missing prototypes to header files and relevant includes
	to reduce compile time warnings.

Sun Jul  9 18:32:56 1995  Michael Patra  <micky@marie.physik.tu-berlin.de>

	* [configure.in] [include/config.h] [*/Makefile.in]
	New configuration scheme based on autoconf.

Sat Jul  8 14:12:45 1995  Morten Welinder  <terra+@cs.cmu.edu>

	* [miscemu/ioports.c]
	Revamp to have only one in- and one out- variant, both really
 	implemented.

	* [miscemu/instr.c]
	INSTR_EmulateInstruction: Use new ioport interface.  Implement
 	string io.  Correct instruction pointer for 32-bit code.

	* [include/miscemu.h]
	Update port function prototypes.

	* [include/registers.h]
	Defined FS and GS.

Sat Jul  8 13:38:54 1995  Hans de Graaff  <graaff@twi72.twi.tudelft.nl>

	* [misc/dos_fs.c]
	ChopOffSlash(): A path consisting off a single slash is left
 	intact, and multiple slashes are all removed.
1995-07-29 13:09:43 +00:00

336 lines
9.6 KiB
C

/*
* Window classes functions
*
* Copyright 1993 Alexandre Julliard
*/
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "class.h"
#include "user.h"
#include "win.h"
#include "dce.h"
#include "atom.h"
#include "toolhelp.h"
#include "stddebug.h"
/* #define DEBUG_CLASS */
#include "debug.h"
static HCLASS firstClass = 0;
/***********************************************************************
* CLASS_FindClassByName
*
* Return a handle and a pointer to the class.
* 'ptr' can be NULL if the pointer is not needed.
*/
HCLASS CLASS_FindClassByName( char * name, WORD hinstance, CLASS **ptr )
{
ATOM atom;
HCLASS class;
CLASS * classPtr;
if (!(atom = LocalFindAtom( name ))) return 0;
/* First search task-specific classes */
for (class = firstClass; (class); class = classPtr->hNext)
{
classPtr = (CLASS *) USER_HEAP_LIN_ADDR(class);
if (classPtr->wc.style & CS_GLOBALCLASS) continue;
if ((classPtr->atomName == atom) &&
((hinstance==0xffff )|| (hinstance == classPtr->wc.hInstance)))
{
if (ptr) *ptr = classPtr;
return class;
}
}
/* Then search global classes */
for (class = firstClass; (class); class = classPtr->hNext)
{
classPtr = (CLASS *) USER_HEAP_LIN_ADDR(class);
if (!(classPtr->wc.style & CS_GLOBALCLASS)) continue;
if (classPtr->atomName == atom)
{
if (ptr) *ptr = classPtr;
return class;
}
}
return 0;
}
/***********************************************************************
* CLASS_FindClassPtr
*
* Return a pointer to the CLASS structure corresponding to a HCLASS.
*/
CLASS * CLASS_FindClassPtr( HCLASS hclass )
{
CLASS * ptr;
if (!hclass) return NULL;
ptr = (CLASS *) USER_HEAP_LIN_ADDR( hclass );
if (ptr->wMagic != CLASS_MAGIC) return NULL;
return ptr;
}
/***********************************************************************
* RegisterClass (USER.57)
*/
ATOM RegisterClass( LPWNDCLASS class )
{
CLASS * newClass, * prevClassPtr;
HCLASS handle, prevClass;
int classExtra;
char *name = PTR_SEG_TO_LIN( class->lpszClassName );
dprintf_class(stddeb, "RegisterClass: wndproc=%08lx hinst=%04x name='%s' background %04x\n",
(DWORD)class->lpfnWndProc, class->hInstance, name, class->hbrBackground );
dprintf_class(stddeb, " style %04x\n",class->style);
/* Window classes are owned by modules, not instances */
class->hInstance = GetExePtr( class->hInstance );
/* Check if a class with this name already exists */
prevClass = CLASS_FindClassByName( name, class->hInstance, &prevClassPtr );
if (prevClass)
{
/* Class can be created only if it is local and */
/* if the class with the same name is global. */
if (class->style & CS_GLOBALCLASS) return 0;
if (!(prevClassPtr->wc.style & CS_GLOBALCLASS)) return 0;
}
/* Create class */
classExtra = (class->cbClsExtra < 0) ? 0 : class->cbClsExtra;
handle = USER_HEAP_ALLOC( sizeof(CLASS) + classExtra );
if (!handle) return 0;
newClass = (CLASS *) USER_HEAP_LIN_ADDR( handle );
newClass->hNext = firstClass;
newClass->wMagic = CLASS_MAGIC;
newClass->cWindows = 0;
newClass->wc = *class;
newClass->wc.cbWndExtra = (class->cbWndExtra < 0) ? 0 : class->cbWndExtra;
newClass->wc.cbClsExtra = classExtra;
newClass->atomName = LocalAddAtom( name );
newClass->wc.lpszClassName = NULL;
if (newClass->wc.style & CS_CLASSDC)
newClass->hdce = DCE_AllocDCE( DCE_CLASS_DC );
else newClass->hdce = 0;
/* Make a copy of the menu name (only if it is a string) */
if ((int)class->lpszMenuName & 0xffff0000)
{
char *menuname = PTR_SEG_TO_LIN( class->lpszMenuName );
HANDLE hname = USER_HEAP_ALLOC( strlen(menuname)+1 );
if (hname)
{
newClass->wc.lpszMenuName = (char *)USER_HEAP_SEG_ADDR( hname );
strcpy( USER_HEAP_LIN_ADDR( hname ), menuname );
}
}
if (classExtra) memset( newClass->wExtra, 0, classExtra );
firstClass = handle;
return newClass->atomName;
}
/***********************************************************************
* UnregisterClass (USER.403)
*/
BOOL UnregisterClass( LPSTR className, HANDLE hinstance )
{
HANDLE class, prevClass;
CLASS * classPtr, * prevClassPtr;
hinstance = GetExePtr( hinstance );
/* Check if we can remove this class */
class = CLASS_FindClassByName( className, hinstance, &classPtr );
if (!class) return FALSE;
if ((classPtr->wc.hInstance != hinstance) || (classPtr->cWindows > 0))
return FALSE;
/* Remove the class from the linked list */
if (firstClass == class) firstClass = classPtr->hNext;
else
{
for (prevClass = firstClass; prevClass; prevClass=prevClassPtr->hNext)
{
prevClassPtr = (CLASS *) USER_HEAP_LIN_ADDR(prevClass);
if (prevClassPtr->hNext == class) break;
}
if (!prevClass)
{
fprintf(stderr, "ERROR: Class list corrupted\n" );
return FALSE;
}
prevClassPtr->hNext = classPtr->hNext;
}
/* Delete the class */
if (classPtr->hdce) DCE_FreeDCE( classPtr->hdce );
if (classPtr->wc.hbrBackground) DeleteObject( classPtr->wc.hbrBackground );
/*if (classPtr->wc.style & CS_GLOBALCLASS)*/ LocalDeleteAtom( classPtr->atomName );
/*else DeleteAtom( classPtr->atomName );*/
if ((int)classPtr->wc.lpszMenuName & 0xffff0000)
USER_HEAP_FREE( (int)classPtr->wc.lpszMenuName & 0xffff );
USER_HEAP_FREE( class );
return TRUE;
}
/***********************************************************************
* GetClassWord (USER.129)
*/
WORD GetClassWord( HWND hwnd, short offset )
{
return (WORD)GetClassLong( hwnd, offset );
}
/***********************************************************************
* SetClassWord (USER.130)
*/
WORD SetClassWord( HWND hwnd, short offset, WORD newval )
{
CLASS * classPtr;
WND * wndPtr;
WORD *ptr, retval = 0;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 0;
ptr = (WORD *)(((char *)classPtr->wExtra) + offset);
retval = *ptr;
*ptr = newval;
return retval;
}
/***********************************************************************
* GetClassLong (USER.131)
*/
LONG GetClassLong( HWND hwnd, short offset )
{
CLASS * classPtr;
WND * wndPtr;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 0;
return *(LONG *)(((char *)classPtr->wExtra) + offset);
}
/***********************************************************************
* SetClassLong (USER.132)
*/
LONG SetClassLong( HWND hwnd, short offset, LONG newval )
{
CLASS * classPtr;
WND * wndPtr;
LONG *ptr, retval = 0;
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
if (!(classPtr = CLASS_FindClassPtr( wndPtr->hClass ))) return 0;
ptr = (LONG *)(((char *)classPtr->wExtra) + offset);
retval = *ptr;
*ptr = newval;
return retval;
}
/***********************************************************************
* GetClassName (USER.58)
*/
int GetClassName(HWND hwnd, LPSTR lpClassName, short maxCount)
{
WND *wndPtr;
CLASS *classPtr;
/* FIXME: We have the find the correct hInstance */
dprintf_class(stddeb,"GetClassName(%x,%p,%d)\n",hwnd,lpClassName,maxCount);
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
if (!(classPtr = CLASS_FindClassPtr(wndPtr->hClass))) return 0;
return LocalGetAtomName(classPtr->atomName, lpClassName, maxCount);
}
/***********************************************************************
* GetClassInfo (USER.404)
*/
BOOL GetClassInfo(HANDLE hInstance, SEGPTR ClassName,
LPWNDCLASS lpWndClass)
{
CLASS *classPtr;
LPSTR lpClassName = 0;
char temp[10];
if (HIWORD(ClassName)) {
lpClassName = PTR_SEG_TO_LIN(ClassName);
} else {
sprintf(temp,"#%d",(int)LOWORD(ClassName));
lpClassName = temp;
}
dprintf_class(stddeb, "GetClassInfo hInstance=%04x lpClassName=%s\n",
hInstance, lpClassName);
hInstance = GetExePtr(hInstance);
/* if (!(CLASS_FindClassByName(lpClassName, &classPtr))) return FALSE; */
if (!(CLASS_FindClassByName(lpClassName, hInstance, &classPtr)))
{
/* if (!HIWORD(lpClassName))
{
char temp[10];
sprintf(temp, "#%d", (int)lpClassName);
if (!(CLASS_FindClassByName(temp, hInstance, &classPtr))) return FALSE;
}
else */return FALSE;
}
if (hInstance && (hInstance != classPtr->wc.hInstance)) return FALSE;
memcpy(lpWndClass, &(classPtr->wc), sizeof(WNDCLASS));
return TRUE;
}
/***********************************************************************
* ClassFirst (TOOLHELP.69)
*/
BOOL ClassFirst( CLASSENTRY *pClassEntry )
{
pClassEntry->wNext = firstClass;
return ClassNext( pClassEntry );
}
/***********************************************************************
* ClassNext (TOOLHELP.70)
*/
BOOL ClassNext( CLASSENTRY *pClassEntry )
{
CLASS *classPtr = (CLASS *) USER_HEAP_LIN_ADDR( pClassEntry->wNext );
if (!classPtr) return FALSE;
pClassEntry->hInst = classPtr->wc.hInstance;
pClassEntry->wNext = classPtr->hNext;
LocalGetAtomName( classPtr->atomName, pClassEntry->szClassName,
sizeof(pClassEntry->szClassName) );
return TRUE;
}