none
Get the driver handle by using CreateFile() API RRS feed

  • Question

  • I have driver created for WFP callout. I want to send some data from this driver to user mode application.

    How can I do this?

    I came across API DeviceIoControl() which calls the driver's callback function. But for this I need the device handle for the driver which can be created using CreateFile(). But I don't know what value should I give for file name in CreateFile() function??

    I start the driver with the command "net start WFPSamplerCallouts". So I thought of giving same name in CreatFile() which is giving error as "The system cannot find the file specified.".

    So what name should I use to get the driver handle?

    Sunday, March 24, 2013 10:43 AM

Answers

  • You need to create a device object with IoCreateDeviceSecure for the device.  Once the device is created you either need to create a symbolic link so that Win32 can open the device or a device interface so that you can use the setupAPI's to find the device.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Sunday, April 28, 2013 11:49 AM

All replies

  • To issue a DeviceIoControl you need to create a device in the driver.

    In the driver code (Framework_WFPSamplerCalloutDriver.cpp), find DriverEntry and add a IoCreateDevice call to create a device. Set the pDriverObject IOCTL dispatcher to point to you IOCTLs dispatching code and this way you can communicate between user and kernel.

    Tsang Chan

    Sunday, April 28, 2013 6:01 AM
  • You need to create a device object with IoCreateDeviceSecure for the device.  Once the device is created you either need to create a symbolic link so that Win32 can open the device or a device interface so that you can use the setupAPI's to find the device.


    Don Burn Windows Filesystem and Driver Consulting Website: http://www.windrvr.com Blog: http://msmvps.com/blogs/WinDrvr

    Sunday, April 28, 2013 11:49 AM