44using System . IO ;
55using System . Linq ;
66using System . Runtime . InteropServices ;
7+ using ReClassNET . Memory ;
78using ReClassNET . Util ;
89
9- namespace ReClassNET . Memory
10+ namespace ReClassNET . Native
1011{
11- public enum ProcessAccess
12- {
13- Read ,
14- Write ,
15- Full
16- } ;
17-
18- public enum ControlRemoteProcessAction
19- {
20- Suspend ,
21- Resume ,
22- Terminate
23- }
24-
2512 public class NativeHelper : IDisposable
2613 {
2714 private const string NativeHelperDll = "NativeHelper.dll" ;
2815
29- public enum RequestFunction
30- {
31- IsProcessValid ,
32- OpenRemoteProcess ,
33- CloseRemoteProcess ,
34- ReadRemoteMemory ,
35- WriteRemoteMemory ,
36- EnumerateProcesses ,
37- EnumerateRemoteSectionsAndModules ,
38- DisassembleCode ,
39- ControlRemoteProcess
40- }
41-
4216 public class MethodInfo
4317 {
4418 public RequestFunction Method { get ; set ; }
@@ -75,37 +49,6 @@ public T GetDelegate<T>()
7549 public delegate bool EnumerateProcessCallback ( ref EnumerateProcessData data ) ;
7650 private delegate void EnumerateProcessesDelegate ( EnumerateProcessCallback callbackProcess ) ;
7751
78-
79-
80- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode ) ]
81- public struct EnumerateRemoteSectionData
82- {
83- public IntPtr BaseAddress ;
84-
85- public IntPtr Size ;
86-
87- public SectionType Type ;
88-
89- public SectionProtection Protection ;
90-
91- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 16 ) ]
92- public string Name ;
93-
94- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 260 ) ]
95- public string ModulePath ;
96- }
97-
98- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode ) ]
99- public struct EnumerateRemoteModuleData
100- {
101- public IntPtr BaseAddress ;
102-
103- public IntPtr Size ;
104-
105- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 260 ) ]
106- public string Path ;
107- }
108-
10952 public delegate void EnumerateRemoteSectionCallback ( ref EnumerateRemoteSectionData data ) ;
11053 public delegate void EnumerateRemoteModuleCallback ( ref EnumerateRemoteModuleData data ) ;
11154 private delegate void EnumerateRemoteSectionsAndModulesDelegate ( IntPtr process , EnumerateRemoteSectionCallback callbackSection , EnumerateRemoteModuleCallback callbackModule ) ;
@@ -114,8 +57,6 @@ public struct EnumerateRemoteModuleData
11457
11558 private delegate void ControlRemoteProcessDelegate ( IntPtr process , ControlRemoteProcessAction action ) ;
11659
117- #endregion
118-
11960 private IntPtr fnIsProcessValid ;
12061 private IsProcessValidDelegate isProcessValidDelegate ;
12162 private IntPtr fnOpenRemoteProcess ;
@@ -137,6 +78,8 @@ public struct EnumerateRemoteModuleData
13778
13879 private readonly RequestFunctionPtrCallback requestFunctionPtrReference ;
13980
81+ #endregion
82+
14083 private bool disposedValue = false ;
14184
14285 public NativeHelper ( )
@@ -374,15 +317,6 @@ public bool WriteRemoteMemory(IntPtr process, IntPtr address, byte[] buffer, int
374317 return result ;
375318 }
376319
377- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode ) ]
378- public struct EnumerateProcessData
379- {
380- public IntPtr Id ;
381-
382- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 260 ) ]
383- public string Path ;
384- } ;
385-
386320 public void EnumerateProcesses ( EnumerateProcessCallback callbackProcess )
387321 {
388322 enumerateProcessesDelegate ( callbackProcess ) ;
@@ -440,15 +374,6 @@ public void EnumerateRemoteSectionsAndModules(IntPtr process, Action<Section> ca
440374 EnumerateRemoteSectionsAndModules ( process , c1 , c2 ) ;
441375 }
442376
443- [ StructLayout ( LayoutKind . Sequential , CharSet = CharSet . Unicode ) ]
444- public struct InstructionData
445- {
446- public int Length ;
447-
448- [ MarshalAs ( UnmanagedType . ByValTStr , SizeConst = 64 ) ]
449- public string Instruction ;
450- } ;
451-
452377 public bool DisassembleCode ( IntPtr address , int length , IntPtr virtualAddress , out InstructionData instruction )
453378 {
454379 return disassembleCodeDelegate ( address , ( IntPtr ) length , virtualAddress , out instruction ) ;
0 commit comments