{"id":8995,"date":"2023-12-27T00:09:35","date_gmt":"2023-12-27T00:09:35","guid":{"rendered":"https:\/\/www.hexacorn.com\/blog\/?p=8995"},"modified":"2024-12-25T23:20:18","modified_gmt":"2024-12-25T23:20:18","slug":"1-little-known-secret-of-regsvr32-exe-take-two","status":"publish","type":"post","link":"https:\/\/www.hexacorn.com\/blog\/2023\/12\/27\/1-little-known-secret-of-regsvr32-exe-take-two\/","title":{"rendered":"1 little known secret of regsvr32.exe, take two"},"content":{"rendered":"\n<p>There is an archaic feature that <em>regsvr32.exe<\/em> leverages to autoregister libraries associated with file extensions.<\/p>\n\n\n\n<p>For this to work, it expects an <em>AutoRegister<\/em> key to be present under the file extension handler with a default value pointing to the library f.ex:<\/p>\n\n\n\n<p>file extension entry: txt -> txtfile<br>file handler: txtfile <br>autoregister entry: txtfile\\AutoRegister\\{Default}=&lt;Library><\/p>\n\n\n\n<p>As such, one can use <em>regsvr32.exe<\/em> to load library of their choice without passing it as a command line argument to the program!<\/p>\n\n\n\n<p>Let&#8217;s see an example for the <em>txtfile<\/em>:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">reg add HKEY_CLASSES_ROOT\\txtfile\\AutoRegister \/ve \/d c:\\test\\bar.dll\n\necho > foo.txt\n\nregsvr32 foo.txt<\/pre>\n\n\n\n<figure class=\"wp-block-image size-full\"><a href=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/12\/regsvr32_2.gif\"><img decoding=\"async\" loading=\"lazy\" width=\"783\" height=\"333\" src=\"https:\/\/www.hexacorn.com\/blog\/wp-content\/uploads\/2023\/12\/regsvr32_2.gif\" alt=\"\" class=\"wp-image-8996\"\/><\/a><\/figure>\n\n\n\n<p>The <em>AutoRegister<\/em> feature requires the library supporting this feature to export a function called <em>DllRegisterServerEx<\/em>, but in my example I didn&#8217;t even bother as I just wanted to demo the DllMain Load&#8230;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>There is an archaic feature that regsvr32.exe leverages to autoregister libraries associated with file extensions. For this to work, it expects an AutoRegister key to be present under the file extension handler with a default value pointing to the library &hellip; <a href=\"https:\/\/www.hexacorn.com\/blog\/2023\/12\/27\/1-little-known-secret-of-regsvr32-exe-take-two\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[126,56,64],"tags":[],"_links":{"self":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8995"}],"collection":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/comments?post=8995"}],"version-history":[{"count":1,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8995\/revisions"}],"predecessor-version":[{"id":8997,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/posts\/8995\/revisions\/8997"}],"wp:attachment":[{"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/media?parent=8995"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/categories?post=8995"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hexacorn.com\/blog\/wp-json\/wp\/v2\/tags?post=8995"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}