Added some error checks.

svn path=/trunk/; revision=1973
This commit is contained in:
Eric Kohl 2001-06-16 09:49:45 +00:00
parent 9d04225d93
commit 9d72cf785d

View file

@ -115,8 +115,12 @@ CmiCreateRegistry(PWSTR Filename)
DWORD FreeOffset;
int i, j;
BLOCK_OFFSET BlockOffset;
DPRINT1("CmiCreateRegistry() Filename '%S'\n", Filename);
RegistryFile = ExAllocatePool(NonPagedPool, sizeof(REGISTRY_FILE));
CHECKPOINT1;
if (RegistryFile == NULL)
return NULL;
CHECKPOINT1;
if (Filename != NULL)
{
UNICODE_STRING TmpFileName;
@ -176,8 +180,21 @@ CmiCreateRegistry(PWSTR Filename)
RegistryFile->HeaderBlock,
sizeof(HEADER_BLOCK),
&fileOffset, 0);
ZwQueryInformationFile(FileHandle,&IoSB,&fsi
if (!NT_SUCCESS(Status))
{
ExFreePool(RegistryFile->Filename);
RegistryFile->Filename = NULL;
return NULL;
}
Status = ZwQueryInformationFile(FileHandle,&IoSB,&fsi
,sizeof(fsi),FileStandardInformation);
if (!NT_SUCCESS(Status))
{
ExFreePool(RegistryFile->Filename);
RegistryFile->Filename = NULL;
return NULL;
}
RegistryFile->FileSize = fsi.EndOfFile.u.LowPart;
RegistryFile->BlockListSize = RegistryFile->FileSize / 4096 -1;
// RegistryFile->NumberOfBlocks = RegistryFile->BlockListSize;