Announcement

Collapse
No announcement yet.

64 bit support/registry access

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 64 bit support/registry access

    Hello

    With introduction of Windows 2008 R2 Microsoft are dropping support for 32bit, see http://www.microsoft.com/windowsserv...liability.aspx.

    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 http://msdn.microsoft.com/en-us/libr...32(VS.85).aspx 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...

    Rgds
    Mike C

  • #2
    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
    www.zapsolution.com
    www.objreader.com
    Addons: GDImage.DLL 32/64-bit (Graphic library), WinLIFT.DLL 32/64-bit (Skin Engine).

    Comment


    • #3
      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.

      Comment


      • #4
        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.

        MCM
        Michael Mattias
        Tal Systems (retired)
        Port Washington WI USA
        [email protected]
        http://www.talsystems.com

        Comment


        • #5
          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.

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

          Comment


          • #6
            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.

            MCM
            Michael Mattias
            Tal Systems (retired)
            Port Washington WI USA
            [email protected]
            http://www.talsystems.com

            Comment


            • #7
              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.
              Sincerely,

              Steve Rossell
              PowerBASIC Staff

              Comment


              • #8
                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:

                Code:
                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:

                http://msdn.microsoft.com/en-us/libr...72(VS.85).aspx

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


                *edit* more

                http://support.microsoft.com/kb/896459

                x64 applications write to the registry here:
                HKEY_LOCAL_MACHINE\SOFTWARE

                x32 applications on x64 are intercepted by the system and write here:
                HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node

                http://www.autohotkey.com/forum/topic23538.html

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

                Comment


                • #9
                  Steve,

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

                  Brice,

                  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 http://msdn.microsoft.com/en-us/libr...29(VS.85).aspx. 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

                  Comment


                  • #10
                    Mike:

                    http://www.autohotkey.com/forum/viewtopic.php?p=241769

                    This one of any help?

                    Comment


                    • #11
                      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.

                      Comment


                      • #12
                        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

                        Comment


                        • #13
                          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]
                          http://www.talsystems.com

                          Comment


                          • #14
                            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.
                            http://www.techtalkz.com/windows-64-...it-64-bit.html



                            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:
                            Code:
                            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.

                            Comment


                            • #15
                              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.

                              Comment


                              • #16
                                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):

                                http://msdn.microsoft.com/en-us/library/aa384253.aspx

                                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
                                sockettools.com

                                Comment


                                • #17
                                  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.
                                  sigpic
                                  Mobile Solutions
                                  Sys Analyst and Development

                                  Comment


                                  • #18
                                    32-bit and 64-bit Application Data in the Registry

                                    And this does the trick:

                                    Accessing an Alternate Registry View

                                    Comment

                                    Working...
                                    X