mirror of
https://github.com/reactos/reactos.git
synced 2024-12-28 10:04:49 +00:00
Fixed name string length and termination for KeyValueBasicInformation and KeyValueFullInformation.
svn path=/trunk/; revision=2602
This commit is contained in:
parent
1815855fb6
commit
5d67a14618
1 changed files with 29 additions and 33 deletions
|
@ -374,26 +374,23 @@ NtEnumerateKey (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtEnumerateValueKey(IN HANDLE KeyHandle,
|
||||||
NtEnumerateValueKey (
|
IN ULONG Index,
|
||||||
IN HANDLE KeyHandle,
|
IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
||||||
IN ULONG Index,
|
OUT PVOID KeyValueInformation,
|
||||||
IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
IN ULONG Length,
|
||||||
OUT PVOID KeyValueInformation,
|
OUT PULONG ResultLength)
|
||||||
IN ULONG Length,
|
|
||||||
OUT PULONG ResultLength
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
PREGISTRY_FILE RegistryFile;
|
PREGISTRY_FILE RegistryFile;
|
||||||
PKEY_BLOCK KeyBlock;
|
PKEY_BLOCK KeyBlock;
|
||||||
PVALUE_BLOCK ValueBlock;
|
PVALUE_BLOCK ValueBlock;
|
||||||
PDATA_BLOCK DataBlock;
|
PDATA_BLOCK DataBlock;
|
||||||
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
|
PKEY_VALUE_BASIC_INFORMATION ValueBasicInformation;
|
||||||
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
|
PKEY_VALUE_PARTIAL_INFORMATION ValuePartialInformation;
|
||||||
PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
|
PKEY_VALUE_FULL_INFORMATION ValueFullInformation;
|
||||||
|
|
||||||
|
|
||||||
/* Verify that the handle is valid and is a registry key */
|
/* Verify that the handle is valid and is a registry key */
|
||||||
|
@ -494,14 +491,15 @@ NtEnumerateValueKey (
|
||||||
ValueFullInformation->Type = ValueBlock->DataType;
|
ValueFullInformation->Type = ValueBlock->DataType;
|
||||||
ValueFullInformation->DataOffset =
|
ValueFullInformation->DataOffset =
|
||||||
(DWORD)ValueFullInformation->Name - (DWORD)ValueFullInformation
|
(DWORD)ValueFullInformation->Name - (DWORD)ValueFullInformation
|
||||||
+ (ValueBlock->NameSize ) * sizeof(WCHAR);
|
+ (ValueBlock->NameSize + 1) * sizeof(WCHAR);
|
||||||
ValueFullInformation->DataOffset =
|
ValueFullInformation->DataOffset =
|
||||||
(ValueFullInformation->DataOffset +3) &0xfffffffc;
|
(ValueFullInformation->DataOffset +3) &0xfffffffc;
|
||||||
ValueFullInformation->DataLength = ValueBlock->DataSize & LONG_MAX;
|
ValueFullInformation->DataLength = ValueBlock->DataSize & LONG_MAX;
|
||||||
ValueFullInformation->NameLength =
|
ValueFullInformation->NameLength =
|
||||||
(ValueBlock->NameSize ) * sizeof(WCHAR);
|
(ValueBlock->NameSize + 1) * sizeof(WCHAR);
|
||||||
mbstowcs(ValueFullInformation->Name, ValueBlock->Name
|
mbstowcs(ValueFullInformation->Name, ValueBlock->Name
|
||||||
,ValueBlock->NameSize*2);
|
,ValueBlock->NameSize*2);
|
||||||
|
ValueFullInformation->Name[ValueBlock->NameSize]=0;
|
||||||
if(ValueBlock->DataSize >0)
|
if(ValueBlock->DataSize >0)
|
||||||
{
|
{
|
||||||
DataBlock = CmiGetBlock(RegistryFile, ValueBlock->DataOffset,NULL);
|
DataBlock = CmiGetBlock(RegistryFile, ValueBlock->DataOffset,NULL);
|
||||||
|
@ -853,16 +851,13 @@ NtQueryKey (
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NTSTATUS
|
NTSTATUS STDCALL
|
||||||
STDCALL
|
NtQueryValueKey(IN HANDLE KeyHandle,
|
||||||
NtQueryValueKey (
|
IN PUNICODE_STRING ValueName,
|
||||||
IN HANDLE KeyHandle,
|
IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
||||||
IN PUNICODE_STRING ValueName,
|
OUT PVOID KeyValueInformation,
|
||||||
IN KEY_VALUE_INFORMATION_CLASS KeyValueInformationClass,
|
IN ULONG Length,
|
||||||
OUT PVOID KeyValueInformation,
|
OUT PULONG ResultLength)
|
||||||
IN ULONG Length,
|
|
||||||
OUT PULONG ResultLength
|
|
||||||
)
|
|
||||||
{
|
{
|
||||||
NTSTATUS Status;
|
NTSTATUS Status;
|
||||||
PKEY_OBJECT KeyObject;
|
PKEY_OBJECT KeyObject;
|
||||||
|
@ -979,13 +974,14 @@ NtQueryValueKey (
|
||||||
ValueFullInformation->Type = ValueBlock->DataType;
|
ValueFullInformation->Type = ValueBlock->DataType;
|
||||||
ValueFullInformation->DataOffset =
|
ValueFullInformation->DataOffset =
|
||||||
(DWORD)ValueFullInformation->Name - (DWORD)ValueFullInformation
|
(DWORD)ValueFullInformation->Name - (DWORD)ValueFullInformation
|
||||||
+ (ValueBlock->NameSize ) * sizeof(WCHAR);
|
+ (ValueBlock->NameSize + 1) * sizeof(WCHAR);
|
||||||
ValueFullInformation->DataOffset =
|
ValueFullInformation->DataOffset =
|
||||||
(ValueFullInformation->DataOffset +3) &0xfffffffc;
|
(ValueFullInformation->DataOffset +3) &0xfffffffc;
|
||||||
ValueFullInformation->DataLength = ValueBlock->DataSize & LONG_MAX;
|
ValueFullInformation->DataLength = ValueBlock->DataSize & LONG_MAX;
|
||||||
ValueFullInformation->NameLength =
|
ValueFullInformation->NameLength =
|
||||||
(ValueBlock->NameSize ) * sizeof(WCHAR);
|
(ValueBlock->NameSize + 1) * sizeof(WCHAR);
|
||||||
mbstowcs(ValueFullInformation->Name, ValueBlock->Name,ValueBlock->NameSize*2);
|
mbstowcs(ValueFullInformation->Name, ValueBlock->Name,ValueBlock->NameSize*2);
|
||||||
|
ValueFullInformation->Name[ValueBlock->NameSize] = 0;
|
||||||
if(ValueBlock->DataSize >0)
|
if(ValueBlock->DataSize >0)
|
||||||
{
|
{
|
||||||
DataBlock = CmiGetBlock(RegistryFile, ValueBlock->DataOffset,NULL);
|
DataBlock = CmiGetBlock(RegistryFile, ValueBlock->DataOffset,NULL);
|
||||||
|
|
Loading…
Reference in a new issue