-
5.1. IO Device Control Method
To use those function call, it is necessary to include “ioc_ioctl.h”. Please refer to below method and sample
source.
5.1.1. Create IO Device
…
#include “ioc_ioctl.h”
…
HANDLE gIOControlDriverHandle;
…
gIOControlDriverHandle = CreateFile(L”IOC1:”, GENERIC_READ |
GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, OPEN_EXISTING, 0, 0);
If (gIOControlDriverHandle == INVALID_HANDLE_VALUE)
{
// IO device not found, function not supported,
// error process
}
…
CloseHandle(gIOControlDriverHandle);
…
After IO device opened, IO functions can be accessed through DeviceIoControl(). If the device handle has
the same name as gIOControlDriverHandle, then help macros defined in ioc_ioctl.h are ready to use.
In following examples, we assume IO device has been successfully opened already with handle name
gIOControlDriverHandle as shown in above code excerpt. And we use help macros to access IO.
5.1.2. Close Device
Device has to be closed before application exit by calling, “CloseHandle(gIOControlDriverHandle)”.
Содержание MR650
Страница 1: ...MR650 Programming Manual V 1 12 1 16 2008 ...
Страница 7: ... 7 13 FUNCTION KEY SETTING ON REGISTRY 65 14 UPDATE NOTES 66 ...
Страница 16: ... it is for internal use send messages ...
Страница 33: ... Be aware to release handles when program ends ...