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

    {

    VOID

    CaifEvtDeviceFileCreate(

    __in WDFDEVICE pv_i_Device,

    __in WDFREQUEST pv_i_Request,

    __in WDFFILEOBJECT pv_i_FileObject

    )

    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

    );

    and callback function

    Wednesday, March 21, 2012 1:06 PM

Answers

  • You cannot call WdfDeviceInitSetFileObjectConfig in this environment.  You must call the function before the WdfDevice is created, and to reach this function you must have already created the device.  Why are you trying to set the callback for the file object in a callback for the file object?


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

    Wednesday, March 21, 2012 1:11 PM