I post this question again. Hopefully MS folks can give me an answer.
My file system filter driver needs to delete a file’s reparse point
attribute by building a DeviceIoControl IRP with FSCTL_DELETE_REPARSE_POINT
control code.
Here is a piece of the code.
=======================================
Irp = IoBuildDeviceIoControlRequest(FSCTL_DELETE_REPARSE_POINT,
UnderlyDeviceObject,
ReparseBuffer,
REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
NULL, 0,
FALSE, &Event, &iosb);
if (Irp == NULL)
return STATUS_INSUFFICIENT_RESOURCES;
// Set the stack location
IrpSp = IoGetNextIrpStackLocation(Irp);
IrpSp->FileObject = FileObject;
// Send the request to the lower layer driver.
Status = IoCallDriver(UnderlyDeviceObject, Irp);
=======================================
The returned status of IoCallDriver is always 0xC000000D
(STATUS_INVALID_PARAMETER).
Please give me any hint about what is wrong with this code.
Thanks,
Shangwu
Where did you get your FileObject from?
Was IRP_MJ_CREATE for this file object already processed by the underlying
file system and returned STATUS_SUCCESS (Not STATUS_REPARSE)?
Alexei.
“Shangwu” wrote in message news:xxxxx@ntfsd…
> I post this question again. Hopefully MS folks can give me an answer.
>
> My file system filter driver needs to delete a file’s reparse point
> attribute by building a DeviceIoControl IRP with
FSCTL_DELETE_REPARSE_POINT
> control code.
> Here is a piece of the code.
>
> =======================================
> Irp = IoBuildDeviceIoControlRequest(FSCTL_DELETE_REPARSE_POINT,
> UnderlyDeviceObject,
> ReparseBuffer,
> REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
> NULL, 0,
> FALSE, &Event, &iosb);
> if (Irp == NULL)
> return STATUS_INSUFFICIENT_RESOURCES;
>
> // Set the stack location
> IrpSp = IoGetNextIrpStackLocation(Irp);
> IrpSp->FileObject = FileObject;
>
> // Send the request to the lower layer driver.
> Status = IoCallDriver(UnderlyDeviceObject, Irp);
>
> =======================================
>
> The returned status of IoCallDriver is always 0xC000000D
> (STATUS_INVALID_PARAMETER).
> Please give me any hint about what is wrong with this code.
>
> Thanks,
>
> Shangwu
>
>
>
Alexei,
The file object was gotten from the underlying driver with STATUS_REPARSE. I
know that it is a premature file object because the file is not really
opened. Do you have any suggestions about this? Have you implemented this
kind of reparse point deletion in your kernel mode code? If you had, would
you please share the piece of code?
Regards,
Shangwu
“Alexei Jelvis” wrote in message news:xxxxx@ntfsd…
> Where did you get your FileObject from?
> Was IRP_MJ_CREATE for this file object already processed by the underlying
> file system and returned STATUS_SUCCESS (Not STATUS_REPARSE)?
>
> Alexei.
>
> “Shangwu” wrote in message news:xxxxx@ntfsd…
> > I post this question again. Hopefully MS folks can give me an answer.
> >
> > My file system filter driver needs to delete a file’s reparse point
> > attribute by building a DeviceIoControl IRP with
> FSCTL_DELETE_REPARSE_POINT
> > control code.
> > Here is a piece of the code.
> >
> > =======================================
> > Irp = IoBuildDeviceIoControlRequest(FSCTL_DELETE_REPARSE_POINT,
> > UnderlyDeviceObject,
> > ReparseBuffer,
> > REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
> > NULL, 0,
> > FALSE, &Event, &iosb);
> > if (Irp == NULL)
> > return STATUS_INSUFFICIENT_RESOURCES;
> >
> > // Set the stack location
> > IrpSp = IoGetNextIrpStackLocation(Irp);
> > IrpSp->FileObject = FileObject;
> >
> > // Send the request to the lower layer driver.
> > Status = IoCallDriver(UnderlyDeviceObject, Irp);
> >
> > =======================================
> >
> > The returned status of IoCallDriver is always 0xC000000D
> > (STATUS_INVALID_PARAMETER).
> > Please give me any hint about what is wrong with this code.
> >
> > Thanks,
> >
> > Shangwu
> >
> >
> >
>
>
>
Before you can send any FSCTL to a file the file must be successfully opened
by underlying file system.
If the file contains reparse point you need to add FILE_OPEN_REPARSE_POINT
to Parameters.CreateFile.Option to instruct the file system driver to open
the file despite presence of the reparse point.
There are many ways to achieve this, one possible solution is to send the
original IRP_MJ_CRAETE IRP again this time with required option specified.
Obviously if you want to re-use the IRP you need to set completion routine
that returns STATUS_MORE_PROCESSING_REQUIRED. Then you can check if status
was STATUS_REPARSE and then either complete the IRP or add the flag in
options field and send it to file system again.
Alexei.
“Shangwu” wrote in message news:xxxxx@ntfsd…
> Alexei,
>
> The file object was gotten from the underlying driver with STATUS_REPARSE.
I
> know that it is a premature file object because the file is not really
> opened. Do you have any suggestions about this? Have you implemented this
> kind of reparse point deletion in your kernel mode code? If you had, would
> you please share the piece of code?
>
> Regards,
>
> Shangwu
>
> “Alexei Jelvis” wrote in message
news:xxxxx@ntfsd…
> > Where did you get your FileObject from?
> > Was IRP_MJ_CREATE for this file object already processed by the
underlying
> > file system and returned STATUS_SUCCESS (Not STATUS_REPARSE)?
> >
> > Alexei.
> >
> > “Shangwu” wrote in message news:xxxxx@ntfsd…
> > > I post this question again. Hopefully MS folks can give me an answer.
> > >
> > > My file system filter driver needs to delete a file’s reparse point
> > > attribute by building a DeviceIoControl IRP with
> > FSCTL_DELETE_REPARSE_POINT
> > > control code.
> > > Here is a piece of the code.
> > >
> > > =======================================
> > > Irp = IoBuildDeviceIoControlRequest(FSCTL_DELETE_REPARSE_POINT,
> > > UnderlyDeviceObject,
> > > ReparseBuffer,
> > > REPARSE_GUID_DATA_BUFFER_HEADER_SIZE,
> > > NULL, 0,
> > > FALSE, &Event, &iosb);
> > > if (Irp == NULL)
> > > return STATUS_INSUFFICIENT_RESOURCES;
> > >
> > > // Set the stack location
> > > IrpSp = IoGetNextIrpStackLocation(Irp);
> > > IrpSp->FileObject = FileObject;
> > >
> > > // Send the request to the lower layer driver.
> > > Status = IoCallDriver(UnderlyDeviceObject, Irp);
> > >
> > > =======================================
> > >
> > > The returned status of IoCallDriver is always 0xC000000D
> > > (STATUS_INVALID_PARAMETER).
> > > Please give me any hint about what is wrong with this code.
> > >
> > > Thanks,
> > >
> > > Shangwu
> > >
> > >
> > >
> >
> >
> >
>
>
>