Debian Codegraph @

dshow/REG.H

raw
1 /*
2 * LAME MP3 encoder for DirectShow
3 * Registry calls handling class
4 *
5 * Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
6 *
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Library General Public
9 * License as published by the Free Software Foundation; either
10 * version 2 of the License, or (at your option) any later version.
11 *
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Library General Public License for more details.
16 *
17 * You should have received a copy of the GNU Library General Public
18 * License along with this library; if not, write to the
19 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20 * Boston, MA 02111-1307, USA.
21 */
22
23 #ifndef __REG__
24 #define __REG__
25
26 namespace Lame
27 {
28 class CRegKey
29 {
30 protected:
31 TCHAR m_name[MAX_PATH];
32 HKEY m_hKey;
33 HKEY m_hRootKey;
34 public:
35 CRegKey(void);
36 CRegKey(HKEY rootKey, PTSTR pName);
37 ~CRegKey(void);
38
39 BOOL Open(HKEY rootKey, PTSTR pName);
40 BOOL Create(HKEY rootKey, PTSTR pName);
41 BOOL Open(PTSTR an = NULL);
42 BOOL Create(PTSTR an = NULL);
43 BOOL Close(void);
44
45 operator HKEY () const { return m_hKey; };
46
47 BOOL getFlag(PTSTR valuename, BOOL bDefault);
48 void setFlag(PTSTR valuename, BOOL bValue, BOOL bDefault);
49 void setFlag(PTSTR valuename, BOOL bValue);
50 DWORD getDWORD(PTSTR valuename, DWORD bDefault);
51 void setDWORD(PTSTR valuename, DWORD dwValue);
52 void setDWORD(PTSTR valuename, DWORD dwValue, DWORD dwDefault);
53 DWORD getString(PTSTR valuename, PTSTR pDefault, PTSTR pResult, int cbSize);
54 void setString(PTSTR valuename, PTSTR pData);
55 DWORD getBinary(PTSTR valuename, PVOID pDefault, PVOID pResult, int cbSize);
56 DWORD setBinary(PTSTR valuename, PVOID pData, int cbSize);
57 };
58
59 class CRegEnumKey
60 {
61 public:
62 CRegEnumKey(HKEY hKey)
63 {
64 m_hKey = hKey;
65 m_dwIndex = 0;
66 }
67
68 ~CRegEnumKey()
69 {
70 }
71
72 LONG Next(LPTSTR pszStr, DWORD cbName)
73 {
74 FILETIME ftLastWriteTime;
75 LONG lRet = RegEnumKeyEx(m_hKey, m_dwIndex, pszStr,
76 &cbName, NULL, NULL, NULL, &ftLastWriteTime);
77
78 m_dwIndex++;
79 return lRet;
80 }
81
82
83 void Reset(void)
84 {
85 m_dwIndex = 0;
86 }
87 protected:
88 HKEY m_hKey;
89 DWORD m_dwIndex;
90 };
91 }
92 #endif // __REG__