You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jul 26, 2023. It is now read-only.
ReadConsole() has an incorrect parameter mode, specifically on int lpNumberOfCharsRead, which is defined as an normal input parameter, but is supposed to be an output parameter, per the WinAPI docs.
Despite the clear intentions to do this (the [Friendly(FriendlyFlags.Out)] attribute), the actual parameter is not defined this way. This causes the following exception:
Fatal error. System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at PInvoke.Kernel32.ReadConsole(IntPtr, Void*, Int32, Int32, IntPtr)
at PInvoke.Kernel32.ReadConsole(IntPtr, Void*, Int32, Int32, IntPtr)
at Consolator.Console.Read()
at Tester.Program.Main()
It was missing the `out` modifier on the `lpNumberOfCharsRead` parameter.
While fixing it, I went ahead and renovated the entire signature to make it easier to use.
Fixes#523
ReadConsole()
has an incorrect parameter mode, specifically onint lpNumberOfCharsRead
, which is defined as an normal input parameter, but is supposed to be an output parameter, per the WinAPI docs.Despite the clear intentions to do this (the
[Friendly(FriendlyFlags.Out)]
attribute), the actual parameter is not defined this way. This causes the following exception:Creating my own import as follows:
Does not throw an exception, and operates as expected.
The text was updated successfully, but these errors were encountered: