|
5 | 5 | using System.IO.MemoryMappedFiles;
|
6 | 6 | using System.Runtime.InteropServices;
|
7 | 7 | using System.Windows.Forms;
|
| 8 | +using ReClassNET.Memory; |
8 | 9 | using ReClassNET.Plugins;
|
9 | 10 | using RGiesecke.DllExport;
|
10 | 11 | using static ReClassNET.Memory.NativeHelper;
|
@@ -97,23 +98,26 @@ public static bool IsProcessValid(IntPtr process)
|
97 | 98 | /// <param name="desiredAccess">The desired access. (ignored)</param>
|
98 | 99 | /// <returns>A plugin internal handle to the file.</returns>
|
99 | 100 | [DllExport(CallingConvention = CallingConvention.StdCall)]
|
100 |
| - private static IntPtr OpenRemoteProcess(int pid, int desiredAccess) |
| 101 | + private static IntPtr OpenRemoteProcess(IntPtr id, ProcessAccess desiredAccess) |
101 | 102 | {
|
102 | 103 | lock (sync)
|
103 | 104 | {
|
104 |
| - try |
| 105 | + if (currentFile.GetHashCode() == id.ToInt32()) |
105 | 106 | {
|
106 |
| - var file = MemoryMappedFile.CreateFromFile(currentFile); |
| 107 | + try |
| 108 | + { |
| 109 | + var file = MemoryMappedFile.CreateFromFile(currentFile); |
107 | 110 |
|
108 |
| - var handle = file.SafeMemoryMappedFileHandle.DangerousGetHandle(); |
| 111 | + var handle = file.SafeMemoryMappedFileHandle.DangerousGetHandle(); |
109 | 112 |
|
110 |
| - openFiles.Add(handle, file); |
| 113 | + openFiles.Add(handle, file); |
111 | 114 |
|
112 |
| - return handle; |
113 |
| - } |
114 |
| - catch (Exception ex) |
115 |
| - { |
116 |
| - host.Logger.Log(ex); |
| 115 | + return handle; |
| 116 | + } |
| 117 | + catch (Exception ex) |
| 118 | + { |
| 119 | + host.Logger.Log(ex); |
| 120 | + } |
117 | 121 | }
|
118 | 122 | }
|
119 | 123 |
|
@@ -209,7 +213,13 @@ private static void EnumerateProcesses(EnumerateProcessCallback callbackProcess)
|
209 | 213 | {
|
210 | 214 | currentFile = ofd.FileName;
|
211 | 215 |
|
212 |
| - callbackProcess(currentFile.GetHashCode(), currentFile); |
| 216 | + var data = new EnumerateProcessData |
| 217 | + { |
| 218 | + Id = (IntPtr)currentFile.GetHashCode(), |
| 219 | + Path = currentFile |
| 220 | + }; |
| 221 | + |
| 222 | + callbackProcess(ref data); |
213 | 223 | }
|
214 | 224 | }
|
215 | 225 | }
|
|
0 commit comments