RtlIoEncodeMemIoResource - NtDoc

Native API online documentation, based on the System Informer (formerly Process Hacker) phnt headers
#ifndef _NTRTL_H

/**
 * The RtlIoEncodeMemIoResource routine encodes address and length information into a memory or I/O resource descriptor.
 *
 * \param Descriptor The IO resource descriptor to populate.
 * \param Type The resource type.
 * \param Length The resource length.
 * \param Alignment The alignment requirement.
 * \param MinimumAddress The minimum acceptable address.
 * \param MaximumAddress The maximum acceptable address.
 * \return NTSTATUS Successful or errant status.
 */
// rev
NTSYSAPI
NTSTATUS
NTAPI
RtlIoEncodeMemIoResource(
    _Out_ PIO_RESOURCE_DESCRIPTOR Descriptor,
    _In_ UCHAR Type,
    _In_ ULONGLONG Length,
    _In_ ULONGLONG Alignment,
    _In_ ULONGLONG MinimumAddress,
    _In_ ULONGLONG MaximumAddress
    );

#endif

View code on GitHub
// wdm.h

NTSYSAPI NTSTATUS RtlIoEncodeMemIoResource(
  [in] PIO_RESOURCE_DESCRIPTOR Descriptor,
  [in] UCHAR                   Type,
  [in] ULONGLONG               Length,
  [in] ULONGLONG               Alignment,
  [in] ULONGLONG               MinimumAddress,
  [in] ULONGLONG               MaximumAddress
);
View the official Windows Driver Kit DDI reference

NtDoc

No description available.

Windows Driver Kit DDI reference (nf-wdm-rtlioencodememioresource)

RtlIoEncodeMemIoResource function

Description

The RtlIoEncodeMemIoResource routine updates an IO_RESOURCE_DESCRIPTOR structure to describe a range of memory or I/O port addresses.

Parameters

Descriptor [in]

A pointer to the IO_RESOURCE_DESCRIPTOR structure to update.

Type [in]

The resource type of the address range. This parameter can be CmResourceTypeMemory, CmResourceTypeMemoryLarge, or CmResourceTypePort.

Length [in]

The length, in bytes, of the range of assignable addresses.

Alignment [in]

The alignment, in bytes, of the starting address of address range.

MinimumAddress [in]

The minimum address that can be assigned to the device.

MaximumAddress [in]

The maximum address that can be assigned to the device.

Return value

RtlIoEncodeMemIoResource returns an NTSTATUS value. This routine might return one of the following values:

Return code Description
STATUS_SUCCESS The IO_RESOURCE_DESCRIPTOR structure was updated.
STATUS_UNSUCCESSFUL The specified value for Length or Alignment could not be encoded in an IO_RESOURCE_DESCRIPTOR structure.
STATUS_INVALID_PARAMETER One or more of the specified parameters were invalid.

Remarks

Addresses that are larger than 32 bits in length must satisfy certain alignment restrictions, or else the routine returns STATUS_UNSUCCESSFUL.

Address length Alignment restriction
40 bits Lowest 8 bits must be zero.
48 bits Lowest 16 bits must be zero.
64 bits Lowest 32 bits must be zero.

See also

IO_RESOURCE_DESCRIPTOR

RtlIoDecodeMemIoResource