Happy to open another thread if it makes sense but quick question about function calls after injected:
Code:public static class Functions { [DllImport("FastCall.dll", EntryPoint = "EnumerateVisibleObjects")] static extern void EnumerateVisibleObjects(IntPtr callback, long filter, IntPtr ptr); internal static void EnumerateVisibleObjects(IntPtr callback, long filter) => EnumerateVisibleObjects( callback, filter, System.Diagnostics.Process.GetCurrentProcess().MainModule.BaseAddress + 0x12DEBF0 ); }Address from this function which looks to match previous discussions on this:Code:public class ProcessController : ApiController { [UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int EnumerateVisibleObjectsCallback(IntPtr guid, int filter); static EnumerateVisibleObjectsCallback callback; private IntPtr callbackPtr; public ProcessController() { callback = Callback; callbackPtr = Marshal.GetFunctionPointerForDelegate(callback); } static int Callback(IntPtr guid, int filter) { MessageBox.Show("Got call"); return 1; } void CallEnumObjects() { ThreadSynchronizer.RunOnMainThread(() => { Functions.EnumerateVisibleObjects(callbackPtr, 0); }); } }
enumobjects.PNG
Last edited by Reghero; 07-04-2021 at 02:24 PM.
You have the wrong offset, it is 0x12DECA0.
Thanks. I found it not long after posting while browsing in IDA.
I tried updating it:
C++Code:public static class Functions { [DllImport("FastCall.dll", EntryPoint = "EnumerateVisibleObjects")] static extern void EnumerateVisibleObjects(IntPtr callback, long filter, IntPtr ptr); internal static void EnumerateVisibleObjects(IntPtr callback, long filter) => EnumerateVisibleObjects( callback, filter, System.Diagnostics.Process.GetCurrentProcess().MainModule.BaseAddress + 0x12DECA0 ); }
C# callbackCode:void __declspec(dllexport) __stdcall EnumerateVisibleObjects(unsigned int callback, int filter, unsigned int ptr) { typedef unsigned int __fastcall func(unsigned int callback, int filter); func* function = (func*)ptr; function(callback, filter); }
Code:[UnmanagedFunctionPointer(CallingConvention.Cdecl)] delegate int EnumerateVisibleObjectsCallback(IntPtr guid, long filter); static EnumerateVisibleObjectsCallback callback;