| Previous | Next |
| STG_E_INSUFFICIENTMEMORY | STG_E_NOMOREFILES |
STG_E_INVALIDPOINTER
Developer-facing HRESULT
STG_E_INVALIDPOINTER normally points to a caller-side API contract problem. Structured Storage interfaces accept pointers for names, interface outputs, statistics, and buffers. A null pointer where the method requires writable storage, a pointer whose lifetime has ended, an invalid string, or a bad interop declaration can cause this error before the compound file is meaningfully accessed.
It is therefore different from STG_E_INVALIDHEADER or STG_E_DOCFILECORRUPT: those describe the document container; STG_E_INVALIDPOINTER describes the call boundary. If the same file works through another tool, investigate the integration code first.
What to review
- Check the exact method signature and which parameters are mandatory, optional, input-only, or output-only.
- For C#/C++ interop, verify marshalling, structure packing, character encoding, and ownership rules for every pointer-sized parameter.
- Initialize output interface pointers to a known value and release interfaces according to COM reference-counting rules.
- Capture the failing method name; a bare HRESULT without the API call is rarely enough to find the defect.
References
- Microsoft: IStorage::OpenStorage parameter contract
- Microsoft: IStorage::OpenStream parameter contract
- OpenMcdf: cross-language compound-file API
Looking for a different code? Search another status or error code.