Hi, I have an IntPtr that points to an unmanaged array. This unmanaged array contains struct pointers. I am able to retrieve the first struct using Marshal.PtrToSt ructure() but I have been unable to retrieve the other structs in the array.
I have been trying to increment the pointer to get the location of the next struct in memory using: ThePointer = (IntPtr)((int)T hePointer + Marshal.SizeOf( TheStruct));
But as soon as I try calling Marshal.PtrToSt ructure() again to get the next struct, I always get an "attempted to read or write to protected memory" exception.
Is there a way that I can do this?
Thanks in advance.
I have been trying to increment the pointer to get the location of the next struct in memory using: ThePointer = (IntPtr)((int)T hePointer + Marshal.SizeOf( TheStruct));
But as soon as I try calling Marshal.PtrToSt ructure() again to get the next struct, I always get an "attempted to read or write to protected memory" exception.
Is there a way that I can do this?
Thanks in advance.
Comment