Skip to content

Commit

Permalink
?virusAnalysisHook s/[] (/auto lambdaScan = [] (/
Browse files Browse the repository at this point in the history
?`cxx/VirusAnalysis.cxx`:
	?`virusAnalysisHook`; `s/[] (/auto lambdaScan = [] (/` ("warning: expression result unused [-Wunused-value]" fix for issue #27.). Deduplicate lambdas.

Is followup to: commit b8023f3 (... ?`build.sh`: `CXXFLAGS_ANALYSIS`: -`-Wno-unused`), d5444b1 (?cxx/VirusAnalysis.*xx:+virusAnalysisHook(enum))

?`posts/VirusAnalysis.md`: Include all this.
  • Loading branch information
SwuduSusuwu committed Nov 24, 2024
1 parent b8023f3 commit a8c9f9b
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 40 deletions.
32 changes: 12 additions & 20 deletions cxx/VirusAnalysis.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -136,30 +136,22 @@ const VirusAnalysisHook virusAnalysisHook(VirusAnalysisHook hookStatus) { /* Ign
/* TODO: undo OS-specific "hook"s/"callback"s */
globalVirusAnalysisHook = virusAnalysisHookDefault;
}
auto lambdaScan = [](const PortableExecutable &file) {
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
};
if(virusAnalysisHookExec & hookStatus) {
/* callbackHook("exec*", */ [](const PortableExecutable &file) { /* TODO: OS-specific "hook"/"callback" for `exec()`/app-launches */
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
} /* ) */ ;
/* callbackHook("exec*", lambdaScan); */ /* TODO: OS-specific "hook"/"callback" for `exec()`/app-launches */
globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookExec);
}
if(virusAnalysisHookNewFile & hookStatus) {
/* callbackHook("fwrite", */ [](const PortableExecutable &file) { /* TODO: OS-specific "hook"/"callback" for new files/downloads */
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
} /* ) */ ;
/* callbackHook("fwrite", lambdaScan); */ /* TODO: OS-specific "hook"/"callback" for new files/downloads */
globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookNewFile);
}
return virusAnalysisGetHook();
Expand Down
32 changes: 12 additions & 20 deletions posts/VirusAnalysis.md
Original file line number Diff line number Diff line change
Expand Up @@ -1369,30 +1369,22 @@ const VirusAnalysisHook virusAnalysisHook(VirusAnalysisHook hookStatus) { /* Ign
/* TODO: undo OS-specific "hook"s/"callback"s */
globalVirusAnalysisHook = virusAnalysisHookDefault;
}
auto lambdaScan = [](const PortableExecutable &file) {
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
};
if(virusAnalysisHookExec & hookStatus) {
/* callbackHook("exec*", */ [](const PortableExecutable &file) { /* TODO: OS-specific "hook"/"callback" for `exec()`/app-launches */
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
} /* ) */ ;
/* callbackHook("exec*", lambdaScan); */ /* TODO: OS-specific "hook"/"callback" for `exec()`/app-launches */
globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookExec);
}
if(virusAnalysisHookNewFile & hookStatus) {
/* callbackHook("fwrite", */ [](const PortableExecutable &file) { /* TODO: OS-specific "hook"/"callback" for new files/downloads */
switch(virusAnalysis(file)) {
case virusAnalysisPass:
return true; /* launch this */
case virusAnalysisRequiresReview:
return (virusAnalysisPass == virusAnalysisManualReview(file));
default:
return false; /* abort */
}
} /* ) */ ;
/* callbackHook("fwrite", lambdaScan); */ /* TODO: OS-specific "hook"/"callback" for new files/downloads */
globalVirusAnalysisHook = (globalVirusAnalysisHook | virusAnalysisHookNewFile);
}
return virusAnalysisGetHook();
Expand Down

0 comments on commit a8c9f9b

Please sign in to comment.