All the per-API message structure unpacking and console validation done
with ConSrvGetConsole() is now automatically generated using the macros,
so that the actual implementation of each API can be done independently
of how the console object is obtained.
This could also allow reusing these API implementations with a different
mechanism for obtaining the console without changing anything in them.
In addition, honour the maximum number of history buffers allowed when
creating new ones.
Some implementation information has been obtained from
https://github.com/microsoft/terminal
(under MIT License).