@@ -24,9 +24,7 @@ static PCWSTR NODEJS = L"Node.js";
24
24
static PCWSTR ENFORCE_CODE_INTEGRITY_SETTING_NAME = L" EnforceCodeIntegrity" ;
25
25
26
26
void InitWldp (Environment* env) {
27
-
28
- if (isWldpInitialized)
29
- {
27
+ if (isWldpInitialized) {
30
28
return ;
31
29
}
32
30
@@ -53,7 +51,7 @@ void InitWldp(Environment* env) {
53
51
(pfnWldpQuerySecurityPolicy)GetProcAddress (
54
52
wldp_module,
55
53
" WldpQuerySecurityPolicy" );
56
-
54
+
57
55
isWldpInitialized = true ;
58
56
}
59
57
@@ -113,8 +111,7 @@ static void IsSystemEnforcingCodeIntegrity(
113
111
InitWldp (env);
114
112
}
115
113
116
- if (WldpGetApplicationSettingBoolean != nullptr )
117
- {
114
+ if (WldpGetApplicationSettingBoolean != nullptr ) {
118
115
BOOL ret;
119
116
HRESULT hr = WldpGetApplicationSettingBoolean (
120
117
NODEJS,
@@ -125,14 +122,15 @@ static void IsSystemEnforcingCodeIntegrity(
125
122
args.GetReturnValue ().Set (
126
123
Boolean::New (env->isolate (), ret));
127
124
return ;
128
- } else if (hr != E_NOTFOUND) {
129
- // If the setting is not found, continue through to attempt WldpQuerySecurityPolicy,
130
- // as the setting may be defined in the old settings format
125
+ } else if (hr != E_NOTFOUND) {
126
+ // If the setting is not found, continue through to attempt
127
+ // WldpQuerySecurityPolicy, as the setting may be defined
128
+ // in the old settings format
131
129
args.GetReturnValue ().Set (Boolean::New (env->isolate (), false ));
132
130
return ;
133
131
}
134
- }
135
-
132
+ }
133
+
136
134
// WldpGetApplicationSettingBoolean is the preferred way for applications to
137
135
// query security policy values. However, this method only exists on Windows
138
136
// versions going back to circa Win10 2023H2. In order to support systems
@@ -162,7 +160,7 @@ static void IsSystemEnforcingCodeIntegrity(
162
160
Boolean::New (env->isolate (), static_cast <bool >(ret)));
163
161
}
164
162
}
165
- #endif // _WIN32
163
+ #endif // _WIN32
166
164
167
165
#ifndef _WIN32
168
166
static void IsFileTrustedBySystemCodeIntegrityPolicy (
@@ -174,7 +172,7 @@ static void IsSystemEnforcingCodeIntegrity(
174
172
const FunctionCallbackInfo<Value>& args) {
175
173
args.GetReturnValue ().Set (false );
176
174
}
177
- #endif // ifndef _WIN32
175
+ #endif // ifndef _WIN32
178
176
179
177
void Initialize (Local<Object> target,
180
178
Local<Value> unused,
@@ -194,15 +192,14 @@ void Initialize(Local<Object> target,
194
192
}
195
193
196
194
void RegisterExternalReferences (ExternalReferenceRegistry* registry) {
197
- // BindingData::RegisterExternalReferences(registry);
198
-
199
195
registry->Register (IsFileTrustedBySystemCodeIntegrityPolicy);
200
196
registry->Register (IsSystemEnforcingCodeIntegrity);
201
197
}
202
198
203
199
} // namespace codeintegrity
204
200
} // namespace node
201
+
205
202
NODE_BINDING_CONTEXT_AWARE_INTERNAL (code_integrity,
206
203
node::codeintegrity::Initialize)
207
204
NODE_BINDING_EXTERNAL_REFERENCE(code_integrity,
208
- node::codeintegrity::RegisterExternalReferences)
205
+ node::codeintegrity::RegisterExternalReferences)
0 commit comments