Switch to buffer protocol

Raw data of bytes, bytearray, or memoryview objects are now accessed via
new buffer protocol. The old way didn't work for memoryview objects in
Python 2.7 and was deprecated in Python 3.
Change argument from c_long to c_ulong

Changed argument type passed to low-level functions from c_long to
c_ulong to be compatiple with pyreadline, which sets parameter types of
WriteConsoleW.