1 // WindowsRegistry.cpp: Implementierung der Klasse WindowsRegistry.
2 //
3 //////////////////////////////////////////////////////////////////////
4 
5 #include "windowsregistry.hxx"
6 #include "registrywnt.hxx"
7 #include "registryw9x.hxx"
8 
9 #ifdef _MSC_VER
10 #pragma warning(disable : 4350)
11 #endif
12 
13 //------------------------------
14 //
15 //------------------------------
16 
17 WindowsRegistry::WindowsRegistry()
18 {
19 	OSVERSIONINFOA osverinfo;
20     ZeroMemory(&osverinfo, sizeof(osverinfo));
21     osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
22     GetVersionExA(&osverinfo);
23 
24     m_IsWinNT = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
25 }
26 
27 //------------------------------
28 //
29 //------------------------------
30 
31 RegistryKey WindowsRegistry::GetClassesRootKey(bool Writeable) const
32 {
33 	return GetRegistryKey(HKEY_CLASSES_ROOT, Writeable);
34 }
35 
36 //------------------------------
37 //
38 //------------------------------
39 
40 RegistryKey WindowsRegistry::GetCurrentUserKey(bool Writeable) const
41 {
42 	return GetRegistryKey(HKEY_CURRENT_USER, Writeable);
43 }
44 
45 //------------------------------
46 //
47 //------------------------------
48 
49 RegistryKey WindowsRegistry::GetLocalMachineKey(bool Writeable) const
50 {
51 	return GetRegistryKey(HKEY_LOCAL_MACHINE, Writeable);
52 }
53 
54 //------------------------------
55 //
56 //------------------------------
57 
58 RegistryKey WindowsRegistry::GetUserKey(bool Writeable) const
59 {
60 	return GetRegistryKey(HKEY_USERS, Writeable);
61 }
62 
63 //------------------------------
64 //
65 //------------------------------
66 
67 RegistryKey WindowsRegistry::GetRegistryKey(HKEY RootKey, bool Writeable) const
68 {
69 	RegistryKey regkey;
70 
71 	if (m_IsWinNT)
72 		regkey = RegistryKey(new RegistryKeyImplWinNT(RootKey));
73 	else
74 		regkey = RegistryKey(new RegistryKeyImplWin9x(RootKey));
75 
76 	regkey->Open(Writeable);
77 
78 	return regkey;
79 }
80