Hi, I'm using CryptProtectData() and CryptUnprotectData() APIs for data encryption and decryption in our App. Reading API document here: https://docs.microsoft.com/en-us/windows/win32/api/dpapi/nf-dpapi-cryptprotectdata, it's not clear why LocalFree() needs to be called against the output buffer after usage, the example code on that page does not invoke LocalFree().
What's also missing on the document (The main reason for this question) is that, how DATA_BLOB::pbData for the output is managed by DPAPI? Can I provide my own memory? If I can, how do I know the output buffer size of the encrypted data?