+ return false;
+}
+
+bool wxRegKey::SetValue(const wxChar *szValue,const wxMemoryBuffer& buffer)
+{
+#ifdef __TWIN32__
+ wxFAIL_MSG("RegSetValueEx not implemented by TWIN32");
+ return false;
+#else
+ if ( CONST_CAST Open() ) {
+ m_dwLastError = RegSetValueEx((HKEY) m_hKey, szValue, (DWORD) RESERVED, REG_BINARY,
+ (RegBinary)buffer.GetData(),buffer.GetDataLen());
+ if ( m_dwLastError == ERROR_SUCCESS )
+ return true;
+ }
+
+ wxLogSysError(m_dwLastError, _("Can't set value of '%s'"),
+ GetFullName(this, szValue));
+ return false;
+#endif
+}
+
+bool wxRegKey::QueryValue(const wxChar *szValue, wxMemoryBuffer& buffer) const
+{
+ if ( CONST_CAST Open() ) {
+ // first get the type and size of the data
+ DWORD dwType, dwSize;
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey, WXSTRINGCAST szValue, RESERVED,
+ &dwType, NULL, &dwSize);
+
+ if ( m_dwLastError == ERROR_SUCCESS ) {
+ if ( dwSize ) {
+ const RegBinary pBuf = (RegBinary)buffer.GetWriteBuf(dwSize);
+ m_dwLastError = RegQueryValueEx((HKEY) m_hKey,
+ WXSTRINGCAST szValue,
+ RESERVED,
+ &dwType,
+ pBuf,
+ &dwSize);
+ buffer.UngetWriteBuf(dwSize);
+ } else {
+ buffer.SetDataLen(0);
+ }
+ }
+
+
+ if ( m_dwLastError != ERROR_SUCCESS ) {
+ wxLogSysError(m_dwLastError, _("Can't read value of key '%s'"),
+ GetName().c_str());
+ return false;
+ }
+ return true;
+ }
+ return false;