Can I call ZwCreateFile() and ZwReadFile() in IRP_MJ_WRITE dispatch ? I have deal with re-entry .

If I had deal with re-entry,could I call ZwCreateFile() and ZwReadFile() in
IRP_MJ_WRITE dispatch ?

Now I will copy original data of A file to B file when writing A File . I
need to call ZwCreateFile(A) and ZwReadFile(A) in the IRP_MJ_WRITE dispatch
of A file.
Can I do so ?

Some one told me that it will result in block !
But how can I do ?

Others will fill in more but at the *very* least:

  • You will have to deal with being re-enterred because you are calling
    ZwCreateFile not IoCreateFileSpecifyDeviceObjectHint

  • You will have to deal with other drivers having been re-enterred because
    of the same

  • Even when you change to use IoCreateFileSpecifyDeviceObjectHint you will
    have issues with filters below you which call back up to a usermode harness
    and issue a NtCreate in another thread context. I’d make sure my
    deadlock-solving skills were sharpenned.

  • In any case, you want to avoid doing this for Paging IO.

/rod

“Leo” wrote in message news:xxxxx@ntfsd…
> If I had deal with re-entry,could I call ZwCreateFile() and ZwReadFile()
> in IRP_MJ_WRITE dispatch ?
>
> Now I will copy original data of A file to B file when writing A File . I
> need to call ZwCreateFile(A) and ZwReadFile(A) in the IRP_MJ_WRITE
> dispatch of A file.
> Can I do so ?
>
> Some one told me that it will result in block !
> But how can I do ?
>
>

I haved deal with re-entry.
My question is how to deal with block ?
Why avoid Paging IO ?

“Rod Widdowson” wrote in message news:xxxxx@ntfsd…
> Others will fill in more but at the very least:
>
> - You will have to deal with being re-enterred because you are calling
> ZwCreateFile not IoCreateFileSpecifyDeviceObjectHint
>
> - You will have to deal with other drivers having been re-enterred because
> of the same
>
> - Even when you change to use IoCreateFileSpecifyDeviceObjectHint you will
> have issues with filters below you which call back up to a usermode
> harness and issue a NtCreate in another thread context. I’d make sure my
> deadlock-solving skills were sharpenned.
>
> - In any case, you want to avoid doing this for Paging IO.
>
>
> /rod
>
> “Leo” wrote in message news:xxxxx@ntfsd…
>> If I had deal with re-entry,could I call ZwCreateFile() and ZwReadFile()
>> in IRP_MJ_WRITE dispatch ?
>>
>> Now I will copy original data of A file to B file when writing A File . I
>> need to call ZwCreateFile(A) and ZwReadFile(A) in the IRP_MJ_WRITE
>> dispatch of A file.
>> Can I do so ?
>>
>> Some one told me that it will result in block !
>> But how can I do ?
>>
>>
>
>
>

> My question is how to deal with block ?

Why avoid Paging IO ?

You appear to have answered your own question. Paging IO is very liable to
cause deadlocks - all sorts of File System and Operating System locks are
held in the context of them and issuing a create at that point is going to
throw the cat among the pigeons.