Update ooo320-m1
[ooovba.git] / setup_native / source / win32 / customactions / reg4msdoc / windowsregistry.cxx
blob9d73d343d239562180c25a24dc40b310ba289fae
1 // WindowsRegistry.cpp: Implementierung der Klasse WindowsRegistry.
2 //
3 //////////////////////////////////////////////////////////////////////
5 #include "windowsregistry.hxx"
6 #include "registrywnt.hxx"
7 #include "registryw9x.hxx"
9 #ifdef _MSC_VER
10 #pragma warning(disable : 4350)
11 #endif
13 //------------------------------
15 //------------------------------
17 WindowsRegistry::WindowsRegistry()
19 OSVERSIONINFOA osverinfo;
20 ZeroMemory(&osverinfo, sizeof(osverinfo));
21 osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
22 GetVersionExA(&osverinfo);
24 m_IsWinNT = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
27 //------------------------------
29 //------------------------------
31 RegistryKey WindowsRegistry::GetClassesRootKey(bool Writeable) const
33 return GetRegistryKey(HKEY_CLASSES_ROOT, Writeable);
36 //------------------------------
38 //------------------------------
40 RegistryKey WindowsRegistry::GetCurrentUserKey(bool Writeable) const
42 return GetRegistryKey(HKEY_CURRENT_USER, Writeable);
45 //------------------------------
47 //------------------------------
49 RegistryKey WindowsRegistry::GetLocalMachineKey(bool Writeable) const
51 return GetRegistryKey(HKEY_LOCAL_MACHINE, Writeable);
54 //------------------------------
56 //------------------------------
58 RegistryKey WindowsRegistry::GetUserKey(bool Writeable) const
60 return GetRegistryKey(HKEY_USERS, Writeable);
63 //------------------------------
65 //------------------------------
67 RegistryKey WindowsRegistry::GetRegistryKey(HKEY RootKey, bool Writeable) const
69 RegistryKey regkey;
71 if (m_IsWinNT)
72 regkey = RegistryKey(new RegistryKeyImplWinNT(RootKey));
73 else
74 regkey = RegistryKey(new RegistryKeyImplWin9x(RootKey));
76 regkey->Open(Writeable);
78 return regkey;