Prev: Can WinDbg script extract an EPROCESS address from command output?
Next: Windows XP ata controller driver
From: Javier Càceres on 16 Sep 2009 15:37 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,
From: Don Burn on 16 Sep 2009 15:45 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" <JavierCceres(a)discussions.microsoft.com> wrote in message news:8F11FB42-972B-4DE5-9056-A4B756C063AE(a)microsoft.com... > 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
From: Javier Càceres on 16 Sep 2009 16:37 Hi Don, And how do you match (or point) the IOCTL_1 CTL_CODE to the driver method in charge of processing that request? Thanks, "Don Burn" wrote: > 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" <JavierCceres(a)discussions.microsoft.com> wrote in message > news:8F11FB42-972B-4DE5-9056-A4B756C063AE(a)microsoft.com... > > 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 > > > > >
From: Don Burn on 16 Sep 2009 16:50 You have an IRP_MJ_DEVICE_CONTROL dispatch routine ( or EvtIoDeviceControl function for KMDF) and in that routine have a switch statement such as: switch ( irpSp->Parameters.DeviceIoControl.IoControlCode ) { case IOCTL_1: case IOCTL_2: etc. Take a look at src\general\ioctl in the WDK for a good example of this. -- 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" <JavierCceres(a)discussions.microsoft.com> wrote in message news:F8ED0860-AC77-42A4-A8E8-2D9555DC687F(a)microsoft.com... > Hi Don, > > And how do you match (or point) the IOCTL_1 CTL_CODE to the driver method > in > charge of processing that request? > > Thanks, > > "Don Burn" wrote: > >> 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" <JavierCceres(a)discussions.microsoft.com> wrote in >> message >> news:8F11FB42-972B-4DE5-9056-A4B756C063AE(a)microsoft.com... >> > 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 >> >> >> >> >> > > __________ 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
From: Maxim S. Shatskih on 16 Sep 2009 17:11 > And how do you match (or point) the IOCTL_1 CTL_CODE to the driver method in > charge of processing that request? The header file with the IOCTL declarations must be included to both user and kernel mode code. -- Maxim S. Shatskih Windows DDK MVP maxim(a)storagecraft.com http://www.storagecraft.com
|
Next
|
Last
Pages: 1 2 Prev: Can WinDbg script extract an EPROCESS address from command output? Next: Windows XP ata controller driver |