Better asked in microsoft.public.dotnet.framework.interop, but:
Use the Marshal methods:
IntPtr pData = ....
byte[] buffdata = new byte[size];
Marshal.Copy(pData, buffdata, 0, size);
Note that it is often easier to proto-type with a [In, Out] byte[] data
then using an IntPtr.
- Michel Gallant
MVP Security
"Dave" <(E-Mail Removed)> wrote in message news:020501c361b3$5088f8e0$(E-Mail Removed)...
> We are writing some code to interface to a DLL. The DLL
> has a callback method that returns the address of a byte
> buffer and the buffer length. I have defined the byte
> pointer as an IntPtr.
>
> How do I convert between the IntPtr and my managed byte[]
> that I want to copy the data into???
>
> -dave
|