Results 1 to 3 of 3

Thread: Windows Registry Reading

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    43

    Windows Registry Reading



    Hello friends,

    I want to read all subkeys under a particular key.

    I got the function and tried. The codes are : -


    // for enumerating the subkeys

    int i = 0;
    char subKeyName[SIZE] ;
    memset(subKeyName, 0, SIZE);
    DWORD Buffsize = SIZE;
    PFILETIME time = NULL;


    cout<<subKeyName;
    do
    {

    if(RegEnumKeyEx(HKEY_CURRENT_USER, i, subKeyName, &Buffsize, 0, NULL, NULL, time) != ERROR_NO_MORE_ITEMS)

    {
    cout<<subKeyName<<"\n";
    i++;
    }
    else
    break;

    }while(1);

    The thing is it shows all subkey names but after showing first 3 - 4 names corectly the subsequent names are shown of having only 4-5 characters . e.g If subkey is Console then it is shown as Conso.
    Any help ?

  2. #2
    Kitten CornedBee's Avatar
    Join Date
    Aug 2001
    Location
    In a microchip!
    Posts
    11,594
    Reset Buffsize to SIZE on each iteration.
    All the buzzt
    CornedBee

    "Writing specifications is like writing a novel. Writing code is like writing poetry."
    - Anonymous, published by Raymond Chen

    Don't PM me with your problems, I scan most of the forums daily. If you do PM me, I will not answer your question.

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    43

    Smile

    Thanks Corned Bee. I did that and it worked perfectly.

    See you again for next query. Till then bye.

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