July 07, 2024, 10:36:42 AM

News:

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


Reading strings with Null characters

Started by Andy, April 02, 2014, 01:07:18 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Andy

Hi,

Some time ago I was able (with a little help) to write binary values to the registry,
the "stumbling block" was that the value to be written had Null entries in it e.g.

1F A3 00 C2 11   where the 00 is a "Null".

I used ISTRING instead of STRING otherwise the string would have "terminated" after the A3 entry.

How can I read a string from the registry (or file for example) with null characters?

Attached is the example of the code to write a binary (hex) value to the registry, I have tried now for some time to read binary / Multi strings / Expandable strings with no luck.

Whilst I'm using my include file I get the same results with IWB's RegGetString function, in other words:
They both return the first two characters and then the string terminates.

I know the number of "pairs" in the binary entry as RegGetBString (in my KMS.INC) sub routine will return it. e.g.  1F A3 00 C2 11 will return 5 - but I can't get any further.

Any one any ideas on this one.

Thanks,
Andy.





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

Andy

Well,

It seems i've answered my own question - this is what I did:

Changed the sub routine in the KMS.inc file and changed how I call it.

It now returns the correct entries.

See attached.

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

Andy

Sorry,

Forgot to mention you need to redo the the $include "C:\\kms\\c3\\kms.inc" to wherever you saved it to.

Also, use Regedit to create a registry key in HKEY_CURRENT_USER\Software - add a key called "KMS" and add an entry called "Bin" to the KMS key, then add some hex values to "Bin" before you try my post.

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