Redirection in minidriver

Hi,

I’ve read a lot of discussion about the REPARSE command to redirect
files open in filter drivers.

I would do the same things with minidriver (I’ve read that should be the
futute technology), I’ve do some test with this code:

RtlInitUnicodeString(&us,L"\Device\HarddiskVolume1\Pippo.txt");

pBuffer = (PWCHAR)ExAllocatePool(PagedPool,us.MaximumLength);

RtlCopyMemory(pBuffer,us.Buffer,us.Length);

if(FileObject->FileName.Buffer) {

ExFreePool(FileObject->FileName.Buffer);

}

FileObject->FileName.Length = us.Length;

FileObject->FileName.MaximumLength = us.MaximumLength;

FileObject->FileName.Buffer = pBuffer;

Data->IoStatus.Information = STATUS_REPARSE;

Data->IoStatus.Information = IO_REPARSE;

FltSetCallbackDataDirty( Data );

returnStatus = STATUS_REPARSE;

return returnStatus;

but this don’t work.

What’s wrong?

I’ve to redirect a CREATE from a file in a volume to a file in another
volume (eg: C:\Test.txt to D:\Pippo.txt)

I’m a newbie in NTFS developing.

Thank’s to All

Gian-Luca

Hello,

change your code:

  1. Data->IoStatus.Status = STATUS_REPARSE
  2. File name buffer has to be allocated from NonPaged pool

I think you can reuse pFileObject->FileName.Buffer if it’s big enough instead of allocating a new buffer.

bye,
Petr Kurtin

“Gian-luca Tenti” wrote in message news:xxxxx@ntfsd…

Hi,

I’ve read a lot of discussion about the REPARSE command to redirect files open in filter drivers.

I would do the same things with minidriver (I’ve read that should be the futute technology), I’ve do some test with this code:

RtlInitUnicodeString(&us,L"\Device\HarddiskVolume1\Pippo.txt");

pBuffer = (PWCHAR)ExAllocatePool(PagedPool,us.MaximumLength);

RtlCopyMemory(pBuffer,us.Buffer,us.Length);

if(FileObject->FileName.Buffer) {

ExFreePool(FileObject->FileName.Buffer);

}

FileObject->FileName.Length = us.Length;

FileObject->FileName.MaximumLength = us.MaximumLength;

FileObject->FileName.Buffer = pBuffer;

Data->IoStatus.Information = STATUS_REPARSE;

Data->IoStatus.Information = IO_REPARSE;

FltSetCallbackDataDirty( Data );

returnStatus = STATUS_REPARSE;

return returnStatus;

but this don’t work.

What’s wrong?

I’ve to redirect a CREATE from a file in a volume to a file in another volume (eg: C:\Test.txt to D:\Pippo.txt)

I’m a newbie in NTFS developing.

Thank’s to All

Gian-Luca

> I think you can reuse pFileObject->FileName.Buffer if it’s big enough
instead

of allocating a new buffer.

Correct.

Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com

Thank’s for yours aid!!

Now I’m able to redirect an access to a file or directory.

But I’ve to allocate a new buffer (the original is not big enough), so I’ve to free the memory (nonpaged)? And where? (I’v attempt to copy the new buffer pointer to the PRE_OP context pointer, but when in the post op I attempt to free it the system give me a beautiful BSOD…

I return from the PRE_CREATE with SYNCRONIZE (if I don’t use the post op it’s all ok)

Thank’s


Ing. Gian-Luca Tenti

mailto: xxxxx@ibsnetwork.it mailto:xxxxx

IBS s.r.l.

Via Marconi, 102

60015 Falconara Marittima (An)

mailto: xxxxx@ibsnetwork.it

Tel: +39 071 9175737

Fax: +39 071 9174788

________________________________

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Kurtin
Sent: luned? 31 ottobre 2005 22.02
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Redirection in minidriver

Hello,

change your code:

1) Data->IoStatus.Status = STATUS_REPARSE

2) File name buffer has to be allocated from NonPaged pool

I think you can reuse pFileObject->FileName.Buffer if it’s big enough instead of allocating a new buffer.

bye,

Petr Kurtin

“Gian-luca Tenti” wrote in message news:xxxxx@ntfsd…

Hi,

I’ve read a lot of discussion about the REPARSE command to redirect files open in filter drivers.

I would do the same things with minidriver (I’ve read that should be the futute technology), I’ve do some test with this code:

RtlInitUnicodeString(&us,L"\Device\HarddiskVolume1\Pippo.txt");

pBuffer = (PWCHAR)ExAllocatePool(PagedPool,us.MaximumLength);

RtlCopyMemory(pBuffer,us.Buffer,us.Length);

if(FileObject->FileName.Buffer) {

ExFreePool(FileObject->FileName.Buffer);

}

FileObject->FileName.Length = us.Length;

FileObject->FileName.MaximumLength = us.MaximumLength;

FileObject->FileName.Buffer = pBuffer;

Data->IoStatus.Information = STATUS_REPARSE;

Data->IoStatus.Information = IO_REPARSE;

FltSetCallbackDataDirty( Data );

returnStatus = STATUS_REPARSE;

return returnStatus;

but this don’t work.

What’s wrong?

I’ve to redirect a CREATE from a file in a volume to a file in another volume (eg: C:\Test.txt to D:\Pippo.txt)

I’m a newbie in NTFS developing.

Thank’s to All

Gian-Luca


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com</mailto:xxxxx>

you don’t need to free your allocated buffer in post callback
just free the old buffer from pFileObject, allocate a new one (all in preCreate) - system will free your buffer (using ExFreePool)

Petr Kurtin

“Gian-luca Tenti” wrote in message news:xxxxx@ntfsd…
Thank’s for yours aid!!

Now I’m able to redirect an access to a file or directory.

But I’ve to allocate a new buffer (the original is not big enough), so I’ve to free the memory (nonpaged)? And where? (I’v attempt to copy the new buffer pointer to the PRE_OP context pointer, but when in the post op I attempt to free it the system give me a beautiful BSOD.

I return from the PRE_CREATE with SYNCRONIZE (if I don’t use the post op it’s all ok)

Thank’s

______________________________________________________________

Ing. Gian-Luca Tenti

mailto: xxxxx@ibsnetwork.it

IBS s.r.l.

Via Marconi, 102

60015 Falconara Marittima (An)

mailto: xxxxx@ibsnetwork.it

Tel: +39 071 9175737

Fax: +39 071 9174788

------------------------------------------------------------------------------

From: xxxxx@lists.osr.com [mailto:xxxxx@lists.osr.com] On Behalf Of Petr Kurtin
Sent: luned? 31 ottobre 2005 22.02
To: Windows File Systems Devs Interest List
Subject: Re:[ntfsd] Redirection in minidriver

Hello,

change your code:

1) Data->IoStatus.Status = STATUS_REPARSE

2) File name buffer has to be allocated from NonPaged pool

I think you can reuse pFileObject->FileName.Buffer if it’s big enough instead of allocating a new buffer.

bye,

Petr Kurtin

“Gian-luca Tenti” wrote in message news:xxxxx@ntfsd…

Hi,

I’ve read a lot of discussion about the REPARSE command to redirect files open in filter drivers.

I would do the same things with minidriver (I’ve read that should be the futute technology), I’ve do some test with this code:

RtlInitUnicodeString(&us,L"\Device\HarddiskVolume1\Pippo.txt");

pBuffer = (PWCHAR)ExAllocatePool(PagedPool,us.MaximumLength);

RtlCopyMemory(pBuffer,us.Buffer,us.Length);

if(FileObject->FileName.Buffer) {

ExFreePool(FileObject->FileName.Buffer);

}

FileObject->FileName.Length = us.Length;

FileObject->FileName.MaximumLength = us.MaximumLength;

FileObject->FileName.Buffer = pBuffer;

Data->IoStatus.Information = STATUS_REPARSE;

Data->IoStatus.Information = IO_REPARSE;

FltSetCallbackDataDirty( Data );

returnStatus = STATUS_REPARSE;

return returnStatus;

but this don’t work.

What’s wrong?

I’ve to redirect a CREATE from a file in a volume to a file in another volume (eg: C:\Test.txt to D:\Pippo.txt)

I’m a newbie in NTFS developing.

Thank’s to All

Gian-Luca


Questions? First check the IFS FAQ at https://www.osronline.com/article.cfm?id=17

You are currently subscribed to ntfsd as: unknown lmsubst tag argument: ‘’
To unsubscribe send a blank email to xxxxx@lists.osr.com