Q: How can I read data from the registry?

A:

Code:
#include <atlbase.h>

DWORD   dwValue = 0;
CRegKey RegKey;

// Open key
if(RegKey.Open(HKEY_LOCAL_MACHINE, "System\\CurrentControlSet\\Control\\Windows") != ERROR_SUCCESS)
  // Error handling

if(RegKey.QueryValue(dwValue, "CSDVersion") != ERROR_SUCCESS)
  // Error handling

// Close key
if(RegKey.Close() != ERROR_SUCCESS)
  // Error handling