mirror of
git://source.winehq.org/git/wine.git
synced 2024-10-31 12:54:13 +00:00
taskmgr: Finish partial unicode conversion of process page.
This commit is contained in:
parent
a0449a5f64
commit
fc888d6835
5 changed files with 101 additions and 112 deletions
|
@ -108,7 +108,7 @@ static DWORD get_selected_pid(void)
|
|||
static int list_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_channel* channel, void* user)
|
||||
{
|
||||
int j;
|
||||
char val[2];
|
||||
WCHAR val[2];
|
||||
LVITEMA lvitem;
|
||||
int index;
|
||||
HWND hChannelLV = user;
|
||||
|
@ -125,7 +125,7 @@ static int list_channel_CB(HANDLE hProcess, void* addr, struct __wine_debug_
|
|||
for (j = 0; j < 4; j++)
|
||||
{
|
||||
val[0] = (channel->flags & (1 << j)) ? 'x' : ' ';
|
||||
ListView_SetItemText(hChannelLV, index, j + 1, val);
|
||||
ListView_SetItemTextW(hChannelLV, index, j + 1, val);
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
@ -290,13 +290,13 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
|
|||
SendMessage(hChannelLV, LVM_SUBITEMHITTEST, 0, (LPARAM)&lhti);
|
||||
if (nmia->iSubItem >= 1 && nmia->iSubItem <= 4)
|
||||
{
|
||||
TCHAR val[2];
|
||||
TCHAR name[32];
|
||||
WCHAR val[2];
|
||||
char name[32];
|
||||
unsigned bitmask = 1 << (lhti.iSubItem - 1);
|
||||
struct cce_user user;
|
||||
|
||||
ListView_GetItemText(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0]));
|
||||
ListView_GetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
|
||||
ListView_GetItemTextA(hChannelLV, lhti.iItem, 0, name, sizeof(name) / sizeof(name[0]));
|
||||
ListView_GetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val, sizeof(val) / sizeof(val[0]));
|
||||
user.name = name;
|
||||
user.value = (val[0] == 'x') ? 0 : bitmask;
|
||||
user.mask = bitmask;
|
||||
|
@ -305,7 +305,7 @@ static void DebugChannels_OnNotify(HWND hDlg, LPARAM lParam)
|
|||
if (user.done)
|
||||
{
|
||||
val[0] ^= ('x' ^ ' ');
|
||||
ListView_SetItemText(hChannelLV, lhti.iItem, lhti.iSubItem, val);
|
||||
ListView_SetItemTextW(hChannelLV, lhti.iItem, lhti.iSubItem, val);
|
||||
}
|
||||
if (user.notdone)
|
||||
printf("Some channel instances weren't correctly set\n");
|
||||
|
|
|
@ -54,10 +54,13 @@ static PSYSTEM_PROCESSORTIME_INFO SystemProcessorTimeInfo = NULL;
|
|||
BOOL PerfDataInitialize(void)
|
||||
{
|
||||
LONG status;
|
||||
static const WCHAR wszNtdll[] = {'n','t','d','l','l','.','d','l','l',0};
|
||||
static const WCHAR wszUser32[] = {'u','s','e','r','3','2','.','d','l','l',0};
|
||||
static const WCHAR wszKernel32[] = {'k','e','r','n','e','l','3','2','.','d','l','l',0};
|
||||
|
||||
NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandle(_T("ntdll.dll")), "NtQuerySystemInformation");
|
||||
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandle(_T("user32.dll")), "GetGuiResources");
|
||||
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandle(_T("kernel32.dll")), "GetProcessIoCounters");
|
||||
NtQuerySystemInformation = (PROCNTQSI)GetProcAddress(GetModuleHandleW(wszNtdll), "NtQuerySystemInformation");
|
||||
pGetGuiResources = (PROCGGR)GetProcAddress(GetModuleHandleW(wszUser32), "GetGuiResources");
|
||||
pGetProcessIoCounters = (PROCGPIC)GetProcAddress(GetModuleHandleW(wszKernel32), "GetProcessIoCounters");
|
||||
|
||||
InitializeCriticalSection(&PerfDataCriticalSection);
|
||||
|
||||
|
@ -92,7 +95,7 @@ void PerfDataRefresh(void)
|
|||
ULONG Idx, Idx2;
|
||||
HANDLE hProcess;
|
||||
HANDLE hProcessToken;
|
||||
TCHAR szTemp[MAX_PATH];
|
||||
WCHAR wszTemp[MAX_PATH];
|
||||
DWORD dwSize;
|
||||
SYSTEM_PERFORMANCE_INFORMATION SysPerfInfo;
|
||||
SYSTEM_TIME_INFORMATION SysTimeInfo;
|
||||
|
@ -291,22 +294,9 @@ void PerfDataRefresh(void)
|
|||
if (hProcess) {
|
||||
if (OpenProcessToken(hProcess, TOKEN_QUERY|TOKEN_DUPLICATE|TOKEN_IMPERSONATE, &hProcessToken)) {
|
||||
ImpersonateLoggedOnUser(hProcessToken);
|
||||
memset(szTemp, 0, sizeof(TCHAR[MAX_PATH]));
|
||||
memset(wszTemp, 0, sizeof(wszTemp));
|
||||
dwSize = MAX_PATH;
|
||||
GetUserName(szTemp, &dwSize);
|
||||
#ifndef UNICODE
|
||||
MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szTemp, -1, pPerfData[Idx].UserName, MAX_PATH);
|
||||
/*
|
||||
int MultiByteToWideChar(
|
||||
UINT CodePage, // code page
|
||||
DWORD dwFlags, // character-type options
|
||||
LPCSTR lpMultiByteStr, // string to map
|
||||
int cbMultiByte, // number of bytes in string
|
||||
LPWSTR lpWideCharStr, // wide-character buffer
|
||||
int cchWideChar // size of buffer
|
||||
);
|
||||
*/
|
||||
#endif
|
||||
GetUserNameW(wszTemp, &dwSize);
|
||||
RevertToSelf();
|
||||
CloseHandle(hProcessToken);
|
||||
}
|
||||
|
@ -349,19 +339,14 @@ ULONG PerfDataGetProcessorSystemUsage(void)
|
|||
return (ULONG)dbKernelTime;
|
||||
}
|
||||
|
||||
BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount)
|
||||
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount)
|
||||
{
|
||||
BOOL bSuccessful;
|
||||
|
||||
EnterCriticalSection(&PerfDataCriticalSection);
|
||||
|
||||
if (Index < ProcessCount) {
|
||||
#ifdef _UNICODE
|
||||
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
|
||||
#else
|
||||
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].ImageName, -1, lpImageName, nMaxCount, NULL, NULL);
|
||||
#endif
|
||||
|
||||
wcsncpy(lpImageName, pPerfData[Index].ImageName, nMaxCount);
|
||||
bSuccessful = TRUE;
|
||||
} else {
|
||||
bSuccessful = FALSE;
|
||||
|
@ -386,19 +371,14 @@ ULONG PerfDataGetProcessId(ULONG Index)
|
|||
return ProcessId;
|
||||
}
|
||||
|
||||
BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount)
|
||||
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, int nMaxCount)
|
||||
{
|
||||
BOOL bSuccessful;
|
||||
|
||||
EnterCriticalSection(&PerfDataCriticalSection);
|
||||
|
||||
if (Index < ProcessCount) {
|
||||
#ifdef _UNICODE
|
||||
wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount);
|
||||
#else
|
||||
WideCharToMultiByte(CP_ACP, 0, pPerfData[Index].UserName, -1, lpUserName, nMaxCount, NULL, NULL);
|
||||
#endif
|
||||
|
||||
wcsncpy(lpUserName, pPerfData[Index].UserName, nMaxCount);
|
||||
bSuccessful = TRUE;
|
||||
} else {
|
||||
bSuccessful = FALSE;
|
||||
|
|
|
@ -37,7 +37,6 @@ typedef struct _TIME {
|
|||
|
||||
typedef ULARGE_INTEGER TIME, *PTIME;
|
||||
|
||||
/* typedef WCHAR UNICODE_STRING; */
|
||||
typedef struct _UNICODE_STRING {
|
||||
USHORT Length;
|
||||
USHORT MaximumLength;
|
||||
|
@ -347,9 +346,9 @@ ULONG PerfDataGetProcessCount(void);
|
|||
ULONG PerfDataGetProcessorUsage(void);
|
||||
ULONG PerfDataGetProcessorSystemUsage(void);
|
||||
|
||||
BOOL PerfDataGetImageName(ULONG Index, LPTSTR lpImageName, int nMaxCount);
|
||||
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, int nMaxCount);
|
||||
ULONG PerfDataGetProcessId(ULONG Index);
|
||||
BOOL PerfDataGetUserName(ULONG Index, LPTSTR lpUserName, int nMaxCount);
|
||||
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, int nMaxCount);
|
||||
ULONG PerfDataGetSessionId(ULONG Index);
|
||||
ULONG PerfDataGetCPUUsage(ULONG Index);
|
||||
TIME PerfDataGetCPUTime(ULONG Index);
|
||||
|
|
|
@ -47,20 +47,21 @@ static int nProcessPageHeight;
|
|||
static HANDLE hProcessPageEvent = NULL; /* When this event becomes signaled then we refresh the process list */
|
||||
|
||||
|
||||
static void CommaSeparateNumberString(LPTSTR strNumber, int nMaxCount)
|
||||
static void CommaSeparateNumberString(LPWSTR strNumber, int nMaxCount)
|
||||
{
|
||||
TCHAR temp[260];
|
||||
WCHAR temp[260];
|
||||
UINT i, j, k;
|
||||
int len = lstrlenW(strNumber);
|
||||
|
||||
for (i=0,j=0; i<(_tcslen(strNumber) % 3); i++, j++)
|
||||
temp[j] = strNumber[i];
|
||||
for (k=0; i<_tcslen(strNumber); i++,j++,k++) {
|
||||
for (i=0; i < len % 3; i++)
|
||||
temp[i] = strNumber[i];
|
||||
for (k=0,j=i; i < len; i++,j++,k++) {
|
||||
if ((k % 3 == 0) && (j > 0))
|
||||
temp[j++] = _T(',');
|
||||
temp[j++] = ',';
|
||||
temp[j] = strNumber[i];
|
||||
}
|
||||
temp[j] = _T('\0');
|
||||
_tcsncpy(strNumber, temp, nMaxCount);
|
||||
temp[j++] = 0;
|
||||
memcpy(strNumber, temp, min(nMaxCount, j) * sizeof(WCHAR));
|
||||
}
|
||||
|
||||
static void ProcessPageShowContextMenu(DWORD dwProcessId)
|
||||
|
@ -69,13 +70,19 @@ static void ProcessPageShowContextMenu(DWORD dwProcessId)
|
|||
HMENU hSubMenu;
|
||||
HMENU hPriorityMenu;
|
||||
POINT pt;
|
||||
SYSTEM_INFO si;
|
||||
HANDLE hProcess;
|
||||
SYSTEM_INFO si;
|
||||
HANDLE hProcess;
|
||||
DWORD dwProcessPriorityClass;
|
||||
TCHAR strDebugger[260];
|
||||
WCHAR strDebugger[260];
|
||||
DWORD dwDebuggerSize;
|
||||
HKEY hKey;
|
||||
UINT Idx;
|
||||
HKEY hKey;
|
||||
UINT Idx;
|
||||
static const WCHAR wszAeDebugRegPath[] = {
|
||||
'S','o','f','t','w','a','r','e','\\',
|
||||
'M','i','c','r','o','s','o','f','t','\\',
|
||||
'W','i','n','d','o','w','s',' ','N','T','\\',
|
||||
'C','u','r','r','e','n','t','V','e','r','s','i','o','n','\\',
|
||||
'A','e','D','e','b','u','g',0};
|
||||
|
||||
memset(&si, 0, sizeof(SYSTEM_INFO));
|
||||
|
||||
|
@ -117,15 +124,17 @@ static void ProcessPageShowContextMenu(DWORD dwProcessId)
|
|||
break;
|
||||
}
|
||||
|
||||
if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, _T("Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug"), 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
if (RegOpenKeyExW(HKEY_LOCAL_MACHINE, wszAeDebugRegPath, 0, KEY_READ, &hKey) == ERROR_SUCCESS)
|
||||
{
|
||||
static const WCHAR wszDebugger[] = {'D','e','b','u','g','g','e','r',0};
|
||||
dwDebuggerSize = 260;
|
||||
if (RegQueryValueEx(hKey, _T("Debugger"), NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
|
||||
if (RegQueryValueExW(hKey, wszDebugger, NULL, NULL, (LPBYTE)strDebugger, &dwDebuggerSize) == ERROR_SUCCESS)
|
||||
{
|
||||
for (Idx=0; Idx<_tcslen(strDebugger); Idx++)
|
||||
static const WCHAR wszDRWTSN32[] = {'D','R','W','T','S','N','3','2',0};
|
||||
for (Idx=0; Idx < lstrlenW(strDebugger); Idx++)
|
||||
strDebugger[Idx] = toupper(strDebugger[Idx]);
|
||||
|
||||
if (_tcsstr(strDebugger, _T("DRWTSN32")))
|
||||
if (wcsstr(strDebugger, wszDRWTSN32))
|
||||
EnableMenuItem(hSubMenu, ID_PROCESS_PAGE_DEBUG, MF_BYCOMMAND|MF_DISABLED|MF_GRAYED);
|
||||
}
|
||||
else
|
||||
|
@ -143,20 +152,23 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
int idctrl;
|
||||
LPNMHDR pnmh;
|
||||
LPNMLISTVIEW pnmv;
|
||||
NMLVDISPINFO* pnmdi;
|
||||
LPNMHEADER pnmhdr;
|
||||
LVITEM lvitem;
|
||||
ULONG Index;
|
||||
ULONG ColumnIndex;
|
||||
LPNMLISTVIEW pnmv;
|
||||
NMLVDISPINFOW* pnmdi;
|
||||
LPNMHEADERW pnmhdr;
|
||||
LVITEM lvitem;
|
||||
ULONG Index;
|
||||
ULONG ColumnIndex;
|
||||
IO_COUNTERS iocounters;
|
||||
TIME time;
|
||||
TIME time;
|
||||
static const WCHAR wszFmtD[] = {'%','d',0};
|
||||
static const WCHAR wszFmt02D[] = {'%','0','2','d',0};
|
||||
static const WCHAR wszUnitK[] = {' ','K',0};
|
||||
|
||||
idctrl = (int) wParam;
|
||||
pnmh = (LPNMHDR) lParam;
|
||||
pnmv = (LPNMLISTVIEW) lParam;
|
||||
pnmdi = (NMLVDISPINFO*) lParam;
|
||||
pnmhdr = (LPNMHEADER) lParam;
|
||||
pnmdi = (NMLVDISPINFOW*) lParam;
|
||||
pnmhdr = (LPNMHEADERW) lParam;
|
||||
|
||||
if (pnmh->hwndFrom == hProcessPageListCtrl)
|
||||
{
|
||||
|
@ -168,7 +180,7 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
break;
|
||||
#endif
|
||||
|
||||
case LVN_GETDISPINFO:
|
||||
case LVN_GETDISPINFOW:
|
||||
|
||||
if (!(pnmdi->item.mask & LVIF_TEXT))
|
||||
break;
|
||||
|
@ -179,139 +191,136 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
if (ColumnDataHints[ColumnIndex] == COLUMN_IMAGENAME)
|
||||
PerfDataGetImageName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_PID)
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetProcessId(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetProcessId(Index));
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_USERNAME)
|
||||
PerfDataGetUserName(Index, pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_SESSIONID)
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetSessionId(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetSessionId(Index));
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_CPUUSAGE)
|
||||
wsprintf(pnmdi->item.pszText, _T("%02d"), PerfDataGetCPUUsage(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmt02D, PerfDataGetCPUUsage(Index));
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_CPUTIME)
|
||||
{
|
||||
DWORD dwHours;
|
||||
DWORD dwMinutes;
|
||||
DWORD dwSeconds;
|
||||
ULONGLONG secs;
|
||||
static const WCHAR timefmt[] = {'%','d',':','%','0','2','d',':','%','0','2','d',0};
|
||||
|
||||
time = PerfDataGetCPUTime(Index);
|
||||
secs = time.QuadPart / 10000000;
|
||||
dwHours = secs / 3600;
|
||||
dwMinutes = (secs % 3600) / 60;
|
||||
dwSeconds = (secs % 3600) % 60;
|
||||
wsprintf(pnmdi->item.pszText, _T("%d:%02d:%02d"), dwHours, dwMinutes, dwSeconds);
|
||||
wsprintfW(pnmdi->item.pszText, timefmt, dwHours, dwMinutes, dwSeconds);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGE)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeBytes(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeBytes(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_PEAKMEMORYUSAGE)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPeakWorkingSetSizeBytes(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_MEMORYUSAGEDELTA)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetWorkingSetSizeDelta(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetWorkingSetSizeDelta(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTS)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCount(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCount(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEFAULTSDELTA)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPageFaultCountDelta(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPageFaultCountDelta(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_VIRTUALMEMORYSIZE)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetVirtualMemorySizeBytes(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_PAGEDPOOL)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetPagedPoolUsagePages(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetPagedPoolUsagePages(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_NONPAGEDPOOL)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetNonPagedPoolUsagePages(Index) / 1024);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
_tcscat(pnmdi->item.pszText, _T(" K"));
|
||||
wcscat(pnmdi->item.pszText, wszUnitK);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_BASEPRIORITY)
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetBasePriority(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetBasePriority(Index));
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_HANDLECOUNT)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetHandleCount(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetHandleCount(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_THREADCOUNT)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetThreadCount(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetThreadCount(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_USEROBJECTS)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetUSERObjectCount(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetUSERObjectCount(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_GDIOBJECTS)
|
||||
{
|
||||
wsprintf(pnmdi->item.pszText, _T("%d"), PerfDataGetGDIObjectCount(Index));
|
||||
wsprintfW(pnmdi->item.pszText, wszFmtD, PerfDataGetGDIObjectCount(Index));
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADS)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadOperationCount); */
|
||||
#ifdef UNICODE
|
||||
#define _ui64toa _ui64tow
|
||||
#else
|
||||
#endif
|
||||
_ui64toa(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadOperationCount); */
|
||||
_ui64tow(iocounters.ReadOperationCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITES)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteOperationCount); */
|
||||
_ui64toa(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteOperationCount); */
|
||||
_ui64tow(iocounters.WriteOperationCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHER)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherOperationCount); */
|
||||
_ui64toa(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherOperationCount); */
|
||||
_ui64tow(iocounters.OtherOperationCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOREADBYTES)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.ReadTransferCount); */
|
||||
_ui64toa(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.ReadTransferCount); */
|
||||
_ui64tow(iocounters.ReadTransferCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOWRITEBYTES)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.WriteTransferCount); */
|
||||
_ui64toa(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.WriteTransferCount); */
|
||||
_ui64tow(iocounters.WriteTransferCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
if (ColumnDataHints[ColumnIndex] == COLUMN_IOOTHERBYTES)
|
||||
{
|
||||
PerfDataGetIOCounters(Index, &iocounters);
|
||||
/* wsprintf(pnmdi->item.pszText, _T("%d"), iocounters.OtherTransferCount); */
|
||||
_ui64toa(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
|
||||
/* wsprintfW(pnmdi->item.pszText, wszFmtD, iocounters.OtherTransferCount); */
|
||||
_ui64tow(iocounters.OtherTransferCount, pnmdi->item.pszText, 10);
|
||||
CommaSeparateNumberString(pnmdi->item.pszText, pnmdi->item.cchTextMax);
|
||||
}
|
||||
|
||||
|
@ -346,7 +355,7 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
{
|
||||
switch (pnmh->code)
|
||||
{
|
||||
case HDN_ITEMCLICK:
|
||||
case HDN_ITEMCLICKW:
|
||||
|
||||
/*
|
||||
* FIXME: Fix the column sorting
|
||||
|
@ -357,7 +366,7 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
|
|||
|
||||
break;
|
||||
|
||||
case HDN_ITEMCHANGED:
|
||||
case HDN_ITEMCHANGEDW:
|
||||
|
||||
UpdateColumnDataHints();
|
||||
|
||||
|
|
|
@ -53,8 +53,9 @@ void TaskManager_OnFileNew(void)
|
|||
HMODULE hShell32;
|
||||
RUNFILEDLG RunFileDlg;
|
||||
OSVERSIONINFO versionInfo;
|
||||
static const WCHAR wszShell32[] = {'S','H','E','L','L','3','2','.','D','L','L',0};
|
||||
|
||||
hShell32 = LoadLibrary(_T("SHELL32.DLL"));
|
||||
hShell32 = LoadLibraryW(wszShell32);
|
||||
RunFileDlg = (RUNFILEDLG)(FARPROC)GetProcAddress(hShell32, (char*)((long)0x3D));
|
||||
|
||||
/* Show "Run..." dialog */
|
||||
|
|
Loading…
Reference in a new issue