From 9903007e5c4407ded451cac0b8164e3d69deb891 Mon Sep 17 00:00:00 2001 From: JJ Liebig Date: Wed, 23 Sep 2026 14:26:17 +0200 Subject: test(windows): capture native console input records (#4520) refs #4470 --- scripts/windows_input/Native.cs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'scripts/windows_input') diff --git a/scripts/windows_input/Native.cs b/scripts/windows_input/Native.cs index 42b387b1..76cb8af7 100644 --- a/scripts/windows_input/Native.cs +++ b/scripts/windows_input/Native.cs @@ -389,7 +389,7 @@ namespace HerdrInputGauntlet { [DllImport("kernel32.dll")] static extern bool SetConsoleCP(uint cp); [DllImport("kernel32.dll")] static extern bool ReadFile(IntPtr handle,byte[] buffer,uint size,out uint count,IntPtr overlap); [DllImport("kernel32.dll")] static extern bool WriteFile(IntPtr handle,byte[] buffer,uint size,out uint count,IntPtr overlap); - [DllImport("kernel32.dll")] static extern bool ReadConsoleInputW(IntPtr handle,Record[] records,uint size,out uint count); + [DllImport("kernel32.dll")] static extern bool ReadConsoleInputW(IntPtr handle,[Out] Record[] records,uint size,out uint count); [DllImport("kernel32.dll")] static extern uint GetCurrentThreadId(); [DllImport("kernel32.dll")] static extern IntPtr OpenThread(uint access,bool inherit,uint id); [DllImport("kernel32.dll")] static extern bool CancelSynchronousIo(IntPtr thread); @@ -459,7 +459,11 @@ namespace HerdrInputGauntlet { public void Clear() { lock(gate) { bytes.Clear(); records.Clear(); } } public bool ClearIfCount(int expected) { lock(gate) { - if(bytes.Count+records.Count!=expected) return false; + if(bytes.Count+records.Count!=expected) { + if(!native || bytes.Count!=0 || records.Count