You obviusly have an issue with treating the data as a null terminated string somewhere in your code. What is the wrapper of which you speak? This looks a likely source of the issue if you can prove that a direct call to the DLL returns the expected stored data.