mirror of
git://source.winehq.org/git/wine.git
synced 2024-11-02 20:18:28 +00:00
a0d77315e4
Fri Sep 11 13:14:35 1998 Andreas Mohr <100.30936@germany.net> * [files/file.c] [include/file.h] Fixed SetFilePointer to allow negative positions as in DOS. * [graphics/ddraw.c] Added some methods to IDirect3D. * [ole/compobj.c] [if1632/compobj.spec] Added/implemented CoCreateStandardMalloc16, CoGetClassObject, CoCreateInstance, LookupETask, SetETask, CoGetState16. * [loader/task.c] MakeProcInstance: return 0 if func == NULL. * [*/*] [tools/winapi-check] Added zillions of missing WINAPI's and __cdecl's. (oops, several caused by myself) Wrote script for automated checking. * [if1632/compobj.spec] Many stub names. * [misc/ddeml.c] [ole/compobj.c] Some stubs. Tue Sep 9 21:36:48 1998 Anders Carlsson <anders.carlsson@linux.nu> * [dlls/comctl32/Makefile.in] [dlls/comctl32/commctrl.c] [dlls/comctl32/tab.c] [include/commctrl.h] [include/tab.h] Added preliminary tab control support. Sat Sep 5 16:27:20 1998 Huw D M Davies <daviesh@abacus.physics.ox.ac.uk> * [graphics/psdrv/*] More changes to the PostScript driver: Implemented pens and solid brushes. Colour/greyscale for fonts, pens and brushes. To get coloured output you need to have *ColorDevice set to true in your PPD, otherwise you'll get greyscale. Landscape mode now works, as does non-A4 page sizes. Encoding of fonts to ANSI is better, Symbol works again. * [objects/dc.c] [include/gdi.h] [*/*] Moved dc->w.{text,background}Pixel to X11DRV_PDEVICE where they belong. Sat Sep 5 05:12:09 1998 Ove Kaaven <ovek@arcticnet.no> * [include/dosexe.h] [include/miscemu.h] [include/msdos.h] [loader/dos/dosvm.c] [loader/dos/module.c] [msdos/dpmi.c] [msdos/int2f.c] [msdos/interrupts.c] Fixed portability. Adapted some code to make it easier to integrate the DOS subsystem with the DPMI subsystem, made the DPMI simulated real-mode interrupts be handled the V86 way. Added support for .COM files. Made int2f DPMI check fail, to avoid pkunzip crashing in attempting to use DPMI. Generally moved stuff around a little. It is now technically possible to load several DOS programs into the same memory space. Not tested, though. Fri Sep 4 21:40:45 1998 Marcus Meissner <marcus@jet.franken.de> * [if1632/kernel.spec] Changed 500-53x stubnames accordingly to nt3.51 krnl386.exe. * [win32/except.c] Fixed one bad program behaviour, (deleting SEH while in first walk). RtlUnwind is broken too I think (it should unwind on success, not while walking the exception chain). * [ole/ole2nls.c] Get*DefaultLCID returns 0x400|id. expected by one application. * [if1632/snoop.c] Handle non-standard SP returns more graceful. * [windows/class.c] hinstances are mostly irrelevant for win32. * [memory/string.c] [misc/registry.c] lstrcmpi32W: use toupper for characters < 0x100. (speedup hack for registry.c) Some small speedup hacks for registry.c Thu Sep 3 20:40:16 1998 Eric Kohl <ekohl@abo.rhein-zeitung.de> * [Makefile.in][configure][configure.in][dlls/Makefile.in] [dlls/comctl32/Makefile.in] Created dlls/comctl32 and moved the common controls stuff to it. * [misc/version.c] Removed COMCTL32_DllGetVersion. The fixed function is part of the common controls stuff. * [dlls/comctl32/*.c][include/commctrl.h] Added structure size tests. * [dlls/comctl32/toolbar.c] Fixed a bug in TOOLBAR_GetMaxWidth(). * [dlls/comctl32/animate.c][include/animate.h] [dlls/comctl32/comboex.c][include/comboex.h] [dlls/comctl32/hotkey.c][include/hotkey.h] [dlls/comctl32/listview.c][include/listview.h] [dlls/comctl32/commctrl.c][include/commctrl.h] New files. Added Animation, ComboBoxEx, Hotkey and Listview control dummies. * [dlls/comctl32/tooltips.c] Fixed a display bug and font selection. * [dlls/comctl32/comctl32undoc.c][include/commctrl.h] Added missing DPA functions. Fixed bugs and published the function prototypes. * [documentation/common_controls] Updated. Wed Sep 2 15:43:45 1998 Patrik Stridvall <ps@leissner.se> * [AUTHORS] [include/authors.h] Added myself as a Wine author. * [memory/virtual.c] [objects/dc.c] Fixed runtime errors for Solaris. * [misc/ddeml.c] [objects/gdiobj.c] Minor fixes. * [win32/device.c] Added stubs for IFSMgr VxDCall and a partial implementation of IFSMgr DeviceIo. * [relay32/Makefile.in] [relay32/builtin32.c] [relay32/imm32.spec] [relay32/msnet32.spec] [relay32/oledlg.spec] Added new spec files for IMM32.DLL, MSNET32.DLL, OLEDLG.DLL. * [misc/Makefile.in] [misc/imm.c] [include/imm.h] Added news files for implementation of IMM32.DLL. All functions return 0 as is correct for all Western Languages. * [ole/Makefile.in] [ole/oledlg.c] [include/oledlg.h] Added new files for implementation of OLEDLG.DLL. Added stubs with FIXME:s for all functions. Wed Sep 2 10:50:00 1998 Juergen Schmied <juergen.schmied@metronet.de> * [dlls/shell32/contmenu.c][dlls/shell32/shellole.c] [dlls/shell32/shlfolder.c][dlls/shell32/shlview.c] [documentation/shell32][include/shell.h] Clean up, bugfixes. * [dlls/shell32/enumidlist.c] Fileattributes implemented. * [dlls/shell32/pidl.c] Class pidlmgr splited into functions, structures changed, some functions rewritten. * [dlls/shell32/shell32_main.c] Small changes and bugfixes SHGetFileInfoA, SHGetSpecialFolderLocation. * [dlls/shell32/shellord.c][relay32/shell32.spec] Parameter documented, implemented SHCloneSpecialIDList. Stub improved ShellExecuteEx32A. New stubs SHFind_InitMenuPopup, FileMenu_InitMenuPopup, FileMenu_Create, FileMenu_TrackPopupMenuEx, SHWinHelp, SHRunConrolPanel, DAD_ShowDragImage, FileMenu_Destroy, SHGetDataFromIDListA, SHFileOperationA. * [include/winnls.h][include/ole2nls.c] TIME_FORCE24HOURFORMAT, TIME_NOTIMEMARKER implemented in OLE_GetFormatA, GetTimeFormat32A. * [win32/code_page.c] WideCharToMultiByte: parameter checking and returning of strlen implemented. * [windows/keyboard.c][windows/defwnd.c] Debug messages added. * [windows/win.c] WIN_SetWindowLong GWL_STYLE and GWL_EXSTYLE implemented. * [controls/menu.c] Missing line added. * [include/winerror.h] Macros for SUCCEEDED and FAILED added. Mon Aug 31 00:55:31 1998 Ulrich Weigand <weigand@informatik.uni-erlangen.de> * [loader/module.c] Bugfix: LoadModule16 should *not* call LoadModule32. * [files/dos_fs.c] Bugfix: don't crash if given directory doesn't exist. Sat Aug 29 15:00:49 1998 Turchanov Sergey <turchanov@usa.net> * [include/mmsystem.h][multimedia/mmsystem.c][relay32/winmm.spec] Almost completed implementation of [snd]PlaySound (except flags SND_ALIAS_ID and SND_APPLICATION). * [if1632/user.spec][windows/winpos.c] Added SetWindowRgn16 stub. Sat Aug 29 02:53:31 1998 Alexander Lukyanov <lav@long.yar.ru> * [files/drive.c] GetDriveType32A: return DRIVE_DOESNOTEXIST in case of non existent drive. * [msdos/int21.c] INT21_FindFirstFCB: check drive validity to prevent oops. * [win32/file.c] CreateFile32A: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [files/dos_fs.c] Make DOSFS_OpenDir treat "" as "/". DOSFS_OpenDevice: duplicate STD_{INPUT,OUTPUT}_HANDLE. * [windows/dialog.c] GetNextDlgTabItem32: use last/first item instead of first/last when hwndCtrl==0. This fixes initial focus. Sat Aug 29 02:46:32 1998 Adrian Harvey <adrian@select.com.au> * [include/process.h] [include/process.c] Renamed PROCESS_SELF to CURRENT_PROCESS_PSEUDOHANDLE in line with thread constant, and Win32 documentation (which calls it a pseudohandle.) Made GetCurrentProcess actually use this constant instead of the value. * [include/process.h] [include/thread.h] [scheduler/thread.c] [scheduler/process.c] [scheduler/handle.c] Modify HANDLE_GetObjPtr to understand about CURRENT_THREAD_PSEUDOHANDLE and CURRENT_PROCESS_PSEUDOHANDLE. This allows DuplicateHandle to do the correct thing with these handles. Removed now duplicate functionality from THREAD_GetPtr and PROCESS_GetPtr. * [loader/ne/segment.c] Fixed two places where HFILE32s were being created and passed to 16-bit code. This should unbreak NE self-loading code. Added two casts to remove compile time warnings. Fri Aug 28 21:04:13 1998 Joseph Pranevich <knight@baltimore.wwaves.com> * [msdos/dosmem.c] [msdos/int2f.c] Added beginnings of DOS error table. * [msdos/int1a.c] Stub for subfunction 0xb0. * [msdos/int10.c] [loader/dos/dosvm.c] INT 10 support completely rewritten and lots of debugging added. Now, DOS apps that use INT 10 to write to the screen will work. (Beyond Zork does, at least. Somewhat.) * [include/miscemu.h] [msdos/dosmem.c] [msdos/int21.c] Another shot at getting MS's generic error message facility right. * [msdos/int21.c] Command.Com wanted to set its own PSP address. I let it. Wed Aug 26 12:26:20 1998 Matthew Toseland <Matthew.Toseland@btinternet.com> * [include/file.h] [misc/lzexpand.c] Fixed LZCopy16 by fixing HFILE16/HFILE32 convertor macros so don't convert lzw handles. Tue Aug 25 22:22:55 1998 Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> * [misc/registry.c] In RegEnumvalue, ivalue == 0 is a legal request and should return the first entry. * [msdos/int21.c] Add handling for Int21-48/49 in Win16. Makes blinker demo work. * [windows/winproc.c] Add Msg32A<->Msg32W translation for LB_ADDSTRING. Tue Aug 25 21:03:31 1998 Kristian Nielsen <kristian.nielsen@risoe.dk> * [windows/win.c] Fix for SetParent(): MS Windows 3.11 does not clear the WS_CHILD flag when a child window is reparented to the desktop window. Mon Aug 24 20:55:22 1998 Berend Reitsma <berend at asset-control dot com> * [controls/menu.c] Menus created with SetMenuItemInfo and InsertMenuItem should work now. Sun Aug 23 23:23:23 1998 Alex Korobka <korobka@ams.sunysb.edu> * [controls/combo.c] Added CB_GETITEMHEIGHT. * [windows/winpos.c] WM_NCHITTEST, SWP_FRAMECHANGED bugfixes. Sat Aug 22 21:15:29 1998 Alex Priem <alexp@sci.kun.nl> * [files/profile.c] [include/windows.h] Added GetPrivateProfileSectionNames[AW],GetPrivateProfileSectionW, GetPrivateProfileStructW, GetProfileSectionW, WriteProfileSection[AW], WritePrivateProfileStructW.
1186 lines
38 KiB
C
1186 lines
38 KiB
C
/*
|
|
* Window classes functions
|
|
*
|
|
* Copyright 1993, 1996 Alexandre Julliard
|
|
* 1998 Juergen Schmied (jsch)
|
|
*
|
|
* FIXME: In win32 all classes are local. They are registered at
|
|
* program start. Processes CANNOT share classes. (Source: some
|
|
* win31->NT migration book)
|
|
*
|
|
* FIXME: There seems to be a general problem with hInstance in WINE
|
|
* classes are getting registred with wrong hInstance.
|
|
*/
|
|
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "class.h"
|
|
#include "heap.h"
|
|
#include "win.h"
|
|
#include "dce.h"
|
|
#include "atom.h"
|
|
#include "ldt.h"
|
|
#include "toolhelp.h"
|
|
#include "winproc.h"
|
|
#include "debug.h"
|
|
#include "winerror.h"
|
|
|
|
|
|
static CLASS *firstClass = NULL;
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_DumpClass
|
|
*
|
|
* Dump the content of a class structure to stderr.
|
|
*/
|
|
void CLASS_DumpClass( CLASS *ptr )
|
|
{
|
|
char className[80];
|
|
int i;
|
|
|
|
if (ptr->magic != CLASS_MAGIC)
|
|
{
|
|
DUMP("%p is not a class\n", ptr );
|
|
return;
|
|
}
|
|
|
|
GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) );
|
|
|
|
DUMP( "Class %p:\n", ptr );
|
|
DUMP( "next=%p name=%04x '%s' style=%08x wndProc=%08x\n"
|
|
"inst=%04x dce=%08x icon=%04x cursor=%04x bkgnd=%04x\n"
|
|
"clsExtra=%d winExtra=%d #windows=%d\n",
|
|
ptr->next, ptr->atomName, className, ptr->style,
|
|
(UINT32)ptr->winproc, ptr->hInstance, (UINT32)ptr->dce,
|
|
ptr->hIcon, ptr->hCursor, ptr->hbrBackground,
|
|
ptr->cbClsExtra, ptr->cbWndExtra, ptr->cWindows );
|
|
if (ptr->cbClsExtra)
|
|
{
|
|
DUMP( "extra bytes:" );
|
|
for (i = 0; i < ptr->cbClsExtra; i++)
|
|
DUMP( " %02x", *((BYTE *)ptr->wExtra+i) );
|
|
DUMP( "\n" );
|
|
}
|
|
DUMP( "\n" );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_WalkClasses
|
|
*
|
|
* Walk the class list and print each class on stderr.
|
|
*/
|
|
void CLASS_WalkClasses(void)
|
|
{
|
|
CLASS *ptr;
|
|
char className[80];
|
|
|
|
DUMP( " Class Name Style WndProc\n" );
|
|
for (ptr = firstClass; ptr; ptr = ptr->next)
|
|
{
|
|
GlobalGetAtomName32A( ptr->atomName, className, sizeof(className) );
|
|
DUMP( "%08x %-20.20s %08x %08x\n", (UINT32)ptr, className,
|
|
ptr->style, (UINT32)ptr->winproc );
|
|
}
|
|
DUMP( "\n" );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_GetMenuNameA
|
|
*
|
|
* Get the menu name as a ASCII string.
|
|
*/
|
|
static LPSTR CLASS_GetMenuNameA( CLASS *classPtr )
|
|
{
|
|
if (!classPtr->menuNameA && classPtr->menuNameW)
|
|
{
|
|
/* We need to copy the Unicode string */
|
|
classPtr->menuNameA = SEGPTR_STRDUP_WtoA( classPtr->menuNameW );
|
|
}
|
|
return classPtr->menuNameA;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_GetMenuNameW
|
|
*
|
|
* Get the menu name as a Unicode string.
|
|
*/
|
|
static LPWSTR CLASS_GetMenuNameW( CLASS *classPtr )
|
|
{
|
|
if (!classPtr->menuNameW && classPtr->menuNameA)
|
|
{
|
|
if (!HIWORD(classPtr->menuNameA))
|
|
return (LPWSTR)classPtr->menuNameA;
|
|
/* Now we need to copy the ASCII string */
|
|
classPtr->menuNameW = HEAP_strdupAtoW( SystemHeap, 0,
|
|
classPtr->menuNameA );
|
|
}
|
|
return classPtr->menuNameW;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_SetMenuNameA
|
|
*
|
|
* Set the menu name in a class structure by copying the string.
|
|
*/
|
|
static void CLASS_SetMenuNameA( CLASS *classPtr, LPCSTR name )
|
|
{
|
|
if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA );
|
|
if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW );
|
|
classPtr->menuNameA = SEGPTR_STRDUP( name );
|
|
classPtr->menuNameW = 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_SetMenuNameW
|
|
*
|
|
* Set the menu name in a class structure by copying the string.
|
|
*/
|
|
static void CLASS_SetMenuNameW( CLASS *classPtr, LPCWSTR name )
|
|
{
|
|
if (!HIWORD(name))
|
|
{
|
|
CLASS_SetMenuNameA( classPtr, (LPCSTR)name );
|
|
return;
|
|
}
|
|
if (HIWORD(classPtr->menuNameA)) SEGPTR_FREE( classPtr->menuNameA );
|
|
if (classPtr->menuNameW) HeapFree( SystemHeap, 0, classPtr->menuNameW );
|
|
if ((classPtr->menuNameW = HeapAlloc( SystemHeap, 0,
|
|
(lstrlen32W(name)+1)*sizeof(WCHAR) )))
|
|
lstrcpy32W( classPtr->menuNameW, name );
|
|
classPtr->menuNameA = 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_FreeClass
|
|
*
|
|
* Free a class structure.
|
|
*/
|
|
static BOOL32 CLASS_FreeClass( CLASS *classPtr )
|
|
{
|
|
CLASS **ppClass;
|
|
TRACE(class,"%p \n", classPtr);
|
|
|
|
/* Check if we can remove this class */
|
|
|
|
if (classPtr->cWindows > 0) return FALSE;
|
|
|
|
/* Remove the class from the linked list */
|
|
|
|
for (ppClass = &firstClass; *ppClass; ppClass = &(*ppClass)->next)
|
|
if (*ppClass == classPtr) break;
|
|
if (!*ppClass)
|
|
{
|
|
ERR( class, "Class list corrupted\n" );
|
|
return FALSE;
|
|
}
|
|
*ppClass = classPtr->next;
|
|
|
|
/* Delete the class */
|
|
|
|
if (classPtr->dce) DCE_FreeDCE( classPtr->dce );
|
|
if (classPtr->hbrBackground) DeleteObject32( classPtr->hbrBackground );
|
|
GlobalDeleteAtom( classPtr->atomName );
|
|
CLASS_SetMenuNameA( classPtr, NULL );
|
|
WINPROC_FreeProc( classPtr->winproc, WIN_PROC_CLASS );
|
|
HeapFree( SystemHeap, 0, classPtr );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_FreeModuleClasses
|
|
*/
|
|
void CLASS_FreeModuleClasses( HMODULE16 hModule )
|
|
{
|
|
CLASS *ptr, *next;
|
|
|
|
TRACE(class,"0x%08x \n", hModule);
|
|
|
|
for (ptr = firstClass; ptr; ptr = next)
|
|
{
|
|
next = ptr->next;
|
|
if (ptr->hInstance == hModule) CLASS_FreeClass( ptr );
|
|
}
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_FindClassByAtom
|
|
*
|
|
* Return a pointer to the class.
|
|
* hinstance has been normalized by the caller.
|
|
*
|
|
* NOTES
|
|
* 980805 a local class will be found now if registred with hInst=0
|
|
* and looed up with a hInst!=0. msmoney does it (jsch)
|
|
*/
|
|
CLASS *CLASS_FindClassByAtom( ATOM atom, HINSTANCE32 hinstance )
|
|
{ CLASS * class, *tclass=0;
|
|
|
|
TRACE(class,"0x%08x 0x%08x\n", atom, hinstance);
|
|
|
|
/* First search task-specific classes */
|
|
|
|
for (class = firstClass; (class); class = class->next)
|
|
{
|
|
if (class->style & CS_GLOBALCLASS) continue;
|
|
if (class->atomName == atom)
|
|
{
|
|
if (hinstance==class->hInstance || hinstance==0xffff )
|
|
{
|
|
TRACE(class,"-- found local %p\n", class);
|
|
return class;
|
|
}
|
|
if (class->hInstance==0) tclass = class;
|
|
}
|
|
}
|
|
|
|
/* Then search global classes */
|
|
|
|
for (class = firstClass; (class); class = class->next)
|
|
{
|
|
if (!(class->style & CS_GLOBALCLASS)) continue;
|
|
if (class->atomName == atom)
|
|
{
|
|
TRACE(class,"-- found global %p\n", class);
|
|
return class;
|
|
}
|
|
}
|
|
|
|
/* Then check if there was a local class with hInst=0*/
|
|
if ( tclass )
|
|
{
|
|
WARN(class,"-- found local Class registred with hInst=0\n");
|
|
return tclass;
|
|
}
|
|
|
|
TRACE(class,"-- not found\n");
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* CLASS_RegisterClass
|
|
*
|
|
* The real RegisterClass() functionality.
|
|
*/
|
|
static CLASS *CLASS_RegisterClass( ATOM atom, HINSTANCE32 hInstance,
|
|
DWORD style, INT32 classExtra,
|
|
INT32 winExtra, WNDPROC16 wndProc,
|
|
WINDOWPROCTYPE wndProcType )
|
|
{
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"atom=0x%x hinst=0x%x style=0x%lx clExtr=0x%x winExtr=0x%x wndProc=0x%p ProcType=0x%x\n",
|
|
atom, hInstance, style, classExtra, winExtra, wndProc, wndProcType);
|
|
|
|
/* Check if a class with this name already exists */
|
|
classPtr = CLASS_FindClassByAtom( atom, hInstance );
|
|
if (classPtr)
|
|
{
|
|
/* Class can be created only if it is local and */
|
|
/* if the class with the same name is global. */
|
|
|
|
if (style & CS_GLOBALCLASS) return NULL;
|
|
if (!(classPtr->style & CS_GLOBALCLASS)) return NULL;
|
|
}
|
|
|
|
/* Fix the extra bytes value */
|
|
|
|
if (classExtra < 0) classExtra = 0;
|
|
else if (classExtra > 40) /* Extra bytes are limited to 40 in Win32 */
|
|
WARN(class, "Class extra bytes %d is > 40\n", classExtra);
|
|
if (winExtra < 0) winExtra = 0;
|
|
else if (winExtra > 40) /* Extra bytes are limited to 40 in Win32 */
|
|
WARN(class, "Win extra bytes %d is > 40\n", winExtra );
|
|
|
|
/* Create the class */
|
|
|
|
classPtr = (CLASS *)HeapAlloc( SystemHeap, 0, sizeof(CLASS) +
|
|
classExtra - sizeof(classPtr->wExtra) );
|
|
if (!classPtr) return NULL;
|
|
classPtr->next = firstClass;
|
|
classPtr->magic = CLASS_MAGIC;
|
|
classPtr->cWindows = 0;
|
|
classPtr->style = style;
|
|
classPtr->winproc = (HWINDOWPROC)0;
|
|
classPtr->cbWndExtra = winExtra;
|
|
classPtr->cbClsExtra = classExtra;
|
|
classPtr->hInstance = hInstance;
|
|
classPtr->atomName = atom;
|
|
classPtr->menuNameA = 0;
|
|
classPtr->menuNameW = 0;
|
|
classPtr->dce = (style & CS_CLASSDC) ?
|
|
DCE_AllocDCE( 0, DCE_CLASS_DC ) : NULL;
|
|
|
|
WINPROC_SetProc( &classPtr->winproc, wndProc, wndProcType, WIN_PROC_CLASS);
|
|
|
|
/* Other values must be set by caller */
|
|
|
|
if (classExtra) memset( classPtr->wExtra, 0, classExtra );
|
|
firstClass = classPtr;
|
|
return classPtr;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClass16 (USER.57)
|
|
*/
|
|
ATOM WINAPI RegisterClass16( const WNDCLASS16 *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
HINSTANCE16 hInstance=GetExePtr(wc->hInstance);
|
|
|
|
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
|
|
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
wc->lpfnWndProc, WIN_PROC_16 )))
|
|
{
|
|
GlobalDeleteAtom( atom );
|
|
return 0;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x
|
|
bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n",
|
|
atom, (DWORD)wc->lpfnWndProc, hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr,
|
|
HIWORD(wc->lpszClassName) ?
|
|
(char *)PTR_SEG_TO_LIN(wc->lpszClassName) : "" );
|
|
|
|
classPtr->hIcon = wc->hIcon;
|
|
classPtr->hIconSm = 0;
|
|
classPtr->hCursor = wc->hCursor;
|
|
classPtr->hbrBackground = wc->hbrBackground;
|
|
|
|
CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ?
|
|
PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClass32A (USER32.427)
|
|
* RETURNS
|
|
* >0: Unique identifier
|
|
* 0: Failure
|
|
*/
|
|
ATOM WINAPI RegisterClass32A(
|
|
const WNDCLASS32A* wc /* Address of structure with class data */
|
|
) {
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
if (!(atom = GlobalAddAtom32A( wc->lpszClassName )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
return FALSE;
|
|
}
|
|
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
(WNDPROC16)wc->lpfnWndProc,
|
|
WIN_PROC_32A )))
|
|
{ GlobalDeleteAtom( atom );
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
return FALSE;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p name='%s'\n",
|
|
atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr,
|
|
HIWORD(wc->lpszClassName) ? wc->lpszClassName : "" );
|
|
|
|
classPtr->hIcon = (HICON16)wc->hIcon;
|
|
classPtr->hIconSm = 0;
|
|
classPtr->hCursor = (HCURSOR16)wc->hCursor;
|
|
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
|
|
CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClass32W (USER32.430)
|
|
*/
|
|
ATOM WINAPI RegisterClass32W( const WNDCLASS32W* wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
if (!(atom = GlobalAddAtom32W( wc->lpszClassName )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
return FALSE;
|
|
}
|
|
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
(WNDPROC16)wc->lpfnWndProc,
|
|
WIN_PROC_32W )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
GlobalDeleteAtom( atom );
|
|
return 0;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
|
|
atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr );
|
|
|
|
classPtr->hIcon = (HICON16)wc->hIcon;
|
|
classPtr->hIconSm = 0;
|
|
classPtr->hCursor = (HCURSOR16)wc->hCursor;
|
|
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
|
|
CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClassEx16 (USER.397)
|
|
*/
|
|
ATOM WINAPI RegisterClassEx16( const WNDCLASSEX16 *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
HINSTANCE16 hInstance = GetExePtr( wc->hInstance );
|
|
|
|
if (!(atom = GlobalAddAtom16( wc->lpszClassName ))) return 0;
|
|
if (!(classPtr = CLASS_RegisterClass( atom, hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
wc->lpfnWndProc, WIN_PROC_16 )))
|
|
{
|
|
GlobalDeleteAtom( atom );
|
|
return 0;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
|
|
atom, (DWORD)wc->lpfnWndProc, hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr );
|
|
|
|
classPtr->hIcon = wc->hIcon;
|
|
classPtr->hIconSm = wc->hIconSm;
|
|
classPtr->hCursor = wc->hCursor;
|
|
classPtr->hbrBackground = wc->hbrBackground;
|
|
|
|
CLASS_SetMenuNameA( classPtr, HIWORD(wc->lpszMenuName) ?
|
|
PTR_SEG_TO_LIN(wc->lpszMenuName) : (LPCSTR)wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClassEx32A (USER32.428)
|
|
*/
|
|
ATOM WINAPI RegisterClassEx32A( const WNDCLASSEX32A* wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
if (!(atom = GlobalAddAtom32A( wc->lpszClassName )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
return FALSE;
|
|
}
|
|
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
(WNDPROC16)wc->lpfnWndProc,
|
|
WIN_PROC_32A )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
GlobalDeleteAtom( atom );
|
|
return FALSE;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
|
|
atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr );
|
|
|
|
classPtr->hIcon = (HICON16)wc->hIcon;
|
|
classPtr->hIconSm = (HICON16)wc->hIconSm;
|
|
classPtr->hCursor = (HCURSOR16)wc->hCursor;
|
|
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
|
|
CLASS_SetMenuNameA( classPtr, wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* RegisterClassEx32W (USER32.429)
|
|
*/
|
|
ATOM WINAPI RegisterClassEx32W( const WNDCLASSEX32W* wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
if (!(atom = GlobalAddAtom32W( wc->lpszClassName )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
return 0;
|
|
}
|
|
if (!(classPtr = CLASS_RegisterClass( atom, wc->hInstance, wc->style,
|
|
wc->cbClsExtra, wc->cbWndExtra,
|
|
(WNDPROC16)wc->lpfnWndProc,
|
|
WIN_PROC_32W )))
|
|
{
|
|
SetLastError(ERROR_CLASS_ALREADY_EXISTS);
|
|
GlobalDeleteAtom( atom );
|
|
return 0;
|
|
}
|
|
|
|
TRACE(class, "atom=%04x wndproc=%08lx hinst=%04x bg=%04x style=%08x clsExt=%d winExt=%d class=%p\n",
|
|
atom, (DWORD)wc->lpfnWndProc, wc->hInstance,
|
|
wc->hbrBackground, wc->style, wc->cbClsExtra,
|
|
wc->cbWndExtra, classPtr );
|
|
|
|
classPtr->hIcon = (HICON16)wc->hIcon;
|
|
classPtr->hIconSm = (HICON16)wc->hIconSm;
|
|
classPtr->hCursor = (HCURSOR16)wc->hCursor;
|
|
classPtr->hbrBackground = (HBRUSH16)wc->hbrBackground;
|
|
CLASS_SetMenuNameW( classPtr, wc->lpszMenuName );
|
|
return atom;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* UnregisterClass16 (USER.403)
|
|
*/
|
|
BOOL16 WINAPI UnregisterClass16( SEGPTR className, HINSTANCE16 hInstance )
|
|
{
|
|
CLASS *classPtr;
|
|
ATOM atom;
|
|
|
|
hInstance = GetExePtr( hInstance );
|
|
if (!(atom = GlobalFindAtom16( className ))) return FALSE;
|
|
if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(classPtr->hInstance != hInstance)) return FALSE;
|
|
return CLASS_FreeClass( classPtr );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* UnregisterClass32A (USER32.563)
|
|
*
|
|
*/
|
|
BOOL32 WINAPI UnregisterClass32A( LPCSTR className, HINSTANCE32 hInstance )
|
|
{ CLASS *classPtr;
|
|
ATOM atom;
|
|
BOOL32 ret;
|
|
|
|
TRACE(class,"%s %x\n",className, hInstance);
|
|
|
|
if (!(atom = GlobalFindAtom32A( className )))
|
|
{
|
|
SetLastError(ERROR_CLASS_DOES_NOT_EXIST);
|
|
return FALSE;
|
|
}
|
|
if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(classPtr->hInstance != hInstance))
|
|
{
|
|
SetLastError(ERROR_CLASS_DOES_NOT_EXIST);
|
|
return FALSE;
|
|
}
|
|
if (!(ret = CLASS_FreeClass( classPtr )))
|
|
SetLastError(ERROR_CLASS_HAS_WINDOWS);
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* UnregisterClass32W (USER32.564)
|
|
*/
|
|
BOOL32 WINAPI UnregisterClass32W( LPCWSTR className, HINSTANCE32 hInstance )
|
|
{ CLASS *classPtr;
|
|
ATOM atom;
|
|
BOOL32 ret;
|
|
|
|
TRACE(class,"%s %x\n",debugstr_w(className), hInstance);
|
|
|
|
if (!(atom = GlobalFindAtom32W( className )))
|
|
{
|
|
SetLastError(ERROR_CLASS_DOES_NOT_EXIST);
|
|
return FALSE;
|
|
}
|
|
if (!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(classPtr->hInstance != hInstance))
|
|
{
|
|
SetLastError(ERROR_CLASS_DOES_NOT_EXIST);
|
|
return FALSE;
|
|
}
|
|
if (!(ret = CLASS_FreeClass( classPtr )))
|
|
SetLastError(ERROR_CLASS_HAS_WINDOWS);
|
|
return ret;
|
|
}
|
|
|
|
/***********************************************************************
|
|
* GetClassWord16 (USER.129)
|
|
*/
|
|
WORD WINAPI GetClassWord16( HWND16 hwnd, INT16 offset )
|
|
{
|
|
return GetClassWord32( hwnd, offset );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassWord32 (USER32.219)
|
|
*/
|
|
WORD WINAPI GetClassWord32( HWND32 hwnd, INT32 offset )
|
|
{
|
|
WND * wndPtr;
|
|
|
|
TRACE(class,"%x %x\n",hwnd, offset);
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
if (offset >= 0)
|
|
{
|
|
if (offset <= wndPtr->class->cbClsExtra - sizeof(WORD))
|
|
return GET_WORD(((char *)wndPtr->class->wExtra) + offset);
|
|
}
|
|
else switch(offset)
|
|
{
|
|
case GCW_HBRBACKGROUND: return wndPtr->class->hbrBackground;
|
|
case GCW_HCURSOR: return wndPtr->class->hCursor;
|
|
case GCW_HICON: return wndPtr->class->hIcon;
|
|
case GCW_HICONSM: return wndPtr->class->hIconSm;
|
|
case GCW_ATOM: return wndPtr->class->atomName;
|
|
case GCW_STYLE:
|
|
case GCW_CBWNDEXTRA:
|
|
case GCW_CBCLSEXTRA:
|
|
case GCW_HMODULE:
|
|
return (WORD)GetClassLong32A( hwnd, offset );
|
|
}
|
|
|
|
WARN(class, "Invalid offset %d\n", offset);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassLong16 (USER.131)
|
|
*/
|
|
LONG WINAPI GetClassLong16( HWND16 hwnd, INT16 offset )
|
|
{
|
|
WND *wndPtr;
|
|
LONG ret;
|
|
|
|
TRACE(class,"%x %x\n",hwnd, offset);
|
|
|
|
switch( offset )
|
|
{
|
|
case GCL_WNDPROC:
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
return (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 );
|
|
case GCL_MENUNAME:
|
|
ret = GetClassLong32A( hwnd, offset );
|
|
return (LONG)SEGPTR_GET( (void *)ret );
|
|
default:
|
|
return GetClassLong32A( hwnd, offset );
|
|
}
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassLong32A (USER32.215)
|
|
*/
|
|
LONG WINAPI GetClassLong32A( HWND32 hwnd, INT32 offset )
|
|
{
|
|
WND * wndPtr;
|
|
|
|
TRACE(class,"%x %x\n",hwnd, offset);
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
if (offset >= 0)
|
|
{
|
|
if (offset <= wndPtr->class->cbClsExtra - sizeof(LONG))
|
|
return GET_DWORD(((char *)wndPtr->class->wExtra) + offset);
|
|
}
|
|
switch(offset)
|
|
{
|
|
case GCL_STYLE: return (LONG)wndPtr->class->style;
|
|
case GCL_CBWNDEXTRA: return (LONG)wndPtr->class->cbWndExtra;
|
|
case GCL_CBCLSEXTRA: return (LONG)wndPtr->class->cbClsExtra;
|
|
case GCL_HMODULE: return (LONG)wndPtr->class->hInstance;
|
|
case GCL_WNDPROC:
|
|
return (LONG)WINPROC_GetProc(wndPtr->class->winproc, WIN_PROC_32A);
|
|
case GCL_MENUNAME:
|
|
return (LONG)CLASS_GetMenuNameA( wndPtr->class );
|
|
case GCL_HBRBACKGROUND:
|
|
case GCL_HCURSOR:
|
|
case GCL_HICON:
|
|
case GCL_HICONSM:
|
|
return GetClassWord32( hwnd, offset );
|
|
}
|
|
WARN(class, "Invalid offset %d\n", offset);
|
|
return 0;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassLong32W (USER32.216)
|
|
*/
|
|
LONG WINAPI GetClassLong32W( HWND32 hwnd, INT32 offset )
|
|
{
|
|
WND * wndPtr;
|
|
|
|
TRACE(class,"%x %x\n",hwnd, offset);
|
|
|
|
switch(offset)
|
|
{
|
|
case GCL_WNDPROC:
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
return (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W );
|
|
case GCL_MENUNAME:
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
return (LONG)CLASS_GetMenuNameW( wndPtr->class );
|
|
default:
|
|
return GetClassLong32A( hwnd, offset );
|
|
}
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetClassWord16 (USER.130)
|
|
*/
|
|
WORD WINAPI SetClassWord16( HWND16 hwnd, INT16 offset, WORD newval )
|
|
{
|
|
return SetClassWord32( hwnd, offset, newval );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetClassWord32 (USER32.469)
|
|
*/
|
|
WORD WINAPI SetClassWord32( HWND32 hwnd, INT32 offset, WORD newval )
|
|
{
|
|
WND * wndPtr;
|
|
WORD retval = 0;
|
|
void *ptr;
|
|
|
|
TRACE(class,"%x %x %x\n",hwnd, offset, newval);
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
if (offset >= 0)
|
|
{
|
|
if (offset + sizeof(WORD) <= wndPtr->class->cbClsExtra)
|
|
ptr = ((char *)wndPtr->class->wExtra) + offset;
|
|
else
|
|
{
|
|
WARN( class, "Invalid offset %d\n", offset );
|
|
return 0;
|
|
}
|
|
}
|
|
else switch(offset)
|
|
{
|
|
case GCW_STYLE:
|
|
case GCW_CBWNDEXTRA:
|
|
case GCW_CBCLSEXTRA:
|
|
case GCW_HMODULE:
|
|
return (WORD)SetClassLong32A( hwnd, offset, (LONG)newval );
|
|
case GCW_HBRBACKGROUND: ptr = &wndPtr->class->hbrBackground; break;
|
|
case GCW_HCURSOR: ptr = &wndPtr->class->hCursor; break;
|
|
case GCW_HICON: ptr = &wndPtr->class->hIcon; break;
|
|
case GCW_HICONSM: ptr = &wndPtr->class->hIconSm; break;
|
|
case GCW_ATOM: ptr = &wndPtr->class->atomName; break;
|
|
default:
|
|
WARN( class, "Invalid offset %d\n", offset);
|
|
return 0;
|
|
}
|
|
retval = GET_WORD(ptr);
|
|
PUT_WORD( ptr, newval );
|
|
return retval;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetClassLong16 (USER.132)
|
|
*/
|
|
LONG WINAPI SetClassLong16( HWND16 hwnd, INT16 offset, LONG newval )
|
|
{
|
|
WND *wndPtr;
|
|
LONG retval;
|
|
|
|
TRACE(class,"%x %x %lx\n",hwnd, offset, newval);
|
|
|
|
switch(offset)
|
|
{
|
|
case GCL_WNDPROC:
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_16 );
|
|
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
|
|
WIN_PROC_16, WIN_PROC_CLASS );
|
|
return retval;
|
|
case GCL_MENUNAME:
|
|
return SetClassLong32A( hwnd, offset, (LONG)PTR_SEG_TO_LIN(newval) );
|
|
default:
|
|
return SetClassLong32A( hwnd, offset, newval );
|
|
}
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetClassLong32A (USER32.467)
|
|
*/
|
|
LONG WINAPI SetClassLong32A( HWND32 hwnd, INT32 offset, LONG newval )
|
|
{
|
|
WND * wndPtr;
|
|
LONG retval = 0;
|
|
void *ptr;
|
|
|
|
TRACE(class,"%x %x %lx\n",hwnd, offset, newval);
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr( hwnd ))) return 0;
|
|
if (offset >= 0)
|
|
{
|
|
if (offset + sizeof(LONG) <= wndPtr->class->cbClsExtra)
|
|
ptr = ((char *)wndPtr->class->wExtra) + offset;
|
|
else
|
|
{
|
|
WARN( class, "Invalid offset %d\n", offset );
|
|
return 0;
|
|
}
|
|
}
|
|
else switch(offset)
|
|
{
|
|
case GCL_MENUNAME:
|
|
CLASS_SetMenuNameA( wndPtr->class, (LPCSTR)newval );
|
|
return 0; /* Old value is now meaningless anyway */
|
|
case GCL_WNDPROC:
|
|
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc,
|
|
WIN_PROC_32A );
|
|
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
|
|
WIN_PROC_32A, WIN_PROC_CLASS );
|
|
return retval;
|
|
case GCL_HBRBACKGROUND:
|
|
case GCL_HCURSOR:
|
|
case GCL_HICON:
|
|
case GCL_HICONSM:
|
|
return SetClassWord32( hwnd, offset, (WORD)newval );
|
|
case GCL_STYLE: ptr = &wndPtr->class->style; break;
|
|
case GCL_CBWNDEXTRA: ptr = &wndPtr->class->cbWndExtra; break;
|
|
case GCL_CBCLSEXTRA: ptr = &wndPtr->class->cbClsExtra; break;
|
|
case GCL_HMODULE: ptr = &wndPtr->class->hInstance; break;
|
|
default:
|
|
WARN( class, "Invalid offset %d\n", offset );
|
|
return 0;
|
|
}
|
|
retval = GET_DWORD(ptr);
|
|
PUT_DWORD( ptr, newval );
|
|
return retval;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* SetClassLong32W (USER32.468)
|
|
*/
|
|
LONG WINAPI SetClassLong32W( HWND32 hwnd, INT32 offset, LONG newval )
|
|
{
|
|
WND *wndPtr;
|
|
LONG retval;
|
|
|
|
TRACE(class,"%x %x %lx\n",hwnd, offset, newval);
|
|
|
|
switch(offset)
|
|
{
|
|
case GCL_WNDPROC:
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
retval = (LONG)WINPROC_GetProc( wndPtr->class->winproc, WIN_PROC_32W );
|
|
WINPROC_SetProc( &wndPtr->class->winproc, (WNDPROC16)newval,
|
|
WIN_PROC_32W, WIN_PROC_CLASS );
|
|
return retval;
|
|
case GCL_MENUNAME:
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
CLASS_SetMenuNameW( wndPtr->class, (LPCWSTR)newval );
|
|
return 0; /* Old value is now meaningless anyway */
|
|
default:
|
|
return SetClassLong32A( hwnd, offset, newval );
|
|
}
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassName16 (USER.58)
|
|
*/
|
|
INT16 WINAPI GetClassName16( HWND16 hwnd, LPSTR buffer, INT16 count )
|
|
{
|
|
WND *wndPtr;
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
return GlobalGetAtomName16( wndPtr->class->atomName, buffer, count );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassName32A (USER32.217)
|
|
*/
|
|
INT32 WINAPI GetClassName32A( HWND32 hwnd, LPSTR buffer, INT32 count )
|
|
{ INT32 ret;
|
|
WND *wndPtr;
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
ret = GlobalGetAtomName32A( wndPtr->class->atomName, buffer, count );
|
|
|
|
TRACE(class,"%x %s %x\n",hwnd, buffer, count);
|
|
return ret;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassName32W (USER32.218)
|
|
*/
|
|
INT32 WINAPI GetClassName32W( HWND32 hwnd, LPWSTR buffer, INT32 count )
|
|
{ INT32 ret;
|
|
WND *wndPtr;
|
|
|
|
if (!(wndPtr = WIN_FindWndPtr(hwnd))) return 0;
|
|
ret = GlobalGetAtomName32W( wndPtr->class->atomName, buffer, count );
|
|
|
|
TRACE(class,"%x %s %x\n",hwnd, debugstr_w(buffer), count);
|
|
|
|
return ret;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfo16 (USER.404)
|
|
*/
|
|
BOOL16 WINAPI GetClassInfo16( HINSTANCE16 hInstance, SEGPTR name,
|
|
WNDCLASS16 *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance, PTR_SEG_TO_LIN (name), wc);
|
|
|
|
hInstance = GetExePtr( hInstance );
|
|
if (!(atom = GlobalFindAtom16( name )) ||
|
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )))
|
|
return FALSE;
|
|
if ((hInstance != classPtr->hInstance) &&
|
|
!(classPtr->style & CS_GLOBALCLASS)) /*BWCC likes to pass hInstance=0*/
|
|
return FALSE;
|
|
wc->style = (UINT16)classPtr->style;
|
|
wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 );
|
|
wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
|
|
wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
|
|
wc->hInstance = (HINSTANCE16)classPtr->hInstance;
|
|
wc->hIcon = classPtr->hIcon;
|
|
wc->hCursor = classPtr->hCursor;
|
|
wc->hbrBackground = classPtr->hbrBackground;
|
|
wc->lpszClassName = (SEGPTR)0;
|
|
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr );
|
|
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */
|
|
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfo32A (USER32.211)
|
|
*/
|
|
BOOL32 WINAPI GetClassInfo32A( HINSTANCE32 hInstance, LPCSTR name,
|
|
WNDCLASS32A *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance, name, wc);
|
|
|
|
/* workaround: if hInstance=NULL you expect to get the system classes
|
|
but this classes (as example from comctl32.dll SysListView) won't be
|
|
registred with hInstance=NULL in WINE because of the late loading
|
|
of this dll. fixes file dialogs in WinWord95 (jsch)*/
|
|
|
|
if (!(atom=GlobalFindAtom32A(name)) || !(classPtr=CLASS_FindClassByAtom(atom,hInstance)))
|
|
return FALSE;
|
|
|
|
if (classPtr->hInstance && (hInstance != classPtr->hInstance))
|
|
{
|
|
if (hInstance) return FALSE;
|
|
else
|
|
WARN(class,"systemclass %s (hInst=0) demanded but only class with hInst!=0 found\n",name);
|
|
}
|
|
|
|
wc->style = classPtr->style;
|
|
wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc,
|
|
WIN_PROC_32A );
|
|
wc->cbClsExtra = classPtr->cbClsExtra;
|
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
|
wc->hInstance = classPtr->hInstance;
|
|
wc->hIcon = (HICON32)classPtr->hIcon;
|
|
wc->hCursor = (HCURSOR32)classPtr->hCursor;
|
|
wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground;
|
|
wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
|
|
wc->lpszClassName = NULL;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfo32W (USER32.214)
|
|
*/
|
|
BOOL32 WINAPI GetClassInfo32W( HINSTANCE32 hInstance, LPCWSTR name,
|
|
WNDCLASS32W *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance, name, wc);
|
|
|
|
if (!(atom = GlobalFindAtom32W( name )) ||
|
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(classPtr->hInstance && (hInstance != classPtr->hInstance)))
|
|
return FALSE;
|
|
|
|
wc->style = classPtr->style;
|
|
wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc,
|
|
WIN_PROC_32W );
|
|
wc->cbClsExtra = classPtr->cbClsExtra;
|
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
|
wc->hInstance = classPtr->hInstance;
|
|
wc->hIcon = (HICON32)classPtr->hIcon;
|
|
wc->hCursor = (HCURSOR32)classPtr->hCursor;
|
|
wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground;
|
|
wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
|
|
wc->lpszClassName = NULL;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfoEx16 (USER.398)
|
|
*
|
|
* FIXME: this is just a guess, I have no idea if GetClassInfoEx() is the
|
|
* same in Win16 as in Win32. --AJ
|
|
*/
|
|
BOOL16 WINAPI GetClassInfoEx16( HINSTANCE16 hInstance, SEGPTR name,
|
|
WNDCLASSEX16 *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance,PTR_SEG_TO_LIN( name ), wc);
|
|
|
|
hInstance = GetExePtr( hInstance );
|
|
if (!(atom = GlobalFindAtom16( name )) ||
|
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(hInstance != classPtr->hInstance)) return FALSE;
|
|
wc->style = classPtr->style;
|
|
wc->lpfnWndProc = WINPROC_GetProc( classPtr->winproc, WIN_PROC_16 );
|
|
wc->cbClsExtra = (INT16)classPtr->cbClsExtra;
|
|
wc->cbWndExtra = (INT16)classPtr->cbWndExtra;
|
|
wc->hInstance = (HINSTANCE16)classPtr->hInstance;
|
|
wc->hIcon = classPtr->hIcon;
|
|
wc->hIconSm = classPtr->hIconSm;
|
|
wc->hCursor = classPtr->hCursor;
|
|
wc->hbrBackground = classPtr->hbrBackground;
|
|
wc->lpszClassName = (SEGPTR)0;
|
|
wc->lpszMenuName = (SEGPTR)CLASS_GetMenuNameA( classPtr );
|
|
if (HIWORD(wc->lpszMenuName)) /* Make it a SEGPTR */
|
|
wc->lpszMenuName = SEGPTR_GET( (LPSTR)wc->lpszMenuName );
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfoEx32A (USER32.212)
|
|
*/
|
|
BOOL32 WINAPI GetClassInfoEx32A( HINSTANCE32 hInstance, LPCSTR name,
|
|
WNDCLASSEX32A *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance, name, wc);
|
|
|
|
if (!(atom = GlobalFindAtom32A( name )) ||
|
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance ))
|
|
/*|| (hInstance != classPtr->hInstance) */ ) return FALSE;
|
|
wc->style = classPtr->style;
|
|
wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc,
|
|
WIN_PROC_32A );
|
|
wc->cbClsExtra = classPtr->cbClsExtra;
|
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
|
wc->hInstance = classPtr->hInstance;
|
|
wc->hIcon = (HICON32)classPtr->hIcon;
|
|
wc->hIconSm = (HICON32)classPtr->hIconSm;
|
|
wc->hCursor = (HCURSOR32)classPtr->hCursor;
|
|
wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground;
|
|
wc->lpszMenuName = CLASS_GetMenuNameA( classPtr );
|
|
wc->lpszClassName = NULL;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* GetClassInfoEx32W (USER32.213)
|
|
*/
|
|
BOOL32 WINAPI GetClassInfoEx32W( HINSTANCE32 hInstance, LPCWSTR name,
|
|
WNDCLASSEX32W *wc )
|
|
{
|
|
ATOM atom;
|
|
CLASS *classPtr;
|
|
|
|
TRACE(class,"%x %p %p\n",hInstance, name, wc);
|
|
|
|
if (!(atom = GlobalFindAtom32W( name )) ||
|
|
!(classPtr = CLASS_FindClassByAtom( atom, hInstance )) ||
|
|
(hInstance != classPtr->hInstance)) return FALSE;
|
|
wc->style = classPtr->style;
|
|
wc->lpfnWndProc = (WNDPROC32)WINPROC_GetProc( classPtr->winproc,
|
|
WIN_PROC_32W );
|
|
wc->cbClsExtra = classPtr->cbClsExtra;
|
|
wc->cbWndExtra = classPtr->cbWndExtra;
|
|
wc->hInstance = classPtr->hInstance;
|
|
wc->hIcon = (HICON32)classPtr->hIcon;
|
|
wc->hIconSm = (HICON32)classPtr->hIconSm;
|
|
wc->hCursor = (HCURSOR32)classPtr->hCursor;
|
|
wc->hbrBackground = (HBRUSH32)classPtr->hbrBackground;
|
|
wc->lpszMenuName = CLASS_GetMenuNameW( classPtr );
|
|
wc->lpszClassName = NULL;
|
|
return TRUE;
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* ClassFirst (TOOLHELP.69)
|
|
*/
|
|
BOOL16 WINAPI ClassFirst( CLASSENTRY *pClassEntry )
|
|
{
|
|
TRACE(class,"%p\n",pClassEntry);
|
|
pClassEntry->wNext = 1;
|
|
return ClassNext( pClassEntry );
|
|
}
|
|
|
|
|
|
/***********************************************************************
|
|
* ClassNext (TOOLHELP.70)
|
|
*/
|
|
BOOL16 WINAPI ClassNext( CLASSENTRY *pClassEntry )
|
|
{
|
|
int i;
|
|
CLASS *class = firstClass;
|
|
|
|
TRACE(class,"%p\n",pClassEntry);
|
|
|
|
if (!pClassEntry->wNext) return FALSE;
|
|
for (i = 1; (i < pClassEntry->wNext) && class; i++) class = class->next;
|
|
if (!class)
|
|
{
|
|
pClassEntry->wNext = 0;
|
|
return FALSE;
|
|
}
|
|
pClassEntry->hInst = class->hInstance;
|
|
pClassEntry->wNext++;
|
|
GlobalGetAtomName32A( class->atomName, pClassEntry->szClassName,
|
|
sizeof(pClassEntry->szClassName) );
|
|
return TRUE;
|
|
}
|