taskmgr: Use the ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
oldstable
Michael Stefaniuc 2018-07-24 00:01:16 +02:00 committed by Alexandre Julliard
parent 8e9a05110e
commit 0b88a53acd
13 changed files with 88 additions and 90 deletions

View File

@ -36,7 +36,7 @@ void OnAbout(void)
WCHAR copy[] = {'B','r','i','a','n',' ', WCHAR copy[] = {'B','r','i','a','n',' ',
'P','a','l','m','e','r',' ', 'P','a','l','m','e','r',' ',
'<','b','r','i','a','n','p','@','r','e','a','c','t','o','s','.','o','r','g','>',0}; '<','b','r','i','a','n','p','@','r','e','a','c','t','o','s','.','o','r','g','>',0};
LoadStringW( hInst, IDC_TASKMGR, appname, sizeof(appname)/sizeof(WCHAR) ); LoadStringW( hInst, IDC_TASKMGR, appname, ARRAY_SIZE( appname ));
ShellAboutW( hMainWnd, appname, copy, ShellAboutW( hMainWnd, appname, copy,
LoadImageA( hInst, (LPSTR)IDI_TASKMANAGER, IMAGE_ICON, 48, 48, LR_SHARED )); LoadImageA( hInst, (LPSTR)IDI_TASKMANAGER, IMAGE_ICON, 48, 48, LR_SHARED ));
} }

View File

@ -51,9 +51,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* the number of CPUs present in the system * the number of CPUs present in the system
*/ */
if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) { if (!GetProcessAffinityMask(hProcessAffinityHandle, &dwProcessAffinityMask, &dwSystemAffinityMask)) {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, 0); EndDialog(hDlg, 0);
LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
} }
@ -291,8 +291,8 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
if (!dwProcessAffinityMask) { if (!dwProcessAffinityMask) {
WCHAR wszErrorMsg[255]; WCHAR wszErrorMsg[255];
WCHAR wszErrorTitle[255]; WCHAR wszErrorTitle[255];
LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, sizeof(wszErrorMsg)/sizeof(WCHAR)); LoadStringW(hInst, IDS_AFFINITY_ERROR_MESSAGE, wszErrorMsg, ARRAY_SIZE(wszErrorMsg));
LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, sizeof(wszErrorTitle)/sizeof(WCHAR)); LoadStringW(hInst, IDS_AFFINITY_ERROR_TITLE, wszErrorTitle, ARRAY_SIZE(wszErrorTitle));
MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP); MessageBoxW(hDlg, wszErrorMsg, wszErrorTitle, MB_OK|MB_ICONSTOP);
return TRUE; return TRUE;
} }
@ -301,9 +301,9 @@ AffinityDialogWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
* Try to set the process affinity * Try to set the process affinity
*/ */
if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) { if (!SetProcessAffinityMask(hProcessAffinityHandle, dwProcessAffinityMask)) {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
EndDialog(hDlg, LOWORD(wParam)); EndDialog(hDlg, LOWORD(wParam));
LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
} }
@ -341,8 +341,8 @@ void ProcessPage_OnSetAffinity(void)
return; return;
hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId); hProcessAffinityHandle = OpenProcess(PROCESS_QUERY_INFORMATION|PROCESS_SET_INFORMATION, FALSE, dwProcessId);
if (!hProcessAffinityHandle) { if (!hProcessAffinityHandle) {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, sizeof(wszUnable2Access)/sizeof(WCHAR)); LoadStringW(hInst, IDS_AFFINITY_UNABLE2ACCESS, wszUnable2Access, ARRAY_SIZE(wszUnable2Access));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Access, MB_OK|MB_ICONSTOP);
return; return;
} }

View File

@ -249,10 +249,8 @@ static BOOL CALLBACK EnumWindowsProc(HWND hWnd, LPARAM lParam)
return TRUE; return TRUE;
/* Check and see if this is a top-level app window */ /* Check and see if this is a top-level app window */
if (!GetWindowTextW(hWnd, wszText, sizeof(wszText)/sizeof(WCHAR)) || if (!GetWindowTextW(hWnd, wszText, ARRAY_SIZE(wszText)) || !IsWindowVisible(hWnd) ||
!IsWindowVisible(hWnd) || (GetParent(hWnd) != NULL) || (GetWindow(hWnd, GW_OWNER) != NULL) ||
(GetParent(hWnd) != NULL) ||
(GetWindow(hWnd, GW_OWNER) != NULL) ||
(GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW)) (GetWindowLongW(hWnd, GWL_EXSTYLE) & WS_EX_TOOLWINDOW))
{ {
return TRUE; /* Skip this window */ return TRUE; /* Skip this window */
@ -415,8 +413,8 @@ static void ApplicationPageOnNotify(WPARAM wParam, LPARAM lParam)
WCHAR wszNotResponding[255]; WCHAR wszNotResponding[255];
WCHAR wszRunning[255]; WCHAR wszRunning[255];
LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, sizeof(wszNotResponding)/sizeof(WCHAR)); LoadStringW(hInst, IDS_APPLICATION_NOT_RESPONDING, wszNotResponding, ARRAY_SIZE(wszNotResponding));
LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, sizeof(wszRunning)/sizeof(WCHAR)); LoadStringW(hInst, IDS_APPLICATION_RUNNING, wszRunning, ARRAY_SIZE(wszRunning));
pnmh = (LPNMHDR) lParam; pnmh = (LPNMHDR) lParam;
pnmdi = (LV_DISPINFOW*) lParam; pnmdi = (LV_DISPINFOW*) lParam;
@ -842,8 +840,8 @@ ApplicationPageWndProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam)
WCHAR wszTask[255]; WCHAR wszTask[255];
WCHAR wszStatus[255]; WCHAR wszStatus[255];
LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, sizeof(wszTask)/sizeof(WCHAR)); LoadStringW(hInst, IDS_APPLICATION_TASK, wszTask, ARRAY_SIZE(wszTask));
LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, sizeof(wszStatus)/sizeof(WCHAR)); LoadStringW(hInst, IDS_APPLICATION_STATUS, wszStatus, ARRAY_SIZE(wszStatus));
switch (message) { switch (message) {
case WM_INITDIALOG: case WM_INITDIALOG:

View File

@ -63,31 +63,31 @@ static WCHAR wszIOOtherBytes[255];
static void load_column_headers(void) static void load_column_headers(void)
{ {
LoadStringW(hInst, IDS_IMAGENAME, wszImageName, sizeof(wszImageName)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IMAGENAME, wszImageName, ARRAY_SIZE(wszImageName));
LoadStringW(hInst, IDS_PID, wszPID, sizeof(wszPID)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PID, wszPID, ARRAY_SIZE(wszPID));
LoadStringW(hInst, IDS_USERNAME, wszUserName, sizeof(wszUserName)/sizeof(WCHAR)); LoadStringW(hInst, IDS_USERNAME, wszUserName, ARRAY_SIZE(wszUserName));
LoadStringW(hInst, IDS_SESSIONID, wszSessionID, sizeof(wszSessionID)/sizeof(WCHAR)); LoadStringW(hInst, IDS_SESSIONID, wszSessionID, ARRAY_SIZE(wszSessionID));
LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, sizeof(wszCPU)/sizeof(WCHAR)); LoadStringW(hInst, IDS_CPUUSAGE, wszCPU, ARRAY_SIZE(wszCPU));
LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, sizeof(wszCPUTime)/sizeof(WCHAR)); LoadStringW(hInst, IDS_CPUTIME, wszCPUTime, ARRAY_SIZE(wszCPUTime));
LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_MEMORYUSAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, sizeof(wszPeakMemUsage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PEAKMEMORYUSAGE, wszPeakMemUsage, ARRAY_SIZE(wszPeakMemUsage));
LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, sizeof(wszMemDelta)/sizeof(WCHAR)); LoadStringW(hInst, IDS_MEMORYUSAGEDELTA, wszMemDelta, ARRAY_SIZE(wszMemDelta));
LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, sizeof(wszPageFaults)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PAGEFAULTS, wszPageFaults, ARRAY_SIZE(wszPageFaults));
LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, sizeof(wszPFDelta)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PAGEFAULTSDELTA, wszPFDelta, ARRAY_SIZE(wszPFDelta));
LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, sizeof(wszVMSize)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIRTUALMEMORYSIZE, wszVMSize, ARRAY_SIZE(wszVMSize));
LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, sizeof(wszPagedPool)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PAGEDPOOL, wszPagedPool, ARRAY_SIZE(wszPagedPool));
LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, sizeof(wszNPPool)/sizeof(WCHAR)); LoadStringW(hInst, IDS_NONPAGEDPOOL, wszNPPool, ARRAY_SIZE(wszNPPool));
LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, sizeof(wszBasePri)/sizeof(WCHAR)); LoadStringW(hInst, IDS_BASEPRIORITY, wszBasePri, ARRAY_SIZE(wszBasePri));
LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, sizeof(wszHandles)/sizeof(WCHAR)); LoadStringW(hInst, IDS_HANDLECOUNT, wszHandles, ARRAY_SIZE(wszHandles));
LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, sizeof(wszThreads)/sizeof(WCHAR)); LoadStringW(hInst, IDS_THREADCOUNT, wszThreads, ARRAY_SIZE(wszThreads));
LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, sizeof(wszUSERObjects)/sizeof(WCHAR)); LoadStringW(hInst, IDS_USEROBJECTS, wszUSERObjects, ARRAY_SIZE(wszUSERObjects));
LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, sizeof(wszGDIObjects)/sizeof(WCHAR)); LoadStringW(hInst, IDS_GDIOBJECTS, wszGDIObjects, ARRAY_SIZE(wszGDIObjects));
LoadStringW(hInst, IDS_IOREADS, wszIOReads, sizeof(wszIOReads)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOREADS, wszIOReads, ARRAY_SIZE(wszIOReads));
LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, sizeof(wszIOWrites)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOWRITES, wszIOWrites, ARRAY_SIZE(wszIOWrites));
LoadStringW(hInst, IDS_IOOTHER, wszIOOther, sizeof(wszIOOther)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOOTHER, wszIOOther, ARRAY_SIZE(wszIOOther));
LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, sizeof(wszIOReadBytes)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOREADBYTES, wszIOReadBytes, ARRAY_SIZE(wszIOReadBytes));
LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, sizeof(wszIOWriteBytes)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOWRITEBYTES, wszIOWriteBytes, ARRAY_SIZE(wszIOWriteBytes));
LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, sizeof(wszIOOtherBytes)/sizeof(WCHAR)); LoadStringW(hInst, IDS_IOOTHERBYTES, wszIOOtherBytes, ARRAY_SIZE(wszIOOtherBytes));
} }
static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem) static int InsertColumn(int nCol, LPCWSTR lpszColumnHeading, int nFormat, int nWidth, int nSubItem)

View File

@ -113,7 +113,7 @@ static int list_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_
int index; int index;
HWND hChannelLV = user; HWND hChannelLV = user;
MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, sizeof(nameW)/sizeof(WCHAR)); MultiByteToWideChar(CP_ACP, 0, channel->name, sizeof(channel->name), nameW, ARRAY_SIZE(nameW));
lvitem.mask = LVIF_TEXT; lvitem.mask = LVIF_TEXT;
lvitem.pszText = nameW; lvitem.pszText = nameW;
@ -231,7 +231,7 @@ static void DebugChannels_OnCreate(HWND hwndDlg)
LVCOLUMNW lvc; LVCOLUMNW lvc;
WCHAR debug_channelW[255]; WCHAR debug_channelW[255];
LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, sizeof(debug_channelW)/sizeof(WCHAR)); LoadStringW(hInst, IDS_DEBUG_CHANNEL, debug_channelW, ARRAY_SIZE(debug_channelW));
lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH; lvc.mask = LVCF_FMT | LVCF_TEXT | LVCF_WIDTH;
lvc.fmt = LVCFMT_LEFT; lvc.fmt = LVCFMT_LEFT;
@ -293,8 +293,8 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
unsigned bitmask = 1 << (lhti.iSubItem - 1); unsigned bitmask = 1 << (lhti.iSubItem - 1);
struct cce_user user; struct cce_user user;
ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0])); ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, ARRAY_SIZE(name));
ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0])); ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, ARRAY_SIZE(val));
user.name = name; user.name = name;
user.value = (val[0] == 'x') ? 0 : bitmask; user.value = (val[0] == 'x') ? 0 : bitmask;
user.mask = bitmask; user.mask = bitmask;

View File

@ -57,9 +57,9 @@ void ProcessPage_OnDebug(void)
'A','e','D','e','b','u','g',0}; 'A','e','D','e','b','u','g',0};
static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0}; static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, sizeof(wszUnable2Debug)/sizeof(WCHAR)); LoadStringW(hInst, IDS_DEBUG_UNABLE2DEBUG, wszUnable2Debug, ARRAY_SIZE(wszUnable2Debug));
LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); LoadStringW(hInst, IDS_DEBUG_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0); Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++) for (Index=0; Index<Count; Index++)
@ -82,14 +82,14 @@ void ProcessPage_OnDebug(void)
if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES) if (MessageBoxW(hMainWnd, wszWarnMsg, wszWarnTitle, MB_YESNO|MB_ICONWARNING) != IDYES)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return; return;
} }
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS) if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszSubKey, 0, KEY_READ, &hKey) != ERROR_SUCCESS)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return; return;
} }
@ -97,7 +97,7 @@ void ProcessPage_OnDebug(void)
dwDebuggerSize = 260; dwDebuggerSize = 260;
if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)wstrDebugger, &dwDebuggerSize) != ERROR_SUCCESS) if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)wstrDebugger, &dwDebuggerSize) != ERROR_SUCCESS)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
RegCloseKey(hKey); RegCloseKey(hKey);
return; return;
@ -108,7 +108,7 @@ void ProcessPage_OnDebug(void)
hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL); hDebugEvent = CreateEventW(NULL, FALSE, FALSE, NULL);
if (!hDebugEvent) if (!hDebugEvent)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
return; return;
} }
@ -120,7 +120,7 @@ void ProcessPage_OnDebug(void)
si.cb = sizeof(STARTUPINFOW); si.cb = sizeof(STARTUPINFOW);
if (!CreateProcessW(NULL, wstrDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi)) if (!CreateProcessW(NULL, wstrDebugPath, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi))
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Debug, MB_OK|MB_ICONSTOP);
} }

View File

@ -38,9 +38,9 @@ static WCHAR wszUnable2Terminate[255];
static void load_message_strings(void) static void load_message_strings(void)
{ {
LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); LoadStringW(hInst, IDS_TERMINATE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, sizeof(wszUnable2Terminate)/sizeof(WCHAR)); LoadStringW(hInst, IDS_TERMINATE_UNABLE2TERMINATE, wszUnable2Terminate, ARRAY_SIZE(wszUnable2Terminate));
LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
} }
void ProcessPage_OnEndProcess(void) void ProcessPage_OnEndProcess(void)
@ -79,14 +79,14 @@ void ProcessPage_OnEndProcess(void)
if (!hProcess) if (!hProcess)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return; return;
} }
if (!TerminateProcess(hProcess, 0)) if (!TerminateProcess(hProcess, 0))
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
} }
@ -129,14 +129,14 @@ void ProcessPage_OnEndProcessTree(void)
if (!hProcess) if (!hProcess)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
return; return;
} }
if (!TerminateProcess(hProcess, 0)) if (!TerminateProcess(hProcess, 0))
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText,wszUnable2Terminate, MB_OK|MB_ICONSTOP);
} }

View File

@ -248,7 +248,7 @@ void PerfDataRefresh(void)
else else
{ {
WCHAR idleW[255]; WCHAR idleW[255];
LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, sizeof(idleW)/sizeof(WCHAR)); LoadStringW(hInst, IDS_SYSTEM_IDLE_PROCESS, idleW, ARRAY_SIZE(idleW));
lstrcpyW(pPerfData[Idx].ImageName, idleW ); lstrcpyW(pPerfData[Idx].ImageName, idleW );
} }

View File

@ -141,7 +141,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
static const WCHAR wszFormatDigit[] = {'%','u',0}; static const WCHAR wszFormatDigit[] = {'%','u',0};
WCHAR wszMemUsage[255]; WCHAR wszMemUsage[255];
LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, sizeof(wszMemUsage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_MEMORY_USAGE, wszMemUsage, ARRAY_SIZE(wszMemUsage));
/* Create the event */ /* Create the event */
hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL); hPerformancePageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);
@ -190,7 +190,7 @@ static DWORD WINAPI PerformancePageRefreshThread(void *lpParameter)
args[1] = CommitChargeLimit; args[1] = CommitChargeLimit;
FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY, FormatMessageW(FORMAT_MESSAGE_FROM_STRING|FORMAT_MESSAGE_ARGUMENT_ARRAY,
wszMemUsage, 0, 0, Text, wszMemUsage, 0, 0, Text,
sizeof(Text)/sizeof(*Text), (__ms_va_list*)args); ARRAY_SIZE(Text), (__ms_va_list*)args);
SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text); SendMessageW(hStatusWnd, SB_SETTEXTW, 2, (LPARAM)Text);
/* /*

View File

@ -44,9 +44,9 @@ static void DoSetPriority(DWORD priority)
WCHAR wszWarnTitle[255]; WCHAR wszWarnTitle[255];
WCHAR wszUnable2Change[255]; WCHAR wszUnable2Change[255];
LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, sizeof(wszWarnMsg)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PRIORITY_CHANGE_MESSAGE, wszWarnMsg, ARRAY_SIZE(wszWarnMsg));
LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, sizeof(wszWarnTitle)/sizeof(WCHAR)); LoadStringW(hInst, IDS_WARNING_TITLE, wszWarnTitle, ARRAY_SIZE(wszWarnTitle));
LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, sizeof(wszUnable2Change)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PRIORITY_UNABLE2CHANGE, wszUnable2Change, ARRAY_SIZE(wszUnable2Change));
Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0); Count = SendMessageW(hProcessPageListCtrl, LVM_GETITEMCOUNT, 0, 0);
for (Index=0; Index<Count; Index++) for (Index=0; Index<Count; Index++)
@ -74,14 +74,14 @@ static void DoSetPriority(DWORD priority)
if (!hProcess) if (!hProcess)
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
return; return;
} }
if (!SetPriorityClass(hProcess, priority)) if (!SetPriorityClass(hProcess, priority))
{ {
GetLastErrorText(wstrErrorText, sizeof(wstrErrorText)/sizeof(WCHAR)); GetLastErrorText(wstrErrorText, ARRAY_SIZE(wstrErrorText));
MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP); MessageBoxW(hMainWnd, wstrErrorText, wszUnable2Change, MB_OK|MB_ICONSTOP);
} }

View File

@ -384,8 +384,8 @@ static DWORD WINAPI ProcessPageRefreshThread(void *lpParameter)
WCHAR wszCPU_Usage[255]; WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255]; WCHAR wszProcesses[255];
LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
/* Create the event */ /* Create the event */
hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL); hProcessPageEvent = CreateEventW(NULL, TRUE, TRUE, NULL);

View File

@ -122,9 +122,9 @@ static BOOL OnCreate(HWND hWnd)
static WCHAR wszProcesses[255]; static WCHAR wszProcesses[255];
static WCHAR wszPerformance[255]; static WCHAR wszPerformance[255];
LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, sizeof(wszApplications)/sizeof(WCHAR)); LoadStringW(hInst, IDS_APPLICATIONS, wszApplications, ARRAY_SIZE(wszApplications));
LoadStringW(hInst, IDS_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, sizeof(wszPerformance)/sizeof(WCHAR)); LoadStringW(hInst, IDS_PERFORMANCE, wszPerformance, ARRAY_SIZE(wszPerformance));
SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER))); SendMessageW(hMainWnd, WM_SETICON, ICON_BIG, (LPARAM)LoadIconW(hInst, MAKEINTRESOURCEW(IDI_TASKMANAGER)));
SendMessageW(hMainWnd, WM_SETICON, ICON_SMALL, SendMessageW(hMainWnd, WM_SETICON, ICON_SMALL,
@ -501,8 +501,8 @@ static void TaskManager_OnExitMenuLoop(HWND hWnd)
WCHAR wszCPU_Usage[255]; WCHAR wszCPU_Usage[255];
WCHAR wszProcesses[255]; WCHAR wszProcesses[255];
LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, sizeof(wszProcesses)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_PROCESSES, wszProcesses, ARRAY_SIZE(wszProcesses));
bInMenuLoop = FALSE; bInMenuLoop = FALSE;
/* Update the status bar pane sizes */ /* Update the status bar pane sizes */
@ -522,7 +522,7 @@ static void TaskManager_OnMenuSelect(HWND hWnd, UINT nItemID, UINT nFlags, HMENU
{ {
WCHAR wstr[256] = {0}; WCHAR wstr[256] = {0};
LoadStringW(hInst, nItemID, wstr, sizeof(wstr)/sizeof(WCHAR)); LoadStringW(hInst, nItemID, wstr, ARRAY_SIZE(wstr));
SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr); SendMessageW(hStatusWnd, SB_SETTEXTW, 0, (LPARAM)wstr);
} }
@ -610,16 +610,16 @@ static void TaskManager_OnTabWndSelChange(void)
WCHAR wszCPUHistory[255]; WCHAR wszCPUHistory[255];
WCHAR wszShowKernelTimes[255]; WCHAR wszShowKernelTimes[255];
LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, sizeof(wszLargeIcons)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_LARGE, wszLargeIcons, ARRAY_SIZE(wszLargeIcons));
LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, sizeof(wszSmallIcons)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_SMALL, wszSmallIcons, ARRAY_SIZE(wszSmallIcons));
LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, sizeof(wszDetails)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_DETAILS, wszDetails, ARRAY_SIZE(wszDetails));
LoadStringW(hInst, IDS_WINDOWS, wszWindows, sizeof(wszWindows)/sizeof(WCHAR)); LoadStringW(hInst, IDS_WINDOWS, wszWindows, ARRAY_SIZE(wszWindows));
LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, sizeof(wszSelectColumns)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_SELECTCOLUMNS, wszSelectColumns, ARRAY_SIZE(wszSelectColumns));
LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, sizeof(wszShow16bTasks)/sizeof(WCHAR)); LoadStringW(hInst, IDS_OPTIONS_SHOW16BITTASKS, wszShow16bTasks, ARRAY_SIZE(wszShow16bTasks));
LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, sizeof(wszOneGraphAllCPU)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHALL, wszOneGraphAllCPU, ARRAY_SIZE(wszOneGraphAllCPU));
LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, sizeof(wszOneGraphPerCPU)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_CPUHISTORY_ONEGRAPHPERCPU, wszOneGraphPerCPU, ARRAY_SIZE(wszOneGraphPerCPU));
LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, sizeof(wszCPUHistory)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_CPUHISTORY, wszCPUHistory, ARRAY_SIZE(wszCPUHistory));
LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, sizeof(wszShowKernelTimes)/sizeof(WCHAR)); LoadStringW(hInst, IDS_VIEW_SHOWKERNELTIMES, wszShowKernelTimes, ARRAY_SIZE(wszShowKernelTimes));
hMenu = GetMenu(hMainWnd); hMenu = GetMenu(hMainWnd);
hViewMenu = GetSubMenu(hMenu, 2); hViewMenu = GetSubMenu(hMenu, 2);

View File

@ -140,7 +140,7 @@ BOOL TrayIcon_ShellAddTrayIcon(void)
BOOL bRetVal; BOOL bRetVal;
WCHAR wszCPU_Usage[255]; WCHAR wszCPU_Usage[255];
LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
memset(&nid, 0, sizeof(NOTIFYICONDATAW)); memset(&nid, 0, sizeof(NOTIFYICONDATAW));
@ -187,8 +187,8 @@ BOOL TrayIcon_ShellUpdateTrayIcon(void)
BOOL bRetVal; BOOL bRetVal;
WCHAR wszCPU_Usage[255]; WCHAR wszCPU_Usage[255];
LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, sizeof(wszCPU_Usage)/sizeof(WCHAR)); LoadStringW(hInst, IDS_STATUS_BAR_CPU_USAGE, wszCPU_Usage, ARRAY_SIZE(wszCPU_Usage));
memset(&nid, 0, sizeof(NOTIFYICONDATAW)); memset(&nid, 0, sizeof(NOTIFYICONDATAW));
hIcon = TrayIcon_GetProcessorUsageIcon(); hIcon = TrayIcon_GetProcessorUsageIcon();