[SHELL32]

* Merge r53661.

svn path=/trunk/; revision=53662
This commit is contained in:
Amine Khaldi 2011-09-09 16:55:59 +00:00
parent d18bfcff5e
commit 859dd5c42a
2 changed files with 36 additions and 16 deletions

View file

@ -31,8 +31,41 @@ CNewMenu::CNewMenu()
szPath = NULL; szPath = NULL;
} }
CNewMenu::~CNewMenu() CNewMenu::~CNewMenu()
{ {
UnloadShellItems();
}
void CNewMenu::UnloadItem(SHELLNEW_ITEM *item)
{
// bail if the item is clearly invalid
if (NULL == item)
return;
if (NULL != item->szTarget)
free(item->szTarget);
free(item->szDesc);
free(item->szIcon);
free(item->szExt);
HeapFree(GetProcessHeap(), 0, item);
}
void CNewMenu::UnloadShellItems()
{
SHELLNEW_ITEM *pCurItem;
while (s_SnHead)
{
pCurItem = s_SnHead;
s_SnHead = s_SnHead->Next;
UnloadItem(pCurItem);
}
s_SnHead = NULL;
} }
static static
@ -87,22 +120,6 @@ GetKeyDescription(LPWSTR szKeyName, LPWSTR szResult)
return TRUE; return TRUE;
} }
void CNewMenu::UnloadItem(SHELLNEW_ITEM *item)
{
// bail if the item is clearly invalid
if (NULL == item)
return;
if (NULL != item->szTarget)
free(item->szTarget);
free(item->szDesc);
free(item->szIcon);
free(item->szExt);
HeapFree(GetProcessHeap(), 0, item);
}
CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPWSTR szKeyName) CNewMenu::SHELLNEW_ITEM *CNewMenu::LoadItem(LPWSTR szKeyName)
{ {
HKEY hKey; HKEY hKey;
@ -201,6 +218,8 @@ CNewMenu::LoadShellNewItems()
szNew[0] = 0; szNew[0] = 0;
szNew[MAX_PATH-1] = 0; szNew[MAX_PATH-1] = 0;
UnloadShellItems();
dwIndex = 0; dwIndex = 0;
do do
{ {

View file

@ -57,6 +57,7 @@ public:
~CNewMenu(); ~CNewMenu();
SHELLNEW_ITEM *LoadItem(LPWSTR szKeyName); SHELLNEW_ITEM *LoadItem(LPWSTR szKeyName);
void UnloadItem(SHELLNEW_ITEM *item); void UnloadItem(SHELLNEW_ITEM *item);
void UnloadShellItems();
BOOL LoadShellNewItems(); BOOL LoadShellNewItems();
UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu); UINT InsertShellNewItems(HMENU hMenu, UINT idFirst, UINT idMenu);
HRESULT DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi); HRESULT DoShellNewCmd(LPCMINVOKECOMMANDINFO lpcmi);