{"id":9143,"date":"2011-11-10T07:00:00","date_gmt":"2011-11-10T07:00:00","guid":{"rendered":"https:\/\/blogs.msdn.microsoft.com\/oldnewthing\/2011\/11\/10\/how-can-i-tell-whether-a-dll-has-been-registered\/"},"modified":"2011-11-10T07:00:00","modified_gmt":"2011-11-10T07:00:00","slug":"how-can-i-tell-whether-a-dll-has-been-registered","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20111110-00\/?p=9143","title":{"rendered":"How can I tell whether a DLL has been registered?"},"content":{"rendered":"<p>A customer pointed out that you can use <code>regsvr32<\/code> to register a DLL or to unregister it, but how do you query whether a DLL has been registered?\n DLL registration (via <code>regsvr32<\/code>) is not declarative; it is procedural. A DLL does not provide a manifest of things it would like to happen when installed. Instead, the DLL merely provides two functions for <code>regsvr32<\/code> to call, one for registration (<code>DllRegisterServer<\/code>) and another for unregistration (<code>DllUnregisterServer<\/code>). All the <code>regsvr32<\/code> function does is call those functions.\n How those functions perform their registration and unregistration is not specified. Most of the time, those functions merely write some registry settings, but the <code>DllRegisterServer<\/code> is not limited to that. For example, the <code>DllRegisterServer<\/code> function might write some values only conditionally, say, only if the user is running a specific version of Windows. Or it might back up the old value of a registry key before it overwrites it. It might create or modify files as part of its installation or configure your firewall settings or look for and uninstall previous versions of the same DLL.\n By convention, the <code>DllRegisterServer<\/code> performs whatever operations are necessary for DLL registration, and the <code>DllUnregisterServer<\/code> reverses those operations, but since those functions are provided by the DLL, there&#8217;s no guarantee that that&#8217;s what actually happens. Who knows, maybe <code>DllRegisterServer<\/code> formats your hard drive. A <code>DllRegisterServer<\/code> function might just return <code>S_OK<\/code> without doing anything. How can you tell whether a function with no side effects has been called?\n Given that DLL registration can encompass arbitrary operations, there is no general-purpose way of determining whether registration has taken place for an arbitrary DLL.<\/p>\n<p> To determine whether a DLL has been registered, you need to bring in domain-specific knowledge. If you know that a DLL registers a COM object with a particular CLSID, you can check whether that CLSID is indeed registered. <\/p>\n","protected":false},"excerpt":{"rendered":"<p>A customer pointed out that you can use regsvr32 to register a DLL or to unregister it, but how do you query whether a DLL has been registered? DLL registration (via regsvr32) is not declarative; it is procedural. A DLL does not provide a manifest of things it would like to happen when installed. Instead, [&hellip;]<\/p>\n","protected":false},"author":1069,"featured_media":111744,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"footnotes":""},"categories":[1],"tags":[26],"class_list":["post-9143","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-other"],"acf":[],"blog_post_summary":"<p>A customer pointed out that you can use regsvr32 to register a DLL or to unregister it, but how do you query whether a DLL has been registered? DLL registration (via regsvr32) is not declarative; it is procedural. A DLL does not provide a manifest of things it would like to happen when installed. Instead, [&hellip;]<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/9143","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/users\/1069"}],"replies":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/comments?post=9143"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/9143\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media\/111744"}],"wp:attachment":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/media?parent=9143"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=9143"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=9143"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}