August 18, 2019, 03:22:37 pm

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


Understanding the registry - a subtle difference

Started by Andy, October 25, 2017, 06:02:09 am

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

A subtle difference.

I was trying to nail down a string entry that was larger then 254 characters, and I realised I had to use istrings instead of strings to do that so I could get the full data.

So I changed the RegGetValue in my registry lib file to istrings - okay, no problem.

Now, up until this to check if an entry existed I was just getting the value of "this" entry, and if it return blank i.e. "" then more likely the entry didn't exist - which is logically wrong.

But now I was getting " 0" (a blank and a null character) which puzzled me.

I realised a string will not return a null character, but an istring will.

Why is this important? well I recently added in a function to copy entries from one location to another - and what would happen is an entry with the same name be copied to another folder also with the same name.

To combat this, I've added two new commands:

RegEntryExists and RegGetDataSize.

The first does what it says on the tin, the second returns the size (in bytes) of the data value which is very handy if you're dealing with binary.

I will release the new registry lib and include files as soon as I've documented the new functions.


Day after day, day after day, we struck nor breath nor motion, as idle as a painted ship upon a painted ocean.