1159b3361Sopenharmony_ci/*
2159b3361Sopenharmony_ci *  LAME MP3 encoder for DirectShow
3159b3361Sopenharmony_ci *  Registry calls handling class
4159b3361Sopenharmony_ci *
5159b3361Sopenharmony_ci *  Copyright (c) 2000-2005 Marie Orlova, Peter Gubanov, Vitaly Ivanov, Elecard Ltd.
6159b3361Sopenharmony_ci *
7159b3361Sopenharmony_ci * This library is free software; you can redistribute it and/or
8159b3361Sopenharmony_ci * modify it under the terms of the GNU Library General Public
9159b3361Sopenharmony_ci * License as published by the Free Software Foundation; either
10159b3361Sopenharmony_ci * version 2 of the License, or (at your option) any later version.
11159b3361Sopenharmony_ci *
12159b3361Sopenharmony_ci * This library is distributed in the hope that it will be useful,
13159b3361Sopenharmony_ci * but WITHOUT ANY WARRANTY; without even the implied warranty of
14159b3361Sopenharmony_ci * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15159b3361Sopenharmony_ci * Library General Public License for more details.
16159b3361Sopenharmony_ci *
17159b3361Sopenharmony_ci * You should have received a copy of the GNU Library General Public
18159b3361Sopenharmony_ci * License along with this library; if not, write to the
19159b3361Sopenharmony_ci * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
20159b3361Sopenharmony_ci * Boston, MA 02111-1307, USA.
21159b3361Sopenharmony_ci */
22159b3361Sopenharmony_ci
23159b3361Sopenharmony_ci#ifndef	__REG__
24159b3361Sopenharmony_ci#define	__REG__
25159b3361Sopenharmony_ci
26159b3361Sopenharmony_cinamespace Lame
27159b3361Sopenharmony_ci{
28159b3361Sopenharmony_ciclass	CRegKey
29159b3361Sopenharmony_ci{
30159b3361Sopenharmony_ciprotected:
31159b3361Sopenharmony_ci	TCHAR	m_name[MAX_PATH];
32159b3361Sopenharmony_ci	HKEY	m_hKey;
33159b3361Sopenharmony_ci	HKEY	m_hRootKey;
34159b3361Sopenharmony_cipublic:
35159b3361Sopenharmony_ci	CRegKey(void);
36159b3361Sopenharmony_ci	CRegKey(HKEY rootKey, PTSTR pName);
37159b3361Sopenharmony_ci	~CRegKey(void);
38159b3361Sopenharmony_ci
39159b3361Sopenharmony_ci	BOOL	Open(HKEY rootKey, PTSTR pName);
40159b3361Sopenharmony_ci	BOOL	Create(HKEY rootKey, PTSTR pName);
41159b3361Sopenharmony_ci	BOOL	Open(PTSTR an = NULL);
42159b3361Sopenharmony_ci	BOOL	Create(PTSTR an = NULL);
43159b3361Sopenharmony_ci	BOOL	Close(void);
44159b3361Sopenharmony_ci
45159b3361Sopenharmony_ci	operator HKEY () const { return m_hKey; };
46159b3361Sopenharmony_ci
47159b3361Sopenharmony_ci	BOOL	getFlag(PTSTR valuename, BOOL bDefault);
48159b3361Sopenharmony_ci	void	setFlag(PTSTR valuename, BOOL bValue, BOOL bDefault);
49159b3361Sopenharmony_ci	void	setFlag(PTSTR valuename, BOOL bValue);
50159b3361Sopenharmony_ci	DWORD	getDWORD(PTSTR valuename, DWORD bDefault);
51159b3361Sopenharmony_ci	void	setDWORD(PTSTR valuename, DWORD dwValue);
52159b3361Sopenharmony_ci	void	setDWORD(PTSTR valuename, DWORD dwValue, DWORD dwDefault);
53159b3361Sopenharmony_ci	DWORD	getString(PTSTR valuename, PTSTR pDefault, PTSTR pResult, int cbSize);
54159b3361Sopenharmony_ci	void	setString(PTSTR valuename, PTSTR pData);
55159b3361Sopenharmony_ci	DWORD	getBinary(PTSTR valuename, PVOID pDefault, PVOID pResult, int cbSize);
56159b3361Sopenharmony_ci	DWORD	setBinary(PTSTR valuename, PVOID pData, int cbSize);
57159b3361Sopenharmony_ci};
58159b3361Sopenharmony_ci
59159b3361Sopenharmony_ciclass CRegEnumKey
60159b3361Sopenharmony_ci{
61159b3361Sopenharmony_cipublic:
62159b3361Sopenharmony_ci	CRegEnumKey(HKEY hKey)
63159b3361Sopenharmony_ci	{
64159b3361Sopenharmony_ci		m_hKey = hKey;
65159b3361Sopenharmony_ci		m_dwIndex = 0;
66159b3361Sopenharmony_ci	}
67159b3361Sopenharmony_ci
68159b3361Sopenharmony_ci	~CRegEnumKey()
69159b3361Sopenharmony_ci	{
70159b3361Sopenharmony_ci	}
71159b3361Sopenharmony_ci
72159b3361Sopenharmony_ci	LONG Next(LPTSTR pszStr, DWORD cbName)
73159b3361Sopenharmony_ci	{
74159b3361Sopenharmony_ci		FILETIME	ftLastWriteTime;
75159b3361Sopenharmony_ci		LONG lRet =  RegEnumKeyEx(m_hKey, m_dwIndex, pszStr,
76159b3361Sopenharmony_ci						&cbName, NULL, NULL, NULL, &ftLastWriteTime);
77159b3361Sopenharmony_ci
78159b3361Sopenharmony_ci		m_dwIndex++;
79159b3361Sopenharmony_ci		return lRet;
80159b3361Sopenharmony_ci	}
81159b3361Sopenharmony_ci
82159b3361Sopenharmony_ci
83159b3361Sopenharmony_ci	void Reset(void)
84159b3361Sopenharmony_ci	{
85159b3361Sopenharmony_ci		m_dwIndex = 0;
86159b3361Sopenharmony_ci	}
87159b3361Sopenharmony_ciprotected:
88159b3361Sopenharmony_ci	HKEY	m_hKey;
89159b3361Sopenharmony_ci	DWORD	m_dwIndex;
90159b3361Sopenharmony_ci};
91159b3361Sopenharmony_ci}
92159b3361Sopenharmony_ci#endif // __REG__
93