I am currently writing an application where I need to be able to read various registry enteries without knowing their types beforehand. All the information read from the registry will be converted to a string. I have written a small bit of code that pretty much handles this, but I am having a problem with binary data. My code is as follows:
RegType := MyReg.GetDataType(RegValue);
if (RegType = rdString) or (RegType = rdExpandString) then sData := MyReg.ReadString(sValue);
if RegType = rdInteger then sData := IntToStr(MyReg.ReadInteger(sValue));
if RegType = rdBinary then
lBinaryDataSize := MyReg.GetDataSize(sValue);
MyReg.ReadBinaryData(RegValue, Buffer, SizeOf(Buffer));
"RegKey", "RegValue" are both strings whose values are predetermined earlier in the code. "Buffer" is an array of byte, which as you can see, is resized based on the size of the binary data.
The error I am recieving is when I actually come across some binary data in the registry. Despite the fact that the key type is rdBinary, I get a message that says "Invalid Data Type For 'CustomColors'" (which is the particular key I am trying to read). Any idea of what I may be doing wrong?