DWORD type = 0; DWORD size = 2048;  LONG res = RegQueryValueEx(vbKey, key, NULL, &type, (UCHAR *)buffer, &size);
if(regEnabled) { DWORD type = 0; DWORD size = 2048;  LONG res = RegQueryValueEx(vbKey, key, NULL, &type, (UCHAR *)buffer, &size);  if(res == ERROR_SUCCESS && type == REG_SZ) return buffer;
char *regQueryStringValue(char * key, char *def){  DWORD type = 0;  DWORD size = 2048;    LONG res = RegQueryValueEx(vbKey,                             key,                             NULL,                             &type,                             (UCHAR *)buffer,                             &size);  if(res == ERROR_SUCCESS && type == REG_SZ)    return buffer;  return def;}