Initialize the output buffer parameters to 0 in RegQueryValue*
functions. This is important specially when there's no data to return.
This commit is contained in:
parent
f4b6e82b84
commit
7a0c2e6294
|
@ -2504,6 +2504,9 @@ DWORD WINAPI RegQueryValueExW( HKEY hkey, LPWSTR lpValueName,
|
||||||
if ((lpbData && ! lpcbData) || lpdwReserved)
|
if ((lpbData && ! lpcbData) || lpdwReserved)
|
||||||
return ERROR_INVALID_PARAMETER;
|
return ERROR_INVALID_PARAMETER;
|
||||||
|
|
||||||
|
if (lpbData && lpcbData)
|
||||||
|
memset(lpbData,0,*lpcbData);
|
||||||
|
|
||||||
/* An empty name string is equivalent to NULL */
|
/* An empty name string is equivalent to NULL */
|
||||||
if (lpValueName && !*lpValueName)
|
if (lpValueName && !*lpValueName)
|
||||||
lpValueName = NULL;
|
lpValueName = NULL;
|
||||||
|
@ -2573,6 +2576,9 @@ DWORD WINAPI RegQueryValueW( HKEY hkey, LPCWSTR lpszSubKey, LPWSTR lpszData,
|
||||||
TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_w(lpszSubKey),lpszData,
|
TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_w(lpszSubKey),lpszData,
|
||||||
lpcbData?*lpcbData:0);
|
lpcbData?*lpcbData:0);
|
||||||
|
|
||||||
|
if (lpszData && lpcbData)
|
||||||
|
memset(lpszData,0,*lpcbData);
|
||||||
|
|
||||||
/* Only open subkey, if we really do descend */
|
/* Only open subkey, if we really do descend */
|
||||||
if (lpszSubKey && *lpszSubKey) {
|
if (lpszSubKey && *lpszSubKey) {
|
||||||
ret = RegOpenKeyW( hkey, lpszSubKey, &xhkey );
|
ret = RegOpenKeyW( hkey, lpszSubKey, &xhkey );
|
||||||
|
@ -2615,6 +2621,9 @@ DWORD WINAPI RegQueryValueExA( HKEY hkey, LPSTR lpszValueName,
|
||||||
{ return ERROR_INVALID_PARAMETER;
|
{ return ERROR_INVALID_PARAMETER;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (lpbData && lpcbData)
|
||||||
|
memset(lpbData,0,*lpcbData);
|
||||||
|
|
||||||
lpszValueNameW = lpszValueName ? strdupA2W(lpszValueName) : NULL;
|
lpszValueNameW = lpszValueName ? strdupA2W(lpszValueName) : NULL;
|
||||||
|
|
||||||
/* get just the type first */
|
/* get just the type first */
|
||||||
|
@ -2685,6 +2694,9 @@ DWORD WINAPI RegQueryValueA( HKEY hkey, LPCSTR lpszSubKey, LPSTR lpszData,
|
||||||
TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_a(lpszSubKey),lpszData,
|
TRACE(reg,"(%x,%s,%p,%ld)\n",hkey,debugstr_a(lpszSubKey),lpszData,
|
||||||
lpcbData?*lpcbData:0);
|
lpcbData?*lpcbData:0);
|
||||||
|
|
||||||
|
if (lpszData && lpcbData)
|
||||||
|
memset(lpszData,0,*lpcbData);
|
||||||
|
|
||||||
if (lpszSubKey && *lpszSubKey) {
|
if (lpszSubKey && *lpszSubKey) {
|
||||||
ret = RegOpenKey16( hkey, lpszSubKey, &xhkey );
|
ret = RegOpenKey16( hkey, lpszSubKey, &xhkey );
|
||||||
if( ret != ERROR_SUCCESS )
|
if( ret != ERROR_SUCCESS )
|
||||||
|
|
Loading…
Reference in New Issue