private static void WriteBytes(IntPtr p, int length) { for (int i = 0; i < length; i++) { Marshal.WriteByte(p + i, (byte)i); } }