Exemplo n.º 1
0
 /// <summary>
 ///     Attach all manipulation related classes to the passed process.
 ///     ObjectManager and Hook related operations will be available after this call
 /// </summary>
 /// <param name="process"></param>
 public static void AttachToProcess(Process process)
 {
     lock (LockObject)
     {
         try
         {
             if (process.HasExited)
             {
                 Logger.Warn("The process you have selected has exited. Please select another.");
                 return;
             }
             if (IsAttached)
             {
                 DetachFromProcess();
             }
             if (Offsets.FindOffsets(process))
             {
                 Memory = new ExternalProcessReader(process);
                 if (DxHook.Apply())
                 {
                     Memory.ProcessExited += (sender, args) => DetachFromProcess();
                     Logger.Info("Attached to: " + process.Id);
                     return;
                 }
             }
         }
         catch (Exception ex)
         {
             Logger.Error("Failed to attach do to an exception.", ex);
         }
         DetachFromProcess();
         Logger.Warn("Failed to attach to: " + process.Id);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 ///     Attach all manipulation related classes to the passed process.
 ///     ObjectManager and Hook related operations will be available after this call
 /// </summary>
 /// <param name="process"></param>
 public static void AttachToProcess(Process process)
 {
     lock (LockObject)
     {
         try
         {
             if (process.HasExited)
             {
                 Logger.Warn("The process you have selected has exited. Please select another.");
                 return;
             }
             if (IsAttached)
             {
                 DetachFromProcess();
             }
             if (Offsets.FindOffsets(process))
             {
                 Memory = new ExternalProcessReader(process);
                 if (DxHook.Apply())
                 {
                     Memory.ProcessExited += (sender, args) => DetachFromProcess();
                     Logger.Info("Attached to: " + process.Id);
                     return;
                 }
             }
         }
         catch (FileNotFoundException ex)
         {
             if (ex.FileName.Contains("fasmdll_managed"))
             {
                 Logger.Fatal(
                     "You have not downloaded a required prerequisite for CoolFish. Please visit the following download page for the Visual C++ Redistributable: http://www.microsoft.com/en-us/download/details.aspx?id=40784 (Download the vcredist_x86.exe when asked)");
             }
             else
             {
                 Logger.Error("Failed to attach do to an exception. Missing File: " + ex.FileName, (Exception)ex);
             }
         }
         catch (Exception ex)
         {
             Logger.Error("Failed to attach do to an exception.", ex);
         }
         DetachFromProcess();
         Logger.Warn("Failed to attach to: " + process.Id);
     }
 }