{"id":108911,"date":"2023-10-20T07:00:00","date_gmt":"2023-10-20T14:00:00","guid":{"rendered":"https:\/\/devblogs.microsoft.com\/oldnewthing\/?p=108911"},"modified":"2023-10-20T06:07:15","modified_gmt":"2023-10-20T13:07:15","slug":"20231020-00","status":"publish","type":"post","link":"https:\/\/devblogs.microsoft.com\/oldnewthing\/20231020-00\/?p=108911","title":{"rendered":"On the failed unrealized promise of <CODE>Reg&shy;Override&shy;Predef&shy;Key<\/CODE>"},"content":{"rendered":"<p>If you go browsing through the Win32 API (a common pastime back in the old days), you may run into the <code>Reg\u00adOverride\u00adPredef\u00adKey<\/code> function, which lets a process redirect one of the predefined keys to a separate registry key. What&#8217;s the idea behind this function?<\/p>\n<p>It&#8217;s explained in the Remarks in the documentation. The idea is that you have a self-registering DLL, and you want to capture the registry changes made by that DLL&#8217;s <code>Dll\u00adRegister\u00adServer<\/code> function, so that you can take the captured registry changes and add them to your product&#8217;s main installer. This allows you to simplify your installer to just &#8220;Copy these files to these locations, and then set these registry keys to these values.&#8221; You took the <code>Dll\u00adRegister\u00adServer<\/code> step out of the equation, which speeds up installation and also simplifies auditing.<\/p>\n<p>That was the idea, but it pretty much never worked in practice.<\/p>\n<p>The trick assumed that all the DLL&#8217;s <code>Dll\u00adRegister\u00adServer<\/code> did was set some registry keys in well-known places (specifically, under <code>HKEY_<wbr \/>CLASSES_<wbr \/>ROOT<\/code>) to hard-coded values. That may have been true in simpler times, but DLLs quickly took advantage of the fact that the <code>Dll\u00adRegister\u00adServer<\/code> function was <i>code<\/i>, so you can add whatever other logic to the function you like. You can look around the system and decide to write different keys depending on what you find. You don&#8217;t even have to limit yourself to writing registry keys! You can create files, call networking APIs, reconfigure the system to your heart&#8217;s content.<\/p>\n<p>The dream of being able to capture the output of a function call into a list of registry keys was too na\u00efve. Real life is more complicated than that.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>An early attempt to sandbox the registry for a process.<\/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":[2],"class_list":["post-108911","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-oldnewthing","tag-history"],"acf":[],"blog_post_summary":"<p>An early attempt to sandbox the registry for a process.<\/p>\n","_links":{"self":[{"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108911","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=108911"}],"version-history":[{"count":0,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/posts\/108911\/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=108911"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/categories?post=108911"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/devblogs.microsoft.com\/oldnewthing\/wp-json\/wp\/v2\/tags?post=108911"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}