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
cf3e6c35
Commit
cf3e6c35
authored
Oct 20, 2020
by
Michael Stefaniuc
Committed by
Alexandre Julliard
Oct 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
taskmgr: Use NtQuerySystemInformation() directly.
Signed-off-by:
Michael Stefaniuc
<
mstefani@winehq.org
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
1f040d66
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
9 additions
and
15 deletions
+9
-15
perfdata.c
programs/taskmgr/perfdata.c
+9
-14
perfdata.h
programs/taskmgr/perfdata.h
+0
-1
No files found.
programs/taskmgr/perfdata.c
View file @
cf3e6c35
...
...
@@ -30,7 +30,6 @@
#include "taskmgr.h"
#include "perfdata.h"
static
PROCNTQSI
pNtQuerySystemInformation
=
NULL
;
static
PROCGPIC
pGetProcessIoCounters
=
NULL
;
static
PROCISW64
pIsWow64Process
=
NULL
;
static
CRITICAL_SECTION
PerfDataCriticalSection
;
...
...
@@ -58,22 +57,17 @@ static size_t size_diff(size_t x, size_t y)
BOOL
PerfDataInitialize
(
void
)
{
LONG
status
;
static
const
WCHAR
wszNtdll
[]
=
{
'n'
,
't'
,
'd'
,
'l'
,
'l'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
static
const
WCHAR
wszKernel32
[]
=
{
'k'
,
'e'
,
'r'
,
'n'
,
'e'
,
'l'
,
'3'
,
'2'
,
'.'
,
'd'
,
'l'
,
'l'
,
0
};
pNtQuerySystemInformation
=
(
PROCNTQSI
)
GetProcAddress
(
GetModuleHandleW
(
wszNtdll
),
"NtQuerySystemInformation"
);
pGetProcessIoCounters
=
(
PROCGPIC
)
GetProcAddress
(
GetModuleHandleW
(
wszKernel32
),
"GetProcessIoCounters"
);
pIsWow64Process
=
(
PROCISW64
)
GetProcAddress
(
GetModuleHandleW
(
wszKernel32
),
"IsWow64Process"
);
InitializeCriticalSection
(
&
PerfDataCriticalSection
);
if
(
!
pNtQuerySystemInformation
)
return
FALSE
;
/*
* Get number of processors in the system
*/
status
=
p
NtQuerySystemInformation
(
SystemBasicInformation
,
&
SystemBasicInfo
,
sizeof
(
SystemBasicInfo
),
NULL
);
status
=
NtQuerySystemInformation
(
SystemBasicInformation
,
&
SystemBasicInfo
,
sizeof
(
SystemBasicInfo
),
NULL
);
if
(
status
!=
NO_ERROR
)
return
FALSE
;
...
...
@@ -102,24 +96,25 @@ void PerfDataRefresh(void)
/* Get new system time */
status
=
p
NtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
SysTimeInfo
,
sizeof
(
SysTimeInfo
),
0
);
status
=
NtQuerySystemInformation
(
SystemTimeOfDayInformation
,
&
SysTimeInfo
,
sizeof
(
SysTimeInfo
),
0
);
if
(
status
!=
NO_ERROR
)
return
;
/* Get new CPU's idle time */
status
=
p
NtQuerySystemInformation
(
SystemPerformanceInformation
,
&
SysPerfInfo
,
sizeof
(
SysPerfInfo
),
NULL
);
status
=
NtQuerySystemInformation
(
SystemPerformanceInformation
,
&
SysPerfInfo
,
sizeof
(
SysPerfInfo
),
NULL
);
if
(
status
!=
NO_ERROR
)
return
;
/* Get system cache information */
status
=
p
NtQuerySystemInformation
(
SystemCacheInformation
,
&
SysCacheInfo
,
sizeof
(
SysCacheInfo
),
NULL
);
status
=
NtQuerySystemInformation
(
SystemCacheInformation
,
&
SysCacheInfo
,
sizeof
(
SysCacheInfo
),
NULL
);
if
(
status
!=
NO_ERROR
)
return
;
/* Get processor time information */
SysProcessorTimeInfo
=
HeapAlloc
(
GetProcessHeap
(),
0
,
sizeof
(
*
SysProcessorTimeInfo
)
*
SystemBasicInfo
.
NumberOfProcessors
);
status
=
pNtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
SysProcessorTimeInfo
,
sizeof
(
*
SysProcessorTimeInfo
)
*
SystemBasicInfo
.
NumberOfProcessors
,
&
ulSize
);
sizeof
(
*
SysProcessorTimeInfo
)
*
SystemBasicInfo
.
NumberOfProcessors
);
status
=
NtQuerySystemInformation
(
SystemProcessorPerformanceInformation
,
SysProcessorTimeInfo
,
sizeof
(
*
SysProcessorTimeInfo
)
*
SystemBasicInfo
.
NumberOfProcessors
,
&
ulSize
);
if
(
status
!=
NO_ERROR
)
{
HeapFree
(
GetProcessHeap
(),
0
,
SysProcessorTimeInfo
);
return
;
...
...
@@ -135,7 +130,7 @@ void PerfDataRefresh(void)
BufferSize
+=
0x10000
;
SysHandleInfoData
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BufferSize
);
status
=
p
NtQuerySystemInformation
(
SystemHandleInformation
,
SysHandleInfoData
,
BufferSize
,
&
ulSize
);
status
=
NtQuerySystemInformation
(
SystemHandleInformation
,
SysHandleInfoData
,
BufferSize
,
&
ulSize
);
if
(
status
==
0xC0000004
/*STATUS_INFO_LENGTH_MISMATCH*/
)
{
HeapFree
(
GetProcessHeap
(),
0
,
SysHandleInfoData
);
...
...
@@ -153,7 +148,7 @@ void PerfDataRefresh(void)
BufferSize
+=
0x10000
;
pBuffer
=
HeapAlloc
(
GetProcessHeap
(),
0
,
BufferSize
);
status
=
p
NtQuerySystemInformation
(
SystemProcessInformation
,
pBuffer
,
BufferSize
,
&
ulSize
);
status
=
NtQuerySystemInformation
(
SystemProcessInformation
,
pBuffer
,
BufferSize
,
&
ulSize
);
if
(
status
==
0xC0000004
/*STATUS_INFO_LENGTH_MISMATCH*/
)
{
HeapFree
(
GetProcessHeap
(),
0
,
pBuffer
);
...
...
programs/taskmgr/perfdata.h
View file @
cf3e6c35
...
...
@@ -66,7 +66,6 @@ struct _SYSTEM_PAGEFILE_INFORMATION
#define GR_GDIOBJECTS 0
/* Count of GDI objects */
#define GR_USEROBJECTS 1
/* Count of USER objects */
typedef
LONG
(
WINAPI
*
PROCNTQSI
)(
UINT
,
PVOID
,
ULONG
,
PULONG
);
typedef
BOOL
(
WINAPI
*
PROCGPIC
)(
HANDLE
,
PIO_COUNTERS
);
typedef
BOOL
(
WINAPI
*
PROCISW64
)(
HANDLE
,
PBOOL
);
...
...
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