Commit fc888d68 authored by Dylan Smith's avatar Dylan Smith Committed by Alexandre Julliard

taskmgr: Finish partial unicode conversion of process page.

parent a0449a5f
......@@ -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);
......
......@@ -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 */
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment