ReactOS 0.4.17-dev-1005-g171e1de
env_windowsUserModeWin8_1.c File Reference
#include <windows.h>
#include "symcrypt.h"
#include "sc_lib.h"
Include dependency graph for env_windowsUserModeWin8_1.c:

Go to the source code of this file.

Functions

SYMCRYPT_CPU_FEATURES SYMCRYPT_CALL SymCryptCpuFeaturesNeverPresentEnvWindowsUsermodeWin8_1nLater ()
 
VOID SYMCRYPT_CALL SymCryptInitEnvWindowsUsermodeWin8_1nLater (UINT32 version)
 
_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatalEnvWindowsUsermodeWin8_1nLater (UINT32 fatalCode)
 
VOID SYMCRYPT_CALL SymCryptTestInjectErrorEnvWindowsUsermodeWin8_1nLater (PBYTE pbBuf, SIZE_T cbBuf)
 

Function Documentation

◆ SymCryptCpuFeaturesNeverPresentEnvWindowsUsermodeWin8_1nLater()

SYMCRYPT_CPU_FEATURES SYMCRYPT_CALL SymCryptCpuFeaturesNeverPresentEnvWindowsUsermodeWin8_1nLater ( )

Definition at line 17 of file env_windowsUserModeWin8_1.c.

18{
19 return 0;
20}

◆ SymCryptFatalEnvWindowsUsermodeWin8_1nLater()

_Analysis_noreturn_ VOID SYMCRYPT_CALL SymCryptFatalEnvWindowsUsermodeWin8_1nLater ( UINT32  fatalCode)

Definition at line 75 of file env_windowsUserModeWin8_1.c.

76{
77 UINT32 fatalCodeVar;
78
79 SymCryptFatalIntercept( fatalCode );
80
81 //
82 // Put the fatal code in a location where it shows up in the dump
83 //
84 SYMCRYPT_FORCE_WRITE32( &fatalCodeVar, fatalCode );
85
86 //
87 // Our first preference is to fastfail,
88 // the second to create an AV, which triggers a Watson report so that we get to
89 // see what is going wrong.
90 //
92
93 //
94 // Next we write to the NULL pointer, this causes an AV
95 //
96 SYMCRYPT_FORCE_WRITE32( (volatile UINT32 *)NULL, fatalCode );
97
98 //
99 // If that fails, we terminate the process. (This function call also ensures that this environment is actually
100 // used in user mode and not some other environment.)
101 // (During testing we had the TerminateProcess as the first option, but that makes debugging very hard as
102 // it leaves no traces of what went wrong.)
103 //
104 TerminateProcess( GetCurrentProcess(), fatalCode );
105
106 SymCryptFatalHang( fatalCode );
107}
VOID SYMCRYPT_CALL SymCryptFatalIntercept(UINT32 fatalCode)
#define NULL
Definition: types.h:112
#define GetCurrentProcess()
Definition: compat.h:759
BOOL WINAPI TerminateProcess(IN HANDLE hProcess, IN UINT uExitCode)
Definition: proc.c:1425
__fastfail(FAST_FAIL_INVALID_ARG)
_Analysis_noreturn_ SYMCRYPT_NOINLINE VOID SYMCRYPT_CALL SymCryptFatalHang(UINT32 fatalCode)
Definition: libmain.c:101
#define FAST_FAIL_CRYPTO_LIBRARY
Definition: sc_lib.h:58
#define SYMCRYPT_FORCE_WRITE32(_p, _v)
Definition: symcrypt.h:423
uint32_t UINT32
Definition: typedefs.h:59

◆ SymCryptInitEnvWindowsUsermodeWin8_1nLater()

VOID SYMCRYPT_CALL SymCryptInitEnvWindowsUsermodeWin8_1nLater ( UINT32  version)

Definition at line 24 of file env_windowsUserModeWin8_1.c.

25{
27 {
28 return;
29 }
30
31#if SYMCRYPT_CPU_X86 | SYMCRYPT_CPU_AMD64
32 //
33 // First we detect what the CPU has
34 //
36
37 //
38 // We also need to be sure that the OS supports the extended registers.
39 //
40 {
41 ULONGLONG FeatureMask = GetEnabledXStateFeatures();
42
43 if( !(FeatureMask & XSTATE_MASK_AVX) )
44 {
45 g_SymCryptCpuFeaturesNotPresent |= SYMCRYPT_CPU_FEATURE_AVX2;
46 }
47
48 if( !(FeatureMask & XSTATE_MASK_AVX512) )
49 {
50 g_SymCryptCpuFeaturesNotPresent |= SYMCRYPT_CPU_FEATURE_AVX512;
51 }
52 }
53
54 //
55 // Our SaveXmm function never fails because it doesn't have to do anything in User mode.
56 //
57 g_SymCryptCpuFeaturesNotPresent &= ~SYMCRYPT_CPU_FEATURE_SAVEXMM_NOFAIL;
58
59#elif SYMCRYPT_CPU_ARM
60
61 g_SymCryptCpuFeaturesNotPresent = (SYMCRYPT_CPU_FEATURES) ~SYMCRYPT_CPU_FEATURE_NEON;
62
63#elif SYMCRYPT_CPU_ARM64
64
66
67#endif
68
70}
static const WCHAR version[]
Definition: asmname.c:66
UINT32 g_SymCryptFlags
Definition: libmain.c:18
VOID SYMCRYPT_CALL SymCryptInitEnvCommon(UINT32 version)
Definition: libmain.c:43
#define SYMCRYPT_FLAG_LIB_INITIALIZED
Definition: sc_lib.h:22
VOID SYMCRYPT_CALL SymCryptDetectCpuFeaturesFromIsProcessorFeaturePresent(void)
VOID SYMCRYPT_CALL SymCryptDetectCpuFeaturesByCpuid(UINT32 flags)
#define SYMCRYPT_CPUID_DETECT_FLAG_CHECK_OS_SUPPORT_FOR_YMM
Definition: sc_lib.h:1025
UINT32 SYMCRYPT_CPU_FEATURES
SYMCRYPT_CPU_FEATURES g_SymCryptCpuFeaturesNotPresent
Definition: libmain.c:20
uint64_t ULONGLONG
Definition: typedefs.h:67
WINBASEAPI DWORD64 WINAPI GetEnabledXStateFeatures()
#define XSTATE_MASK_AVX512
Definition: ketypes.h:1304
#define XSTATE_MASK_AVX
Definition: ketypes.h:1302

◆ SymCryptTestInjectErrorEnvWindowsUsermodeWin8_1nLater()

VOID SYMCRYPT_CALL SymCryptTestInjectErrorEnvWindowsUsermodeWin8_1nLater ( PBYTE  pbBuf,
SIZE_T  cbBuf 
)

Definition at line 168 of file env_windowsUserModeWin8_1.c.

169{
170 //
171 // This feature is only used during testing. In production it is always
172 // an empty function that the compiler can optimize away.
173 //
174 UNREFERENCED_PARAMETER( pbBuf );
175 UNREFERENCED_PARAMETER( cbBuf );
176}
#define UNREFERENCED_PARAMETER(P)
Definition: ntbasedef.h:329