blob: 0f3dbeb1c03d26648ffe71059cb4885df016ed1e (
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
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.
#include "common.h"
#include "clrconfig.h"
#include "compatibilityswitch.h"
FCIMPL2(StringObject*, CompatibilitySwitch::GetValue, StringObject* switchNameUNSAFE, CLR_BOOL onlyDB) {
CONTRACTL {
FCALL_CHECK;
}
CONTRACTL_END;
if (!switchNameUNSAFE)
FCThrowRes(kArgumentNullException, W("Arg_InvalidSwitchName"));
STRINGREF name = (STRINGREF) switchNameUNSAFE;
VALIDATEOBJECTREF(name);
STRINGREF refName = NULL;
HELPER_METHOD_FRAME_BEGIN_RET_1(name);
CLRConfig::ConfigStringInfo info;
info.name = name->GetBuffer();
if(onlyDB)
{
// for public managed apis we ignore checking in registry/config/env
// only check in windows appcompat DB
info.options = CLRConfig::IgnoreEnv |
CLRConfig::IgnoreHKLM |
CLRConfig::IgnoreHKCU |
CLRConfig::IgnoreConfigFiles;
}
else
{
// for mscorlib (i.e. which use internal apis) also check in
// registry/config/env in addition to windows appcompat DB
info.options = CLRConfig::EEConfig_default;
}
LPWSTR strVal = CLRConfig::GetConfigValue(info);
refName = StringObject::NewString(strVal);
HELPER_METHOD_FRAME_END();
return (StringObject*)OBJECTREFToObject(refName);
}
FCIMPLEND
|