Details
-
Bug
-
Resolution: Fixed
-
Major
-
None
-
None
-
Operating System: ReactOS
Platform: x86 Hardware
Description
There are various bugs while running taskmgr under Windows 7, while code from 1997 runs fine, indicating major discrepancies in the psdk and NT API defs in comparison with Windows.
These two screen shots are from Windows 7 64bit, running taskmgr elevated:
http://img806.imageshack.us/img806/6730/procpage.png
http://img4.imageshack.us/img4/3077/perfpage.png
This is a screenshot of code written in 1997 that still functions on Windows 7 without elevation. (just to show taskmgr is getting it all wrong )
http://img651.imageshack.us/img651/4677/msj1997.png
These are two screen shots after removing the checks performed (note; its not duplicating process entries)
http://img251.imageshack.us/img251/4664/tm1r.png
http://img822.imageshack.us/img822/6684/tm2s.png
commenting out the various if (status != NO_ERROR) checks allows taskmgr to query the process list correctly, however the CPU totals and per page results are incorrectly calculated and returned. As a side note, it should be checking the return length and (status != NO_ERROR) is incorrect as NtQuerySystemInformation returns NTSTATUS so it should be (status != STATUS_SUCCESS)
/* Get new system time */
status = NtQuerySystemInformation(SystemTimeOfDayInformation, &SysTimeInfo, sizeof(SysTimeInfo), 0);
if (status != NO_ERROR)
return;
/* Get new CPU's idle time */
status = NtQuerySystemInformation(SystemPerformanceInformation, &SysPerfInfo, sizeof(SysPerfInfo), NULL);
if (status != NO_ERROR)
return;
/* Get system cache information */
status = NtQuerySystemInformation(SystemFileCacheInformation, &SysCacheInfo, sizeof(SysCacheInfo), NULL);
if (status != NO_ERROR)
return;
This demonstration application (from a 1997 Microsoft Journal article) is able to correctly query all the various details and indicates many discrepancies between psdk defs and the use of NT api's by taskmgr: http://www.microsoft.com/msj/0197/hood/hood0197.aspx
Code linked from that article is public domain and licence free, there is a link at the top of the article, for convenience it can be downloaded here: http://download.microsoft.com/download/0/6/7/0678184e-905e-4783-9511-d4dca1f492b4/hood0197.exe