Short of writing a function manually that translates a few known REFIID to names, such as:
if (riid == IID_IUnknown) return "IUnknown";
if (riid == IID_IShellBrowser) return "IShellBrowser";
...
Is there a system call that would return a reasonable debugging string for well-known (or even all) REFIIDs?
Thanks for the responses. Below is what I came up with based on your feedback - much appreciated!
CString ToString(const GUID & guid)
{
// could use StringFromIID() - but that requires managing an OLE string
CString str;
str.Format(_T("%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X"),
guid.Data1,
guid.Data2,
guid.Data3,
guid.Data4[0],
guid.Data4[1],
guid.Data4[2],
guid.Data4[3],
guid.Data4[4],
guid.Data4[5],
guid.Data4[6],
guid.Data4[7]);
return str;
}
CString GetNameOf(REFIID riid)
{
CString name(ToString(riid));
try
{
// attempt to lookup the interface name from the registry
RegistryKey::OpenKey(HKEY_CLASSES_ROOT, "Interface", KEY_READ).OpenSubKey("{"+name+"}", KEY_READ).GetDefaultValue(name);
}
catch (...)
{
// use simple string representation if no registry entry found
}
return name;
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With