Пример #1
0
 static HighPrecisionTimerHelper()
 {
     Addr = Marshal.AllocHGlobal(3);
     int old = 0;
     VirtualProtect(Addr, 3, 0x40, ref old);
     Marshal.Copy(asm, 0, Addr, 3);
     getTick = (GetTickDelegate)Marshal.GetDelegateForFunctionPointer(Addr, typeof(GetTickDelegate));
 }
Пример #2
0
        static HighPrecisionTimerHelper()
        {
            Addr = Marshal.AllocHGlobal(3);
            int old = 0;

            VirtualProtect(Addr, 3, 0x40, ref old);
            Marshal.Copy(asm, 0, Addr, 3);
            getTick = (GetTickDelegate)Marshal.GetDelegateForFunctionPointer(Addr, typeof(GetTickDelegate));
        }