IOCTL_USBPRINT_VENDOR_SET_COMMAND

The IOCTL_USBPRINT_VENDOR_SET_COMMAND request allows upper-layer software (such as a language monitor) to issue a vendor-specific SET command to the target device.

To perform this operation, call the DeviceIoControl function (described in the Microsoft Windows SDK documentation) with the following parameters.


bRet = DeviceIoControl(
    (HANDLE)  hDevice, 
 IOCTL_USBPRINT_VENDOR_SET_COMMAND, // dwIoControlCode 
    (PUCHAR)  lpInBuffer,
    (DWORD)  nInBufferSize,
    NULL,     // lpOutBuffer
    0,        // nOutBufferSize
    (LPDWORD)  lpBytesReturned,
    (LPOVERLAPPED)  lpOverlapped 
  );

Parameters

hDevice

The handle to the print device.

dwIoControlCode

The control code for the operation. This value identifies the specific operation to be performed and the type of device on which to perform it. Use IOCTL_USBPRINT_VENDOR_SET_COMMAND for this operation.

lpInBuffer

A pointer to a input buffer, an array of UCHAR elements. The meaning of each array element is shown in the following table.

Array ElementContents

lpInBuffer[0]

Vendor request code

lpInBuffer[1]

Vendor request value (most significant byte)

lpInBuffer[2]

Vendor request value (least significant byte)

lpInBuffer[3], ...

Any additional data to be sent as part of the command

 

nInBufferSize

The size of the input buffer, in bytes.

lpOutBuffer

Not used in this operation; set this parameter to NULL.

nOutBufferSize

Not used in this operation; set this parameter to 0.

lpBytesReturned

A pointer to a variable that receives the size of the data stored in the lpOutBuffer buffer, in bytes.

If the output buffer is too small to return any data then the call fails, GetLastError (described in the Windows SDK documentation) returns the error code ERROR_INSUFFICIENT_BUFFER, and the returned byte count is zero.

If lpOverlapped is NULL (nonoverlapped I/O), lpBytesReturned cannot be NULL. If lpOverlapped is not NULL (overlapped I/O), lpBytesReturned can be NULL. If this is an overlapped operation, you can retrieve the number of bytes returned by calling the GetOverlappedResult function. If hDevice is associated with an I/O completion port, you can get the number of bytes returned by calling the GetQueuedCompletionStatus function. GetOverlappedResult and GetQueuedCompletionStatus are described in the Windows SDK documentation.

lpOverlapped

A pointer to an OVERLAPPED structure (described in the Windows SDK documentation).

If hDevice was opened with the FILE_FLAG_OVERLAPPED flag, lpOverlapped must point to a valid OVERLAPPED structure. In this case, DeviceIoControl is performed as an overlapped (asynchronous) operation. If the device was opened with the FILE_FLAG_OVERLAPPED flag and lpOverlapped is NULL, the function fails in unpredictable ways.

If hDevice was opened without specifying the FILE_FLAG_OVERLAPPED flag, lpOverlapped is ignored and the DeviceIoControl function does not return until the operation has been completed, or until an error occurs.

Return Value

If the operation succeeds, DeviceIoControl returns a nonzero value.

If the operation fails, DeviceIoControl returns zero. To get extended error information, call GetLastError.

Headers

Declared in usbprint.h. Include usbprint.h.

See also

IOCTL_USBPRINT_VENDOR_GET_COMMAND

 

 

Send comments about this topic to Microsoft

Show:
© 2014 Microsoft