Properly resize the buffer based on ERROR_MORE_DATA.
Also remember to free the allocated buffer.
This commit is contained in:
parent
0f394ae6dc
commit
9170cc8225
|
@ -873,9 +873,18 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
|
|||
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
|
||||
NULL, (LPBYTE)full_buffer, &full_buffer_size);
|
||||
|
||||
if (rc == ERROR_MORE_DATA)
|
||||
{
|
||||
HeapFree(GetProcessHeap(),0,full_buffer);
|
||||
full_buffer_size+=sizeof(WCHAR);
|
||||
full_buffer = HeapAlloc(GetProcessHeap(),0,full_buffer_size);
|
||||
rc = RegEnumValueW(key, iIndex, lpQualifierBuf, pcchQualifierBuf, NULL,
|
||||
NULL, (LPBYTE)full_buffer, &full_buffer_size);
|
||||
}
|
||||
|
||||
RegCloseKey(key);
|
||||
|
||||
if (rc == ERROR_SUCCESS || rc == ERROR_MORE_DATA)
|
||||
if (rc == ERROR_SUCCESS)
|
||||
{
|
||||
if (lpApplicationDataBuf && pcchApplicationDataBuf)
|
||||
{
|
||||
|
@ -898,6 +907,8 @@ UINT WINAPI MsiEnumComponentQualifiersW( LPWSTR szComponent, DWORD iIndex,
|
|||
debugstr_w(lpApplicationDataBuf));
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(),0,full_buffer);
|
||||
|
||||
return rc;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue