mirror of
https://github.com/reactos/reactos.git
synced 2025-08-06 11:22:58 +00:00
[EXPLORER_NEW]
- Plug a memory leak in IDropTargetImpl - Do not allocate 64x the required space in TaskSwitchWnd_AllocTaskItem - Properly free and unregister the tray window - Fix a few more style issues svn path=/trunk/; revision=58123
This commit is contained in:
parent
b9a482f6fd
commit
6effe35b24
8 changed files with 78 additions and 70 deletions
|
@ -62,6 +62,9 @@ static VOID
|
||||||
IDropTargetImpl_Free(IDropTargetImpl *This)
|
IDropTargetImpl_Free(IDropTargetImpl *This)
|
||||||
{
|
{
|
||||||
IDropTargetHelper_Release(This->DropTargetHelper);
|
IDropTargetHelper_Release(This->DropTargetHelper);
|
||||||
|
HeapFree(hProcessHeap,
|
||||||
|
0,
|
||||||
|
This);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ULONG STDMETHODCALLTYPE
|
static ULONG STDMETHODCALLTYPE
|
||||||
|
@ -127,7 +130,7 @@ CreateDropTarget(IN HWND hwndTarget,
|
||||||
IDropTargetImpl *This;
|
IDropTargetImpl *This;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
This = (IDropTargetImpl *)HeapAlloc(hProcessHeap,
|
This = HeapAlloc(hProcessHeap,
|
||||||
0,
|
0,
|
||||||
FIELD_OFFSET(IDropTargetImpl,
|
FIELD_OFFSET(IDropTargetImpl,
|
||||||
Formats[nSupportedFormats]));
|
Formats[nSupportedFormats]));
|
||||||
|
@ -159,7 +162,7 @@ CreateDropTarget(IN HWND hwndTarget,
|
||||||
NULL,
|
NULL,
|
||||||
CLSCTX_INPROC_SERVER,
|
CLSCTX_INPROC_SERVER,
|
||||||
&IID_IDropTargetHelper,
|
&IID_IDropTargetHelper,
|
||||||
(PVOID)&This->DropTargetHelper);
|
(PVOID *)&This->DropTargetHelper);
|
||||||
|
|
||||||
if (!SUCCEEDED(hr))
|
if (!SUCCEEDED(hr))
|
||||||
{
|
{
|
||||||
|
|
|
@ -311,7 +311,7 @@ GetVersionInfoString(IN TCHAR *szFileName,
|
||||||
(LPVOID *)&lpTranslate,
|
(LPVOID *)&lpTranslate,
|
||||||
&cbTranslate);
|
&cbTranslate);
|
||||||
|
|
||||||
for (i = 0;i < (cbTranslate / sizeof(LANGCODEPAGE));i++)
|
for (i = 0; i < cbTranslate / sizeof(LANGCODEPAGE); i++)
|
||||||
{
|
{
|
||||||
/* If the bottom eight bits of the language id's
|
/* If the bottom eight bits of the language id's
|
||||||
match, use this version information (since this
|
match, use this version information (since this
|
||||||
|
@ -410,7 +410,11 @@ _tWinMain(IN HINSTANCE hInstance,
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Tray != NULL)
|
if (Tray != NULL)
|
||||||
|
{
|
||||||
TrayMessageLoop(Tray);
|
TrayMessageLoop(Tray);
|
||||||
|
ITrayWindow_Release(Tray);
|
||||||
|
UnregisterTrayWindowClass();
|
||||||
|
}
|
||||||
|
|
||||||
if (hShellDesktop != NULL)
|
if (hShellDesktop != NULL)
|
||||||
DesktopDestroyShellWindow(hShellDesktop);
|
DesktopDestroyShellWindow(hShellDesktop);
|
||||||
|
|
|
@ -59,7 +59,7 @@ CreateContextMenuFromShellFolderPidl(IN HWND hWndOwner,
|
||||||
hRet = IShellFolder_GetUIObjectOf(psf,
|
hRet = IShellFolder_GetUIObjectOf(psf,
|
||||||
hWndOwner,
|
hWndOwner,
|
||||||
1,
|
1,
|
||||||
(LPCITEMIDLIST*)&pidl, /* FIXME: shouldn't need a typecast! */
|
(LPCITEMIDLIST *)&pidl,
|
||||||
&IID_IContextMenu,
|
&IID_IContextMenu,
|
||||||
NULL,
|
NULL,
|
||||||
(PVOID *)&pcm);
|
(PVOID *)&pcm);
|
||||||
|
@ -82,9 +82,10 @@ CreateContextMenuFromShellFolderPidl(IN HWND hWndOwner,
|
||||||
return hPopup;
|
return hPopup;
|
||||||
}
|
}
|
||||||
|
|
||||||
IContextMenu_Release(pcm);
|
|
||||||
DestroyMenu(hPopup);
|
DestroyMenu(hPopup);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
IContextMenu_Release(pcm);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -96,7 +97,7 @@ OnStartContextMenuCommand(IN HWND hWndOwner,
|
||||||
IN PVOID pcmContext OPTIONAL,
|
IN PVOID pcmContext OPTIONAL,
|
||||||
IN PVOID Context OPTIONAL)
|
IN PVOID Context OPTIONAL)
|
||||||
{
|
{
|
||||||
PSTARTMNU_CTMENU_CTX psmcmc = (PSTARTMNU_CTMENU_CTX)pcmContext;
|
PSTARTMNU_CTMENU_CTX psmcmc = pcmContext;
|
||||||
|
|
||||||
if (uiCmdId != 0)
|
if (uiCmdId != 0)
|
||||||
{
|
{
|
||||||
|
@ -231,7 +232,7 @@ CreateStartContextMenu(IN HWND hWndOwner,
|
||||||
hRet = IShellFolder_BindToObject(psfDesktop,
|
hRet = IShellFolder_BindToObject(psfDesktop,
|
||||||
pidlStart,
|
pidlStart,
|
||||||
NULL,
|
NULL,
|
||||||
(REFIID)&IID_IShellFolder, /* FIXME: Shouldn't require a typecast */
|
&IID_IShellFolder,
|
||||||
(PVOID*)&psfStart);
|
(PVOID*)&psfStart);
|
||||||
if (SUCCEEDED(hRet))
|
if (SUCCEEDED(hRet))
|
||||||
{
|
{
|
||||||
|
@ -255,7 +256,7 @@ CreateStartContextMenu(IN HWND hWndOwner,
|
||||||
AddStartContextMenuItems(hWndOwner,
|
AddStartContextMenuItems(hWndOwner,
|
||||||
hPopup);
|
hPopup);
|
||||||
|
|
||||||
*((PSTARTMNU_CTMENU_CTX*)ppcmContext) = psmcmc;
|
*ppcmContext = psmcmc;
|
||||||
return hPopup;
|
return hPopup;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -815,12 +816,11 @@ UpdateStartMenu(IN OUT IMenuPopup *pMenuPopup,
|
||||||
|
|
||||||
hRet = IMenuPopup_QueryInterface(pMenuPopup,
|
hRet = IMenuPopup_QueryInterface(pMenuPopup,
|
||||||
&IID_IBanneredBar,
|
&IID_IBanneredBar,
|
||||||
(PVOID)&pbb);
|
(PVOID *)&pbb);
|
||||||
if (SUCCEEDED(hRet))
|
if (SUCCEEDED(hRet))
|
||||||
{
|
{
|
||||||
hRet = IBanneredBar_SetBitmap(pbb, hbmBanner);
|
hRet = IBanneredBar_SetBitmap(pbb, hbmBanner);
|
||||||
|
|
||||||
|
|
||||||
/* Update the icon size */
|
/* Update the icon size */
|
||||||
hRet = IBanneredBar_SetIconSize(pbb,
|
hRet = IBanneredBar_SetIconSize(pbb,
|
||||||
bSmallIcons ? BMICON_SMALL : BMICON_LARGE);
|
bSmallIcons ? BMICON_SMALL : BMICON_LARGE);
|
||||||
|
|
|
@ -852,7 +852,19 @@ TaskSwitchWnd_AllocTaskItem(IN OUT PTASK_SWITCH_WND This)
|
||||||
|
|
||||||
ASSERT(This->AllocatedTaskItems >= This->TaskItemCount);
|
ASSERT(This->AllocatedTaskItems >= This->TaskItemCount);
|
||||||
|
|
||||||
if (This->TaskItemCount != 0)
|
if (This->TaskItemCount == 0)
|
||||||
|
{
|
||||||
|
This->TaskItems = HeapAlloc(hProcessHeap,
|
||||||
|
0,
|
||||||
|
TASK_ITEM_ARRAY_ALLOC * sizeof(*This->TaskItems));
|
||||||
|
if (This->TaskItems != NULL)
|
||||||
|
{
|
||||||
|
This->AllocatedTaskItems = TASK_ITEM_ARRAY_ALLOC;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
else if (This->TaskItemCount >= This->AllocatedTaskItems)
|
||||||
{
|
{
|
||||||
PTASK_ITEM NewArray;
|
PTASK_ITEM NewArray;
|
||||||
SIZE_T NewArrayLength, ActiveTaskItemIndex;
|
SIZE_T NewArrayLength, ActiveTaskItemIndex;
|
||||||
|
@ -877,18 +889,6 @@ TaskSwitchWnd_AllocTaskItem(IN OUT PTASK_SWITCH_WND This)
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
else
|
|
||||||
{
|
|
||||||
This->TaskItems = HeapAlloc(hProcessHeap,
|
|
||||||
0,
|
|
||||||
TASK_ITEM_ARRAY_ALLOC * sizeof(*This->TaskItems));
|
|
||||||
if (This->TaskItems != NULL)
|
|
||||||
{
|
|
||||||
This->AllocatedTaskItems = TASK_ITEM_ARRAY_ALLOC;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
return This->TaskItems + This->TaskItemCount++;
|
return This->TaskItems + This->TaskItemCount++;
|
||||||
}
|
}
|
||||||
|
@ -2073,7 +2073,7 @@ ForwardContextMenuMsg:
|
||||||
case WM_NCCREATE:
|
case WM_NCCREATE:
|
||||||
{
|
{
|
||||||
LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT)lParam;
|
LPCREATESTRUCT CreateStruct = (LPCREATESTRUCT)lParam;
|
||||||
This = (PTASK_SWITCH_WND)HeapAlloc(hProcessHeap,
|
This = HeapAlloc(hProcessHeap,
|
||||||
0,
|
0,
|
||||||
sizeof(*This));
|
sizeof(*This));
|
||||||
if (This == NULL)
|
if (This == NULL)
|
||||||
|
|
|
@ -239,7 +239,6 @@ SysPagerWnd_RemoveButton(IN OUT PSYS_PAGER_WND_DATA This,
|
||||||
PNOTIFY_ITEM updateItem;
|
PNOTIFY_ITEM updateItem;
|
||||||
deleteItem = *NotifyPointer;
|
deleteItem = *NotifyPointer;
|
||||||
|
|
||||||
|
|
||||||
SendMessage(This->hWndToolbar,
|
SendMessage(This->hWndToolbar,
|
||||||
TB_DELETEBUTTON,
|
TB_DELETEBUTTON,
|
||||||
deleteItem->Index,
|
deleteItem->Index,
|
||||||
|
@ -611,16 +610,16 @@ static HWND
|
||||||
CreateSysPagerWnd(IN HWND hWndParent,
|
CreateSysPagerWnd(IN HWND hWndParent,
|
||||||
IN BOOL bVisible)
|
IN BOOL bVisible)
|
||||||
{
|
{
|
||||||
PSYS_PAGER_WND_DATA TcData;
|
PSYS_PAGER_WND_DATA SpData;
|
||||||
DWORD dwStyle;
|
DWORD dwStyle;
|
||||||
HWND hWnd = NULL;
|
HWND hWnd = NULL;
|
||||||
|
|
||||||
TcData = HeapAlloc(hProcessHeap,
|
SpData = HeapAlloc(hProcessHeap,
|
||||||
0,
|
0,
|
||||||
sizeof(*TcData));
|
sizeof(*SpData));
|
||||||
if (TcData != NULL)
|
if (SpData != NULL)
|
||||||
{
|
{
|
||||||
ZeroMemory(TcData, sizeof(*TcData));
|
ZeroMemory(SpData, sizeof(*SpData));
|
||||||
|
|
||||||
/* Create the window. The tray window is going to move it to the correct
|
/* Create the window. The tray window is going to move it to the correct
|
||||||
position and resize it as needed. */
|
position and resize it as needed. */
|
||||||
|
@ -639,18 +638,20 @@ CreateSysPagerWnd(IN HWND hWndParent,
|
||||||
hWndParent,
|
hWndParent,
|
||||||
NULL,
|
NULL,
|
||||||
hExplorerInstance,
|
hExplorerInstance,
|
||||||
TcData);
|
SpData);
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd != NULL)
|
||||||
|
{
|
||||||
|
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HeapFree(hProcessHeap,
|
HeapFree(hProcessHeap,
|
||||||
0,
|
0,
|
||||||
TcData);
|
SpData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
|
||||||
|
|
||||||
return hWnd;
|
return hWnd;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1381,16 +1382,19 @@ CreateTrayClockWnd(IN HWND hWndParent,
|
||||||
hWndParent,
|
hWndParent,
|
||||||
NULL,
|
NULL,
|
||||||
hExplorerInstance,
|
hExplorerInstance,
|
||||||
(LPVOID)TcData);
|
TcData);
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd != NULL)
|
||||||
|
{
|
||||||
|
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
HeapFree(hProcessHeap,
|
HeapFree(hProcessHeap,
|
||||||
0,
|
0,
|
||||||
TcData);
|
TcData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
SetWindowTheme(hWnd, L"TrayNotify", NULL);
|
|
||||||
|
|
||||||
return hWnd;
|
return hWnd;
|
||||||
|
|
||||||
|
@ -1860,7 +1864,7 @@ CreateTrayNotifyWnd(IN OUT ITrayWindow *TrayWindow,
|
||||||
hWndTrayWindow,
|
hWndTrayWindow,
|
||||||
NULL,
|
NULL,
|
||||||
hExplorerInstance,
|
hExplorerInstance,
|
||||||
(LPVOID)TnData);
|
TnData);
|
||||||
|
|
||||||
if (hWnd == NULL)
|
if (hWnd == NULL)
|
||||||
{
|
{
|
||||||
|
|
|
@ -369,7 +369,7 @@ DisplayTrayProperties(ITrayWindow *Tray)
|
||||||
PROPSHEETPAGE psp[5];
|
PROPSHEETPAGE psp[5];
|
||||||
TCHAR szCaption[256];
|
TCHAR szCaption[256];
|
||||||
|
|
||||||
pPropInfo = (PPROPSHEET_INFO)HeapAlloc(hProcessHeap,
|
pPropInfo = HeapAlloc(hProcessHeap,
|
||||||
HEAP_ZERO_MEMORY,
|
HEAP_ZERO_MEMORY,
|
||||||
sizeof(PROPSHEET_INFO));
|
sizeof(PROPSHEET_INFO));
|
||||||
if (!pPropInfo)
|
if (!pPropInfo)
|
||||||
|
|
|
@ -2769,14 +2769,12 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
{
|
{
|
||||||
Ret = (GetMessage(&Msg,
|
Ret = GetMessage(&Msg,
|
||||||
NULL,
|
NULL,
|
||||||
0,
|
0,
|
||||||
0) != 0);
|
0);
|
||||||
|
|
||||||
if (Ret != -1)
|
if (!Ret || Ret == -1)
|
||||||
{
|
|
||||||
if (!Ret)
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (This->StartMenuBand == NULL ||
|
if (This->StartMenuBand == NULL ||
|
||||||
|
@ -2788,7 +2786,6 @@ TrayMessageLoop(IN OUT ITrayWindow *Tray)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* IShellDesktopTray
|
* IShellDesktopTray
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue