Add KeDelayExecutionThread mock - #323
Draft
mikeagun wants to merge 1 commit into
Draft
Conversation
Add a user-mode mock for KeDelayExecutionThread, the WDM primitive a kernel thread uses to delay its own execution for a relative or absolute interval. This API was not previously provided by usersim. - inc/usersim/ke.h: declare KeDelayExecutionThread with SAL matching the WDK wdm.h contract (_IRQL_requires_min_(PASSIVE_LEVEL), _IRQL_requires_max_(APC_LEVEL)). - src/ke.cpp: mock implementation. A negative Interval is a delay relative to the current time, converted from 100-ns units to milliseconds (rounded up) and passed to Sleep; a non-negative (absolute) Interval is not tracked by the mock and is treated as no delay. Returns STATUS_SUCCESS (non-alertable waits only; STATUS_ALERTED/STATUS_USER_APC are not modeled). - tests/ke_test.cpp: add a test verifying a relative interval blocks for at least the requested duration and a zero interval returns immediately. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: 3e1f4d8c-9f26-40cc-ae7d-089fa6c8f959
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Adds a user-mode mock for
KeDelayExecutionThread, the WDM primitive a kernel thread uses to delay its own execution for a relative or absolute interval. This API was not previously provided by usersim.Changes
inc/usersim/ke.h— declaresKeDelayExecutionThreadwith SAL matching the WDKwdm.hcontract (_IRQL_requires_min_(PASSIVE_LEVEL),_IRQL_requires_max_(APC_LEVEL)).src/ke.cpp— mock implementation. A negativeIntervalis a delay relative to the current time and is converted from 100-ns units to milliseconds (rounded up) and passed toSleep; a non-negative (absolute)Intervalis not tracked by the mock and is treated as no delay. ReturnsSTATUS_SUCCESS(non-alertable waits only;STATUS_ALERTED/STATUS_USER_APCare not modeled).tests/ke_test.cpp— adds aKeDelayExecutionThreadtest verifying that a relative interval blocks for at least the requested duration (conservative lower bound to avoid timer-granularity flakiness) and that a zero interval returns immediately.Testing
usersimunit tests ([ke]tag) green, Debug + Release x64.