I'm trying to retrieve a value from the registry. InstallDate is a REG_DWORD value and GetInstallDate returns true, but returnstr is "0". return_size is 4 as would be expected. I really don't know what's going wrong here.
Yes, it's REG_DWORD.
Changed that line to LONG created_key=RegOpenKeyEx(HKEY_LOCAL_MACHINE, reg_key.c_str(), 0, KEY_QUERY_VALUE, &hkey);
still not having any luck.
Without the cast, the function call is ambiguous.
Figured out what the problem is. The registry call is being redirected to SOFTWARE\Wow6432Node\Microsoft\Windows NT\CurrentVersion
The 'InstallDate' value at that location is actually 0. Is it possible to prevent this redirection?
@ OP: Yes, but you shouldn't get into the habit of leaning on the registry for this kind of stuff for this among other reasons. The Win32_Product class has the data you need in a property titled "InstallDate2".