I have an array of bytes that I would like to get using the Int32 pointer (insecure context). I'm doing it
byte[] bgImageBytes = new byte[1000]; unsafe { fixed (byte* bgImgPtr = bgImageBytes) {
I am already accessing the pointer returned from kernel32.dll, both the Byte and Int32 pointer without any problems. But when I try to make an Int32 pointer on a managed byte array (example above), it seems to complain that it is controlled by code, so it won't work.
Just doing UInt32* bgImgIntPtr = (UInt32*)bgImgPtr; leading to MDA FatalExecutionEngineError: CLR was fatally damaged. This is most often caused by data corruption, which can be caused by a number of problems, such as calls to the incorrect platform function to call and transfer invalid data to the CLR.
My goal: Point both UInt32 and Byte pointers to a single bytearray so that I can read the Kinect heat map, both whole and individual colors. I know that I can easily convert between types, but since I work with several arrays in different formats, it would be much better if I could access them directly without having to switch between them all the time. There is a lot of simple copying, so it just adds the overhead to convert.
source share