@@ -24,9 +24,7 @@ static PCWSTR NODEJS = L"Node.js";
2424static PCWSTR ENFORCE_CODE_INTEGRITY_SETTING_NAME = L" EnforceCodeIntegrity" ;
2525
2626void InitWldp (Environment* env) {
27-
28- if (isWldpInitialized)
29- {
27+ if (isWldpInitialized) {
3028 return ;
3129 }
3230
@@ -53,7 +51,7 @@ void InitWldp(Environment* env) {
5351 (pfnWldpQuerySecurityPolicy)GetProcAddress (
5452 wldp_module,
5553 " WldpQuerySecurityPolicy" );
56-
54+
5755 isWldpInitialized = true ;
5856}
5957
@@ -113,8 +111,7 @@ static void IsSystemEnforcingCodeIntegrity(
113111 InitWldp (env);
114112 }
115113
116- if (WldpGetApplicationSettingBoolean != nullptr )
117- {
114+ if (WldpGetApplicationSettingBoolean != nullptr ) {
118115 BOOL ret;
119116 HRESULT hr = WldpGetApplicationSettingBoolean (
120117 NODEJS,
@@ -125,14 +122,15 @@ static void IsSystemEnforcingCodeIntegrity(
125122 args.GetReturnValue ().Set (
126123 Boolean::New (env->isolate (), ret));
127124 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
131129 args.GetReturnValue ().Set (Boolean::New (env->isolate (), false ));
132130 return ;
133131 }
134- }
135-
132+ }
133+
136134 // WldpGetApplicationSettingBoolean is the preferred way for applications to
137135 // query security policy values. However, this method only exists on Windows
138136 // versions going back to circa Win10 2023H2. In order to support systems
@@ -162,7 +160,7 @@ static void IsSystemEnforcingCodeIntegrity(
162160 Boolean::New (env->isolate (), static_cast <bool >(ret)));
163161 }
164162}
165- #endif // _WIN32
163+ #endif // _WIN32
166164
167165#ifndef _WIN32
168166static void IsFileTrustedBySystemCodeIntegrityPolicy (
@@ -174,7 +172,7 @@ static void IsSystemEnforcingCodeIntegrity(
174172 const FunctionCallbackInfo<Value>& args) {
175173 args.GetReturnValue ().Set (false );
176174}
177- #endif // ifndef _WIN32
175+ #endif // ifndef _WIN32
178176
179177void Initialize (Local<Object> target,
180178 Local<Value> unused,
@@ -194,15 +192,14 @@ void Initialize(Local<Object> target,
194192}
195193
196194void RegisterExternalReferences (ExternalReferenceRegistry* registry) {
197- // BindingData::RegisterExternalReferences(registry);
198-
199195 registry->Register (IsFileTrustedBySystemCodeIntegrityPolicy);
200196 registry->Register (IsSystemEnforcingCodeIntegrity);
201197}
202198
203199} // namespace codeintegrity
204200} // namespace node
201+
205202NODE_BINDING_CONTEXT_AWARE_INTERNAL (code_integrity,
206203 node::codeintegrity::Initialize)
207204NODE_BINDING_EXTERNAL_REFERENCE(code_integrity,
208- node::codeintegrity::RegisterExternalReferences)
205+ node::codeintegrity::RegisterExternalReferences)
0 commit comments