static HRESULT load_IFD_entry(IStream *input, const struct IFD_entry *entry,
MetadataItem *item, BOOL native_byte_order)
{
- ULONG count, value, i;
+ ULONG count, value, i, bytesread;
SHORT type;
LARGE_INTEGER pos;
HRESULT hr;
item->value.vt |= VT_VECTOR;
item->value.u.caub.cElems = count;
- item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count);
+ item->value.u.caub.pElems = HeapAlloc(GetProcessHeap(), 0, count);
if (!item->value.u.caub.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caub.pElems, count, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.caub.pElems, count, &bytesread);
+ if (bytesread != count) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.caub.pElems);
return hr;
item->value.vt |= VT_VECTOR;
item->value.u.caui.cElems = count;
- item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 2);
+ item->value.u.caui.pElems = HeapAlloc(GetProcessHeap(), 0, count * 2);
if (!item->value.u.caui.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.caui.pElems, count * 2, &bytesread);
+ if (bytesread != count * 2) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.caui.pElems);
return hr;
item->value.vt |= VT_VECTOR;
item->value.u.caul.cElems = count;
- item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 4);
+ item->value.u.caul.pElems = HeapAlloc(GetProcessHeap(), 0, count * 4);
if (!item->value.u.caul.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.caul.pElems, count * 4, &bytesread);
+ if (bytesread != count * 4) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.caul.pElems);
return hr;
hr = IStream_Seek(input, pos, SEEK_SET, NULL);
if (FAILED(hr)) return hr;
- hr = IStream_Read(input, &ull, sizeof(ull), NULL);
+ hr = IStream_Read(input, &ull, sizeof(ull), &bytesread);
+ if (bytesread != sizeof(ull)) hr = E_FAIL;
if (hr != S_OK) return hr;
item->value.u.uhVal.QuadPart = ull;
{
item->value.vt |= VT_VECTOR;
item->value.u.cauh.cElems = count;
- item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count * 8);
+ item->value.u.cauh.pElems = HeapAlloc(GetProcessHeap(), 0, count * 8);
if (!item->value.u.cauh.pElems) return E_OUTOFMEMORY;
pos.QuadPart = value;
HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
return hr;
}
- hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.cauh.pElems, count * 8, &bytesread);
+ if (bytesread != count * 8) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.cauh.pElems);
return hr;
}
break;
case IFD_ASCII:
- item->value.u.pszVal = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count + 1);
+ item->value.u.pszVal = HeapAlloc(GetProcessHeap(), 0, count + 1);
if (!item->value.u.pszVal) return E_OUTOFMEMORY;
if (count <= 4)
HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
return hr;
}
- hr = IStream_Read(input, item->value.u.pszVal, count, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.pszVal, count, &bytesread);
+ if (bytesread != count) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.pszVal);
return hr;
break;
}
- item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, count);
+ item->value.u.blob.pBlobData = HeapAlloc(GetProcessHeap(), 0, count);
if (!item->value.u.blob.pBlobData) return E_OUTOFMEMORY;
item->value.u.blob.cbSize = count;
HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
return hr;
}
- hr = IStream_Read(input, item->value.u.blob.pBlobData, count, NULL);
- if (FAILED(hr))
+ hr = IStream_Read(input, item->value.u.blob.pBlobData, count, &bytesread);
+ if (bytesread != count) hr = E_FAIL;
+ if (hr != S_OK)
{
HeapFree(GetProcessHeap(), 0, item->value.u.blob.pBlobData);
return hr;