- offset.QuadPart = 0;
- size.u.LowPart = 0xffffffff;
- size.u.HighPart = 0xffffffff;
- return IWICStream_InitializeFromIStreamRegion(iface, pIStream, offset, size);
What prevents you from discovering correct stream size?
The size passed to InitializeFromIStreamRegion is an upper limit. If the underlying stream is smaller, the appropriate size will still be reported from Read, Stat, and Seek.