Long File Names

I am facing problem while reparsing with short file names, How do I make
sure that I always get LFN while querying file name with own IRP.

Thanks
Ramaraj


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

At 03:20 PM 5/14/01 -0700, you wrote:

I am facing problem while reparsing with short file names, How do I make
sure that I always get LFN while querying file name with own IRP.

I think you can do the following (this only holds for NTFS):

Before initializing the IRP and calling IoCallDriver:

//
// Zap Fscontext2 (the CCB) so that NTFS will give us the long name
//
if ( hookExt->IsNTFS )
{
fsContext2 = fileObject->FsContext2;
fileObject->FsContext2 = NULL;
}

After your IoCallDriver and KeWaitForSingleObject():

//
// Restore the fscontext
//
if ( hookExt->IsNTFS )
{
fileObject->FsContext2 = fsContext2;
}

BTW, in this case fsContext2 is a local variable.


Bartjan


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Thanks Bartjan.
But Still I am getting the same ie)SFN instead of LFN
Here is what I am doing:
//
// Make sure that we get LFN always
//
FsContext2 = FileObject->FsContext2;
FileObject->FsContext2 = NULL;

//
// Allocate an irp for this request. This could also come from a
// private pool, for instance.
//
irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
if(!irp) {

//
// Failure!
//
return FALSE;
}

//
// Build the IRP’s main body
//
irp->AssociatedIrp.SystemBuffer = FileQueryBuffer;
irp->UserEvent = &event;
irp->UserIosb = &IoStatusBlock;
irp->Tail.Overlay.Thread = PsGetCurrentThread();
irp->Tail.Overlay.OriginalFileObject = FileObject;
irp->RequestorMode = KernelMode;
irp->Flags = 0;

//
// Set up the I/O stack location.
//
ioStackLocation = IoGetNextIrpStackLocation(irp);
ioStackLocation->MajorFunction = IRP_MJ_QUERY_INFORMATION;
ioStackLocation->DeviceObject = DeviceObject;
ioStackLocation->FileObject = FileObject;
ioStackLocation->Parameters.QueryFile.Length = FileQueryBufferLength;
ioStackLocation->Parameters.QueryFile.FileInformationClass =
FileInformationClass;

// Set the completion routine.
//
IoSetCompletionRoutine(irp, PwrFilterQueryFileComplete, 0, TRUE, TRUE,
TRUE);

//
// Send it to the FSD
//
(void) IoCallDriver(DeviceObject, irp);

//
// Wait for the I/O
//
KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0);

//
// Revert it back
//
FileObject->FsContext2 = FsContext2;

-----Original Message-----
From: Bartjan Wattel [mailto:xxxxx@zeelandnet.nl]
Sent: Tuesday, May 15, 2001 2:33 AM
To: File Systems Developers
Subject: [ntfsd] Re: Long File Names

At 03:20 PM 5/14/01 -0700, you wrote:

I am facing problem while reparsing with short file names, How do I make
sure that I always get LFN while querying file name with own IRP.

I think you can do the following (this only holds for NTFS):

Before initializing the IRP and calling IoCallDriver:

//
// Zap Fscontext2 (the CCB) so that NTFS will give us the long name
//
if ( hookExt->IsNTFS )
{
fsContext2 = fileObject->FsContext2;
fileObject->FsContext2 = NULL;
}

After your IoCallDriver and KeWaitForSingleObject():

//
// Restore the fscontext
//
if ( hookExt->IsNTFS )
{
fileObject->FsContext2 = fsContext2;
}

BTW, in this case fsContext2 is a local variable.


Bartjan


You are currently subscribed to ntfsd as: xxxxx@dvdjukebox.com
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com


You are currently subscribed to ntfsd as: $subst(‘Recip.EmailAddr’)
To unsubscribe send a blank email to leave-ntfsd-$subst(‘Recip.MemberIDChar’)@lists.osr.com

Try to use recursive IRP_MJ_DIRECTORY_CONTROL to query BothDirectoryInformation. It seems GetLongPathName function use this way.

Oliver Fu

----- Original Message -----
From: “Ramaraj Pandian”
To: “File Systems Developers”
Sent: Wednesday, May 16, 2001 2:51 AM
Subject: [ntfsd] Re: Long File Names

> Thanks Bartjan.
> But Still I am getting the same ie)SFN instead of LFN
> Here is what I am doing:
> //
> // Make sure that we get LFN always
> //
> FsContext2 = FileObject->FsContext2;
> FileObject->FsContext2 = NULL;
>
> //
> // Allocate an irp for this request. This could also come from a
> // private pool, for instance.
> //
> irp = IoAllocateIrp(DeviceObject->StackSize, FALSE);
> if(!irp) {
>
> //
> // Failure!
> //
> return FALSE;
> }
>
> //
> // Build the IRP’s main body
> //
> irp->AssociatedIrp.SystemBuffer = FileQueryBuffer;
> irp->UserEvent = &event;
> irp->UserIosb = &IoStatusBlock;
> irp->Tail.Overlay.Thread = PsGetCurrentThread();
> irp->Tail.Overlay.OriginalFileObject = FileObject;
> irp->RequestorMode = KernelMode;
> irp->Flags = 0;
>
> //
> // Set up the I/O stack location.
> //
> ioStackLocation = IoGetNextIrpStackLocation(irp);
> ioStackLocation->MajorFunction = IRP_MJ_QUERY_INFORMATION;
> ioStackLocation->DeviceObject = DeviceObject;
> ioStackLocation->FileObject = FileObject;
> ioStackLocation->Parameters.QueryFile.Length = FileQueryBufferLength;
> ioStackLocation->Parameters.QueryFile.FileInformationClass =
> FileInformationClass;
>
> // Set the completion routine.
> //
> IoSetCompletionRoutine(irp, PwrFilterQueryFileComplete, 0, TRUE, TRUE,
> TRUE);
>
> //
> // Send it to the FSD
> //
> (void) IoCallDriver(DeviceObject, irp);
>
>
> //
> // Wait for the I/O
> //
> KeWaitForSingleObject(&event, Executive, KernelMode, TRUE, 0);
>
> //
> // Revert it back
> //
> FileObject->FsContext2 = FsContext2;
>
>
> -----Original Message-----
> From: Bartjan Wattel [mailto:xxxxx@zeelandnet.nl]
> Sent: Tuesday, May 15, 2001 2:33 AM
> To: File Systems Developers
> Subject: [ntfsd] Re: Long File Names
>
>
> At 03:20 PM 5/14/01 -0700, you wrote:
> >I am facing problem while reparsing with short file names, How do I make
> >sure that I always get LFN while querying file name with own IRP.
>
> I think you can do the following (this only holds for NTFS):
>
> Before initializing the IRP and calling IoCallDriver:
>
> //
> // Zap Fscontext2 (the CCB) so that NTFS will give us the long name
> //
> if ( hookExt->IsNTFS )
> {
> fsContext2 = fileObject->FsContext2;
> fileObject->FsContext2 = NULL;
> }
>
> After your IoCallDriver and KeWaitForSingleObject():
>
> //
> // Restore the fscontext
> //
> if ( hookExt->IsNTFS )
> {
> fileObject->FsContext2 = fsContext2;
> }
>
> BTW, in this case fsContext2 is a local variable.
>
> –
> Bartjan
>
>

(???r??z{e?˛???m?m?{_?֬???&j)@u?Ӣ?칻?&ޱ??i?Z?G?j)m?W???~?l??-E?"?Ǧm??(Z?X???,??&