Is the file object in question a stream file object
(FO_STREAM_FILE_OBJECT set in the Flags field)?
Can you tell us which file system and OS version on which you are
observing this behavior?
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
Hope to see you at the next OSR file systems class in Boston, MA, March
29, 2004!
-----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Valerino
Sent: Wednesday, February 11, 2004 3:21 AM
To: ntfsd redirect
Subject: Re:[ntfsd] Weird behaviour of ObQueryNameString…
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi Tony,
the IRP_MJ_CLEANUP irp has not been processed yet by the FS(NTFS) on
that fileobject.
In my cleanup dispatch code, i do query the workitem, then i wait on
an event that will be set by the workroutine.
Only after the event has been set i call the underlying FS to
complete the IRP.
And anyway, if i do allocate a proper chunk of memory… say
pBuffer = ExAllocatePool (PagedPool,1024);
Status = ObQueryNameString
(FileObject,(POBJECT_NAME_INFORMATION)pBuffer,1024,&ReturnSize);
(…)
the query in that case works. Its that what puzzles me.
It’s not such a big problem for me to preallocate the buffer, i just
wanted to know why that behaviour differs from what the DDK says.
It’s really simple code, i don’t do anything weird. that query
request is issued at the beginning of the work routine, and the
cleanup dispatch code
just gets the file object from IrpSp and fire the workitem, then
after waiting for it to complete, IoSkipCurrentIrpStackLocation and
call the underlying FS.
Valerio
“Tony Mason” wrote in message news:xxxxx@ntfsd…
Only paging I/O operations are allowed between cleanup and close
inside
of a file system; there is no guarantee that once the IRP_MJ_CLEANUP
has
been processed by the underlying file system that anything OTHER than
a
paging I/O operation (read, write, and certain length management
operations) will work properly. That may or may not be your problem,
but it is worth noting that you shouldn’t expect to be able to call
ObQueryObjectNameString in such a case in any case.
Of course, if you observe this problem with FAT, you should just walk
through the logic in the debugger and see why you observe this
behavior.
Regards,
Tony
Tony Mason
Consulting Partner
OSR Open Systems Resources, Inc.
http://www.osr.com
- -----Original Message-----
From: xxxxx@lists.osr.com
[mailto:xxxxx@lists.osr.com] On Behalf Of Valerino
Sent: Tuesday, February 10, 2004 5:40 PM
To: ntfsd redirect
Subject: [ntfsd] Weird behaviour of ObQueryNameString…
- -----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Hi,
In my FSFD i use ObQueryNameString to obtain the file path from
FileObject.
I just noticed this weird behaviur:
in a code like that in a WorkRoutine triggered by my filter (i just made
a simple snippet for you to check) :
VOID FsWorkRoutine (PVOID Context)
{
PFSWORK_ITEM FsWrkItem = (PFSWORK_ITEM)Context);
ULONG ReturnLength = 0;
NT_STATUS Status;
PVOID pucBuffer = NULL;
// query the needed size to allocate a buffer large enough
Status = ObQueryNameString
(FsWkrItem->FileObject,(POBJECT_NAME_INFORMATION)pucBuffer,0,&Length);
if ((NT_SUCCESS (Status) && (Status != STATUS_INFO_LENGTH_MISMATCH)
{
// allocate buffer of the returned Size
(…)
}
(…)
return;
}
As far as i understood from the DDK, ObQueryNameString should work this
way
:
if i pass 0 as Length parameter, it should return the required size for
the buffer in the last parameter.
Now… in the code above, if Length is 0, it returns
STATUS_INFO_LENGTH_MISMATCH as expected but it DOESN’T update the
ReturnLength parameter.
The same code,allocating a buffer before,and passing the size (let’s
say, 100), works as the DDK says (updated ReturnLength).
What’s weird is i use the same exact code in another part of the driver
and it works.
Btw, the fileobject comes from an IRP_MJ_CLEANUP. In the IRP_MJ_CLEANUP
dispatch i wait on an event that will be set by the workroutine before
completing the IRP, so the fileobejct shouldn’t be invalidated yet when
i’m in the workroutine (there’s no completion routine set). And anyway,
as i said, passing a nonzero size works.
Any ideas ?
Thanks,
Valerio
- -----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBQCld2WGxr2U3nc5EEQIm3QCg2Bk/0iJrXf30znIjGTTpSj4qCi0AoPPX
7KfFKX9qX57B/visLL12tVtL
=63ne
- -----END PGP SIGNATURE-----
- —
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com To unsubscribe
send a blank email to xxxxx@lists.osr.com
-----BEGIN PGP SIGNATURE-----
Version: PGP 8.0
iQA/AwUBQCnl32Gxr2U3nc5EEQLCZQCg4yk/3VEEhpqApiMH4AaKtkhZRj8An24v
OGHtYzZ5vEquhbyQu3gB9gNY
=ZgLl
-----END PGP SIGNATURE-----
—
Questions? First check the IFS FAQ at
https://www.osronline.com/article.cfm?id=17
You are currently subscribed to ntfsd as: xxxxx@osr.com
To unsubscribe send a blank email to xxxxx@lists.osr.com