1*32b1fd08SAndrew Rist /**************************************************************
2*32b1fd08SAndrew Rist *
3*32b1fd08SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*32b1fd08SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*32b1fd08SAndrew Rist * distributed with this work for additional information
6*32b1fd08SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*32b1fd08SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*32b1fd08SAndrew Rist * "License"); you may not use this file except in compliance
9*32b1fd08SAndrew Rist * with the License. You may obtain a copy of the License at
10*32b1fd08SAndrew Rist *
11*32b1fd08SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*32b1fd08SAndrew Rist *
13*32b1fd08SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*32b1fd08SAndrew Rist * software distributed under the License is distributed on an
15*32b1fd08SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*32b1fd08SAndrew Rist * KIND, either express or implied. See the License for the
17*32b1fd08SAndrew Rist * specific language governing permissions and limitations
18*32b1fd08SAndrew Rist * under the License.
19*32b1fd08SAndrew Rist *
20*32b1fd08SAndrew Rist *************************************************************/
21*32b1fd08SAndrew Rist
22cdf0e10cSrcweir // WindowsRegistry.cpp: Implementierung der Klasse WindowsRegistry.
23cdf0e10cSrcweir //
24cdf0e10cSrcweir //////////////////////////////////////////////////////////////////////
25cdf0e10cSrcweir
26cdf0e10cSrcweir #include "windowsregistry.hxx"
27cdf0e10cSrcweir #include "registrywnt.hxx"
28cdf0e10cSrcweir #include "registryw9x.hxx"
29cdf0e10cSrcweir
30cdf0e10cSrcweir #ifdef _MSC_VER
31cdf0e10cSrcweir #pragma warning(disable : 4350)
32cdf0e10cSrcweir #endif
33cdf0e10cSrcweir
34cdf0e10cSrcweir //------------------------------
35cdf0e10cSrcweir //
36cdf0e10cSrcweir //------------------------------
37cdf0e10cSrcweir
WindowsRegistry()38cdf0e10cSrcweir WindowsRegistry::WindowsRegistry()
39cdf0e10cSrcweir {
40cdf0e10cSrcweir OSVERSIONINFOA osverinfo;
41cdf0e10cSrcweir ZeroMemory(&osverinfo, sizeof(osverinfo));
42cdf0e10cSrcweir osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
43cdf0e10cSrcweir GetVersionExA(&osverinfo);
44cdf0e10cSrcweir
45cdf0e10cSrcweir m_IsWinNT = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
46cdf0e10cSrcweir }
47cdf0e10cSrcweir
48cdf0e10cSrcweir //------------------------------
49cdf0e10cSrcweir //
50cdf0e10cSrcweir //------------------------------
51cdf0e10cSrcweir
GetClassesRootKey(bool Writeable) const52cdf0e10cSrcweir RegistryKey WindowsRegistry::GetClassesRootKey(bool Writeable) const
53cdf0e10cSrcweir {
54cdf0e10cSrcweir return GetRegistryKey(HKEY_CLASSES_ROOT, Writeable);
55cdf0e10cSrcweir }
56cdf0e10cSrcweir
57cdf0e10cSrcweir //------------------------------
58cdf0e10cSrcweir //
59cdf0e10cSrcweir //------------------------------
60cdf0e10cSrcweir
GetCurrentUserKey(bool Writeable) const61cdf0e10cSrcweir RegistryKey WindowsRegistry::GetCurrentUserKey(bool Writeable) const
62cdf0e10cSrcweir {
63cdf0e10cSrcweir return GetRegistryKey(HKEY_CURRENT_USER, Writeable);
64cdf0e10cSrcweir }
65cdf0e10cSrcweir
66cdf0e10cSrcweir //------------------------------
67cdf0e10cSrcweir //
68cdf0e10cSrcweir //------------------------------
69cdf0e10cSrcweir
GetLocalMachineKey(bool Writeable) const70cdf0e10cSrcweir RegistryKey WindowsRegistry::GetLocalMachineKey(bool Writeable) const
71cdf0e10cSrcweir {
72cdf0e10cSrcweir return GetRegistryKey(HKEY_LOCAL_MACHINE, Writeable);
73cdf0e10cSrcweir }
74cdf0e10cSrcweir
75cdf0e10cSrcweir //------------------------------
76cdf0e10cSrcweir //
77cdf0e10cSrcweir //------------------------------
78cdf0e10cSrcweir
GetUserKey(bool Writeable) const79cdf0e10cSrcweir RegistryKey WindowsRegistry::GetUserKey(bool Writeable) const
80cdf0e10cSrcweir {
81cdf0e10cSrcweir return GetRegistryKey(HKEY_USERS, Writeable);
82cdf0e10cSrcweir }
83cdf0e10cSrcweir
84cdf0e10cSrcweir //------------------------------
85cdf0e10cSrcweir //
86cdf0e10cSrcweir //------------------------------
87cdf0e10cSrcweir
GetRegistryKey(HKEY RootKey,bool Writeable) const88cdf0e10cSrcweir RegistryKey WindowsRegistry::GetRegistryKey(HKEY RootKey, bool Writeable) const
89cdf0e10cSrcweir {
90cdf0e10cSrcweir RegistryKey regkey;
91cdf0e10cSrcweir
92cdf0e10cSrcweir if (m_IsWinNT)
93cdf0e10cSrcweir regkey = RegistryKey(new RegistryKeyImplWinNT(RootKey));
94cdf0e10cSrcweir else
95cdf0e10cSrcweir regkey = RegistryKey(new RegistryKeyImplWin9x(RootKey));
96cdf0e10cSrcweir
97cdf0e10cSrcweir regkey->Open(Writeable);
98cdf0e10cSrcweir
99cdf0e10cSrcweir return regkey;
100cdf0e10cSrcweir }
101