QSysInfo::machineUniqueId() empty on Windows
-
@JonB I will try this now, but since RegOpenKeyEx is from Win api not Qt which lib should I link to and include headers?
Thanks,
Marek@Marek
Not sure what you mean, but I did not mean compile anything! I meant: look at that code, and go look in your registry to see whether you even have that entry sitting there or not, because that is the code Qt will be executing for you. I can see that key value under my Win 8 (so I would expect the Qt call to work), maybe it isn't there on your machine in Win 10, or (unlikely?) your Qt app process has no permission to read it from the registry? -
@Marek
Not sure what you mean, but I did not mean compile anything! I meant: look at that code, and go look in your registry to see whether you even have that entry sitting there or not, because that is the code Qt will be executing for you. I can see that key value under my Win 8 (so I would expect the Qt call to work), maybe it isn't there on your machine in Win 10, or (unlikely?) your Qt app process has no permission to read it from the registry? -
@JonB I have compiled this into app and it returns empty string, I think because I can see Q_OS_WINRT is set
This windows is a bit slow... -
@Marek
http://qt.apidoc.info/5.2.0/qtcore/qtglobal.html#Q_OS_WINRT:Defined for Windows Runtime (Windows Store apps) on Windows 8, Windows RT, and Windows Phone 8.
Is your Qt compiled for Win 10 "Windows Store app" ??
-
- Recheck your claim "I think because I can see Q_OS_WINRT is set", because that doesn't sound likely to me?
- Look in your registry to see what you have for the key entry referenced in the code?
-
@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.
@Marek
Yeah, everybody knows that Windows comes withREGEDIT
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. -
@Marek
Yeah, everybody knows that Windows comes withREGEDIT
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. -
@JonB anyway thanks for help, I really have Q_OS_WINRT set thats why this code returned empty string first time I have compiled
@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.
-
@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.
-
@Marek
Yeah, everybody knows that Windows comes withREGEDIT
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. -
@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@Marek
Yes it can. It's all to do with theWow6432Node
key:Yes, for 32-bit software 64-bit OS will substitute
HKLM\SOFTWARE\
path withHKLM\SOFTWARE\Wow6432Node\
. So you were trying to readHKLM\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 :)
-
@Marek
Yes it can. It's all to do with theWow6432Node
key:Yes, for 32-bit software 64-bit OS will substitute
HKLM\SOFTWARE\
path withHKLM\SOFTWARE\Wow6432Node\
. So you were trying to readHKLM\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 :)
@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 ? -
@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 ? -
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.
-
@JonB but I was downloading Qt 5.11.1 throught Maintenance tool and there was MinGW 32Bit not 64Bit
@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. -
@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.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)