mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 18:15:11 +00:00
Added some error checks.
svn path=/trunk/; revision=1973
This commit is contained in:
parent
9d04225d93
commit
9d72cf785d
1 changed files with 26 additions and 9 deletions
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue