blob: 7ea7187eb1a9ee4f48178ea9c1be5ab10507a500 (
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
|
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#include "staticcontract.h"
#ifndef WRAPPER_NO_CONTRACT
#define WRAPPER_NO_CONTRACT ANNOTATION_WRAPPER
#endif
#ifndef LIMITED_METHOD_CONTRACT
#define LIMITED_METHOD_CONTRACT ANNOTATION_FN_LEAF
#endif
//*****************************************************************************
// Enum to track which version of the OS we are running
// Note that NT5 (Win2k) is the minimum supported platform. Any code using
// utilcode (which includes the CLR's execution engine) will fail to start
// on a pre-Win2k platform. This is enforced by InitRunningOnVersionStatus.
//
// Note: The value is used for data mining from links clicked by user in shim dialog - see code:FWLinkTemplateFromTextID
// Please do not modify existing values, adding new ones is fine.
//*****************************************************************************
typedef enum {
RUNNING_ON_STATUS_UNINITED = 0,
RUNNING_ON_WIN7 = 1,
RUNNING_ON_WIN8 = 2
} RunningOnStatusEnum;
extern RunningOnStatusEnum gRunningOnStatus;
void InitRunningOnVersionStatus();
#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM)
typedef enum
{
WINRT_STATUS_UNINITED = 0,
WINRT_STATUS_UNSUPPORTED,
WINRT_STATUS_SUPPORTED
}
WinRTStatusEnum;
extern WinRTStatusEnum gWinRTStatus;
void InitWinRTStatus();
#endif // FEATURE_COMINTEROP && !FEATURE_CORESYSTEM
//*****************************************************************************
// Returns true if you are running on Windows 8 or newer.
//*****************************************************************************
inline BOOL RunningOnWin8()
{
WRAPPER_NO_CONTRACT;
#if (!defined(HOST_X86) && !defined(HOST_AMD64)) || defined(CROSSGEN_COMPILE)
return TRUE;
#else
if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED)
{
InitRunningOnVersionStatus();
}
return (gRunningOnStatus >= RUNNING_ON_WIN8) ? TRUE : FALSE;
#endif
}
#ifdef FEATURE_COMINTEROP
#ifdef FEATURE_CORESYSTEM
inline BOOL WinRTSupported()
{
return RunningOnWin8();
}
#else
inline BOOL WinRTSupported()
{
STATIC_CONTRACT_NOTHROW;
STATIC_CONTRACT_GC_NOTRIGGER;
STATIC_CONTRACT_CANNOT_TAKE_LOCK;
#ifdef CROSSGEN_COMPILE
return TRUE;
#endif
if (gWinRTStatus == WINRT_STATUS_UNINITED)
{
InitWinRTStatus();
}
return gWinRTStatus == WINRT_STATUS_SUPPORTED;
}
#endif // FEATURE_CORESYSTEM
#endif // FEATURE_COMINTEROP
#ifdef HOST_64BIT
inline BOOL RunningInWow64()
{
return FALSE;
}
#else
BOOL RunningInWow64();
#endif
|