DeviceControlStatus Enum

Overview

The DeviceControlStatus enumeration defines the possible status codes returned by device control operations in the Win32 API. These values indicate whether an operation completed successfully, encountered an error, or requires further processing.

enum DeviceControlStatus : DWORD {
    DEVICE_CONTROL_STATUS_OK          = 0, // Operation completed successfully.
    DEVICE_CONTROL_STATUS_NOT_READY  = 1, // Device is not ready to accept the request.
    DEVICE_CONTROL_STATUS_ERROR      = 2, // An error occurred during the operation.
    DEVICE_CONTROL_STATUS_PENDING    = 3, // Operation is pending and will complete asynchronously.
    DEVICE_CONTROL_STATUS_UNKNOWN    = 4  // Status could not be determined.
};

Enum Values

NameValueDescription
DEVICE_CONTROL_STATUS_OK0Operation completed successfully.
DEVICE_CONTROL_STATUS_NOT_READY1Device is not ready to accept the request.
DEVICE_CONTROL_STATUS_ERROR2An error occurred while processing the request.
DEVICE_CONTROL_STATUS_PENDING3The request is pending; completion will be signaled later.
DEVICE_CONTROL_STATUS_UNKNOWN4The status could not be determined.

Remarks

When using functions such as DeviceIoControl, the return value is often cast to DeviceControlStatus to simplify error handling. Typical usage involves checking for DEVICE_CONTROL_STATUS_OK before proceeding with further processing.

// Example usage
DeviceControlStatus status = static_cast(result);
if (status == DEVICE_CONTROL_STATUS_OK) {
    // Continue processing
} else {
    // Handle error or pending state
}

See Also