summaryrefslogtreecommitdiff
path: root/setup_native/source/win32/customactions/reg4msdoc/windowsregistry.cxx
blob: 1e97f779bc3932f1c3e3600b8a29d47af847c75c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
// WindowsRegistry.cpp: Implementierung der Klasse WindowsRegistry.
//
//////////////////////////////////////////////////////////////////////

#include "windowsregistry.hxx"
#include "registrywnt.hxx"
#include "registryw9x.hxx"

#ifdef _MSC_VER
#pragma warning(disable : 4350)
#endif

//------------------------------
//
//------------------------------

WindowsRegistry::WindowsRegistry()
{
    OSVERSIONINFOA osverinfo;
    ZeroMemory(&osverinfo, sizeof(osverinfo));
    osverinfo.dwOSVersionInfoSize = sizeof(osverinfo);
    GetVersionExA(&osverinfo);

    m_IsWinNT = (osverinfo.dwPlatformId == VER_PLATFORM_WIN32_NT);
}

//------------------------------
//
//------------------------------

RegistryKey WindowsRegistry::GetClassesRootKey(bool Writeable) const
{
    return GetRegistryKey(HKEY_CLASSES_ROOT, Writeable);
}

//------------------------------
//
//------------------------------

RegistryKey WindowsRegistry::GetCurrentUserKey(bool Writeable) const
{
    return GetRegistryKey(HKEY_CURRENT_USER, Writeable);
}

//------------------------------
//
//------------------------------

RegistryKey WindowsRegistry::GetLocalMachineKey(bool Writeable) const
{
    return GetRegistryKey(HKEY_LOCAL_MACHINE, Writeable);
}

//------------------------------
//
//------------------------------

RegistryKey WindowsRegistry::GetUserKey(bool Writeable) const
{
    return GetRegistryKey(HKEY_USERS, Writeable);
}

//------------------------------
//
//------------------------------

RegistryKey WindowsRegistry::GetRegistryKey(HKEY RootKey, bool Writeable) const
{
    RegistryKey regkey;

    if (m_IsWinNT)
        regkey = RegistryKey(new RegistryKeyImplWinNT(RootKey));
    else
        regkey = RegistryKey(new RegistryKeyImplWin9x(RootKey));

    regkey->Open(Writeable);

    return regkey;
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */