Non-IMAPI2 error codes (HRESULTs)
I discovered that IDiscFormat2::InitializeDiscRecorder returns 0x80070002 (ERROR_FILE_NOT_FOUND) when you pass it the unique ID of a drive which once existed but has since been safely removed from the system. To detect this situation, I use the following code:
if (SCODE_FACILITY(hr) == FACILITY_WIN32 && SCODE_CODE(hr) == ERROR_FILE_NOT_FOUND)
Is this going to be a reliable method to determine when a drive no longer exists?
I am currently handling a subset of common error codes which are defined in IMAP2ERROR.H or IMAP2FSERROR.H (and return an "unexpected" return code for the rest). I am discovering other codes as I go. I know this may be difficult to answer, but are there any other OLE-defined error codes that are returned forcommon situations such as this but which are not uniquely identified under the IMAPI2 facility umbrella (FACILITY_IMAPI2)?
Hello again Caliendo!
Just to clarify, I believe you meant IDiscRecorder2::InitializeDiscRecorder, correct? :)
First off, just FYI, there should be updated documentation coming out with more specific return values for many of our functions. This will include a list of explicit ERROR_*'s that may come out of our functions as HRESULTs, however it may not be a complete list and is subject to change.
For now, I can tell you that you can reasonably expect to see the following two values come out of IDiscRecorder2 functions that send commands to the drive:
HRESULT_FROM_WIN32(ERROR_DEV_NOT_EXIST)
HRESULT_FROM_WIN32(ERROR_INVALID_HANDLE)
I would say your above code is a reliable method to determine when a drive no longer exists. You could probably simplify this and use the HRESULT_FROM_WIN32 macro that is available in WinError.h if you preferred.
Please let me know if you have any further questions or if I didn't fully answer your original question!
Garrett Jacobson
SDE, Optical Platform Group