taskmgr: Replace malloc with HeapAlloc.

This commit is contained in:
Michael Stefaniuc 2008-12-08 04:07:31 +01:00 committed by Alexandre Julliard
parent 50b45a78a3
commit f3975c5a7e
18 changed files with 23 additions and 37 deletions

View File

@ -25,7 +25,6 @@
#include <commctrl.h>
#include <stdlib.h>
#include <shellapi.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <winnt.h>
#include <stdio.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
@ -173,7 +172,7 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung)
/* It is not already in the list so add it */
else
{
pAPLI = (LPAPPLICATION_PAGE_LIST_ITEM)malloc(sizeof(APPLICATION_PAGE_LIST_ITEM));
pAPLI = HeapAlloc(GetProcessHeap(), 0, sizeof(APPLICATION_PAGE_LIST_ITEM));
pAPLI->hWnd = hWnd;
pAPLI->hIcon = hIcon;
@ -212,7 +211,7 @@ static void AddOrUpdateHwnd(HWND hWnd, WCHAR *wszTitle, HICON hIcon, BOOL bHung)
ImageList_Remove(hImageListSmall, item.iItem);
SendMessage(hApplicationPageListCtrl, LVM_DELETEITEM, item.iItem, 0);
free(pAPLI);
HeapFree(GetProcessHeap(), 0, pAPLI);
bItemRemoved = TRUE;
}
}
@ -715,7 +714,8 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
hWndArray = HeapAlloc(GetProcessHeap(), 0,
sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
@ -735,7 +735,7 @@ void ApplicationPage_OnWindowsTileHorizontally(void)
}
}
TileWindows(NULL, MDITILE_HORIZONTAL, NULL, nWndCount, hWndArray);
free(hWndArray);
HeapFree(GetProcessHeap(), 0, hWndArray);
}
void ApplicationPage_OnWindowsTileVertically(void)
@ -746,7 +746,8 @@ void ApplicationPage_OnWindowsTileVertically(void)
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
hWndArray = HeapAlloc(GetProcessHeap(), 0,
sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
@ -766,7 +767,7 @@ void ApplicationPage_OnWindowsTileVertically(void)
}
TileWindows(NULL, MDITILE_VERTICAL, NULL, nWndCount, hWndArray);
free(hWndArray);
HeapFree(GetProcessHeap(), 0, hWndArray);
}
void ApplicationPage_OnWindowsMinimize(void)
@ -819,7 +820,8 @@ void ApplicationPage_OnWindowsCascade(void)
HWND* hWndArray;
int nWndCount;
hWndArray = (HWND*)malloc(sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
hWndArray = HeapAlloc(GetProcessHeap(), 0,
sizeof(HWND) * ListView_GetItemCount(hApplicationPageListCtrl));
nWndCount = 0;
for (i=0; i<ListView_GetItemCount(hApplicationPageListCtrl); i++) {
@ -837,7 +839,7 @@ void ApplicationPage_OnWindowsCascade(void)
}
}
CascadeWindows(NULL, 0, NULL, nWndCount, hWndArray);
free(hWndArray);
HeapFree(GetProcessHeap(), 0, hWndArray);
}
void ApplicationPage_OnWindowsBringToFront(void)

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>

View File

@ -26,7 +26,6 @@
#include <ctype.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -30,7 +30,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>
@ -122,10 +121,11 @@ void PerfDataRefresh(void)
return;
/* Get processor time information */
SysProcessorTimeInfo = (PSYSTEM_PROCESSORTIME_INFO)malloc(sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
SysProcessorTimeInfo = HeapAlloc(GetProcessHeap(), 0,
sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors);
status = NtQuerySystemInformation(SystemProcessorTimeInformation, SysProcessorTimeInfo, sizeof(SYSTEM_PROCESSORTIME_INFO) * SystemBasicInfo.bKeNumberProcessors, &ulSize);
if (status != NO_ERROR) {
free(SysProcessorTimeInfo);
HeapFree(GetProcessHeap(), 0, SysProcessorTimeInfo);
return;
}
@ -137,12 +137,12 @@ void PerfDataRefresh(void)
do
{
BufferSize += 0x10000;
SysHandleInfoData = (LPBYTE)malloc(BufferSize);
SysHandleInfoData = HeapAlloc(GetProcessHeap(), 0, BufferSize);
status = NtQuerySystemInformation(SystemHandleInformation, SysHandleInfoData, BufferSize, &ulSize);
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
free(SysHandleInfoData);
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
}
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
@ -155,12 +155,12 @@ void PerfDataRefresh(void)
do
{
BufferSize += 0x10000;
pBuffer = (LPBYTE)malloc(BufferSize);
pBuffer = HeapAlloc(GetProcessHeap(), 0, BufferSize);
status = NtQuerySystemInformation(SystemProcessInformation, pBuffer, BufferSize, &ulSize);
if (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/) {
free(pBuffer);
HeapFree(GetProcessHeap(), 0, pBuffer);
}
} while (status == 0xC0000004 /*STATUS_INFO_LENGTH_MISMATCH*/);
@ -180,14 +180,14 @@ void PerfDataRefresh(void)
/*
* Save system processor time info
*/
free(SystemProcessorTimeInfo);
HeapFree(GetProcessHeap(), 0, SystemProcessorTimeInfo);
SystemProcessorTimeInfo = SysProcessorTimeInfo;
/*
* Save system handle info
*/
memcpy(&SystemHandleInfo, SysHandleInfoData, sizeof(SYSTEM_HANDLE_INFORMATION));
free(SysHandleInfoData);
HeapFree(GetProcessHeap(), 0, SysHandleInfoData);
for (CurrentKernelTime=0, Idx=0; Idx<SystemBasicInfo.bKeNumberProcessors; Idx++) {
CurrentKernelTime += Li2Double(SystemProcessorTimeInfo[Idx].KernelTime);
@ -231,9 +231,9 @@ void PerfDataRefresh(void)
}
/* Now alloc a new PERFDATA array and fill in the data */
free(pPerfDataOld);
HeapFree(GetProcessHeap(), 0, pPerfDataOld);
pPerfDataOld = pPerfData;
pPerfData = (PPERFDATA)malloc(sizeof(PERFDATA) * ProcessCount);
pPerfData = HeapAlloc(GetProcessHeap(), 0, sizeof(PERFDATA) * ProcessCount);
pSPI = (PSYSTEM_PROCESS_INFORMATION)pBuffer;
for (Idx=0; Idx<ProcessCount; Idx++) {
/* Get the old perf data for this process (if any) */
@ -321,7 +321,7 @@ int MultiByteToWideChar(
pPerfData[Idx].KernelTime.QuadPart = pSPI->KernelTime.QuadPart;
pSPI = (PSYSTEM_PROCESS_INFORMATION)((LPBYTE)pSPI + pSPI->RelativeOffset);
}
free(pBuffer);
HeapFree(GetProcessHeap(), 0, pBuffer);
LeaveCriticalSection(&PerfDataCriticalSection);
}

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <tchar.h>
#include <stdio.h>

View File

@ -25,7 +25,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>

View File

@ -24,7 +24,6 @@
#include <windows.h>
#include <commctrl.h>
#include <stdlib.h>
#include <malloc.h>
#include <memory.h>
#include <stdio.h>
#include <winnt.h>