Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Retrieves the maximum read length (MRL) and IBI length as determined by a WinI3C-Target, from a completed overlapped operation started with WinI3CSetMaxReadAndIbiLengthWithFileHandle. The underlying overlapped operation shall have completed before this function is called.
WinI3CGetMaxReadAndIbiLengthFromOperation is a Non-library-managed WinI3C API, intended only for advanced scenarios and generally not recommended.
Syntax
_Must_inspect_result_
HRESULT WINAPI WinI3CGetMaxReadAndIbiLengthFromOperation(
_In_ HANDLE targetFileHandle,
_In_ OVERLAPPED* setMrlOverlapped,
_In_ WinI3CAsyncOperation setMrlOperation,
_Out_ UINT16* actualMaxReadAndAutoCommandReadLength,
_Out_ UINT8* actualMaxIbiLength);
Parameters
[in] targetFileHandle
The file handle associated with the WinI3C-Target.
[in] setMrlOverlapped
The client-allocated OVERLAPPED that was supplied to WinI3CSetMaxReadAndIbiLengthWithFileHandle.
[in] setMrlOperation
The WinI3CAsyncOperation created by WinI3CSetMaxReadAndIbiLengthWithFileHandle.
[out] actualMaxReadAndAutoCommandReadLength
Receives the actual maximum Private Read and IBI Auto-Command-Read payload size, as determined by the WinI3C-Target. This may differ from the requested length.
Valid only when the function returns S_OK.
[out] actualMaxIbiLength
Receives the actual maximum IBI payload size, as determined by the WinI3C-Target. This may differ from the requested length.
0 indicates an unlimited payload.
If IBIs are unsupported, this is shall be 0 and ignored by the client.
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 | The overlapped operation completed and actualMaxReadAndAutoCommandReadLength/actualMaxIbiLength may be inspected. |
| E_INVALIDARG | One or more parameters are invalid. |
| E_OUTOFMEMORY | Available memory is insufficient to execute this function. |
| HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE) | targetFileHandle is invalid, or was not opened with FILE_FLAG_OVERLAPPED. |
| HRESULT_FROM_WIN32(ERROR_IO_PENDING) | The overlapped operation has not completed. |
| HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER) | The overlapped operation returned more data than expected. |
| HRESULT_FROM_WIN32(ERROR_DEVICE_NACKED) | The WinI3C-Target (passively) NACKed the SETMRL or GETMRL CCC. This can be because the WinI3C-Target is busy, doesn't support the CCC or has experienced a fatal hardware-error. Client may retry later (by invoking another read); consider first invoking WinI3CGetStatusWithFileHandle to validate the WinI3C-Target is available. |
| HRESULT_FROM_WIN32(ERROR_DEVICE_HARDWARE_ERROR) | A fatal hardware error occurred. Close targetFileHandle with CloseHandle. |
Remarks
The library-created setMrlOperation shall now be destroyed with WinI3CRelease.
This function is thread-safe.
Example
#include <wil\result.h>
#include <wil\resource.h>
#include <wini3c.h>
int main()
{
...
auto destroyOperationOnExit = wil::scope_exit([&]()
{
WinI3CRelease(setMrlOperation);
});
// Blocking, waiting for result (for demonstration purposes only).
// In a real application, would use a completion port or other async mechanism to avoid blocking the thread.
DWORD numberOfBytesTransferred;
if (!GetOverlappedResult(winI3cTargetHandle, &setMrlOverlapped, &numberOfBytesTransferred, true))
{
RETURN_LAST_ERROR();
}
uint16_t actualMaxReadLength;
uint8_t actualMaxIbiLength;
RETURN_IF_FAILED(WinI3CGetMaxReadAndIbiLengthFromOperation(
winI3cTargetHandle,
&setMrlOverlapped,
setMrlOperation,
&actualMaxReadLength,
&actualMaxIbiLength));
...
}
Requirements
| Requirement | Value |
|---|---|
| Minimum supported client | Windows 11 25H2 October update (build 26200) |
| Target Platform | Windows |
| Header | wini3c.h |
| DLL | wini3c.dll |