Skip to content
Search

WindowsApi:KernelIoControl

lastmod 2018-08-17created 2016-04-122 edits

[Windows CE] This function provides the kernel with a generic I/O control for carrying out I/O operations.

Requests information for generic I/O control from the kernel.

Syntax

BOOL KernelIoControl( 
  DWORD dwIoControlCode, 
  LPVOID lpInBuf, 
  DWORD nInBufSize, 
  LPVOID lpOutBuf, 
  DWORD nOutBufSize, 
  LPDWORD lpBytesReturned 
);

Requirements

OS Versions

Windows CE 2.10 and later

Header

Pkfuncs.h

Link Library

Coredll.lib

Windows CE UUID Example

Describes how to obtain a UUID on Windows CE.

For the Windows Thin Client to read the UUID from where it is saved in nonvolatile memory, you must call GetUUID(). %_WINCEROOT%\Public\Rdp\Oak\Uit\Wbttscmn\Ioctl.cpp contains the GetUUID() function. GetUUID in turn calls KernelIoControl for the IOCTL_HAL_GET_UUID.

Then, to handle the call to that function, you must implement the section of code in the OEM Adaptation Layer (OAL) for the CEPC OS design. An example of the recommended implementation for any Windows Thin Client device that uses the Remote Desktop (RDP) client can be found at %_WINCEROOT%\OS design\Cepc\Kernel\Hal\Oemoictl.c

The following procedures show how to make the Windows Thin Client read the UUID and then implement the OAL code for the CEPC OS design.

To read a UUID

Implement KernelIoControl. The control code that is specified for reading a UUID is IOCTL_HAL_GET_UUID. The following code example shows how to make the Windows Thin Client read a UUID.

BOOL GetUUID () 
{
  GUID myUUID;
  BOOL bRetVal;
  DWORD dwBytesReturned;

  bRetVal = KernelIoControl (IOCTL_HAL_GET_UUID, NULL, 0, &myUUID, 
                             sizeof (myUUID), &dwBytesReturned);
  if (!bRetVal) 
  {
    RETAILMSG(1, TEXT("KernelIoControl call failed!\r\n"));
    return FALSE;
  }

  RETAILMSG(
    1,
    TEXT("UUID: %08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X\r\n"),
    myUUID.Data1,
    myUUID.Data2,
    myUUID.Data3,
    myUUID.Data4[0],
    myUUID.Data4[1],
    myUUID.Data4[2],
    myUUID.Data4[3],
    myUUID.Data4[4],
    myUUID.Data4[5],
    myUUID.Data4[6],
    myUUID.Data4[7]);

  return TRUE;
}

See also

Favorite site