Skip to content

How to obtaining an active instance of a class at the runtime? #41

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
mehgancangweh opened this issue Mar 26, 2025 · 3 comments
Open

Comments

@mehgancangweh
Copy link

mehgancangweh commented Mar 26, 2025

while(true)
{
	// I 100% confirmed the game called this class public Void .ctor() method.
	// so that mean there is an instance exists somewhere in the game memory.
	// The reason i can't hook them because:
	//		Too late. the game called .ctor before Resolver even done.
	//		I need the instance to iterate at the runtime in my case.

	UnityResolve::Class* CProtocol_CSMsgPara = pAssembly->Get("CSMsgPara", "Protocol");

	const auto Vector1 = CProtocol_CSMsgPara->FindObjectsByType<UnityResolve::UnityType::Object*>();
	LOG(DEBUG) << Vector1.size(); // always zero didn't exists for the whole playing time

	const auto Vector2 = CProtocol_CSMsgPara->FindObjectsByType<UnityResolve::UnityType::Array<Object*>*>();
	LOG(DEBUG) << Vector2.size(); // always zero didn't exists for the whole playing time

	THIS_SLEEP(3s);
}

i searched the internet and tried this frida js version: vfsfitvnm/frida-il2cpp-bridge#341
and its working fine. the project is for android.

@mehgancangweh mehgancangweh changed the title How to find an active instance of a class at the runtime? How to obtaining an active instance of a class at the runtime? Mar 27, 2025
@tikkamasala
Copy link

You can't call FindObjectsByType if you are looking for an IL2CPP Object and not a GameObject
You need to call the functions from the garbage collector like they do in frida-il2cpp-bridge

@mehgancangweh
Copy link
Author

You can't call FindObjectsByType if you are looking for an IL2CPP Object and not a GameObject You need to call the functions from the garbage collector like they do in frida-il2cpp-bridge

Since i low knowledge with the il2cpp things, i'd love to see if you can give me example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants
@mehgancangweh @tikkamasala and others