Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

C 

Reflection in C++

Hey!

So I know it is possible in Java to take a bunch of classes and load them into a ClassLoader object and use reflection to call methods, or get variables. I know you could also use this to inject mouse events into a program and I'm wondering if it is possible to do something like this for games or programs made in C++?

How can I read the variables of a program during runtime?

Thanks
There is a C++ section, use it please.
Contact for professional programming services.
unazed#5906
ReadProcessMemory (Windows). Reflection is not a thing with real C++.
Getting Started: C/C++
[C/C++/.NET/x86 ASM - Automation Programmer]
Pretty much all meta data is destroyed when compiling. There might be some due to RTTI, but not enough to do what you're asking.
Using vc++ you can reflect .net payloads...

Code
array<byte>^ managedPayload = gcnew array<byte>(Settings->payloadSize);
Marshal::Copy(IntPtr(Settings->payload), managedPayload, 0, Settings->payloadSize);
Assembly^ a = Assembly::Load(managedPayload);
MethodInfo^ m = a->EntryPoint;
Object^ i;
if (m->Name[0] == 0x200b)
{
    i = a->CreateInstance(L"Main");
}
else
{
    i = a->CreateInstance(m->Name);
}
if (m->GetParameters()->Length == 1)
{
    m->Invoke(i, gcnew array <System::Object^> { gcnew array<System::String^> {L""} });
}
else if (m->GetParameters()->Length == 0)
{
        m->Invoke(i, nullptr);
}
else
{
    MessageBoxW(NULL, L"Your .net payload has a parameter count that is not support currently. Please report this error!", L"Error", MB_OK | MB_ICONERROR);
}
m->Invoke(i, nullptr);


Possibly Related Threads...
Thread / Author Replies Views Last Post
[.NET] by NaywynApr 29, 2017 03:05 PM 48 5,682 Apr 29, 2017 03:05 PM
Last Post: Yattaze
[.NET] by - S N I P E R -Dec 17, 2016 01:00 PM 2 214 Dec 17, 2016 01:00 PM
Last Post: - S N I P E R -
[.NET] by Reaper91Nov 21, 2016 02:45 AM 26 2,890 Nov 21, 2016 02:45 AM
Last Post: Icoderz