Download NowDEALSEDISCOUNT ANDRIOD APPGET FREE DEALS AND OFFERS ON THE GO

How to define a FunctionCode to use in a I/O Control ?

Function code is a value to help uniquely identify the specific IOCTL. So
for instance if you are defining 5 IOCTL’s you would do something like:

#define IOCTL_1 CTL_CODE( MyDeviceType, 0, METHOD_BUFFERED,
FILE_ANY_ACCESS )

#define IOCTL_2 CTL_CODE( MyDeviceType, 1, METHOD_BUFFERED,
FILE_ANY_ACCESS )

#define IOCTL_3 CTL_CODE( MyDeviceType, 2, METHOD_BUFFERED,
FILE_ANY_ACCESS )

#define IOCTL_4 CTL_CODE( MyDeviceType, 3, METHOD_BUFFERED,
FILE_ANY_ACCESS )

#define IOCTL_5 CTL_CODE( MyDeviceType, 4, METHOD_BUFFERED,
FILE_ANY_ACCESS )

The function code has nothing to do with the dispatch of the function.


Don Burn (MVP, Windows DKD)
Windows Filesystem and Driver Consulting
Website: http://www.windrvr.com
Blog: http://msmvps.com/blogs/WinDrvr
Remove StopSpam to reply

"Javier Càceres" <> wrote in message
news:8F11FB42-972B-4DE5-9056-…
> This link (http://msdn.microsoft.com/en-us/library/ms795909.aspx) says
> that
> is necessary to define I/O contro codes in this way:
>
> #define IOCTL_Device_Function CTL_CODE(DeviceType, Function, Method,
> Access)
>
> The Function is a reference to a driver function, but how do you specify
> it?
> I have seen other IOCTL definition and they use to be hex addresses.
>
> I have two doubts:
> 1-Where does FunctionCode come from?
> 2-I’m confused, if FunctionCode points to driver’s handler function then
> what does DispatchDeviceControl do? ->I mean, DispatchDeviceControl is
> suposse to handle all calls to DeviceIoControl.
>
> Thanks,
>
> __________ Information from ESET NOD32 Antivirus, version of virus
> signature database 4431 (20090916) __________
>
> The message was checked by ESET NOD32 Antivirus.
>
> http://www.eset.com
>
>
>

__________ Information from ESET NOD32 Antivirus, version of virus signature database 4431 (20090916) __________

The message was checked by ESET NOD32 Antivirus.

http://www.eset.com

Add a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.