1+
2+ #ifndef __linux__
13#include < windows.h>
4+ #endif
5+
26#include < cstdint>
37
48#include < ReClassNET_Plugin.hpp>
59
610// / <summary>Enumerate all processes on the system.</summary>
711// / <param name="callbackProcess">The callback for a process.</param>
8- void __stdcall EnumerateProcesses (EnumerateProcessCallback callbackProcess)
12+ extern " C " void __stdcall EnumerateProcesses (EnumerateProcessCallback callbackProcess)
913{
1014 // Enumerate all processes with the current plattform (x86/x64) and call the callback.
1115}
@@ -14,7 +18,7 @@ void __stdcall EnumerateProcesses(EnumerateProcessCallback callbackProcess)
1418// / <param name="process">The process handle obtained by OpenRemoteProcess.</param>
1519// / <param name="callbackSection">The callback for a section.</param>
1620// / <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)
1822{
1923 // Enumerate all sections and modules of the remote process and call the callback for them.
2024}
@@ -23,7 +27,7 @@ void __stdcall EnumerateRemoteSectionsAndModules(RC_Pointer handle, EnumerateRem
2327// / <param name="id">The identifier of the process returned by EnumerateProcesses.</param>
2428// / <param name="desiredAccess">The desired access.</param>
2529// / <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)
2731{
2832 // Open the remote process with the desired access rights and return the handle to use with the other functions.
2933
@@ -33,7 +37,7 @@ RC_Pointer __stdcall OpenRemoteProcess(RC_Pointer id, ProcessAccess desiredAcces
3337// / <summary>Queries if the process is valid.</summary>
3438// / <param name="handle">The process handle obtained by OpenRemoteProcess.</param>
3539// / <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)
3741{
3842 // Check if the handle is valid.
3943
@@ -42,7 +46,7 @@ bool __stdcall IsProcessValid(RC_Pointer handle)
4246
4347// / <summary>Closes the handle to the remote process.</summary>
4448// / <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)
4650{
4751 // Close the handle to the remote process.
4852}
@@ -54,7 +58,7 @@ void __stdcall CloseRemoteProcess(RC_Pointer handle)
5458// / <param name="offset">The offset into the buffer.</param>
5559// / <param name="size">The number of bytes to read.</param>
5660// / <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)
5862{
5963 // Read the memory of the remote process into the buffer.
6064
@@ -68,7 +72,7 @@ bool __stdcall ReadRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Pointe
6872// / <param name="offset">The offset into the buffer.</param>
6973// / <param name="size">The number of bytes to write.</param>
7074// / <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)
7276{
7377 // Write the buffer into the memory of the remote process.
7478
@@ -78,15 +82,15 @@ bool __stdcall WriteRemoteMemory(RC_Pointer handle, RC_Pointer address, RC_Point
7882// / <summary>Control the remote process (Pause, Resume, Terminate).</summary>
7983// / <param name="handle">The process handle obtained by OpenRemoteProcess.</param>
8084// / <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)
8286{
8387 // Perform the desired action on the remote process.
8488}
8589
8690// / <summary>Attach a debugger to the process.</summary>
8791// / <param name="id">The identifier of the process returned by EnumerateProcesses.</param>
8892// / <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)
9094{
9195 // Attach a debugger to the remote process.
9296
@@ -95,7 +99,7 @@ bool __stdcall AttachDebuggerToProcess(RC_Pointer id)
9599
96100// / <summary>Detach a debugger from the remote process.</summary>
97101// / <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)
99103{
100104 // Detach the debugger.
101105}
@@ -104,16 +108,16 @@ void __stdcall DetachDebuggerFromProcess(RC_Pointer id)
104108// / <param name="evt">[out] The occured debug event.</param>
105109// / <param name="timeoutInMilliseconds">The timeout in milliseconds.</param>
106110// / <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)
108112{
109113 // Wait for a debug event.
110-
114+
111115 return false ;
112116}
113117
114118// / <summary>Handles the debug event described by evt.</summary>
115119// / <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)
117121{
118122 // Handle the debug event.
119123}
@@ -126,7 +130,7 @@ void __stdcall HandleDebugEvent(DebugEvent* evt)
126130// / <param name="size">The size of the breakpoint.</param>
127131// / <param name="set">True to set the breakpoint, false to remove it.</param>
128132// / <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)
130134{
131135 // Set a hardware breakpoint with the given parameters.
132136
0 commit comments