Win32.RegistryKey BUG?????

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi All

I Wonder... why does the 'RegistryKey' object saves an 'unsigned int' as a string type in the registry while 'int' is being saved as a DWORD type??? Is this a BUG or there is a logical explenation for that??? following is a code example that demonstrate the problem

Microsoft::Win32::RegistryKey *regExplorer = Microsoft::Win32::Registry::LocalMachine->OpenSubKey(S"SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\policies\\Explorer", true)

regExplorer->SetValue("NoDrives", __box((int)(1))); <- Set the regisrty value as DWORD typ
regExplorer->SetValue("NoDrives", __box((unsigned int)(1))); <- Set the regisrty value as STRING type!!!
regExplorer->Close()

Thanks
Nadav
 
MS: "This behavior is by design.", so it's not a BUG:

"If the second parameter in SetValue is an Int32 value, the value is stored
as an integer with the REG_DWORD registry value type. However, if the second
parameter is any other type of integer (such as Int16, UInt16, UInt32, and
so on), the value is stored as a string with the REG_SZ registry value type.
"

Maybe this helps:

http://support.microsoft.com/default.aspx?scid=kb;en-us;317873


Nadav said:
Hi All,

I Wonder... why does the 'RegistryKey' object saves an 'unsigned int' as a
string type in the registry while 'int' is being saved as a DWORD type??? Is
this a BUG or there is a logical explenation for that??? following is a code
example that demonstrate the problem:
Microsoft::Win32::RegistryKey *regExplorer =
Microsoft::Win32::Registry::LocalMachine->OpenSubKey(S"SOFTWARE\\Microsoft\\
Windows\\CurrentVersion\\policies\\Explorer", true);
regExplorer->SetValue("NoDrives", __box((int)(1))); <- Set the regisrty value as DWORD type
regExplorer->SetValue("NoDrives", __box((unsigned int)(1))); <- Set the
regisrty value as STRING type!!!!
 
Back
Top