Add usermode_accessors.h sample driver (AB#61473417)#1357
Add usermode_accessors.h sample driver (AB#61473417)#1357limitedge wants to merge 61 commits intomicrosoft:developfrom
Conversation
Create Sample Issue template
Sample based issue template
import requests module
Correct regex expression
Made the query more efficient
Selected path bug fix
Fix selected path bug
Sort the area in the issue template
Correct codeowner path
Correct sample issue path
Order sample issue
PR to test changes from original branch. No harm done since this is done to my users branch
New issues template based on sample.
…seIssues adding workflow to bulk cleanup stale issues older than 1 year
Increase operations-per-run to 400 and the stale threshold
use PAT_TOKEN and add dry-run for testing purpose.
reversing the PAT_TOKEN and dry-run change
…Workflow disable schedule and deleted the closing issue part
removed the space after newline which seems to be a bug in c++ 23
…pdateScript update Script to be compatible with vs2026
New SDCAVAD sample
Added 'if: false' to the job to prevent it from running while preserving the code. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…ble-tag-owners Disable tag-codeowner-on-issue workflow
…test-infra-changes Making INF verifier and option to the build all samples PS script
… direct interpolation Co-authored-by: 5an7y-Microsoft <219205893+5an7y-Microsoft@users.noreply.github.com>
…ity-in-workflow Fix RCE in tag-codeowner-on-issue workflow via environment variables
Fix RCE vulnerability in workflow using environment variables
New KMDF sample demonstrating safe user-mode memory access using the usermode_accessors.h DDI family. DDIs covered: CopyFromUser, CopyToUser, ReadULongFromUser, WriteULongToUser, FillUserMemory, InterlockedAndToUser, StringLengthFromUser, ReadStructFromUser, WriteStructToUser, UmaExceptionFilter, and 20+ additional typed accessors. Fixes DDI coverage gaps for usermode_accessors.h header. AB#61473417
| DECLARE_CONST_UNICODE_STRING(circuitUri, EXT_CAPTURE_CIRCUIT_URI); | ||
|
|
||
| #pragma prefast(suppress:__WARNING_ALIASED_MEMORY_LEAK, "memory is freed by scope_exit") | ||
| PSDCAXU_ACX_CIRCUIT_CONFIG exCircuitConfig = (PSDCAXU_ACX_CIRCUIT_CONFIG)ExAllocatePool2( |
Check warning
Code scanning / CodeQL
Possible information leakage from uninitialized padding bytes. Warning
| DECLARE_CONST_UNICODE_STRING(circuitUri, EXT_RENDER_CIRCUIT_URI); | ||
|
|
||
| #pragma prefast(suppress:__WARNING_ALIASED_MEMORY_LEAK, "memory is freed by scope_exit") | ||
| PSDCAXU_ACX_CIRCUIT_CONFIG exCircuitConfig = (PSDCAXU_ACX_CIRCUIT_CONFIG)ExAllocatePool2( |
Check warning
Code scanning / CodeQL
Possible information leakage from uninitialized padding bytes. Warning
| RETURN_NTSTATUS_IF_TRUE(pinConnection != nullptr, status); | ||
|
|
||
| pinConnectionSize = (ULONG)info; | ||
| pinConnection = (PKSPIN_PHYSICALCONNECTION)ExAllocatePool2(POOL_FLAG_NON_PAGED, pinConnectionSize, DRIVER_TAG); |
Check warning
Code scanning / CodeQL
Possible information leakage from uninitialized padding bytes. Warning
| m_PartialFrameBytes = m_FrameSize - (DWORD)length; | ||
|
|
||
| Done: | ||
| KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
| m_PartialFrameBytes = m_FrameSize - (DWORD)length; | ||
|
|
||
| Done: | ||
| KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
| // | ||
| // Restore floating state. | ||
| // | ||
| KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
| // | ||
| // Restore floating state. | ||
| // | ||
| KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
| ntStatus = ReadHeaderAndFillBuffer(); | ||
|
|
||
| Done: | ||
| (void)KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
| ntStatus = ReadHeaderAndFillBuffer(); | ||
|
|
||
| Done: | ||
| (void)KeRestoreFloatingPointState(&saveData); |
Check warning
Code scanning / CodeQL
Irql Float State Mismatch Warning
Summary
Add a new KMDF sample driver demonstrating safe user-mode memory access using the
usermode_accessors.hDDI family.New Sample
Path:
general/usermode-accessors-sample/DDIs Covered
This sample exercises 30+ DDI functions from
usermode_accessors.h, including:CopyFromUser,CopyToUser,CopyFromMode,CopyToModeReadUCharFromUser,ReadUShortFromUser,ReadULongFromUser,ReadULong64FromUser,ReadBooleanFromUserWriteUCharToUser,WriteUShortToUser,WriteULongToUser,WriteULong64ToUser,WriteBooleanToUserReleaseReadULongFromMode,WriteULongToModeReadStructFromUser,WriteStructToUserFillUserMemoryInterlockedAndToUser,InterlockedOrToUser,InterlockedCompareExchangeToUserStringLengthFromUser,WideStringLengthFromUserUmaExceptionFilterADO Work Item