FltLockUserBuffer() and Minifilter!

I have modified the Cancel safe queue example of WDK to suit my requirements. Specifically i have registered the callback routines for all IRPs.
However in the worker routine FltLockUserBuffer is ALWAYS failing for ONLY IRP_MJ_FILE_SYSTEM and IRP_MJ_DEVICE_CONTROL. For rest of the major functions it is working fine.
The status code returned is 0xc000000d (STATUS_INVALID_PARAMETER )…
The documentation on FltLockUserBuffer mentions that it can be used with 11 Major Functions and they are listed. IRP_MJ_FILE_SYSTEM and IRP_MJ_DEVICE_CONTROL are included in the list.
What is the reason for failure?

Thanks in advance!