Exemplo n.º 1
0
/* walks to the first value */
bool
RegFindFirstValue (HKEY hKey, LPCTSTR *ppszValue, RegVal *pValData)
{
  if (RegQueryInfoKey (hKey, NULL, NULL, 0, NULL, NULL, NULL,
    &g_dwValueCnt, &g_dwValueMax, NULL, NULL, NULL) == ERROR_SUCCESS)
    {
      if (g_dwValueCnt)
        {
          if (g_pszValue)
            {
              free (g_pszValue);
              g_pszValue = NULL;
            }
          g_pszValue = (LPTSTR) malloc (g_dwValueMax += 1);
          if (g_pszValue)
            {
              DWORD dwMaxValue = g_dwValueMax;
              g_dwValue = 0;
              if (RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
                {
                  *ppszValue = g_pszValue;
                  return RegLoadVal (hKey, NULL, g_pszValue, pValData);
                }
            }
        }
    }
  return false;
}
Exemplo n.º 2
0
/* walks to the next value */
bool RegFindNextValue (HKEY hKey, LPCTSTR *ppszValue, RegVal *pValData)
{
  DWORD dwMaxValue = g_dwValueMax;
  if (g_dwValue < g_dwValueCnt && RegEnumValue (hKey, g_dwValue++, g_pszValue, &dwMaxValue, 0, NULL, NULL, NULL) == ERROR_SUCCESS)
    {
      *ppszValue = g_pszValue;
      return RegLoadVal (hKey, NULL, g_pszValue, pValData);
    }
  return false;
}
Exemplo n.º 3
0
/* load an array of strings */
bool
RegLoadStringArr (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, CStringArray &arrString)
{
  RegVal Value;
  if (RegLoadVal (hKey, pszSubKey, pszValName, &Value))
    {
      if (RegValGetStringArr (&Value, arrString))
        {
          RegValFree (&Value);
          return true;
        }
      RegValFree (&Value);
    }
  return false;
}
Exemplo n.º 4
0
/* load a new array of strings */
bool
RegLoadNewStringArr (HKEY hKey, LPCTSTR pszSubKey, LPCTSTR pszValName, LPTSTR **pszStrings, DWORD *pdwCount)
{
  RegVal Value;
  if (RegLoadVal (hKey, pszSubKey, pszValName, &Value))
    {
      if (RegValGetNewStringArr (&Value, pszStrings, pdwCount))
        {
          RegValFree (&Value);
          return true;
        }
      RegValFree (&Value);
    }
  return false;
}
Exemplo n.º 5
0
/* load data of any type from subkey */
bool CReg::LoadVal (LPCTSTR pszSubKey, LPCTSTR pszValName, RegVal *pValData)
{
  return RegLoadVal (hKey, pszSubKey, pszValName, pValData);
}
Exemplo n.º 6
0
/* load data of any type */
bool CReg::LoadVal (LPCTSTR pszValName, RegVal *pValData)
{
  return RegLoadVal (hKey, nullptr, pszValName, pValData);
}