Main Page | Class Hierarchy | Class List | File List | Class Members | File Members

winprop.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL InternalSetProp (PWND pwnd, LPWSTR pszKey, HANDLE hData, DWORD dwFlags)
HANDLE InternalRemoveProp (PWND pwnd, LPWSTR pszKey, BOOL fInternal)
NTSTATUS _BuildPropList (PWND pwnd, PROPSET aPropSet[], UINT cPropMax, PUINT pcPropNeeded)
PPROP CreateProp (PWND pwnd)
void DeleteProperties (PWND pwnd)


Function Documentation

NTSTATUS _BuildPropList PWND  pwnd,
PROPSET  aPropSet[],
UINT  cPropMax,
PUINT  pcPropNeeded
 

Definition at line 141 of file kernel/winprop.c.

References tagPROPLIST::aprop, _PROPSET::atom, tagPROP::atomKey, DWORD, tagPROP::fs, tagPROP::hData, _PROPSET::hData, tagPROPLIST::iFirstFree, NTSTATUS(), NULL, tagWND::ppropList, PROPF_INTERNAL, Status, and UINT.

Referenced by NtUserBuildPropList().

00146 { 00147 UINT i; 00148 PPROPLIST ppropList; 00149 PPROP pProp; 00150 DWORD iRetCnt = 0; // The number of Props returned 00151 DWORD iProp = 0; 00152 PPROPSET pPropSetLast = (aPropSet + cPropMax - 1); 00153 NTSTATUS Status; 00154 00155 /* 00156 * If the Window does not have a property list then we're done 00157 */ 00158 ppropList = pwnd->ppropList; 00159 if (ppropList == NULL) { 00160 *pcPropNeeded = 0; 00161 return STATUS_SUCCESS; 00162 } 00163 00164 /* 00165 * For each element in the property list enumerate it. 00166 * (only if it is not internal!) 00167 */ 00168 Status = STATUS_SUCCESS; 00169 pProp = ppropList->aprop; 00170 for (i = ppropList->iFirstFree; i > 0; i--) { 00171 00172 /* 00173 * if we run out of space in shared memory return 00174 * STATUS_BUFFER_TOO_SMALL 00175 */ 00176 if (&aPropSet[iProp] > pPropSetLast) { 00177 00178 /* 00179 * Reset to the beginning of the output 00180 * buffer so we can continue and compute 00181 * the needed space. 00182 */ 00183 iProp = 0; 00184 Status = STATUS_BUFFER_TOO_SMALL; 00185 } 00186 00187 if (!(pProp->fs & PROPF_INTERNAL)) { 00188 aPropSet[iProp].hData = pProp->hData; 00189 aPropSet[iProp].atom = pProp->atomKey; 00190 iProp++; 00191 iRetCnt++; 00192 } 00193 pProp++; 00194 } 00195 00196 /* 00197 * Return the number of PROPLISTs given back to the client 00198 */ 00199 00200 *pcPropNeeded = iRetCnt; 00201 00202 return Status; 00203 }

PPROP CreateProp PWND  pwnd  ) 
 

Definition at line 217 of file kernel/winprop.c.

References tagPROPLIST::aprop, tagPROPLIST::cEntries, DesktopAlloc(), DesktopFree, DTAG_PROPLIST, tagWND::head, tagPROPLIST::iFirstFree, NULL, tagWND::ppropList, PROP, and PROPLIST.

Referenced by InternalSetProp().

00219 { 00220 PPROPLIST ppropList; 00221 PPROP pprop; 00222 00223 if (pwnd->ppropList == NULL) { 00224 pwnd->ppropList = (PPROPLIST)DesktopAlloc(pwnd->head.rpdesk, 00225 sizeof(PROPLIST), 00226 DTAG_PROPLIST); 00227 if (pwnd->ppropList == NULL) { 00228 return NULL; 00229 } 00230 pwnd->ppropList->cEntries = 1; 00231 } else if (pwnd->ppropList->iFirstFree == pwnd->ppropList->cEntries) { 00232 ppropList = (PPROPLIST)DesktopAlloc(pwnd->head.rpdesk, 00233 sizeof(PROPLIST) + pwnd->ppropList->cEntries * sizeof(PROP), 00234 DTAG_PROPLIST); 00235 if (ppropList == NULL) { 00236 return NULL; 00237 } 00238 RtlCopyMemory(ppropList, pwnd->ppropList, sizeof(PROPLIST) + (pwnd->ppropList->cEntries - 1) * sizeof(PROP)); 00239 DesktopFree(pwnd->head.rpdesk, pwnd->ppropList); 00240 pwnd->ppropList = ppropList; 00241 pwnd->ppropList->cEntries++; 00242 } 00243 pprop = &pwnd->ppropList->aprop[pwnd->ppropList->iFirstFree]; 00244 pwnd->ppropList->iFirstFree++; 00245 00246 return pprop; 00247 }

void DeleteProperties PWND  pwnd  ) 
 

Definition at line 265 of file kernel/winprop.c.

References tagPROPLIST::aprop, DesktopFree, tagPROP::fs, tagPROP::hData, tagWND::head, tagPROPLIST::iFirstFree, NULL, tagWND::ppropList, PROPF_INTERNAL, PROPF_NOPOOL, and UINT.

Referenced by xxxFreeWindow().

00267 { 00268 PPROP pprop; 00269 UINT i; 00270 00271 UserAssert(pwnd->ppropList); 00272 00273 /* 00274 * Loop through the whole list of properties on this window. 00275 */ 00276 pprop = pwnd->ppropList->aprop; 00277 for (i = pwnd->ppropList->iFirstFree; i > 0; i--) { 00278 00279 /* 00280 * Is this an internal property? If so, free any data we allocated 00281 * for it. 00282 */ 00283 if ((pprop->fs & PROPF_INTERNAL) && !(pprop->fs & PROPF_NOPOOL)) { 00284 UserFreePool(pprop->hData); 00285 } 00286 00287 /* 00288 * Advance to the next property in the list. 00289 */ 00290 pprop++; 00291 } 00292 00293 /* 00294 * All properties gone, free the property list and clear out the 00295 * window's property list pointer. 00296 */ 00297 DesktopFree(pwnd->head.rpdesk, pwnd->ppropList); 00298 pwnd->ppropList = NULL; 00299 }

HANDLE InternalRemoveProp PWND  pwnd,
LPWSTR  pszKey,
BOOL  fInternal
 

Definition at line 98 of file kernel/winprop.c.

References _FindProp(), tagPROPLIST::aprop, tagPROP::hData, tagPROPLIST::iFirstFree, NULL, and tagWND::ppropList.

Referenced by _DdeSetQualityOfService(), _SetWindowContextHelpId(), DestroyWindowSmIcon(), MESSAGECALL(), NtUserRemoveProp(), RemoveRedirectionBitmap(), UnlinkConv(), UserAssociateHwnd(), and xxxFreeWindow().

00102 { 00103 PPROP pprop; 00104 PPROP ppropLast; 00105 HANDLE hT; 00106 00107 /* 00108 * Find the property to be removed. 00109 */ 00110 pprop = _FindProp(pwnd, pszKey, fInternal); 00111 if (pprop == NULL) 00112 return NULL; 00113 00114 /* 00115 * Remember what it was pointing at. 00116 */ 00117 hT = pprop->hData; 00118 00119 /* 00120 * Move the property at the end of the list into this slot. 00121 */ 00122 pwnd->ppropList->iFirstFree--; 00123 ppropLast = &pwnd->ppropList->aprop[pwnd->ppropList->iFirstFree]; 00124 *pprop = *ppropLast; 00125 RtlZeroMemory(ppropLast, sizeof(*ppropLast)); 00126 00127 return hT; 00128 }

BOOL InternalSetProp PWND  pwnd,
LPWSTR  pszKey,
HANDLE  hData,
DWORD  dwFlags
 

Definition at line 39 of file kernel/winprop.c.

References _FindProp(), tagPROP::atomKey, BOOL, CreateProp(), dwFlags, FALSE, tagPROP::fs, tagPROP::hData, IS_PTR, NULL, PROPF_INTERNAL, PTR_TO_ID, and TRUE.

Referenced by _DdeSetQualityOfService(), _SetWindowContextHelpId(), AddConvProp(), CkptRestore(), CreateRedirectionBitmap(), MESSAGECALL(), NtUserSetAppImeLevel(), NtUserSetProp(), UnlinkConv(), UserAssociateHwnd(), xxxCreateWindowSmIcon(), and xxxDWP_SetIcon().

00044 { 00045 PPROP pprop; 00046 00047 if (pszKey == NULL) { 00048 RIPERR0(ERROR_INVALID_PARAMETER, 00049 RIP_WARNING, 00050 "Invalid parameter \"pszKey\" (NULL) to InternalSetProp"); 00051 00052 return FALSE; 00053 } 00054 00055 /* 00056 * If no property list exists for this window, create one. 00057 */ 00058 pprop = _FindProp(pwnd, pszKey, dwFlags & PROPF_INTERNAL); 00059 if (pprop == NULL) { 00060 00061 /* 00062 * pszKey must be an atom within the server. 00063 */ 00064 UserAssert(!IS_PTR(pszKey)); 00065 00066 /* 00067 * CreateProp allocates the property and links it into the window's 00068 * property list. 00069 */ 00070 pprop = CreateProp(pwnd); 00071 if (pprop == NULL) 00072 return FALSE; 00073 00074 pprop->atomKey = PTR_TO_ID(pszKey); 00075 pprop->fs = (WORD)dwFlags; 00076 } 00077 00078 pprop->hData = hData; 00079 00080 return TRUE; 00081 }


Generated on Sat May 15 19:46:09 2004 for test by doxygen 1.3.7