Solved

RegEnumValue

Posted on 1998-05-06
2
529 Views
Last Modified: 2013-11-20
I just want to know the parameters declarations for the RegEnumValue function to be able to retreive values in a key. Which parameters I really need?
0
Comment
Question by:fmichaud061597
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 

Author Comment

by:fmichaud061597
ID: 1308110
Adjusted points to 50
0
 
LVL 11

Accepted Solution

by:
mikeblas earned 50 total points
ID: 1308111
You need all of them, except for the "reserved" parameter.

Here's a sample:

// -- begin file enum.cpp --

// compile me with
//      cl enum.cpp


#include <windows.h>
#include <stdio.h>

#pragma comment(lib, "advapi32.lib")

void main()
{
   HKEY hKey;

   if (ERROR_SUCCESS == RegOpenKeyEx(HKEY_LOCAL_MACHINE,
      "SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Extensions",
      0, KEY_READ, &hKey))
   {
      printf("It worked\n");

      DWORD dwIndex = 0;
      LONG lResult;

      while (1)
      {
         char szValue[1024];
         DWORD dwValueLen = sizeof(szValue) / sizeof(szValue[0]);
         BYTE bData[1024];
         DWORD dwDataLen = sizeof(bData) / sizeof(bData[0]);
         DWORD dwType;

         lResult = RegEnumValue(hKey, dwIndex, szValue, &dwValueLen,
            0, &dwType, bData, &dwDataLen);
         
         if (lResult == ERROR_SUCCESS)
         {
            printf("value name is \"%s\", ", szValue);

            if (dwType == REG_SZ)
               printf("Data is \"%s\"\n", bData);
            else if (dwType == REG_DWORD)
               printf("Data is 0x%8.8X\n", *((DWORD*) &bData));
            else
               printf("This program only supports DWORD and SZ\n");

            dwIndex++;
         }
         else
            break;
      }

      RegCloseKey(hKey);
   }

   return;
}

// -- end file enum.cpp --


.B ekiM
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction: Ownerdraw of the grid button.  A singleton class implentation and usage. Continuing from the fifth article about sudoku.   Open the project in visual studio. Go to the class view – CGridButton should be visible as a class.  R…
In this post we will learn different types of Android Layout and some basics of an Android App.
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.

737 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question