{"id":725,"date":"2011-08-02T10:40:18","date_gmt":"2011-08-01T22:40:18","guid":{"rendered":"https:\/\/www.deltics.co.nz\/blog\/?p=725"},"modified":"2011-08-02T10:40:18","modified_gmt":"2011-08-01T22:40:18","slug":"finalbuilder-and-delphi-64-bit-registry-gotcha","status":"publish","type":"post","link":"https:\/\/www.deltics.co.nz\/blog\/posts\/725\/","title":{"rendered":"FinalBuilder and Delphi: 64-Bit Registry Gotcha"},"content":{"rendered":"<span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">2<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span><p>Just a short post to share something I learned the hard way today when moving a <strong>FinalBuilder<\/strong> installation from a <strong>32-bit Windows<\/strong> server to a shiny new <strong>64-bit Windows 2008<\/strong> server on our even shinier new <strong>HyperV<\/strong> platform: \u00a0The 64-bit registry can catch you out.<\/p>\n<p><!--more-->The registry on 64-bit Windows (as probably everybody but me knows) contains both 32-bit and 64-bit keys. \u00a0But the 32-bit keys are effectively redirected for keys in the <strong>Software<\/strong> branches:<\/p>\n<ul>\n<li>HKEY_LOCAL_MACHINE\\Software<\/li>\n<li>HKEY_CURRENT_USER\\Software<\/li>\n<\/ul>\n<p>On a 64-bit Windows system if you explore these keys using <strong>regedit<\/strong> you will find a sub-key:<\/p>\n<ul>\n<li>HKEY_LOCAL_MACHINE\\Software\\<strong>Wow6432Node<\/strong><\/li>\n<li>HKEY_CURRENT_USER\\Software\\<strong>Wow6432Node<\/strong><\/li>\n<\/ul>\n<p>When a 32-bit process access the <em>HKLM\\Software<\/em> or <em>HKCU\\Software<\/em> keys it is in fact accessing the <span style=\"text-decoration: underline;\">Wow6432Node<\/span> subkey ! \u00a0This is of course all for <a href=\"http:\/\/support.microsoft.com\/kb\/305097\" target=\"_blank\">very good reasons<\/a>.<\/p>\n<p>Why is this important for <strong>FinalBuilder<\/strong> and <strong>Delphi<\/strong> ?<\/p>\n<p>Well, <strong>FinalBuilder<\/strong> detects the presence of a <strong>Delphi<\/strong> version on your build machine by the presence of specific keys in the registry for each individual version of <strong>Delphi<\/strong>. \u00a0For <strong>Delphi 2006<\/strong> for example,\u00a0<strong>FinalBuilder<\/strong> is looking for a value called:<\/p>\n<ul>\n<li>HKEY_LOCAL_MACHINE\\Software\\<strong>Borland\\BDS\\4.0\\RootDir<\/strong><\/li>\n<\/ul>\n<p>This key would normally be created when you install <strong>Delphi<\/strong>, but\u00a0<strong>FinalBuilder<\/strong> doesn&#8217;t require that your <strong>Delphi<\/strong> installation be a fully and completely installed instance of <strong>Delphi.<\/strong> As long as this <strong>RootDir<\/strong> value is present and points to a folder containing the relevant <strong>Delphi<\/strong> files (and as long as certain other registry keys are available in the absence of specific configuration in <strong>FinalBuilder<\/strong>), this is enough for <strong>FinalBuilder<\/strong> to recognise the presence of a particular <strong>Delphi<\/strong> version and invoke it&#8217;s command line compiler.<\/p>\n<p>Which is great, because this means that &#8220;installing&#8221; <strong>Delphi<\/strong> on our build machine can be achieved by merely checking out the &#8220;tools&#8221; folder of our SVN repository. \u00a0This folder includes an image of a <strong>Delphi<\/strong> installation (bin, source etc) and a pair of <strong>.reg<\/strong> files containing registry keys to be imported.<\/p>\n<p>Except that when those <strong>.reg<\/strong> files are imported on a 64-bit version of <strong>Windows<\/strong>, having been exported from a 32-bit version, the keys are imported to the wrong place and <strong>FinalBuilder<\/strong> (being a 32-bit process) won&#8217;t find those imported keys !<\/p>\n<p>This isn&#8217;t a problem if you are actually installing Delphi on the machine where FinalBuilder is located because both Delphi and FinalBuilder are 32-bit processes. \u00a0The Delphi installer will create the necessary keys in the 32-bit tree from the outset.<\/p>\n<p>The solution if &#8211; like us &#8211; you are not actually installing Delphi is of course very simple once you know what the problem is. \u00a0We now have 32-bit and 64-bit versions of these <strong>.reg<\/strong> files, where the 64-bit version includes the <strong>Wow6432Node<\/strong> folder in the key paths.<\/p>\n","protected":false},"excerpt":{"rendered":"<p><span class=\"rt-reading-time\" style=\"display: block;\"><span class=\"rt-label rt-prefix\">[Estimated Reading Time: <\/span> <span class=\"rt-time\">2<\/span> <span class=\"rt-label rt-postfix\">minutes]<\/span><\/span> Just a short post to share something I learned the hard way today when moving a FinalBuilder installation from a 32-bit Windows server to a shiny new 64-bit Windows 2008 server on our even shinier new HyperV platform: \u00a0The 64-bit registry can catch you out.<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"jetpack_publicize_message":"","jetpack_is_tweetstorm":false,"jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":[]},"categories":[4],"tags":[24,292,134],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p1TKYv-bH","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":731,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/731\/","url_meta":{"origin":725,"position":0},"title":"FinalBuilder\/Delphi 64-bit Gotcha&#8230; Again !","date":"02 Aug 2011","format":false,"excerpt":"As it turns out, simply importing all old 32-bit key values into the Wow6432Node isn't the complete answer. If you are using Delphi Environment Variables (as we are) and loading those into the FinalBuilder environment, then those values need to be imported in the 64-bit registry after all ! \u00a0This\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":452,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/452\/","url_meta":{"origin":725,"position":1},"title":"Cross Platform More Important Than 64-Bit?","date":"15 Jun 2009","format":false,"excerpt":"Whilst it's nice to see Delphi in the news again in a context other than the Borland firesale, an interview with Wayne Williams recently posted on The Register is something of a mixed bag when it comes to content. \u00a0There is some confidence inspiring news but also disclosure of some\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":579,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/579\/","url_meta":{"origin":725,"position":2},"title":"Let&#8217;s do the Time Warp again&#8230;","date":"13 Oct 2009","format":false,"excerpt":"Approximately 2 years ago I was present at a Delphi launch event here in Auckland. \u00a0At that time the hot news was the release of Delphi 2007. \u00a0But more significant than that (great) release was the recent publication after much SOX hoo-ing and haa-ing of a Delphi RoadMap. On that\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2337,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2337\/","url_meta":{"origin":725,"position":3},"title":"A Silent Danger&#8230;","date":"07 Jun 2015","format":false,"excerpt":"A brief post on a long standing omission in type checking in Pascal and the limitations of Range Checking as applied to the problem. Consider this contrived example of a simple function: This very simple function accepts an explicitly 32-bit Integer parameter and simply returns TRUE if the value passed\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2344,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/2344\/","url_meta":{"origin":725,"position":4},"title":"A Deeper Dive into Range Checking","date":"08 Jun 2015","format":false,"excerpt":"Yesterday I posted about an issue with type checking in Delphi (and other Pascal) compilers. As mentioned in that post, range checking is fundamentally flawed as a supposed solution to the problem for reasons that are explored further in this post. To recap: Range checking does not test the types\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":697,"url":"https:\/\/www.deltics.co.nz\/blog\/posts\/697\/","url_meta":{"origin":725,"position":5},"title":"Deploying without DBXDRIVERS.INI","date":"26 Nov 2010","format":false,"excerpt":"As far as I can tell, as of Delphi 2010 at least it is impossible to deploy a DBExpress application without also deploying at least one dbxdrivers.ini. Furthermore, deciding where this ini file has to go is a minefield, and the DBExpress architecture smells very badly in this area. Sadly,\u2026","rel":"","context":"In &quot;Delphi&quot;","img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/725"}],"collection":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/comments?post=725"}],"version-history":[{"count":5,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/725\/revisions"}],"predecessor-version":[{"id":730,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/posts\/725\/revisions\/730"}],"wp:attachment":[{"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/media?parent=725"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/categories?post=725"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.deltics.co.nz\/blog\/wp-json\/wp\/v2\/tags?post=725"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}