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
|
|
|
|
2009-01-16 13:17:28 +01:00
|
|
|
Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
|
2010-01-29 12:20:06 +01:00
|
|
|
2009, 2010 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. */
|
|
|
|
|
2010-03-15 22:29:15 +01:00
|
|
|
#ifndef _NTDLL_H
|
|
|
|
#define _NTDLL_H 1
|
2009-01-07 19:18:23 +01:00
|
|
|
#define STATUS_NOT_ALL_ASSIGNED ((NTSTATUS) 0x00000106)
|
2008-04-21 14:46:58 +02:00
|
|
|
#define STATUS_OBJECT_NAME_EXISTS ((NTSTATUS) 0x40000000)
|
|
|
|
#define STATUS_BUFFER_OVERFLOW ((NTSTATUS) 0x80000005)
|
|
|
|
#define STATUS_NO_MORE_FILES ((NTSTATUS) 0x80000006)
|
2006-05-14 20:32:57 +02:00
|
|
|
#ifndef STATUS_INVALID_INFO_CLASS
|
|
|
|
/* Some w32api header file defines this so we need to conditionalize this
|
|
|
|
define to avoid warnings. */
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_INVALID_INFO_CLASS ((NTSTATUS) 0xc0000003)
|
2006-05-14 20:32:57 +02:00
|
|
|
#endif
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_INFO_LENGTH_MISMATCH ((NTSTATUS) 0xc0000004)
|
|
|
|
#define STATUS_INVALID_PARAMETER ((NTSTATUS) 0xc000000d)
|
2007-08-23 09:43:24 +02:00
|
|
|
#define STATUS_NO_SUCH_FILE ((NTSTATUS) 0xc000000f)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_INVALID_DEVICE_REQUEST ((NTSTATUS) 0xc0000010)
|
2007-10-13 13:06:43 +02:00
|
|
|
#define STATUS_END_OF_FILE ((NTSTATUS) 0xc0000011)
|
2007-08-01 14:55:25 +02:00
|
|
|
#define STATUS_NO_MEDIA_IN_DEVICE ((NTSTATUS) 0xc0000013)
|
2007-08-01 16:46:09 +02:00
|
|
|
#define STATUS_ACCESS_DENIED ((NTSTATUS) 0xc0000022)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_BUFFER_TOO_SMALL ((NTSTATUS) 0xc0000023)
|
2007-09-20 17:14:13 +02:00
|
|
|
#define STATUS_OBJECT_NAME_INVALID ((NTSTATUS) 0xc0000033)
|
2007-08-01 14:55:25 +02:00
|
|
|
#define STATUS_OBJECT_NAME_NOT_FOUND ((NTSTATUS) 0xc0000034)
|
2007-08-12 14:48:02 +02:00
|
|
|
#define STATUS_OBJECT_PATH_NOT_FOUND ((NTSTATUS) 0xc000003A)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_SHARING_VIOLATION ((NTSTATUS) 0xc0000043)
|
2009-01-07 19:18:23 +01:00
|
|
|
#define STATUS_EAS_NOT_SUPPORTED ((NTSTATUS) 0xc000004f)
|
* Makefile.in (DLL_OFILES): Add ntea.o.
* cygwin.din (getxattr, listxattr, removexattr, setxattr, lgetxattr,
llistxattr, lremovexattr, lsetxattr, fgetxattr, flistxattr,
fremovexattr, fsetxattr): Export Linux extended attribute functions.
Sort.
* errno.cc (errmap): Add mappings for ERROR_EAS_DIDNT_FIT,
ERROR_EAS_NOT_SUPPORTED, ERROR_EA_LIST_INCONSISTENT,
ERROR_EA_TABLE_FULL, ERROR_FILE_CORRUPT, ERROR_INVALID_EA_NAME.
* fhandler.h (class fhandler_base): Declare new fgetxattr and
fsetxattr methods.
(class fhandler_disk_file): Ditto.
* fhandler.cc (fhandler_base::fgetxattr): New method.
(fhandler_base::fsetxattr): New method.
* fhandler_disk_file.cc (fhandler_disk_file::fgetxattr): New method.
(fhandler_disk_file::fsetxattr): New method.
* ntdll.h (STATUS_EA_TOO_LARGE): Define.
(STATUS_NONEXISTENT_EA_ENTRY): Define.
(STATUS_NO_EAS_ON_FILE): Define.
* ntea.cc (read_ea): Rewrite for long pathnames and for using with
Linux extended attribute functions.
(write_ea): Ditto.
(getxattr_worker): New static function.
(getxattr): New function.
(lgetxattr): New function.
(fgetxattr): New function.
(listxattr): New function.
(llistxattr): New function.
(flistxattr): New function.
(setxattr_worker): New static function.
(setxattr): New function.
(lsetxattr): New function.
(fsetxattr): New function.
(removexattr): New function.
(lsetxattr): New function.
(fsetxattr): New function.
* security.h (read_ea): Change declaration according to above changes.
(write_ea): Ditto.
* include/cygwin/version.h: Bump API minor version.
2008-02-10 16:43:04 +01:00
|
|
|
#define STATUS_EA_TOO_LARGE ((NTSTATUS) 0xc0000050)
|
|
|
|
#define STATUS_NONEXISTENT_EA_ENTRY ((NTSTATUS) 0xc0000051)
|
|
|
|
#define STATUS_NO_EAS_ON_FILE ((NTSTATUS) 0xc0000052)
|
2009-04-16 14:16:35 +02:00
|
|
|
#define STATUS_LOCK_NOT_GRANTED ((NTSTATUS) 0xc0000055)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_DELETE_PENDING ((NTSTATUS) 0xc0000056)
|
2007-10-15 10:25:38 +02:00
|
|
|
#define STATUS_DISK_FULL ((NTSTATUS) 0xc000007f)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_WORKING_SET_QUOTA ((NTSTATUS) 0xc00000a1)
|
2007-07-29 10:23:04 +02:00
|
|
|
#define STATUS_NOT_SUPPORTED ((NTSTATUS) 0xc00000bb)
|
2010-06-02 16:52:34 +02:00
|
|
|
#define STATUS_BAD_NETWORK_PATH ((NTSTATUS) 0xc00000be)
|
2010-01-29 12:20:06 +01:00
|
|
|
#define STATUS_INVALID_NETWORK_RESPONSE ((NTSTATUS) 0xc00000c3)
|
2010-06-02 16:52:34 +02:00
|
|
|
#define STATUS_BAD_NETWORK_NAME ((NTSTATUS) 0xc00000cc)
|
2007-07-29 14:27:22 +02:00
|
|
|
#define STATUS_DIRECTORY_NOT_EMPTY ((NTSTATUS) 0xc0000101)
|
2009-01-07 19:18:23 +01:00
|
|
|
#define STATUS_CANNOT_DELETE ((NTSTATUS) 0xc0000121)
|
2007-07-27 18:24:07 +02:00
|
|
|
#define STATUS_INVALID_LEVEL ((NTSTATUS) 0xc0000148)
|
2008-04-21 14:46:58 +02:00
|
|
|
#define STATUS_DLL_NOT_FOUND ((NTSTATUS) 0xc0000135)
|
|
|
|
#define STATUS_ENTRYPOINT_NOT_FOUND ((NTSTATUS) 0xc0000139)
|
|
|
|
#define STATUS_BAD_DLL_ENTRYPOINT ((NTSTATUS) 0xc0000251)
|
|
|
|
#define STATUS_ILLEGAL_DLL_RELOCATION ((NTSTATUS) 0xc0000269)
|
2009-10-07 17:47:38 +02:00
|
|
|
/* custom status code: */
|
|
|
|
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((NTSTATUS) 0xe0000269)
|
2008-03-27 02:50:40 +01:00
|
|
|
|
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
|
|
|
|
|
2007-08-12 14:48:02 +02:00
|
|
|
#define FILE_SUPERSEDED 0
|
|
|
|
#define FILE_OPENED 1
|
|
|
|
#define FILE_CREATED 2
|
|
|
|
#define FILE_OVERWRITTEN 3
|
|
|
|
#define FILE_EXISTS 4
|
|
|
|
#define FILE_DOES_NOT_EXIST 5
|
|
|
|
|
2007-10-15 10:25:38 +02:00
|
|
|
#define FILE_WRITE_TO_END_OF_FILE (-1LL)
|
|
|
|
#define FILE_USE_FILE_POINTER_POSITION (-2LL)
|
|
|
|
|
2007-08-01 14:55:25 +02:00
|
|
|
/* Device Characteristics. */
|
|
|
|
#define FILE_REMOVABLE_MEDIA 0x00000001
|
|
|
|
#define FILE_READ_ONLY_DEVICE 0x00000002
|
|
|
|
#define FILE_FLOPPY_DISKETTE 0x00000004
|
|
|
|
#define FILE_WRITE_ONCE_MEDIA 0x00000008
|
|
|
|
#define FILE_REMOTE_DEVICE 0x00000010
|
|
|
|
#define FILE_DEVICE_IS_MOUNTED 0x00000020
|
|
|
|
#define FILE_VIRTUAL_VOLUME 0x00000040
|
|
|
|
#define FILE_AUTOGENERATED_DEVICE_NAME 0x00000080
|
|
|
|
#define FILE_DEVICE_SECURE_OPEN 0x00000100
|
|
|
|
|
2008-05-15 18:34:01 +02:00
|
|
|
/* Transaction access rights. */
|
|
|
|
#define TRANSACTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x3F)
|
|
|
|
|
2006-01-25 06:57:20 +01:00
|
|
|
typedef enum _FILE_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
FileDirectoryInformation = 1,
|
|
|
|
FileFullDirectoryInformation, // 2
|
|
|
|
FileBothDirectoryInformation, // 3
|
|
|
|
FileBasicInformation, // 4 wdm
|
|
|
|
FileStandardInformation, // 5 wdm
|
|
|
|
FileInternalInformation, // 6
|
|
|
|
FileEaInformation, // 7
|
|
|
|
FileAccessInformation, // 8
|
|
|
|
FileNameInformation, // 9
|
|
|
|
FileRenameInformation, // 10
|
|
|
|
FileLinkInformation, // 11
|
|
|
|
FileNamesInformation, // 12
|
|
|
|
FileDispositionInformation, // 13
|
|
|
|
FilePositionInformation, // 14 wdm
|
|
|
|
FileFullEaInformation, // 15
|
|
|
|
FileModeInformation, // 16
|
|
|
|
FileAlignmentInformation, // 17
|
|
|
|
FileAllInformation, // 18
|
|
|
|
FileAllocationInformation, // 19
|
|
|
|
FileEndOfFileInformation, // 20 wdm
|
|
|
|
FileAlternateNameInformation, // 21
|
|
|
|
FileStreamInformation, // 22
|
|
|
|
FilePipeInformation, // 23
|
|
|
|
FilePipeLocalInformation, // 24
|
|
|
|
FilePipeRemoteInformation, // 25
|
|
|
|
FileMailslotQueryInformation, // 26
|
|
|
|
FileMailslotSetInformation, // 27
|
|
|
|
FileCompressionInformation, // 28
|
|
|
|
FileObjectIdInformation, // 29
|
|
|
|
FileCompletionInformation, // 30
|
|
|
|
FileMoveClusterInformation, // 31
|
|
|
|
FileQuotaInformation, // 32
|
|
|
|
FileReparsePointInformation, // 33
|
|
|
|
FileNetworkOpenInformation, // 34
|
|
|
|
FileAttributeTagInformation, // 35
|
|
|
|
FileTrackingInformation, // 36
|
|
|
|
FileIdBothDirectoryInformation, // 37
|
|
|
|
FileIdFullDirectoryInformation, // 38
|
|
|
|
FileValidDataLengthInformation, // 39
|
|
|
|
FileShortNameInformation, // 40
|
|
|
|
FileMaximumInformation
|
|
|
|
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
|
|
|
|
2007-03-02 21:04:26 +01:00
|
|
|
typedef struct _FILE_NAMES_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG FileIndex;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
|
|
|
|
|
2007-07-26 19:30:54 +02:00
|
|
|
typedef struct _FILE_DIRECTORY_INFORMATION {
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG FileIndex;
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
|
|
|
|
|
2010-01-29 12:20:06 +01:00
|
|
|
typedef struct _FILE_BOTH_DIRECTORY_INFORMATION
|
2006-01-25 06:57:20 +01:00
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG FileIndex;
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
ULONG EaSize;
|
|
|
|
CCHAR ShortNameLength;
|
|
|
|
WCHAR ShortName[12];
|
|
|
|
WCHAR FileName[1];
|
2010-01-29 12:20:06 +01:00
|
|
|
} FILE_BOTH_DIRECTORY_INFORMATION, *PFILE_BOTH_DIRECTORY_INFORMATION;
|
2006-01-25 06:57:20 +01:00
|
|
|
|
|
|
|
typedef struct _FILE_ID_BOTH_DIR_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG FileIndex;
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
ULONG EaSize;
|
|
|
|
CCHAR ShortNameLength;
|
|
|
|
WCHAR ShortName[12];
|
|
|
|
LARGE_INTEGER FileId;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
2006-03-09 10:01:08 +01:00
|
|
|
#define DIRECTORY_QUERY 1
|
2008-03-27 21:03:32 +01:00
|
|
|
#define DIRECTORY_TRAVERSE 2
|
|
|
|
#define DIRECTORY_CREATE_OBJECT 4
|
|
|
|
#define DIRECTORY_CREATE_SUBDIRECTORY 8
|
2008-03-24 15:48:58 +01:00
|
|
|
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x0f)
|
2006-03-09 10:01:08 +01:00
|
|
|
|
2008-03-27 21:03:32 +01:00
|
|
|
#define EVENT_QUERY_STATE 1
|
2008-04-21 14:46:58 +02:00
|
|
|
#define SEMAPHORE_QUERY_STATE 1
|
|
|
|
|
|
|
|
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
|
|
|
|
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
|
2008-11-26 18:21:04 +01:00
|
|
|
| DIRECTORY_TRAVERSE \
|
|
|
|
| DIRECTORY_CREATE_SUBDIRECTORY \
|
|
|
|
| DIRECTORY_CREATE_OBJECT \
|
|
|
|
| READ_CONTROL)
|
2008-04-21 14:46:58 +02:00
|
|
|
|
|
|
|
#define CYG_MUTANT_ACCESS (MUTANT_QUERY_STATE \
|
|
|
|
| SYNCHRONIZE \
|
|
|
|
| READ_CONTROL)
|
|
|
|
|
|
|
|
#define CYG_EVENT_ACCESS (EVENT_QUERY_STATE \
|
|
|
|
| EVENT_MODIFY_STATE \
|
|
|
|
| SYNCHRONIZE \
|
|
|
|
| READ_CONTROL)
|
|
|
|
|
|
|
|
#define CYG_SEMAPHORE_ACCESS (SEMAPHORE_QUERY_STATE \
|
|
|
|
| SEMAPHORE_MODIFY_STATE \
|
|
|
|
| SYNCHRONIZE \
|
|
|
|
| READ_CONTROL)
|
2008-03-27 21:03:32 +01:00
|
|
|
|
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,
|
2008-04-21 14:46:58 +02:00
|
|
|
ProcessTimes = 4,
|
|
|
|
ProcessSessionInformation = 24,
|
2009-07-12 23:15:47 +02:00
|
|
|
ProcessWow64Information = 26
|
2002-05-12 03:37:48 +02:00
|
|
|
} 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;
|
|
|
|
|
2007-01-16 19:01:06 +01:00
|
|
|
typedef struct _RTL_USER_PROCESS_PARAMETERS
|
|
|
|
{
|
|
|
|
ULONG AllocationSize;
|
|
|
|
ULONG Size;
|
|
|
|
ULONG Flags;
|
|
|
|
ULONG DebugFlags;
|
|
|
|
HANDLE hConsole;
|
|
|
|
ULONG ProcessGroup;
|
|
|
|
HANDLE hStdInput;
|
|
|
|
HANDLE hStdOutput;
|
|
|
|
HANDLE hStdError;
|
|
|
|
UNICODE_STRING CurrentDirectoryName;
|
|
|
|
HANDLE CurrentDirectoryHandle;
|
|
|
|
UNICODE_STRING DllPath;
|
|
|
|
UNICODE_STRING ImagePathName;
|
|
|
|
UNICODE_STRING CommandLine;
|
|
|
|
PWSTR Environment;
|
|
|
|
ULONG dwX;
|
|
|
|
ULONG dwY;
|
|
|
|
ULONG dwXSize;
|
|
|
|
ULONG dwYSize;
|
|
|
|
ULONG dwXCountChars;
|
|
|
|
ULONG dwYCountChars;
|
|
|
|
ULONG dwFillAttribute;
|
|
|
|
ULONG dwFlags;
|
|
|
|
ULONG wShowWindow;
|
|
|
|
UNICODE_STRING WindowTitle;
|
|
|
|
UNICODE_STRING DesktopInfo;
|
|
|
|
UNICODE_STRING ShellInfo;
|
|
|
|
UNICODE_STRING RuntimeInfo;
|
|
|
|
} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
|
|
|
|
|
|
|
|
typedef struct _PEB
|
|
|
|
{
|
|
|
|
BYTE Reserved1[2];
|
|
|
|
BYTE BeingDebugged;
|
|
|
|
BYTE Reserved2[9];
|
|
|
|
PVOID LoaderData;
|
|
|
|
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
|
|
|
BYTE Reserved3[448];
|
|
|
|
ULONG SessionId;
|
|
|
|
} PEB, *PPEB;
|
2002-05-12 03:37:48 +02:00
|
|
|
|
2007-10-23 18:26:28 +02:00
|
|
|
/* Simplifed definition, just to get the PEB pointer. */
|
|
|
|
typedef struct _TEB
|
|
|
|
{
|
|
|
|
PVOID dummy[12];
|
|
|
|
PPEB Peb;
|
|
|
|
/* A lot more follows... */
|
|
|
|
} TEB, *PTEB;
|
|
|
|
|
2002-05-12 03:37:48 +02:00
|
|
|
typedef struct _PROCESS_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
NTSTATUS ExitStatus;
|
|
|
|
PPEB PebBaseAddress;
|
|
|
|
KAFFINITY AffinityMask;
|
|
|
|
KPRIORITY BasePriority;
|
|
|
|
ULONG UniqueProcessId;
|
|
|
|
ULONG InheritedFromUniqueProcessId;
|
|
|
|
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
|
|
|
|
|
2008-04-21 14:46:58 +02:00
|
|
|
typedef struct _PROCESS_SESSION_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG SessionId;
|
|
|
|
} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
|
|
|
|
|
2002-05-12 03:37:48 +02:00
|
|
|
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;
|
|
|
|
|
2007-07-19 19:22:34 +02:00
|
|
|
typedef struct _FILE_NETWORK_OPEN_INFORMATION {
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
} FILE_NETWORK_OPEN_INFORMATION, *PFILE_NETWORK_OPEN_INFORMATION;
|
|
|
|
|
2005-04-12 16:26:31 +02:00
|
|
|
typedef struct _FILE_INTERNAL_INFORMATION {
|
2006-01-27 22:50:42 +01:00
|
|
|
LARGE_INTEGER FileId;
|
2005-04-12 16:26:31 +02:00
|
|
|
} 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;
|
|
|
|
|
2006-12-07 18:40:24 +01:00
|
|
|
typedef struct _FILE_DISPOSITION_INFORMATION {
|
|
|
|
BOOLEAN DeleteFile;
|
|
|
|
} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_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
|
|
|
|
2006-08-07 21:29:14 +02:00
|
|
|
typedef struct _FILE_END_OF_FILE_INFORMATION {
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_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
|
|
|
|
2007-07-27 18:24:07 +02:00
|
|
|
typedef struct _FILE_LINK_INFORMATION {
|
|
|
|
BOOLEAN ReplaceIfExists;
|
|
|
|
HANDLE RootDirectory;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
|
|
|
|
|
2006-12-10 17:43:30 +01:00
|
|
|
typedef struct _FILE_RENAME_INFORMATION {
|
|
|
|
BOOLEAN ReplaceIfExists;
|
|
|
|
HANDLE RootDirectory;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_RENAME_INFORMATION, *PFILE_RENAME_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
|
|
|
|
{
|
2007-09-27 11:35:06 +02:00
|
|
|
LARGE_INTEGER CompressedFileSize;
|
2004-04-06 12:19:31 +02:00
|
|
|
USHORT CompressionFormat;
|
|
|
|
UCHAR CompressionUnitShift;
|
2007-09-27 11:35:06 +02:00
|
|
|
UCHAR ChunkShift;
|
|
|
|
UCHAR ClusterShift;
|
|
|
|
UCHAR Reserved[3];
|
2004-04-06 12:19:31 +02:00
|
|
|
} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
|
|
|
|
|
2007-08-01 14:55:25 +02:00
|
|
|
typedef struct _FILE_FS_DEVICE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG DeviceType;
|
|
|
|
ULONG Characteristics;
|
|
|
|
} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
|
|
|
|
|
2007-02-27 13:58:56 +01:00
|
|
|
typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG FileSystemAttributes;
|
|
|
|
ULONG MaximumComponentNameLength;
|
|
|
|
ULONG FileSystemNameLength;
|
|
|
|
WCHAR FileSystemName[1];
|
|
|
|
} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
|
|
|
|
|
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;
|
|
|
|
|
2006-03-24 15:52:08 +01:00
|
|
|
typedef struct _FILE_FS_SIZE_INFORMATION
|
2005-04-12 16:26:31 +02:00
|
|
|
{
|
2006-03-24 15:52:08 +01:00
|
|
|
LARGE_INTEGER TotalAllocationUnits;
|
|
|
|
LARGE_INTEGER AvailableAllocationUnits;
|
|
|
|
ULONG SectorsPerAllocationUnit;
|
|
|
|
ULONG BytesPerSector;
|
|
|
|
} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
|
|
|
|
|
2007-02-27 13:58:56 +01:00
|
|
|
typedef struct _FILE_FS_FULL_SIZE_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER TotalAllocationUnits;
|
|
|
|
LARGE_INTEGER CallerAvailableAllocationUnits;
|
|
|
|
LARGE_INTEGER ActualAvailableAllocationUnits;
|
|
|
|
ULONG SectorsPerAllocationUnit;
|
|
|
|
ULONG BytesPerSector;
|
|
|
|
} FILE_FS_FULL_SIZE_INFORMATION, *PFILE_FS_FULL_SIZE_INFORMATION;
|
|
|
|
|
2008-01-22 18:43:22 +01:00
|
|
|
typedef struct _FILE_FS_OBJECTID_INFORMATION {
|
|
|
|
UCHAR ObjectId[16];
|
|
|
|
UCHAR ExtendedInfo[48];
|
|
|
|
} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
|
|
|
|
|
2006-03-24 15:52:08 +01:00
|
|
|
typedef enum _FSINFOCLASS {
|
|
|
|
FileFsVolumeInformation = 1,
|
|
|
|
FileFsLabelInformation,
|
|
|
|
FileFsSizeInformation,
|
|
|
|
FileFsDeviceInformation,
|
|
|
|
FileFsAttributeInformation,
|
|
|
|
FileFsControlInformation,
|
|
|
|
FileFsFullSizeInformation,
|
|
|
|
FileFsObjectIdInformation,
|
|
|
|
FileFsDriverPathInformation,
|
|
|
|
FileFsMaximumInformation
|
2005-04-12 16:26:31 +02:00
|
|
|
} 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;
|
|
|
|
|
2008-03-24 15:48:58 +01:00
|
|
|
typedef struct _OBJECT_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG Attributes;
|
|
|
|
ACCESS_MASK GrantedAccess;
|
|
|
|
ULONG HandleCount;
|
|
|
|
ULONG PointerCount;
|
|
|
|
ULONG PagedPoolUsage;
|
|
|
|
ULONG NonPagedPoolUsage;
|
|
|
|
ULONG Reserved[3];
|
|
|
|
ULONG NameInformationLength;
|
|
|
|
ULONG TypeInformationLength;
|
|
|
|
ULONG SecurityDescriptorLength;
|
|
|
|
LARGE_INTEGER CreateTime;
|
|
|
|
} OBJECT_BASIC_INFORMATION, *POBJECT_BASIC_INFORMATION;
|
|
|
|
|
2002-05-28 03:55:40 +02:00
|
|
|
typedef struct _OBJECT_NAME_INFORMATION
|
|
|
|
{
|
|
|
|
UNICODE_STRING Name;
|
|
|
|
} OBJECT_NAME_INFORMATION;
|
|
|
|
|
2006-03-09 10:01:08 +01:00
|
|
|
typedef struct _DIRECTORY_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
UNICODE_STRING ObjectName;
|
|
|
|
UNICODE_STRING ObjectTypeName;
|
|
|
|
} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
|
|
|
|
|
2006-07-03 20:30:08 +02:00
|
|
|
typedef struct _FILE_GET_EA_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
UCHAR EaNameLength;
|
|
|
|
CHAR EaName[1];
|
|
|
|
} FILE_GET_EA_INFORMATION, *PFILE_GET_EA_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_FULL_EA_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
UCHAR Flags;
|
|
|
|
UCHAR EaNameLength;
|
|
|
|
USHORT EaValueLength;
|
|
|
|
CHAR EaName[1];
|
|
|
|
} FILE_FULL_EA_INFORMATION, *PFILE_FULL_EA_INFORMATION;
|
|
|
|
|
2007-08-13 17:08:25 +02:00
|
|
|
typedef struct _FILE_MAILSLOT_SET_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER ReadTimeout;
|
|
|
|
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
|
|
|
|
|
2007-08-12 14:48:02 +02:00
|
|
|
typedef VOID NTAPI (*PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG);
|
|
|
|
|
2008-03-24 15:48:58 +01:00
|
|
|
typedef enum _EVENT_TYPE
|
|
|
|
{
|
|
|
|
NotificationEvent = 0,
|
|
|
|
SynchronizationEvent
|
|
|
|
} EVENT_TYPE, *PEVENT_TYPE;
|
|
|
|
|
2008-03-31 20:03:25 +02:00
|
|
|
typedef struct _EVENT_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
EVENT_TYPE EventType;
|
|
|
|
LONG SignalState;
|
|
|
|
} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _EVENT_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
EventBasicInformation = 0
|
|
|
|
} EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
/* Function declarations for ntdll.dll. These don't appear in any
|
|
|
|
standard Win32 header. */
|
2009-12-18 21:32:04 +01:00
|
|
|
|
|
|
|
#define NtCurrentProcess() ((HANDLE) 0xffffffff)
|
|
|
|
#define NtCurrentThread() ((HANDLE) 0xfffffffe)
|
|
|
|
|
2010-06-15 14:05:15 +02:00
|
|
|
/* Helper macro for sync I/O with async handle. */
|
|
|
|
inline NTSTATUS
|
|
|
|
wait_pending (NTSTATUS status, HANDLE h, IO_STATUS_BLOCK &io)
|
|
|
|
{
|
|
|
|
if (status != STATUS_PENDING)
|
|
|
|
return status;
|
|
|
|
WaitForSingleObject (h, INFINITE);
|
|
|
|
return io.Status;
|
|
|
|
}
|
|
|
|
|
2000-11-02 06:25:56 +01:00
|
|
|
extern "C"
|
|
|
|
{
|
2007-07-19 10:33:22 +02:00
|
|
|
NTSTATUS NTAPI NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES,
|
|
|
|
ULONG, PTOKEN_PRIVILEGES, PULONG);
|
2006-03-09 10:01:08 +01:00
|
|
|
NTSTATUS NTAPI NtClose (HANDLE);
|
2008-05-15 18:34:01 +02:00
|
|
|
NTSTATUS NTAPI NtCommitTransaction (HANDLE, BOOLEAN);
|
2008-03-24 15:48:58 +01:00
|
|
|
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
|
|
|
|
POBJECT_ATTRIBUTES);
|
|
|
|
NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2008-11-26 18:21:04 +01:00
|
|
|
EVENT_TYPE, BOOLEAN);
|
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);
|
2007-08-13 17:08:25 +02:00
|
|
|
NTSTATUS NTAPI NtCreateMailslotFile(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, ULONG, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER);
|
2008-03-24 15:48:58 +01:00
|
|
|
NTSTATUS NTAPI NtCreateMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
BOOLEAN);
|
2005-11-28 23:32:29 +01:00
|
|
|
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2008-02-15 18:53:11 +01:00
|
|
|
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
2008-04-21 14:46:58 +02:00
|
|
|
NTSTATUS NTAPI NtCreateSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
LONG, LONG);
|
* 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);
|
2008-05-15 18:34:01 +02:00
|
|
|
NTSTATUS NTAPI NtCreateTransaction (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
LPGUID, HANDLE, ULONG, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER, PUNICODE_STRING);
|
2007-08-12 14:48:02 +02:00
|
|
|
NTSTATUS NTAPI NtFsControlFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
2007-07-26 19:30:54 +02:00
|
|
|
PIO_STATUS_BLOCK, ULONG, PVOID, ULONG,
|
|
|
|
PVOID, ULONG);
|
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);
|
2007-08-21 14:37:40 +02:00
|
|
|
NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE,
|
2008-02-15 18:53:11 +01:00
|
|
|
PVOID, PIO_STATUS_BLOCK,
|
2007-08-21 14:37:40 +02:00
|
|
|
PFILE_NOTIFY_INFORMATION, ULONG,
|
|
|
|
ULONG, BOOLEAN);
|
2006-03-09 10:01:08 +01:00
|
|
|
NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK,
|
2008-02-15 18:53:11 +01:00
|
|
|
POBJECT_ATTRIBUTES);
|
2008-03-24 15:48:58 +01:00
|
|
|
NTSTATUS NTAPI NtOpenEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2001-10-16 16:53:26 +02:00
|
|
|
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, ULONG, ULONG);
|
2008-03-24 15:48:58 +01:00
|
|
|
NTSTATUS NTAPI NtOpenMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
* 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);
|
2008-04-21 14:46:58 +02:00
|
|
|
NTSTATUS NTAPI NtOpenSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2007-08-21 14:37:40 +02:00
|
|
|
/* WARNING! Don't rely on the timestamp information returned by
|
|
|
|
NtQueryAttributesFile. Only the DOS file attribute info is reliable. */
|
|
|
|
NTSTATUS NTAPI NtQueryAttributesFile (POBJECT_ATTRIBUTES,
|
|
|
|
PFILE_BASIC_INFORMATION);
|
2006-03-09 10:01:08 +01:00
|
|
|
NTSTATUS NTAPI NtQueryDirectoryFile(HANDLE, HANDLE, PVOID, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PVOID, ULONG,
|
|
|
|
FILE_INFORMATION_CLASS, BOOLEAN,
|
|
|
|
PUNICODE_STRING, BOOLEAN);
|
|
|
|
NTSTATUS NTAPI NtQueryDirectoryObject (HANDLE, PVOID, ULONG, BOOLEAN,
|
2008-02-15 18:53:11 +01:00
|
|
|
BOOLEAN, PULONG, PULONG);
|
2006-07-03 20:30:08 +02:00
|
|
|
NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
|
|
|
|
BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
2008-03-31 20:03:25 +02:00
|
|
|
NTSTATUS NTAPI NtQueryEvent (HANDLE, EVENT_INFORMATION_CLASS, PVOID, ULONG,
|
|
|
|
PULONG);
|
2007-07-19 19:22:34 +02:00
|
|
|
NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES,
|
|
|
|
PFILE_NETWORK_OPEN_INFORMATION);
|
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);
|
2010-03-15 22:29:15 +01:00
|
|
|
|
|
|
|
NTSTATUS WINAPI NtQuerySystemTime (PLARGE_INTEGER);
|
|
|
|
|
2004-04-13 14:14:59 +02:00
|
|
|
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
2008-02-15 18:53:11 +01:00
|
|
|
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);
|
2007-08-15 17:17:05 +02:00
|
|
|
NTSTATUS NTAPI NtReadFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
|
|
|
|
PULONG);
|
2008-05-15 18:34:01 +02:00
|
|
|
NTSTATUS NTAPI NtRollbackTransaction (HANDLE, BOOLEAN);
|
2006-07-03 20:30:08 +02:00
|
|
|
NTSTATUS NTAPI NtSetEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
|
2006-08-07 21:29:14 +02:00
|
|
|
NTSTATUS NTAPI NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
|
|
|
|
FILE_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);
|
2007-08-12 14:48:02 +02:00
|
|
|
NTSTATUS NTAPI NtWriteFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
|
|
|
|
PULONG);
|
2007-07-26 19:30:54 +02:00
|
|
|
NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR);
|
|
|
|
NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING,
|
|
|
|
PUNICODE_STRING);
|
2007-08-16 16:30:53 +02:00
|
|
|
VOID NTAPI RtlAcquirePebLock ();
|
2007-01-16 19:01:06 +01:00
|
|
|
NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-26 19:30:54 +02:00
|
|
|
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-09 12:32:25 +02:00
|
|
|
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
2007-07-26 19:30:54 +02:00
|
|
|
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
|
2007-08-16 12:41:45 +02:00
|
|
|
BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
|
2007-12-12 13:12:24 +01:00
|
|
|
NTSTATUS NTAPI RtlDowncaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-26 19:30:54 +02:00
|
|
|
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-31 22:48:17 +02:00
|
|
|
VOID NTAPI RtlFreeAnsiString (PANSI_STRING);
|
|
|
|
VOID NTAPI RtlFreeOemString (POEM_STRING);
|
2007-07-26 19:30:54 +02:00
|
|
|
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
|
2008-05-15 18:34:01 +02:00
|
|
|
HANDLE NTAPI RtlGetCurrentTransaction ();
|
2007-07-26 19:30:54 +02:00
|
|
|
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
|
2000-11-02 06:25:56 +01:00
|
|
|
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
2007-08-09 12:32:25 +02:00
|
|
|
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
|
2006-03-09 10:01:08 +01:00
|
|
|
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
|
2000-11-02 06:25:56 +01:00
|
|
|
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
|
2007-01-16 19:01:06 +01:00
|
|
|
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-31 17:20:00 +02:00
|
|
|
BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-16 16:30:53 +02:00
|
|
|
VOID NTAPI RtlReleasePebLock ();
|
2007-07-26 19:30:54 +02:00
|
|
|
VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER);
|
2008-05-15 18:34:01 +02:00
|
|
|
BOOLEAN NTAPI RtlSetCurrentTransaction (HANDLE);
|
2007-07-31 22:48:17 +02:00
|
|
|
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
|
|
|
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-16 12:41:45 +02:00
|
|
|
WCHAR NTAPI RtlUpcaseUnicodeChar (WCHAR);
|
2007-12-12 13:12:24 +01:00
|
|
|
NTSTATUS NTAPI RtlUpcaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-26 19:30:54 +02:00
|
|
|
|
|
|
|
/* A few Rtl functions are either actually macros, or they just don't
|
2007-08-12 14:48:02 +02:00
|
|
|
exist even though they would be a big help. We implement them here,
|
|
|
|
partly as inline functions. */
|
|
|
|
|
|
|
|
/* RtlInitEmptyUnicodeString is defined as a macro in wdm.h, but that file
|
|
|
|
is missing entirely in w32api. */
|
2007-07-26 19:30:54 +02:00
|
|
|
inline
|
|
|
|
VOID NTAPI RtlInitEmptyUnicodeString(PUNICODE_STRING dest, PCWSTR buf,
|
|
|
|
USHORT len)
|
|
|
|
{
|
|
|
|
dest->Length = 0;
|
|
|
|
dest->MaximumLength = len;
|
|
|
|
dest->Buffer = (PWSTR) buf;
|
|
|
|
}
|
2007-08-12 14:48:02 +02:00
|
|
|
/* Like RtlInitEmptyUnicodeString, but initialize Length to len, too.
|
|
|
|
This is for instance useful when creating a UNICODE_STRING from an
|
|
|
|
NtQueryInformationFile info buffer, where the length of the filename
|
|
|
|
is known, but you can't rely on the string being 0-terminated.
|
|
|
|
If you know it's 0-terminated, just use RtlInitUnicodeString(). */
|
2007-07-26 19:30:54 +02:00
|
|
|
inline
|
2007-07-28 18:00:35 +02:00
|
|
|
VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf,
|
2008-02-15 18:53:11 +01:00
|
|
|
USHORT len)
|
2007-07-26 19:30:54 +02:00
|
|
|
{
|
|
|
|
dest->Length = dest->MaximumLength = len;
|
|
|
|
dest->Buffer = (PWSTR) buf;
|
|
|
|
}
|
2007-08-12 14:48:02 +02:00
|
|
|
/* Split path into dirname and basename part. This function does not
|
|
|
|
copy anything! It just initializes the dirname and basename
|
|
|
|
UNICODE_STRINGs so that their Buffer members point to the right spot
|
2008-02-15 18:53:11 +01:00
|
|
|
into path's Buffer, and the Length (and MaximumLength) members are set
|
2007-08-12 14:48:02 +02:00
|
|
|
to match the dirname part and the basename part.
|
|
|
|
Note that dirname's Length is set so that it also includes the trailing
|
|
|
|
backslash. If you don't need it, just subtract sizeof(WCHAR) from
|
|
|
|
dirname.Length. */
|
2007-07-27 12:10:57 +02:00
|
|
|
inline
|
2007-08-12 14:48:02 +02:00
|
|
|
VOID NTAPI RtlSplitUnicodePath (PUNICODE_STRING path, PUNICODE_STRING dirname,
|
|
|
|
PUNICODE_STRING basename)
|
2007-07-27 12:10:57 +02:00
|
|
|
{
|
|
|
|
USHORT len = path->Length / sizeof (WCHAR);
|
|
|
|
while (len > 0 && path->Buffer[--len] != L'\\')
|
|
|
|
;
|
|
|
|
++len;
|
2007-08-12 14:48:02 +02:00
|
|
|
if (dirname)
|
|
|
|
RtlInitCountedUnicodeString (dirname, path->Buffer, len * sizeof (WCHAR));
|
|
|
|
if (basename)
|
|
|
|
RtlInitCountedUnicodeString (basename, &path->Buffer[len],
|
2007-07-28 18:00:35 +02:00
|
|
|
path->Length - len * sizeof (WCHAR));
|
|
|
|
}
|
2007-08-12 14:48:02 +02:00
|
|
|
/* Check if prefix is a prefix of path. */
|
2007-07-28 18:00:35 +02:00
|
|
|
inline
|
2009-07-14 19:37:42 +02:00
|
|
|
BOOLEAN NTAPI RtlEqualUnicodePathPrefix (PUNICODE_STRING path,
|
|
|
|
PUNICODE_STRING prefix,
|
2007-07-28 18:08:45 +02:00
|
|
|
BOOLEAN caseinsensitive)
|
2007-07-28 18:00:35 +02:00
|
|
|
{
|
2009-07-14 19:37:42 +02:00
|
|
|
UNICODE_STRING p;
|
2007-07-28 18:00:35 +02:00
|
|
|
|
|
|
|
RtlInitCountedUnicodeString (&p, path->Buffer,
|
2009-07-14 19:37:42 +02:00
|
|
|
prefix->Length < path->Length
|
|
|
|
? prefix->Length : path->Length);
|
|
|
|
return RtlEqualUnicodeString (&p, prefix, caseinsensitive);
|
2007-07-28 18:00:35 +02:00
|
|
|
}
|
2007-08-12 14:48:02 +02:00
|
|
|
/* Check if sufffix is a sufffix of path. */
|
2007-07-28 18:00:35 +02:00
|
|
|
inline
|
2009-07-14 19:37:42 +02:00
|
|
|
BOOL NTAPI RtlEqualUnicodePathSuffix (PUNICODE_STRING path,
|
|
|
|
PUNICODE_STRING suffix,
|
2007-07-28 18:08:45 +02:00
|
|
|
BOOLEAN caseinsensitive)
|
2007-07-28 18:00:35 +02:00
|
|
|
{
|
2009-07-14 19:37:42 +02:00
|
|
|
UNICODE_STRING p;
|
2007-07-28 18:00:35 +02:00
|
|
|
|
2009-07-14 19:37:42 +02:00
|
|
|
if (suffix->Length < path->Length)
|
2007-07-28 18:00:35 +02:00
|
|
|
RtlInitCountedUnicodeString (&p, (PWCHAR) ((PBYTE) path->Buffer
|
2009-07-14 19:37:42 +02:00
|
|
|
+ path->Length - suffix->Length),
|
|
|
|
suffix->Length);
|
2007-07-28 18:00:35 +02:00
|
|
|
else
|
|
|
|
RtlInitCountedUnicodeString (&p, path->Buffer, path->Length);
|
2009-07-14 19:37:42 +02:00
|
|
|
return RtlEqualUnicodeString (&p, suffix, caseinsensitive);
|
2007-07-27 12:10:57 +02:00
|
|
|
}
|
2007-08-12 14:48:02 +02:00
|
|
|
/* Implemented in strfuncs.cc. Create a Hex UNICODE_STRING from a given
|
|
|
|
64 bit integer value. If append is TRUE, append the hex string,
|
2007-12-12 13:12:24 +01:00
|
|
|
otherwise overwrite dest. Returns either STATUS_SUCCESS, or
|
2007-08-12 14:48:02 +02:00
|
|
|
STATUS_BUFFER_OVERFLOW, if the unicode buffer is too small (hasn't
|
|
|
|
room for 16 WCHARs). */
|
|
|
|
NTSTATUS NTAPI RtlInt64ToHexUnicodeString (ULONGLONG value,
|
|
|
|
PUNICODE_STRING dest,
|
|
|
|
BOOLEAN append);
|
2008-10-20 21:30:06 +02:00
|
|
|
/* Set file attributes. Don't change file times. */
|
|
|
|
inline
|
|
|
|
NTSTATUS NTAPI NtSetAttributesFile (HANDLE h, ULONG attr)
|
|
|
|
{
|
|
|
|
IO_STATUS_BLOCK io;
|
|
|
|
FILE_BASIC_INFORMATION fbi;
|
|
|
|
fbi.CreationTime.QuadPart = fbi.LastAccessTime.QuadPart =
|
|
|
|
fbi.LastWriteTime.QuadPart = fbi.ChangeTime.QuadPart = 0LL;
|
|
|
|
fbi.FileAttributes = attr ?: FILE_ATTRIBUTE_NORMAL;
|
|
|
|
return NtSetInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
|
|
|
|
}
|
2000-11-02 06:25:56 +01:00
|
|
|
}
|
2010-03-15 22:29:15 +01:00
|
|
|
#endif /*_NTDLL_H*/
|