Примечание.
Для доступа к этой странице требуется авторизация. Вы можете попробовать войти или изменить каталоги.
Для доступа к этой странице требуется авторизация. Вы можете попробовать изменить каталоги.
The SetModeMemory function fills a memory region with a specified byte value, based on the specified processor mode.
Syntax
VOID SetModeMemory(
volatile VOID *Destination,
UCHAR Fill,
SIZE_T Length,
KPROCESSOR_MODE Mode
);
Parameters
Destination
[out] Указатель на начальный адрес блока памяти для заполнения.
Fill
[in] The byte value used to fill the first Length bytes of Destination.
Length
[in] The number of bytes to fill with the Fill value.
Mode
[in] Режим процессора, определяющий, как выполняется доступ к памяти. Mode can be one of the following values.
| Value | Meaning |
|---|---|
| KernelMode | Destination points to kernel-mode memory. The function performs a direct memory fill operation with memory_order_relaxed semantics. Дополнительные сведения см. в примечаниях. |
| UserMode | Destination points to user-mode memory. The function raises an exception if Destination doesn't point to user-mode memory; otherwise it performs a fill operation at the specified address with memory_order_relaxed semantics. Дополнительные сведения см. в примечаниях. |
Return value
None
Remarks
Эта функция обеспечивает безопасный способ заполнения области памяти указанным значением байтов с механизмом заполнения, определенным заданным режимом процессора.
Функция имеет следующие свойства:
When Mode is KernelMode, the function performs a direct memory fill without additional safety checks.
When Mode is UserMode, the function validates the pointer is a user-mode address and then performs the fill. The memory access is performed with memory_order_relaxed semantics.
Эта функция не распознается как компилятор instrinsic, поэтому компилятор никогда не оптимизирует вызов (полностью или замените вызов эквивалентной последовательностью инструкций).
When the call returns, the first Length bytes of the buffer have been overwritten with the specified Fill value. This function's memory accesses to the Destination will only be performed within the function (for example, the compiler can't move memory accesses out of this function).
Функция может выполнять неуправляемый доступ к памяти, если платформа позволяет ей.
Функция может получить доступ к расположениям памяти более одного раза в рамках операции заполнения.
Функция вызывает структурированное исключение, если операция заполнения завершается ошибкой, например если целевой адрес недопустим для указанного режима или недоступен.
Эта функция работает во всех версиях Windows, а не только на последних версиях. You need to consume the latest WDK to get the function declaration from the usermode_accessors.h header. You also need the library (umaccess.lib) from the latest WDK. Однако результирующий драйвер будет работать в более ранних версиях Windows.
Requirements
| Requirement | Value |
|---|---|
| Минимальный поддерживаемый клиент | See Remarks |
| Header | usermode_accessors.h |
| Library | umaccess.lib |
| IRQL | Меньше или равно APC_LEVEL |