Example #1
0
  bool _WriteValue(CTSTRING &tsValName, ValueType Type, const void *pVal, DWORD dwBytes) {

    bool r       = false;
    DWORD dwType = 0UL;

    switch (Type) {

      case VT_DWORD:  dwType = REG_DWORD; break;
      case VT_STRING: dwType = REG_SZ; break;
      case VT_BINARY: dwType = REG_BINARY; break;

    }

    if (ERROR_SUCCESS == RegSetValueEx(m_hKey, 
                                       (0 < tsValName.size()) ? tsValName.c_str() : NULL,
                                       0UL,
                                       dwType,
                                       static_cast<const BYTE *>(pVal),
                                       dwBytes))
    {

      r = true;

    }

    return r;
  }
Example #2
0
  bool _ReadValue(CTSTRING &tsValName, ValueType Type, void *pVal, DWORD_PTR *pdwBytes) {

    bool r = false;

    if (ERROR_SUCCESS == RegQueryValueEx(m_hKey,
                                         (0 < tsValName.size()) ? tsValName.c_str() : NULL,
                                         0UL,
                                         NULL,
                                         static_cast<BYTE *>(pVal),
                                         pdwBytes))
    {

      r = true;

    }

    return r;
  }
Example #3
0
  bool SetDefaultValue(CTSTRING &tsVal) {

    return _WriteValue(_T(""), VT_STRING, tsVal.c_str(), 
                       static_cast<DWORD>(tsVal.size() * sizeof (TCHAR)));
  }
Example #4
0
  bool WriteString(CTSTRING &tsValName, CTSTRING &tsVal) {

    return _WriteValue(tsValName, VT_STRING, tsVal.c_str(),
                       static_cast<DWORD>(tsVal.size() * sizeof(TCHAR)));
  }