Skip to content

Commit 4dba1cc

Browse files
committed
1 parent 78e3f7c commit 4dba1cc

File tree

25 files changed

+1136
-418
lines changed

25 files changed

+1136
-418
lines changed

Source/Include/KNSoft/NDK/NT/Bcd.h

Lines changed: 369 additions & 170 deletions
Large diffs are not rendered by default.

Source/Include/KNSoft/NDK/NT/Cm/RegInfo.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ typedef struct _KEY_CACHED_INFORMATION
131131
// msdn
132132
/**
133133
* \def REG_KEY_DONT_VIRTUALIZE
134-
* \brief The REG_KEY_DONT_VIRTUALIZE flag disables write registry virtualization.
134+
* \brief The REG_KEY_DONT_VIRTUALIZE flag disables write registry virtualization.
135135
*
136136
* If this flag is set and a create key or set value operation fails because the caller
137137
* does not have sufficient access right to the parent key, the registry fails the operation.
@@ -432,6 +432,7 @@ typedef enum _REG_ACTION
432432
KeyModified
433433
} REG_ACTION;
434434

435+
_Struct_size_bytes_(NextEntryOffset)
435436
typedef struct _REG_NOTIFY_INFORMATION
436437
{
437438
ULONG NextEntryOffset;

Source/Include/KNSoft/NDK/NT/Ex/Boot.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ typedef struct _BOOT_OPTIONS
170170
ULONG Timeout;
171171
ULONG CurrentBootEntryId;
172172
ULONG NextBootEntryId;
173-
WCHAR HeadlessRedirection[1];
173+
_Field_size_bytes_(Length) WCHAR HeadlessRedirection[1];
174174
} BOOT_OPTIONS, *PBOOT_OPTIONS;
175175

176176
// private

Source/Include/KNSoft/NDK/NT/Ex/Misc.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,17 @@ typedef enum _HARDERROR_RESPONSE
6161

6262
#define HARDERROR_OVERRIDE_ERRORMODE 0x10000000
6363

64+
/**
65+
* The NtRaiseHardError routine raises a hard error or serious error dialog box being displayed to the user.
66+
*
67+
* \param[in] ErrorStatus The NTSTATUS code that describes the error condition.
68+
* \param[in] NumberOfParameters The number of parameters in the Parameters array.
69+
* \param[in] UnicodeStringParameterMask A bitmask indicating which entries in the Parameters array are Unicode strings.
70+
* \param[in] Parameters An array of parameters to be used in the error message.
71+
* \param[in] ValidResponseOptions Specifies the valid responses that the user can select in the error dialog.
72+
* \param[out] Response Receives the user's response to the error dialog.
73+
* \return NTSTATUS Successful or errant status.
74+
*/
6475
_Analysis_noreturn_
6576
DECLSPEC_NORETURN
6677
NTSYSCALLAPI

Source/Include/KNSoft/NDK/NT/Ex/Sync.h

Lines changed: 98 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,15 @@ typedef enum _TIMER_INFORMATION_CLASS
530530
TimerBasicInformation // TIMER_BASIC_INFORMATION
531531
} TIMER_INFORMATION_CLASS;
532532

533+
typedef enum _TIMER_SET_INFORMATION_CLASS
534+
{
535+
TimerSetCoalescableTimer, // TIMER_SET_COALESCABLE_TIMER_INFO
536+
MaxTimerInfoClass
537+
} TIMER_SET_INFORMATION_CLASS;
538+
539+
/**
540+
* The TIMER_BASIC_INFORMATION structure contains basic information about a timer object.
541+
*/
533542
typedef struct _TIMER_BASIC_INFORMATION
534543
{
535544
LARGE_INTEGER RemainingTime;
@@ -546,12 +555,6 @@ TIMER_APC_ROUTINE(
546555
_In_ LONG TimerHighValue);
547556
typedef TIMER_APC_ROUTINE* PTIMER_APC_ROUTINE;
548557

549-
typedef enum _TIMER_SET_INFORMATION_CLASS
550-
{
551-
TimerSetCoalescableTimer, // TIMER_SET_COALESCABLE_TIMER_INFO
552-
MaxTimerInfoClass
553-
} TIMER_SET_INFORMATION_CLASS;
554-
555558
typedef struct _TIMER_SET_COALESCABLE_TIMER_INFO
556559
{
557560
_In_ LARGE_INTEGER DueTime;
@@ -681,28 +684,86 @@ NtQueryTimer(
681684

682685
#if (NTDDI_VERSION >= NTDDI_WIN8)
683686

687+
// ExCheckValidIRTimerId
688+
typedef enum _IR_TIMER_PROVIDER_INDEX
689+
{
690+
IR_TIMER_PROVIDER_TESTIDENTIFIER, // Token(Service SID)
691+
IR_TIMER_PROVIDER_BROKERINFRASTRUCTURE, // Token(Service SID)
692+
IR_TIMER_PROVIDER_TIMEBROKERSVC, // Token(Service SID)
693+
IR_TIMER_PROVIDER_LFSVC,
694+
IR_TIMER_PROVIDER_WINLOGON,
695+
IR_TIMER_PROVIDER_POWER,
696+
IR_TIMER_PROVIDER_SENSORSERVICE,
697+
IR_TIMER_PROVIDER_NTOSPO,
698+
IR_TIMER_PROVIDER_ACPI,
699+
IR_TIMER_PROVIDER_BUTTON,
700+
IR_TIMER_PROVIDER_MSGPIOCLX,
701+
IR_TIMER_PROVIDER_BUTTONCONVERTER,
702+
IR_TIMER_PROVIDER_MSGPIOWIN32,
703+
IR_TIMER_PROVIDER_KNETPWRDEPBROKER,
704+
IR_TIMER_PROVIDER_CMBATT,
705+
IR_TIMER_PROVIDER_BTHPORT,
706+
IR_TIMER_PROVIDER_AUDIOSRV, // TOKEN(SERVICE SID)
707+
IR_TIMER_PROVIDER_ARTESTIDENTIFIER, // TOKEN(SERVICE SID)
708+
IR_TIMER_PROVIDER_BATTC,
709+
IR_TIMER_PROVIDER_MAXINDEX
710+
} IR_TIMER_PROVIDER_INDEX;
711+
712+
//CONST USHORT IR_TIMER_PROVIDER_ID_MAX[] =
713+
//{
714+
// 1, // IR_TIMER_PROVIDER_TESTIDENTIFIER
715+
// 1, // IR_TIMER_PROVIDER_BROKERINFRASTRUCTURE
716+
// 1, // IR_TIMER_PROVIDER_TIMEBROKERSVC
717+
// 11, // IR_TIMER_PROVIDER_LFSVC (0x0B)
718+
// 1, // IR_TIMER_PROVIDER_WINLOGON
719+
// 2, // IR_TIMER_PROVIDER_POWER
720+
// 1, // IR_TIMER_PROVIDER_SENSORSERVICE
721+
// 6, // IR_TIMER_PROVIDER_NTOSPO
722+
// 1, // IR_TIMER_PROVIDER_ACPI
723+
// 1, // IR_TIMER_PROVIDER_BUTTON
724+
// 2, // MsGpioClx
725+
// 1, // ButtonConverter
726+
// 2, // MsGpioWin32
727+
// 2, // KNetPwrDepBroker
728+
// 1, // Cmbatt
729+
// 2, // Bthport
730+
// 1, // AudioSrv
731+
// 1, // ArTestIdentifier
732+
// 1 // Battc
733+
//};
734+
735+
// rev
736+
#define IR_TIMERID_PROVIDER(TimerId) ((USHORT)HIWORD((ULONG)(TimerId)))
737+
#define IR_TIMERID_ID(TimerId) ((USHORT)LOWORD((ULONG)(TimerId)))
738+
#define IR_TIMERID_IS_NONZERO(TimerId) (IR_TIMERID_ID(TimerId) != 0)
739+
#define IR_TIMERID_ATTRIBUTES(ProviderIndex, ProviderId) \
740+
((ULONG)MAKELONG((USHORT)(ProviderId), (USHORT)(ProviderIndex)))
741+
684742
/**
685743
* The NtCreateIRTimer routine creates an IR timer object.
744+
* IR timers are interruptdriven and designed for high-resolution timing in system components.
686745
*
687746
* \param TimerHandle A pointer to a variable that receives the handle to the IR timer object.
688-
* \param Reserved Reserved parameter.
747+
* \param TimerId A pointer to a timer identifier that specifies the provider.
689748
* \param DesiredAccess The access mask that specifies the requested access to the timer object.
690749
* \return NTSTATUS Successful or errant status.
750+
* \remarks The TimerId must be non-NULL and point to a valid timer identifier.
691751
*/
692752
NTSYSCALLAPI
693753
NTSTATUS
694754
NTAPI
695755
NtCreateIRTimer(
696756
_Out_ PHANDLE TimerHandle,
697-
_In_ PVOID Reserved,
757+
_In_ PULONG TimerId,
698758
_In_ ACCESS_MASK DesiredAccess
699-
);
759+
);
700760

701761
/**
702762
* The NtSetIRTimer routine sets an IR timer object.
703763
*
704764
* \param TimerHandle A handle to the IR timer object.
705-
* \param DueTime An optional pointer to a LARGE_INTEGER that specifies the time at which the timer is to be set to the signaled state.
765+
* \param DueTime An optional pointer to a LARGE_INTEGER that specifies
766+
* the time at which the timer is to be set to the signaled state.
706767
* \return NTSTATUS Successful or errant status.
707768
*/
708769
NTSYSCALLAPI
@@ -720,31 +781,48 @@ NtSetIRTimer(
720781
//
721782
// NtCreateTimer2 Attributes
722783
//
784+
#define TIMER2_ATTRIBUTE_IR_TIMER 0x00000002UL
723785
#define TIMER2_ATTRIBUTE_HIGH_RESOLUTION 0x00000004UL
724786
#define TIMER2_ATTRIBUTE_NOTIFICATION 0x80000000UL
725-
#define TIMER2_ATTRIBUTE_KNOWN_MASK (TIMER2_ATTRIBUTE_HIGH_RESOLUTION | TIMER2_ATTRIBUTE_NOTIFICATION)
726-
#define TIMER2_ATTRIBUTE_RESERVED_MASK (~TIMER2_ATTRIBUTE_KNOWN_MASK)
727-
#define TIMER2_ATTRIBUTE_FOR_TYPE(T) (((T) == NotificationTimer) ? TIMER2_ATTRIBUTE_NOTIFICATION : 0)
728-
#define TIMER2_BUILD_ATTRIBUTES(T, R) (TIMER2_ATTRIBUTE_FOR_TYPE(T) | ((R) ? TIMER2_ATTRIBUTE_HIGH_RESOLUTION : 0))
787+
// rev
788+
#define TIMER2_ATTRIBUTE_KNOWN_MASK (TIMER2_ATTRIBUTE_IR_TIMER | TIMER2_ATTRIBUTE_HIGH_RESOLUTION | TIMER2_ATTRIBUTE_NOTIFICATION)
789+
#define TIMER2_ATTRIBUTE_RESERVED_MASK (~TIMER2_ATTRIBUTE_KNOWN_MASK)
790+
791+
#define TIMER2_ATTRIBUTE_FOR_TYPE(T) \
792+
(((T) == NotificationTimer) ? TIMER2_ATTRIBUTE_NOTIFICATION : 0)
793+
794+
// Build attributes for a *non-IR* timer
795+
// - T: TIMER_TYPE (NotificationTimer/SynchronizationTimer)
796+
// - R: bool for HighResolution
797+
//
798+
#define TIMER2_BUILD_ATTRIBUTES(T, R) \
799+
(TIMER2_ATTRIBUTE_FOR_TYPE(T) | ((R) ? TIMER2_ATTRIBUTE_HIGH_RESOLUTION : 0))
800+
801+
// Build attributes for an *IR* timer
802+
// - R: bool for HighResolution
803+
//
804+
#define TIMER2_BUILD_IR_ATTRIBUTES(R) \
805+
(TIMER2_ATTRIBUTE_IR_TIMER | ((R) ? TIMER2_ATTRIBUTE_HIGH_RESOLUTION : 0))
729806

730807
// rev
731808
typedef union _TIMER2_ATTRIBUTES
732809
{
733810
ULONG Value;
734811
struct
735812
{
736-
ULONG Reserved0 : 2;
737-
ULONG HighResolution : 1;
738-
ULONG Reserved1 : 28;
739-
TIMER_TYPE NotificationType : 1;
813+
ULONG Reserved0 : 1; // bit 0 (reserved)
814+
ULONG IrTimer : 1; // bit 1 == TIMER2_ATTRIBUTE_IR_TIMER
815+
ULONG HighResolution : 1; // bit 2 == TIMER2_ATTRIBUTE_HIGH_RESOLUTION
816+
ULONG Reserved1 : 28; // bits [3..30] (reserved)
817+
TIMER_TYPE NotificationType : 1; // bit 31 == TIMER2_ATTRIBUTE_NOTIFICATION
740818
};
741819
} TIMER2_ATTRIBUTES;
742820

743821
/**
744822
* The NtCreateTimer2 routine creates a timer object.
745823
*
746824
* \param TimerHandle A pointer to a variable that receives the handle to the timer object.
747-
* \param Reserved Reserved parameter.
825+
* \param TimerId For IR timers: A pointer to ULONG TIMERID (non-NULL). For non-IR timers: must be NULL.
748826
* \param ObjectAttributes A pointer to an OBJECT_ATTRIBUTES structure that specifies the object attributes.
749827
* \param Attributes Timer attributes (TIMER_TYPE).
750828
* \param DesiredAccess The access mask that specifies the requested access to the timer object.
@@ -755,7 +833,7 @@ NTSTATUS
755833
NTAPI
756834
NtCreateTimer2(
757835
_Out_ PHANDLE TimerHandle,
758-
_In_opt_ PVOID Reserved,
836+
_In_opt_ PULONG TimerId,
759837
_In_opt_ PCOBJECT_ATTRIBUTES ObjectAttributes,
760838
_In_ ULONG Attributes, // TIMER2_ATTRIBUTES or TIMER2_BUILD_ATTRIBUTES
761839
_In_ ACCESS_MASK DesiredAccess

Source/Include/KNSoft/NDK/NT/Ex/SysDbg.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,17 @@ typedef struct _SYSDBG_KD_PULL_REMOTE_FILE
194194
UNICODE_STRING ImageFileName;
195195
} SYSDBG_KD_PULL_REMOTE_FILE, *PSYSDBG_KD_PULL_REMOTE_FILE;
196196

197+
/**
198+
* The NtSystemDebugControl routine provides system debugging and diagnostic control of the system.
199+
*
200+
* \param[in] Command The debug control command to execute (of type SYSDBG_COMMAND).
201+
* \param[in] InputBuffer Optional pointer to a buffer containing input data for the command.
202+
* \param[in] InputBufferLength Length, in bytes, of the input buffer.
203+
* \param[out] OutputBuffer Optional pointer to a buffer that receives output data from the command.
204+
* \param[in] OutputBufferLength Length, in bytes, of the output buffer.
205+
* \param[out] ReturnLength Optional pointer to a variable that receives the number of bytes returned in the output buffer.
206+
* \return NTSTATUS Successful or errant status.
207+
*/
197208
NTSYSCALLAPI
198209
NTSTATUS
199210
NTAPI

0 commit comments

Comments
 (0)