diff options
author | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-20 05:38:10 -0800 |
---|---|---|
committer | Giampaolo Rodola <g.rodola@gmail.com> | 2019-02-20 05:38:10 -0800 |
commit | 265ee244a3aeb5103106aebe39f508f68ada7c33 (patch) | |
tree | 177b546571bac2866b48a83b3e03518d4f678e49 | |
parent | 4a386e488425d81ac4989f7dad802714733a3e3e (diff) | |
download | psutil-265ee244a3aeb5103106aebe39f508f68ada7c33.tar.gz |
move definitions in ntextapi.h
-rw-r--r-- | psutil/_psutil_windows.c | 2 | ||||
-rw-r--r-- | psutil/arch/windows/global.c | 2 | ||||
-rw-r--r-- | psutil/arch/windows/global.h | 76 | ||||
-rw-r--r-- | psutil/arch/windows/ntextapi.h | 65 |
4 files changed, 67 insertions, 78 deletions
diff --git a/psutil/_psutil_windows.c b/psutil/_psutil_windows.c index cdd52c0b..72ca5036 100644 --- a/psutil/_psutil_windows.c +++ b/psutil/_psutil_windows.c @@ -3871,7 +3871,7 @@ void init_psutil_windows(void) // set SeDebug for the current process psutil_set_se_debug(); psutil_setup(); - if (psutil_load_globals() != 0) + if (psutil_loadlibs() != 0) return NULL; #if PY_MAJOR_VERSION >= 3 diff --git a/psutil/arch/windows/global.c b/psutil/arch/windows/global.c index f085735a..e426b561 100644 --- a/psutil/arch/windows/global.c +++ b/psutil/arch/windows/global.c @@ -50,7 +50,7 @@ ps_GetProcAddressFromLib(LPCSTR libname, LPCSTR procname) { int -psutil_load_globals() { +psutil_loadlibs() { // Mandatory. psutil_NtQuerySystemInformation = ps_GetProcAddressFromLib( diff --git a/psutil/arch/windows/global.h b/psutil/arch/windows/global.h index cb2f99b8..0a6cd25d 100644 --- a/psutil/arch/windows/global.h +++ b/psutil/arch/windows/global.h @@ -4,78 +4,4 @@ * found in the LICENSE file. */ -#include "ntextapi.h" -#include <iphlpapi.h> - -typedef DWORD (_stdcall * NTQSI_PROC) (int, PVOID, ULONG, PULONG); -typedef PSTR (NTAPI * _RtlIpv4AddressToStringA)(struct in_addr *, PSTR); -typedef PSTR (NTAPI * _RtlIpv6AddressToStringA)(struct in6_addr *, PSTR); -typedef DWORD (WINAPI * _GetExtendedTcpTable)(PVOID, PDWORD, BOOL, ULONG, - TCP_TABLE_CLASS, ULONG); -typedef DWORD (WINAPI * _GetExtendedUdpTable)(PVOID, PDWORD, BOOL, ULONG, - UDP_TABLE_CLASS, ULONG); -typedef DWORD (CALLBACK *_GetActiveProcessorCount)(WORD); -typedef ULONGLONG (CALLBACK *_GetTickCount64)(void); -typedef NTSTATUS (NTAPI *_NtQueryObject)( - HANDLE ObjectHandle, - ULONG ObjectInformationClass, - PVOID ObjectInformation, - ULONG ObjectInformationLength, - PULONG ReturnLength -); -typedef NTSTATUS (NTAPI *_NtWow64ReadVirtualMemory64)( - IN HANDLE ProcessHandle, - IN PVOID64 BaseAddress, - OUT PVOID Buffer, - IN ULONG64 Size, - OUT PULONG64 NumberOfBytesRead); - - -// probably unnecessary? -/* -#ifndef NT_SUCCESS -#define NT_SUCCESS(Status) ((NTSTATUS)(Status) >= 0) -#endif -*/ - -NTQSI_PROC \ - psutil_NtQuerySystemInformation; - -_NtQueryInformationProcess \ - psutil_NtQueryInformationProcess; - -_NtSetInformationProcess - psutil_NtSetInformationProcess; - -PWINSTATIONQUERYINFORMATIONW \ - psutil_WinStationQueryInformationW; - -_RtlIpv4AddressToStringA \ - psutil_rtlIpv4AddressToStringA; - -_RtlIpv6AddressToStringA \ - psutil_rtlIpv6AddressToStringA; - -_GetExtendedTcpTable \ - psutil_GetExtendedTcpTable; - -_GetExtendedUdpTable \ - psutil_GetExtendedUdpTable; - -_GetActiveProcessorCount \ - psutil_GetActiveProcessorCount; - -_GetTickCount64 \ - psutil_GetTickCount64; - -_NtQueryObject \ - psutil_NtQueryObject; - -// XXX: just an alias; probably unnecessary -_NtQueryInformationProcess \ - psutil_NtWow64QueryInformationProcess64; - -_NtWow64ReadVirtualMemory64 \ - psutil_NtWow64ReadVirtualMemory64; - -int psutil_load_globals(); +int psutil_loadlibs(); diff --git a/psutil/arch/windows/ntextapi.h b/psutil/arch/windows/ntextapi.h index ea23ddb7..38f89dd9 100644 --- a/psutil/arch/windows/ntextapi.h +++ b/psutil/arch/windows/ntextapi.h @@ -6,7 +6,7 @@ #if !defined(__NTEXTAPI_H__) #define __NTEXTAPI_H__ #include <winternl.h> - +#include <iphlpapi.h> typedef struct { LARGE_INTEGER IdleTime; @@ -342,4 +342,67 @@ typedef enum _PROCESSINFOCLASS2 { #define ProcessImageFileName _ProcessImageFileName #define ProcessBreakOnTermination _ProcessBreakOnTermination +typedef DWORD (_stdcall * NTQSI_PROC) (int, PVOID, ULONG, PULONG); +typedef PSTR (NTAPI * _RtlIpv4AddressToStringA)(struct in_addr *, PSTR); +typedef PSTR (NTAPI * _RtlIpv6AddressToStringA)(struct in6_addr *, PSTR); +typedef DWORD (WINAPI * _GetExtendedTcpTable)(PVOID, PDWORD, BOOL, ULONG, + TCP_TABLE_CLASS, ULONG); +typedef DWORD (WINAPI * _GetExtendedUdpTable)(PVOID, PDWORD, BOOL, ULONG, + UDP_TABLE_CLASS, ULONG); +typedef DWORD (CALLBACK *_GetActiveProcessorCount)(WORD); +typedef ULONGLONG (CALLBACK *_GetTickCount64)(void); +typedef NTSTATUS (NTAPI *_NtQueryObject)( + HANDLE ObjectHandle, + ULONG ObjectInformationClass, + PVOID ObjectInformation, + ULONG ObjectInformationLength, + PULONG ReturnLength +); +typedef NTSTATUS (NTAPI *_NtWow64ReadVirtualMemory64)( + IN HANDLE ProcessHandle, + IN PVOID64 BaseAddress, + OUT PVOID Buffer, + IN ULONG64 Size, + OUT PULONG64 NumberOfBytesRead); + +NTQSI_PROC \ + psutil_NtQuerySystemInformation; + +_NtQueryInformationProcess \ + psutil_NtQueryInformationProcess; + +_NtSetInformationProcess + psutil_NtSetInformationProcess; + +PWINSTATIONQUERYINFORMATIONW \ + psutil_WinStationQueryInformationW; + +_RtlIpv4AddressToStringA \ + psutil_rtlIpv4AddressToStringA; + +_RtlIpv6AddressToStringA \ + psutil_rtlIpv6AddressToStringA; + +_GetExtendedTcpTable \ + psutil_GetExtendedTcpTable; + +_GetExtendedUdpTable \ + psutil_GetExtendedUdpTable; + +_GetActiveProcessorCount \ + psutil_GetActiveProcessorCount; + +_GetTickCount64 \ + psutil_GetTickCount64; + +_NtQueryObject \ + psutil_NtQueryObject; + +// XXX: just an alias; probably unnecessary +_NtQueryInformationProcess \ + psutil_NtWow64QueryInformationProcess64; + +_NtWow64ReadVirtualMemory64 \ + psutil_NtWow64ReadVirtualMemory64; + #endif // __NTEXTAPI_H__ |