You may want to look at the functions available in the
System.Runtime.InteropServices.Marshal
class and see if any of them may be of use.
Take a look at
this article[
^] it may help with your requirement.
Not sure if this will work but you could try this;
IntPtr fileData_ptr = IntPtr.Zero;
try
{
managedDataFile.loadFile(@"MyFileName", fileData_ptr);
if (fileData_ptr != IntPtr.Zero)
{
IntPtr pData = managedDataFile.GlobalLock(fileData_ptr);
IntPtr pArrayLocation = pData;
Int32 uiSize = Marshal.ReadInt32(pData);
byte[] filebuf = new byte[uiSize];
Marshal.Copy(pArrayLocation, filebuf, 0, uiSize);
managedDataFile.GlobalUnlock(pData);
managedDataFile.GlobalFree(fileData_ptr);
}
}
catch
{
}