Partager via


IOCTL_HAL_GET_DEVICEID (deprecated) (Compact 2013)

10/16/2014

This I/O control is deprecated. Its functionality has been integrated into IOCTL_HAL_GET_DEVICE_INFO.

This I/O control message returns the current DEVICE_ID structure assigned to the device. Send this message with KernelIoControl.

Syntax

BOOL KernelIoControl(
    DWORD dwIoControlCode,    // use IOCTL_HAL_GET_DEVICEID
    LPVOID lpInBuffer,        // pointer to input buffer
    DWORD nInBufferSize,      // input buffer size
    LPVOID lpOutBuffer,       // pointer to output buffer
    DWORD nOutBufferSize,     // output buffer size
    LPDWORD lpBytesReturned  // number of bytes returned
);

Parameters

  • dwIoControlCode
    [in] Control code for the operation. Use IOCTL_HAL_GET_DEVICEID for this operation.
  • lpInBuffer
    Not used; set to NULL.
  • nInBufferSize
    [in] Set to zero.
  • lpOutBuffer
    [out] Pointer to an allocated DEVICE_ID structure.
  • lpBytesReturned
    [in] Pointer to a DWORD value that receives the size, in bytes, of the data structure that contains the device identification information.

    This parameter is optional. If you do not need this value, set this parameter to NULL.

Return Values

If the system supports this I/O control and the parameters are correct, returns TRUE if successful; otherwise, returns FALSE. Also returns FALSE when querying the I/O control for the correct data structure size.

Remarks

This IOCTL allows the caller to obtain the DEVICE_ID structure associated with the device and to determine the size of the structure. It is recommended that you query the system for the structure size so that you can allocate the right buffer size, and then get the actual device DEVICE_ID data structure.

To query the structure size

  1. Allocate a DEVICE_ID structure and then set the dwSize value to zero

  2. Pass the DEVICE_ID structure to KernelIoControl using IOCTL_HAL_GET_DEVICEID.

    The KernelIoControl call will return FALSEand GetLastError will return ERROR_INSUFFICIENT_BUFFER. The dwSize member in the DEVICE_ID structure will contain the number of bytes needed for the device identification information. In this case, the lpBytesReturned value is not set.

To get the device identification information

  • Allocate a large enough buffer and then call KernelIoControl using IOCTL_HAL_GET_DEVICEID.

    The data will be copied into lpOutBuf. If lpBytesReturned is not NULL, then this address will contain the size of the data copied to the buffer. This should be equal to the dwSize parameter in the DEVICE_ID data structure.

    If this process is successful, the function returns TRUE. If an error occurs, this function returns FALSE and sets GetLastError. If GetLastError equals ERROR_INSUFFICIENT_BUFFER, the dwSize parameter will not be set to the size needed for the data structure.

Requirements

Header

pkfuncs.h

See Also

Reference

Device Information IOCTLs