Reputation: 6094
I am testing this function ::RegGetValue
. The code below returns success.
DWORD data_size = 0;
LONG result = ::RegGetValue(HKEY_LOCAL_MACHINE,
_T("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\App Paths\\OUTLOOK.EXE"),
_T("Path"),
RRF_RT_REG_SZ,
NULL, NULL,
&data_size);
But if I try to find different entry under current user, it fails even though the entry does exist.
DWORD data_size = 0;
LONG result = ::RegGetValue(HKEY_CURRENT_USER,
_T("Software\\Microsoft\\Internet Explorer\\Main\\FeatureControl\\FEATURE_BROWSER_EMULATION"),
_T("OUTLOOK.EXE"),
RRF_RT_REG_SZ,
NULL, NULL,
&data_size);
Upvotes: 1
Views: 171
Reputation: 596703
All of the values in the FEATURE_BROWSER_EMULATION
key are DWORD values, not String values, per MSDN documentation:
Internet Feature Controls (B..C): Browser Emulation
By specifying RRF_RT_REG_SZ
, you are telling RegGetValue()
to read only String values. That makes sense when reading a "Path"
value from the App Paths
key, but when reading from the FEATURE_BROWSER_EMULATION
key you need to specify RRF_RT_REG_DWORD
instead.
Upvotes: 2