2001-04-29 10:54:36 +08:00
|
|
|
/* ntdll.h. Contains ntdll specific stuff not defined elsewhere.
|
2000-10-25 02:44:56 +08: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. */
|
|
|
|
|
2012-07-22 06:58:20 +08:00
|
|
|
#pragma once
|
2011-12-05 23:46:26 +08:00
|
|
|
|
2018-03-01 23:50:41 +08:00
|
|
|
#include <w32api/ntstatus.h>
|
|
|
|
|
2018-03-03 01:07:39 +08:00
|
|
|
/* Values for Cygwin AF_UNIX socket reparse points. */
|
2018-03-01 23:54:57 +08:00
|
|
|
#define IO_REPARSE_TAG_CYGUNIX (0x00006375)
|
2018-03-03 01:07:39 +08:00
|
|
|
extern GUID __cygwin_socket_guid;
|
|
|
|
#define CYGWIN_SOCKET_GUID (&__cygwin_socket_guid)
|
2012-11-26 21:28:53 +08:00
|
|
|
|
2019-04-15 23:43:57 +08:00
|
|
|
/* Custom Cygwin-only status codes. */
|
|
|
|
#define STATUS_THREAD_SIGNALED ((NTSTATUS)0xe0000001)
|
|
|
|
#define STATUS_THREAD_CANCELED ((NTSTATUS)0xe0000002)
|
2020-09-19 23:15:40 +08:00
|
|
|
#define STATUS_ILLEGAL_DLL_PSEUDO_RELOCATION ((DWORD) 0xe0000269)
|
2008-03-27 09:50:40 +08:00
|
|
|
|
2018-03-01 23:51:12 +08:00
|
|
|
/* Simplify checking for a transactional error code. */
|
|
|
|
#define NT_TRANSACTIONAL_ERROR(s) \
|
|
|
|
(((ULONG)(s) >= (ULONG)STATUS_TRANSACTIONAL_CONFLICT) \
|
|
|
|
&& ((ULONG)(s) <= (ULONG)STATUS_TRANSACTION_NOT_ENLISTED))
|
2013-04-23 17:44:36 +08:00
|
|
|
|
|
|
|
#define NtCurrentProcess() ((HANDLE) (LONG_PTR) -1)
|
|
|
|
#define NtCurrentThread() ((HANDLE) (LONG_PTR) -2)
|
2002-05-12 09:37:48 +08:00
|
|
|
|
2012-06-28 22:06:06 +08:00
|
|
|
/* Creation information returned in IO_STATUS_BLOCK. */
|
2007-08-12 20:48:02 +08: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
|
|
|
|
|
2011-12-05 23:46:26 +08:00
|
|
|
/* Relative file position values in NtWriteFile call. */
|
2007-10-15 16:25:38 +08:00
|
|
|
#define FILE_WRITE_TO_END_OF_FILE (-1LL)
|
|
|
|
#define FILE_USE_FILE_POINTER_POSITION (-2LL)
|
|
|
|
|
2007-08-01 20:55:25 +08: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
|
|
|
|
|
2011-12-05 23:46:26 +08:00
|
|
|
/* Lock type in NtLockVirtualMemory/NtUnlockVirtualMemory call. */
|
|
|
|
#define MAP_PROCESS 1
|
|
|
|
#define MAP_SYSTEM 2
|
|
|
|
|
|
|
|
/* Directory access rights (only in NT namespace). */
|
|
|
|
#define DIRECTORY_QUERY 1
|
|
|
|
#define DIRECTORY_TRAVERSE 2
|
|
|
|
#define DIRECTORY_CREATE_OBJECT 4
|
|
|
|
#define DIRECTORY_CREATE_SUBDIRECTORY 8
|
|
|
|
#define DIRECTORY_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|0x0f)
|
|
|
|
|
|
|
|
/* Symbolic link access rights (only in NT namespace). */
|
|
|
|
#define SYMBOLIC_LINK_QUERY 1
|
2018-03-03 01:03:11 +08:00
|
|
|
#define SYMBOLIC_LINK_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x1)
|
2011-12-05 23:46:26 +08:00
|
|
|
|
2008-05-16 00:34:01 +08:00
|
|
|
/* Transaction access rights. */
|
2013-10-05 22:34:41 +08:00
|
|
|
#ifndef TRANSACTION_ALL_ACCESS
|
2008-05-16 00:34:01 +08:00
|
|
|
#define TRANSACTION_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED | 0x3F)
|
2013-10-05 22:34:41 +08:00
|
|
|
#endif
|
2008-05-16 00:34:01 +08:00
|
|
|
|
2011-12-05 23:46:26 +08:00
|
|
|
/* Event object access rights. */
|
|
|
|
#define EVENT_QUERY_STATE 1
|
|
|
|
|
|
|
|
/* Semaphore access rights. */
|
|
|
|
#define SEMAPHORE_QUERY_STATE 1
|
|
|
|
|
|
|
|
/* Specific ACCESS_MASKSs for objects created in Cygwin. */
|
|
|
|
#define CYG_SHARED_DIR_ACCESS (DIRECTORY_QUERY \
|
|
|
|
| DIRECTORY_TRAVERSE \
|
|
|
|
| DIRECTORY_CREATE_SUBDIRECTORY \
|
|
|
|
| DIRECTORY_CREATE_OBJECT \
|
|
|
|
| READ_CONTROL)
|
|
|
|
#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)
|
|
|
|
|
|
|
|
/* Definitions for first parameter of RtlQueryRegistryValues. */
|
|
|
|
#define RTL_REGISTRY_ABSOLUTE 0
|
|
|
|
#define RTL_REGISTRY_SERVICES 1
|
|
|
|
#define RTL_REGISTRY_CONTROL 2
|
|
|
|
#define RTL_REGISTRY_WINDOWS_NT 3
|
|
|
|
#define RTL_REGISTRY_DEVICEMAP 4
|
|
|
|
#define RTL_REGISTRY_USER 5
|
|
|
|
#define RTL_REGISTRY_HANDLE 0x40000000
|
|
|
|
#define RTL_REGISTRY_OPTIONAL 0x80000000
|
|
|
|
|
|
|
|
/* Flags values for QueryTable parameter of RtlQueryRegistryValues. */
|
|
|
|
#define RTL_QUERY_REGISTRY_SUBKEY 0x01
|
|
|
|
#define RTL_QUERY_REGISTRY_TOPKEY 0x02
|
|
|
|
#define RTL_QUERY_REGISTRY_REQUIRED 0x04
|
|
|
|
#define RTL_QUERY_REGISTRY_NOVALUE 0x08
|
|
|
|
#define RTL_QUERY_REGISTRY_NOEXPAND 0x10
|
|
|
|
#define RTL_QUERY_REGISTRY_DIRECT 0x20
|
|
|
|
#define RTL_QUERY_REGISTRY_DELETE 0x40
|
|
|
|
#define RTL_QUERY_REGISTRY_NOSTRING 0x80
|
|
|
|
|
|
|
|
/* What RtlQueryProcessDebugInformation shall return. */
|
|
|
|
#define PDI_MODULES 0x01
|
|
|
|
#define PDI_HEAPS 0x04
|
|
|
|
#define PDI_HEAP_BLOCKS 0x10
|
2013-04-23 17:44:36 +08:00
|
|
|
#define PDI_WOW64_MODULES 0x40
|
2011-12-05 23:46:26 +08:00
|
|
|
|
|
|
|
/* VM working set list protection values. Returned by NtQueryVirtualMemory. */
|
|
|
|
#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
|
|
|
|
|
|
|
|
/* Known debug heap flags */
|
|
|
|
#define HEAP_FLAG_NOSERIALIZE 0x1
|
|
|
|
#define HEAP_FLAG_GROWABLE 0x2
|
|
|
|
#define HEAP_FLAG_EXCEPTIONS 0x4
|
|
|
|
#define HEAP_FLAG_NONDEFAULT 0x1000
|
|
|
|
#define HEAP_FLAG_SHAREABLE 0x8000
|
|
|
|
#define HEAP_FLAG_EXECUTABLE 0x40000
|
|
|
|
#define HEAP_FLAG_DEBUGGED 0x40000000
|
|
|
|
|
2014-10-17 16:19:27 +08:00
|
|
|
#define FILE_VC_QUOTA_NONE 0x00000000
|
|
|
|
#define FILE_VC_QUOTA_TRACK 0x00000001
|
|
|
|
#define FILE_VC_QUOTA_ENFORCE 0x00000002
|
|
|
|
#define FILE_VC_QUOTA_MASK 0x00000003
|
|
|
|
#define FILE_VC_CONTENT_INDEX_DISABLED 0x00000008
|
|
|
|
#define FILE_VC_LOG_QUOTA_THRESHOLD 0x00000010
|
|
|
|
#define FILE_VC_LOG_QUOTA_LIMIT 0x00000020
|
|
|
|
#define FILE_VC_LOG_VOLUME_THRESHOLD 0x00000040
|
|
|
|
#define FILE_VC_LOG_VOLUME_LIMIT 0x00000080
|
|
|
|
#define FILE_VC_QUOTAS_INCOMPLETE 0x00000100
|
|
|
|
#define FILE_VC_QUOTAS_REBUILDING 0x00000200
|
|
|
|
#define FILE_VC_VALID_MASK 0x000003ff
|
|
|
|
|
2011-12-05 23:46:26 +08:00
|
|
|
/* IOCTL code to impersonate client of named pipe. */
|
2018-03-08 04:54:46 +08:00
|
|
|
|
2018-03-07 01:24:13 +08:00
|
|
|
#define FSCTL_PIPE_DISCONNECT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 1, \
|
|
|
|
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define FSCTL_PIPE_LISTEN CTL_CODE(FILE_DEVICE_NAMED_PIPE, 2, \
|
2018-03-19 03:07:35 +08:00
|
|
|
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define FSCTL_PIPE_PEEK CTL_CODE(FILE_DEVICE_NAMED_PIPE, 3, \
|
|
|
|
METHOD_BUFFERED, FILE_READ_DATA)
|
2018-03-07 01:24:13 +08:00
|
|
|
#define FSCTL_PIPE_WAIT CTL_CODE(FILE_DEVICE_NAMED_PIPE, 6, \
|
|
|
|
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
|
|
|
#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \
|
|
|
|
METHOD_BUFFERED, FILE_ANY_ACCESS)
|
2018-03-08 04:54:46 +08:00
|
|
|
#define FSCTL_PIPE_FLUSH CTL_CODE(FILE_DEVICE_NAMED_PIPE, 16, \
|
|
|
|
METHOD_BUFFERED, FILE_WRITE_DATA)
|
2011-12-05 23:46:26 +08:00
|
|
|
|
2006-01-25 13:57:20 +08:00
|
|
|
typedef enum _FILE_INFORMATION_CLASS
|
|
|
|
{
|
2018-12-23 07:17:34 +08:00
|
|
|
FileDirectoryInformation = 1, // 1
|
|
|
|
FileFullDirectoryInformation, // 2
|
|
|
|
FileBothDirectoryInformation, // 3
|
|
|
|
FileBasicInformation, // 4
|
|
|
|
FileStandardInformation, // 5
|
|
|
|
FileInternalInformation, // 6
|
|
|
|
FileEaInformation, // 7
|
|
|
|
FileAccessInformation, // 8
|
|
|
|
FileNameInformation, // 9
|
|
|
|
FileRenameInformation, // 10
|
|
|
|
FileLinkInformation, // 11
|
|
|
|
FileNamesInformation, // 12
|
|
|
|
FileDispositionInformation, // 13
|
|
|
|
FilePositionInformation, // 14
|
|
|
|
FileFullEaInformation, // 15
|
|
|
|
FileModeInformation, // 16
|
|
|
|
FileAlignmentInformation, // 17
|
|
|
|
FileAllInformation, // 18
|
|
|
|
FileAllocationInformation, // 19
|
|
|
|
FileEndOfFileInformation, // 20
|
|
|
|
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
|
|
|
|
FileIoCompletionNotificationInformation, // 41
|
|
|
|
FileIoStatusBlockRangeInformation, // 42
|
|
|
|
FileIoPriorityHintInformation, // 43
|
|
|
|
FileSfioReserveInformation, // 44
|
|
|
|
FileSfioVolumeInformation, // 45
|
|
|
|
FileHardLinkInformation, // 46
|
|
|
|
FileProcessIdsUsingFileInformation, // 47
|
|
|
|
FileNormalizedNameInformation, // 48
|
|
|
|
FileNetworkPhysicalNameInformation, // 49
|
|
|
|
FileIdGlobalTxDirectoryInformation, // 50
|
|
|
|
FileIsRemoteDeviceInformation, // 51
|
|
|
|
FileUnusedInformation, // 52
|
|
|
|
FileNumaNodeInformation, // 53
|
|
|
|
FileStandardLinkInformation, // 54
|
|
|
|
FileRemoteProtocolInformation, // 55
|
|
|
|
FileRenameInformationBypassAccessCheck, // 56
|
|
|
|
FileLinkInformationBypassAccessCheck, // 57
|
|
|
|
FileVolumeNameInformation, // 58
|
|
|
|
FileIdInformation, // 59
|
|
|
|
FileIdExtdDirectoryInformation, // 60
|
|
|
|
FileReplaceCompletionInformation, // 61
|
|
|
|
FileHardLinkFullIdInformation, // 62
|
|
|
|
FileIdExtdBothDirectoryInformation, // 63
|
|
|
|
FileDispositionInformationEx, // 64
|
|
|
|
FileRenameInformationEx, // 65
|
|
|
|
FileRenameInformationExBypassAccessCheck, // 66
|
|
|
|
FileDesiredStorageClassInformation, // 67
|
|
|
|
FileStatInformation, // 68
|
|
|
|
FileMemoryPartitionInformation, // 69
|
|
|
|
FileStatLxInformation, // 70
|
|
|
|
FileCaseSensitiveInformation, // 71
|
|
|
|
FileLinkInformationEx, // 72
|
|
|
|
FileLinkInformationExBypassAccessCheck, // 73
|
|
|
|
FileStorageReserveIdInformation, // 74
|
|
|
|
FileCaseSensitiveInformationForceAccessCheck, // 75
|
2006-01-25 13:57:20 +08:00
|
|
|
FileMaximumInformation
|
|
|
|
} FILE_INFORMATION_CLASS, *PFILE_INFORMATION_CLASS;
|
|
|
|
|
2018-12-23 07:17:34 +08:00
|
|
|
typedef struct _FILE_DIRECTORY_INFORMATION // 1
|
2013-04-23 17:44:36 +08:00
|
|
|
{
|
2007-07-27 01:30:54 +08: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;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_DIRECTORY_INFORMATION, *PFILE_DIRECTORY_INFORMATION;
|
|
|
|
|
2018-12-23 07:17:34 +08:00
|
|
|
typedef struct _FILE_BOTH_DIR_INFORMATION // 3
|
2006-01-25 13:57:20 +08: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];
|
2013-04-23 17:44:36 +08:00
|
|
|
} FILE_BOTH_DIR_INFORMATION, *PFILE_BOTH_DIR_INFORMATION;
|
2006-01-25 13:57:20 +08:00
|
|
|
|
2018-12-23 07:17:34 +08:00
|
|
|
typedef struct _FILE_BASIC_INFORMATION // 4
|
|
|
|
{
|
|
|
|
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 // 5
|
|
|
|
{
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
ULONG NumberOfLinks;
|
|
|
|
BOOLEAN DeletePending;
|
|
|
|
BOOLEAN Directory;
|
|
|
|
} FILE_STANDARD_INFORMATION, *PFILE_STANDARD_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_INTERNAL_INFORMATION // 6
|
|
|
|
{
|
|
|
|
LARGE_INTEGER IndexNumber;
|
|
|
|
} FILE_INTERNAL_INFORMATION, *PFILE_INTERNAL_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_EA_INFORMATION // 7
|
|
|
|
{
|
|
|
|
ULONG EaSize;
|
|
|
|
} FILE_EA_INFORMATION, *PFILE_EA_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_ACCESS_INFORMATION // 8
|
|
|
|
{
|
|
|
|
ACCESS_MASK AccessFlags;
|
|
|
|
} FILE_ACCESS_INFORMATION, *PFILE_ACCESS_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_NAME_INFORMATION // 9, 21, 40
|
|
|
|
{
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_NAME_INFORMATION, *PFILE_NAME_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_RENAME_INFORMATION // 10, 56, 65, 66
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
BOOLEAN ReplaceIfExists; // FileRenameInformation
|
|
|
|
ULONG Flags; // FileRenameInformationEx
|
|
|
|
};
|
|
|
|
HANDLE RootDirectory;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_RENAME_INFORMATION, *PFILE_RENAME_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_LINK_INFORMATION // 11, 57, 72, 73
|
|
|
|
{
|
|
|
|
union
|
|
|
|
{
|
|
|
|
BOOLEAN ReplaceIfExists; // FileLinkInformation
|
|
|
|
ULONG Flags; // FileLinkInformationEx
|
|
|
|
};
|
|
|
|
HANDLE RootDirectory;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_LINK_INFORMATION, *PFILE_LINK_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_NAMES_INFORMATION // 12
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG FileIndex;
|
|
|
|
ULONG FileNameLength;
|
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_NAMES_INFORMATION, *PFILE_NAMES_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_DISPOSITION_INFORMATION // 13
|
|
|
|
{
|
|
|
|
BOOLEAN DeleteFile;
|
|
|
|
} FILE_DISPOSITION_INFORMATION, *PFILE_DISPOSITION_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_POSITION_INFORMATION // 14
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CurrentByteOffset;
|
|
|
|
} FILE_POSITION_INFORMATION, *PFILE_POSITION_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_MODE_INFORMATION // 16
|
|
|
|
{
|
|
|
|
ULONG Mode;
|
|
|
|
} FILE_MODE_INFORMATION, *PFILE_MODE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_ALIGNMENT_INFORMATION // 17
|
|
|
|
{
|
|
|
|
ULONG AlignmentRequirement;
|
|
|
|
} FILE_ALIGNMENT_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_ALL_INFORMATION { // 18
|
|
|
|
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;
|
|
|
|
|
|
|
|
typedef struct _FILE_END_OF_FILE_INFORMATION // 20
|
|
|
|
{
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
} FILE_END_OF_FILE_INFORMATION, *PFILE_END_OF_FILE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_PIPE_INFORMATION // 23
|
|
|
|
{
|
|
|
|
ULONG ReadMode;
|
|
|
|
ULONG CompletionMode;
|
|
|
|
} FILE_PIPE_INFORMATION, *PFILE_PIPE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_PIPE_LOCAL_INFORMATION // 24
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
typedef struct _FILE_COMPRESSION_INFORMATION // 28
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CompressedFileSize;
|
|
|
|
USHORT CompressionFormat;
|
|
|
|
UCHAR CompressionUnitShift;
|
|
|
|
UCHAR ChunkShift;
|
|
|
|
UCHAR ClusterShift;
|
|
|
|
UCHAR Reserved[3];
|
|
|
|
} FILE_COMPRESSION_INFORMATION, *PFILE_COMPRESSION_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_NETWORK_OPEN_INFORMATION // 34
|
|
|
|
{
|
|
|
|
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;
|
|
|
|
|
|
|
|
typedef struct _FILE_ID_BOTH_DIR_INFORMATION // 37
|
2006-01-25 13:57:20 +08: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];
|
2015-12-10 01:11:47 +08:00
|
|
|
LARGE_INTEGER FileId;
|
2006-01-25 13:57:20 +08:00
|
|
|
WCHAR FileName[1];
|
|
|
|
} FILE_ID_BOTH_DIR_INFORMATION, *PFILE_ID_BOTH_DIR_INFORMATION;
|
|
|
|
|
2018-12-23 07:17:34 +08:00
|
|
|
typedef struct _FILE_PROCESS_IDS_USING_FILE_INFORMATION // 47
|
|
|
|
{
|
|
|
|
ULONG NumberOfProcessIdsInList;
|
|
|
|
ULONG_PTR ProcessIdList[1];
|
|
|
|
} FILE_PROCESS_IDS_USING_FILE_INFORMATION,
|
|
|
|
*PFILE_PROCESS_IDS_USING_FILE_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_DISPOSITION_INFORMATION_EX // 64
|
|
|
|
{
|
|
|
|
ULONG Flags;
|
|
|
|
} FILE_DISPOSITION_INFORMATION_EX, *PFILE_DISPOSITION_INFORMATION_EX;
|
|
|
|
|
|
|
|
typedef struct _FILE_STAT_INFORMATION // 68
|
|
|
|
{
|
|
|
|
LARGE_INTEGER FileId;
|
|
|
|
LARGE_INTEGER CreationTime;
|
|
|
|
LARGE_INTEGER LastAccessTime;
|
|
|
|
LARGE_INTEGER LastWriteTime;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER AllocationSize;
|
|
|
|
LARGE_INTEGER EndOfFile;
|
|
|
|
ULONG FileAttributes;
|
|
|
|
ULONG ReparseTag;
|
|
|
|
ULONG NumberOfLinks;
|
|
|
|
ACCESS_MASK EffectiveAccess;
|
|
|
|
} FILE_STAT_INFORMATION, *PFILE_STAT_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_CASE_SENSITIVE_INFORMATION // 71
|
|
|
|
{
|
|
|
|
ULONG Flags;
|
|
|
|
} FILE_CASE_SENSITIVE_INFORMATION, *PFILE_CASE_SENSITIVE_INFORMATION;
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FILE_LINK_REPLACE_IF_EXISTS = 0x01,
|
|
|
|
FILE_LINK_POSIX_SEMANTICS = 0x02,
|
|
|
|
FILE_LINK_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x08,
|
|
|
|
FILE_LINK_NO_INCREASE_AVAILABLE_SPACE = 0x10,
|
|
|
|
FILE_LINK_NO_DECREASE_AVAILABLE_SPACE = 0x20,
|
|
|
|
FILE_LINK_PRESERVE_AVAILABLE_SPACE = 0x30,
|
|
|
|
FILE_LINK_IGNORE_READONLY_ATTRIBUTE = 0x40
|
|
|
|
};
|
|
|
|
|
|
|
|
enum {
|
|
|
|
FILE_DISPOSITION_DO_NOT_DELETE = 0x00,
|
|
|
|
FILE_DISPOSITION_DELETE = 0x01,
|
|
|
|
FILE_DISPOSITION_POSIX_SEMANTICS = 0x02,
|
|
|
|
FILE_DISPOSITION_FORCE_IMAGE_SECTION_CHECK = 0x04,
|
|
|
|
FILE_DISPOSITION_ON_CLOSE = 0x08
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_RENAME_REPLACE_IF_EXISTS = 0x01,
|
|
|
|
FILE_RENAME_POSIX_SEMANTICS = 0x02,
|
|
|
|
FILE_RENAME_SUPPRESS_PIN_STATE_INHERITANCE = 0x04,
|
|
|
|
FILE_RENAME_SUPPRESS_STORAGE_RESERVE_INHERITANCE = 0x08,
|
|
|
|
FILE_RENAME_NO_INCREASE_AVAILABLE_SPACE = 0x10,
|
|
|
|
FILE_RENAME_NO_DECREASE_AVAILABLE_SPACE = 0x20,
|
|
|
|
FILE_RENAME_PRESERVE_AVAILABLE_SPACE = 0x30,
|
|
|
|
FILE_RENAME_IGNORE_READONLY_ATTRIBUTE = 0x40
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_CS_FLAG_CASE_SENSITIVE_DIR = 0x01
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_QUEUE_OPERATION = 0,
|
|
|
|
FILE_PIPE_COMPLETE_OPERATION = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_BYTE_STREAM_MODE = 0,
|
|
|
|
FILE_PIPE_MESSAGE_MODE = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_DISCONNECTED_STATE = 1,
|
|
|
|
FILE_PIPE_LISTENING_STATE = 2,
|
|
|
|
FILE_PIPE_CONNECTED_STATE = 3,
|
|
|
|
FILE_PIPE_CLOSING_STATE = 4
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_INBOUND = 0,
|
|
|
|
FILE_PIPE_OUTBOUND = 1,
|
|
|
|
FILE_PIPE_FULL_DUPLEX = 2
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_CLIENT_END = 0,
|
|
|
|
FILE_PIPE_SERVER_END = 1
|
|
|
|
};
|
|
|
|
|
|
|
|
enum
|
|
|
|
{
|
|
|
|
FILE_PIPE_BYTE_STREAM_TYPE = 0,
|
2019-12-22 06:53:52 +08:00
|
|
|
FILE_PIPE_MESSAGE_TYPE = 1,
|
|
|
|
FILE_PIPE_REJECT_REMOTE_CLIENTS = 2
|
2018-12-23 07:17:34 +08:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct _FILE_PIPE_PEEK_BUFFER {
|
|
|
|
ULONG NamedPipeState;
|
|
|
|
ULONG ReadDataAvailable;
|
|
|
|
ULONG NumberOfMessages;
|
|
|
|
ULONG MessageLength;
|
|
|
|
CHAR Data[1];
|
|
|
|
} FILE_PIPE_PEEK_BUFFER, *PFILE_PIPE_PEEK_BUFFER;
|
|
|
|
|
|
|
|
typedef struct _FILE_PIPE_WAIT_FOR_BUFFER {
|
|
|
|
LARGE_INTEGER Timeout;
|
|
|
|
ULONG NameLength;
|
|
|
|
BOOLEAN TimeoutSpecified;
|
|
|
|
WCHAR Name[1];
|
|
|
|
} FILE_PIPE_WAIT_FOR_BUFFER, *PFILE_PIPE_WAIT_FOR_BUFFER;
|
|
|
|
|
2000-11-02 13:25:56 +08:00
|
|
|
typedef enum _SYSTEM_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
SystemBasicInformation = 0,
|
2002-05-12 09:37:48 +08:00
|
|
|
SystemPerformanceInformation = 2,
|
|
|
|
SystemTimeOfDayInformation = 3,
|
2013-04-23 17:44:36 +08:00
|
|
|
SystemProcessInformation = 5,
|
|
|
|
SystemProcessorPerformanceInformation = 8,
|
2011-05-29 02:17:09 +08:00
|
|
|
SystemHandleInformation = 16,
|
2004-03-18 20:28:47 +08:00
|
|
|
SystemPagefileInformation = 18,
|
2019-03-13 03:11:38 +08:00
|
|
|
SystemProcessIdInformation = 0x58,
|
2000-11-02 13:25:56 +08:00
|
|
|
/* There are a lot more of these... */
|
2000-10-25 02:44:56 +08:00
|
|
|
} SYSTEM_INFORMATION_CLASS;
|
|
|
|
|
2000-11-02 13:25:56 +08:00
|
|
|
typedef struct _SYSTEM_BASIC_INFORMATION
|
|
|
|
{
|
2000-10-25 02:44:56 +08:00
|
|
|
ULONG Unknown;
|
|
|
|
ULONG MaximumIncrement;
|
|
|
|
ULONG PhysicalPageSize;
|
|
|
|
ULONG NumberOfPhysicalPages;
|
|
|
|
ULONG LowestPhysicalPage;
|
|
|
|
ULONG HighestPhysicalPage;
|
|
|
|
ULONG AllocationGranularity;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR LowestUserAddress;
|
|
|
|
ULONG_PTR HighestUserAddress;
|
|
|
|
ULONG_PTR ActiveProcessors;
|
2002-05-12 09:37:48 +08:00
|
|
|
UCHAR NumberProcessors;
|
2000-10-25 02:44:56 +08:00
|
|
|
} SYSTEM_BASIC_INFORMATION, *PSYSTEM_BASIC_INFORMATION;
|
|
|
|
|
2004-03-18 20:28:47 +08:00
|
|
|
typedef struct _SYSTEM_PAGEFILE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG CurrentSize;
|
|
|
|
ULONG TotalUsed;
|
|
|
|
ULONG PeakUsed;
|
|
|
|
UNICODE_STRING FileName;
|
|
|
|
} SYSTEM_PAGEFILE_INFORMATION, *PSYSTEM_PAGEFILE_INFORMATION;
|
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION
|
2002-05-12 09:37:48 +08:00
|
|
|
{
|
|
|
|
LARGE_INTEGER IdleTime;
|
|
|
|
LARGE_INTEGER KernelTime;
|
|
|
|
LARGE_INTEGER UserTime;
|
|
|
|
LARGE_INTEGER DpcTime;
|
|
|
|
LARGE_INTEGER InterruptTime;
|
|
|
|
ULONG InterruptCount;
|
2013-04-23 17:44:36 +08:00
|
|
|
} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
|
2002-05-12 09:37:48 +08:00
|
|
|
|
2000-11-02 13:25:56 +08:00
|
|
|
typedef LONG KPRIORITY;
|
2013-04-23 17:44:36 +08:00
|
|
|
|
2000-11-02 13:25:56 +08:00
|
|
|
typedef struct _VM_COUNTERS
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
SIZE_T PeakVirtualSize;
|
|
|
|
SIZE_T VirtualSize;
|
2000-11-02 13:25:56 +08:00
|
|
|
ULONG PageFaultCount;
|
2013-04-23 17:44:36 +08:00
|
|
|
SIZE_T PeakWorkingSetSize;
|
|
|
|
SIZE_T WorkingSetSize;
|
|
|
|
SIZE_T QuotaPeakPagedPoolUsage;
|
|
|
|
SIZE_T QuotaPagedPoolUsage;
|
|
|
|
SIZE_T QuotaPeakNonPagedPoolUsage;
|
|
|
|
SIZE_T QuotaNonPagedPoolUsage;
|
|
|
|
SIZE_T PagefileUsage;
|
|
|
|
SIZE_T PeakPagefileUsage;
|
2000-11-02 13:25:56 +08:00
|
|
|
} 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-25 02:44:56 +08:00
|
|
|
|
2000-11-02 13:25:56 +08: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 09:37:48 +08:00
|
|
|
DWORD Reserved;
|
2000-11-02 13:25:56 +08:00
|
|
|
} SYSTEM_THREADS, *PSYSTEM_THREADS;
|
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _SYSTEM_PROCESS_INFORMATION
|
2000-11-02 13:25:56 +08:00
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG NumberOfThreads;
|
2000-11-02 13:25:56 +08:00
|
|
|
ULONG Reserved1[6];
|
|
|
|
LARGE_INTEGER CreateTime;
|
|
|
|
LARGE_INTEGER UserTime;
|
|
|
|
LARGE_INTEGER KernelTime;
|
2013-04-23 17:44:36 +08:00
|
|
|
UNICODE_STRING ImageName;
|
2000-11-02 13:25:56 +08:00
|
|
|
KPRIORITY BasePriority;
|
2013-04-23 17:44:36 +08:00
|
|
|
HANDLE UniqueProcessId;
|
|
|
|
HANDLE InheritedFromUniqueProcessId;
|
2000-11-02 13:25:56 +08:00
|
|
|
ULONG HandleCount;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG SessionId;
|
|
|
|
ULONG PageDirectoryBase;
|
|
|
|
VM_COUNTERS VirtualMemoryCounters;
|
|
|
|
SIZE_T PrivatePageCount;
|
2000-11-02 13:25:56 +08:00
|
|
|
IO_COUNTERS IoCounters;
|
|
|
|
SYSTEM_THREADS Threads[1];
|
2013-04-23 17:44:36 +08:00
|
|
|
} SYSTEM_PROCESS_INFORMATION, *PSYSTEM_PROCESS_INFORMATION;
|
2000-11-02 13:25:56 +08:00
|
|
|
|
2002-05-12 09:37:48 +08: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;
|
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _SYSTEM_TIMEOFDAY_INFORMATION
|
2002-05-12 09:37:48 +08:00
|
|
|
{
|
|
|
|
LARGE_INTEGER BootTime;
|
|
|
|
LARGE_INTEGER CurrentTime;
|
|
|
|
LARGE_INTEGER TimeZoneBias;
|
|
|
|
ULONG CurrentTimeZoneId;
|
2013-04-23 17:44:36 +08:00
|
|
|
BYTE Reserved1[20]; /* Per MSDN. Always 0. */
|
|
|
|
} SYSTEM_TIMEOFDAY_INFORMATION, *PSYSTEM_TIMEOFDAY_INFORMATION;
|
2002-05-12 09:37:48 +08:00
|
|
|
|
2019-03-13 03:11:38 +08:00
|
|
|
typedef struct _SYSTEM_PROCESS_ID_INFORMATION
|
|
|
|
{
|
|
|
|
PVOID ProcessId;
|
|
|
|
UNICODE_STRING ImageName;
|
|
|
|
} SYSTEM_PROCESS_ID_INFORMATION, *PSYSTEM_PROCESS_ID_INFORMATION;
|
|
|
|
|
2002-05-12 09:37:48 +08:00
|
|
|
typedef enum _PROCESSINFOCLASS
|
|
|
|
{
|
|
|
|
ProcessBasicInformation = 0,
|
|
|
|
ProcessQuotaLimits = 1,
|
|
|
|
ProcessVmCounters = 3,
|
2008-04-21 20:46:58 +08:00
|
|
|
ProcessTimes = 4,
|
|
|
|
ProcessSessionInformation = 24,
|
2012-07-06 21:49:53 +08:00
|
|
|
ProcessWow64Information = 26,
|
2015-08-25 00:37:53 +08:00
|
|
|
ProcessImageFileName = 27,
|
|
|
|
ProcessDebugFlags = 31
|
2002-05-12 09:37:48 +08:00
|
|
|
} PROCESSINFOCLASS;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_BUFFER
|
|
|
|
{
|
|
|
|
HANDLE SectionHandle;
|
|
|
|
PVOID SectionBase;
|
|
|
|
PVOID RemoteSectionBase;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR SectionBaseDelta;
|
2002-05-12 09:37:48 +08:00
|
|
|
HANDLE EventPairHandle;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Unknown[2];
|
2002-05-12 09:37:48 +08:00
|
|
|
HANDLE RemoteThreadHandle;
|
|
|
|
ULONG InfoClassMask;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR SizeOfInfo;
|
|
|
|
ULONG_PTR AllocatedSize;
|
|
|
|
ULONG_PTR SectionSize;
|
2002-05-12 09:37:48 +08:00
|
|
|
PVOID ModuleInformation;
|
|
|
|
PVOID BackTraceInformation;
|
|
|
|
PVOID HeapInformation;
|
|
|
|
PVOID LockInformation;
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID Reserved[8];
|
2002-05-12 09:37:48 +08:00
|
|
|
} DEBUG_BUFFER, *PDEBUG_BUFFER;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_HEAP_INFORMATION
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Base;
|
2002-05-12 09:37:48 +08:00
|
|
|
ULONG Flags;
|
|
|
|
USHORT Granularity;
|
|
|
|
USHORT Unknown;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Allocated;
|
|
|
|
ULONG_PTR Committed;
|
2002-05-12 09:37:48 +08:00
|
|
|
ULONG TagCount;
|
|
|
|
ULONG BlockCount;
|
|
|
|
ULONG Reserved[7];
|
|
|
|
PVOID Tags;
|
|
|
|
PVOID Blocks;
|
|
|
|
} DEBUG_HEAP_INFORMATION, *PDEBUG_HEAP_INFORMATION;
|
|
|
|
|
2011-05-13 14:50:20 +08:00
|
|
|
typedef struct _DEBUG_HEAP_ARRAY
|
|
|
|
{
|
|
|
|
ULONG Count;
|
|
|
|
DEBUG_HEAP_INFORMATION Heaps[1];
|
|
|
|
} DEBUG_HEAP_ARRAY, *PDEBUG_HEAP_ARRAY;
|
|
|
|
|
|
|
|
typedef struct _DEBUG_HEAP_BLOCK
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Size;
|
2011-05-13 14:50:20 +08:00
|
|
|
ULONG Flags;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Committed;
|
|
|
|
ULONG_PTR Address;
|
2011-05-13 14:50:20 +08:00
|
|
|
} DEBUG_HEAP_BLOCK, *PDEBUG_HEAP_BLOCK;
|
|
|
|
|
2002-05-12 09:37:48 +08:00
|
|
|
typedef struct _DEBUG_MODULE_INFORMATION
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR Reserved[2];
|
|
|
|
ULONG_PTR Base;
|
2002-05-12 09:37:48 +08:00
|
|
|
ULONG Size;
|
|
|
|
ULONG Flags;
|
|
|
|
USHORT Index;
|
|
|
|
USHORT Unknown;
|
|
|
|
USHORT LoadCount;
|
|
|
|
USHORT ModuleNameOffset;
|
|
|
|
CHAR ImageName[256];
|
|
|
|
} DEBUG_MODULE_INFORMATION, *PDEBUG_MODULE_INFORMATION;
|
|
|
|
|
2011-05-11 21:25:27 +08:00
|
|
|
typedef struct _DEBUG_MODULE_ARRAY
|
|
|
|
{
|
|
|
|
ULONG Count;
|
|
|
|
DEBUG_MODULE_INFORMATION Modules[1];
|
|
|
|
} DEBUG_MODULE_ARRAY, *PDEBUG_MODULE_ARRAY;
|
|
|
|
|
2002-05-12 09:37:48 +08:00
|
|
|
typedef struct _KERNEL_USER_TIMES
|
|
|
|
{
|
|
|
|
LARGE_INTEGER CreateTime;
|
|
|
|
LARGE_INTEGER ExitTime;
|
|
|
|
LARGE_INTEGER KernelTime;
|
|
|
|
LARGE_INTEGER UserTime;
|
|
|
|
} KERNEL_USER_TIMES, *PKERNEL_USER_TIMES;
|
|
|
|
|
2011-08-17 04:08:34 +08:00
|
|
|
typedef struct _LDR_DATA_TABLE_ENTRY
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
/* Heads up! The pointers within the LIST_ENTRYs don't point to the
|
|
|
|
start of the next LDR_DATA_TABLE_ENTRY, but rather they point to the
|
|
|
|
start of their respective LIST_ENTRY *within* LDR_DATA_TABLE_ENTRY. */
|
2011-08-17 04:08:34 +08:00
|
|
|
LIST_ENTRY InLoadOrderLinks;
|
|
|
|
LIST_ENTRY InMemoryOrderLinks;
|
|
|
|
LIST_ENTRY InInitializationOrderLinks;
|
|
|
|
PVOID DllBase;
|
|
|
|
PVOID EntryPoint;
|
|
|
|
ULONG SizeOfImage;
|
|
|
|
UNICODE_STRING FullDllName;
|
|
|
|
UNICODE_STRING BaseDllName;
|
|
|
|
ULONG Flags;
|
2013-04-23 17:44:36 +08:00
|
|
|
USHORT LoadCount;
|
2011-08-17 04:08:34 +08:00
|
|
|
/* More follows. Left out since it's just not used. The aforementioned
|
2013-04-23 17:44:36 +08:00
|
|
|
part of the structure is stable from at least NT4 up to Windows 8,
|
2011-08-17 04:08:34 +08:00
|
|
|
including WOW64. */
|
|
|
|
} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
|
|
|
|
|
|
|
|
typedef struct _PEB_LDR_DATA
|
|
|
|
{
|
|
|
|
ULONG Length;
|
2013-04-23 17:44:36 +08:00
|
|
|
BOOLEAN Initialized;
|
2011-08-17 04:08:34 +08:00
|
|
|
PVOID SsHandle;
|
2013-04-23 17:44:36 +08:00
|
|
|
/* Heads up! The pointers within the LIST_ENTRYs don't point to the
|
|
|
|
start of the next LDR_DATA_TABLE_ENTRY, but rather they point to the
|
|
|
|
start of their respective LIST_ENTRY *within* LDR_DATA_TABLE_ENTRY. */
|
2011-08-17 04:08:34 +08:00
|
|
|
LIST_ENTRY InLoadOrderModuleList;
|
|
|
|
LIST_ENTRY InMemoryOrderModuleList;
|
|
|
|
LIST_ENTRY InInitializationOrderModuleList;
|
|
|
|
PVOID EntryInProgress;
|
|
|
|
} PEB_LDR_DATA, *PPEB_LDR_DATA;
|
|
|
|
|
2007-01-17 02:01:06 +08: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;
|
2013-04-23 17:44:36 +08:00
|
|
|
BYTE Reserved2[1];
|
|
|
|
PVOID Reserved3[2];
|
2011-08-17 04:08:34 +08:00
|
|
|
PPEB_LDR_DATA Ldr;
|
2007-01-17 02:01:06 +08:00
|
|
|
PRTL_USER_PROCESS_PARAMETERS ProcessParameters;
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID Reserved4;
|
2010-10-09 18:54:13 +08:00
|
|
|
PVOID ProcessHeap;
|
|
|
|
PRTL_CRITICAL_SECTION FastPebLock;
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID Reserved5[2];
|
2012-02-17 22:26:18 +08:00
|
|
|
ULONG EnvironmentUpdateCount;
|
2013-04-23 17:44:36 +08:00
|
|
|
BYTE Reserved6[228];
|
|
|
|
PVOID Reserved7[49];
|
2007-01-17 02:01:06 +08:00
|
|
|
ULONG SessionId;
|
2013-04-23 17:44:36 +08:00
|
|
|
/* A lot more follows... */
|
2007-01-17 02:01:06 +08:00
|
|
|
} PEB, *PPEB;
|
2002-05-12 09:37:48 +08:00
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _GDI_TEB_BATCH
|
|
|
|
{
|
|
|
|
ULONG Offset;
|
|
|
|
HANDLE HDC;
|
|
|
|
ULONG Buffer[0x136];
|
|
|
|
} GDI_TEB_BATCH, *PGDI_TEB_BATCH;
|
|
|
|
|
2007-10-24 00:26:28 +08:00
|
|
|
typedef struct _TEB
|
|
|
|
{
|
2011-05-16 02:49:40 +08:00
|
|
|
NT_TIB Tib;
|
|
|
|
PVOID EnvironmentPointer;
|
|
|
|
CLIENT_ID ClientId;
|
|
|
|
PVOID ActiveRpcHandle;
|
|
|
|
PVOID ThreadLocalStoragePointer;
|
|
|
|
PPEB Peb;
|
2011-05-20 15:23:11 +08:00
|
|
|
ULONG LastErrorValue;
|
|
|
|
ULONG CountOfOwnedCriticalSections;
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID CsrClientThread;
|
|
|
|
PVOID Win32ThreadInfo;
|
|
|
|
ULONG User32Reserved[26];
|
|
|
|
ULONG UserReserved[5];
|
2011-05-20 15:23:11 +08:00
|
|
|
PVOID WOW32Reserved;
|
2013-04-23 17:44:36 +08:00
|
|
|
LCID CurrentLocale;
|
2011-05-20 15:23:11 +08:00
|
|
|
ULONG FpSoftwareStatusRegister;
|
|
|
|
PVOID SystemReserved1[54];
|
|
|
|
LONG ExceptionCode;
|
|
|
|
PVOID ActivationContextStackPointer;
|
2013-04-23 17:44:36 +08:00
|
|
|
UCHAR SpareBytes1[0x30 - 3 * sizeof(PVOID)];
|
2011-05-20 15:23:11 +08:00
|
|
|
ULONG TxFsContext;
|
2013-04-23 17:44:36 +08:00
|
|
|
GDI_TEB_BATCH GdiTebBatch;
|
2011-05-20 15:23:11 +08:00
|
|
|
CLIENT_ID RealClientId;
|
|
|
|
PVOID GdiCachedProcessHandle;
|
|
|
|
ULONG GdiClientPID;
|
|
|
|
ULONG GdiClientTID;
|
|
|
|
PVOID GdiThreadLocalInfo;
|
2013-04-23 17:44:36 +08:00
|
|
|
SIZE_T Win32ClientInfo[62];
|
2011-05-20 15:23:11 +08:00
|
|
|
PVOID glDispatchTable[233];
|
2013-04-23 17:44:36 +08:00
|
|
|
SIZE_T glReserved1[29];
|
|
|
|
PVOID glReserved2;
|
|
|
|
PVOID glSectionInfo;
|
|
|
|
PVOID glSection;
|
|
|
|
PVOID glTable;
|
|
|
|
PVOID glCurrentRC;
|
|
|
|
PVOID glContext;
|
2011-05-20 15:23:11 +08:00
|
|
|
ULONG LastStatusValue;
|
|
|
|
UNICODE_STRING StaticUnicodeString;
|
|
|
|
WCHAR StaticUnicodeBuffer[261];
|
|
|
|
PVOID DeallocationStack;
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID TlsSlots[64];
|
|
|
|
BYTE Reserved3[8];
|
|
|
|
PVOID Reserved4[26];
|
|
|
|
PVOID ReservedForOle;
|
|
|
|
PVOID Reserved5[4];
|
|
|
|
PVOID TlsExpansionSlots;
|
2007-10-24 00:26:28 +08:00
|
|
|
/* A lot more follows... */
|
|
|
|
} TEB, *PTEB;
|
|
|
|
|
2011-03-29 18:21:30 +08:00
|
|
|
typedef struct _KSYSTEM_TIME
|
|
|
|
{
|
|
|
|
ULONG LowPart;
|
|
|
|
LONG High1Time;
|
|
|
|
LONG High2Time;
|
|
|
|
} KSYSTEM_TIME, *PKSYSTEM_TIME;
|
|
|
|
|
2010-10-09 18:54:13 +08:00
|
|
|
typedef struct _KUSER_SHARED_DATA
|
|
|
|
{
|
2011-03-29 18:21:30 +08:00
|
|
|
BYTE Reserved1[0x08];
|
|
|
|
KSYSTEM_TIME InterruptTime;
|
|
|
|
BYTE Reserved2[0x2c8];
|
2010-10-09 18:54:13 +08:00
|
|
|
ULONG DismountCount;
|
2018-11-27 20:47:02 +08:00
|
|
|
BYTE Reserved3[0xd0];
|
|
|
|
UINT64 InterruptTimeBias;
|
2010-10-09 18:54:13 +08:00
|
|
|
} KUSER_SHARED_DATA, *PKUSER_SHARED_DATA;
|
|
|
|
|
2002-05-12 09:37:48 +08:00
|
|
|
typedef struct _PROCESS_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
NTSTATUS ExitStatus;
|
|
|
|
PPEB PebBaseAddress;
|
|
|
|
KAFFINITY AffinityMask;
|
2013-04-23 17:44:36 +08:00
|
|
|
KPRIORITY BasePriority; /* !!!Broken on WOW64!!! */
|
|
|
|
ULONG_PTR UniqueProcessId;
|
|
|
|
ULONG_PTR InheritedFromUniqueProcessId;
|
2002-05-12 09:37:48 +08:00
|
|
|
} PROCESS_BASIC_INFORMATION, *PPROCESS_BASIC_INFORMATION;
|
|
|
|
|
2008-04-21 20:46:58 +08:00
|
|
|
typedef struct _PROCESS_SESSION_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG SessionId;
|
|
|
|
} PROCESS_SESSION_INFORMATION, *PPROCESS_SESSION_INFORMATION;
|
|
|
|
|
2002-05-12 09:37:48 +08:00
|
|
|
typedef enum _MEMORY_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
MemoryBasicInformation,
|
|
|
|
MemoryWorkingSetList,
|
|
|
|
MemorySectionName,
|
2003-01-13 11:55:00 +08:00
|
|
|
MemoryBasicVlmInformation
|
2002-05-12 09:37:48 +08:00
|
|
|
} MEMORY_INFORMATION_CLASS;
|
|
|
|
|
2002-05-28 09:55:40 +08:00
|
|
|
typedef struct _MEMORY_WORKING_SET_LIST
|
|
|
|
{
|
2002-05-12 09:37:48 +08:00
|
|
|
ULONG NumberOfPages;
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG_PTR WorkingSetList[1];
|
2002-05-12 09:37:48 +08:00
|
|
|
} MEMORY_WORKING_SET_LIST, *PMEMORY_WORKING_SET_LIST;
|
|
|
|
|
2011-05-11 18:31:22 +08:00
|
|
|
typedef struct _MEMORY_SECTION_NAME
|
|
|
|
{
|
|
|
|
UNICODE_STRING SectionFileName;
|
|
|
|
} MEMORY_SECTION_NAME, *PMEMORY_SECTION_NAME;
|
|
|
|
|
2007-08-01 20:55:25 +08:00
|
|
|
typedef struct _FILE_FS_DEVICE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG DeviceType;
|
|
|
|
ULONG Characteristics;
|
|
|
|
} FILE_FS_DEVICE_INFORMATION, *PFILE_FS_DEVICE_INFORMATION;
|
|
|
|
|
2007-02-27 20:58:56 +08:00
|
|
|
typedef struct _FILE_FS_ATTRIBUTE_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG FileSystemAttributes;
|
|
|
|
ULONG MaximumComponentNameLength;
|
|
|
|
ULONG FileSystemNameLength;
|
|
|
|
WCHAR FileSystemName[1];
|
|
|
|
} FILE_FS_ATTRIBUTE_INFORMATION, *PFILE_FS_ATTRIBUTE_INFORMATION;
|
|
|
|
|
2010-09-10 18:04:28 +08:00
|
|
|
#pragma pack(push,4)
|
2005-04-12 22:26:31 +08:00
|
|
|
typedef struct _FILE_FS_VOLUME_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER VolumeCreationTime;
|
|
|
|
ULONG VolumeSerialNumber;
|
|
|
|
ULONG VolumeLabelLength;
|
|
|
|
BOOLEAN SupportsObjects;
|
2010-09-10 18:04:28 +08:00
|
|
|
BOOLEAN __dummy;
|
2005-04-12 22:26:31 +08:00
|
|
|
WCHAR VolumeLabel[1];
|
|
|
|
} FILE_FS_VOLUME_INFORMATION, *PFILE_FS_VOLUME_INFORMATION;
|
2010-09-10 18:04:28 +08:00
|
|
|
#pragma pack(pop)
|
2005-04-12 22:26:31 +08:00
|
|
|
|
2006-03-24 22:52:08 +08:00
|
|
|
typedef struct _FILE_FS_SIZE_INFORMATION
|
2005-04-12 22:26:31 +08:00
|
|
|
{
|
2006-03-24 22:52:08 +08:00
|
|
|
LARGE_INTEGER TotalAllocationUnits;
|
|
|
|
LARGE_INTEGER AvailableAllocationUnits;
|
|
|
|
ULONG SectorsPerAllocationUnit;
|
|
|
|
ULONG BytesPerSector;
|
|
|
|
} FILE_FS_SIZE_INFORMATION, *PFILE_FS_SIZE_INFORMATION;
|
|
|
|
|
2014-10-17 16:19:27 +08:00
|
|
|
typedef struct _FILE_FS_CONTROL_INFORMATION {
|
|
|
|
LARGE_INTEGER FreeSpaceStartFiltering;
|
|
|
|
LARGE_INTEGER FreeSpaceThreshold;
|
|
|
|
LARGE_INTEGER FreeSpaceStopFiltering;
|
|
|
|
LARGE_INTEGER DefaultQuotaThreshold;
|
|
|
|
LARGE_INTEGER DefaultQuotaLimit;
|
|
|
|
ULONG FileSystemControlFlags;
|
|
|
|
} FILE_FS_CONTROL_INFORMATION, *PFILE_FS_CONTROL_INFORMATION;
|
|
|
|
|
2007-02-27 20:58:56 +08: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;
|
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _FILE_FS_OBJECTID_INFORMATION
|
|
|
|
{
|
|
|
|
UCHAR ObjectId[16];
|
|
|
|
UCHAR ExtendedInfo[48];
|
2008-01-23 01:43:22 +08:00
|
|
|
} FILE_FS_OBJECTID_INFORMATION, *PFILE_FS_OBJECTID_INFORMATION;
|
|
|
|
|
2006-03-24 22:52:08 +08:00
|
|
|
typedef enum _FSINFOCLASS {
|
|
|
|
FileFsVolumeInformation = 1,
|
|
|
|
FileFsLabelInformation,
|
|
|
|
FileFsSizeInformation,
|
|
|
|
FileFsDeviceInformation,
|
|
|
|
FileFsAttributeInformation,
|
|
|
|
FileFsControlInformation,
|
|
|
|
FileFsFullSizeInformation,
|
|
|
|
FileFsObjectIdInformation,
|
|
|
|
FileFsDriverPathInformation,
|
|
|
|
FileFsMaximumInformation
|
2005-04-12 22:26:31 +08:00
|
|
|
} FS_INFORMATION_CLASS, *PFS_INFORMATION_CLASS;
|
|
|
|
|
2002-05-28 09:55:40 +08:00
|
|
|
typedef enum _OBJECT_INFORMATION_CLASS
|
|
|
|
{
|
2004-04-06 18:19:31 +08:00
|
|
|
ObjectBasicInformation = 0,
|
|
|
|
ObjectNameInformation = 1,
|
|
|
|
ObjectHandleInformation = 4
|
2002-05-28 09:55:40 +08:00
|
|
|
// and many more
|
|
|
|
} OBJECT_INFORMATION_CLASS;
|
|
|
|
|
2008-03-24 22:48:58 +08: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 09:55:40 +08:00
|
|
|
typedef struct _OBJECT_NAME_INFORMATION
|
|
|
|
{
|
|
|
|
UNICODE_STRING Name;
|
|
|
|
} OBJECT_NAME_INFORMATION;
|
|
|
|
|
2006-03-09 17:01:08 +08:00
|
|
|
typedef struct _DIRECTORY_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
UNICODE_STRING ObjectName;
|
|
|
|
UNICODE_STRING ObjectTypeName;
|
|
|
|
} DIRECTORY_BASIC_INFORMATION, *PDIRECTORY_BASIC_INFORMATION;
|
|
|
|
|
2014-10-17 16:19:27 +08:00
|
|
|
typedef struct _FILE_GET_QUOTA_INFORMATION {
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG SidLength;
|
|
|
|
SID Sid;
|
|
|
|
} FILE_GET_QUOTA_INFORMATION, *PFILE_GET_QUOTA_INFORMATION;
|
|
|
|
|
|
|
|
typedef struct _FILE_QUOTA_INFORMATION {
|
|
|
|
ULONG NextEntryOffset;
|
|
|
|
ULONG SidLength;
|
|
|
|
LARGE_INTEGER ChangeTime;
|
|
|
|
LARGE_INTEGER QuotaUsed;
|
|
|
|
LARGE_INTEGER QuotaThreshold;
|
|
|
|
LARGE_INTEGER QuotaLimit;
|
|
|
|
SID Sid;
|
|
|
|
} FILE_QUOTA_INFORMATION, *PFILE_QUOTA_INFORMATION;
|
|
|
|
|
2006-07-04 02:30:08 +08:00
|
|
|
typedef struct _FILE_GET_EA_INFORMATION
|
|
|
|
{
|
2013-04-23 17:44:36 +08:00
|
|
|
ULONG NextEntryOffset;
|
|
|
|
UCHAR EaNameLength;
|
|
|
|
CHAR EaName[1];
|
2006-07-04 02:30:08 +08:00
|
|
|
} 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 23:08:25 +08:00
|
|
|
typedef struct _FILE_MAILSLOT_SET_INFORMATION
|
|
|
|
{
|
|
|
|
LARGE_INTEGER ReadTimeout;
|
|
|
|
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
|
|
|
|
|
2019-03-13 03:11:38 +08:00
|
|
|
typedef struct _IO_STATUS_BLOCK
|
|
|
|
{
|
|
|
|
union {
|
|
|
|
NTSTATUS Status;
|
|
|
|
PVOID Pointer;
|
|
|
|
};
|
|
|
|
ULONG_PTR Information;
|
|
|
|
} IO_STATUS_BLOCK, *PIO_STATUS_BLOCK;
|
|
|
|
|
2007-08-12 20:48:02 +08:00
|
|
|
typedef VOID NTAPI (*PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG);
|
|
|
|
|
2008-04-01 02:03:25 +08: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;
|
|
|
|
|
2013-07-23 22:15:20 +08:00
|
|
|
typedef struct _SEMAPHORE_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
LONG CurrentCount;
|
|
|
|
LONG MaximumCount;
|
|
|
|
} SEMAPHORE_BASIC_INFORMATION, *PSEMAPHORE_BASIC_INFORMATION;
|
|
|
|
|
|
|
|
typedef enum _SEMAPHORE_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
SemaphoreBasicInformation = 0
|
|
|
|
} SEMAPHORE_INFORMATION_CLASS, *PSEMAPHORE_INFORMATION_CLASS;
|
|
|
|
|
2013-10-26 02:40:57 +08:00
|
|
|
typedef enum _THREADINFOCLASS
|
2011-04-01 00:08:01 +08:00
|
|
|
{
|
2011-05-03 09:13:37 +08:00
|
|
|
ThreadBasicInformation = 0,
|
2011-05-18 01:08:10 +08:00
|
|
|
ThreadTimes = 1,
|
2015-10-29 16:17:46 +08:00
|
|
|
ThreadImpersonationToken = 5,
|
|
|
|
ThreadQuerySetWin32StartAddress = 9
|
2013-10-26 02:40:57 +08:00
|
|
|
} THREADINFOCLASS, *PTHREADINFOCLASS;
|
2011-04-01 00:08:01 +08:00
|
|
|
|
2013-04-23 17:44:36 +08:00
|
|
|
typedef struct _THREAD_BASIC_INFORMATION
|
|
|
|
{
|
|
|
|
NTSTATUS ExitStatus;
|
|
|
|
PNT_TIB TebBaseAddress;
|
|
|
|
CLIENT_ID ClientId;
|
|
|
|
KAFFINITY AffinityMask;
|
|
|
|
KPRIORITY Priority;
|
|
|
|
KPRIORITY BasePriority;
|
2011-05-03 09:13:37 +08:00
|
|
|
} THREAD_BASIC_INFORMATION, *PTHREAD_BASIC_INFORMATION;
|
|
|
|
|
2011-08-04 00:40:48 +08:00
|
|
|
typedef enum _TIMER_INFORMATION_CLASS {
|
|
|
|
TimerBasicInformation = 0
|
|
|
|
} TIMER_INFORMATION_CLASS, *PTIMER_INFORMATION_CLASS;
|
|
|
|
|
|
|
|
typedef struct _TIMER_BASIC_INFORMATION {
|
|
|
|
LARGE_INTEGER TimeRemaining;
|
|
|
|
BOOLEAN SignalState;
|
|
|
|
} TIMER_BASIC_INFORMATION, *PTIMER_BASIC_INFORMATION;
|
|
|
|
|
2011-04-01 00:08:01 +08:00
|
|
|
typedef NTSTATUS (*PRTL_QUERY_REGISTRY_ROUTINE)
|
|
|
|
(PWSTR, ULONG, PVOID, ULONG, PVOID, PVOID);
|
|
|
|
|
|
|
|
typedef struct _RTL_QUERY_REGISTRY_TABLE
|
|
|
|
{
|
|
|
|
PRTL_QUERY_REGISTRY_ROUTINE QueryRoutine;
|
|
|
|
ULONG Flags;
|
|
|
|
PCWSTR Name;
|
|
|
|
PVOID EntryContext;
|
|
|
|
ULONG DefaultType;
|
|
|
|
PVOID DefaultData;
|
|
|
|
ULONG DefaultLength;
|
|
|
|
} RTL_QUERY_REGISTRY_TABLE, *PRTL_QUERY_REGISTRY_TABLE;
|
|
|
|
|
|
|
|
typedef enum _KEY_VALUE_INFORMATION_CLASS
|
|
|
|
{
|
|
|
|
KeyValueBasicInformation = 0,
|
|
|
|
KeyValueFullInformation,
|
|
|
|
KeyValuePartialInformation
|
|
|
|
} KEY_VALUE_INFORMATION_CLASS, *PKEY_VALUE_INFORMATION_CLASS;
|
2011-06-06 13:02:13 +08:00
|
|
|
|
2011-04-01 00:08:01 +08:00
|
|
|
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
|
|
|
|
{
|
|
|
|
ULONG TitleIndex;
|
|
|
|
ULONG Type;
|
|
|
|
ULONG DataLength;
|
|
|
|
UCHAR Data[1];
|
|
|
|
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
|
|
|
|
|
2012-06-27 21:19:11 +08:00
|
|
|
typedef enum _SECTION_INHERIT
|
|
|
|
{
|
|
|
|
ViewShare = 1,
|
|
|
|
ViewUnmap = 2
|
|
|
|
} SECTION_INHERIT;
|
2011-04-28 20:13:41 +08:00
|
|
|
|
|
|
|
typedef VOID (APIENTRY *PTIMER_APC_ROUTINE)(PVOID, ULONG, ULONG);
|
|
|
|
|
2014-08-22 17:21:33 +08:00
|
|
|
#ifdef __x86_64__
|
|
|
|
typedef struct _SCOPE_TABLE
|
|
|
|
{
|
|
|
|
ULONG Count;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
ULONG BeginAddress;
|
|
|
|
ULONG EndAddress;
|
|
|
|
ULONG HandlerAddress;
|
|
|
|
ULONG JumpTarget;
|
|
|
|
} ScopeRecord[1];
|
|
|
|
} SCOPE_TABLE, *PSCOPE_TABLE;
|
|
|
|
#endif
|
2009-12-19 04:32:04 +08:00
|
|
|
|
2011-04-01 00:08:01 +08:00
|
|
|
#ifdef __cplusplus
|
2013-04-23 17:44:36 +08:00
|
|
|
/* This is the mapping of the KUSER_SHARED_DATA structure into the user
|
|
|
|
address space on BOTH architectures, 32 and 64 bit!
|
|
|
|
We need it here to access the current DismountCount and InterruptTime. */
|
2012-03-21 02:01:09 +08:00
|
|
|
static volatile KUSER_SHARED_DATA &SharedUserData
|
|
|
|
= *(volatile KUSER_SHARED_DATA *) 0x7ffe0000;
|
2011-03-29 18:21:30 +08:00
|
|
|
|
2014-08-22 17:21:33 +08:00
|
|
|
/* Function declarations for ntdll.dll. These don't appear in any
|
|
|
|
standard Win32 header. */
|
|
|
|
|
2000-11-02 13:25:56 +08:00
|
|
|
extern "C"
|
|
|
|
{
|
2011-04-01 00:08:01 +08:00
|
|
|
#endif
|
|
|
|
NTSTATUS NTAPI NtAccessCheck (PSECURITY_DESCRIPTOR, HANDLE, ACCESS_MASK,
|
|
|
|
PGENERIC_MAPPING, PPRIVILEGE_SET, PULONG,
|
|
|
|
PACCESS_MASK, PNTSTATUS);
|
2007-07-19 16:33:22 +08:00
|
|
|
NTSTATUS NTAPI NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES,
|
|
|
|
ULONG, PTOKEN_PRIVILEGES, PULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtAllocateLocallyUniqueId (PLUID);
|
2011-03-29 18:42:11 +08:00
|
|
|
NTSTATUS NTAPI NtAllocateUuids (PLARGE_INTEGER, PULONG, PULONG, PUCHAR);
|
2011-04-28 20:13:41 +08:00
|
|
|
NTSTATUS NTAPI NtCancelTimer (HANDLE, PBOOLEAN);
|
2006-03-09 17:01:08 +08:00
|
|
|
NTSTATUS NTAPI NtClose (HANDLE);
|
2008-05-16 00:34:01 +08:00
|
|
|
NTSTATUS NTAPI NtCommitTransaction (HANDLE, BOOLEAN);
|
Implement getcontext, setcontext, makecontext, swapcontext
* common.din (getcontext): Export.
(makecontext): Export.
(setcontext): Export.
(swapcontext): Export.
* exceptions.cc (__unwind_single_frame): New static functions, 64 bit
only.
(setcontext): New function.
(getcontext): New function.
(swapcontext): New function.
(__cont_link_context): New function.
(makecontext): New function.
* include/cygwin/version.h (CYGWIN_VERSION_DLL_MAJOR): Bump to 2002.
(CYGWIN_VERSION_API_MINOR): Bump.
* include/ucontext.h (getcontext): Add prototype.
(setcontext): Ditto.
(swapcontext): Ditto.
(makecontext): Ditto.
* ntdll.h (NtContinue): Ditto.
* new-features.xml (ov-new2.2): Add new section. Document getcontext,
setcontext, makecontext, swapcontext.
* posix.xml (std-deprec): Add getcontext, setcontext, makecontext,
swapcontext.
Signed-off-by: Corinna Vinschen <corinna@vinschen.de>
2015-07-17 20:31:12 +08:00
|
|
|
NTSTATUS NTAPI NtContinue (PCONTEXT, BOOLEAN);
|
2008-03-24 22:48:58 +08:00
|
|
|
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
|
|
|
|
POBJECT_ATTRIBUTES);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtCreateKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG,
|
|
|
|
PUNICODE_STRING, ULONG, PULONG);
|
2008-03-24 22:48:58 +08:00
|
|
|
NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2008-11-27 01:21:04 +08:00
|
|
|
EVENT_TYPE, BOOLEAN);
|
2004-04-17 05:22:13 +08:00
|
|
|
NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, PLARGE_INTEGER, ULONG, ULONG,
|
|
|
|
ULONG, ULONG, PVOID, ULONG);
|
2007-08-13 23:08:25 +08:00
|
|
|
NTSTATUS NTAPI NtCreateMailslotFile(PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, ULONG, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER);
|
2008-03-24 22:48:58 +08:00
|
|
|
NTSTATUS NTAPI NtCreateMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
BOOLEAN);
|
2018-03-03 01:03:11 +08:00
|
|
|
NTSTATUS NTAPI NtCreateNamedPipeFile (PHANDLE, ACCESS_MASK,
|
|
|
|
POBJECT_ATTRIBUTES, PIO_STATUS_BLOCK,
|
|
|
|
ULONG, ULONG, ULONG, ULONG, ULONG,
|
|
|
|
ULONG, ULONG, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER);
|
2005-11-29 06:32:29 +08:00
|
|
|
NTSTATUS NTAPI NtCreateSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2008-02-16 01:53:11 +08:00
|
|
|
PLARGE_INTEGER, ULONG, ULONG, HANDLE);
|
2008-04-21 20:46:58 +08:00
|
|
|
NTSTATUS NTAPI NtCreateSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
LONG, LONG);
|
2018-03-03 01:03:11 +08:00
|
|
|
NTSTATUS NTAPI NtCreateSymbolicLinkObject (PHANDLE, ACCESS_MASK,
|
|
|
|
POBJECT_ATTRIBUTES,
|
|
|
|
PUNICODE_STRING);
|
2011-04-28 20:13:41 +08:00
|
|
|
NTSTATUS NTAPI NtCreateTimer (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
TIMER_TYPE);
|
* 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 16:10:47 +08:00
|
|
|
NTSTATUS NTAPI NtCreateToken (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
2001-09-08 05:32:07 +08:00
|
|
|
TOKEN_TYPE, PLUID, PLARGE_INTEGER, PTOKEN_USER,
|
|
|
|
PTOKEN_GROUPS, PTOKEN_PRIVILEGES, PTOKEN_OWNER,
|
|
|
|
PTOKEN_PRIMARY_GROUP, PTOKEN_DEFAULT_DACL,
|
|
|
|
PTOKEN_SOURCE);
|
2008-05-16 00:34:01 +08:00
|
|
|
NTSTATUS NTAPI NtCreateTransaction (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
LPGUID, HANDLE, ULONG, ULONG, ULONG,
|
|
|
|
PLARGE_INTEGER, PUNICODE_STRING);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtDuplicateToken (HANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
BOOLEAN, TOKEN_TYPE, PHANDLE);
|
2007-08-12 20:48:02 +08:00
|
|
|
NTSTATUS NTAPI NtFsControlFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
2007-07-27 01:30:54 +08:00
|
|
|
PIO_STATUS_BLOCK, ULONG, PVOID, ULONG,
|
|
|
|
PVOID, ULONG);
|
2011-04-02 19:43:43 +08:00
|
|
|
NTSTATUS NTAPI NtFlushBuffersFile (HANDLE, PIO_STATUS_BLOCK);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtLoadKey (POBJECT_ATTRIBUTES, POBJECT_ATTRIBUTES);
|
2013-06-02 18:22:14 +08:00
|
|
|
NTSTATUS NTAPI NtLockFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PLARGE_INTEGER, PLARGE_INTEGER,
|
|
|
|
ULONG, BOOLEAN, BOOLEAN);
|
2013-04-23 17:44:36 +08:00
|
|
|
NTSTATUS NTAPI NtLockVirtualMemory (HANDLE, PVOID *, PSIZE_T, ULONG);
|
|
|
|
NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG_PTR, SIZE_T,
|
|
|
|
PLARGE_INTEGER, PSIZE_T, SECTION_INHERIT,
|
2000-11-02 13:25:56 +08:00
|
|
|
ULONG, ULONG);
|
2020-09-23 23:04:08 +08:00
|
|
|
|
|
|
|
/* For the extended memory API. */
|
|
|
|
#if __MINGW64_VERSION_MAJOR < 8
|
|
|
|
#error "Version >= 8 of the w32api headers is required"
|
|
|
|
#endif
|
|
|
|
|
2020-04-07 20:13:50 +08:00
|
|
|
NTSTATUS NTAPI NtMapViewOfSectionEx (HANDLE, HANDLE, PVOID *, PLARGE_INTEGER,
|
|
|
|
PSIZE_T, ULONG, ULONG,
|
|
|
|
PMEM_EXTENDED_PARAMETER, ULONG);
|
2007-08-21 20:37:40 +08:00
|
|
|
NTSTATUS NTAPI NtNotifyChangeDirectoryFile (HANDLE, HANDLE, PIO_APC_ROUTINE,
|
2008-02-16 01:53:11 +08:00
|
|
|
PVOID, PIO_STATUS_BLOCK,
|
2007-08-21 20:37:40 +08:00
|
|
|
PFILE_NOTIFY_INFORMATION, ULONG,
|
|
|
|
ULONG, BOOLEAN);
|
2006-03-09 17:01:08 +08:00
|
|
|
NTSTATUS NTAPI NtOpenDirectoryObject (PHANDLE, ACCESS_MASK,
|
2008-02-16 01:53:11 +08:00
|
|
|
POBJECT_ATTRIBUTES);
|
2008-03-24 22:48:58 +08:00
|
|
|
NTSTATUS NTAPI NtOpenEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2001-10-16 22:53:26 +08:00
|
|
|
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
|
|
|
|
PIO_STATUS_BLOCK, ULONG, ULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtOpenKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2008-03-24 22:48:58 +08:00
|
|
|
NTSTATUS NTAPI NtOpenMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtOpenProcessToken (HANDLE, ACCESS_MASK, PHANDLE);
|
|
|
|
NTSTATUS NTAPI NtOpenThreadToken (HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
|
* 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 16:10:47 +08:00
|
|
|
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2008-04-21 20:46:58 +08:00
|
|
|
NTSTATUS NTAPI NtOpenSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
|
2010-09-06 17:47:01 +08:00
|
|
|
NTSTATUS NTAPI NtOpenSymbolicLinkObject (PHANDLE, ACCESS_MASK,
|
|
|
|
POBJECT_ATTRIBUTES);
|
2007-08-21 20:37:40 +08:00
|
|
|
/* WARNING! Don't rely on the timestamp information returned by
|
|
|
|
NtQueryAttributesFile. Only the DOS file attribute info is reliable. */
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtPrivilegeCheck (HANDLE, PPRIVILEGE_SET, PBOOLEAN);
|
2007-08-21 20:37:40 +08:00
|
|
|
NTSTATUS NTAPI NtQueryAttributesFile (POBJECT_ATTRIBUTES,
|
|
|
|
PFILE_BASIC_INFORMATION);
|
2006-03-09 17:01:08 +08: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-16 01:53:11 +08:00
|
|
|
BOOLEAN, PULONG, PULONG);
|
2006-07-04 02:30:08 +08:00
|
|
|
NTSTATUS NTAPI NtQueryEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
|
|
|
|
BOOLEAN, PVOID, ULONG, PULONG, BOOLEAN);
|
2008-04-01 02:03:25 +08:00
|
|
|
NTSTATUS NTAPI NtQueryEvent (HANDLE, EVENT_INFORMATION_CLASS, PVOID, ULONG,
|
|
|
|
PULONG);
|
2007-07-20 01:22:34 +08:00
|
|
|
NTSTATUS NTAPI NtQueryFullAttributesFile (POBJECT_ATTRIBUTES,
|
|
|
|
PFILE_NETWORK_OPEN_INFORMATION);
|
2005-04-12 22:26:31 +08:00
|
|
|
NTSTATUS NTAPI NtQueryInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
2004-09-03 09:32:02 +08:00
|
|
|
ULONG, FILE_INFORMATION_CLASS);
|
2002-05-30 15:45:30 +08:00
|
|
|
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
|
2003-03-10 04:31:07 +08:00
|
|
|
PVOID, ULONG, PULONG);
|
2013-10-26 02:40:57 +08:00
|
|
|
NTSTATUS NTAPI NtQueryInformationThread (HANDLE, THREADINFOCLASS, PVOID,
|
|
|
|
ULONG, PULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtQueryInformationToken (HANDLE, TOKEN_INFORMATION_CLASS,
|
|
|
|
PVOID, ULONG, PULONG);
|
2014-10-17 16:19:27 +08:00
|
|
|
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, PVOID, ULONG,
|
2020-03-11 20:23:55 +08:00
|
|
|
PULONG);
|
2014-10-17 16:19:27 +08:00
|
|
|
NTSTATUS NTAPI NtQueryQuotaInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
|
|
|
ULONG, BOOLEAN, PVOID, ULONG,
|
|
|
|
PSID, BOOLEAN);
|
2013-07-23 22:15:20 +08:00
|
|
|
NTSTATUS NTAPI NtQuerySemaphore (HANDLE, SEMAPHORE_INFORMATION_CLASS,
|
|
|
|
PVOID, ULONG, PULONG);
|
2000-11-02 13:25:56 +08:00
|
|
|
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
|
|
|
|
PVOID, ULONG, PULONG);
|
2010-03-16 05:29:15 +08:00
|
|
|
NTSTATUS WINAPI NtQuerySystemTime (PLARGE_INTEGER);
|
2004-04-13 20:14:59 +08:00
|
|
|
NTSTATUS NTAPI NtQuerySecurityObject (HANDLE, SECURITY_INFORMATION,
|
2008-02-16 01:53:11 +08:00
|
|
|
PSECURITY_DESCRIPTOR, ULONG, PULONG);
|
2010-09-06 17:47:01 +08:00
|
|
|
NTSTATUS NTAPI NtQuerySymbolicLinkObject (HANDLE, PUNICODE_STRING, PULONG);
|
2011-08-04 00:40:48 +08:00
|
|
|
NTSTATUS NTAPI NtQueryTimer (HANDLE, TIMER_INFORMATION_CLASS, PVOID,
|
|
|
|
ULONG, PULONG);
|
2011-03-29 18:21:30 +08:00
|
|
|
NTSTATUS NTAPI NtQueryTimerResolution (PULONG, PULONG, PULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtQueryValueKey (HANDLE, PUNICODE_STRING,
|
|
|
|
KEY_VALUE_INFORMATION_CLASS, PVOID, ULONG,
|
|
|
|
PULONG);
|
2002-05-30 15:45:30 +08:00
|
|
|
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
|
2013-04-23 17:44:36 +08:00
|
|
|
PVOID, SIZE_T, PSIZE_T);
|
2014-10-17 16:19:27 +08:00
|
|
|
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
|
|
|
ULONG, FS_INFORMATION_CLASS);
|
2007-08-15 23:17:05 +08:00
|
|
|
NTSTATUS NTAPI NtReadFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
|
|
|
|
PULONG);
|
2008-05-16 00:34:01 +08:00
|
|
|
NTSTATUS NTAPI NtRollbackTransaction (HANDLE, BOOLEAN);
|
2006-07-04 02:30:08 +08:00
|
|
|
NTSTATUS NTAPI NtSetEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
|
2011-08-28 04:01:29 +08:00
|
|
|
NTSTATUS NTAPI NtSetEvent (HANDLE, PULONG);
|
2006-08-08 03:29:14 +08:00
|
|
|
NTSTATUS NTAPI NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
|
|
|
|
FILE_INFORMATION_CLASS);
|
2013-10-26 02:40:57 +08:00
|
|
|
NTSTATUS NTAPI NtSetInformationThread (HANDLE, THREADINFOCLASS, PVOID, ULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtSetInformationToken (HANDLE, TOKEN_INFORMATION_CLASS, PVOID,
|
|
|
|
ULONG);
|
2014-10-17 16:19:27 +08:00
|
|
|
NTSTATUS NTAPI NtSetQuotaInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
|
|
|
ULONG);
|
2004-04-14 18:20:26 +08:00
|
|
|
NTSTATUS NTAPI NtSetSecurityObject (HANDLE, SECURITY_INFORMATION,
|
|
|
|
PSECURITY_DESCRIPTOR);
|
2011-04-28 20:13:41 +08:00
|
|
|
NTSTATUS NTAPI NtSetTimer (HANDLE, PLARGE_INTEGER, PTIMER_APC_ROUTINE, PVOID,
|
|
|
|
BOOLEAN, LONG, PBOOLEAN);
|
2011-03-29 18:21:30 +08:00
|
|
|
NTSTATUS NTAPI NtSetTimerResolution (ULONG, BOOLEAN, PULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI NtSetValueKey (HANDLE, PUNICODE_STRING, ULONG, ULONG, PVOID,
|
|
|
|
ULONG);
|
2014-10-17 16:19:27 +08:00
|
|
|
NTSTATUS NTAPI NtSetVolumeInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID,
|
|
|
|
ULONG, FS_INFORMATION_CLASS);
|
2013-06-02 18:22:14 +08:00
|
|
|
NTSTATUS NTAPI NtUnlockFile (HANDLE, PIO_STATUS_BLOCK, PLARGE_INTEGER,
|
|
|
|
PLARGE_INTEGER, ULONG);
|
2013-04-23 17:44:36 +08:00
|
|
|
NTSTATUS NTAPI NtUnlockVirtualMemory (HANDLE, PVOID *, PSIZE_T, ULONG);
|
2000-11-02 13:25:56 +08:00
|
|
|
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
|
2018-03-19 03:07:35 +08:00
|
|
|
NTSTATUS NTAPI NtWaitForSingleObject (HANDLE, BOOLEAN, PLARGE_INTEGER);
|
2007-08-12 20:48:02 +08:00
|
|
|
NTSTATUS NTAPI NtWriteFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
|
|
|
|
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
|
|
|
|
PULONG);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlAbsoluteToSelfRelativeSD (PSECURITY_DESCRIPTOR,
|
|
|
|
PSECURITY_DESCRIPTOR, PULONG);
|
2010-10-09 18:54:13 +08:00
|
|
|
VOID NTAPI RtlAcquirePebLock ();
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlAddAccessAllowedAce (PACL, ULONG, ACCESS_MASK, PSID);
|
2012-06-04 00:46:53 +08:00
|
|
|
NTSTATUS NTAPI RtlAddAccessAllowedAceEx (PACL, ULONG, ULONG, ACCESS_MASK,
|
|
|
|
PSID);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlAddAccessDeniedAce (PACL, ULONG, ACCESS_MASK, PSID);
|
2012-06-04 00:46:53 +08:00
|
|
|
NTSTATUS NTAPI RtlAddAccessDeniedAceEx (PACL, ULONG, ULONG, ACCESS_MASK,
|
|
|
|
PSID);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlAddAce (PACL, ULONG, ULONG, PVOID, ULONG);
|
2010-10-09 18:54:13 +08:00
|
|
|
PVOID NTAPI RtlAllocateHeap (PVOID, ULONG, SIZE_T);
|
2007-07-27 01:30:54 +08:00
|
|
|
NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR);
|
|
|
|
NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING,
|
|
|
|
PUNICODE_STRING);
|
2007-01-17 02:01:06 +08:00
|
|
|
NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING,
|
|
|
|
BOOLEAN);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlCheckRegistryKey (ULONG, PCWSTR);
|
2007-07-27 01:30:54 +08:00
|
|
|
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-09 18:32:25 +08:00
|
|
|
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
|
2011-04-28 15:27:51 +08:00
|
|
|
NTSTATUS NTAPI RtlConvertToAutoInheritSecurityObject (PSECURITY_DESCRIPTOR,
|
2011-06-06 13:02:13 +08:00
|
|
|
PSECURITY_DESCRIPTOR,
|
2011-04-28 15:27:51 +08:00
|
|
|
PSECURITY_DESCRIPTOR *,
|
|
|
|
GUID *, BOOLEAN,
|
|
|
|
PGENERIC_MAPPING);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlCopySid (ULONG, PSID, PSID);
|
2011-04-28 15:27:51 +08:00
|
|
|
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlCreateAcl (PACL, ULONG, ULONG);
|
2011-05-11 21:25:27 +08:00
|
|
|
PDEBUG_BUFFER NTAPI RtlCreateQueryDebugBuffer (ULONG, BOOLEAN);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlCreateRegistryKey (ULONG, PCWSTR);
|
|
|
|
NTSTATUS NTAPI RtlCreateSecurityDescriptor (PSECURITY_DESCRIPTOR, ULONG);
|
2007-08-16 18:41:45 +08:00
|
|
|
BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
|
2011-04-28 15:27:51 +08:00
|
|
|
NTSTATUS NTAPI RtlDeleteSecurityObject (PSECURITY_DESCRIPTOR *);
|
2011-05-11 21:25:27 +08:00
|
|
|
NTSTATUS NTAPI RtlDestroyQueryDebugBuffer (PDEBUG_BUFFER);
|
2007-12-12 20:12:24 +08:00
|
|
|
NTSTATUS NTAPI RtlDowncaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2010-10-09 18:54:13 +08:00
|
|
|
NTSTATUS NTAPI RtlEnterCriticalSection (PRTL_CRITICAL_SECTION);
|
2011-04-01 00:08:01 +08:00
|
|
|
BOOLEAN NTAPI RtlEqualPrefixSid (PSID, PSID);
|
|
|
|
BOOLEAN NTAPI RtlEqualSid (PSID, PSID);
|
2007-07-27 01:30:54 +08:00
|
|
|
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-01 04:48:17 +08:00
|
|
|
VOID NTAPI RtlFreeAnsiString (PANSI_STRING);
|
2013-04-23 17:44:36 +08:00
|
|
|
BOOLEAN NTAPI RtlFreeHeap (HANDLE, ULONG, PVOID);
|
2007-08-01 04:48:17 +08:00
|
|
|
VOID NTAPI RtlFreeOemString (POEM_STRING);
|
2007-07-27 01:30:54 +08:00
|
|
|
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
|
2011-04-01 00:08:01 +08:00
|
|
|
BOOLEAN NTAPI RtlFirstFreeAce (PACL, PVOID *);
|
|
|
|
NTSTATUS NTAPI RtlGetAce (PACL, ULONG, PVOID);
|
2011-04-28 15:27:51 +08:00
|
|
|
NTSTATUS NTAPI RtlGetControlSecurityDescriptor (PSECURITY_DESCRIPTOR,
|
|
|
|
PSECURITY_DESCRIPTOR_CONTROL,
|
|
|
|
PULONG);
|
2008-05-16 00:34:01 +08:00
|
|
|
HANDLE NTAPI RtlGetCurrentTransaction ();
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
|
|
|
|
PACL *, PBOOLEAN);
|
|
|
|
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
2011-06-06 13:02:13 +08:00
|
|
|
PBOOLEAN);
|
2016-03-10 06:10:17 +08:00
|
|
|
NTSTATUS NTAPI RtlGetNtVersionNumbers (LPDWORD, LPDWORD, LPDWORD);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
|
2011-06-06 13:02:13 +08:00
|
|
|
PBOOLEAN);
|
2013-11-20 06:21:11 +08:00
|
|
|
NTSTATUS NTAPI RtlGetVersion (PRTL_OSVERSIONINFOEXW);
|
2011-04-01 00:08:01 +08:00
|
|
|
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
|
2012-07-06 21:49:53 +08:00
|
|
|
VOID NTAPI RtlInitAnsiString (PANSI_STRING, PCSTR);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
|
2000-11-02 13:25:56 +08:00
|
|
|
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
|
2007-08-09 18:32:25 +08:00
|
|
|
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
|
2006-03-09 17:01:08 +08:00
|
|
|
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
|
2010-10-09 18:54:13 +08:00
|
|
|
NTSTATUS NTAPI RtlLeaveCriticalSection (PRTL_CRITICAL_SECTION);
|
2011-04-28 15:27:51 +08:00
|
|
|
ULONG NTAPI RtlLengthSecurityDescriptor (PSECURITY_DESCRIPTOR);
|
2011-04-01 00:08:01 +08:00
|
|
|
ULONG NTAPI RtlLengthSid (PSID);
|
2000-11-02 13:25:56 +08:00
|
|
|
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
|
2007-01-17 02:01:06 +08:00
|
|
|
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
|
|
|
|
BOOLEAN);
|
2007-07-31 23:20:00 +08:00
|
|
|
BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2011-05-11 21:25:27 +08:00
|
|
|
NTSTATUS NTAPI RtlQueryProcessDebugInformation (ULONG, ULONG, PDEBUG_BUFFER);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlQueryRegistryValues (ULONG, PCWSTR,
|
|
|
|
PRTL_QUERY_REGISTRY_TABLE, PVOID,
|
|
|
|
PVOID);
|
2007-08-16 22:30:53 +08:00
|
|
|
VOID NTAPI RtlReleasePebLock ();
|
2007-07-27 01:30:54 +08:00
|
|
|
VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER);
|
2010-08-28 01:58:45 +08:00
|
|
|
NTSTATUS NTAPI RtlSetCurrentDirectory_U (PUNICODE_STRING);
|
2008-05-16 00:34:01 +08:00
|
|
|
BOOLEAN NTAPI RtlSetCurrentTransaction (HANDLE);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlSetControlSecurityDescriptor (PSECURITY_DESCRIPTOR,
|
|
|
|
SECURITY_DESCRIPTOR_CONTROL,
|
|
|
|
SECURITY_DESCRIPTOR_CONTROL);
|
|
|
|
NTSTATUS NTAPI RtlSetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, BOOLEAN,
|
|
|
|
PACL, BOOLEAN);
|
|
|
|
NTSTATUS NTAPI RtlSetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
2011-06-06 13:02:13 +08:00
|
|
|
BOOLEAN);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
|
2011-06-06 13:02:13 +08:00
|
|
|
BOOLEAN);
|
2011-04-01 00:08:01 +08:00
|
|
|
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
|
|
|
|
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
|
2012-07-06 21:49:53 +08:00
|
|
|
ULONG NTAPI RtlUnicodeStringToAnsiSize (PUNICODE_STRING);
|
2007-08-01 04:48:17 +08:00
|
|
|
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
|
|
|
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2007-08-16 18:41:45 +08:00
|
|
|
WCHAR NTAPI RtlUpcaseUnicodeChar (WCHAR);
|
2007-12-12 20:12:24 +08:00
|
|
|
NTSTATUS NTAPI RtlUpcaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
|
|
|
|
BOOLEAN);
|
2011-04-01 00:08:01 +08:00
|
|
|
NTSTATUS NTAPI RtlWriteRegistryValue (ULONG, PCWSTR, PCWSTR, ULONG, PVOID,
|
|
|
|
ULONG);
|
2007-07-27 01:30:54 +08:00
|
|
|
|
2011-04-01 00:08:01 +08:00
|
|
|
#ifdef __cplusplus
|
2007-07-27 01:30:54 +08:00
|
|
|
/* A few Rtl functions are either actually macros, or they just don't
|
2007-08-12 20:48:02 +08: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-27 01:30:54 +08: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 20:48:02 +08: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-27 01:30:54 +08:00
|
|
|
inline
|
2007-07-29 00:00:35 +08:00
|
|
|
VOID NTAPI RtlInitCountedUnicodeString (PUNICODE_STRING dest, PCWSTR buf,
|
2008-02-16 01:53:11 +08:00
|
|
|
USHORT len)
|
2007-07-27 01:30:54 +08:00
|
|
|
{
|
|
|
|
dest->Length = dest->MaximumLength = len;
|
|
|
|
dest->Buffer = (PWSTR) buf;
|
|
|
|
}
|
2007-08-12 20:48:02 +08: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-16 01:53:11 +08:00
|
|
|
into path's Buffer, and the Length (and MaximumLength) members are set
|
2007-08-12 20:48:02 +08: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 18:10:57 +08:00
|
|
|
inline
|
2007-08-12 20:48:02 +08:00
|
|
|
VOID NTAPI RtlSplitUnicodePath (PUNICODE_STRING path, PUNICODE_STRING dirname,
|
|
|
|
PUNICODE_STRING basename)
|
2007-07-27 18:10:57 +08:00
|
|
|
{
|
|
|
|
USHORT len = path->Length / sizeof (WCHAR);
|
|
|
|
while (len > 0 && path->Buffer[--len] != L'\\')
|
|
|
|
;
|
|
|
|
++len;
|
2007-08-12 20:48:02 +08:00
|
|
|
if (dirname)
|
|
|
|
RtlInitCountedUnicodeString (dirname, path->Buffer, len * sizeof (WCHAR));
|
|
|
|
if (basename)
|
|
|
|
RtlInitCountedUnicodeString (basename, &path->Buffer[len],
|
2007-07-29 00:00:35 +08:00
|
|
|
path->Length - len * sizeof (WCHAR));
|
|
|
|
}
|
2007-08-12 20:48:02 +08:00
|
|
|
/* Check if prefix is a prefix of path. */
|
2007-07-29 00:00:35 +08:00
|
|
|
inline
|
2009-07-15 01:37:42 +08:00
|
|
|
BOOLEAN NTAPI RtlEqualUnicodePathPrefix (PUNICODE_STRING path,
|
|
|
|
PUNICODE_STRING prefix,
|
2007-07-29 00:08:45 +08:00
|
|
|
BOOLEAN caseinsensitive)
|
2007-07-29 00:00:35 +08:00
|
|
|
{
|
2009-07-15 01:37:42 +08:00
|
|
|
UNICODE_STRING p;
|
2007-07-29 00:00:35 +08:00
|
|
|
|
|
|
|
RtlInitCountedUnicodeString (&p, path->Buffer,
|
2009-07-15 01:37:42 +08:00
|
|
|
prefix->Length < path->Length
|
|
|
|
? prefix->Length : path->Length);
|
|
|
|
return RtlEqualUnicodeString (&p, prefix, caseinsensitive);
|
2007-07-29 00:00:35 +08:00
|
|
|
}
|
2011-07-26 17:54:11 +08:00
|
|
|
/* Check if suffix is a suffix of path. */
|
2007-07-29 00:00:35 +08:00
|
|
|
inline
|
2009-07-15 01:37:42 +08:00
|
|
|
BOOL NTAPI RtlEqualUnicodePathSuffix (PUNICODE_STRING path,
|
|
|
|
PUNICODE_STRING suffix,
|
2007-07-29 00:08:45 +08:00
|
|
|
BOOLEAN caseinsensitive)
|
2007-07-29 00:00:35 +08:00
|
|
|
{
|
2009-07-15 01:37:42 +08:00
|
|
|
UNICODE_STRING p;
|
2007-07-29 00:00:35 +08:00
|
|
|
|
2009-07-15 01:37:42 +08:00
|
|
|
if (suffix->Length < path->Length)
|
2007-07-29 00:00:35 +08:00
|
|
|
RtlInitCountedUnicodeString (&p, (PWCHAR) ((PBYTE) path->Buffer
|
2009-07-15 01:37:42 +08:00
|
|
|
+ path->Length - suffix->Length),
|
|
|
|
suffix->Length);
|
2007-07-29 00:00:35 +08:00
|
|
|
else
|
|
|
|
RtlInitCountedUnicodeString (&p, path->Buffer, path->Length);
|
2009-07-15 01:37:42 +08:00
|
|
|
return RtlEqualUnicodeString (&p, suffix, caseinsensitive);
|
2007-07-27 18:10:57 +08:00
|
|
|
}
|
2007-08-12 20:48:02 +08: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 20:12:24 +08:00
|
|
|
otherwise overwrite dest. Returns either STATUS_SUCCESS, or
|
2007-08-12 20:48:02 +08: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-21 03:30:06 +08: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);
|
|
|
|
}
|
2011-04-29 16:27:11 +08:00
|
|
|
|
|
|
|
/* This test for a signalled event is twice as fast as calling
|
|
|
|
WaitForSingleObject (event, 0). */
|
|
|
|
inline
|
|
|
|
BOOL NTAPI IsEventSignalled (HANDLE event)
|
|
|
|
{
|
|
|
|
EVENT_BASIC_INFORMATION ebi;
|
|
|
|
return NT_SUCCESS (NtQueryEvent (event, EventBasicInformation,
|
|
|
|
&ebi, sizeof ebi, NULL))
|
|
|
|
&& ebi.SignalState != 0;
|
|
|
|
|
|
|
|
}
|
2018-03-01 23:51:12 +08:00
|
|
|
|
|
|
|
static inline void
|
|
|
|
start_transaction (HANDLE &old_trans, HANDLE &trans)
|
|
|
|
{
|
|
|
|
NTSTATUS status = NtCreateTransaction (&trans,
|
|
|
|
SYNCHRONIZE | TRANSACTION_ALL_ACCESS,
|
|
|
|
NULL, NULL, NULL, 0, 0, 0, NULL, NULL);
|
|
|
|
if (NT_SUCCESS (status))
|
|
|
|
{
|
|
|
|
old_trans = RtlGetCurrentTransaction ();
|
|
|
|
RtlSetCurrentTransaction (trans);
|
|
|
|
}
|
|
|
|
else
|
2018-03-06 00:50:52 +08:00
|
|
|
old_trans = trans = NULL;
|
2018-03-01 23:51:12 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
static inline NTSTATUS
|
|
|
|
stop_transaction (NTSTATUS status, HANDLE old_trans, HANDLE &trans)
|
|
|
|
{
|
|
|
|
RtlSetCurrentTransaction (old_trans);
|
|
|
|
if (NT_SUCCESS (status))
|
|
|
|
status = NtCommitTransaction (trans, TRUE);
|
|
|
|
else
|
|
|
|
status = NtRollbackTransaction (trans, TRUE);
|
|
|
|
NtClose (trans);
|
|
|
|
trans = NULL;
|
|
|
|
return status;
|
|
|
|
}
|
2000-11-02 13:25:56 +08:00
|
|
|
}
|
2020-01-14 10:50:04 +08:00
|
|
|
|
|
|
|
/* This is for pseudo console workaround. ClosePseudoConsole()
|
|
|
|
seems to have a bug that one internal handle remains opend.
|
|
|
|
This causes handle leak. To close this handle, it is needed
|
|
|
|
to access internal of HPCON. HPCON_INTERNAL is defined for
|
|
|
|
this purpose. The structure of internal of HPCON is not
|
|
|
|
documented. Refer to: https://github.com/Biswa96/XConPty */
|
|
|
|
typedef struct _HPCON_INTERNAL
|
|
|
|
{
|
|
|
|
HANDLE hWritePipe;
|
|
|
|
HANDLE hConDrvReference;
|
|
|
|
HANDLE hConHostProcess;
|
|
|
|
} HPCON_INTERNAL;
|
2011-04-01 00:08:01 +08:00
|
|
|
#endif
|