ReactOS  0.4.15-dev-1638-gc0caa5c
wdfmemory.h File Reference
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _WDFMEMORY_OFFSET
 
struct  _WDF_MEMORY_DESCRIPTOR
 

Macros

#define WDF_EXTERN_C
 
#define WDF_EXTERN_C_START
 
#define WDF_EXTERN_C_END
 

Typedefs

typedef WDF_EXTERN_C_START enum _WDF_MEMORY_DESCRIPTOR_TYPE WDF_MEMORY_DESCRIPTOR_TYPE
 
typedef struct _WDFMEMORY_OFFSET WDFMEMORY_OFFSET
 
typedef struct _WDFMEMORY_OFFSETPWDFMEMORY_OFFSET
 
typedef struct _WDF_MEMORY_DESCRIPTOR WDF_MEMORY_DESCRIPTOR
 
typedef struct _WDF_MEMORY_DESCRIPTORPWDF_MEMORY_DESCRIPTOR
 
typedef _Must_inspect_result_ _When_(PoolType==1||PoolType==257, _IRQL_requires_max_(APC_LEVEL)) _When_(PoolType == 0 || PoolType == 256
 
typedef _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL)) WDFAPI NTSTATUS(STDCALL *PFN_WDFMEMORYCREATE) (_In_ PWDF_DRIVER_GLOBALS DriverGlobals
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE PoolType
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY _Outptr_opt_result_bytebuffer_(BufferSize) PVOID *Buffer)
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
 
typedef _In_ WDFMEMORY _Out_opt_ size_tBufferSize
 
typedef _Must_inspect_result_ _In_ WDFMEMORY _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer
 
typedef _Must_inspect_result_ _In_ WDFMEMORY SourceMemory
 
typedef _Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
 
typedef _Must_inspect_result_ _In_ WDFMEMORY _In_ size_t _Out_writes_bytes_(NumBytesToCopyTo) PVOID Buffer
 
typedef _Must_inspect_result_ _In_ WDFMEMORY DestinationMemory
 
typedef _Must_inspect_result_ _In_ WDFMEMORY _In_ size_t DestinationOffset
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES LookasideAttributes
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
 
typedef _Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
 

Enumerations

enum  _WDF_MEMORY_DESCRIPTOR_TYPE { WdfMemoryDescriptorTypeInvalid = 0, WdfMemoryDescriptorTypeBuffer, WdfMemoryDescriptorTypeMdl, WdfMemoryDescriptorTypeHandle }
 

Functions

FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_BUFFER (_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PVOID Buffer, _In_ ULONG BufferLength)
 
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_HANDLE (_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ WDFMEMORY Memory, _In_opt_ PWDFMEMORY_OFFSET Offsets)
 
FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_MDL (_Out_ PWDF_MEMORY_DESCRIPTOR Descriptor, _In_ PMDL Mdl, _In_ ULONG BufferLength)
 
_Must_inspect_result_ _When_ (PoolType==1||PoolType==257, _IRQL_requires_max_(APC_LEVEL)) _When_(PoolType
 
_Must_inspect_result_ _IRQL_requires_max_ (DISPATCH_LEVEL)) FORCEINLINE NTSTATUS WdfMemoryCreate(_In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
 
_Must_inspect_result_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _When_ (BufferSize==0, __drv_reportError(BufferSize cannot be zero)) size_t BufferSize
 
_Must_inspect_result_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY _Outptr_opt_result_bytebuffer_ (BufferSize) PVOID *Buffer)
 
_Must_inspect_result_ _Pre_notnull_ _Pre_writable_byte_size_ (BufferSize) PVOID Buffer
 
_Must_inspect_result_ _In_ size_t _Out_writes_bytes_ (NumBytesToCopyTo) PVOID Buffer
 
_Must_inspect_result_ _In_ size_t _In_ _When_ (NumBytesToCopyTo==0, __drv_reportError(NumBytesToCopyTo cannot be zero)) size_t NumBytesToCopyTo)
 
_Must_inspect_result_ _In_ size_t _In_ PVOID _In_ _When_ (NumBytesToCopyFrom==0, __drv_reportError(NumBytesToCopyFrom cannot be zero)) size_t NumBytesToCopyFrom)
 

Macro Definition Documentation

◆ WDF_EXTERN_C

#define WDF_EXTERN_C

Definition at line 40 of file wdfmemory.h.

◆ WDF_EXTERN_C_END

#define WDF_EXTERN_C_END

Definition at line 42 of file wdfmemory.h.

◆ WDF_EXTERN_C_START

#define WDF_EXTERN_C_START

Definition at line 41 of file wdfmemory.h.

Typedef Documentation

◆ _IRQL_requires_max_

typedef _Must_inspect_result_ _IRQL_requires_max_(DISPATCH_LEVEL) WDFAPI NTSTATUS(STDCALL *PFN_WDFMEMORYCREATEFROMLOOKASIDE)(_In_ PWDF_DRIVER_GLOBALS DriverGlobals

Definition at line 152 of file wdfmemory.h.

◆ _Out_writes_bytes_

typedef _Must_inspect_result_ _In_ WDFMEMORY _In_ size_t _Out_writes_bytes_(NumBytesToCopyTo) PVOID Buffer

Definition at line 321 of file wdfmemory.h.

◆ _Outptr_opt_result_bytebuffer_

typedef _Must_inspect_result_ _In_ WDFUSBDEVICE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ ULONG _Out_ WDFMEMORY _Outptr_opt_result_bytebuffer_(GET_ISO_URB_SIZE(NumberOfIsochPackets)) PURB *Urb)

Definition at line 170 of file wdfmemory.h.

◆ _Pre_writable_byte_size_

typedef _Must_inspect_result_ _In_ WDFMEMORY _Pre_notnull_ _Pre_writable_byte_size_(BufferSize) PVOID Buffer

Definition at line 282 of file wdfmemory.h.

◆ _When_

◆ Attributes

◆ Buffer

◆ BufferSize

Initial value:
{
#define WdfFunctions
Definition: wdf.h:66
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Definition at line 251 of file wdfmemory.h.

◆ DestinationMemory

Definition at line 359 of file wdfmemory.h.

◆ DestinationOffset

◆ Lookaside

Initial value:
{
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_opt_ ULONG _Out_ WDFLOOKASIDE * Lookaside
Definition: wdfmemory.h:407
#define WdfFunctions
Definition: wdf.h:66
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ PWDF_OBJECT_ATTRIBUTES MemoryAttributes
Definition: wdfmemory.h:407
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES LookasideAttributes
Definition: wdfmemory.h:401
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Definition at line 407 of file wdfmemory.h.

◆ LookasideAttributes

◆ Memory

_Must_inspect_result_ _In_ WDFUSBDEVICE _In_ WDFREQUEST _In_ WDFMEMORY Memory
Initial value:
{
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define WdfFunctions
Definition: wdf.h:66
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: wdfmemory.h:159
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

Definition at line 169 of file wdfmemory.h.

◆ MemoryAttributes

◆ PoolTag

◆ PoolType

◆ PWDF_MEMORY_DESCRIPTOR

◆ PWDFMEMORY_OFFSET

◆ SourceMemory

Definition at line 318 of file wdfmemory.h.

◆ SourceOffset

◆ WDF_MEMORY_DESCRIPTOR

◆ WDF_MEMORY_DESCRIPTOR_TYPE

◆ WDFMEMORY_OFFSET

Enumeration Type Documentation

◆ _WDF_MEMORY_DESCRIPTOR_TYPE

Enumerator
WdfMemoryDescriptorTypeInvalid 
WdfMemoryDescriptorTypeBuffer 
WdfMemoryDescriptorTypeMdl 
WdfMemoryDescriptorTypeHandle 

Definition at line 52 of file wdfmemory.h.

Function Documentation

◆ _IRQL_requires_max_()

_Must_inspect_result_ _IRQL_requires_max_ ( DISPATCH_LEVEL  )

Definition at line 3557 of file common.c.

3587 {
3588  NTSTATUS status;
3589  BOOLEAN requestSent = FALSE;
3590 
3591  BOOLEAN shouldRetry = TRUE;
3592  PCDB cdb = (PCDB)DeviceExtension->PowerContext.Srb.Cdb;
3593  ULONG timeoutValue = DeviceExtension->TimeOutValue;
3594  ULONG retryCount = 1;
3595 
3596  // reset some fields.
3597  DeviceExtension->PowerContext.RetryIntervalIn100ns = 0;
3598  status = PowerContextReuseRequest(DeviceExtension);
3599  RequestClearSendTime(DeviceExtension->PowerContext.PowerRequest);
3600 
3601  if (!NT_SUCCESS(status))
3602  {
3603  return status;
3604  }
3605 
3606  // set proper timeout value and max retry count.
3607  switch(DeviceExtension->PowerContext.PowerChangeState.PowerDown)
3608  {
3612  break;
3613 
3614  case PowerDownDeviceLocked:
3615  // Case of issuing SYNC CACHE command. Do not use power irp timeout remaining time in this case
3616  // as we want to give best try on SYNC CACHE command.
3617  retryCount = MAXIMUM_RETRIES;
3618  timeoutValue = DeviceExtension->TimeOutValue;
3619  break;
3620 
3622  {
3623  // Case of issuing STOP UNIT command
3624  // As "Imme" bit is set to '1', this command should be completed in short time.
3625  // This command is at low importance, failure of this command has very small impact.
3626  ULONG secondsRemaining = 0;
3627 
3628 #if (WINVER >= 0x0601)
3629  // this API is introduced in Windows7
3630  PoQueryWatchdogTime(DeviceExtension->LowerPdo, &secondsRemaining);
3631 #endif
3632 
3633  if (secondsRemaining == 0)
3634  {
3635  // not able to retrieve remaining time from PoQueryWatchdogTime API, use default values.
3636  retryCount = MAXIMUM_RETRIES;
3637  timeoutValue = SCSI_CDROM_TIMEOUT;
3638  }
3639  else
3640  {
3641  // plan to leave about 30 seconds to lower level drivers if possible.
3642  if (secondsRemaining >= 32)
3643  {
3644  retryCount = (secondsRemaining - 30)/SCSI_CDROM_TIMEOUT + 1;
3645  timeoutValue = SCSI_CDROM_TIMEOUT;
3646 
3647  if (retryCount > MAXIMUM_RETRIES)
3648  {
3649  retryCount = MAXIMUM_RETRIES;
3650  }
3651 
3652  if (retryCount == 1)
3653  {
3654  timeoutValue = secondsRemaining - 30;
3655  }
3656  }
3657  else
3658  {
3659  // issue the command with minimal timeout value and do not retry on it.
3660  retryCount = 1;
3661  timeoutValue = 2;
3662  }
3663  }
3664  }
3665  break;
3666  default:
3667  NT_ASSERT( FALSE );
3669  return status;
3670  }
3671 
3672  DeviceExtension->PowerContext.RetryCount = retryCount;
3673 
3674  // issue command.
3675  while (shouldRetry)
3676  {
3677 
3678  // set SRB fields.
3679  DeviceExtension->PowerContext.Srb.SrbFlags = SRB_FLAGS_NO_DATA_TRANSFER |
3684 
3685  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_EXECUTE_SCSI;
3686  DeviceExtension->PowerContext.Srb.TimeOutValue = timeoutValue;
3687 
3688  if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceInitial)
3689  {
3690  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_LOCK_QUEUE;
3691  }
3692  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceLocked)
3693  {
3694  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_QUIESCE_DEVICE;
3695  }
3696  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced)
3697  {
3698  // Case of issuing SYNC CACHE command.
3699  DeviceExtension->PowerContext.Srb.CdbLength = 10;
3700  cdb->SYNCHRONIZE_CACHE10.OperationCode = SCSIOP_SYNCHRONIZE_CACHE;
3701  }
3702  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceFlushed)
3703  {
3704  // Case of issuing STOP UNIT command.
3705  DeviceExtension->PowerContext.Srb.CdbLength = 6;
3706  cdb->START_STOP.OperationCode = SCSIOP_START_STOP_UNIT;
3707  cdb->START_STOP.Start = 0;
3708  cdb->START_STOP.Immediate = 1;
3709  }
3710  else if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceStopped)
3711  {
3712  DeviceExtension->PowerContext.Srb.Function = SRB_FUNCTION_UNLOCK_QUEUE;
3713  }
3714 
3715  // Set up completion routine and context if requested
3716  if (CompletionRoutine)
3717  {
3718  WdfRequestSetCompletionRoutine(DeviceExtension->PowerContext.PowerRequest,
3720  Context);
3721  }
3722 
3723  status = RequestSend(DeviceExtension,
3724  DeviceExtension->PowerContext.PowerRequest,
3725  DeviceExtension->IoTarget,
3727  &requestSent);
3728 
3729  if (requestSent)
3730  {
3731  if ((CompletionRoutine == NULL) &&
3732  (SRB_STATUS(DeviceExtension->PowerContext.Srb.SrbStatus) != SRB_STATUS_SUCCESS))
3733  {
3734  TracePrint((TRACE_LEVEL_ERROR,
3735  TRACE_FLAG_POWER,
3736  "%p\tError occured when issuing %s command to device. Srb %p, Status %x\n",
3737  DeviceExtension->PowerContext.PowerRequest,
3738  (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced) ? "SYNC CACHE" : "STOP UNIT",
3739  &DeviceExtension->PowerContext.Srb,
3740  DeviceExtension->PowerContext.Srb.SrbStatus));
3741 
3742  NT_ASSERT(!(TEST_FLAG(DeviceExtension->PowerContext.Srb.SrbStatus, SRB_STATUS_QUEUE_FROZEN)));
3743 
3744  shouldRetry = RequestSenseInfoInterpret(DeviceExtension,
3745  DeviceExtension->PowerContext.PowerRequest,
3746  &(DeviceExtension->PowerContext.Srb),
3747  retryCount - DeviceExtension->PowerContext.RetryCount,
3748  &status,
3749  &(DeviceExtension->PowerContext.RetryIntervalIn100ns));
3750 
3751  if (shouldRetry && (DeviceExtension->PowerContext.RetryCount-- == 0))
3752  {
3753  shouldRetry = FALSE;
3754  }
3755  }
3756  else
3757  {
3758  // succeeded, do not need to retry.
3759  shouldRetry = FALSE;
3760  }
3761 
3762  }
3763  else
3764  {
3765  // request failed to be sent
3766  shouldRetry = FALSE;
3767  }
3768 
3769  if (shouldRetry)
3770  {
3771  LARGE_INTEGER t;
3772  t.QuadPart = -DeviceExtension->PowerContext.RetryIntervalIn100ns;
3774 
3775  status = PowerContextReuseRequest(DeviceExtension);
3776  if (!NT_SUCCESS(status))
3777  {
3778  shouldRetry = FALSE;
3779  }
3780  }
3781  }
3782 
3783  if (DeviceExtension->PowerContext.PowerChangeState.PowerDown == PowerDownDeviceQuiesced)
3784  {
3785  // record SYNC CACHE command completion time stamp.
3786  KeQueryTickCount(&DeviceExtension->PowerContext.Step1CompleteTime);
3787  }
3788 
3789  return status;
3790 }
#define SRB_FUNCTION_UNLOCK_QUEUE
Definition: srb.h:325
#define SCSIOP_SYNCHRONIZE_CACHE
Definition: cdrw_hw.h:918
#define SRB_FUNCTION_QUIESCE_DEVICE
Definition: srb.h:90
#define SRB_FLAGS_NO_QUEUE_FREEZE
Definition: srb.h:396
#define TRUE
Definition: types.h:120
Definition: cdrw_hw.h:28
LONG NTSTATUS
Definition: precomp.h:26
struct _CDB::_SYNCHRONIZE_CACHE10 SYNCHRONIZE_CACHE10
GLdouble GLdouble t
Definition: gl.h:2047
#define SRB_STATUS(Status)
Definition: srb.h:381
VOID RequestClearSendTime(_In_ WDFREQUEST Request)
Definition: common.c:111
#define MAXIMUM_RETRIES
Definition: cdrom.h:124
return STATUS_NOT_IMPLEMENTED
#define SCSI_CDROM_TIMEOUT
Definition: cdrom.c:170
#define FALSE
Definition: types.h:117
NTSTATUS NTAPI KeDelayExecutionThread(IN KPROCESSOR_MODE WaitMode, IN BOOLEAN Alertable, IN PLARGE_INTEGER Interval OPTIONAL)
Definition: wait.c:283
#define SRB_FLAGS_BYPASS_LOCKED_QUEUE
Definition: srb.h:402
unsigned char BOOLEAN
union _CDB * PCDB
struct _CDB::_START_STOP START_STOP
VOID NTAPI KeQueryTickCount(IN PLARGE_INTEGER TickCount)
Definition: clock.c:165
#define TEST_FLAG(Flags, Bit)
Definition: cdrom.h:1495
#define NT_SUCCESS(StatCode)
Definition: apphelp.c:32
#define SRB_FLAGS_DISABLE_SYNCH_TRANSFER
Definition: srb.h:389
#define SRB_FLAGS_NO_DATA_TRANSFER
Definition: srb.h:394
BOOLEAN RequestSenseInfoInterpret(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ PSCSI_REQUEST_BLOCK Srb, _In_ ULONG RetriedCount, _Out_ NTSTATUS *Status, _Out_opt_ _Deref_out_range_(0, MAXIMUM_RETRY_FOR_SINGLE_IO_IN_100NS_UNITS) LONGLONG *RetryIntervalIn100ns)
Definition: sense.c:2467
#define SRB_STATUS_QUEUE_FROZEN
Definition: srb.h:378
NTSTATUS RequestSend(_In_ PCDROM_DEVICE_EXTENSION DeviceExtension, _In_ WDFREQUEST Request, _In_ WDFIOTARGET IoTarget, _In_ ULONG Flags, _Out_opt_ PBOOLEAN RequestSent)
Definition: common.c:3793
#define TRACE_LEVEL_ERROR
Definition: storswtr.h:27
_In_ WDFREQUEST _In_opt_ PFN_WDF_REQUEST_COMPLETION_ROUTINE CompletionRoutine
Definition: wdfrequest.h:893
#define NULL
Definition: types.h:112
#define SRB_FUNCTION_EXECUTE_SCSI
Definition: srb.h:307
unsigned int ULONG
Definition: retypes.h:1
#define SRB_STATUS_SUCCESS
Definition: srb.h:333
#define SRB_FLAGS_D3_PROCESSING
Definition: srb.h:156
static SERVICE_STATUS status
Definition: service.c:31
#define SCSIOP_START_STOP_UNIT
Definition: cdrw_hw.h:897
#define SRB_FUNCTION_LOCK_QUEUE
Definition: srb.h:324
#define NT_ASSERT
Definition: rtlfuncs.h:3312
Definition: ps.c:97

◆ _Out_writes_bytes_()

_Must_inspect_result_ _In_ size_t _Out_writes_bytes_ ( NumBytesToCopyTo  )

◆ _Outptr_opt_result_bytebuffer_()

_Must_inspect_result_ _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY _Outptr_opt_result_bytebuffer_ ( BufferSize  )

Definition at line 192 of file wdfmemory.h.

195 {
197 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define WdfFunctions
Definition: wdf.h:66
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG PoolTag
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE PoolType
Definition: wdfmemory.h:159
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES Attributes
Definition: wdfmemory.h:159
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

◆ _Pre_writable_byte_size_()

_Must_inspect_result_ _Pre_notnull_ _Pre_writable_byte_size_ ( BufferSize  )

◆ _When_() [1/4]

_Must_inspect_result_ _When_ ( PoolType  = = 1 || PoolType == 257,
_IRQL_requires_max_(APC_LEVEL  
)

◆ _When_() [2/4]

Definition at line 299 of file wdfmemory.h.

302 {
303  return ((PFN_WDFMEMORYASSIGNBUFFER) WdfFunctions[WdfMemoryAssignBufferTableIndex])(WdfDriverGlobals, Memory, Buffer, BufferSize);
304 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define WdfFunctions
Definition: wdf.h:66
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_In_ WDFMEMORY _Out_opt_ size_t * BufferSize
Definition: wdfmemory.h:251

◆ _When_() [3/4]

_Must_inspect_result_ _In_ size_t _In_ _When_ ( NumBytesToCopyTo  = = 0,
__drv_reportError(NumBytesToCopyTo cannot be zero  
)

Definition at line 340 of file wdfmemory.h.

343 {
344  return ((PFN_WDFMEMORYCOPYTOBUFFER) WdfFunctions[WdfMemoryCopyToBufferTableIndex])(WdfDriverGlobals, SourceMemory, SourceOffset, Buffer, NumBytesToCopyTo);
345 }
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t SourceOffset
Definition: wdfmemory.h:318
_Must_inspect_result_ _In_ WDFMEMORY SourceMemory
Definition: wdfmemory.h:318
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define WdfFunctions
Definition: wdf.h:66
PWDF_DRIVER_GLOBALS WdfDriverGlobals

◆ _When_() [4/4]

_Must_inspect_result_ _In_ size_t _In_ PVOID _In_ _When_ ( NumBytesToCopyFrom  = = 0,
__drv_reportError(NumBytesToCopyFrom cannot be zero  
)

Definition at line 381 of file wdfmemory.h.

384 {
385  return ((PFN_WDFMEMORYCOPYFROMBUFFER) WdfFunctions[WdfMemoryCopyFromBufferTableIndex])(WdfDriverGlobals, DestinationMemory, DestinationOffset, Buffer, NumBytesToCopyFrom);
386 }
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define WdfFunctions
Definition: wdf.h:66
PWDF_DRIVER_GLOBALS WdfDriverGlobals
_Must_inspect_result_ _In_ WDFMEMORY _In_ size_t DestinationOffset
Definition: wdfmemory.h:359
_Must_inspect_result_ _In_ WDFMEMORY DestinationMemory
Definition: wdfmemory.h:359

◆ WDF_MEMORY_DESCRIPTOR_INIT_BUFFER()

FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_BUFFER ( _Out_ PWDF_MEMORY_DESCRIPTOR  Descriptor,
_In_ PVOID  Buffer,
_In_ ULONG  BufferLength 
)

Definition at line 102 of file wdfmemory.h.

107 {
109 
111  Descriptor->u.BufferType.Buffer = Buffer;
112  Descriptor->u.BufferType.Length = BufferLength;
113 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ __drv_aliasesMem PVOID Buffer
Definition: wdfmemory.h:211
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

Referenced by _IRQL_requires_max_().

◆ WDF_MEMORY_DESCRIPTOR_INIT_HANDLE()

FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_HANDLE ( _Out_ PWDF_MEMORY_DESCRIPTOR  Descriptor,
_In_ WDFMEMORY  Memory,
_In_opt_ PWDFMEMORY_OFFSET  Offsets 
)

Definition at line 117 of file wdfmemory.h.

122 {
124 
126  Descriptor->u.HandleType.Memory = Memory;
127  Descriptor->u.HandleType.Offsets = Offsets;
128 }
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
_Must_inspect_result_ _In_opt_ PWDF_OBJECT_ATTRIBUTES _In_ _Strict_type_match_ POOL_TYPE _In_opt_ ULONG _In_ _Out_ WDFMEMORY * Memory
Definition: wdfmemory.h:169
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262

◆ WDF_MEMORY_DESCRIPTOR_INIT_MDL()

FORCEINLINE VOID WDF_MEMORY_DESCRIPTOR_INIT_MDL ( _Out_ PWDF_MEMORY_DESCRIPTOR  Descriptor,
_In_ PMDL  Mdl,
_In_ ULONG  BufferLength 
)

Definition at line 133 of file wdfmemory.h.

138 {
140 
142  Descriptor->u.MdlType.Mdl = Mdl;
143  Descriptor->u.MdlType.BufferLength = BufferLength;
144 }
_Must_inspect_result_ _In_ WDFDEVICE _In_ DEVICE_REGISTRY_PROPERTY _In_ ULONG BufferLength
Definition: wdfdevice.h:3767
_Must_inspect_result_ _In_ WDFIORESLIST _In_ PIO_RESOURCE_DESCRIPTOR Descriptor
Definition: wdfresource.h:339
_In_ WDFDEVICE _In_ PVOID _In_opt_ PMDL Mdl
#define RtlZeroMemory(Destination, Length)
Definition: typedefs.h:262