TRUNCATE_EXISTING - part 2

The reason I asked the previous question about this is the following:

When I try a test on NT4 and try the same test on Win2K,
I get different results when opening a file with
TRUNCATE_EXISTING specified:

Here’s what the win32 API calls looks like:

hFile = CreateFile(
FileName, // lpFileName
GENERIC_READ | GENERIC_WRITE, // dwDesiredAccess
0, // dwSharedMode
NULL, // lpSecurityAttribs
TRUNCATE_EXISTING, // dwCreationDistrib
FILE_ATTRIBUTE_NORMAL, // dwFlags/Attribs
NULL); // hTemplateFile

// cause a IRP_MJ_QUERY_INFORMATION GetFileInformation IRP
printf(“File size after open: %d\n”, GetFileSize(hFile, NULL));

// Now do a read
if ( !ReadFile( hFile, dest, sizeof(dest), &dwBytesRead, NULL) )
{
nEC = GetLastError();
printf(“ReadFile() failed %08X\n”, GetErrorMessage(nEC));
}
else
{
printf(“TRUNCATE_EXISTING failed to truncate file”);
}
CloseHandle(hFile);

The following output is my trace info using DbgPrint.
The order of IRPs in this output corresponds with filemon’s
output too.

Case #1 - remote client on winnt4, talking to my FSD on win2k:

Notice that the “GetFileInfo 2” call happens BEFORE the system
sends in the IRP for SetFileInformation (AllocationInformation).
The system sends in this IRP because the Win32 User Mode
application did the open with TRUNCATE_EXISTING specified as
a disposition option.

MYFSD: (Open) - AllocationSize = 4096, FileSize = 69, FileName = nt4ll.txt
MYFSD: (GetFileInfo 2) - FileSize is 69, FileName is nt4ll.txt
MYFSD: (SetAllocFixUpFcbSizes) - FileSize is 0, FileName is nt4ll.txt
MYFSD: (Read) Offset (0) >= EndOfFile (0), returning EOF
MYFSD: (Cleanup) - FileSize is 0, FileName is nt4ll.txt
MYFSD: (Close 2), FileSize is 0, FileName is nt4ll.txt

Case #2 - Local client in Win2k where my FSD is running:

Notice that the “GetFileInfo 2” call happens after the system
sends in the IRP for SetFileInformation (AllocationInformation).

FSD: (Open) - AllocationSize = 4096, FileSize = 69, FileName = \nt5aa.txt
FSD: SetAllocFixUpFcbSizes, FileSize is 0, FileName is \nt5aa.txt
FSD: GetFileInfo 2, FileSize is 0, FileName is \nt5aa.txt
FSD: (Read) Offset (0) >= EndOfFile (0), returning EOF
FSD: Cleanup, FileSize is 0, FileName is \nt5aa.txt
FSD: Close 2, FileSize is 0, FileName is \nt5aa.txt

Case #2 is how it should work. Case #2 is also what happens when the
test is run on the local hard disk (NTFS) on the winnt4 machine.
Case #1 returns the wrong file size when the GetFileSize API call
executes.

Has anyone seen this problem before, and if so, how do I get around it?

Thanks

gap