1
+
2
+ #ifndef __linux__
1
3
#include < windows.h>
4
+ #endif
5
+
2
6
#include < cstdint>
3
7
4
8
#include < ReClassNET_Plugin.hpp>
5
9
6
10
// / <summary>Enumerate all processes on the system.</summary>
7
11
// / <param name="callbackProcess">The callback for a process.</param>
8
- void __stdcall EnumerateProcesses (EnumerateProcessCallback callbackProcess)
12
+ extern " C " void __stdcall EnumerateProcesses (EnumerateProcessCallback callbackProcess)
9
13
{
10
14
// Enumerate all processes with the current plattform (x86/x64) and call the callback.
11
15
}
@@ -14,7 +18,7 @@ void __stdcall EnumerateProcesses(EnumerateProcessCallback callbackProcess)
14
18
// / <param name="process">The process handle obtained by OpenRemoteProcess.</param>
15
19
// / <param name="callbackSection">The callback for a section.</param>
16
20
// / <param name="callbackModule">The callback for a module.</param>
17
- void __stdcall EnumerateRemoteSectionsAndModules (RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule)
21
+ extern " C " void __stdcall EnumerateRemoteSectionsAndModules (RC_Pointer handle, EnumerateRemoteSectionsCallback callbackSection, EnumerateRemoteModulesCallback callbackModule)
18
22
{
19
23
// Enumerate all sections and modules of the remote process and call the callback for them.
20
24
}
@@ -23,7 +27,7 @@ void __stdcall EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRem
23
27
// / <param name="id">The identifier of the process returned by EnumerateProcesses.</param>
24
28
// / <param name="desiredAccess">The desired access.</param>
25
29
// / <returns>A handle to the remote process or nullptr if an error occured.</returns>
26
- RC_Pointer __stdcall OpenRemoteProcess (RC_Pointer id, ProcessAccess desiredAccess)
30
+ extern " C " RC_Pointer __stdcall OpenRemoteProcess (RC_Pointer id, ProcessAccess desiredAccess)
27
31
{
28
32
// Open the remote process with the desired access rights and return the handle to use with the other functions.
29
33
@@ -33,7 +37,7 @@ RC_Pointer __stdcall OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAcces
33
37
// / <summary>Queries if the process is valid.</summary>
34
38
// / <param name="handle">The process handle obtained by OpenRemoteProcess.</param>
35
39
// / <returns>True if the process is valid, false if not.</returns>
36
- bool __stdcall IsProcessValid (RC_Pointer handle)
40
+ extern " C " bool __stdcall IsProcessValid (RC_Pointer handle)
37
41
{
38
42
// Check if the handle is valid.
39
43
@@ -42,7 +46,7 @@ bool __stdcall IsProcessValid(RC_Pointer handle)
42
46
43
47
// / <summary>Closes the handle to the remote process.</summary>
44
48
// / <param name="handle">The process handle obtained by OpenRemoteProcess.</param>
45
- void __stdcall CloseRemoteProcess (RC_Pointer handle)
49
+ extern " C " void __stdcall CloseRemoteProcess (RC_Pointer handle)
46
50
{
47
51
// Close the handle to the remote process.
48
52
}
@@ -54,7 +58,7 @@ void __stdcall CloseRemoteProcess(RC_Pointer handle)
54
58
// / <param name="offset">The offset into the buffer.</param>
55
59
// / <param name="size">The number of bytes to read.</param>
56
60
// / <returns>True if it succeeds, false if it fails.</returns>
57
- bool __stdcall ReadRemoteMemory (RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size)
61
+ extern " C " bool __stdcall ReadRemoteMemory (RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size)
58
62
{
59
63
// Read the memory of the remote process into the buffer.
60
64
@@ -68,7 +72,7 @@ bool __stdcall ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointe
68
72
// / <param name="offset">The offset into the buffer.</param>
69
73
// / <param name="size">The number of bytes to write.</param>
70
74
// / <returns>True if it succeeds, false if it fails.</returns>
71
- bool __stdcall WriteRemoteMemory (RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size)
75
+ extern " C " bool __stdcall WriteRemoteMemory (RC_Pointer handle, RC_Pointer address, RC_Pointer buffer, int offset, int size)
72
76
{
73
77
// Write the buffer into the memory of the remote process.
74
78
@@ -78,15 +82,15 @@ bool __stdcall WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Point
78
82
// / <summary>Control the remote process (Pause, Resume, Terminate).</summary>
79
83
// / <param name="handle">The process handle obtained by OpenRemoteProcess.</param>
80
84
// / <param name="action">The action to perform.</param>
81
- void __stdcall ControlRemoteProcess (RC_Pointer handle, ControlRemoteProcessAction action)
85
+ extern " C " void __stdcall ControlRemoteProcess (RC_Pointer handle, ControlRemoteProcessAction action)
82
86
{
83
87
// Perform the desired action on the remote process.
84
88
}
85
89
86
90
// / <summary>Attach a debugger to the process.</summary>
87
91
// / <param name="id">The identifier of the process returned by EnumerateProcesses.</param>
88
92
// / <returns>True if it succeeds, false if it fails.</returns>
89
- bool __stdcall AttachDebuggerToProcess (RC_Pointer id)
93
+ extern " C " bool __stdcall AttachDebuggerToProcess (RC_Pointer id)
90
94
{
91
95
// Attach a debugger to the remote process.
92
96
@@ -95,7 +99,7 @@ bool __stdcall AttachDebuggerToProcess(RC_Pointer id)
95
99
96
100
// / <summary>Detach a debugger from the remote process.</summary>
97
101
// / <param name="id">The identifier of the process returned by EnumerateProcesses.</param>
98
- void __stdcall DetachDebuggerFromProcess (RC_Pointer id)
102
+ extern " C " void __stdcall DetachDebuggerFromProcess (RC_Pointer id)
99
103
{
100
104
// Detach the debugger.
101
105
}
@@ -104,16 +108,16 @@ void __stdcall DetachDebuggerFromProcess(RC_Pointer id)
104
108
// / <param name="evt">[out] The occured debug event.</param>
105
109
// / <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
106
110
// / <returns>True if an event occured within the given timeout, false if not.</returns>
107
- bool __stdcall AwaitDebugEvent (DebugEvent* evt, int timeoutInMilliseconds)
111
+ extern " C " bool __stdcall AwaitDebugEvent (DebugEvent* evt, int timeoutInMilliseconds)
108
112
{
109
113
// Wait for a debug event.
110
-
114
+
111
115
return false ;
112
116
}
113
117
114
118
// / <summary>Handles the debug event described by evt.</summary>
115
119
// / <param name="evt">[in] The (modified) event returned by AwaitDebugEvent.</param>
116
- void __stdcall HandleDebugEvent (DebugEvent* evt)
120
+ extern " C " void __stdcall HandleDebugEvent (DebugEvent* evt)
117
121
{
118
122
// Handle the debug event.
119
123
}
@@ -126,7 +130,7 @@ void __stdcall HandleDebugEvent(DebugEvent* evt)
126
130
// / <param name="size">The size of the breakpoint.</param>
127
131
// / <param name="set">True to set the breakpoint, false to remove it.</param>
128
132
// / <returns>True if it succeeds, false if it fails.</returns>
129
- bool __stdcall SetHardwareBreakpoint (RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set)
133
+ extern " C " bool __stdcall SetHardwareBreakpoint (RC_Pointer id, RC_Pointer address, HardwareBreakpointRegister reg, HardwareBreakpointTrigger type, HardwareBreakpointSize size, bool set)
130
134
{
131
135
// Set a hardware breakpoint with the given parameters.
132
136
0 commit comments