Do not zero memory in RegQueryValueExW and handle the error cases better way.

svn path=/trunk/; revision=7216
This commit is contained in:
Filip Navara 2003-12-24 21:23:03 +00:00
parent 2105eedbc7
commit 822a987bc4

View file

@ -1,4 +1,4 @@
/* $Id: reg.c,v 1.36 2003/12/23 22:00:54 navaraf Exp $ /* $Id: reg.c,v 1.37 2003/12/24 21:23:03 navaraf Exp $
* *
* COPYRIGHT: See COPYING in the top level directory * COPYRIGHT: See COPYING in the top level directory
* PROJECT: ReactOS system libraries * PROJECT: ReactOS system libraries
@ -2123,7 +2123,7 @@ RegQueryValueExW (HKEY hKey,
lpValueName); lpValueName);
BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + *lpcbData; BufferSize = sizeof (KEY_VALUE_PARTIAL_INFORMATION) + *lpcbData;
ValueInfo = RtlAllocateHeap (ProcessHeap, ValueInfo = RtlAllocateHeap (ProcessHeap,
HEAP_ZERO_MEMORY, 0,
BufferSize); BufferSize);
if (ValueInfo == NULL) if (ValueInfo == NULL)
{ {
@ -2142,11 +2142,13 @@ RegQueryValueExW (HKEY hKey,
{ {
/* Return ERROR_SUCCESS and the buffer space needed for a successful call */ /* Return ERROR_SUCCESS and the buffer space needed for a successful call */
ErrorCode = ERROR_SUCCESS; ErrorCode = ERROR_SUCCESS;
ValueInfo->DataLength = 0;
} }
else if (!NT_SUCCESS(Status)) else if (!NT_SUCCESS(Status))
{ {
ErrorCode = RtlNtStatusToDosError (Status); ErrorCode = RtlNtStatusToDosError (Status);
SetLastError (ErrorCode); SetLastError (ErrorCode);
ValueInfo->DataLength = 0;
} }
else else
{ {