mirror of
https://github.com/reactos/reactos.git
synced 2025-08-05 16:52:59 +00:00
- RegQueryValueExA: Return the correct data size for binary data types.
svn path=/trunk/; revision=11900
This commit is contained in:
parent
bfbb47d39e
commit
9fbe02e539
1 changed files with 8 additions and 15 deletions
|
@ -1,4 +1,4 @@
|
||||||
/* $Id: reg.c,v 1.63 2004/11/22 16:11:25 ekohl Exp $
|
/* $Id: reg.c,v 1.64 2004/12/02 14:08:27 ekohl 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
|
||||||
|
@ -2443,8 +2443,8 @@ RegQueryValueExA (HKEY hKey,
|
||||||
|
|
||||||
if (lpData)
|
if (lpData)
|
||||||
{
|
{
|
||||||
ValueData.Length = *lpcbData * sizeof(WCHAR);
|
ValueData.Length = 0;
|
||||||
ValueData.MaximumLength = ValueData.Length + sizeof(WCHAR);
|
ValueData.MaximumLength = (*lpcbData + 1) * sizeof(WCHAR);
|
||||||
ValueData.Buffer = RtlAllocateHeap (ProcessHeap,
|
ValueData.Buffer = RtlAllocateHeap (ProcessHeap,
|
||||||
0,
|
0,
|
||||||
ValueData.MaximumLength);
|
ValueData.MaximumLength);
|
||||||
|
@ -2464,16 +2464,13 @@ RegQueryValueExA (HKEY hKey,
|
||||||
RtlCreateUnicodeStringFromAsciiz (&ValueName,
|
RtlCreateUnicodeStringFromAsciiz (&ValueName,
|
||||||
(LPSTR)lpValueName);
|
(LPSTR)lpValueName);
|
||||||
|
|
||||||
if (NULL != lpcbData)
|
Length = (lpcbData == NULL) ? 0 : *lpcbData * sizeof(WCHAR);
|
||||||
{
|
|
||||||
Length = *lpcbData * sizeof(WCHAR);
|
|
||||||
}
|
|
||||||
ErrorCode = RegQueryValueExW (hKey,
|
ErrorCode = RegQueryValueExW (hKey,
|
||||||
ValueName.Buffer,
|
ValueName.Buffer,
|
||||||
lpReserved,
|
lpReserved,
|
||||||
&Type,
|
&Type,
|
||||||
(LPBYTE)ValueData.Buffer,
|
(lpData == NULL) ? NULL : (LPBYTE)ValueData.Buffer,
|
||||||
NULL == lpcbData ? NULL : &Length);
|
&Length);
|
||||||
DPRINT("ErrorCode %lu\n", ErrorCode);
|
DPRINT("ErrorCode %lu\n", ErrorCode);
|
||||||
RtlFreeUnicodeString(&ValueName);
|
RtlFreeUnicodeString(&ValueName);
|
||||||
|
|
||||||
|
@ -2498,13 +2495,9 @@ RegQueryValueExA (HKEY hKey,
|
||||||
}
|
}
|
||||||
Length = Length / sizeof(WCHAR);
|
Length = Length / sizeof(WCHAR);
|
||||||
}
|
}
|
||||||
else if (lpcbData != NULL)
|
else if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL)
|
||||||
{
|
{
|
||||||
Length = min(*lpcbData, Length);
|
RtlMoveMemory(lpData, ValueData.Buffer, Length);
|
||||||
if (ErrorCode == ERROR_SUCCESS && ValueData.Buffer != NULL)
|
|
||||||
{
|
|
||||||
RtlMoveMemory(lpData, ValueData.Buffer, Length);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (lpcbData != NULL)
|
if (lpcbData != NULL)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue