I want to get the file size, and tried to get the ValidDataLength
(assosiated with FSRTL_COMMON_FCB_HEADER) with FileObject->FsContext.
When I copy the ValidDataLength to local variable, I got the difference
value than DbgPrint( “…%X”, pFcb->ValidDataLength) as following code.
Does anyone know, why DbgPrint() print the difference value ?
=== code ===
LONGLONG VLength;
FSRTL_COMMON_FCB_HEADER *pFcb;
pFcb = (FSRTL_COMMON_FCB_HEADER *)(irpStack->FileObject->FsContext);
VLength = pFcb->ValidDataLength.QuadPart;
DbgPrint(“VLength=%d\n”, VLength.QuadPart);
DbgPrint(“VDLen:%d\n”, pFcb->ValidDataLength.QuadPart);
// during FCB access, value may change. Then tried one more time.
DbgPrint(“VLength=%d\n”, VLength.QuadPart);
DbgPrint(“VDLen:%d\n”, pFcb->ValidDataLength.QuadPart);
== end of code ===
----- output ----
VLength=0
VDLen:57344
VLength=0
VDLen:57344
…
VLength=57344
VDLen:114688
VLength=57344
VDLen:114688
…
---- end of output —
Seems that the problem is in size of ValidDataLength.
It is 64-bit value, but “%d” expects 32-bit value.
try DbgPrint(“%lx-%lx”, VLength.HighPart, VLength.LowPart);
L.
> It is 64-bit value, but “%d” expects 32-bit value.
try DbgPrint(“%lx-%lx”, VLength.HighPart, VLength.LowPart);
DbgPrint(“%I64x”, VLength.QuadPart) is also a good idea.
Maxim Shatskih, Windows DDK MVP
StorageCraft Corporation
xxxxx@storagecraft.com
http://www.storagecraft.com
Thank you for your reply.
I tried with “%I64d” and HighPart and LowPart member, and I got the value
(not 0).
But value for local variable and DbgPrint() was difference. yet.
Also, Itried with 3 machines, but one machine have this problem.
OS (Windows XP) and HDD format (NTFS) were same.
Tohru.
You can refer to the DDK Documentation of DbgPrint for your answer?
“Tohru” wrote in message news:xxxxx@ntfsd…
>I want to get the file size, and tried to get the ValidDataLength
> (assosiated with FSRTL_COMMON_FCB_HEADER) with FileObject->FsContext.
> When I copy the ValidDataLength to local variable, I got the difference
> value than DbgPrint( “…%X”, pFcb->ValidDataLength) as following code.
> Does anyone know, why DbgPrint() print the difference value ?
>
> === code ===
> LONGLONG VLength;
> FSRTL_COMMON_FCB_HEADER *pFcb;
> pFcb = (FSRTL_COMMON_FCB_HEADER *)(irpStack->FileObject->FsContext);
> VLength = pFcb->ValidDataLength.QuadPart;
> DbgPrint(“VLength=%d\n”, VLength.QuadPart);
> DbgPrint(“VDLen:%d\n”, pFcb->ValidDataLength.QuadPart);
> // during FCB access, value may change. Then tried one more time.
> DbgPrint(“VLength=%d\n”, VLength.QuadPart);
> DbgPrint(“VDLen:%d\n”, pFcb->ValidDataLength.QuadPart);
> == end of code ===
> ----- output ----
> VLength=0
> VDLen:57344
> VLength=0
> VDLen:57344
> …
> VLength=57344
> VDLen:114688
> VLength=57344
> VDLen:114688
> …
> ---- end of output —
>
>
>