Author: tfaber
Date: Sat Oct 10 19:50:05 2015
New Revision: 69494
URL:
http://svn.reactos.org/svn/reactos?rev=69494&view=rev
Log:
[WIN32K]
- Separate system-defined from user-defined window properties. The values stored by
win32k/user32 must not interfere with those stored by applications. Fixes various
applications (e.g. PeaZip) randomly getting their window properties overwritten by the
system
CORE-3897 #resolve
Modified:
trunk/reactos/win32ss/gdi/eng/engwindow.c
trunk/reactos/win32ss/include/ntuser.h
trunk/reactos/win32ss/user/ntuser/dde.c
trunk/reactos/win32ss/user/ntuser/defwnd.c
trunk/reactos/win32ss/user/ntuser/layered.c
trunk/reactos/win32ss/user/ntuser/nonclient.c
trunk/reactos/win32ss/user/ntuser/painting.c
trunk/reactos/win32ss/user/ntuser/prop.c
trunk/reactos/win32ss/user/ntuser/prop.h
trunk/reactos/win32ss/user/ntuser/simplecall.c
trunk/reactos/win32ss/user/ntuser/windc.c
trunk/reactos/win32ss/user/ntuser/window.c
trunk/reactos/win32ss/user/user32/include/user32p.h
trunk/reactos/win32ss/user/user32/windows/defwnd.c
trunk/reactos/win32ss/user/user32/windows/prop.c
Modified: trunk/reactos/win32ss/gdi/eng/engwindow.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/gdi/eng/engwindow.…
==============================================================================
--- trunk/reactos/win32ss/gdi/eng/engwindow.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/gdi/eng/engwindow.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -104,7 +104,7 @@
ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL);
- Clip = UserGetProp(Window, AtomWndObj);
+ Clip = UserGetProp(Window, AtomWndObj, TRUE);
if (!Clip)
{
return;
@@ -208,7 +208,7 @@
Clip->PixelFormat = iPixelFormat;
/* associate object with window */
- UserSetProp(Window, AtomWndObj, Clip);
+ UserSetProp(Window, AtomWndObj, Clip, TRUE);
++gcountPWO;
TRACE("EngCreateWnd: SUCCESS: %p!\n", WndObjUser);
@@ -253,7 +253,7 @@
else
{
/* Remove object from window */
- UserRemoveProp(Window, AtomWndObj);
+ UserRemoveProp(Window, AtomWndObj, TRUE);
}
--gcountPWO;
Modified: trunk/reactos/win32ss/include/ntuser.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/include/ntuser.h?r…
==============================================================================
--- trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/include/ntuser.h [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -1028,6 +1028,8 @@
ATOM Atom;
HANDLE Data;
} PROPLISTITEM, *PPROPLISTITEM;
+
+#define PROPERTY_FLAG_SYSTEM 1
typedef struct _PROPERTY
{
Modified: trunk/reactos/win32ss/user/ntuser/dde.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/dde.c?…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/dde.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -339,7 +339,7 @@
if (pMsg->message == WM_DDE_TERMINATE)
{
- pddeProp = (PDDE_PROP)UserGetProp(pWnd, AtomDDETrack);
+ pddeProp = (PDDE_PROP)UserGetProp(pWnd, AtomDDETrack, TRUE);
if (pddeProp)
{
pWndClient = UserGetWindowObject((HWND)pMsg->wParam);
@@ -348,7 +348,7 @@
ERR("DDE Get Client WM_DDE_TERMINATE\n");
}
- UserRemoveProp(pWnd, AtomDDETrack);
+ UserRemoveProp(pWnd, AtomDDETrack, TRUE);
ExFreePoolWithTag(pddeProp, USERTAG_DDE1);
}
return TRUE;
@@ -419,7 +419,7 @@
pddeProp->spwnd = pWndServer;
pddeProp->spwndPartner = pWnd;
- UserSetProp(pWndServer, AtomDDETrack, (HANDLE)pddeProp);
+ UserSetProp(pWndServer, AtomDDETrack, (HANDLE)pddeProp, TRUE);
}
return TRUE;
}
Modified: trunk/reactos/win32ss/user/ntuser/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/defwnd…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/defwnd.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -441,8 +441,8 @@
EngSetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
- hIconSmall = UserGetProp(pWnd, gpsi->atomIconSmProp);
- hIcon = UserGetProp(pWnd, gpsi->atomIconProp);
+ hIconSmall = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
+ hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
hIconOld = wParam == ICON_BIG ? hIcon : hIconSmall;
@@ -460,8 +460,8 @@
break;
}
- UserSetProp(pWnd, gpsi->atomIconProp, hIcon);
- UserSetProp(pWnd, gpsi->atomIconSmProp, hIconSmall);
+ UserSetProp(pWnd, gpsi->atomIconProp, hIcon, TRUE);
+ UserSetProp(pWnd, gpsi->atomIconSmProp, hIconSmall, TRUE);
if ((pWnd->style & WS_CAPTION ) == WS_CAPTION)
UserPaintCaption(pWnd, DC_ICON);
@@ -481,11 +481,11 @@
switch(wParam)
{
case ICON_BIG:
- hIconRet = UserGetProp(pWnd, gpsi->atomIconProp);
+ hIconRet = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
break;
case ICON_SMALL:
case ICON_SMALL2:
- hIconRet = UserGetProp(pWnd, gpsi->atomIconSmProp);
+ hIconRet = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
break;
default:
break;
Modified: trunk/reactos/win32ss/user/ntuser/layered.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/layere…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/layered.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/layered.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -22,7 +22,7 @@
BOOL FASTCALL
GetLayeredStatus(PWND pWnd)
{
- PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer);
+ PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
if (pLrdProp)
{
return pLrdProp->is_Layered;
@@ -33,7 +33,7 @@
BOOL FASTCALL
SetLayeredStatus(PWND pWnd, BYTE set)
{
- PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer);
+ PLRD_PROP pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
if (pLrdProp)
{
pLrdProp->is_Layered = set;
@@ -57,7 +57,7 @@
return FALSE;
}
- pLrdProp = UserGetProp(pWnd, AtomLayer);
+ pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
if (!pLrdProp)
{
@@ -68,7 +68,7 @@
return FALSE;
}
RtlZeroMemory(pLrdProp, sizeof(LRD_PROP));
- UserSetProp(pWnd, AtomLayer, (HANDLE)pLrdProp);
+ UserSetProp(pWnd, AtomLayer, (HANDLE)pLrdProp, TRUE);
}
if (pLrdProp)
@@ -258,7 +258,7 @@
goto Exit;
}
- pLrdProp = UserGetProp(pWnd, AtomLayer);
+ pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE);
if (!pLrdProp)
{
Modified: trunk/reactos/win32ss/user/ntuser/nonclient.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/noncli…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/nonclient.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -606,8 +606,8 @@
//FIXME: This is bad and we should feel bad.
//FIXME: Stop whining over wine code.
- hIcon = UserGetProp(pWnd, gpsi->atomIconSmProp);
- if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp);
+ hIcon = UserGetProp(pWnd, gpsi->atomIconSmProp, TRUE);
+ if (!hIcon) hIcon = UserGetProp(pWnd, gpsi->atomIconProp, TRUE);
if (!hIcon && pWnd->pcls->spicnSm)
return pWnd->pcls->spicnSm;
Modified: trunk/reactos/win32ss/user/ntuser/painting.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/painti…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/painting.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -1189,7 +1189,7 @@
ASSERT(pfwi);
- FlashState = (DWORD)UserGetProp(pWnd, AtomFlashWndState);
+ FlashState = (DWORD)UserGetProp(pWnd, AtomFlashWndState, TRUE);
if (FlashState == FLASHW_FINISHED)
{
@@ -1267,7 +1267,7 @@
IntKillTimer(pWnd, ID_EVENT_SYSTIMER_FLASHWIN, TRUE);
}
- UserRemoveProp(pWnd, AtomFlashWndState);
+ UserRemoveProp(pWnd, AtomFlashWndState, TRUE);
}
else
{ // Have a count and started, set timer.
@@ -1305,7 +1305,7 @@
FlashState ^= (FlashState ^ pfwi->dwFlags) & (FLASHW_MASK &
~FLASHW_TIMER);
}
FlashState = MAKELONG(LOWORD(FlashState),uCount);
- UserSetProp(pWnd, AtomFlashWndState, (HANDLE) FlashState);
+ UserSetProp(pWnd, AtomFlashWndState, (HANDLE)FlashState, TRUE);
}
return Ret;
}
Modified: trunk/reactos/win32ss/user/ntuser/prop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.c…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/prop.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -15,11 +15,13 @@
FASTCALL
IntGetProp(
_In_ PWND Window,
- _In_ ATOM Atom)
+ _In_ ATOM Atom,
+ _In_ BOOLEAN SystemProp)
{
PLIST_ENTRY ListEntry;
PPROPERTY Property;
UINT i;
+ WORD SystemFlag = SystemProp ? PROPERTY_FLAG_SYSTEM : 0;
NT_ASSERT(UserIsEntered());
ListEntry = Window->PropListHead.Flink;
@@ -27,33 +29,29 @@
for (i = 0; i < Window->PropListItems; i++)
{
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
-
- if (ListEntry == NULL)
- {
- ERR("Corrupted (or uninitialized?) property list for window %p. Prop
count %u. Atom %u.\n",
- Window, Window->PropListItems, Atom);
- return NULL;
- }
-
- if (Property->Atom == Atom)
- {
- return(Property);
- }
ListEntry = ListEntry->Flink;
- }
- return(NULL);
+
+ if (Property->Atom == Atom &&
+ (Property->fs & PROPERTY_FLAG_SYSTEM) == SystemFlag)
+ {
+ return Property;
+ }
+ }
+ NT_ASSERT(ListEntry == &Window->PropListHead);
+ return NULL;
}
HANDLE
FASTCALL
UserGetProp(
_In_ PWND Window,
- _In_ ATOM Atom)
+ _In_ ATOM Atom,
+ _In_ BOOLEAN SystemProp)
{
PPROPERTY Prop;
NT_ASSERT(UserIsEntered());
- Prop = IntGetProp(Window, Atom);
+ Prop = IntGetProp(Window, Atom, SystemProp);
return Prop ? Prop->Data : NULL;
}
@@ -62,13 +60,14 @@
FASTCALL
UserRemoveProp(
_In_ PWND Window,
- _In_ ATOM Atom)
+ _In_ ATOM Atom,
+ _In_ BOOLEAN SystemProp)
{
PPROPERTY Prop;
HANDLE Data;
NT_ASSERT(UserIsEnteredExclusive());
- Prop = IntGetProp(Window, Atom);
+ Prop = IntGetProp(Window, Atom, SystemProp);
if (Prop == NULL)
{
return NULL;
@@ -87,12 +86,13 @@
UserSetProp(
_In_ PWND Window,
_In_ ATOM Atom,
- _In_ HANDLE Data)
+ _In_ HANDLE Data,
+ _In_ BOOLEAN SystemProp)
{
PPROPERTY Prop;
NT_ASSERT(UserIsEnteredExclusive());
- Prop = IntGetProp(Window, Atom);
+ Prop = IntGetProp(Window, Atom, SystemProp);
if (Prop == NULL)
{
Prop = UserHeapAlloc(sizeof(PROPERTY));
@@ -101,6 +101,7 @@
return FALSE;
}
Prop->Atom = Atom;
+ Prop->fs = SystemProp ? PROPERTY_FLAG_SYSTEM : 0;
InsertTailList(&Window->PropListHead, &Prop->PropListEntry);
Window->PropListItems++;
}
@@ -171,24 +172,28 @@
(ListEntry != &Window->PropListHead))
{
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
- listitem.Atom = Property->Atom;
- listitem.Data = Property->Data;
-
- Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
- if (!NT_SUCCESS(Status))
+ ListEntry = ListEntry->Flink;
+ if (!(Property->fs & PROPERTY_FLAG_SYSTEM))
{
- goto Exit;
+ listitem.Atom = Property->Atom;
+ listitem.Data = Property->Data;
+
+ Status = MmCopyToCaller(li, &listitem, sizeof(PROPLISTITEM));
+ if (!NT_SUCCESS(Status))
+ {
+ goto Exit;
+ }
+
+ BufferSize -= sizeof(PROPLISTITEM);
+ Cnt++;
+ li++;
}
-
- BufferSize -= sizeof(PROPLISTITEM);
- Cnt++;
- li++;
- ListEntry = ListEntry->Flink;
}
}
else
{
+ /* FIXME: This counts user and system props */
Cnt = Window->PropListItems * sizeof(PROPLISTITEM);
}
@@ -228,7 +233,7 @@
goto Exit;
}
- Data = UserRemoveProp(Window, Atom);
+ Data = UserRemoveProp(Window, Atom, FALSE);
Exit:
TRACE("Leave NtUserRemoveProp, ret=%p\n", Data);
@@ -257,7 +262,7 @@
goto Exit;
}
- Ret = UserSetProp(Window, Atom, Data);
+ Ret = UserSetProp(Window, Atom, Data, FALSE);
Exit:
TRACE("Leave NtUserSetProp, ret=%i\n", Ret);
Modified: trunk/reactos/win32ss/user/ntuser/prop.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/prop.h…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/prop.h [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -4,13 +4,15 @@
FASTCALL
UserGetProp(
_In_ PWND Window,
- _In_ ATOM Atom);
+ _In_ ATOM Atom,
+ _In_ BOOLEAN SystemProp);
HANDLE
FASTCALL
UserRemoveProp(
_In_ PWND Window,
- _In_ ATOM Atom);
+ _In_ ATOM Atom,
+ _In_ BOOLEAN SystemProp);
_Success_(return)
BOOL
@@ -18,7 +20,8 @@
UserSetProp(
_In_ PWND Window,
_In_ ATOM Atom,
- _In_ HANDLE Data);
+ _In_ HANDLE Data,
+ _In_ BOOLEAN SystemProp);
VOID
FASTCALL
Modified: trunk/reactos/win32ss/user/ntuser/simplecall.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/simple…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/simplecall.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -610,7 +610,7 @@
return 0;
}
- HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp);
+ HelpId = (DWORD)(DWORD_PTR)UserGetProp(Window, gpsi->atomContextHelpIdProp,
TRUE);
UserLeave();
return HelpId;
@@ -666,9 +666,9 @@
}
if ( Param )
- UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param);
+ UserSetProp(Window, gpsi->atomContextHelpIdProp, (HANDLE)Param, TRUE);
else
- UserRemoveProp(Window, gpsi->atomContextHelpIdProp);
+ UserRemoveProp(Window, gpsi->atomContextHelpIdProp, TRUE);
UserLeave();
return TRUE;
Modified: trunk/reactos/win32ss/user/ntuser/windc.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/windc.…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/windc.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -967,7 +967,7 @@
if (hWnd && (Wnd = UserGetWindowObject(hWnd)))
{
- Clip = (XCLIPOBJ*)UserGetProp(Wnd, AtomWndObj);
+ Clip = (XCLIPOBJ*)UserGetProp(Wnd, AtomWndObj, TRUE);
if ( Clip && Clip->Hwnd == hWnd )
{
Modified: trunk/reactos/win32ss/user/ntuser/window.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/ntuser/window…
==============================================================================
--- trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/ntuser/window.c [iso-8859-1] Sat Oct 10 19:50:05 2015
@@ -373,7 +373,7 @@
do
{
- HelpId = (DWORD)(DWORD_PTR)UserGetProp(pWnd, gpsi->atomContextHelpIdProp);
+ HelpId = (DWORD)(DWORD_PTR)UserGetProp(pWnd, gpsi->atomContextHelpIdProp,
TRUE);
if (!HelpId) break;
pWnd = IntGetParent(pWnd);
}
Modified: trunk/reactos/win32ss/user/user32/include/user32p.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/includ…
==============================================================================
--- trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/include/user32p.h [iso-8859-1] Sat Oct 10 19:50:05
2015
@@ -133,7 +133,7 @@
HWND* WIN_ListChildren (HWND hWndparent);
VOID DeleteFrameBrushes(VOID);
BOOL WINAPI GdiValidateHandle(HGDIOBJ);
-HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom);
+HANDLE FASTCALL UserGetProp(HWND hWnd, ATOM Atom, BOOLEAN SystemProp);
BOOL WINAPI InitializeImmEntryTable(VOID);
/* EOF */
Modified: trunk/reactos/win32ss/user/user32/windows/defwnd.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/defwnd.c [iso-8859-1] Sat Oct 10 19:50:05
2015
@@ -397,11 +397,11 @@
switch(wParam)
{
case ICON_BIG:
- hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp);
+ hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconProp, TRUE);
break;
case ICON_SMALL:
case ICON_SMALL2:
- hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp);
+ hIconRet = UserGetProp(UserHMGetHandle(pWnd), gpsi->atomIconSmProp,
TRUE);
break;
default:
break;
Modified: trunk/reactos/win32ss/user/user32/windows/prop.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/win32ss/user/user32/window…
==============================================================================
--- trunk/reactos/win32ss/user/user32/windows/prop.c [iso-8859-1] (original)
+++ trunk/reactos/win32ss/user/user32/windows/prop.c [iso-8859-1] Sat Oct 10 19:50:05
2015
@@ -35,12 +35,13 @@
HANDLE
FASTCALL
-IntGetProp(HWND hWnd, ATOM Atom)
+IntGetProp(HWND hWnd, ATOM Atom, BOOLEAN SystemProp)
{
PLIST_ENTRY ListEntry, temp;
PPROPERTY Property;
PWND pWnd;
int i;
+ WORD SystemFlag = SystemProp ? PROPERTY_FLAG_SYSTEM : 0;
pWnd = ValidateHwnd(hWnd);
if (!pWnd) return NULL;
@@ -49,7 +50,8 @@
for (i = 0; i < pWnd->PropListItems; i++ )
{
Property = CONTAINING_RECORD(ListEntry, PROPERTY, PropListEntry);
- if (Property->Atom == Atom)
+ if (Property->Atom == Atom &&
+ (Property->fs & PROPERTY_FLAG_SYSTEM) == SystemFlag)
{
return(Property);
}
@@ -61,10 +63,10 @@
HANDLE
FASTCALL
-UserGetProp(HWND hWnd, ATOM Atom)
+UserGetProp(HWND hWnd, ATOM Atom, BOOLEAN SystemProp)
{
PPROPERTY Prop;
- Prop = IntGetProp(hWnd, Atom);
+ Prop = IntGetProp(hWnd, Atom, SystemProp);
return Prop ? Prop->Data : NULL;
}
@@ -383,7 +385,7 @@
{
Atom = LOWORD((DWORD_PTR)lpString);
}
- Prop = IntGetProp(hWnd, Atom);
+ Prop = IntGetProp(hWnd, Atom, FALSE);
if (Prop != NULL) Data = Prop->Data;
return Data;
}