You can't just use a static class factory for all the classes.
There's no need for GetIDispatchForObject when we already have GetIUnknownForObject (and all you use is QueryInterface).
+ res = RegGetValueA( key, NULL, "Class", RRF_RT_REG_SZ, NULL, classname, &dwBufLen); We should probably use a W function here and convert to utf8, rather than assume that's the default encoding.