how to print a list of modules

Want Cheat Engine to do something specific and no idea how to do that, ask here. (From simple scripts to full trainers and extensions)
Post Reply
coroco
Noobzor
Noobzor
Posts: 10
Joined: Wed Jul 28, 2021 4:01 pm
Reputation: 0

how to print a list of modules

Post by coroco »

hey i need to print the module list in lua script, how can i make a function which will give me the names of all game modules?
ideally it should only show modules that start with 'gam' :D

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: how to print a list of modules

Post by ShyTwig16 »

You can use "enumModules". And lua's "string.find" or "string.sub" to see if the name starts with the match you want.

This is from the "celua.txt" file in the CE directory.

Code: Select all

enumModules(processid OPTIONAL):
  Returns a table containing information about each module in the current process, or the specified processid
  Each entry is a table with fields
    Name : String containing the modulename    
    Address: Integer representing the address the module is loaded
    Is64Bit: Boolean set to true if it's a 64-bit module
    PathToFile: String to the location this module is loaded

GreenHouse
Expert Cheater
Expert Cheater
Posts: 857
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 889

Re: how to print a list of modules

Post by GreenHouse »

ShyTwig16 wrote:
Sun Aug 01, 2021 11:12 am
...
I don't think that gives you addresses inside each module. But module name, address, etc.

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: how to print a list of modules

Post by ShyTwig16 »

GreenHouse wrote:
Sun Aug 01, 2021 11:14 am
...
I don't think that gives you addresses inside each module. But module name, address, etc.
No but you can use the address and "getModuleSize" to determine the address range of a given module.

Code: Select all

getModuleSize(modulename): Returns the size of a given module (Use getAddress to get the base address)

GreenHouse
Expert Cheater
Expert Cheater
Posts: 857
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 889

Re: how to print a list of modules

Post by GreenHouse »

ShyTwig16 wrote:
Sun Aug 01, 2021 11:18 am
...
I know. What I mean is that using that, I don't think you can dump every address inside of each module with its name.

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: how to print a list of modules

Post by ShyTwig16 »

GreenHouse wrote:
Sun Aug 01, 2021 11:21 am
...
I know. What I mean is that using that, I don't think you can dump every address inside of each module with its name.
OP asked how to print a list of module name if they start with "gam", they never said anything about the module addresses.

You can get the address range and iterate through the addresses and dump whatever you want.

As an example I use this to make a lua AOBScanModule.

Code: Select all

	function AOBScanModule(strModule, strSignature, aobSignaturePrivileges, alignmentType, alignmentParam)
		index = index or 1
		local msa = getAddress(strModule)
		local mea = msa + getModuleSize(strModule)
		local ms = createMemScan()
		ms.firstScan(soExactValue, vtByteArray, nil, strSignature, nil, msa, mea, 
					 aobSignaturePrivileges, alignmentType, alignmentParam, true, true, false, false)
		ms.waitTillDone()
		local result = createFoundList(ms)
		result.initialize()
		ms.destroy()
		return result
	end

GreenHouse
Expert Cheater
Expert Cheater
Posts: 857
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 889

Re: how to print a list of modules

Post by GreenHouse »

ShyTwig16 wrote:
Sun Aug 01, 2021 11:30 am
...
Well, I imagined that by getting what starts with "gam'", he means everything from inside a module that includes game functions, like for example Terraria does. Or there's also an engine in which the executable of the game is always called "game.exe", that also does include some generic functions. Otherwise I don't think that dumping the list in itself makes sense. There's no use for that.

ShyTwig16
Expert Cheater
Expert Cheater
Posts: 335
Joined: Thu Apr 06, 2017 7:14 pm
Reputation: 19

Re: how to print a list of modules

Post by ShyTwig16 »

GreenHouse wrote:
Sun Aug 01, 2021 11:41 am
...
Well, I imagined that by getting what starts with "gam'", he means everything from inside a module that includes game functions, like for example Terraria does. Or there's also an engine in which the executable of the game is always called "game.exe", that also does include some generic functions. Otherwise I don't think that dumping the list in itself makes sense. There's no use for that.
I could make a million guesses as to what OP wants and all could be wrong. I've found it better to just work based on what they ask for. You're welcome to answer questions based on what you speculate they really mean, but that's not what I do.

coroco
Noobzor
Noobzor
Posts: 10
Joined: Wed Jul 28, 2021 4:01 pm
Reputation: 0

Re: how to print a list of modules

Post by coroco »

ShyTwig16 wrote:
Sun Aug 01, 2021 11:12 am
You can use "enumModules". And lua's "string.find" or "string.sub" to see if the name starts with the match you want.

This is from the "celua.txt" file in the CE directory.

Code: Select all

enumModules(processid OPTIONAL):
  Returns a table containing information about each module in the current process, or the specified processid
  Each entry is a table with fields
    Name : String containing the modulename    
    Address: Integer representing the address the module is loaded
    Is64Bit: Boolean set to true if it's a 64-bit module
    PathToFile: String to the location this module is loaded
Thanks
GreenHouse wrote:
Sun Aug 01, 2021 11:14 am
ShyTwig16 wrote:
Sun Aug 01, 2021 11:12 am
...
I don't think that gives you addresses inside each module. But module name, address, etc.
I just worked with the game fear, where there are two modules that start with gam and then have a random prefix of type gamXXXX.tmp. so I needed to download the list of game modules to update the base address of the pointers.

GreenHouse
Expert Cheater
Expert Cheater
Posts: 857
Joined: Fri Oct 12, 2018 10:25 pm
Reputation: 889

Re: how to print a list of modules

Post by GreenHouse »

coroco wrote:
Tue Aug 03, 2021 2:56 am
I just worked with the game fear, where there are two modules that start with gam and then have a random prefix of type gamXXXX.tmp. so I needed to download the list of game modules to update the base address of the pointers.
Makes sense then. What Tim said should work perfectly then. Also, remember that in the Cheat Engine folder, you have a file called "celua.txt" which has lots of useful things you can use. If you need anything module related, you could for example search "module" and find that one.

Post Reply

Who is online

Users browsing this forum: No registered users