11#define WIN32_LEAN_AND_MEAN
38#define CMD_LINE_MIN(a, b) (a < b ? a - sizeof(WCHAR) : b)
66 AllocateAndInitializeSid(&
NtSidAuthority, 1,
SECURITY_LOCAL_SYSTEM_RID, 0, 0, 0, 0, 0, 0, 0, &
SystemUserSid);
102 static WCHAR szDomainNameUnused[255];
174 double CurrentKernelTime;
201 if (SysProcessorTimeInfo !=
NULL)
406 if (ProcessSD !=
NULL)
525 static const LPWSTR ellipsis =
L"...";
576 sizeof(ProcessParams),
586 sizeof(CommandLineStr),
617 new_entry->
str = new_string;
623 cache->pnext = new_entry;
639 pnext =
cache->pnext;
694 ULONG WorkingSetSizeBytes;
701 WorkingSetSizeBytes = 0;
705 return WorkingSetSizeBytes;
710 ULONG PeakWorkingSetSizeBytes;
717 PeakWorkingSetSizeBytes = 0;
721 return PeakWorkingSetSizeBytes;
726 ULONG WorkingSetSizeDelta;
733 WorkingSetSizeDelta = 0;
737 return WorkingSetSizeDelta;
742 ULONG PageFaultCount;
753 return PageFaultCount;
758 ULONG PageFaultCountDelta;
765 PageFaultCountDelta = 0;
769 return PageFaultCountDelta;
774 ULONG VirtualMemorySizeBytes;
781 VirtualMemorySizeBytes = 0;
785 return VirtualMemorySizeBytes;
790 ULONG PagedPoolUsage;
801 return PagedPoolUsage;
806 ULONG NonPagedPoolUsage;
813 NonPagedPoolUsage = 0;
817 return NonPagedPoolUsage;
870 ULONG USERObjectCount;
881 return USERObjectCount;
886 ULONG GDIObjectCount;
897 return GDIObjectCount;
931 Total = Total * (PageSize / 1024);
965 Peak = Peak * (PageSize / 1024);
985 Paged = Paged * (PageSize / 1024);
986 NonPaged = NonPaged * (PageSize / 1024);
988 Total = Paged + NonPaged;
1005 Paged = Paged * (PageSize / 1024);
1022 NonPaged = NonPaged * (PageSize / 1024);
1039 Total = Total * (PageSize / 1024);
1056 Available = Available * (PageSize / 1024);
1073 return SystemCache / 1024;
1091 ULONG ThreadCount = 0;
static LPWSTR PULONG pcwcUserName
#define NT_SUCCESS(StatCode)
DWORD WINAPI GetSecurityInfo(HANDLE handle, SE_OBJECT_TYPE ObjectType, SECURITY_INFORMATION SecurityInfo, PSID *ppsidOwner, PSID *ppsidGroup, PACL *ppDacl, PACL *ppSacl, PSECURITY_DESCRIPTOR *ppSecurityDescriptor)
BOOL WINAPI LookupAccountSidW(LPCWSTR pSystemName, PSID pSid, LPWSTR pAccountName, LPDWORD pdwAccountName, LPWSTR pDomainName, LPDWORD pdwDomainName, PSID_NAME_USE peUse)
BOOL WINAPI GetTokenInformation(HANDLE TokenHandle, TOKEN_INFORMATION_CLASS TokenInformationClass, LPVOID TokenInformation, DWORD TokenInformationLength, PDWORD ReturnLength)
BOOL WINAPI OpenProcessToken(HANDLE ProcessHandle, DWORD DesiredAccess, PHANDLE TokenHandle)
BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY pIdentifierAuthority, BYTE nSubAuthorityCount, DWORD nSubAuthority0, DWORD nSubAuthority1, DWORD nSubAuthority2, DWORD nSubAuthority3, DWORD nSubAuthority4, DWORD nSubAuthority5, DWORD nSubAuthority6, DWORD nSubAuthority7, PSID *pSid)
BOOL WINAPI CopySid(DWORD nDestinationSidLength, PSID pDestinationSid, PSID pSourceSid)
DWORD WINAPI GetLengthSid(PSID pSid)
PVOID WINAPI FreeSid(PSID pSid)
BOOL WINAPI EqualSid(PSID pSid1, PSID pSid2)
#define ReadProcessMemory(a, b, c, d, e)
#define HeapFree(x, y, z)
static void cleanup(void)
HANDLE WINAPI OpenProcess(IN DWORD dwDesiredAccess, IN BOOL bInheritHandle, IN DWORD dwProcessId)
BOOL WINAPI GetProcessIoCounters(IN HANDLE hProcess, OUT PIO_COUNTERS lpIoCounters)
IN PLARGE_INTEGER IN PLARGE_INTEGER PEPROCESS ProcessId
@ SystemTimeOfDayInformation
@ SystemFileCacheInformation
@ SystemHandleInformation
@ SystemProcessInformation
@ SystemProcessorPerformanceInformation
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Check_return_ long __cdecl labs(_In_ long x)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define PROCESS_QUERY_INFORMATION
enum _SID_NAME_USE SID_NAME_USE
_In_ BOOL _In_ HANDLE hProcess
#define SystemPerformanceInformation
#define memcpy(s1, s2, n)
static const char * ImageName
static const char mbstate_t *static wchar_t const char mbstate_t *static const wchar_t int *static double
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION * PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
struct _SYSTEM_PROCESS_INFORMATION * PSYSTEM_PROCESS_INFORMATION
_In_ ULONG _In_ ACCESS_MASK _In_ PSID Sid
NTSTATUS NTAPI NtQueryInformationProcess(_In_ HANDLE ProcessHandle, _In_ PROCESSINFOCLASS ProcessInformationClass, _Out_ PVOID ProcessInformation, _In_ ULONG ProcessInformationLength, _Out_opt_ PULONG ReturnLength)
EXTINLINE DWORD WINAPI GetGuiResources(HANDLE hProcess, DWORD uiFlags)
ULONG PerfDataGetPagedPoolUsagePages(ULONG Index)
SYSTEM_BASIC_INFORMATION SystemBasicInfo
ULONG PerfDataGetWorkingSetSizeBytes(ULONG Index)
ULONG SystemNumberOfHandles
ULONG PerfDataGetWorkingSetSizeDelta(ULONG Index)
ULONG PerfDataGetPageFaultCountDelta(ULONG Index)
ULONG PerfDataGetProcessIndex(ULONG pid)
struct _SIDTOUSERNAME SIDTOUSERNAME
ULONG PerfDataGetKernelMemoryNonPagedK(void)
ULONG PerfDataGetPageFaultCount(ULONG Index)
ULONG PerfDataGetSystemHandleCount(void)
ULONG PerfDataGetSessionId(ULONG Index)
ULONG PerfDataGetPhysicalMemoryTotalK(void)
ULONG PerfDataGetTotalThreadCount(void)
void PerfDataDeallocCommandLineCache()
ULONG PerfDataGetCommitChargePeakK(void)
ULONG PerfDataGetProcessorSystemUsage(void)
PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION SystemProcessorTimeInfo
LARGE_INTEGER PerfDataGetCPUTime(ULONG Index)
ULONG PerfDataGetHandleCount(ULONG Index)
ULONG PerfDataGetProcessId(ULONG Index)
ULONG PerfDataGetProcessorUsage(void)
ULONG PerfDataGetCPUUsage(ULONG Index)
ULONG PerfDataGetKernelMemoryPagedK(void)
BOOL PerfDataGetCommandLine(ULONG Index, LPWSTR lpCommandLine, ULONG nMaxCount)
PCMD_LINE_CACHE global_cache
ULONG PerfDataGetKernelMemoryTotalK(void)
ULONG PerfDataGetCommitChargeLimitK(void)
ULONG PerfDataGetThreadCount(ULONG Index)
ULONG PerfDataGetBasePriority(ULONG Index)
BOOL PerfDataGetUserName(ULONG Index, LPWSTR lpUserName, ULONG nMaxCount)
BOOL PerfDataInitialize(void)
void PerfDataRefresh(void)
static void SidToUserName(PSID Sid, LPWSTR szBuffer, DWORD BufferSize)
struct _SIDTOUSERNAME * PSIDTOUSERNAME
ULONG PerfDataGetUSERObjectCount(ULONG Index)
LARGE_INTEGER liOldIdleTime
SYSTEM_PERFORMANCE_INFORMATION SystemPerfInfo
ULONG PerfDataGetPhysicalMemoryAvailableK(void)
ULONG PerfDataGetNonPagedPoolUsagePages(ULONG Index)
ULONG PerfDataGetCommitChargeTotalK(void)
CRITICAL_SECTION PerfDataCriticalSection
void PerfDataUninitialize(void)
LARGE_INTEGER liOldSystemTime
ULONG PerfDataGetVirtualMemorySizeBytes(ULONG Index)
VOID WINAPI CachedGetUserFromSid(PSID pSid, LPWSTR pUserName, PULONG pcwcUserName)
BOOL PerfDataGetImageName(ULONG Index, LPWSTR lpImageName, ULONG nMaxCount)
ULONG PerfDataGetPeakWorkingSetSizeBytes(ULONG Index)
ULONG PerfDataGetGDIObjectCount(ULONG Index)
BOOL PerfDataGetIOCounters(ULONG Index, PIO_COUNTERS pIoCounters)
static LIST_ENTRY SidToUserNameHead
SYSTEM_FILECACHE_INFORMATION SystemCacheInfo
ULONG PerfDataGetProcessCount(void)
BOOL PerfDataGet(ULONG Index, PPERFDATA *lppData)
#define CMD_LINE_MIN(a, b)
ULONG PerfDataGetPhysicalMemorySystemCacheK(void)
struct _PERFDATA PERFDATA
struct _PERFDATA * PPERFDATA
struct _CMD_LINE_CACHE CMD_LINE_CACHE
static SID_IDENTIFIER_AUTHORITY NtSidAuthority
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_CRTIMP wchar_t *__cdecl wcsncpy(wchar_t *_Dest, const wchar_t *_Source, size_t _Count)
NTSYSAPI NTSTATUS NTAPI NtQuerySystemInformation(IN SYSTEM_INFORMATION_CLASS SystemInfoClass, OUT PVOID SystemInfoBuffer, IN ULONG SystemInfoBufferSize, OUT PULONG BytesReturned OPTIONAL)
struct _LIST_ENTRY * Blink
struct _LIST_ENTRY * Flink
ULONG PageFaultCountDelta
ULONG WorkingSetSizeDelta
ULONG NonPagedPoolUsagePages
ULONG VirtualMemorySizeBytes
ULONG PagedPoolUsagePages
ULONG WorkingSetSizeBytes
ULONG PeakWorkingSetSizeBytes
VOID WINAPI InitializeCriticalSection(OUT LPCRITICAL_SECTION lpCriticalSection)
#define FIELD_OFFSET(t, f)
#define CONTAINING_RECORD(address, type, field)
#define STATUS_INFO_LENGTH_MISMATCH
_In_ WDFCOLLECTION _In_ ULONG Index
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
_Must_inspect_result_ _In_ WDFCMRESLIST List
_In_ LPCSTR _Out_writes_bytes_to_opt_ cbSid PSID _Inout_ LPDWORD cbSid
void WINAPI LeaveCriticalSection(LPCRITICAL_SECTION)
void WINAPI EnterCriticalSection(LPCRITICAL_SECTION)
void WINAPI DeleteCriticalSection(PCRITICAL_SECTION)
_Inout_ PERBANDINFO * pbi
_In_ ULONG_PTR _In_ ULONG _Out_ ULONG_PTR * pid
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO
_In_ LONG _In_ LONG Limit
struct _TOKEN_USER * PTOKEN_USER
#define SECURITY_LOCAL_SYSTEM_RID
#define OWNER_SECURITY_INFORMATION
#define SECURITY_NT_AUTHORITY