filter drivers problem...............

hi everybody
m new to this field.
my problem is …
if m clicking some a:\A.txt then other desired application opens.
and i hav done this problem thru hooking of system functions address with my own functions and i hav succeded in this …
but now i want to do thru Irp major and minor requests and thru the concept of reparsing … and i hav wriiten my code fo create like this below…

#define NEW_NAME_STRING L"\??\c:\example.txt"

NTSTATUS

MYCreate(

IN PDEVICE_OBJECT DeviceObject,

IN PIRP Irp

)

{

NTSTATUS Status;

PFILE_OBJECT FileObject;

PIO_STACK_LOCATION Current;

PUNICODE_STRING FileName;

UNICODE_STRING NewName;

Current = IoGetCurrentIrpStackLocation(Irp);

FileObject = Current->FileObject;

FileName = &FileObject->FileName;

if (FileName->Length && (FileName->Buffer[FileName->Length/2-1] == L’#'))

{

DbgPrint(“Reparsing file %wZ\n”, FileName);

RtlInitUnicodeString(&NewName, NEW_NAME_STRING);

if (FileName->MaximumLength >= sizeof(NewName)+2) {

DbgPrint(“Reusing old buffer!\n”);

} else {

DbgPrint(“Allocating new buffer!\n”);

ExFreePool(FileName->Buffer);// freeing old pool if lenght of new is greater than old one and will allocate new later.

FileName->MaximumLength = sizeof(NewName)+2;

FileName->Buffer = ExAllocatePool(NonPagedPool, FileName->MaximumLength);// allocating new pool for new name acc to his length

}

RtlCopyUnicodeString(FileName, &NewName);// copying new name to File object file name

DbgPrint(“New file is %wZ\n”, FileName);

Irp->IoStatus.Status = STATUS_REPARSE;

Irp->IoStatus.Information = IO_REPARSE;

IoCompleteRequest( Irp, IO_NO_INCREMENT );

return STATUS_REPARSE;

}

DbgPrint(“Opening file %wZ\n”, FileName);

IoSkipCurrentIrpStackLocation( Irp );

// this simply forwards the irp to the FSD below us

Status = IoCallDriver(DeviceObject, Irp);

return Status;

}

and in others functions i hav simply passed the parameters down thru irpskip… and done nothing…
but m still not able to do complete this.
can any body helps me in this … where m wrong…

thnx in advance…
amarpreet singh


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

You are currently subscribed to ntfsd as: xxxxx@yahoo.com
To unsubscribe send a blank email to xxxxx@lists.osr.com


Yahoo! Messenger - Communicate instantly…“Ping” your friends today! Download Messenger Now

As far as I can tell, there is one bug

FileName->MaximumLength = sizeof(NewName)+2;

I see that the NewName is UNICODE_STRING,
so the size is 8 bytes. MaximumLength must be at least
lengh of the string IN BYTES (not in WCHARs).

L.