예제 #1
0
        static void BasicMemoryTests()
        {
            Console.WriteLine();
            Console.WriteLine("+ - - - - - - - - - - - - - - - -");
            Console.WriteLine("| Basic memory tests");
            Console.WriteLine("+ - - - - - - - - - - - - - - - -");
            Console.WriteLine();

            var allocatedMemory = process.AllocateMemory(0x1000);
            int memoryWriteTest = Environment.TickCount;

            Console.Write("Memory allocation ... ");
            Console.WriteLine(allocatedMemory.IsValid ? string.Format("[SUCCESS] (BaseAddress : 0x{0})", allocatedMemory.Pointer.ToString("X")) : "[FAIL]");

            Console.Write("Memory write ... ");
            Console.WriteLine(allocatedMemory.Write <int>(0, memoryWriteTest) ? "[SUCCESS]" : "[FAIL]");

            Console.Write("Memory read ... ");
            Console.WriteLine(allocatedMemory.Read <int>() == memoryWriteTest ? "[SUCCESS]" : "[FAIL]");

            Console.Write("Memory release ... ");
            Console.WriteLine(allocatedMemory.Release() ? "[SUCCESS]" : "[FAIL]");
        }