{"id":109815,"date":"2024-05-28T07:00:00","date_gmt":"2024-05-28T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=109815"},"modified":"2024-05-28T14:00:07","modified_gmt":"2024-05-28T21:00:07","slug":"20240528-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20240528-00\/?p=109815","title":{"rendered":"How can I force a DLL to register itself if it won&#8217;t respond to <CODE>regsvr32<\/CODE>?"},"content":{"rendered":"<p>A customer was having trouble registering a DLL.<\/p>\n<blockquote class=\"q\"><p>We are trying to use the <code>regsvr32<\/code> command to register a DLL that is not already registered, but the command is not working. We get the message &#8220;The module &#8216;contoso.dll&#8217; was loaded but the entry-point DllRegisterServer was not found. Make sure that &#8216;contoso.dll&#8217; is a valid DLL or OCX file and try again.&#8221; How can we force contoso.dll to be registered?<\/p><\/blockquote>\n<p>Registering a DLL is not a formally-defined operation. It&#8217;s a general way of saying &#8220;Do whatever is required to make it possible to use the DLL in the manner it was intended.&#8221; For DLLs that are COM servers, this typically means creating registry keys to advertise the DLL&#8217;s objects.<\/p>\n<p>There is a convention for DLLs that if they know how to register themselves, they can export a function under the well-known name <code>Dll\u00adRegister\u00adServer<\/code>, and the function must <a title=\"DllRegisterServer\" href=\"https:\/\/learn.microsoft.com\/windows\/win32\/api\/olectl\/nf-olectl-dllregisterserver\"> follow certain rules<\/a>. Furthermore, a DLL that supports <code>Dll\u00adRegister\u00adServer<\/code> advertises the fact by adding the string <code>OLESelfRegister<\/code> to their version string file info.<\/p>\n<p>But there is no rule that requires any arbitrary DLL to support this feature.<\/p>\n<p>From the error message, it is apparent that the <code>contoso.dll<\/code> does not support this optional feature. You can&#8217;t force it to support a feature any more than you can force a program to support the <tt>-?<\/tt> option or force a book to have a happy ending.<\/p>\n<p>The idea of self-registration comes from the days of ActiveX, when the idea was that users could go to a Web page and install components directly off the Internet. The system would use the <code>Dll\u00adRegister\u00adServer<\/code> function to tell the DLL, &#8220;Okay, you&#8217;ve just been downloaded. Please do whatever is required so that Web pages can start using you.&#8221;<\/p>\n<p>ActiveX as a Web technology is dead. Nobody uses it any more. The problem that <code>Dll\u00adRegister\u00adServer<\/code> was created to solve no longer exists. But the idea of <code>Dll\u00adRegister\u00adServer<\/code> still carries on. There is nothing inherently Internet-related about <code>Dll\u00adRegister\u00adServer<\/code>, and some people still use it to decentralize their setup programs: Instead of putting all of the settings required by their program in one massive file, they let each DLL be responsible for its part of the project.<\/p>\n<p>But the authors of <code>contoso.dll<\/code> didn&#8217;t do that. The work of setting up the system so that the <code>contoso.dll<\/code> file is ready to use is handled by whatever program installed <code>contoso.dll<\/code>. If you need to register <code>contoso.dll<\/code>, you&#8217;ll have to run its setup program.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can&#8217;t force something that isn&#8217;t there.<\/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":[104],"class_list":["post-109815","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-tipssupport"],"acf":[],"blog_post_summary":"<p>You can&#8217;t force something that isn&#8217;t there.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109815","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=109815"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/109815\/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=109815"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=109815"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=109815"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}