Read String Value from the registry

Discussion in 'Windows Vista Drivers' started by Shiri Schneider, Feb 3, 2009.

  1. Hi,

    I am tring to read string value from the registry by using 'ZwQueryValueKey'.
    I succeeded to read only the first letter of the string.

    Does anyone have an example how to read a string value from the registry in
    the kernel driver?

    Shiri Schneider, Feb 3, 2009
    1. Advertisements

  2. Shiri Schneider

    Pavel A. Guest

    Dear Shiri,

    The string you've read with ZwQueryValueKey is in Unicode (also known as

    Hope this helps :)

    Pavel A., Feb 3, 2009
    1. Advertisements

  3. Thanks Pavel.
    That was my problem - the return value is Wild Char and not normal Char.
    Do you know how can I convert this Wstring to normal String (in 'c').

    Shiri Schneider, Feb 4, 2009
  4. Shiri Schneider

    Don Burn Guest

    Well first do you really want to convert it? Many things in the registy
    can contain characters outside the ANSI range. Also, the use of the
    standard "C" runtime string functions is deprecated in the kernel. Many of
    us find the counted UNICODE_STRING functions the way to go. If you do want
    to convert it to a ANSI characters look at RtlUnicodeStringToAnsiString, but
    this will not give you a NULL terminated string. You will have to do more
    manipulation for that, then use the RtlStringXXX functions on the NULL
    terminated string.

    Don Burn (MVP, Windows DDK)
    Windows Filesystem and Driver Consulting
    Remove StopSpam to reply
    Don Burn, Feb 4, 2009
  5. That was my problem - the return value is Wild Char and not normal Char.

    "Wild char" - is it "wide char"? :)
    Maxim S. Shatskih, Feb 4, 2009
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.