다음을 통해 공유


Device Information IOCTL Unification (Windows Embedded CE 6.0)

1/5/2010

In Windows Embedded CE 6.0, IOCTL_HAL_GET_DEVICEID and IOCTL_HAL_GET_UUID are deprecated. They have been functionally replaced by new SPI_* codes in IOCTL_HAL_GET_DEVICE_INFO. Previously, the mechanisms for retrieving device information were spread across multiple IOCTLs.

The examples below illustrate the required changes to transition existing OS components and applications to use the new unified design.

IOCTL_HAL_GET_DEVICE_ID

Deprecated IOCTL:

The deprecated IOCTL example fills the deviceID buffer with a Unicode string describing the platform type, i.e. "CEPC" as well as a multibyte string describing the BOOTME name of the device, i.e. "CEPC53902".

DWORD deviceID[64];
DWORD dwSize = sizeof(deviceID);
KernelIoControl(IOCTL_HAL_GET_DEVICEID, NULL,
                0, deviceID, dwSize, &dwSize));
PDEVICE_ID pDeviceId = (PDEVICE_ID)(&(deviceID[0]));

Unified IOCTL:

The unified IOCTL example fills the platformName buffer with a Unicode string describing the platform type, i.e. "CEPC" and fills the bootmeName buffer with a Unicode string describing the BOOTME name of the device, i.e. "CEPC53902".

WCHAR platformName[32];
DWORD platformNameSize = sizeof(platformName);
UINT32 spiValue;
WCHAR bootmeName[32];
DWORD bootmeNameSize = sizeof(bootmeName);
spiValue = SPI_GETPLATFORMNAME;
KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO, spiValue,
                sizeof(spiValue), platformName,
                platformNameSize, &platformNameSize));
spiValue = SPI_GETBOOTMENAME;
KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO, spiValue,
                sizeof(spiValue), bootmeName,
                bootmeNameSize, &bootmeNameSize));

IOCTL_HAL_GET_UUID

Deprecated IOCTL:

The deprecated IOCTL example fills the uuid buffer with a platform-unique GUID. If the platform does not support a unique GUID, a potentially non-unique value will be returned.

GUID uuid;
DWORD dwSize = sizeof(uuid);
KernelIoControl(IOCTL_HAL_GET_UUID, NULL,
                0, uuid, dwSize, &dwSize));

Unified IOCTL:

The unified IOCTL example fills the uuid buffer with a platform-unique GUID. If the platform does not support a unique GUID, KernelIoControl will return false. If existing code relies on the potentially non-unique value returned by the deprecated IOCTL, you can call IOCTL_HAL_GET_DEVICE_INFO / SPI_GETBOOTMENAME to request (potentially non-unique) data to fill the uuid structure. This is similar to the deprecated technique, but without creating the expectation of unique data.

GUID uuid;
DWORD dwSize = sizeof(uuid);
UINT32 spiValue = SPI_GETUUID;
KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO, spiValue,
                sizeof(spiValue), &uuid,
                dwSize, &dwSize));

IOCTL_HAL_GET_DEVICE INFO / SPI_GETPLATFORMTYPE

Deprecated IOCTL:

The deprecated IOCTL example fills the platformType buffer with a Unicode string describing the platform name, i.e. "CEPC".

DWORD platformType[32];
DWORD dwSize = sizeof(platformType);
UINT32 spiValue = SPI_GETPLATFORMTYPE;
KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO, spiValue,
                sizeof(spiValue), platformType,
                dwSize, &dwSize));

Unified IOCTL:

The unified IOCTL example fills the platformName buffer with a Unicode string describing the platform name, i.e. "CEPC".

WCHAR platformName[64];
DWORD dwSize = sizeof(platformName);
UINT32 spiValue = SPI_GETPLATFORMNAME;
KernelIoControl(IOCTL_HAL_GET_DEVICE_INFO, spiValue,
                sizeof(spiValue), platformName,
                dwSize, &dwSize));

IOCTL_HAL_GET_DEVICE INFO / SPI_GETPLATFORMVERSION

**Deprecated IOCTL:

The deprecated IOCTL expected an array of versions returned. For example, by checking for a {4,2} value in the array, it could verify the version as WinCE 4.2 or later.**

Unified IOCTL:

The new unified IOCTL returns a single version. For example, if you want to check for version 4.2 or later, simply do a >= comparison of the return value and {4,2}.

See Also

Reference

IOCTL_HAL_GET_DEVICE_INFO
IOCTL_HAL_GET_DEVICEID
IOCTL_HAL_GET_UUID

Concepts

OEM Adaptation Layer

Other Resources

SystemParametersInfo