VirtualProtect(System.IntPtr, System.IntPtr, uint, out uint)' must declare a body because it is not marked abstract, extern, or partial

StackOverflow https://stackoverflow.com/questions/23157404

  •  05-07-2023
  •  | 
  •  

Question

Hi can anyone help me with this error!

 [DllImport("kernel32.dll")]
 [return: MarshalAs(UnmanagedType.Bool)]
 private static bool VirtualProtect(IntPtr intptr_0, IntPtr intptr_1, uint uint_0, out uint uint_1);

 private unsafe int method_2(byte?[] nullable_0, int int_1 = 1, int int_2 = 16777216, int int_3 = 63963136)
 {
   byte* numPtr = (byte*) null;
   int num1;
   try
   {
     int num2 = 0;
     for (int index1 = int_2; index1 < int_3; ++index1)
     {
       numPtr = (byte*) index1;
       bool flag = false;
       for (int index2 = 0; index2 < nullable_0.Length; ++index2)
       {
         if (nullable_0[index2].HasValue)
         {
           int num3 = (int) *numPtr;
           byte? nullable = nullable_0[index2];
           if ((num3 != (int) nullable.GetValueOrDefault() ? 1 : (!nullable.HasValue ? 1 : 0)) != 0)
             break;
         }
         if (index2 == nullable_0.Length - 1)
         {
           if (int_1 == 1)
           {
             flag = true;
           }
           else
           {
             ++num2;
             if (num2 == int_1)
               flag = true;
           }
         }
         else
           ++numPtr;
       }
       if (flag)
       {
         num1 = index1;
         goto label_19;
       }
     }
   }
   catch (Exception ex)
   {
     Log.Write(InfinityScript.LogLevel.Error, string.Concat(new object[4]
     {
       (object) "FindMem: ",
       (object) ex.Message,
       (object) "\nAddress: ",
       (object) (int) numPtr
     }));
   }
   num1 = 0; label_19:
   return num1;
 }

Thank you in advance

Was it helpful?

Solution

Mark it extern like the message says.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top