RtlInitUnicodeString(&DestinationString, KeyName);
InitializeObjectAttributes(&ObjectAttributes,
&DestinationString,
- OBJ_CASE_INSENSITIVE,
+ OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
Status = ZwOpenKey(&Handle,
NULL,
0,
&ResultLength);
- if (!ResultLength) return Status;
+ if (!ResultLength)
+ goto Quit;
/* Allocate the buffer for the partial info structure and our integer data */
ResultLength += sizeof(ULONG);
if (!*Buffer)
{
SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC GetRegistryValueBuffer: failed allocation\n");
- return Status;
+ goto Quit;
}
/* Now read the data */
SacFreePool(*Buffer);
}
- /* Return the result */
- SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC SetRegistryValue: Exiting.\n");
+Quit:
+ /* Close the handle and exit */
+ ZwClose(Handle);
+ SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC GetRegistryValueBuffer: Exiting.\n");
return Status;
}
RtlInitUnicodeString(&DestinationString, KeyName);
InitializeObjectAttributes(&ObjectAttributes,
&DestinationString,
- OBJ_CASE_INSENSITIVE,
+ OBJ_CASE_INSENSITIVE | OBJ_KERNEL_HANDLE,
NULL,
NULL);
Status = ZwOpenKey(&Handle,
}
/* Close the handle and exit */
- NtClose(Handle);
+ ZwClose(Handle);
SAC_DBG(SAC_DBG_ENTRY_EXIT, "SAC SetRegistryValue: Exiting.\n");
return Status;
}