From c0f1450076244e92ca76532ce1aa78944933a66b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Thu, 11 Jun 2026 21:43:01 +0200 Subject: [PATCH] [NDK][XDK][SYSUTILS:PS] Update the KWAIT_REASON enumeration Validated with the System Informer phnt headers[^1]. Versioning added for Windows 8+ values, from Vergilius[^2]. [^1]: phnt headers and documentation from: https://ntdoc.m417z.com/kwait_reason https://github.com/winsiderss/systeminformer/blob/5311c5ff7ebe0a900a792730395faf147d4451b9/phnt/include/ntkeapi.h#L49 [^2]: https://www.vergiliusproject.com --- .../applications/sysutils/utils/ps/ps.c | 81 ++++++++++--------- sdk/include/ndk/ketypes.h | 29 +++++-- sdk/include/xdk/ketypes.h | 16 ++++ 3 files changed, 85 insertions(+), 41 deletions(-) diff --git a/modules/rosapps/applications/sysutils/utils/ps/ps.c b/modules/rosapps/applications/sysutils/utils/ps/ps.c index d356969822a..b49c4dbbcad 100644 --- a/modules/rosapps/applications/sysutils/utils/ps/ps.c +++ b/modules/rosapps/applications/sysutils/utils/ps/ps.c @@ -113,42 +113,51 @@ struct waitres { DWORD state; char desc[17]; } waitreason[35 + 1] = { - {0, "Executive "}, - {1, "FreePage "}, - {2, "PageIn "}, - {3, "PoolAllocation "}, - {4, "DelayExecution "}, - {5, "Suspended "}, - {6, "UserRequest "}, - {7, "WrExecutive "}, - {8, "WrFreePage "}, - {9, "WrPageIn "}, - {10,"WrPoolAllocation "}, - {11,"WrDelayExecution "}, - {12,"WrSuspended "}, - {13,"WrUserRequest "}, - {14,"WrEventPair "}, - {15,"WrQueue "}, - {16,"WrLpcReceive "}, - {17,"WrLpcReply "}, - {18,"WrVirtualMemory "}, - {19,"WrPageOut "}, - {20,"WrRendezvous "}, - {21,"Spare2 "}, - {22,"WrGuardedMutex "}, - {23,"Spare4 "}, - {24,"Spare5 "}, - {25,"Spare6 "}, - {26,"WrKernel "}, - {27,"WrResource "}, - {28,"WrPushLock "}, - {29,"WrMutex "}, - {30,"WrQuantumEnd "}, - {31,"WrDispatchInt "}, - {32,"WrPreempted "}, - {33,"WrYieldExecution "}, - {34,"MaximumWaitReason"}, - {-1," ? "} + {0, "Executive "}, + {1, "FreePage "}, + {2, "PageIn "}, + {3, "PoolAllocation "}, + {4, "DelayExecution "}, + {5, "Suspended "}, + {6, "UserRequest "}, + {7, "WrExecutive "}, + {8, "WrFreePage "}, + {9, "WrPageIn "}, + {10,"WrPoolAllocation "}, + {11,"WrDelayExecution "}, + {12,"WrSuspended "}, + {13,"WrUserRequest "}, + {14,"WrEventPair "}, + {15,"WrQueue "}, + {16,"WrLpcReceive "}, + {17,"WrLpcReply "}, + {18,"WrVirtualMemory "}, + {19,"WrPageOut "}, + {20,"WrRendezvous "}, + {21,"WrKeyedEvent "}, + {22,"WrTerminated "}, + {23,"WrProcessInSwap "}, + {24,"WrCpuRateControl "}, + {25,"WrCalloutStack "}, + {26,"WrKernel "}, + {27,"WrResource "}, + {28,"WrPushLock "}, + {29,"WrMutex "}, + {30,"WrQuantumEnd "}, + {31,"WrDispatchInt "}, + {32,"WrPreempted "}, + {33,"WrYieldExecution "}, + {34,"WrFastMutex "}, + {35,"WrGuardedMutex "}, + {36,"WrRundown "}, + {37,"WrAlertByThreadId"}, + {38,"WrDeferredPreempt"}, + {39,"WrPhysicalFault "}, + {40,"WrIoRing "}, + {41,"WrMdlCache "}, + {42,"WrRcu "}, + {43,"MaximumWaitReason"}, + {-1," ? "} }; static BOOL CALLBACK diff --git a/sdk/include/ndk/ketypes.h b/sdk/include/ndk/ketypes.h index 0a686cf6053..ad2312d4b25 100644 --- a/sdk/include/ndk/ketypes.h +++ b/sdk/include/ndk/ketypes.h @@ -303,11 +303,11 @@ typedef enum _KWAIT_REASON WrVirtualMemory, WrPageOut, WrRendezvous, - Spare2, - WrGuardedMutex, - Spare4, - Spare5, - Spare6, + WrKeyedEvent, + WrTerminated, + WrProcessInSwap, + WrCpuRateControl, + WrCalloutStack, WrKernel, WrResource, WrPushLock, @@ -316,6 +316,25 @@ typedef enum _KWAIT_REASON WrDispatchInt, WrPreempted, WrYieldExecution, + WrFastMutex, + WrGuardedMutex, + WrRundown, +#if (NTDDI_VERSION >= NTDDI_WIN8) + WrAlertByThreadId, + WrDeferredPreempt, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN10_RS3) + WrPhysicalFault, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11) + WrIoRing, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11_NI) + WrMdlCache, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11_GE) + WrRcu, +#endif MaximumWaitReason } KWAIT_REASON; diff --git a/sdk/include/xdk/ketypes.h b/sdk/include/xdk/ketypes.h index ea38cd8315b..7e4d9fe5537 100644 --- a/sdk/include/xdk/ketypes.h +++ b/sdk/include/xdk/ketypes.h @@ -501,6 +501,22 @@ typedef enum _KWAIT_REASON { WrFastMutex, WrGuardedMutex, WrRundown, +#if (NTDDI_VERSION >= NTDDI_WIN8) + WrAlertByThreadId, + WrDeferredPreempt, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN10_RS3) + WrPhysicalFault, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11) + WrIoRing, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11_NI) + WrMdlCache, +#endif +#if (NTDDI_VERSION >= NTDDI_WIN11_GE) + WrRcu, +#endif MaximumWaitReason } KWAIT_REASON;