From 8a97cb8ea3b98f2b7d501ea01651b61d2f67f50a Mon Sep 17 00:00:00 2001 From: Ratin Gao Date: Mon, 23 Sep 2024 21:21:33 +0800 Subject: [PATCH] [SYNC] Sync phnt --- README.md | 2 +- README.zh-CN.md | 2 +- Source/Include/KNSoft/NDK/NT/MinDef.h | 10 ++++- Source/Include/KNSoft/NDK/NT/Rtl/Heap.h | 2 + Source/Include/KNSoft/NDK/NT/Win32K/Misc.h | 44 +++++++++++++++++++- Source/Include/KNSoft/NDK/Win32/API/User32.h | 9 ++++ Source/Include/KNSoft/NDK/Win32/API/WinSta.h | 5 +-- 7 files changed, 67 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index c17335b..d1937e9 100644 --- a/README.md +++ b/README.md @@ -85,6 +85,6 @@ The content from the following public sources were lawfully used: - Windows Internals And public projects: -- phnt (from [winsiderss/systeminformer](https://github.com/winsiderss/systeminformer), [commit ec15fef2](https://github.com/winsiderss/systeminformer/commit/ec15fef23bff3e94ce2621a4f3eb67a1b493cb35)) - [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) +- phnt (from [winsiderss/systeminformer](https://github.com/winsiderss/systeminformer), [commit 6a372fc5](https://github.com/winsiderss/systeminformer/commit/6a372fc5167e3c27230dee84644817c5e54ef5ed)) - [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) [KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK) also uses [KNSoft/Precomp4C](https://github.com/KNSoft/Precomp4C) to generate DLL import libraries. diff --git a/README.zh-CN.md b/README.zh-CN.md index 52ef7b9..2617626 100644 --- a/README.zh-CN.md +++ b/README.zh-CN.md @@ -85,6 +85,6 @@ NuGet包[KNSoft.NDK](https://www.nuget.org/packages/KNSoft.NDK)包含所有头 - Windows Internals 和公开项目: -- phnt(来自[winsiderss/systeminformer](https://github.com/winsiderss/systeminformer),[提交 ec15fef2](https://github.com/winsiderss/systeminformer/commit/ec15fef23bff3e94ce2621a4f3eb67a1b493cb35))- [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) +- phnt(来自[winsiderss/systeminformer](https://github.com/winsiderss/systeminformer),[提交 6a372fc5](https://github.com/winsiderss/systeminformer/commit/6a372fc5167e3c27230dee84644817c5e54ef5ed))- [MIT](https://github.com/winsiderss/phnt/blob/master/LICENSE) [KNSoft.NDK](https://github.com/KNSoft/KNSoft.NDK)也使用了[KNSoft/Precomp4C](https://github.com/KNSoft/Precomp4C)来生成DLL引入库。 diff --git a/Source/Include/KNSoft/NDK/NT/MinDef.h b/Source/Include/KNSoft/NDK/NT/MinDef.h index 24f10ca..cf450bf 100644 --- a/Source/Include/KNSoft/NDK/NT/MinDef.h +++ b/Source/Include/KNSoft/NDK/NT/MinDef.h @@ -257,7 +257,7 @@ typedef SID* PSID; #pragma region Basic Types typedef unsigned __int64 QWORD, near* PQWORD, far* LPQWORD; -typedef double *PDOUBLE; +typedef DOUBLE *PDOUBLE; #define MAKEDWORD(l, h) ((DWORD)(((WORD)(((DWORD_PTR)(l)) & 0xffff)) | ((DWORD)((WORD)(((DWORD_PTR)(h)) & 0xffff))) << 16)) #define MAKEQWORD(l, h) ((QWORD)(((DWORD)(((DWORD_PTR)(l)) & 0xffffffff)) | ((QWORD)((DWORD)(((DWORD_PTR)(h)) & 0xffffffff))) << 32)) @@ -273,9 +273,17 @@ typedef double *PDOUBLE; #define DECLSPEC_ALLOCATOR __declspec(allocator) #define DECLSPEC_EXPORT __declspec(dllexport) +#define DECLSPEC_NOALIAS __declspec(noalias) EXTERN_C IMAGE_DOS_HEADER __ImageBase; +#if __STDC_VERSION__ >= 202311L +#ifndef __cplusplus +#define nullptr ((void *)0) +#endif +typedef __typeof__(nullptr) nullptr_t; +#endif + #pragma endregion #pragma region Types diff --git a/Source/Include/KNSoft/NDK/NT/Rtl/Heap.h b/Source/Include/KNSoft/NDK/NT/Rtl/Heap.h index 643807f..21de5d6 100644 --- a/Source/Include/KNSoft/NDK/NT/Rtl/Heap.h +++ b/Source/Include/KNSoft/NDK/NT/Rtl/Heap.h @@ -283,6 +283,7 @@ _Ret_maybenull_ _Post_writable_byte_size_(Size) __drv_allocatesMem(Mem) DECLSPEC_ALLOCATOR +DECLSPEC_NOALIAS DECLSPEC_RESTRICT PVOID NTAPI @@ -362,6 +363,7 @@ _Ret_maybenull_ _Post_writable_byte_size_(Size) _When_(Size > 0, __drv_allocatesMem(Mem)) DECLSPEC_ALLOCATOR +DECLSPEC_NOALIAS DECLSPEC_RESTRICT PVOID NTAPI diff --git a/Source/Include/KNSoft/NDK/NT/Win32K/Misc.h b/Source/Include/KNSoft/NDK/NT/Win32K/Misc.h index 286de15..24dc796 100644 --- a/Source/Include/KNSoft/NDK/NT/Win32K/Misc.h +++ b/Source/Include/KNSoft/NDK/NT/Win32K/Misc.h @@ -28,6 +28,48 @@ NtUserQueryWindow( _In_ WINDOWINFOCLASS WindowInfo ); +NTSYSCALLAPI +NTSTATUS +NTAPI +NtUserTestForInteractiveUser( + _In_ PLUID AuthenticationId + ); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtUserCheckAccessForIntegrityLevel( + _In_ ULONG ProcessIdFirst, + _In_ ULONG ProcessIdSecond, + _Out_ PBOOLEAN GrantedAccess + ); + +NTSYSCALLAPI +NTSTATUS +NTAPI +NtUserCheckProcessForClipboardAccess( + _In_ ULONG ProcessId, + _Out_ PULONG GrantedAccess + ); + +NTSYSCALLAPI +ULONG +NTAPI +NtUserInternalGetWindowText( + _In_ HWND WindowHandle, + _Out_writes_to_(cchMaxCount, return + 1) LPWSTR pString, + _In_ ULONG cchMaxCount + ); + +NTSYSCALLAPI +ULONG +NTAPI +NtUserGetClassName( + _In_ HWND WindowHandle, + _In_ LONGLONG Real, + _Out_ PUNICODE_STRING ClassName + ); + typedef enum _CONSOLECONTROL { ConsoleSetVDMCursorBounds = 0, // RECT @@ -74,7 +116,7 @@ typedef struct _CONSOLEENDTASK } CONSOLEENDTASK, *PCONSOLEENDTASK; /** - * Performs special kernel operations for console host applications. + * Performs special kernel operations for console host applications. (win32u.dll) * * This includes reparenting the console window, allowing the console to pass foreground rights * on to launched console subsystem applications and terminating attached processes. diff --git a/Source/Include/KNSoft/NDK/Win32/API/User32.h b/Source/Include/KNSoft/NDK/Win32/API/User32.h index 139868f..508a5b0 100644 --- a/Source/Include/KNSoft/NDK/Win32/API/User32.h +++ b/Source/Include/KNSoft/NDK/Win32/API/User32.h @@ -36,4 +36,13 @@ EndTask( BOOL fShutDown, BOOL fForce); +/* See also NtUserConsoleControl */ +NTSYSCALLAPI +NTSTATUS +NTAPI +ConsoleControl( + _In_ CONSOLECONTROL Command, + _In_reads_bytes_(ConsoleInformationLength) PVOID ConsoleInformation, + _In_ ULONG ConsoleInformationLength); + EXTERN_C_END diff --git a/Source/Include/KNSoft/NDK/Win32/API/WinSta.h b/Source/Include/KNSoft/NDK/Win32/API/WinSta.h index 6e20cd7..0c6ad2d 100644 --- a/Source/Include/KNSoft/NDK/Win32/API/WinSta.h +++ b/Source/Include/KNSoft/NDK/Win32/API/WinSta.h @@ -1188,14 +1188,13 @@ WinStationIsSessionRemoteable( _Out_ PBOOLEAN IsRemote ); - // rev NTSYSAPI BOOLEAN NTAPI WinStationSetAutologonPassword( - _In_ PCSTR SessionId, - _In_ PCSTR Name + _In_ PCSTR KeyName, + _In_ PCSTR Password ); typedef enum _SessionType