Is it possible using Inno Setup to write the current date to a registry key as binary data? (if it is a string then that makes it very easy for someone to alter)
In my MFC C++ projects I serialize a DATE variable using WriteProfileBinary.
Eventually I need to be able to read this value into a DateTime variable using .NET C#. I would be using the common program data key to store the value and only if doesn't exist.
The [Registry] caters for binary data:
If
binaryis specified, Setup will create a binary (REG_BINARY) value ... If the data type isbinary, this is a sequence of hexadecimal bytes in the form:"00 ff 12 34".
How to we take the timestamp and turn it into the required format?
I see this question (Writing binary data to registry using Inno Setup Pascal Scripting) which is useful and also in the Inno Setup forum where they responded to me:
It's possible, but you'll have to use some
[Code]and theRegWriteBinaryValuefunction.
But it is still not clear to me:
- How to write the current timestamp to the registry using this function?
- How to write it in a binary format such that .NET C# will be able to read it as a
DateTimeobject?