Obtaining Vehicle Specific I/O

The vehicle I/O API enables you to access confidential or proprietary device information. The IVIO_Ioctl interface communicates directly with the vehicle I/O device driver and enables you to access information beyond standard diagnostics. The DoCommand method enables direct communication with the device driver.

The following code example shows how to use an IVIO_Ioctl interface to execute an IOCTL command. The first parameter of DoCommand, IOCTL_CMD_xxx, is a command identifier specific to the device driver. You must obtain this identifier from the provider of the device driver. The second parameter is the address of a buffer that contains driver-specific data for the specified command referenced by IOCTL_CMD_xxx.

IVIO_Ioctl      *pIoctl;
BYTE             bInputBuffer[64];
BYTE                 bReplyBuffer[64];
DWORD            cbReply;

// Create an IVIO_IOCTL interface.
hr = CoCreateInstance(CLSID_VIOIOCTL, NULL, CLSCTX_INPROC_SERVER,
                      IID_VIOIOCTL, (PVOID *) &pIoctl);
// Initialize the input buffer. You must write code to correspond to the
// device driver command you are accessing.
MyInitializeInputBuffer(bInputBuffer);
// Pass the I/O control data to the mini-driver.
pIoctl->DoCommand(IOCTL_CMD_xxx, bInputBuffer, 64, bReplyBuffer, 64,
                  &cbReply);
// Parse the reply.
MyParseReply(pReplyBuffer, cbReply);
// Release the reference to IOCTL.
pIoctl->Release();