c# - Strange Console MoveBufferArea IOException -


I was making a "reverse console" (so that the written row is attached to the top instead of the bottom) I have a console Stuck on a very strange behavior. MovBufferArea method:

  static zero main (for (var_linesWritten = 0; _lines written & lt; 1000; _lines written ++) {var _height = Math Minimum (console.bufferhit - 1, _line written); console.mob buffer area (0, 0, console buffer wide, _heit, 0, 1); console.setcorption (0, 0); console.light line ("line {0} aaaaaaa", _ Links written); Console.ResetColor ();}}  

When I call it a certain number, then it is a system .IO.IOException says: "This command is processed Enough to do I'm not aware that this buffer depends on the quantity of the area moving around, the number of lines written before the exception changes, as I have changed the console, buffer width properties.

I'm running 7 7x64 @ korei 7, 6GB DDR3, so storage problems can not be a problem ... Do anyone have any clue? Which can be wrong?

< P> The API function causes the exception to ReadConsoleOutput (). SDK Doctor has some relevant small prints:

lpBuffer:

An indicator for a destination buffer that receives data from the console Does the screen buffer this pointer is considered as the origin of the two-dimensional array of CHAR_INFO structures whose size is specified by the dwBufferSize parameter. The total size of the array should be Less than 64K .

I bold the relevant phrase. Your program will be bombed while trying to scroll more than 200 lines (201 x 80 x 4 = 64320 bytes, slightly weaker than 65536). This is a bug in the console. MoveBufferArea (), it does not check this limit nor tries to work around it which will be easy to do. You can report a bug on the connect. Microsoft.com

For now, you need to limit the number of lines so that the buffer size does not exceed the limit.


Comments

Popular posts from this blog

c# - How to capture HTTP packet with SharpPcap -

php - Multiple Select with Explode: only returns the word "Array" -

php - jQuery AJAX Post not working -