diff --git a/reactos/win32ss/gdi/eng/engwindow.c b/reactos/win32ss/gdi/eng/engwindow.c index 71910bb2e74..3338076ea2e 100644 --- a/reactos/win32ss/gdi/eng/engwindow.c +++ b/reactos/win32ss/gdi/eng/engwindow.c @@ -104,7 +104,7 @@ IntEngWindowChanged( ASSERT_IRQL_LESS_OR_EQUAL(PASSIVE_LEVEL); - Clip = UserGetProp(Window, AtomWndObj); + Clip = UserGetProp(Window, AtomWndObj, TRUE); if (!Clip) { return; @@ -208,7 +208,7 @@ EngCreateWnd( 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 @@ EngDeleteWnd( else { /* Remove object from window */ - UserRemoveProp(Window, AtomWndObj); + UserRemoveProp(Window, AtomWndObj, TRUE); } --gcountPWO; diff --git a/reactos/win32ss/include/ntuser.h b/reactos/win32ss/include/ntuser.h index 22cdea82840..6e396eb6aaf 100644 --- a/reactos/win32ss/include/ntuser.h +++ b/reactos/win32ss/include/ntuser.h @@ -1029,6 +1029,8 @@ typedef struct _PROPLISTITEM HANDLE Data; } PROPLISTITEM, *PPROPLISTITEM; +#define PROPERTY_FLAG_SYSTEM 1 + typedef struct _PROPERTY { LIST_ENTRY PropListEntry; diff --git a/reactos/win32ss/user/ntuser/dde.c b/reactos/win32ss/user/ntuser/dde.c index 3850bd9d2ee..3c3a11c1965 100644 --- a/reactos/win32ss/user/ntuser/dde.c +++ b/reactos/win32ss/user/ntuser/dde.c @@ -339,7 +339,7 @@ IntDdeGetMessageHook(PMSG pMsg, LONG_PTR ExtraInfo) 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 @@ IntDdeGetMessageHook(PMSG pMsg, LONG_PTR ExtraInfo) 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 @@ IntDdeSendMessageHook(PWND pWnd, UINT Msg, WPARAM wParam, LPARAM lParam) pddeProp->spwnd = pWndServer; pddeProp->spwndPartner = pWnd; - UserSetProp(pWndServer, AtomDDETrack, (HANDLE)pddeProp); + UserSetProp(pWndServer, AtomDDETrack, (HANDLE)pddeProp, TRUE); } return TRUE; } diff --git a/reactos/win32ss/user/ntuser/defwnd.c b/reactos/win32ss/user/ntuser/defwnd.c index 044d6f6c92e..36cc914cb57 100644 --- a/reactos/win32ss/user/ntuser/defwnd.c +++ b/reactos/win32ss/user/ntuser/defwnd.c @@ -441,8 +441,8 @@ DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) 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 @@ DefWndSetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) 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 @@ DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) 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; diff --git a/reactos/win32ss/user/ntuser/layered.c b/reactos/win32ss/user/ntuser/layered.c index ff927e84566..67357549535 100644 --- a/reactos/win32ss/user/ntuser/layered.c +++ b/reactos/win32ss/user/ntuser/layered.c @@ -22,7 +22,7 @@ typedef struct _LRD_PROP 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 @@ GetLayeredStatus(PWND pWnd) 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 @@ IntSetLayeredWindowAttributes(PWND pWnd, return FALSE; } - pLrdProp = UserGetProp(pWnd, AtomLayer); + pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE); if (!pLrdProp) { @@ -68,7 +68,7 @@ IntSetLayeredWindowAttributes(PWND pWnd, return FALSE; } RtlZeroMemory(pLrdProp, sizeof(LRD_PROP)); - UserSetProp(pWnd, AtomLayer, (HANDLE)pLrdProp); + UserSetProp(pWnd, AtomLayer, (HANDLE)pLrdProp, TRUE); } if (pLrdProp) @@ -258,7 +258,7 @@ NtUserGetLayeredWindowAttributes( goto Exit; } - pLrdProp = UserGetProp(pWnd, AtomLayer); + pLrdProp = UserGetProp(pWnd, AtomLayer, TRUE); if (!pLrdProp) { diff --git a/reactos/win32ss/user/ntuser/nonclient.c b/reactos/win32ss/user/ntuser/nonclient.c index 1cf3265e2c5..00c4398a9e3 100644 --- a/reactos/win32ss/user/ntuser/nonclient.c +++ b/reactos/win32ss/user/ntuser/nonclient.c @@ -606,8 +606,8 @@ PCURICON_OBJECT FASTCALL NC_IconForWindow( PWND pWnd ) //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; diff --git a/reactos/win32ss/user/ntuser/painting.c b/reactos/win32ss/user/ntuser/painting.c index f5d82fda247..94abd8a8dd4 100644 --- a/reactos/win32ss/user/ntuser/painting.c +++ b/reactos/win32ss/user/ntuser/painting.c @@ -1189,7 +1189,7 @@ IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi) ASSERT(pfwi); - FlashState = (DWORD)UserGetProp(pWnd, AtomFlashWndState); + FlashState = (DWORD)UserGetProp(pWnd, AtomFlashWndState, TRUE); if (FlashState == FLASHW_FINISHED) { @@ -1267,7 +1267,7 @@ IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi) 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 @@ IntFlashWindowEx(PWND pWnd, PFLASHWINFO pfwi) 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; } diff --git a/reactos/win32ss/user/ntuser/prop.c b/reactos/win32ss/user/ntuser/prop.c index 4429dbe9789..e325ed45cfa 100644 --- a/reactos/win32ss/user/ntuser/prop.c +++ b/reactos/win32ss/user/ntuser/prop.c @@ -15,11 +15,13 @@ PPROPERTY 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 @@ IntGetProp( 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; + + if (Property->Atom == Atom && + (Property->fs & PROPERTY_FLAG_SYSTEM) == SystemFlag) + { + return Property; + } } - return(NULL); + 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 @@ HANDLE 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 @@ FASTCALL 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 @@ UserSetProp( return FALSE; } Prop->Atom = Atom; + Prop->fs = SystemProp ? PROPERTY_FLAG_SYSTEM : 0; InsertTailList(&Window->PropListHead, &Prop->PropListEntry); Window->PropListItems++; } @@ -171,24 +172,28 @@ NtUserBuildPropList( (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)) - { - goto Exit; - } - - BufferSize -= sizeof(PROPLISTITEM); - Cnt++; - li++; ListEntry = ListEntry->Flink; + if (!(Property->fs & PROPERTY_FLAG_SYSTEM)) + { + 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++; + } } } else { + /* FIXME: This counts user and system props */ Cnt = Window->PropListItems * sizeof(PROPLISTITEM); } @@ -228,7 +233,7 @@ NtUserRemoveProp( goto Exit; } - Data = UserRemoveProp(Window, Atom); + Data = UserRemoveProp(Window, Atom, FALSE); Exit: TRACE("Leave NtUserRemoveProp, ret=%p\n", Data); @@ -257,7 +262,7 @@ NtUserSetProp( goto Exit; } - Ret = UserSetProp(Window, Atom, Data); + Ret = UserSetProp(Window, Atom, Data, FALSE); Exit: TRACE("Leave NtUserSetProp, ret=%i\n", Ret); diff --git a/reactos/win32ss/user/ntuser/prop.h b/reactos/win32ss/user/ntuser/prop.h index 8d832748b05..7c5beb8703b 100644 --- a/reactos/win32ss/user/ntuser/prop.h +++ b/reactos/win32ss/user/ntuser/prop.h @@ -4,13 +4,15 @@ HANDLE 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 @@ FASTCALL UserSetProp( _In_ PWND Window, _In_ ATOM Atom, - _In_ HANDLE Data); + _In_ HANDLE Data, + _In_ BOOLEAN SystemProp); VOID FASTCALL diff --git a/reactos/win32ss/user/ntuser/simplecall.c b/reactos/win32ss/user/ntuser/simplecall.c index 7fef2c7961b..86d9cee7415 100644 --- a/reactos/win32ss/user/ntuser/simplecall.c +++ b/reactos/win32ss/user/ntuser/simplecall.c @@ -610,7 +610,7 @@ NtUserCallHwnd( 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 @@ NtUserCallHwndParam( } 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; diff --git a/reactos/win32ss/user/ntuser/windc.c b/reactos/win32ss/user/ntuser/windc.c index 521a312b472..7427b9fe11c 100644 --- a/reactos/win32ss/user/ntuser/windc.c +++ b/reactos/win32ss/user/ntuser/windc.c @@ -967,7 +967,7 @@ UserGethWnd( HDC hdc, PWNDOBJ *pwndo) if (hWnd && (Wnd = UserGetWindowObject(hWnd))) { - Clip = (XCLIPOBJ*)UserGetProp(Wnd, AtomWndObj); + Clip = (XCLIPOBJ*)UserGetProp(Wnd, AtomWndObj, TRUE); if ( Clip && Clip->Hwnd == hWnd ) { diff --git a/reactos/win32ss/user/ntuser/window.c b/reactos/win32ss/user/ntuser/window.c index 46baca6d7fd..bcc915e4eb7 100644 --- a/reactos/win32ss/user/ntuser/window.c +++ b/reactos/win32ss/user/ntuser/window.c @@ -373,7 +373,7 @@ DWORD FASTCALL IntGetWindowContextHelpId( PWND pWnd ) do { - HelpId = (DWORD)(DWORD_PTR)UserGetProp(pWnd, gpsi->atomContextHelpIdProp); + HelpId = (DWORD)(DWORD_PTR)UserGetProp(pWnd, gpsi->atomContextHelpIdProp, TRUE); if (!HelpId) break; pWnd = IntGetParent(pWnd); } diff --git a/reactos/win32ss/user/user32/include/user32p.h b/reactos/win32ss/user/user32/include/user32p.h index 8e29ab41d05..466c0cbd77b 100644 --- a/reactos/win32ss/user/user32/include/user32p.h +++ b/reactos/win32ss/user/user32/include/user32p.h @@ -133,7 +133,7 @@ BOOL UserDrawSysMenuButton( HWND hWnd, HDC hDC, LPRECT, BOOL down ); 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 */ diff --git a/reactos/win32ss/user/user32/windows/defwnd.c b/reactos/win32ss/user/user32/windows/defwnd.c index 9b6e1bd4da4..b255338230b 100644 --- a/reactos/win32ss/user/user32/windows/defwnd.c +++ b/reactos/win32ss/user/user32/windows/defwnd.c @@ -397,11 +397,11 @@ DefWndGetIcon(PWND pWnd, WPARAM wParam, LPARAM lParam) 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; diff --git a/reactos/win32ss/user/user32/windows/prop.c b/reactos/win32ss/user/user32/windows/prop.c index d57f4dc9e9f..ce4d130cbb5 100644 --- a/reactos/win32ss/user/user32/windows/prop.c +++ b/reactos/win32ss/user/user32/windows/prop.c @@ -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 @@ IntGetProp(HWND hWnd, ATOM Atom) 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 @@ IntGetProp(HWND hWnd, ATOM Atom) 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 @@ GetPropW(HWND hWnd, LPCWSTR lpString) { Atom = LOWORD((DWORD_PTR)lpString); } - Prop = IntGetProp(hWnd, Atom); + Prop = IntGetProp(hWnd, Atom, FALSE); if (Prop != NULL) Data = Prop->Data; return Data; }