GetErrorInfo Function
Obtains the error information pointer set by the previous call to SetErrorInfo in the current logical thread.
HRESULT GetErrorInfo( DWORD dwReserved, IErrorInfo **pperrinfo );
This function returns a pointer to the most recently set IErrorInfo pointer in the current logical thread. It transfers ownership of the error object to the caller, and clears the error state for the thread.
Making a COM call that goes through a proxy-stub will clear any existing error object for the calling thread. A called object should not make any such calls after calling SetErrorInfo and before returning. The caller should not make any such calls after the call returns and before calling GetErrorInfo. As a rule of thumb, an interface method should return as soon as possible after calling SetErrorInfo, and the caller should call GetErrorInfo as soon as possible after the call returns.