* ntdll.h: Allow usage from plain C code.

(FSCTL_PIPE_IMPERSONATE): Define.
	(enum _THREAD_INFORMATION_CLASS): Define.
	(RTL_QUERY_REGISTRY_xxx): Define.
	(RTL_REGISTRY_xxx): Define.
	(PRTL_QUERY_REGISTRY_ROUTINE): Define.
	(struct _RTL_QUERY_REGISTRY_TABLE): Define.
	(enum _KEY_VALUE_INFORMATION_CLASS): Define.
	(struct _KEY_VALUE_PARTIAL_INFORMATION): Define.
	(NtAccessCheck): Declare.
	(NtAllocateLocallyUniqueId): Declare.
	(NtCreateKey): Declare.
	(NtDuplicateToken): Declare.
	(NtLoadKey): Declare.
	(NtOpenKey): Declare.
	(NtOpenProcessToken): Declare.
	(NtOpenThreadToken): Declare.
	(NtPrivilegeCheck): Declare.
	(NtQueryInformationToken): Declare.
	(NtQueryValueKey): Declare.
	(NtSetInformationThread): Declare.
	(NtSetInformationToken): Declare.
	(NtSetValueKey): Declare.
	(RtlAbsoluteToSelfRelativeSD): Declare.
	(RtlAddAccessAllowedAce): Declare.
	(RtlAddAccessDeniedAce): Declare.
	(RtlAddAce): Declare.
	(RtlCheckRegistryKey): Declare.
	(RtlCopySid): Declare.
	(RtlCreateAcl): Declare.
	(RtlCreateRegistryKey): Declare.
	(RtlCreateSecurityDescriptor): Declare.
	(RtlEqualPrefixSid): Declare.
	(RtlEqualSid): Declare.
	(RtlFirstFreeAce): Declare.
	(RtlGetAce): Declare.
	(RtlGetDaclSecurityDescriptor): Declare.
	(RtlGetGroupSecurityDescriptor): Declare.
	(RtlGetOwnerSecurityDescriptor): Declare.
	(RtlIdentifierAuthoritySid): Declare.
	(RtlInitializeSid): Declare.
	(RtlLengthSid): Declare.
	(RtlQueryRegistryValues): Declare.
	(RtlSetControlSecurityDescriptor): Declare.
	(RtlSetDaclSecurityDescriptor): Declare.
	(RtlSetGroupSecurityDescriptor): Declare.
	(RtlSetOwnerSecurityDescriptor): Declare.
	(RtlSubAuthorityCountSid): Declare.
	(RtlSubAuthoritySid): Declare.
	(RtlWriteRegistryValue): Declare.
This commit is contained in:
Corinna Vinschen 2011-03-31 16:08:01 +00:00
parent 3f74d8d568
commit e17c77459e
2 changed files with 175 additions and 0 deletions

View File

@ -1,3 +1,56 @@
2011-03-31 Corinna Vinschen <corinna@vinschen.de>
* ntdll.h: Allow usage from plain C code.
(FSCTL_PIPE_IMPERSONATE): Define.
(enum _THREAD_INFORMATION_CLASS): Define.
(RTL_QUERY_REGISTRY_xxx): Define.
(RTL_REGISTRY_xxx): Define.
(PRTL_QUERY_REGISTRY_ROUTINE): Define.
(struct _RTL_QUERY_REGISTRY_TABLE): Define.
(enum _KEY_VALUE_INFORMATION_CLASS): Define.
(struct _KEY_VALUE_PARTIAL_INFORMATION): Define.
(NtAccessCheck): Declare.
(NtAllocateLocallyUniqueId): Declare.
(NtCreateKey): Declare.
(NtDuplicateToken): Declare.
(NtLoadKey): Declare.
(NtOpenKey): Declare.
(NtOpenProcessToken): Declare.
(NtOpenThreadToken): Declare.
(NtPrivilegeCheck): Declare.
(NtQueryInformationToken): Declare.
(NtQueryValueKey): Declare.
(NtSetInformationThread): Declare.
(NtSetInformationToken): Declare.
(NtSetValueKey): Declare.
(RtlAbsoluteToSelfRelativeSD): Declare.
(RtlAddAccessAllowedAce): Declare.
(RtlAddAccessDeniedAce): Declare.
(RtlAddAce): Declare.
(RtlCheckRegistryKey): Declare.
(RtlCopySid): Declare.
(RtlCreateAcl): Declare.
(RtlCreateRegistryKey): Declare.
(RtlCreateSecurityDescriptor): Declare.
(RtlEqualPrefixSid): Declare.
(RtlEqualSid): Declare.
(RtlFirstFreeAce): Declare.
(RtlGetAce): Declare.
(RtlGetDaclSecurityDescriptor): Declare.
(RtlGetGroupSecurityDescriptor): Declare.
(RtlGetOwnerSecurityDescriptor): Declare.
(RtlIdentifierAuthoritySid): Declare.
(RtlInitializeSid): Declare.
(RtlLengthSid): Declare.
(RtlQueryRegistryValues): Declare.
(RtlSetControlSecurityDescriptor): Declare.
(RtlSetDaclSecurityDescriptor): Declare.
(RtlSetGroupSecurityDescriptor): Declare.
(RtlSetOwnerSecurityDescriptor): Declare.
(RtlSubAuthorityCountSid): Declare.
(RtlSubAuthoritySid): Declare.
(RtlWriteRegistryValue): Declare.
2011-03-31 Corinna Vinschen <corinna@vinschen.de>
* uinfo.cc (cygheap_user::init): Don't call GetUserName. Fetch username

View File

@ -873,6 +873,9 @@ typedef struct _FILE_MAILSLOT_SET_INFORMATION
LARGE_INTEGER ReadTimeout;
} FILE_MAILSLOT_SET_INFORMATION, *PFILE_MAILSLOT_SET_INFORMATION;
#define FSCTL_PIPE_IMPERSONATE CTL_CODE(FILE_DEVICE_NAMED_PIPE, 7, \
METHOD_BUFFERED, FILE_ANY_ACCESS)
typedef VOID NTAPI (*PIO_APC_ROUTINE)(PVOID, PIO_STATUS_BLOCK, ULONG);
typedef enum _EVENT_TYPE
@ -892,12 +895,65 @@ typedef enum _EVENT_INFORMATION_CLASS
EventBasicInformation = 0
} EVENT_INFORMATION_CLASS, *PEVENT_INFORMATION_CLASS;
typedef enum _THREAD_INFORMATION_CLASS
{
ThreadImpersonationToken = 5
} THREAD_INFORMATION_CLASS, *PTHREAD_INFORMATION_CLASS;
#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
#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
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;
typedef struct _KEY_VALUE_PARTIAL_INFORMATION
{
ULONG TitleIndex;
ULONG Type;
ULONG DataLength;
UCHAR Data[1];
} KEY_VALUE_PARTIAL_INFORMATION, *PKEY_VALUE_PARTIAL_INFORMATION;
/* Function declarations for ntdll.dll. These don't appear in any
standard Win32 header. */
#define NtCurrentProcess() ((HANDLE) 0xffffffff)
#define NtCurrentThread() ((HANDLE) 0xfffffffe)
#ifdef __cplusplus
/* This is the mapping of the KUSER_SHARED_DATA structure into the 32 bit
user address space. We need it here to access the current DismountCount. */
static KUSER_SHARED_DATA &SharedUserData
@ -905,13 +961,20 @@ static KUSER_SHARED_DATA &SharedUserData
extern "C"
{
#endif
NTSTATUS NTAPI NtAccessCheck (PSECURITY_DESCRIPTOR, HANDLE, ACCESS_MASK,
PGENERIC_MAPPING, PPRIVILEGE_SET, PULONG,
PACCESS_MASK, PNTSTATUS);
NTSTATUS NTAPI NtAdjustPrivilegesToken (HANDLE, BOOLEAN, PTOKEN_PRIVILEGES,
ULONG, PTOKEN_PRIVILEGES, PULONG);
NTSTATUS NTAPI NtAllocateLocallyUniqueId (PLUID);
NTSTATUS NTAPI NtAllocateUuids (PLARGE_INTEGER, PULONG, PULONG, PUCHAR);
NTSTATUS NTAPI NtClose (HANDLE);
NTSTATUS NTAPI NtCommitTransaction (HANDLE, BOOLEAN);
NTSTATUS NTAPI NtCreateDirectoryObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtCreateKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES, ULONG,
PUNICODE_STRING, ULONG, PULONG);
NTSTATUS NTAPI NtCreateEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
EVENT_TYPE, BOOLEAN);
NTSTATUS NTAPI NtCreateFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
@ -934,9 +997,12 @@ extern "C"
NTSTATUS NTAPI NtCreateTransaction (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
LPGUID, HANDLE, ULONG, ULONG, ULONG,
PLARGE_INTEGER, PUNICODE_STRING);
NTSTATUS NTAPI NtDuplicateToken (HANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
BOOLEAN, TOKEN_TYPE, PHANDLE);
NTSTATUS NTAPI NtFsControlFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
PIO_STATUS_BLOCK, ULONG, PVOID, ULONG,
PVOID, ULONG);
NTSTATUS NTAPI NtLoadKey (POBJECT_ATTRIBUTES, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtLockVirtualMemory (HANDLE, PVOID *, ULONG *, ULONG);
NTSTATUS NTAPI NtMapViewOfSection (HANDLE, HANDLE, PVOID *, ULONG, ULONG,
PLARGE_INTEGER, PULONG, SECTION_INHERIT,
@ -950,13 +1016,17 @@ extern "C"
NTSTATUS NTAPI NtOpenEvent (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenFile (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES,
PIO_STATUS_BLOCK, ULONG, ULONG);
NTSTATUS NTAPI NtOpenKey (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenMutant (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenProcessToken (HANDLE, ACCESS_MASK, PHANDLE);
NTSTATUS NTAPI NtOpenThreadToken (HANDLE, ACCESS_MASK, BOOLEAN, PHANDLE);
NTSTATUS NTAPI NtOpenSection (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenSemaphore (PHANDLE, ACCESS_MASK, POBJECT_ATTRIBUTES);
NTSTATUS NTAPI NtOpenSymbolicLinkObject (PHANDLE, ACCESS_MASK,
POBJECT_ATTRIBUTES);
/* WARNING! Don't rely on the timestamp information returned by
NtQueryAttributesFile. Only the DOS file attribute info is reliable. */
NTSTATUS NTAPI NtPrivilegeCheck (HANDLE, PPRIVILEGE_SET, PBOOLEAN);
NTSTATUS NTAPI NtQueryAttributesFile (POBJECT_ATTRIBUTES,
PFILE_BASIC_INFORMATION);
NTSTATUS NTAPI NtQueryDirectoryFile(HANDLE, HANDLE, PVOID, PVOID,
@ -975,6 +1045,8 @@ extern "C"
ULONG, FILE_INFORMATION_CLASS);
NTSTATUS NTAPI NtQueryInformationProcess (HANDLE, PROCESSINFOCLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryInformationToken (HANDLE, TOKEN_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryObject (HANDLE, OBJECT_INFORMATION_CLASS, VOID *,
ULONG, ULONG *);
NTSTATUS NTAPI NtQuerySystemInformation (SYSTEM_INFORMATION_CLASS,
@ -986,6 +1058,9 @@ extern "C"
PSECURITY_DESCRIPTOR, ULONG, PULONG);
NTSTATUS NTAPI NtQuerySymbolicLinkObject (HANDLE, PUNICODE_STRING, PULONG);
NTSTATUS NTAPI NtQueryTimerResolution (PULONG, PULONG, PULONG);
NTSTATUS NTAPI NtQueryValueKey (HANDLE, PUNICODE_STRING,
KEY_VALUE_INFORMATION_CLASS, PVOID, ULONG,
PULONG);
NTSTATUS NTAPI NtQueryVirtualMemory (HANDLE, PVOID, MEMORY_INFORMATION_CLASS,
PVOID, ULONG, PULONG);
NTSTATUS NTAPI NtQueryVolumeInformationFile (HANDLE, IO_STATUS_BLOCK *,
@ -998,50 +1073,93 @@ extern "C"
NTSTATUS NTAPI NtSetEaFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG);
NTSTATUS NTAPI NtSetInformationFile (HANDLE, PIO_STATUS_BLOCK, PVOID, ULONG,
FILE_INFORMATION_CLASS);
NTSTATUS NTAPI NtSetInformationThread (HANDLE, THREAD_INFORMATION_CLASS,
PVOID, ULONG);
NTSTATUS NTAPI NtSetInformationToken (HANDLE, TOKEN_INFORMATION_CLASS, PVOID,
ULONG);
NTSTATUS NTAPI NtSetSecurityObject (HANDLE, SECURITY_INFORMATION,
PSECURITY_DESCRIPTOR);
NTSTATUS NTAPI NtSetTimerResolution (ULONG, BOOLEAN, PULONG);
NTSTATUS NTAPI NtSetValueKey (HANDLE, PUNICODE_STRING, ULONG, ULONG, PVOID,
ULONG);
NTSTATUS NTAPI NtUnlockVirtualMemory (HANDLE, PVOID *, ULONG *, ULONG);
NTSTATUS NTAPI NtUnmapViewOfSection (HANDLE, PVOID);
NTSTATUS NTAPI NtWriteFile (HANDLE, HANDLE, PIO_APC_ROUTINE, PVOID,
PIO_STATUS_BLOCK, PVOID, ULONG, PLARGE_INTEGER,
PULONG);
NTSTATUS NTAPI RtlAbsoluteToSelfRelativeSD (PSECURITY_DESCRIPTOR,
PSECURITY_DESCRIPTOR, PULONG);
VOID NTAPI RtlAcquirePebLock ();
NTSTATUS NTAPI RtlAddAccessAllowedAce (PACL, ULONG, ACCESS_MASK, PSID);
NTSTATUS NTAPI RtlAddAccessDeniedAce (PACL, ULONG, ACCESS_MASK, PSID);
NTSTATUS NTAPI RtlAddAce (PACL, ULONG, ULONG, PVOID, ULONG);
PVOID NTAPI RtlAllocateHeap (PVOID, ULONG, SIZE_T);
NTSTATUS NTAPI RtlAppendUnicodeToString (PUNICODE_STRING, PCWSTR);
NTSTATUS NTAPI RtlAppendUnicodeStringToString (PUNICODE_STRING,
PUNICODE_STRING);
NTSTATUS NTAPI RtlAnsiStringToUnicodeString (PUNICODE_STRING, PANSI_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlCheckRegistryKey (ULONG, PCWSTR);
LONG NTAPI RtlCompareUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlConvertSidToUnicodeString (PUNICODE_STRING, PSID, BOOLEAN);
VOID NTAPI RtlCopyUnicodeString (PUNICODE_STRING, PUNICODE_STRING);
NTSTATUS NTAPI RtlCopySid (ULONG, PSID, PSID);
NTSTATUS NTAPI RtlCreateAcl (PACL, ULONG, ULONG);
NTSTATUS NTAPI RtlCreateRegistryKey (ULONG, PCWSTR);
NTSTATUS NTAPI RtlCreateSecurityDescriptor (PSECURITY_DESCRIPTOR, ULONG);
BOOLEAN NTAPI RtlCreateUnicodeStringFromAsciiz (PUNICODE_STRING, PCSTR);
NTSTATUS NTAPI RtlDowncaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlEnterCriticalSection (PRTL_CRITICAL_SECTION);
BOOLEAN NTAPI RtlEqualPrefixSid (PSID, PSID);
BOOLEAN NTAPI RtlEqualSid (PSID, PSID);
BOOLEAN NTAPI RtlEqualUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
VOID NTAPI RtlFreeAnsiString (PANSI_STRING);
BOOLEAN NTAPI RtlFreeHeap (PVOID, ULONG, PVOID);
VOID NTAPI RtlFreeOemString (POEM_STRING);
VOID NTAPI RtlFreeUnicodeString (PUNICODE_STRING);
BOOLEAN NTAPI RtlFirstFreeAce (PACL, PVOID *);
NTSTATUS NTAPI RtlGetAce (PACL, ULONG, PVOID);
HANDLE NTAPI RtlGetCurrentTransaction ();
NTSTATUS NTAPI RtlGetDaclSecurityDescriptor (PSECURITY_DESCRIPTOR, PBOOLEAN,
PACL *, PBOOLEAN);
NTSTATUS NTAPI RtlGetGroupSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
PBOOLEAN);
NTSTATUS NTAPI RtlGetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID *,
PBOOLEAN);
PSID_IDENTIFIER_AUTHORITY NTAPI RtlIdentifierAuthoritySid (PSID);
VOID NTAPI RtlInitEmptyUnicodeString (PUNICODE_STRING, PCWSTR, USHORT);
NTSTATUS NTAPI RtlInitializeSid (PSID, PSID_IDENTIFIER_AUTHORITY, UCHAR);
VOID NTAPI RtlInitUnicodeString (PUNICODE_STRING, PCWSTR);
NTSTATUS NTAPI RtlIntegerToUnicodeString (ULONG, ULONG, PUNICODE_STRING);
ULONG NTAPI RtlIsDosDeviceName_U (PCWSTR);
NTSTATUS NTAPI RtlLeaveCriticalSection (PRTL_CRITICAL_SECTION);
ULONG NTAPI RtlLengthSid (PSID);
ULONG NTAPI RtlNtStatusToDosError (NTSTATUS);
NTSTATUS NTAPI RtlOemStringToUnicodeString (PUNICODE_STRING, POEM_STRING,
BOOLEAN);
BOOLEAN NTAPI RtlPrefixUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlQueryRegistryValues (ULONG, PCWSTR,
PRTL_QUERY_REGISTRY_TABLE, PVOID,
PVOID);
VOID NTAPI RtlReleasePebLock ();
VOID NTAPI RtlSecondsSince1970ToTime (ULONG, PLARGE_INTEGER);
NTSTATUS NTAPI RtlSetCurrentDirectory_U (PUNICODE_STRING);
BOOLEAN NTAPI RtlSetCurrentTransaction (HANDLE);
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,
BOOLEAN);
NTSTATUS NTAPI RtlSetOwnerSecurityDescriptor (PSECURITY_DESCRIPTOR, PSID,
BOOLEAN);
PUCHAR NTAPI RtlSubAuthorityCountSid (PSID);
PULONG NTAPI RtlSubAuthoritySid (PSID, ULONG);
NTSTATUS NTAPI RtlUnicodeStringToAnsiString (PANSI_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlUnicodeStringToOemString (PANSI_STRING, PUNICODE_STRING,
@ -1049,7 +1167,10 @@ extern "C"
WCHAR NTAPI RtlUpcaseUnicodeChar (WCHAR);
NTSTATUS NTAPI RtlUpcaseUnicodeString (PUNICODE_STRING, PUNICODE_STRING,
BOOLEAN);
NTSTATUS NTAPI RtlWriteRegistryValue (ULONG, PCWSTR, PCWSTR, ULONG, PVOID,
ULONG);
#ifdef __cplusplus
/* A few Rtl functions are either actually macros, or they just don't
exist even though they would be a big help. We implement them here,
partly as inline functions. */
@ -1147,4 +1268,5 @@ extern "C"
return NtSetInformationFile(h, &io, &fbi, sizeof fbi, FileBasicInformation);
}
}
#endif
#endif /*_NTDLL_H*/