Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QSysInfo::machineUniqueId() empty on Windows
QtWS25 Last Chance

QSysInfo::machineUniqueId() empty on Windows

Scheduled Pinned Locked Moved Solved General and Desktop
28 Posts 4 Posters 6.6k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Marek

    @JonB Yeah, I have downloaded some tool for registry and I'm checking, will report

    JonBJ Offline
    JonBJ Offline
    JonB
    wrote on last edited by JonB
    #10

    @Marek
    You don't need to download anything, you already have REGEDIT! :)

    M 2 Replies Last reply
    0
    • JonBJ JonB

      @Marek
      You don't need to download anything, you already have REGEDIT! :)

      M Offline
      M Offline
      Marek
      wrote on last edited by
      #11

      @JonB REGEDIT inside Win ? Sorry I don't work usally on Windows. I have downloaded some regmagik and I can see that Microsoft\Cryptography hasn't any keys only some branches.

      JonBJ 1 Reply Last reply
      0
      • JonBJ JonB

        @Marek
        You don't need to download anything, you already have REGEDIT! :)

        M Offline
        M Offline
        Marek
        wrote on last edited by
        #12

        @JonB I have searched through the registry and there is no MachineGuid in reg

        1 Reply Last reply
        0
        • M Marek

          @JonB REGEDIT inside Win ? Sorry I don't work usally on Windows. I have downloaded some regmagik and I can see that Microsoft\Cryptography hasn't any keys only some branches.

          JonBJ Offline
          JonBJ Offline
          JonB
          wrote on last edited by
          #13

          @Marek
          Yeah, everybody knows that Windows comes with REGEDIT for examining the Registry! :)

          If you don't have HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid (I do), that function is not going to return anything on your machine. That's all I know.

          M 2 Replies Last reply
          0
          • JonBJ JonB

            @Marek
            Yeah, everybody knows that Windows comes with REGEDIT for examining the Registry! :)

            If you don't have HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid (I do), that function is not going to return anything on your machine. That's all I know.

            M Offline
            M Offline
            Marek
            wrote on last edited by
            #14

            @JonB anyway thanks for help, I really have Q_OS_WINRT set thats why this code returned empty string first time I have compiled

            JonBJ 1 Reply Last reply
            0
            • M Marek

              @JonB anyway thanks for help, I really have Q_OS_WINRT set thats why this code returned empty string first time I have compiled

              JonBJ Offline
              JonBJ Offline
              JonB
              wrote on last edited by JonB
              #15

              @Marek
              Well actually that sounds more reasonable as an explanation, because I think the registry entry really is there under all Windows.

              Now your question becomes: "why does the Qt I am using seem to have been compiled with Q_OS_WINRT defined, because I would have thought it should not?".

              I am not a Qt expert: you would need someone like @SGaist to see this, look through my understanding of what must be going on, and explain.

              M 1 Reply Last reply
              0
              • JonBJ JonB

                @Marek
                Well actually that sounds more reasonable as an explanation, because I think the registry entry really is there under all Windows.

                Now your question becomes: "why does the Qt I am using seem to have been compiled with Q_OS_WINRT defined, because I would have thought it should not?".

                I am not a Qt expert: you would need someone like @SGaist to see this, look through my understanding of what must be going on, and explain.

                M Offline
                M Offline
                Marek
                wrote on last edited by
                #16

                @JonB does this matter if on my win 10 there is o MachineGuid key ?
                I'm checking something, I'm using MinGW 32 bit, https://github.com/gentoo90/winreg-rs/issues/10 try to compile with msvc2017 64bit

                JonBJ 1 Reply Last reply
                0
                • JonBJ JonB

                  @Marek
                  Yeah, everybody knows that Windows comes with REGEDIT for examining the Registry! :)

                  If you don't have HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Cryptography\MachineGuid (I do), that function is not going to return anything on your machine. That's all I know.

                  M Offline
                  M Offline
                  Marek
                  wrote on last edited by
                  #17

                  @JonB OK, success, Thanks for your help ;)
                  so windows can provide "virtual" registry for 32 bit applications and this registry does not have MachineGuid. I have compiled with msvc2017 64Bit and it works. I can call it a day ;)

                  Best,
                  Marek

                  1 Reply Last reply
                  1
                  • M Marek

                    @JonB does this matter if on my win 10 there is o MachineGuid key ?
                    I'm checking something, I'm using MinGW 32 bit, https://github.com/gentoo90/winreg-rs/issues/10 try to compile with msvc2017 64bit

                    JonBJ Offline
                    JonBJ Offline
                    JonB
                    wrote on last edited by JonB
                    #18

                    @Marek
                    Yes it can. It's all to do with the Wow6432Node key:

                    Yes, for 32-bit software 64-bit OS will substitute HKLM\SOFTWARE\ path with HKLM\SOFTWARE\Wow6432Node\. So you were trying to read HKLM\SOFTWARE\Wow6432Node\Microsoft\Cryptography\MachineGuid which doesn't exist.

                    You did not say in your question that any 32-bitted-ness was involved at your side, I assumed all 64-bit, else I would have said about needing to change where you look in the registry :)

                    M 1 Reply Last reply
                    2
                    • JonBJ JonB

                      @Marek
                      Yes it can. It's all to do with the Wow6432Node key:

                      Yes, for 32-bit software 64-bit OS will substitute HKLM\SOFTWARE\ path with HKLM\SOFTWARE\Wow6432Node\. So you were trying to read HKLM\SOFTWARE\Wow6432Node\Microsoft\Cryptography\MachineGuid which doesn't exist.

                      You did not say in your question that any 32-bitted-ness was involved at your side, I assumed all 64-bit, else I would have said about needing to change where you look in the registry :)

                      M Offline
                      M Offline
                      Marek
                      wrote on last edited by
                      #19

                      @JonB I did not supposed it matters, frankly I prefer to use MinGW (old habits maybe) and I didn't see Qt 5.11 for MinGW 64bit.
                      @CoreyAnderson how this HP printer support is related to Qt or even Windows 10, I don't get it, you mean bug in Windows that it does not provide key for 32bit apps ?

                      JonBJ 1 Reply Last reply
                      0
                      • M Marek

                        @JonB I did not supposed it matters, frankly I prefer to use MinGW (old habits maybe) and I didn't see Qt 5.11 for MinGW 64bit.
                        @CoreyAnderson how this HP printer support is related to Qt or even Windows 10, I don't get it, you mean bug in Windows that it does not provide key for 32bit apps ?

                        JonBJ Offline
                        JonBJ Offline
                        JonB
                        wrote on last edited by JonB
                        #20

                        @Marek

                        Ignore @CoreyAnderson 's post, he is just advertising his hyperlink! It's a scam.

                        You can use a 64-bit compiler with no issue. If you want to use a 32-bit compiler, you will have to do some work.

                        M 1 Reply Last reply
                        0
                        • JonBJ JonB

                          @Marek

                          Ignore @CoreyAnderson 's post, he is just advertising his hyperlink! It's a scam.

                          You can use a 64-bit compiler with no issue. If you want to use a 32-bit compiler, you will have to do some work.

                          M Offline
                          M Offline
                          Marek
                          wrote on last edited by
                          #21

                          @JonB but I was downloading Qt 5.11.1 throught Maintenance tool and there was MinGW 32Bit not 64Bit

                          JonBJ 1 Reply Last reply
                          0
                          • M Marek

                            @JonB but I was downloading Qt 5.11.1 throught Maintenance tool and there was MinGW 32Bit not 64Bit

                            JonBJ Offline
                            JonBJ Offline
                            JonB
                            wrote on last edited by
                            #22

                            @Marek
                            I don't know what to say other than you have the choice of what compiler and bitted-ness are used to compile Qt, and you decide which target platforms you wish to support. In this case you have found a situation where there is a 32-bit/64-bit Windows Registry issue if you mix bitted-nesses.

                            JKSHJ 1 Reply Last reply
                            0
                            • JonBJ JonB

                              @Marek
                              I don't know what to say other than you have the choice of what compiler and bitted-ness are used to compile Qt, and you decide which target platforms you wish to support. In this case you have found a situation where there is a 32-bit/64-bit Windows Registry issue if you mix bitted-nesses.

                              JKSHJ Offline
                              JKSHJ Offline
                              JKSH
                              Moderators
                              wrote on last edited by
                              #23

                              I sense a bit of miscommunication in the last few messages; @Marek and @JonB are talking about slightly different things.

                              @Marek's observation is correct: The Maintenance Tool does not provide a pre-built 64-bit version of Qt for MinGW.

                              @JonB's point is also correct: We can choose from a variety of 32-bit and 64-bit versions. (But if we want 64-bit MinGW, then we need to build Qt ourselves -- we can't just download it through the MaintenanceTool)

                              Qt Doc Search for browsers: forum.qt.io/topic/35616/web-browser-extension-for-improved-doc-searches

                              JonBJ 1 Reply Last reply
                              2
                              • JKSHJ JKSH

                                I sense a bit of miscommunication in the last few messages; @Marek and @JonB are talking about slightly different things.

                                @Marek's observation is correct: The Maintenance Tool does not provide a pre-built 64-bit version of Qt for MinGW.

                                @JonB's point is also correct: We can choose from a variety of 32-bit and 64-bit versions. (But if we want 64-bit MinGW, then we need to build Qt ourselves -- we can't just download it through the MaintenanceTool)

                                JonBJ Offline
                                JonBJ Offline
                                JonB
                                wrote on last edited by JonB
                                #24

                                @JKSH
                                Ah, I don't even know what that "Maintenance Tool" is! I actually thought it might be for building Qt yourself, now I understand it gives pre-compiled versions. And you're saying it does not offer 64-bit for MinGW.

                                @Marek
                                You still have two choices for your issue:

                                • If you use a 64-bit Qt there is no problem. That could be pre-compiled or compiled by you, and it could be MinGW, MSVC or whatever. I do not know whether you find using either a pre-supplied MSVC 64-bit (does Maint Tool have that?) or compiling for yourself a 64-bit MinGW acceptable or a pain in the ass.

                                • If you use a 32-bit Qt --- perhaps the conveniently pre-compiled MinGW one --- there is a problem, because of where that looks in the Registry. You can probably address this by doing something in your app code, but we haven't investigated this yet as you haven't said which Qt 32/64-bit route you wish to pursue.

                                M 1 Reply Last reply
                                0
                                • JonBJ JonB

                                  @JKSH
                                  Ah, I don't even know what that "Maintenance Tool" is! I actually thought it might be for building Qt yourself, now I understand it gives pre-compiled versions. And you're saying it does not offer 64-bit for MinGW.

                                  @Marek
                                  You still have two choices for your issue:

                                  • If you use a 64-bit Qt there is no problem. That could be pre-compiled or compiled by you, and it could be MinGW, MSVC or whatever. I do not know whether you find using either a pre-supplied MSVC 64-bit (does Maint Tool have that?) or compiling for yourself a 64-bit MinGW acceptable or a pain in the ass.

                                  • If you use a 32-bit Qt --- perhaps the conveniently pre-compiled MinGW one --- there is a problem, because of where that looks in the Registry. You can probably address this by doing something in your app code, but we haven't investigated this yet as you haven't said which Qt 32/64-bit route you wish to pursue.

                                  M Offline
                                  M Offline
                                  Marek
                                  wrote on last edited by
                                  #25

                                  @JonB Thanks for your help.
                                  MSVC 64Bit is provided by Maintenance Tool.
                                  Compiling Qt on Windows with 64-Bit MinGW might be a pain ;) I'm doing this quite often on embedded platforms but then I need much less modules. What is more, I'm writing code that someone else will use in his projects, so it needs to be compatible with commercial Qt license.
                                  I will stick to MSVC 64Bit.

                                  Thanks,
                                  Marek

                                  JonBJ 1 Reply Last reply
                                  0
                                  • M Marek

                                    @JonB Thanks for your help.
                                    MSVC 64Bit is provided by Maintenance Tool.
                                    Compiling Qt on Windows with 64-Bit MinGW might be a pain ;) I'm doing this quite often on embedded platforms but then I need much less modules. What is more, I'm writing code that someone else will use in his projects, so it needs to be compatible with commercial Qt license.
                                    I will stick to MSVC 64Bit.

                                    Thanks,
                                    Marek

                                    JonBJ Offline
                                    JonBJ Offline
                                    JonB
                                    wrote on last edited by JonB
                                    #26

                                    @Marek
                                    So it sounds like you will use 64-bit, this problem will go away and we don't need to investigate any further.
                                    I presume all your targets will be 64-bit, none 32-bit(?).

                                    Now that we know how QSysInfo::machineUniqueId() relies on finding that "MachineGuid" in the correct place in the Registry where it looks, and there's some possibility it may not find it, you might be best documenting this somewhere for both developers & end-users, and/or providing a "fallback" mechanism if it returns an empty string.

                                    M 1 Reply Last reply
                                    0
                                    • JonBJ JonB

                                      @Marek
                                      So it sounds like you will use 64-bit, this problem will go away and we don't need to investigate any further.
                                      I presume all your targets will be 64-bit, none 32-bit(?).

                                      Now that we know how QSysInfo::machineUniqueId() relies on finding that "MachineGuid" in the correct place in the Registry where it looks, and there's some possibility it may not find it, you might be best documenting this somewhere for both developers & end-users, and/or providing a "fallback" mechanism if it returns an empty string.

                                      M Offline
                                      M Offline
                                      Marek
                                      wrote on last edited by
                                      #27

                                      @JonB I'm reading mac addresses of network cards when machineUniqueId returns empty string. This can be problematic especially when someone uses detachable usb->wifi adapter but I don't see other option with Qt.

                                      JonBJ 1 Reply Last reply
                                      0
                                      • M Marek

                                        @JonB I'm reading mac addresses of network cards when machineUniqueId returns empty string. This can be problematic especially when someone uses detachable usb->wifi adapter but I don't see other option with Qt.

                                        JonBJ Offline
                                        JonBJ Offline
                                        JonB
                                        wrote on last edited by JonB
                                        #28

                                        @Marek
                                        Well Qt is only a library providing "abstracted, convenience" functions where possible, it's not magic, so yes sometimes you have to supply your own alternatives as best you can. If you can't find anything, chances are nor can Qt.

                                        1 Reply Last reply
                                        0

                                        • Login

                                        • Login or register to search.
                                        • First post
                                          Last post
                                        0
                                        • Categories
                                        • Recent
                                        • Tags
                                        • Popular
                                        • Users
                                        • Groups
                                        • Search
                                        • Get Qt Extensions
                                        • Unsolved