Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
fc888d68
Commit
fc888d68
authored
Aug 24, 2009
by
Dylan Smith
Committed by
Alexandre Julliard
Aug 24, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskmgr: Finish partial unicode conversion of process page.
parent
a0449a5f
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
101 additions
and
112 deletions
+101
-112
dbgchnl.c
programs/taskmgr/dbgchnl.c
+7
-7
perfdata.c
programs/taskmgr/perfdata.c
+13
-33
perfdata.h
programs/taskmgr/perfdata.h
+2
-3
procpage.c
programs/taskmgr/procpage.c
+77
-68
run.c
programs/taskmgr/run.c
+2
-1
No files found.
programs/taskmgr/dbgchnl.c
View file @
fc888d68
...
...
@@ -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_SetItemText
W
(
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
)
{
T
CHAR
val
[
2
];
TCHAR
name
[
32
];
W
CHAR
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_GetItemText
A
(
hChannelLV
,
lhti
.
iItem
,
0
,
name
,
sizeof
(
name
)
/
sizeof
(
name
[
0
]));
ListView_GetItemText
W
(
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_SetItemText
W
(
hChannelLV
,
lhti
.
iItem
,
lhti
.
iSubItem
,
val
);
}
if
(
user
.
notdone
)
printf
(
"Some channel instances weren't correctly set
\n
"
);
...
...
programs/taskmgr/perfdata.c
View file @
fc888d68
...
...
@@ -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
(
GetModuleHandle
W
(
wszNtdll
),
"NtQuerySystemInformation"
);
pGetGuiResources
=
(
PROCGGR
)
GetProcAddress
(
GetModuleHandle
W
(
wszUser32
),
"GetGuiResources"
);
pGetProcessIoCounters
=
(
PROCGPIC
)
GetProcAddress
(
GetModuleHandle
W
(
wszKernel32
),
"GetProcessIoCounters"
);
InitializeCriticalSection
(
&
PerfDataCriticalSection
);
...
...
@@ -92,7 +95,7 @@ void PerfDataRefresh(void)
ULONG
Idx
,
Idx2
;
HANDLE
hProcess
;
HANDLE
hProcessToken
;
TCHAR
szTemp
[
MAX_PATH
];
WCHAR
w
szTemp
[
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
,
LP
T
STR
lpImageName
,
int
nMaxCount
)
BOOL
PerfDataGetImageName
(
ULONG
Index
,
LP
W
STR
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
,
LP
T
STR
lpUserName
,
int
nMaxCount
)
BOOL
PerfDataGetUserName
(
ULONG
Index
,
LP
W
STR
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
;
...
...
programs/taskmgr/perfdata.h
View file @
fc888d68
...
...
@@ -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
,
LP
T
STR
lpImageName
,
int
nMaxCount
);
BOOL
PerfDataGetImageName
(
ULONG
Index
,
LP
W
STR
lpImageName
,
int
nMaxCount
);
ULONG
PerfDataGetProcessId
(
ULONG
Index
);
BOOL
PerfDataGetUserName
(
ULONG
Index
,
LP
T
STR
lpUserName
,
int
nMaxCount
);
BOOL
PerfDataGetUserName
(
ULONG
Index
,
LP
W
STR
lpUserName
,
int
nMaxCount
);
ULONG
PerfDataGetSessionId
(
ULONG
Index
);
ULONG
PerfDataGetCPUUsage
(
ULONG
Index
);
TIME
PerfDataGetCPUTime
(
ULONG
Index
);
...
...
programs/taskmgr/procpage.c
View file @
fc888d68
...
...
@@ -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
(
LP
T
STR
strNumber
,
int
nMaxCount
)
static
void
CommaSeparateNumberString
(
LP
W
STR
strNumber
,
int
nMaxCount
)
{
T
CHAR
temp
[
260
];
W
CHAR
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
;
T
CHAR
strDebugger
[
260
];
W
CHAR
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
(
RegOpenKeyEx
W
(
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
(
RegQueryValueEx
W
(
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
;
NMLVDISPINFO
W
*
pnmdi
;
LPNMHEADER
W
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
=
(
NMLVDISPINFO
W
*
)
lParam
;
pnmhdr
=
(
LPNMHEADER
W
)
lParam
;
if
(
pnmh
->
hwndFrom
==
hProcessPageListCtrl
)
{
...
...
@@ -168,7 +180,7 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
break;
#endif
case
LVN_GETDISPINFO
:
case
LVN_GETDISPINFO
W
:
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
));
wsprintf
W
(
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
));
wsprintf
W
(
pnmdi
->
item
.
pszText
,
wszFmtD
,
PerfDataGetSessionId
(
Index
));
if
(
ColumnDataHints
[
ColumnIndex
]
==
COLUMN_CPUUSAGE
)
wsprintf
(
pnmdi
->
item
.
pszText
,
_T
(
"%02d"
)
,
PerfDataGetCPUUsage
(
Index
));
wsprintf
W
(
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
);
wsprintf
W
(
pnmdi
->
item
.
pszText
,
timefmt
,
dwHours
,
dwMinutes
,
dwSeconds
);
}
if
(
ColumnDataHints
[
ColumnIndex
]
==
COLUMN_MEMORYUSAGE
)
{
wsprintf
(
pnmdi
->
item
.
pszText
,
_T
(
"%d"
)
,
PerfDataGetWorkingSetSizeBytes
(
Index
)
/
1024
);
wsprintf
W
(
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
);
wsprintf
W
(
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
);
wsprintf
W
(
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
));
wsprintf
W
(
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
));
wsprintf
W
(
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
);
wsprintf
W
(
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
);
wsprintf
W
(
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
);
wsprintf
W
(
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
));
wsprintf
W
(
pnmdi
->
item
.
pszText
,
wszFmtD
,
PerfDataGetBasePriority
(
Index
));
if
(
ColumnDataHints
[
ColumnIndex
]
==
COLUMN_HANDLECOUNT
)
{
wsprintf
(
pnmdi
->
item
.
pszText
,
_T
(
"%d"
)
,
PerfDataGetHandleCount
(
Index
));
wsprintf
W
(
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
));
wsprintf
W
(
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
));
wsprintf
W
(
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
));
wsprintf
W
(
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); */
_ui64to
a
(
iocounters
.
WriteOperationCount
,
pnmdi
->
item
.
pszText
,
10
);
/* wsprintf
W(pnmdi->item.pszText, wszFmtD
, iocounters.WriteOperationCount); */
_ui64to
w
(
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); */
_ui64to
a
(
iocounters
.
OtherOperationCount
,
pnmdi
->
item
.
pszText
,
10
);
/* wsprintf
W(pnmdi->item.pszText, wszFmtD
, iocounters.OtherOperationCount); */
_ui64to
w
(
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); */
_ui64to
a
(
iocounters
.
ReadTransferCount
,
pnmdi
->
item
.
pszText
,
10
);
/* wsprintf
W(pnmdi->item.pszText, wszFmtD
, iocounters.ReadTransferCount); */
_ui64to
w
(
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); */
_ui64to
a
(
iocounters
.
WriteTransferCount
,
pnmdi
->
item
.
pszText
,
10
);
/* wsprintf
W(pnmdi->item.pszText, wszFmtD
, iocounters.WriteTransferCount); */
_ui64to
w
(
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); */
_ui64to
a
(
iocounters
.
OtherTransferCount
,
pnmdi
->
item
.
pszText
,
10
);
/* wsprintf
W(pnmdi->item.pszText, wszFmtD
, iocounters.OtherTransferCount); */
_ui64to
w
(
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_ITEMCLICK
W
:
/*
* FIXME: Fix the column sorting
...
...
@@ -357,7 +366,7 @@ static void ProcessPageOnNotify(WPARAM wParam, LPARAM lParam)
break
;
case
HDN_ITEMCHANGED
:
case
HDN_ITEMCHANGED
W
:
UpdateColumnDataHints
();
...
...
programs/taskmgr/run.c
View file @
fc888d68
...
...
@@ -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
=
LoadLibrary
W
(
wszShell32
);
RunFileDlg
=
(
RUNFILEDLG
)(
FARPROC
)
GetProcAddress
(
hShell32
,
(
char
*
)((
long
)
0x3D
));
/* Show "Run..." dialog */
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment