mirror of
https://github.com/reactos/wine.git
synced 2024-11-29 22:50:43 +00:00
2787be8766
Sun May 21 12:30:30 1995 Alexandre Julliard (julliard@sunsite.unc.edu) * [debugger/hash.c] [debugger/info.c] Added support for symbolic segmented addresses. Add symbols for all built-in API entry points. * [if1632/relay.c] [include/dlls.h] Removed dll_table structure, as we now use the built-in module structures. * [if1632/relay.c] [loader/main.c] Removed winestat option, as it was no longer very meaningful. * [include/stackframe.h] New macro MAKE_SEGPTR that creates a segmented pointer to a local variable on the 32-bit stack. * [loader/module.c] Added support for multiple instances of an application. Implemented LoadModule() and FreeModule(). * [loader/ne_image.c] [loader/task.c] Moved initialisation of built-in DLLs to InitTask(). * [memory/global.c] Implemented discardable blocks. * [misc/file.c] Search path of current executable in OpenFile(). Fixed bug with searching in Windows path. * [misc/lstr.c] Hard-coded translation tables for Ansi<->Oem. * [misc/user.c] Moved some global initializations to InitApp(), because they need a task context to be performed. * [objects/dc.c] Handle R2_BLACK and R2_WHITE specially so that they work correctly with palette displays. * [tools/build.c] Suppressed generation of the C file for DLL specs, because it's no longer needed. Output all the assembly code directly to stdout. Some changes to integrate Win32 support from Martin von Loewis. * [windows/msgbox.c] Moved message box code from misc/ to windows/. Mon May 15 23:40:04 1995 Martin Ayotte (wine@trgcorp.mksinfo.qc.ca) * [misc/audio.c] [misc/mcicda.c] [misc/mcianim.c] [misc/midi.c] [misc/mmaux.c] [misc/mmsystem.c] Modify code & use pointers conversion macros. Make cdaudio & wave devices work again (only using some applets). * [misc/profile.c] Change getc() to fgetc() where needed. Mon May 15 22:10:56 1995 Martin von Loewis <loewis@informatik.hu-berlin.de> * [if1632/Imakefile] added entries for the new files gdi32.spec, kernel32.spec, user32.spec, shell32.spec and winprocs32.spec. * [if1632/commdlg.spec][if1632/kernel.spec][if1632/shell.spec] [if1632/storage.spec][if1632/system.spec][if1632/user.spec] ChooseFont, RESERVED5, InternalExtractIcon: Marked as stubs ExtractAssociatedIcon, DoEnvironmentSubst, DumpIcon: stub implementations provided marked storage.dll,storege.sys functions as stubs * [include/pe_image.h] Added structures WIN32_builtin and WIN32_function * [include/peexe.h] PE_Import_Directory: renamed reserved fields to TimeDate, Forwarder, Thunk_List * [include/winerror.h] New file. * [loader/main.c] called RELAY32_Init * [loader/pe_image.c] xmmap: map BSS anonymous dump_imports: renamed to fixup_imports, do the fixup of imported symbols PE_LoadImage: pass raw data size to xmmap * [loader/resource.c] DumpIcon: new function * [misc/kernel32.c] New file. * [misc/main.c] make stdout and stderr unbuffered * [misc/shell.c] DoEnvironmentSubst: new function * [objects/font.c] FONT_MatchFont: try oblique if there is no italic * [rc/Imakefile][rc/parser.l] yywrap: new function Don't link with libfl.a on Linux * [tools/build.c] Added keywords stdcall, subsystem, base GenerateForWin32: new function BuildSpecFiles: call GenerateForWin32 if subsystem is win32 Mon May 15 10:38:14 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [controls/listbox.c] [controls/combo.c] [windows/defwnd.c] Minor fixes. * [misc/message.c] [misc/main.c] [rc/sysres*.rc] [include/texts.h] Rewrote message box handling. * [windows/dialog.c] Dialogs should be invisible until after WM_INITDIALOG is seent. Don't switch to invisible dialog items on a TAB keypress. * [windows/mdi.c] Send WM_NCPAINT message in MDIRestoreChild(). * [windows/painting.c] Fixed typo (&& -> &). * [windows/message.c] [if1632/user.spec] Implemented PostAppMessage(). * [windows/event.c] SetCapture(0) should act like ReleaseCapture(). Tue May 9 11:55:52 1995 Eddie C. Dost (ecd@dressler.de) * [Imakefile] Changed CDEBUGFLAGS for systems running __ELF__ (temporarily) Added ASFLAGS to exported variables. * [debugger/readline/Imakefile] Moved defines for libreadline from DEFINES to EXTRA_DEFINES * [memory/local.c] [miscemu/int21.c] Added some more debugging outputs. Mon May 8 00:55:27 MET DST 1995 Dag Asheim (dash@ifi.uio.no) * [misc/message.c] Fixed a "FIXME" concerning norwegian translation. Sun May 7 23:25:23 1995 Bernd Schmidt <crux@pool.informatik.rwth-aachen.de> * [*/*] Removed warnings in a couple of files and deleted some obsolete code. * [controls/listbox.c] Cleanup, speed improvements & lots of bug fixes. * [controls/combo.c] Mostly rewritten. This is still very buggy, but not quite as bad as before. * [include/commdlg.h] [misc/commdlg.c] Removed the need for sysres.dll. Small bug fixes. * [objects/oembitmap.c] [include/bitmaps/<many>] [include/windows.h] [loader/library.c] [loader/main.c] [rc/sysres*.rc] Removed sysres.dll and replaced the remaining bitmaps/icons with XPM equivalents. * [misc/message.c] [windows/nonclient.c] [misc/main.c] [if1632/winprocs.spec] "About Wine..." now brings up a standard ShellAbout() window with the Wine icon and the list of contributors. * [misc/shell.c] Fixed ShellAbout()/AboutDialogProc() to show the right icon. * [windows/event.c] Small hack for non-alphanumeric keys: Dont't send the ascii value in the WM_KEYDOWN message, but some unused code instead. Should be done properly by sending different codes for each key. The edit control used to get a VK_DELETE message each time the user typed '.'. * [windows/class.c] Removed a check for CS_GLOBALCLASS in CLASS_FindClassByName(). This used to be no problem, but breaks Resource Workshop in 950403. * [objects/dib.c] New diagnostic for a bug I've been encountering. If it shows up, please report it. Sun May 7 23:11:18 EDT 1995 William Magro (wmagro@tc.cornell.edu) * [objects/color.c] Handle situation when 'dc' exists, but palette mapping does not. (Fixes kidpix2 demo.) Sun May 7 03:32:00 1995 Charles M. Hannum (mycroft@mit.edu) * [loader/ldt.c] LDT_Print: Only show the number of entries that the kernel returned. Make this work for NetBSD. Fri May 5 02:53:26 1995 Charles M. Hannum (mycroft@mit.edu) * [debugger/dbg.y] [include/wine.h] [loader/signal.c] Modify cs and ds selector values for NetBSD-current. * [debugger/debug.l] $sp, $esp: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [debugger/regpos.h] Modify sigcontext format for NetBSD-current. SC_ESP: Use RN_ESP_AT_SIGNAL rather than RN_ESP. * [include/ldt.h] SELECTOR_TO_ENTRY: Explicitly clear the top half of the selector value, since only 16 bits of it may have been saved. * [misc/winsocket.c] Set structure packing with `#pragma pack' to accomodate other/older compilers. Tue May 2 18:15:01 1995 Paal Beyer (beyer@idt.unit.no) * [misc/commdlg.c] Fixed path-names so when changing directory the listboxes changes too. * [debugger/dbg.y debugger/debug.l wine.ini] Added SymbolTableFile to wine.ini so symbols can be read without standing in the directory containing wine.sym. Added the possibility to specify full name of wine.sym from the debugger prompt.
337 lines
9.6 KiB
C
337 lines
9.6 KiB
C
/*
|
|
* Window classes functions
|
|
*
|
|
* Copyright 1993 Alexandre Julliard
|
|
*
|
|
static char Copyright[] = "Copyright Alexandre Julliard, 1993";
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <stdio.h>
|
|
#include <string.h>
|
|
#include "class.h"
|
|
#include "user.h"
|
|
#include "win.h"
|
|
#include "dce.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 = GlobalFindAtom( 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 0
|
|
/* This breaks Borland's Resource Workshop: A DLL creates a class,
|
|
* and the main program tries to use it, but passes a different
|
|
* hInstance */
|
|
if (!(classPtr->wc.style & CS_GLOBALCLASS)) continue;
|
|
#endif
|
|
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=%d name='%s' background %04x\n",
|
|
(DWORD)class->lpfnWndProc, class->hInstance, name, class->hbrBackground );
|
|
dprintf_class(stddeb, " style %04x\n",class->style);
|
|
/* 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 = GlobalAddAtom( 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 instance )
|
|
{
|
|
HANDLE class, prevClass;
|
|
CLASS * classPtr, * prevClassPtr;
|
|
|
|
/* Check if we can remove this class */
|
|
class = CLASS_FindClassByName( className, instance, &classPtr );
|
|
if (!class) return FALSE;
|
|
if ((classPtr->wc.hInstance != instance) || (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)*/ GlobalDeleteAtom( 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 GlobalGetAtomName(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);
|
|
|
|
|
|
/* 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;
|
|
GlobalGetAtomName( classPtr->atomName, pClassEntry->szClassName,
|
|
sizeof(pClassEntry->szClassName) );
|
|
return TRUE;
|
|
}
|