using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Runtime.InteropServices;


namespace vmp
{
    public class SDK
    {
        // 引用 VMProtect 
        [DllImport("virbox32.dll", EntryPoint = "VBProtectBegin", CallingConvention = CallingConvention.StdCall)]
        public static extern int VBProtectBegin(string tag);

        [DllImport("virbox32.dll", EntryPoint = "VBVirtualizeBegin", CallingConvention = CallingConvention.StdCall)]
        public static extern int VBVirtualizeBegin(string tag);

        [DllImport("virbox32.dll", EntryPoint = "VBMutateBegin", CallingConvention = CallingConvention.StdCall)]
        public static extern int VBMutateBegin(string tag);

        [DllImport("virbox32.dll", EntryPoint = "VBProtectEnd", CallingConvention = CallingConvention.StdCall)]
        public static extern void VBProtectEnd();
    }
}

namespace netusingvmp
{
      public class myPoint
    {
        class show
        {
            public void myPrint()
            {
                
            }
        }

        public int x, y;
        public myPoint(int x,int y)
        {
            this.x = x;
            this.y = y;
        }
        public void myPrintPoint()
        {
            Console.WriteLine("myPoint = ({0},{1})", this.x, this.y);
        }
    }
	
    class Program
    {   
	
        static void add(int x,int y,out int sub)
        {
            vmp.SDK.VBMutateBegin("VBMutateBegin");
            sub = x + y;
            myPoint p = new myPoint(33, 22);
            p.x += x;
            p.y += y;
            p.myPrintPoint();
            vmp.SDK.VBProtectEnd();
           
        }
		
        static void decrease(int x, int y,out int dec)
        {
             dec = x - y;
           
        }
		
        static void Main(string[] args)
        {
            myPoint p = new myPoint(33,22);
            p.myPrintPoint();
            int sub, dec;
            add(p.x, p.y, out sub);
            Console.WriteLine("add = {0}", sub);
            decrease(p.x, p.y, out dec);
            Console.WriteLine("dec = {0}", dec);
            p.myPrintPoint();
            Console.ReadKey(true);
        }
    }
}
