wine/windows/property.c
Alexandre Julliard c7c217b31c Release 980413
Sun Apr 12 12:22:23 1997  Andreas Mohr <100.30936@germany.net>

	* [files/drive.c]
	Fixed "no free space" problem with partition sizes between 1 and 2 GB
	(cluster_sectors may not exceed 0x40).

	* [windows/msgbox.c] [if1632/user.spec] [include/windows.h]
	Implemented MessageBoxIndirect16, corrected MSGBOXPARAMS16.

	* [loader/task.c]
	DOS environment strings may never exceed 127 chars
	-> truncate Unix environment strings if necessary.

Sun Apr 12 02:51:44 1998  Dimitrie O. Paun  <dimi@mail.cs.toronto.edu>

	* [files/*.c]
	All fprintf statements were converted to appropriate debug
	messages.

	* [tools/find_debug_channels]
	Updated comments at the beginning of the file.

Sat Apr 11 15:27:21 1998  Alexandre Julliard  <julliard@lrc.epfl.ch>

	* [loader/module.c] [loader/task.c] [scheduler/process.c]
	Moved some code around to prepare the ground for CreateProcess().

	* [memory/environ.c] [loader/task.c]
	Moved Win32 environment strings functions to environ.c.
	Unified Win16 and Win32 environment management.

	* [scheduler/handle.c] [scheduler/k32obj.c] [scheduler/*.c]
	Implemented handle inheritance and DuplicateHandle().

	* [scheduler/thread.c]
	Create a 16-bit stack for all threads.

	* [windows/dialog.c]
	Implemented DIALOGEX resource format.

Fri Apr 10 20:21:51 1998  Marcus Meissner <marcus@mud.de>

	* [configure.in][include/acconfig.h][*/*][multimedia/*]
	Cleaned up the OSS detection stuff, added some more checks for
	headerfiles/functions.
	Removed a lot of OS specific #ifdefs.
	Lots of dependend multimedia cleanups.

	* [loader/pe_image.c]
	Enhanced comment, added missing reference count increase.

	* [ole/compobj.c]
	Replaced broken StringFromGUID2 by working one.

	* [misc/winsock.c]
	SO_LINGER uses unsigned 16 bit in Win16 and Win32, but unsigned
	int (32bit) for UNIX.

	* [memory/global.c]
	Allow realloc for lockcount 1 too.

Fri Apr 10 15:27:34 1998  Morten Welinder  <terra@diku.dk>

	* [graphics/x11drv/text.c]
	Handle control characters in trace.  Ignore terminating newline.

	* [multimedia/init.c]
	(MULTIMEDIA_Init): Correct allocations.

	* [tools/examine-relay]
 	Tidy up.

	* [windows/syscolor.c]
	Change highlight colour from lightblue to lightgray.  This
	looks correct for menus.

Fri Apr 10 01:49:58 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [configure.in] [Make.rules.in]
	Add check for c2man before using it.

Fri Apr 10 02:59:21 1998  Douglas Ridgway  <ridgway@winehq.com>

	* [DEVELOPERS-HINTS]
	Simple description of adding API calls.

	* [include/wintypes.h] [include/windows.h]
	Get rid of Winelib16, avoid declaring some illegal functions in
	Winelib, add prototypes for some enhanced metafile functions, fix
	GetTextExtentPoint32 declarations.

	* [relay32/gdi32.spec] [objects/enhmetafile.c]
	Cosmetic and functional improvements.

	* [include/wincon.h] [programs/view/*]
	Fixes, improved compatibility with native compilers.

Thu Apr  9 15:48:49 1998  Ulrich Weigand <weigand@informatik.uni-erlangen.de>

	* [win32/kernel32.c]
	Implemented FT_Thunk / FT_Prolog / FT_Exit / FT_PrologPrime.
	Fixed Common32ThkLS thunk function.

	* [tools/build.c] [relay32/relay386.c] [if1632/relay.c]
	Changed relay code to allow register functions to modify stack layout.

	* [memory/selector.c]
	Implemented AllocMappedBuffer / FreeMappedBuffer.

	* [relay32/kernel32.spec] [if1632/kernel.spec] [win32/ordinals.c]
	Added names for undocumented functions.

	* [loader/module.c]
	Bugfix: LoadLibrary16 should *not* silently load 32-bit DLL.

Thu Apr  9 03:54:58 1998  Jim Peterson <jspeter@birch.ee.vt.edu>

	* [windows/keyboard.c]
	Fix an erroneous test in TranslateAccelerator{16,32} for the end
	of the accelerator table.

Thu Apr  8 20:36:28 1998  Uwe Bonnes <bon@elektron.ikp.physik.tu-darmstadt.de> 

	* [misc/crtdll.c]
	Implement getenv.

	* [misc/commdlg.c]
	Make Get[Save/Open]FileName work in most situations.

	* [misc/lstr.c]
	Use wvsprintf32A instead of vsprintf in FormatMessage32X

	* [misc/version]
	Make NT3.50 a recognised version

	* [graphics/x11drv/graphics.c]
	Change the algorithme to draw arcs

	* [loader/resource.c]
	Return an empty buffer in LoadString32A if no resource found.

	* [win32/code_page.c]
	Try harder to get the right size in MultiByteToWideChar.

	* [win32/process.c]
	Call WinExec32 for CreateProcess32A.

	* [windows/user.c]
	Install default Int0 Handler in InitApp().

Thu Apr  8 19:29:48 1998  Eric Kohl <ekohl@abo.rhein-zeitung.de>

	* [misc/imagelist.c]
	Preliminary fix for drawing selected images.
	Various improvements.

	* [controls/progress.c][include/progress.c][include/commctrl.h]
	Added progress bar messages and styles for IE4.01 (dll version 4.72)
	compatibility.
	Fixed led size problem.

	* [controls/updown.c][include/commctrl.h]
	Added UDM_GETRANGE32 and UDM_SETRANGE32.

	* [objects/oembitmaps.c][include/windows.h][include/bitmaps/*]
	Added Win95 icons and fixed Win95 cursor and restore button bug.
	Now they should be visible. Sorry!!!

	* [relay32/comctl32.spec]
	Added most missing function names.

Tue Apr  6 18:48:36 1998  Matthew Becker <mbecker@glasscity.net>

	* [objects/font.c] [if1632/gdi.spec]
	GetOutlineTextMetrics: stub

	* [objects/text.c]
	GetTextCharset should just call GetTextCharsetInfo.

	* [misc/mpr.c] [relay32/mpr.spec]
	WNetCachePassword: stub

	* [scheduler/thread.c] [relay32/user32.spec]
	AttachThreadInput: stub
	Updated documentation.

	* [objects/palette.c]
	Updated documentation.

Tue Mar 31 17:06:30 1998  James Juran <jrj120@psu.edu>

	* [*/*.c]
	Finished fixing USER32 ordinal numbers in function documentation.

Mon Mar 30 20:27:38 1998  Morten Welinder  <terra@diku.dk>

	* [misc/debugstr.c] [include/debugstr.h]
	Moved _dumpstr from relay32/relay386.c.  Improved control
	character handling.

	* [msdos/int21.c]
	Implement 215E00 -- get machine name.

	* [windows/winpos.c]
	SetWindowPos32: Make an extra sync when mapping managed
	windows.  This makes sure the reconfigure event has been
	handled.  See Mshearts' what's-your-name window.

Mon Mar 30 01:13:50 1998  Alexander V. Lukyanov <lav@long.yar.ru>

	* [Makefile.in]
	Install includes from TOPSRCDIR.
1998-04-13 12:21:30 +00:00

360 lines
9.6 KiB
C

/*
* Window properties
*
* Copyright 1995, 1996 Alexandre Julliard
*/
#include <string.h>
#include "win.h"
#include "heap.h"
#include "debug.h"
typedef struct tagPROPERTY
{
struct tagPROPERTY *next; /* Next property in window list */
HANDLE32 handle; /* User's data */
LPSTR string; /* Property string (or atom) */
} PROPERTY;
/***********************************************************************
* PROP_FindProp
*/
static PROPERTY *PROP_FindProp( HWND32 hwnd, LPCSTR str )
{
ATOM atom;
PROPERTY *prop;
WND *pWnd = WIN_FindWndPtr( hwnd );
if (!pWnd) return NULL;
if (HIWORD(str))
{
atom = GlobalFindAtom32A( str );
for (prop = pWnd->pProp; prop; prop = prop->next)
{
if (HIWORD(prop->string))
{
if (!lstrcmpi32A( prop->string, str )) return prop;
}
else if (LOWORD(prop->string) == atom) return prop;
}
}
else /* atom */
{
atom = LOWORD(str);
for (prop = pWnd->pProp; (prop); prop = prop->next)
{
if (HIWORD(prop->string))
{
if (GlobalFindAtom32A( prop->string ) == atom) return prop;
}
else if (LOWORD(prop->string) == atom) return prop;
}
}
return NULL;
}
/***********************************************************************
* GetProp16 (USER.25)
*/
HANDLE16 WINAPI GetProp16( HWND16 hwnd, LPCSTR str )
{
return (HANDLE16)GetProp32A( hwnd, str );
}
/***********************************************************************
* GetProp32A (USER32.281)
*/
HANDLE32 WINAPI GetProp32A( HWND32 hwnd, LPCSTR str )
{
PROPERTY *prop = PROP_FindProp( hwnd, str );
if (HIWORD(str))
TRACE(prop, "(%08x,'%s'): returning %08x\n",
hwnd, str, prop ? prop->handle : 0 );
else
TRACE(prop, "(%08x,#%04x): returning %08x\n",
hwnd, LOWORD(str), prop ? prop->handle : 0 );
return prop ? prop->handle : 0;
}
/***********************************************************************
* GetProp32W (USER32.282)
*/
HANDLE32 WINAPI GetProp32W( HWND32 hwnd, LPCWSTR str )
{
LPSTR strA;
HANDLE32 ret;
if (!HIWORD(str)) return GetProp32A( hwnd, (LPCSTR)(UINT32)LOWORD(str) );
strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
ret = GetProp32A( hwnd, strA );
HeapFree( GetProcessHeap(), 0, strA );
return ret;
}
/***********************************************************************
* SetProp16 (USER.26)
*/
BOOL16 WINAPI SetProp16( HWND16 hwnd, LPCSTR str, HANDLE16 handle )
{
return (BOOL16)SetProp32A( hwnd, str, handle );
}
/***********************************************************************
* SetProp32A (USER32.497)
*/
BOOL32 WINAPI SetProp32A( HWND32 hwnd, LPCSTR str, HANDLE32 handle )
{
PROPERTY *prop;
if (HIWORD(str))
TRACE(prop, "%04x '%s' %08x\n", hwnd, str, handle );
else
TRACE(prop, "%04x #%04x %08x\n",
hwnd, LOWORD(str), handle );
if (!(prop = PROP_FindProp( hwnd, str )))
{
/* We need to create it */
WND *pWnd = WIN_FindWndPtr( hwnd );
if (!pWnd) return FALSE;
if (!(prop = HeapAlloc( SystemHeap, 0, sizeof(*prop) ))) return FALSE;
if (!(prop->string = SEGPTR_STRDUP(str)))
{
HeapFree( SystemHeap, 0, prop );
return FALSE;
}
prop->next = pWnd->pProp;
pWnd->pProp = prop;
}
prop->handle = handle;
return TRUE;
}
/***********************************************************************
* SetProp32W (USER32.498)
*/
BOOL32 WINAPI SetProp32W( HWND32 hwnd, LPCWSTR str, HANDLE32 handle )
{
BOOL32 ret;
LPSTR strA;
if (!HIWORD(str))
return SetProp32A( hwnd, (LPCSTR)(UINT32)LOWORD(str), handle );
strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
ret = SetProp32A( hwnd, strA, handle );
HeapFree( GetProcessHeap(), 0, strA );
return ret;
}
/***********************************************************************
* RemoveProp16 (USER.24)
*/
HANDLE16 WINAPI RemoveProp16( HWND16 hwnd, LPCSTR str )
{
return (HANDLE16)RemoveProp32A( hwnd, str );
}
/***********************************************************************
* RemoveProp32A (USER32.442)
*/
HANDLE32 WINAPI RemoveProp32A( HWND32 hwnd, LPCSTR str )
{
ATOM atom;
HANDLE32 handle;
PROPERTY **pprop, *prop;
WND *pWnd = WIN_FindWndPtr( hwnd );
if (HIWORD(str))
TRACE(prop, "%04x '%s'\n", hwnd, str );
else
TRACE(prop, "%04x #%04x\n", hwnd, LOWORD(str));
if (!pWnd) return NULL;
if (HIWORD(str))
{
atom = GlobalFindAtom32A( str );
for (pprop=(PROPERTY**)&pWnd->pProp; (*pprop); pprop = &(*pprop)->next)
{
if (HIWORD((*pprop)->string))
{
if (!lstrcmpi32A( (*pprop)->string, str )) break;
}
else if (LOWORD((*pprop)->string) == atom) break;
}
}
else /* atom */
{
atom = LOWORD(str);
for (pprop=(PROPERTY**)&pWnd->pProp; (*pprop); pprop = &(*pprop)->next)
{
if (HIWORD((*pprop)->string))
{
if (GlobalFindAtom32A( (*pprop)->string ) == atom) break;
}
else if (LOWORD((*pprop)->string) == atom) break;
}
}
if (!*pprop) return 0;
prop = *pprop;
handle = prop->handle;
*pprop = prop->next;
SEGPTR_FREE(prop->string);
HeapFree( SystemHeap, 0, prop );
return handle;
}
/***********************************************************************
* RemoveProp32W (USER32.443)
*/
HANDLE32 WINAPI RemoveProp32W( HWND32 hwnd, LPCWSTR str )
{
LPSTR strA;
HANDLE32 ret;
if (!HIWORD(str))
return RemoveProp32A( hwnd, (LPCSTR)(UINT32)LOWORD(str) );
strA = HEAP_strdupWtoA( GetProcessHeap(), 0, str );
ret = RemoveProp32A( hwnd, strA );
HeapFree( GetProcessHeap(), 0, strA );
return ret;
}
/***********************************************************************
* PROPERTY_RemoveWindowProps
*
* Remove all properties of a window.
*/
void PROPERTY_RemoveWindowProps( WND *pWnd )
{
PROPERTY *prop, *next;
for (prop = pWnd->pProp; (prop); prop = next)
{
next = prop->next;
SEGPTR_FREE( prop->string );
HeapFree( SystemHeap, 0, prop );
}
pWnd->pProp = NULL;
}
/***********************************************************************
* EnumProps16 (USER.27)
*/
INT16 WINAPI EnumProps16( HWND16 hwnd, PROPENUMPROC16 func )
{
PROPERTY *prop, *next;
WND *pWnd;
INT16 ret = -1;
TRACE(prop, "%04x %08x\n", hwnd, (UINT32)func );
if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
for (prop = pWnd->pProp; (prop); prop = next)
{
/* Already get the next in case the callback */
/* function removes the current property. */
next = prop->next;
TRACE(prop, " Callback: handle=%08x str='%s'\n",
prop->handle, prop->string );
ret = func( hwnd, SEGPTR_GET(prop->string), prop->handle );
if (!ret) break;
}
return ret;
}
/***********************************************************************
* EnumProps32A (USER32.186)
*/
INT32 WINAPI EnumProps32A( HWND32 hwnd, PROPENUMPROC32A func )
{
return EnumPropsEx32A( hwnd, (PROPENUMPROCEX32A)func, 0 );
}
/***********************************************************************
* EnumProps32W (USER32.189)
*/
INT32 WINAPI EnumProps32W( HWND32 hwnd, PROPENUMPROC32W func )
{
return EnumPropsEx32W( hwnd, (PROPENUMPROCEX32W)func, 0 );
}
/***********************************************************************
* EnumPropsEx32A (USER32.187)
*/
INT32 WINAPI EnumPropsEx32A(HWND32 hwnd, PROPENUMPROCEX32A func, LPARAM lParam)
{
PROPERTY *prop, *next;
WND *pWnd;
INT32 ret = -1;
TRACE(prop, "%04x %08x %08lx\n",
hwnd, (UINT32)func, lParam );
if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
for (prop = pWnd->pProp; (prop); prop = next)
{
/* Already get the next in case the callback */
/* function removes the current property. */
next = prop->next;
TRACE(prop, " Callback: handle=%08x str='%s'\n",
prop->handle, prop->string );
ret = func( hwnd, prop->string, prop->handle, lParam );
if (!ret) break;
}
return ret;
}
/***********************************************************************
* EnumPropsEx32W (USER32.188)
*/
INT32 WINAPI EnumPropsEx32W(HWND32 hwnd, PROPENUMPROCEX32W func, LPARAM lParam)
{
PROPERTY *prop, *next;
WND *pWnd;
INT32 ret = -1;
TRACE(prop, "%04x %08x %08lx\n",
hwnd, (UINT32)func, lParam );
if (!(pWnd = WIN_FindWndPtr( hwnd ))) return -1;
for (prop = pWnd->pProp; (prop); prop = next)
{
/* Already get the next in case the callback */
/* function removes the current property. */
next = prop->next;
TRACE(prop, " Callback: handle=%08x str='%s'\n",
prop->handle, prop->string );
if (HIWORD(prop->string))
{
LPWSTR str = HEAP_strdupAtoW( GetProcessHeap(), 0, prop->string );
ret = func( hwnd, str, prop->handle, lParam );
HeapFree( GetProcessHeap(), 0, str );
}
else
ret = func( hwnd, (LPCWSTR)(UINT32)LOWORD( prop->string ),
prop->handle, lParam );
if (!ret) break;
}
return ret;
}