ZwSetInformationFile problem on Vista. Help

Hi gurus. I can’t solve strange problem I’ve encountered on Vista.

Here is code which driving crazy for the last 2 days:

OBJECT_ATTRIBUTES oa;
UNICODE_STRING usFile;
FILE_END_OF_FILE_INFORMATION EndOfFileInfo;
WCHAR szName[260]={0};
wcscpy(szName,L"\??\c:\xxx.tmp");

RtlInitUnicodeString(&usFile,szName);

InitializeObjectAttributes(&oa,&usFile,OBJ_KERNEL_HANDLE|OBJ_CASE_INSENSITIVE,0,0);

Status=ZwCreateFile(&hFile,GENERIC_ALL ,&oa,&iosb,
NULL,
FILE_ATTRIBUTE_NORMAL,
FILE_SHARE_READ|FILE_SHARE_WRITE,
FILE_OVERWRITE_IF,
FILE_NON_DIRECTORY_FILE|
FILE_RANDOM_ACCESS,
0,
0);
if(!NT_SUCCESS(Status))
{

}

EndOfFileInfo.EndOfFile.QuadPart=5;

Status=ZwSetInformationFile(hFile,0,&EndOfFileInfo,sizeof(FILE_END_OF_FILE_INFORMATION),FileEndOfFileInformation);

Status=ZwSetInformationFile(hFile,0,&EndOfFileInfo,sizeof(FILE_END_OF_FILE_INFORMATION),FileAllocationInformation);

Both calls to ZwSetInformationFile fails with status STATUS_ACCESS_VIOLATION.

Can anybody point me what is wrong. This code works fine on WXP and WNET. But Vista don’t. Vista Ultimate x86, UAC off.

Thanx in advance.

> Status=ZwSetInformationFile(hFile,0,&EndOfFileInfo,sizeof(FILE_END_OF_FILE_INFORMATION),FileEndOfFileInformation);

Status=ZwSetInformationFile(hFile,0,&EndOfFileInfo,sizeof(FILE_END_OF_FILE_INFORMATION),FileAllocationInformation);

Pointer to IO_STATUS_BLOCK is set to NULL ?

L.

Oops.

Thanx Ladislav. But why does ti work on WXP and WNET?