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