Edit

WinI3CSetMaxWriteLength function (wini3c.h)

Indicates to a WinI3C-Target the expected maximum size of an I3C Private Write. This corresponds to the I3C SETMWL and GETMWL Direct CCCs. While a WinI3C-Target is expected to respect this value, the I3C specification provides no enforcement mechanism, so it is not guaranteed.

WinI3CSetMaxWriteLength is a Library-managed WinI3C API (the recommended way to use WinI3C). For an overlapped equivalent, see WinI3CSetMaxWriteLengthWithFileHandle.

Syntax

_Must_inspect_result_
HRESULT WINAPI WinI3CSetMaxWriteLength(
    _In_ WinI3CTarget target,
    _In_ UINT16 requestedMaxWriteLength,
    _Out_ UINT16* actualMaxWriteLength);

Parameters

[in] target

The WinI3CTarget to configure.

The handle shall have been created by WinI3CInitializeTarget.

[in] requestedMaxWriteLength

The requested maximum Private Write payload size (bytes).

[out] actualMaxWriteLength

Receives the actual maximum Private Write payload size, as determined by the WinI3C-Target. This may differ from the requested length.

Valid only when the function returns S_OK.

Return value

On success this function returns S_OK.

On failure this function returns an appropriate HRESULT error code, including the following.

Return code Description
S_OK Successfully set the maximum write length. This does not imply the requested value was set; see actualMaxWriteLength.
E_INVALIDARG One or more parameters are invalid.
E_OUTOFMEMORY Available memory is insufficient to execute this function.
HRESULT_FROM_WIN32(ERROR_DEVICE_NACKED) The WinI3C-Target (passively) NACKed the SETMWL or GETMWL CCC. The client may retry later; consider first calling WinI3CGetStatus.
HRESULT_FROM_WIN32(ERROR_DEVICE_NOT_CONNECTED) The WinI3C-Target is not connected. Destroy the handle with WinI3CRelease.
HRESULT_FROM_WIN32(ERROR_DEVICE_HARDWARE_ERROR) A fatal hardware error occurred. Destroy the handle with WinI3CRelease.

Remarks

Vendors understand the capabilities of their devices, so there is no provided mechanism to determine if SETMWL/GETMWL Direct CCCs are supported by the WinI3C-Target.

This function is thread-safe.

Example

#include <wini3c.h>

void main()
{
    ...

    const uint16_t requestedMaxWriteLength = ...;
    uint16_t actualMaxWriteLength;

    if (FAILED(WinI3CSetMaxWriteLength(target, requestedMaxWriteLength, &actualMaxWriteLength)))
    {
        // Handle failure.
    }

    ...
}

Requirements

Requirement Value
Minimum supported client Windows 11 25H2 October update (build 26200)
Target Platform Windows
Header wini3c.h
DLL wini3c.dll

See also

WinI3CSetMaxWriteLengthWithFileHandle

WinI3CSetMaxReadAndIbiLength

WinI3CWrite