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

mndstry.c File Reference

#include "precomp.h"

Go to the source code of this file.

Functions

BOOL _DestroyMenu (PMENU pMenu)


Function Documentation

BOOL _DestroyMenu PMENU  pMenu  ) 
 

Definition at line 27 of file mndstry.c.

References BOOL, tagMENU::cItems, DesktopFree, FALSE, tagMENU::head, HMFreeObject(), HMMarkObjectDestroy(), LockDesktop, MNFreeItem(), NULL, PtiCurrent, tagMENU::rgItems, tagMENU::spwndNotify, TRUE, Unlock, and UnlockDesktop.

Referenced by MNFreeItem(), NtUserDestroyMenu(), xxxDesktopThread(), xxxFreeWindow(), xxxGetSystemMenu(), xxxLoadSysDesktopMenu(), xxxSetLPITEMInfo(), xxxSetSystemMenu(), and xxxUpdatePerUserSystemParameters().

00029 { 00030 PITEM pItem; 00031 int i; 00032 PDESKTOP rpdeskLock; 00033 00034 if (pMenu == NULL) 00035 return FALSE; 00036 00037 /* 00038 * If the object is locked, just mark it for destroy and don't 00039 * free it yet. 00040 */ 00041 if (!HMMarkObjectDestroy(pMenu)) 00042 return TRUE; 00043 00044 /* 00045 * Go down the item list and free the items 00046 */ 00047 pItem = pMenu->rgItems; 00048 for (i = pMenu->cItems; i--; ++pItem) 00049 MNFreeItem(pMenu, pItem, TRUE); 00050 00051 /* 00052 * free the menu items 00053 */ 00054 if (pMenu->rgItems) 00055 DesktopFree(pMenu->head.rpdesk, pMenu->rgItems); 00056 00057 /* 00058 * Because menus are the only objects on the desktop owned 00059 * by the process and process cleanup is done after thread 00060 * cleanup, this may be the last reference to the desktop. 00061 * We must lock the desktop before unlocking 00062 * the parent desktop reference and freeing the menu to 00063 * ensure that the desktop will not be freed until after 00064 * the menu is freed. Don't use static locks because 00065 * the pti for this thread will not be valid during 00066 * process cleanup. 00067 */ 00068 rpdeskLock = NULL; 00069 LockDesktop(&rpdeskLock, pMenu->head.rpdesk, LDL_FN_DESTROYMENU, (ULONG_PTR)PtiCurrent()); 00070 00071 /* 00072 * Unlock all menu objects. 00073 */ 00074 Unlock(&pMenu->spwndNotify); 00075 00076 HMFreeObject(pMenu); 00077 00078 UnlockDesktop(&rpdeskLock, LDU_FN_DESTROYMENU, (ULONG_PTR)PtiCurrent()); 00079 00080 return TRUE; 00081 }


Generated on Sat May 15 19:44:47 2004 for test by doxygen 1.3.7