aboutsummaryrefslogtreecommitdiff
path: root/winsup/cygwin/ntdll.h
diff options
context:
space:
mode:
authorChristopher Faylor <me@cgf.cx>2000-11-02 05:25:56 +0000
committerChristopher Faylor <me@cgf.cx>2000-11-02 05:25:56 +0000
commit6d87f7d7c4f89ddbf550f22751f61d29cceab850 (patch)
treecebcc1674c120a72f31f4efa4f92912fc448662e /winsup/cygwin/ntdll.h
parente2fa502354e32466425ae03ebf2aa269835f2956 (diff)
downloadnewlib-6d87f7d7c4f89ddbf550f22751f61d29cceab850.zip
newlib-6d87f7d7c4f89ddbf550f22751f61d29cceab850.tar.gz
newlib-6d87f7d7c4f89ddbf550f22751f61d29cceab850.tar.bz2
* pinfo.cc (EnumProcessesNT): New function. Eliminates dependence on psapi.h.
(EnumProcesses9x): Rename from EnumProcessesW95. Change arguments to be more useful for cygwin. (winpids::init): Accomodate argument changes. (enum_init): Ditto. * pinfo.h (winpids): Make pidlist dynamically extendable by storing it as a pointer and remembering the size. * ntdll.h: Add extra definitions needed for EnumProcessesNT. Reformat via 'indent'.
Diffstat (limited to 'winsup/cygwin/ntdll.h')
-rw-r--r--winsup/cygwin/ntdll.h159
1 files changed, 135 insertions, 24 deletions
diff --git a/winsup/cygwin/ntdll.h b/winsup/cygwin/ntdll.h
index bdb4fe8..79a8c73 100644
--- a/winsup/cygwin/ntdll.h
+++ b/winsup/cygwin/ntdll.h
@@ -8,17 +8,17 @@
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
details. */
-/*
- * The following both data structures aren't defined anywhere in the Microsoft
- * header files. Taken from the book "Windows NT/2000 Native API Reference"
- * by Gary Nebbett.
- */
-typedef enum _SYSTEM_INFORMATION_CLASS {
- SystemBasicInformation = 0
- /* Dropped each other since not used here. */
+#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
+
+typedef enum _SYSTEM_INFORMATION_CLASS
+{
+ SystemBasicInformation = 0,
+ SystemProcessesAndThreadsInformation = 5,
+ /* There are a lot more of these... */
} SYSTEM_INFORMATION_CLASS;
-typedef struct _SYSTEM_BASIC_INFORMATION {
+typedef struct _SYSTEM_BASIC_INFORMATION
+{
ULONG Unknown;
ULONG MaximumIncrement;
ULONG PhysicalPageSize;
@@ -32,19 +32,130 @@ typedef struct _SYSTEM_BASIC_INFORMATION {
ULONG NumberProcessors;
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
-/*
- * Function declarations for ntdll.dll. They doesn't appear in any
- * Win32 header either.
- */
-extern "C" {
-NTSTATUS NTAPI NtMapViewOfSection(HANDLE,HANDLE,PVOID*,ULONG,ULONG,
- PLARGE_INTEGER,PULONG,SECTION_INHERIT,
- ULONG,ULONG);
-NTSTATUS NTAPI NtQuerySystemInformation(SYSTEM_INFORMATION_CLASS,
- PVOID,ULONG,PULONG);
-NTSTATUS NTAPI NtOpenSection(PHANDLE,ACCESS_MASK,POBJECT_ATTRIBUTES);
-NTSTATUS NTAPI NtUnmapViewOfSection(HANDLE,PVOID);
-VOID NTAPI RtlInitUnicodeString(PUNICODE_STRING,PCWSTR);
-ULONG NTAPI RtlNtStatusToDosError(NTSTATUS);
-}
+typedef LONG KPRIORITY;
+typedef struct _VM_COUNTERS
+{
+ ULONG PeakVirtualSize;
+ ULONG VirtualSize;
+ ULONG PageFaultCount;
+ ULONG PeakWorkingSetSize;
+ ULONG WorkingSetSize;
+ ULONG QuotaPeakPagedPoolUsage;
+ ULONG QuotaPagedPoolUsage;
+ ULONG QuotaPeakNonPagedPoolUsage;
+ ULONG QuotaNonPagedPoolUsage;
+ ULONG PagefileUsage;
+ ULONG PeakPagefileUsage;
+} VM_COUNTERS, *PVM_COUNTERS;
+
+typedef struct _IO_COUNTERS
+{
+ LARGE_INTEGER ReadOperationCount;
+ LARGE_INTEGER WriteOperationCount;
+ LARGE_INTEGER OtherOperationCount;
+ LARGE_INTEGER ReadTransferCount;
+ LARGE_INTEGER WriteTransferCount;
+ LARGE_INTEGER OtherTransferCount;
+} IO_COUNTERS, *PIO_COUNTERS;
+
+typedef struct _CLIENT_ID
+{
+ HANDLE UniqueProcess;
+ HANDLE UniqueThread;
+} CLIENT_ID, *PCLIENT_ID;
+
+typedef enum
+{
+ StateInitialized,
+ StateReady,
+ StateRunning,
+ StateStandby,
+ StateTerminated,
+ StateWait,
+ StateTransition,
+ StateUnknown,
+} THREAD_STATE;
+typedef enum
+{
+ Executive,
+ FreePage,
+ PageIn,
+ PoolAllocation,
+ DelayExecution,
+ Suspended,
+ UserRequest,
+ WrExecutive,
+ WrFreePage,
+ WrPageIn,
+ WrPoolAllocation,
+ WrDelayExecution,
+ WrSuspended,
+ WrUserRequest,
+ WrEventPair,
+ WrQueue,
+ WrLpcReceive,
+ WrLpcReply,
+ WrVirtualMemory,
+ WrPageOut,
+ WrRendezvous,
+ Spare2,
+ Spare3,
+ Spare4,
+ Spare5,
+ Spare6,
+ WrKernel,
+ MaximumWaitReason
+} KWAIT_REASON;
+
+typedef struct _SYSTEM_THREADS
+{
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER CreateTime;
+ ULONG WaitTime;
+ PVOID StartAddress;
+ CLIENT_ID ClientId;
+ KPRIORITY Priority;
+ KPRIORITY BasePriority;
+ ULONG ContextSwitchCount;
+ THREAD_STATE State;
+ KWAIT_REASON WaitReason;
+} SYSTEM_THREADS, *PSYSTEM_THREADS;
+
+typedef struct _SYSTEM_PROCESSES
+{
+ ULONG NextEntryDelta;
+ ULONG Threadcount;
+ ULONG Reserved1[6];
+ LARGE_INTEGER CreateTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER KernelTime;
+ UNICODE_STRING ProcessName;
+ KPRIORITY BasePriority;
+ ULONG ProcessId;
+ ULONG InheritedFromProcessId;
+ ULONG HandleCount;
+ ULONG Reserved2[2];
+ VM_COUNTERS VmCounters;
+ IO_COUNTERS IoCounters;
+ SYSTEM_THREADS Threads[1];
+} SYSTEM_PROCESSES, *PSYSTEM_PROCESSES;
+
+/* Function declarations for ntdll.dll. These don't appear in any
+ standard Win32 header. */
+extern "C"
+{
+ NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG, ULONG,
+ PLARGE_INTEGER, PULONG, SECTION_INHERIT,
+ ULONG, ULONG);
+ NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
+ PVOID, ULONG, PULONG);
+ NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
+ NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
+ VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
+ ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
+ NTSTATUS NTAPI ZwQuerySystemInformation (IN SYSTEM_INFORMATION_CLASS,
+ IN OUT PVOID, IN ULONG,
+ OUT PULONG);
+}