Dynamic service GUIDs
Reply #4 – 2010-11-16 14:30:48
I'm a bit curious, when do you instantiate your service factories? You wouldn't believe. I wince looking at how it's done :-D Drum-roll.........BOOL WINAPI DllMain(HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved) { if (fdwReason == DLL_PROCESS_ATTACH) { // Whatever if (n > 0) static dsp_factory_t<foo_vst<0>> dsp; if (n > 1) static dsp_factory_t<foo_vst<1>> dsp; if (n > 2) static dsp_factory_t<foo_vst<2>> dsp; // and so on in a copy-paste style } } I should kill myself for that, shan't I? It does work however. And that's why I have to keep settings in the registry, not in the foobar's configs.I wouldn't worry about crash reports at all regarding this. Most of the information they supply comes from crash location, call path, stack dump, module list etc. I don't remember ever having to look at service GUIDs without their owner being easily apparent by other means while analyzing a crash. The answer I was waiting for. Thanks.So it may also be a good idea to hash up some other identifiers, such as the component name, filename, or even complete path. I thought the same thing. And I think it's not a big deal to generate random GUID if some duplicate UID is to be added to the list. This is where other identifiers should be compared. And if some uncertainty is left after all, then we can still ask user if they insist on adding “duplicate” to the list.