2001-04-29 04:54:36 +02:00
|
|
|
/* ntdll.h. Contains ntdll specific stuff not defined elsewhere.
|
2000-10-24 20:44:56 +02:00
|
|
|
|
2004-04-14 23:11:45 +02:00
|
|
|
Copyright 2000, 2001, 2002, 2003, 2004 Red Hat, Inc.
|
2000-10-24 20:44:56 +02:00
|
|
|
|
|
|
|
This file is part of Cygwin.
|
|
|
|
|
|
|
|
This software is a copyrighted work licensed under the terms of the
|
|
|
|
Cygwin license. Please consult the file "CYGWIN_LICENSE" for
|
|
|
|
details. */
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
|
2004-04-13 14:14:59 +02:00
|
|
|
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xc0000023)
|
2005-10-18 20:51:33 +02:00
|
|
|
#define STATUS_WORKING_SET_QUOTA ((NTSTATUS) 0xc00000a1L)
|
2002-05-12 03:37:48 +02:00
|
|
|
#define PDI_MODULES 0x01
|
|
|
|
#define PDI_HEAPS 0x04
|
|
|
|
#define LDRP_IMAGE_DLL 0x00000004
|
|
|
|
#define WSLE_PAGE_READONLY 0x001
|
|
|
|
#define WSLE_PAGE_EXECUTE 0x002
|
|
|
|
#define WSLE_PAGE_EXECUTE_READ 0x003
|
|
|
|
#define WSLE_PAGE_READWRITE 0x004
|
|
|
|
#define WSLE_PAGE_WRITECOPY 0x005
|
|
|
|
#define WSLE_PAGE_EXECUTE_READWRITE 0x006
|
|
|
|
#define WSLE_PAGE_EXECUTE_WRITECOPY 0x007
|
|
|
|
#define WSLE_PAGE_SHARE_COUNT_MASK 0x0E0
|
|
|
|
#define WSLE_PAGE_SHAREABLE 0x100
|
|
|
|
|
2005-11-28 23:32:29 +01:00
|
|
|
#define AT_EXTENDABLE_FILE 0x00002000
|
2005-12-07 12:16:47 +01:00
|
|
|
#define AT_ROUND_TO_PAGE 0x40000000
|
2005-02-25 22:23:15 +01:00
|
|
|
|
2005-10-18 20:51:33 +02:00
|
|
|
#define LOCK_VM_IN_WSL 1
|
|
|
|
#define LOCK_VM_IN_RAM 2
|
|
|
|
|
2002-05-12 03:37:48 +02:00
|
|
|
typedef ULONG KAFFINITY;
|
2000-11-02 06:25:56 +01:00
|
|
|
|
|
|
|
typedef enum _SYSTEM_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
SystemBasicInformation = 0,
|
2002-05-12 03:37:48 +02:00
|
|
|
SystemPerformanceInformation = 2,
|
|
|
|
SystemTimeOfDayInformation = 3,
|
2000-11-02 06:25:56 +01:00
|
|
|
SystemProcessesAndThreadsInformation = 5,
|
2002-05-12 03:37:48 +02:00
|
|
|
SystemProcessorTimes = 8,
|
2004-03-18 13:28:47 +01:00
|
|
|
SystemPagefileInformation = 18,
|
2000-11-02 06:25:56 +01:00
|
|
|
/* There are a lot more of these... */
|
2000-10-24 20:44:56 +02:00
|
|
|
} SYSTEM_INFORMATION_CLASS;
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
typedef struct _SYSTEM_BASIC_INFORMATION
|
|
|
|
{
|
2000-10-24 20:44:56 +02:00
|
|
|
ULONG Unknown;
|
|
|
|
ULONG MaximumIncrement;
|
|
|
|
ULONG PhysicalPageSize;
|
|
|
|
ULONG NumberOfPhysicalPages;
|
|
|
|
ULONG LowestPhysicalPage;
|
|
|
|
ULONG HighestPhysicalPage;
|
|
|
|
ULONG AllocationGranularity;
|
|
|
|
ULONG LowestUserAddress;
|
|
|
|
ULONG HighestUserAddress;
|
|
|
|
ULONG ActiveProcessors;
|
2002-05-12 03:37:48 +02:00
|
|
|
UCHAR NumberProcessors;
|
2000-10-24 20:44:56 +02:00
|
|
|
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
|
|
|
|
|
2004-03-18 13:28:47 +01:00
|
|
|
typedef struct _SYSTEM_PAGEFILE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG CurrentSize;
|
|
|
|
ULONG TotalUsed;
|
|
|
|
ULONG PeakUsed;
|
|
|
|
UNICODE_STRING FileName;
|
|
|
|
} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
|
|
|
|
|
2002-07-05 23:58:49 +02:00
|
|
|
typedef struct __attribute__ ((aligned (8))) _SYSTEM_PROCESSOR_TIMES
|
2002-05-12 03:37:48 +02:00
|
|
|
{
|
|
|
|
LARGE_INTEGER IdleTime;
|
|
|
|
LARGE_INTEGER KernelTime;
|
|
|
|
LARGE_INTEGER UserTime;
|
|
|
|
LARGE_INTEGER DpcTime;
|
|
|
|
LARGE_INTEGER InterruptTime;
|
|
|
|
ULONG InterruptCount;
|
|
|
|
} SYSTEM_PROCESSOR_TIMES, *PSYSTEM_PROCESSOR_TIMES;
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
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 _CLIENT_ID
|
|
|
|
{
|
|
|
|
HANDLE UniqueProcess;
|
|
|
|
HANDLE UniqueThread;
|
|
|
|
} CLIENT_ID, *PCLIENT_ID;
|
|
|
|
|
|
|
|
typedef enum
|
|
|
|
{
|
|
|
|
StateInitialized,
|
|
|
|
StateReady,
|
|
|
|
StateRunning,
|
|
|
|
StateStandby,
|
|
|
|
StateTerminated,
|
|
|
|
StateWait,
|
|
|
|
StateTransition,
|
|
|
|
StateUnknown,
|
|
|
|
} THREAD_STATE;
|
2000-10-24 20:44:56 +02:00
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
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;
|
2002-05-12 03:37:48 +02:00
|
|
|
DWORD Reserved;
|
2000-11-02 06:25:56 +01:00
|
|
|
} SYSTEM_THREADS, *PSYSTEM_THREADS;
|
|
|
|
|
|
|
|
typedef struct _SYSTEM_PROCESSES
|
|
|
|
{
|
|
|
|
ULONG NextEntryDelta;
|
2002-05-12 03:37:48 +02:00
|
|
|
ULONG ThreadCount;
|
2000-11-02 06:25:56 +01:00
|
|
|
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;
|
|
|
|
|
2001-10-16 16:53:26 +02:00
|
|
|
typedef struct _IO_STATUS_BLOCK
|
|
|
|
{
|
|
|
|
NTSTATUS Status;
|
|
|
|
ULONG Information;
|
|
|
|
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
|
|
|
|
2002-05-12 03:37:48 +02:00
|
|
|
typedef struct _SYSTEM_PERFORMANCE_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER IdleTime;
|
|
|
|
LARGE_INTEGER ReadTransferCount;
|
|
|
|
LARGE_INTEGER WriteTransferCount;
|
|
|
|
LARGE_INTEGER OtherTransferCount;
|
|
|
|
ULONG ReadOperationCount;
|
|
|
|
ULONG WriteOperationCount;
|
|
|
|
ULONG OtherOperationCount;
|
|
|
|
ULONG AvailablePages;
|
|
|
|
ULONG TotalCommittedPages;
|
|
|
|
ULONG TotalCommitLimit;
|
|
|
|
ULONG PeakCommitment;
|
|
|
|
ULONG PageFaults;
|
|
|
|
ULONG WriteCopyFaults;
|
|
|
|
ULONG TransitionFaults;
|
|
|
|
ULONG Reserved1;
|
|
|
|
ULONG DemandZeroFaults;
|
|
|
|
ULONG PagesRead;
|
|
|
|
ULONG PageReadIos;
|
|
|
|
ULONG Reserved2[2];
|
|
|
|
ULONG PagefilePagesWritten;
|
|
|
|
ULONG PagefilePageWriteIos;
|
|
|
|
ULONG MappedFilePagesWritten;
|
|
|
|
ULONG MappedFilePageWriteIos;
|
|
|
|
ULONG PagedPoolUsage;
|
|
|
|
ULONG NonPagedPoolUsage;
|
|
|
|
ULONG PagedPoolAllocs;
|
|
|
|
ULONG PagedPoolFrees;
|
|
|
|
ULONG NonPagedPoolAllocs;
|
|
|
|
ULONG NonPagedPoolFrees;
|
|
|
|
ULONG TotalFreeSystemPtes;
|
|
|
|
ULONG SystemCodePage;
|
|
|
|
ULONG TotalSystemDriverPages;
|
|
|
|
ULONG TotalSystemCodePages;
|
|
|
|
ULONG SmallNonPagedLookasideListAllocateHits;
|
|
|
|
ULONG SmallPagedLookasideListAllocateHits;
|
|
|
|
ULONG Reserved3;
|
|
|
|
ULONG MmSystemCachePage;
|
|
|
|
ULONG PagedPoolPage;
|
|
|
|
ULONG SystemDriverPage;
|
|
|
|
ULONG FastReadNoWait;
|
|
|
|
ULONG FastReadWait;
|
|
|
|
ULONG FastReadResourceMiss;
|
|
|
|
ULONG FastReadNotPossible;
|
|
|
|
ULONG FastMdlReadNoWait;
|
|
|
|
ULONG FastMdlReadWait;
|
|
|
|
ULONG FastMdlReadResourceMiss;
|
|
|
|
ULONG FastMdlReadNotPossible;
|
|
|
|
ULONG MapDataNoWait;
|
|
|
|
ULONG MapDataWait;
|
|
|
|
ULONG MapDataNoWaitMiss;
|
|
|
|
ULONG MapDataWaitMiss;
|
|
|
|
ULONG PinMappedDataCount;
|
|
|
|
ULONG PinReadNoWait;
|
|
|
|
ULONG PinReadWait;
|
|
|
|
ULONG PinReadNoWaitMiss;
|
|
|
|
ULONG PinReadWaitMiss;
|
|
|
|
ULONG CopyReadNoWait;
|
|
|
|
ULONG CopyReadWait;
|
|
|
|
ULONG CopyReadNoWaitMiss;
|
|
|
|
ULONG CopyReadWaitMiss;
|
|
|
|
ULONG MdlReadNoWait;
|
|
|
|
ULONG MdlReadWait;
|
|
|
|
ULONG MdlReadNoWaitMiss;
|
|
|
|
ULONG MdlReadWaitMiss;
|
|
|
|
ULONG ReadAheadIos;
|
|
|
|
ULONG LazyWriteIos;
|
|
|
|
ULONG LazyWritePages;
|
|
|
|
ULONG DataFlushes;
|
|
|
|
ULONG DataPages;
|
|
|
|
ULONG ContextSwitches;
|
|
|
|
ULONG FirstLevelTbFills;
|
|
|
|
ULONG SecondLevelTbFills;
|
|
|
|
ULONG SystemCalls;
|
|
|
|
} SYSTEM_PERFORMANCE_INFORMATION, *PSYSTEM_PERFORMANCE_INFORMATION;
|
|
|
|
|
2002-07-05 23:58:49 +02:00
|
|
|
typedef struct __attribute__ ((aligned(8))) _SYSTEM_TIME_OF_DAY_INFORMATION
|
2002-05-12 03:37:48 +02:00
|
|
|
{
|
|
|
|
LARGE_INTEGER BootTime;
|
|
|
|
LARGE_INTEGER CurrentTime;
|
|
|
|
LARGE_INTEGER TimeZoneBias;
|
|
|
|
ULONG CurrentTimeZoneId;
|
|
|
|
} SYSTEM_TIME_OF_DAY_INFORMATION, *PSYSTEM_TIME_OF_DAY_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _PROCESSINFOCLASS
|
|
|
|
{
|
|
|
|
ProcessBasicInformation = 0,
|
|
|
|
ProcessQuotaLimits = 1,
|
|
|
|
ProcessVmCounters = 3,
|
|
|
|
ProcessTimes =4,
|
|
|
|
} PROCESSINFOCLASS;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_BUFFER
|
|
|
|
{
|
|
|
|
HANDLE SectionHandle;
|
|
|
|
PVOID SectionBase;
|
|
|
|
PVOID RemoteSectionBase;
|
|
|
|
ULONG SectionBaseDelta;
|
|
|
|
HANDLE EventPairHandle;
|
|
|
|
ULONG Unknown[2];
|
|
|
|
HANDLE RemoteThreadHandle;
|
|
|
|
ULONG InfoClassMask;
|
|
|
|
ULONG SizeOfInfo;
|
|
|
|
ULONG AllocatedSize;
|
|
|
|
ULONG SectionSize;
|
|
|
|
PVOID ModuleInformation;
|
|
|
|
PVOID BackTraceInformation;
|
|
|
|
PVOID HeapInformation;
|
|
|
|
PVOID LockInformation;
|
|
|
|
PVOID Reserved[9];
|
|
|
|
} DEBUG_BUFFER, *PDEBUG_BUFFER;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_HEAP_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG Base;
|
|
|
|
ULONG Flags;
|
|
|
|
USHORT Granularity;
|
|
|
|
USHORT Unknown;
|
|
|
|
ULONG Allocated;
|
|
|
|
ULONG Committed;
|
|
|
|
ULONG TagCount;
|
|
|
|
ULONG BlockCount;
|
|
|
|
ULONG Reserved[7];
|
|
|
|
PVOID Tags;
|
|
|
|
PVOID Blocks;
|
|
|
|
} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_MODULE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG Reserved[2];
|
|
|
|
ULONG Base;
|
|
|
|
ULONG Size;
|
|
|
|
ULONG Flags;
|
|
|
|
USHORT Index;
|
|
|
|
USHORT Unknown;
|
|
|
|
USHORT LoadCount;
|
|
|
|
USHORT ModuleNameOffset;
|
|
|
|
CHAR ImageName[256];
|
|
|
|
} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _KERNEL_USER_TIMES
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CreateTime;
|
|
|
|
LARGE_INTEGER ExitTime;
|
|
|
|
LARGE_INTEGER KernelTime;
|
|
|
|
LARGE_INTEGER UserTime;
|
|
|
|
} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
|
|
|
|
|
|
|
|
typedef void *PPEB;
|
|
|
|
|
|
|
|
typedef struct _PROCESS_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
NTSTATUS ExitStatus;
|
|
|
|
PPEB PebBaseAddress;
|
|
|
|
KAFFINITY AffinityMask;
|
|
|
|
KPRIORITY BasePriority;
|
|
|
|
ULONG UniqueProcessId;
|
|
|
|
ULONG InheritedFromUniqueProcessId;
|
|
|
|
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _MEMORY_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
MemoryBasicInformation,
|
|
|
|
MemoryWorkingSetList,
|
|
|
|
MemorySectionName,
|
2003-01-13 04:55:00 +01:00
|
|
|
MemoryBasicVlmInformation
|
2002-05-12 03:37:48 +02:00
|
|
|
} MEMORY_INFORMATION_CLASS;
|
|
|
|
|
2002-05-28 03:55:40 +02:00
|
|
|
typedef struct _MEMORY_WORKING_SET_LIST
|
|
|
|
{
|
2002-05-12 03:37:48 +02:00
|
|
|
ULONG NumberOfPages;
|
|
|
|
ULONG WorkingSetList[1];
|
|
|
|
} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
|
|
|
|
|
2005-04-12 16:26:31 +02:00
|
|
|
typedef struct _FILE_BASIC_INFORMATION {
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
} FILE_BASIC_INFORMATION, *PFILE_BASIC_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_STANDARD_INFORMATION {
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
ULONG NumberOfLinks;
|
|
|
|
BOOLEAN DeletePending;
|
|
|
|
BOOLEAN Directory;
|
|
|
|
} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_INTERNAL_INFORMATION {
|
|
|
|
LARGE_INTEGER IndexNumber;
|
|
|
|
} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_EA_INFORMATION {
|
|
|
|
ULONG EaSize;
|
|
|
|
} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_ACCESS_INFORMATION {
|
|
|
|
ACCESS_MASK AccessFlags;
|
|
|
|
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
|
|
|
|
|
2005-05-02 05:50:11 +02:00
|
|
|
typedef struct _FILE_POSITION_INFORMATION {
|
|
|
|
LARGE_INTEGER CurrentByteOffset;
|
|
|
|
} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
|
2005-04-12 16:26:31 +02:00
|
|
|
|
|
|
|
typedef struct _FILE_MODE_INFORMATION {
|
|
|
|
ULONG Mode;
|
|
|
|
} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_ALIGNMENT_INFORMATION {
|
|
|
|
ULONG AlignmentRequirement;
|
|
|
|
} FILE_ALIGNMENT_INFORMATION;
|
|
|
|
|
2005-05-02 05:50:11 +02:00
|
|
|
typedef struct _FILE_NAME_INFORMATION {
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
|
2005-04-12 16:26:31 +02:00
|
|
|
|
|
|
|
typedef struct _FILE_ALL_INFORMATION {
|
|
|
|
FILE_BASIC_INFORMATION BasicInformation;
|
|
|
|
FILE_STANDARD_INFORMATION StandardInformation;
|
|
|
|
FILE_INTERNAL_INFORMATION InternalInformation;
|
|
|
|
FILE_EA_INFORMATION EaInformation;
|
|
|
|
FILE_ACCESS_INFORMATION AccessInformation;
|
|
|
|
FILE_POSITION_INFORMATION PositionInformation;
|
|
|
|
FILE_MODE_INFORMATION ModeInformation;
|
|
|
|
FILE_ALIGNMENT_INFORMATION AlignmentInformation;
|
|
|
|
FILE_NAME_INFORMATION NameInformation;
|
|
|
|
} FILE_ALL_INFORMATION, *PFILE_ALL_INFORMATION;
|
2002-05-28 03:55:40 +02:00
|
|
|
|
2004-09-03 03:32:02 +02:00
|
|
|
typedef struct _FILE_PIPE_LOCAL_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NamedPipeType;
|
|
|
|
ULONG NamedPipeConfiguration;
|
|
|
|
ULONG MaximumInstances;
|
|
|
|
ULONG CurrentInstances;
|
|
|
|
ULONG InboundQuota;
|
|
|
|
ULONG ReadDataAvailable;
|
|
|
|
ULONG OutboundQuota;
|
|
|
|
ULONG WriteQuotaAvailable;
|
|
|
|
ULONG NamedPipeState;
|
|
|
|
ULONG NamedPipeEnd;
|
|
|
|
} FILE_PIPE_LOCAL_INFORMATION, *PFILE_PIPE_LOCAL_INFORMATION;
|
|
|
|
|
2004-04-06 12:19:31 +02:00
|
|
|
typedef struct _FILE_COMPRESSION_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CompressedSize;
|
|
|
|
USHORT CompressionFormat;
|
|
|
|
UCHAR CompressionUnitShift;
|
|
|
|
UCHAR Unknown;
|
|
|
|
UCHAR ClusterSizeShift;
|
|
|
|
} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _FILE_INFORMATION_CLASS
|
|
|
|
{
|
2005-04-12 16:26:31 +02:00
|
|
|
FileAllInformation = 18,
|
2004-09-03 03:32:02 +02:00
|
|
|
FilePipeLocalInformation = 24,
|
2004-04-06 12:19:31 +02:00
|
|
|
FileCompressionInformation = 28
|
|
|
|
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
|
|
|
|
2005-04-12 16:26:31 +02:00
|
|
|
typedef struct _FILE_FS_VOLUME_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER VolumeCreationTime;
|
|
|
|
ULONG VolumeSerialNumber;
|
|
|
|
ULONG VolumeLabelLength;
|
|
|
|
BOOLEAN SupportsObjects;
|
|
|
|
WCHAR VolumeLabel[1];
|
|
|
|
} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _FSINFOCLASS
|
|
|
|
{
|
|
|
|
FileFsVolumeInformation = 1
|
|
|
|
} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
|
|
|
|
|
2002-05-28 03:55:40 +02:00
|
|
|
typedef enum _OBJECT_INFORMATION_CLASS
|
|
|
|
{
|
2004-04-06 12:19:31 +02:00
|
|
|
ObjectBasicInformation = 0,
|
|
|
|
ObjectNameInformation = 1,
|
|
|
|
ObjectHandleInformation = 4
|
2002-05-28 03:55:40 +02:00
|
|
|
// and many more
|
|
|
|
} OBJECT_INFORMATION_CLASS;
|
|
|
|
|
|
|
|
typedef struct _OBJECT_NAME_INFORMATION
|
|
|
|
{
|
|
|
|
UNICODE_STRING Name;
|
|
|
|
} OBJECT_NAME_INFORMATION;
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
/* Function declarations for ntdll.dll. These don't appear in any
|
|
|
|
standard Win32 header. */
|
|
|
|
extern "C"
|
|
|
|
{
|
2004-04-16 23:22:13 +02:00
|
|
|
NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
|
|
|
|
ULONG, ULONG, PVOID, ULONG);
|
2005-11-28 23:32:29 +01:00
|
|
|
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
* autoload.cc: Add load statements for `LookupAccountNameW',
`LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory',
`LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum',
`NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and
`NtCreateToken'.
* ntdll.h: Add declaration for `NtCreateToken'.
* sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid',
`well_known_network_sid', `well_known_batch_sid',
`well_known_interactive_sid', `well_known_service_sid' and
`well_known_authenticated_users_sid'.
(cygsid::string): Define as const method.
(cygsid::get_sid): Set psid to NO_SID on error.
(cygsid::getfromstr): Ditto.
(cygsid::getfrompw): Simplify.
(cygsid::getfromgr): Check for gr == NULL.
(legal_sid_type): Move to security.h.
(set_process_privilege): Return -1 on error, otherwise 0 or 1 related
to previous privilege setting.
* security.cc (extract_nt_dom_user): Remove `static'.
(lsa2wchar): New function.
(open_local_policy): Ditto.
(close_local_policy): Ditto.
(get_lsa_srv_inf): Ditto.
(get_logon_server): Ditto.
(get_logon_server_and_user_domain): Ditto.
(get_user_groups): Ditto.
(is_group_member): Ditto.
(get_user_local_groups): Ditto.
(sid_in_token_groups): Ditto.
(get_user_primary_group): Ditto.
(get_group_sidlist): Ditto.
(get_system_priv_list): Ditto.
(get_priv_list): Ditto.
(get_dacl): Ditto.
(create_token): Ditto.
(subauth): Return immediately if SE_TCB_NAME can't be assigned.
Change all return statements in case of error to jumps to `out'
label. Add `out' label to support cleanup.
* security.h: Add extern declarations for `well_known_local_sid',
`well_known_dialup_sid', `well_known_network_sid',
`well_known_batch_sid', `well_known_interactive_sid',
`well_known_service_sid' and `well_known_authenticated_users_sid'.
Add extern declarations for functions `create_token',
`extract_nt_dom_user' and `get_logon_server_and_user_domain'.
(class cygsid): Add method `assign'. Change operator= to call new
`assign' method. Add `debug_print' method.
(class cygsidlist): New class.
(legal_sid_type): Moved from sec_helper.cc to here.
* spawn.cc (spawn_guts) Revert reversion of previous patch.
Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid'
again.
* syscalls.cc (seteuid): Rearranged. Call `create_token' now when
needed. Call `subauth' if `create_token' fails. Try setting token
owner and primary group only if token was not explicitely created
by `create_token'.
* uinfo.cc (internal_getlogin): Try harder to generate correct user
information. Especially don't trust return value of `GetUserName'.
2001-05-20 10:10:47 +02:00
|
|
|
NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2001-09-07 23:32:07 +02:00
|
|
|
TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
|
|
|
|
PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
|
|
|
|
PTOKEN_PRIMARY_GROUP, PTOKEN_DEFAULT_DACL,
|
|
|
|
PTOKEN_SOURCE);
|
2005-10-18 20:51:33 +02:00
|
|
|
NTSTATUS NTAPI NtLockVirtualMemory (HANDLE, PVOID *, ULONG *, ULONG);
|
2000-11-02 06:25:56 +01:00
|
|
|
NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER, PULONG, SECTION_INHERIT,
|
|
|
|
ULONG, ULONG);
|
2001-10-16 16:53:26 +02:00
|
|
|
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, ULONG, ULONG);
|
* autoload.cc: Add load statements for `LookupAccountNameW',
`LsaClose', `LsaEnumerateAccountRights', `LsaFreeMemory',
`LsaOpenPolicy', `LsaQueryInformationPolicy', `NetLocalGroupEnum',
`NetLocalGroupGetMembers', `NetServerEnum', `NetUserGetGroups' and
`NtCreateToken'.
* ntdll.h: Add declaration for `NtCreateToken'.
* sec_helper.cc: Add `well_known_local_sid', `well_known_dialup_sid',
`well_known_network_sid', `well_known_batch_sid',
`well_known_interactive_sid', `well_known_service_sid' and
`well_known_authenticated_users_sid'.
(cygsid::string): Define as const method.
(cygsid::get_sid): Set psid to NO_SID on error.
(cygsid::getfromstr): Ditto.
(cygsid::getfrompw): Simplify.
(cygsid::getfromgr): Check for gr == NULL.
(legal_sid_type): Move to security.h.
(set_process_privilege): Return -1 on error, otherwise 0 or 1 related
to previous privilege setting.
* security.cc (extract_nt_dom_user): Remove `static'.
(lsa2wchar): New function.
(open_local_policy): Ditto.
(close_local_policy): Ditto.
(get_lsa_srv_inf): Ditto.
(get_logon_server): Ditto.
(get_logon_server_and_user_domain): Ditto.
(get_user_groups): Ditto.
(is_group_member): Ditto.
(get_user_local_groups): Ditto.
(sid_in_token_groups): Ditto.
(get_user_primary_group): Ditto.
(get_group_sidlist): Ditto.
(get_system_priv_list): Ditto.
(get_priv_list): Ditto.
(get_dacl): Ditto.
(create_token): Ditto.
(subauth): Return immediately if SE_TCB_NAME can't be assigned.
Change all return statements in case of error to jumps to `out'
label. Add `out' label to support cleanup.
* security.h: Add extern declarations for `well_known_local_sid',
`well_known_dialup_sid', `well_known_network_sid',
`well_known_batch_sid', `well_known_interactive_sid',
`well_known_service_sid' and `well_known_authenticated_users_sid'.
Add extern declarations for functions `create_token',
`extract_nt_dom_user' and `get_logon_server_and_user_domain'.
(class cygsid): Add method `assign'. Change operator= to call new
`assign' method. Add `debug_print' method.
(class cygsidlist): New class.
(legal_sid_type): Moved from sec_helper.cc to here.
* spawn.cc (spawn_guts) Revert reversion of previous patch.
Call `RevertToSelf' and `ImpersonateLoggedOnUser' instead of `seteuid'
again.
* syscalls.cc (seteuid): Rearranged. Call `create_token' now when
needed. Call `subauth' if `create_token' fails. Try setting token
owner and primary group only if token was not explicitely created
by `create_token'.
* uinfo.cc (internal_getlogin): Try harder to generate correct user
information. Especially don't trust return value of `GetUserName'.
2001-05-20 10:10:47 +02:00
|
|
|
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2005-04-12 16:26:31 +02:00
|
|
|
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
2004-09-03 03:32:02 +02:00
|
|
|
ULONG, FILE_INFORMATION_CLASS);
|
2002-05-30 09:45:30 +02:00
|
|
|
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
|
2003-03-09 21:31:07 +01:00
|
|
|
PVOID, ULONG, PULONG);
|
2002-05-30 09:45:30 +02:00
|
|
|
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
|
2003-03-09 21:31:07 +01:00
|
|
|
ULONG, ULONG *);
|
2000-11-02 06:25:56 +01:00
|
|
|
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
|
|
|
PVOID, ULONG, PULONG);
|
2004-04-13 14:14:59 +02:00
|
|
|
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
|
|
|
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
2002-05-30 09:45:30 +02:00
|
|
|
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
2003-03-09 21:31:07 +01:00
|
|
|
PVOID, ULONG, PULONG);
|
2005-04-12 16:26:31 +02:00
|
|
|
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *,
|
|
|
|
VOID *, ULONG,
|
|
|
|
FS_INFORMATION_CLASS);
|
2004-04-14 12:20:26 +02:00
|
|
|
NTSTATUS NTAPI NtSetSecurityObject (HANDLE, SECURITY_INFORMATION,
|
|
|
|
PSECURITY_DESCRIPTOR);
|
2005-10-18 20:51:33 +02:00
|
|
|
NTSTATUS NTAPI NtUnlockVirtualMemory (HANDLE, PVOID *, ULONG *, ULONG);
|
2000-11-02 06:25:56 +01:00
|
|
|
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
|
|
|
|
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
|
|
|
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
|
2004-06-03 23:29:43 +02:00
|
|
|
ULONG WINAPI RtlIsDosDeviceName_U (PCWSTR);
|
2000-11-02 06:25:56 +01:00
|
|
|
}
|