예제 #1
0
 public bool Apply()
 {
     if (!IsApplied)
     {
         using (MemoryOperation) {
             if (MemoryOperation.Apply())
             {
                 OriginalInstructions = MemoryEditor.ReadBytes(OriginalFunctionPtr, instructionLength);
                 IsApplied            = MemoryEditor.Write(OriginalFunctionPtr, DetourInstructions.ToArray());
             }
         }
     }
     return(IsApplied);
 }
예제 #2
0
 public bool WriteProtected <T>(IntPtr ptr, T value) where T : struct
 {
     using (var memoryOperation = new MemoryProtectionOperation(ptr, Marshal.SizeOf <T>())) {
         if (memoryOperation.Apply())
         {
             return(Write(ptr, value));
         }
     } return(false);
 }