Skip to content

Commit 3dcc862

Browse files
Owen McGirrOwen McGirr
authored andcommitted
Cancel qualification after lost event evidence
1 parent 0e2a7b8 commit 3dcc862

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

tools/keyboard-qualification/WindowsProbe.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,11 @@ internal static class WindowsProbe
3030
static readonly ConcurrentQueue<string> Events=new ConcurrentQueue<string>();
3131
static int EventCount, Overflow;
3232
static uint HookThread;
33-
static void FlushEvents() {
33+
static bool FlushEvents() {
3434
string value;
3535
while(Events.TryDequeue(out value)) { Interlocked.Decrement(ref EventCount);Log(value); }
36-
if(Interlocked.Exchange(ref Overflow,0)!=0) { Recording=false;Log("BLOCKED: Event evidence overflowed or could not be recorded."); }
36+
if(Interlocked.Exchange(ref Overflow,0)!=0) { Recording=false;Log("BLOCKED: Event evidence overflowed or could not be recorded.");return false; }
37+
return true;
3738
}
3839
static AutomationElement OwnedKeyboard(DateTime opened,ref int ownedPid) {
3940
int expectedPid=ownedPid;
@@ -96,7 +97,7 @@ [STAThread] static void Main() {
9697
};
9798
timer.Tick+=(s,e)=>{
9899
try {
99-
FlushEvents();
100+
if(!FlushEvents()) throw new Exception("Event evidence is incomplete; sequence cancelled");
100101
if(root==null) {
101102
if(initiallyOpen) {
102103
var process=Process.GetProcessesByName("osk").FirstOrDefault();

0 commit comments

Comments
 (0)