No announcement yet.

64 bit support/registry access

  • Filter
  • Time
  • Show
Clear All
new posts

    64 bit support/registry access


    With introduction of Windows 2008 R2 Microsoft are dropping support for 32bit, see

    With Windows 64 bit, my understanding is, a) 32 bit exe's run under the WOW, if they access a non shared registry key (controlled by Microsoft) they access the 32 bit registry area, b) 64 bit exe's run native, if they access a non shared registry key (controlled by Microsoft) they access the 64 bit registry area. See for more info.

    As I have many PB based exe's that communicate via the registry with 3rd party exe's (not under my control) that may be running as 64 bit exe's, I am wondering if its possible to force 32 bit apps to write to the registry?

    Wondering if anybody else has been thinking about the affects of 64 bit...

    Mike C

    You are not alone, i have been struggling with it too

    I am unable to use my GDImage.dll with VISUAL STUDIO 64-bit applications.

    Patrice Terrier
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).


      I'm not sure that was clearly stated? Microsoft has no plans to drop support for 32-bit code that I've seen. The certification for the 64-bit Windows Server 2008 R2 includes testing of both 32-bit and 64-bit applications.

      Perhaps you could explain the issue in more detail?
      Last edited by Tom Hanlin; 17 Sep 2009, 11:24 AM.


        I can't find that on that page either.

        Perhaps the question is really, "How can I use the system registry to exchange data between a 32-bit applicaiton and a 64-bit application?"

        And perhaps the answer is, "You can't, so find another way to exchange data." This IS a possibility.

        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]


          Hello Tom,

          The registry is being used to pass data between exe's.

          app32.exe sets HKLM\SOFTWARE\Transfer\XXXata=1. As its a 32 bit exe the 32 bit area of the registry is updated.

          app64.exe reads HKLM\SOFTWARE\Transfer\XXXata. As its a 64 bit exe it accesses the 64 bit area of the registry and hence does not find Data set to 1.

          Basically I'm looking for a way to force the exe's to use a shared registry area so they can exchange data. Problem is I do not own the 64 bit apps.

          Please note, I'm not critising PB in anyway, although a 64 bit version would be great, I'm hoping that somebody will say "you need to use API call XYZ", i.e. I've missed something in MSDN.

          Mike C
          Last edited by Michael Cuff; 17 Sep 2009, 10:25 AM.


            Well, if only a 64-bit application can write to this registry area, then you'll have to obtain or create a 64-bit application to do so, one which can accept 'commands' to read/write to the 64-bit area via some other means of exchange (TCP, memory objects, etc)

            But IIRC "thunking" was used to call 32-bit APIs from a 16-bit applications... perhaps you can Google(r) for something like "thunk 32 bit to 64 bit" and see if you find something which can call a 64-bit API from a 32-bit application?

            I'm not sure that would even help, what with all the automatic "protection and security" being built into today's operating systems, but it's probably worth a search.

            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]


              May be you can use the REG command, shell to it or run a batch file that calls REG? Type in REG /? on Vista and look at the options. I do not know if this will work, just a thought.

              Steve Rossell
              PowerBASIC Staff


                Originally posted by Michael Cuff View Post
                i.e. I've missed something in MSDN.
                Mike, I am in the middle of something right now, but look up KEY_WOW64_64KEY on MSDN. This should allow a 32 bit app to access a 64 bit key:

                RegOpenKeyEx( regkeyRemoteComputer.m_hkey, strSubKey, 0, KEY_WOW64_64KEY | 
                KEY_QUERY_VALUE, &regSubkey.m_hkey )
                NOT PB CODE ABOVE

                You might want to read there, too:

                On 64-bit Windows, portions of the registry entries are stored separately for 32-bit application and 64-bit applications and mapped into separate logical registry views using the registry redirector and registry reflection, because the 64-bit version of an application may use different registry keys and values than the 32-bit version. There are also shared registry keys that are not redirected or reflected.

                Will help more later today, if you can't get it figured out.

                *edit* more

                Describes some of the important registry changes that have been made in the x64 Edition version of the Windows operating system.

                x64 applications write to the registry here:

                x32 applications on x64 are intercepted by the system and write here:

                Registry access limitations on Windows XP 64 - posted in Suggestions: x64 applications write to the registry here:HKEY_LOCAL_MACHINE\SOFTWAREx32 applications on x64 are intercepted by the system and write here:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node This is transparent to the user.(description from microsoft x32 apps read from the registry the read from here:HKEY_LOCAL_MACHINE\SOFTWAREbut th...

                Best I can do for now, hope it helps.
                Last edited by Brice Manuel; 17 Sep 2009, 10:35 AM.



                  Did thinking about using REG however its not very elegant - i.e. its a last resort.


                  My understanding that the flags KEY_WOW64_64KEY and KEY_WOW64_32KEY require registry reflection, somethings that's gone in Windows 2008 R2/Windows 7. Been down this route without much success. See If registry reflection was still available, my understanding is Microsoft control the list of keys that get reflected, i.e. you just cannot add one to the list yourself.

                  Mike C
                  Last edited by Michael Cuff; 17 Sep 2009, 10:58 AM. Reason: Adding bit about reg reflection



                    The official AutoHotkey community forums - share your scripts or functions, find answers to your questions and discuss topics with other members

                    This one of any help?


                      Kinda sounds like Microsoft does not want you to use the registry in that fashion. It would probably be a good idea to find out why, and what the preferred solution might be.


                        Hello All,

                        As Tom suggests, I will be in touch with Microsoft early next week once I've had a chance to try a few tests. Will post outcome.

                        Mike C


                          Oh, the joys of dealing with a non-cooperating application!

                          XI. Thou Shalt Learn To Say, "Sorry, No."
                          Michael Mattias
                          Tal Systems (retired)
                          Port Washington WI USA
                          [email protected]


                            Importing .REG files for a 32-bit program with 64-bit operating system

                            Steve is correct in SHELL does work.
                            Read this before searching this forum.
                            I need to import a .reg file on 32-bit and 64-bit systems. The .reg file contains settings for a 32-bit-only program. In a 32-bit environment the settings are stored at "HKLM/Software/CompanyName/ ProductName", but on a 64-bit system, the settings are stored at "HKLM/...

                            I couldn't get an application to work after importing a .REG file into a computer running Windows 7 64-bit and started reading about the Wow6432Node in the registry. The entries were not being duplicated into Wow6432Node.
                            This gave me the idea (which is already discussed here.)

                            The simple solution for importing .REG files for 32-bit app into 64-bit operating system:
                            FUNCTION PBMAIN AS LONG
                              LOCAL zFile AS ASCIIZ * 64
                              zFile = "MyFile.Reg"
                              ShellExecute (BYVAL 0,"OPEN",zFile,BYVAL 0, CURDIR$,%SW_SHOWNORMAL)
                            END FUNCTION
                            I'm thinking about writing to the registry without the .REG files and hope
                            that the keys under WOW6432Node are correctly duplicated when done from a 32-bit application?

                            Anyway, the SHELLEXECUTE works for 32-bit apps on 64-bit Windows 7.
                            Last edited by Mike Doty; 26 Nov 2009, 02:09 AM.


                              You can simply send messages from a 64 bit App to a 32 bit App.
                              I'd say that Mutexes will also work for synchronisation.

                              Besides that, I'd also like to know, if PowerBasic can read the 64bit-Registry anyway - or if this just doesn't work.


                                Here's the list of registry keys that use WoW64 redirection (note that registry reflection was removed in Windows 7 and Windows Server 2008 R2):

                                If you want to access the alternate view of the registry (i.e.: a 32-bit program reading a 64-bit registry key or vice versa) you can use the KEY_WOW64_32KEY and KEY_WOW64_64KEY flags. Of course, that's only necessary if you're accessing a key that's redirected.
                                Mike Stefanik


                                  The shelling out option doesn't always work 100% of the time either. When I install Windows I have a custom app...actually wrote in PBWin with no GUI other than messageboxes that installs Office, Acrobat, DirectX, FireFox, Thunderbird, Sun JAVA and a Hacked MS JAVA since sometimes it works better in IE, etc. At one point in the processes I shell out to import a Tweaks.reg file that sets all my options and tweaks. This doesn't always work- either for it still writing to the 32bit key or in differences between how Win XP/WinXP 64bit/Win 2003 Server 32bit/64bit installs set keys to defaults or leave alone when done I have to again set it to import the keys on first boot to get them all saved 100%. If memory serves me correct Plain XP handled it the best putting all settings in the Default user key and allowing all users that get created to be created with those settings, etc. I still set all to load it again on first boot though just to make sure.
                                  Mobile Solutions
                                  Sys Analyst and Development


                                    32-bit and 64-bit Application Data in the Registry

                                    And this does the trick:

                                    Accessing an Alternate Registry View