locked
createfile hangs when attach create callback function RRS feed

  • Question

  • I had attached  EVT_WDF_DEVICE_FILE_CREATE callback function for my driver but when i try to open driver using createfile from application system hangs and callback function also not gets called but if i remove the callback attach then createfile works fine
    below is code for attaching callback function please check
     
     
    WDF_FILEOBJECT_CONFIG_INIT(&vl_FileObjectConfig,
    CaifEvtDeviceFileCreate,
    WDF_NO_EVENT_CALLBACK,
    WDF_NO_EVENT_CALLBACK
    );
    WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&vl_FileAttributes, CAIF_FILE_OBJECT_CONTEXT);
    WdfDeviceInitSetFileObjectConfig(pv_io_DeviceInit,
    &vl_FileObjectConfig,
    &vl_FileAttributes
    );
    Wednesday, March 21, 2012 1:15 PM

Answers

  • You have to have the device to recieve a create, so you need to do this in the add device before you ever get there.  Also you need to create a name and a symbolic link for this device to typically open if from an application.


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

    Wednesday, March 21, 2012 1:30 PM

All replies

  • See http://social.msdn.microsoft.com/Forums/en-US/wdk/thread/39ebb17e-c89f-4d00-ba9c-f32f9250392a


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

    Wednesday, March 21, 2012 1:16 PM
  • NTSTATUS
    CaifCreateDevice(
        _Inout_ PWDFDEVICE_INIT pv_io_DeviceInit
        )
    {
     WDF_FILEOBJECT_CONFIG_INIT(&vl_FileObjectConfig,
                                    CaifEvtDeviceFileCreate,
                                    WDF_NO_EVENT_CALLBACK,
                                    WDF_NO_EVENT_CALLBACK
                                    );

     WDF_OBJECT_ATTRIBUTES_INIT_CONTEXT_TYPE(&vl_FileAttributes, CAIF_FILE_OBJECT_CONTEXT);

        WdfDeviceInitSetFileObjectConfig(pv_io_DeviceInit,
                                         &vl_FileObjectConfig,
                                         &vl_FileAttributes
                                         );

        vl_Status = WdfDeviceCreate(&pv_io_DeviceInit,
                                    &vl_DeviceAttributes,
                                    &pl_Device);

    Queue create....

    }

    i am installing this driver and later from application code i am trying to open driver

    NTSTATUS

    CaifCreateDevice(

    _Inout_ PWDFDEVICE_INIT pv_io_DeviceInit

    )

    Wednesday, March 21, 2012 1:24 PM
  • You have to have the device to recieve a create, so you need to do this in the add device before you ever get there.  Also you need to create a name and a symbolic link for this device to typically open if from an application.


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

    Wednesday, March 21, 2012 1:30 PM