retrieving registry path from hkey

This is a discussion on retrieving registry path from hkey within the Windows Programming forums, part of the Platform Specific Boards category; this time i tried to STFW at msdn and google...but didn't find anything so,given an HKEY , how i can ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    69

    retrieving registry path from hkey

    this time i tried to STFW at msdn and google...but didn't find anything

    so,given an HKEY , how i can retrieve the full registry path to the key in question?

  2. #2
    Registered User
    Join Date
    Aug 2005
    Posts
    1,267
    if you have the key then your program must already know the path. Afterall, it needs to know the path in order to get a key.

  3. #3
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    it's not the case,because i have to hook another process' NtCreateKey() function from ntdll.dll because i want to know what registry keys it uses

    now,consider that in the arguments of NtCreateKey() there is a OBJECT_ATTRIBUTES structure,where there is a UNICODE_STRING that specifies the path name,but it's not the full one,because there is also a HANDLE in OBJECT_ATTRIBUTES that specifies the registry key to which the path is relative

    example,if that handle refers to HKEY_CLASSES_ROOT\mykey and the string is "hello" then the key that is going to be created is HKEY_CLASSES_ROOT\mykey\hello

    ok,i do this: i call the original NtCreateKey() in my hook function,and so i obtain an handle to this newly created reg key

    but now i need to discover the full path name in the registry,using this handle...or,equivalently,i first retrieve HKEY_CLASSES_ROOT\mykey from the handle passed in OBJECT_ATTRIBUTES and then i append "hello"

    in both cases,i need a way to get the path name of a key in the registry,having its HKEY only

  4. #4
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,263
    I think RegQueryInfoKey() is the function you are looking for.

  5. #5
    Registered User
    Join Date
    Mar 2005
    Posts
    69
    Quote Originally Posted by bithub
    I think RegQueryInfoKey() is the function you are looking for.
    but the only string that it gives in output is the lpszClass parameter,are you sure that it's the registry path ?

    i think it's only the name of the class to which the key belongs,that is a string like these

    "REG_SZ"
    "REG_DWORD"
    ...etc.

    is it so?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem building Quake source
    By Silvercord in forum Game Programming
    Replies: 16
    Last Post: 07-11-2010, 10:13 AM
  2. Shortest Path Maze Solver (Breadth Search Help)
    By Raskalnikov in forum C Programming
    Replies: 5
    Last Post: 04-07-2009, 08:41 PM
  3. Registry Problem
    By guitarist809 in forum Windows Programming
    Replies: 4
    Last Post: 03-21-2008, 03:00 AM
  4. Retrieving PATH Environment Variable
    By mercury529 in forum Windows Programming
    Replies: 9
    Last Post: 01-09-2007, 08:02 PM
  5. linked list recursive function spaghetti
    By ... in forum C++ Programming
    Replies: 4
    Last Post: 09-02-2003, 03:53 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21