1515
1616namespace ReClassNET . Memory
1717{
18- public delegate void UnderlayingProcessChangedEvent ( RemoteProcess sender ) ;
18+ public delegate void RemoteProcessEvent ( RemoteProcess sender ) ;
1919
2020 public class RemoteProcess : IDisposable
2121 {
@@ -36,7 +36,14 @@ public class RemoteProcess : IDisposable
3636 private ProcessInfo process ;
3737 private IntPtr handle ;
3838
39- public event UnderlayingProcessChangedEvent ProcessChanged ;
39+ /// <summary>Event which gets invoked when a process was opened.</summary>
40+ public event RemoteProcessEvent ProcessAttached ;
41+
42+ /// <summary>Event which gets invoked before a process gets closed.</summary>
43+ public event RemoteProcessEvent ProcessClosing ;
44+
45+ /// <summary>Event which gets invoked after a process was closed.</summary>
46+ public event RemoteProcessEvent ProcessClosed ;
4047
4148 public CoreFunctionsManager CoreFunctions => coreFunctions ;
4249
@@ -81,7 +88,7 @@ public void Open(ProcessInfo info)
8188 handle = coreFunctions . OpenRemoteProcess ( process . Id , ProcessAccess . Full ) ;
8289 }
8390
84- ProcessChanged ? . Invoke ( this ) ;
91+ ProcessAttached ? . Invoke ( this ) ;
8592 }
8693 }
8794
@@ -90,6 +97,8 @@ public void Close()
9097 {
9198 if ( process != null )
9299 {
100+ ProcessClosing ? . Invoke ( this ) ;
101+
93102 lock ( processSync )
94103 {
95104 debugger . Terminate ( ) ;
@@ -101,7 +110,7 @@ public void Close()
101110 process = null ;
102111 }
103112
104- ProcessChanged ? . Invoke ( this ) ;
113+ ProcessClosed ? . Invoke ( this ) ;
105114 }
106115 }
107116
0 commit comments