11-30-2009 03:46 AM
Good Morning,
I usually use the function RegReadString/RegWriteString to read and write on Windows Reg system.
It work without problems on Windows Vista and Windows7 32bits, but under WIndows7 64 Bit doesn't work.
Example :
#define WIN_KEY "SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion"
iRtrn=RegReadString (REGKEY_HKLM, WIN_KEY,"ProductId", szBuffer, 256, &lSize);
This example normally return windows Product ID, but under Win7-64 I got error "Registry values doesn't exist"(-5068).
RegWriteString doesn't work too... 😞
Can you help me?
Thanks
Daniele
Solved! Go to Solution.
11-30-2009 10:44 AM
Hello Daniele,
One important thing to realize when running a 32 bit executable on 64 bit windows is that all registry requests will be redirected through the Wow6432Node. For whatever reason, Microsoft has chosen not to place the product id information in the redirected location (HKLM\SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion). Only 64 bit applications are capable of reading from the non Wow6432Node location, where the product ID you are looking for is located.
Generally, the type of information you're looking for is best retrieved via WMI and some type of scripting such as VBScript. Until CVI 2009 releases (giving you the ability to create native 64 bit applications) you will not be able to retrieve this information from the registry with a CVI application.
NickB
National Instruments
04-25-2017 05:58 AM
Is Retrieving the information in the registry is available in 2015 CVI release? This is because i have installed CVI 2015 release, still RegReadString returns the Registry value not exist.
I can see the installed software in Wow6432Node, but the function returns "Registry does not exist"
Could you help me how this can be done in the latest release?
05-10-2017 04:05 AM
Did you install 64 Bit or 32 Bit LabWindows CVI?
05-10-2017 10:48 AM
I didn't know a 64-bit release of CVI actually existed!
If you want to run through the WMI path that Nick suggested, then you can look at this example program I published: the Product ID can be found as SerialNumber in Operating System section:
How to get informations on the system through WMI in CVI
05-10-2017 12:58 PM
@RobertoBozzolo wrote:
I didn't know a 64-bit release of CVI actually existed!
I can't say that I know, but it was the first thought that came up when seeing the description, having a few times fought with this dragon under LabVIEW. The other possible reason might be access rights, if the key is really there as the poster claims.
I would agree that using WMI is generally a better way to retrieve such information from the system, despite it being a somewhat heavy weight solution.