I'm busy writing a tool, but things aren't really going as expected in the windows registry area, I'm trying to read a value from the registry. So if there was a key HKEY_CURRENT_USER\Software\Brian\ and a value Mega which contained the string "Rad" I would expect this code to extract the value Rad for me.

Code:
#include <windows.h>

int WINAPI WinMain (HINSTANCE hi, HINSTANCE hpi, LPSTR arg, int nfs)
{
  HKEY fdkey;
  
  char dir[250];
  DWORD cbData = 7;
  RegOpenKey(HKEY_CURRENT_USER, "Software\\Brian", &fdkey);
   
  RegQueryValue(fdkey, "Mega", dir, NULL);
  RegCloseKey(fdkey);
  MessageBox(0,dir,"value",0);
  return 0;
}