On input, buffer_length contains the length
of the provided buffer.
On output, buffer_length contains the total
number of bytes that were placed in the buffer. If your buffer is too small,
then buffer_length will be set to the required size, and no data
will be written to the buffer.