Results 1 to 9 of 9

Thread: [Resolved] Mystery Strings?

Threaded View

  1. #8
    Fanatic Member schoolbusdriver's Avatar
    Join Date
    Jan 2006
    Location
    O'er yonder
    Posts
    1,020

    Re: Mystery Strings?

    For info:

    Many registry routines look for the FIRST null in a retrieved REG_SZ and truncate the remainder of the string. If you are using the APIs to retrieve the value, your routine should simply remove the LAST null. Note that VB.Net doesn't give you a choice - it will ALWAYS truncate at the first null. This is also likely with 3rd party controls.

    A REG_SZ will happily accomodate embedded nulls. You can check for the validity of the value in the registry by right-clicking on the value and choosing "Modify Binary Data". As each character in a REG_SZ is seperated by a null, an embedded null will be show as 3 consecutive nulls.

    Writing/reading a REG_SZ with embedded nulls isn't a problem - it's whether the rest of the code can handle them.

    VB controls such as textboxes won't display anything after a null, or store it as a propery - although a string with embedded nulls will happily "live" in a string variable. ie Manipulate strings with embedded nulls in variables, and only display them when all the nulls have been converted to something readable.
    Last edited by schoolbusdriver; Feb 13th, 2008 at 03:48 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width