locked
ZwWriteFile write fail on Win7 RRS feed

  • Question

  • When got request IRP_MJ_WRITE, then used ZwWriteFile to directly write u-disk physical sections, it can be write successful on winxp, but failed on win7, return:0xc0000022.How can I do little change let it can work well on win7?



    Wednesday, August 31, 2011 2:40 AM

Answers

  • #define STATUS_ACCESS_DENIED             ((NTSTATUS)0xC0000022L)

    Vista introduced a restriction to writing directly to the volume on mounted volumes, you need to unmount it first.


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, August 31, 2011 6:33 AM

All replies

  • #define STATUS_ACCESS_DENIED             ((NTSTATUS)0xC0000022L)

    Vista introduced a restriction to writing directly to the volume on mounted volumes, you need to unmount it first.


    d -- This posting is provided "AS IS" with no warranties, and confers no rights.
    Wednesday, August 31, 2011 6:33 AM
  • If not do unmount, can it set io_stack->Flags |= SL_FORCE_DIRECT_WRITE? I have set io_stack->Flags |= SL_FORCE_DIRECT_WRITE but not unmount, it also return STATUS_ACCESS_DENIED 

    If must need unmount volumes, can you give a sample code for mount&unmount about vista driver layer and application layer.thanks  

    Thursday, September 1, 2011 1:45 AM