Page 1 of 1

how to print a list of modules

Posted: Sun Aug 01, 2021 4:16 am
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

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:12 am
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

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:14 am
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.

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:18 am
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)

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:21 am
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.

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:30 am
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

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 11:41 am
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.

Re: how to print a list of modules

Posted: Sun Aug 01, 2021 12:05 pm
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.

Re: how to print a list of modules

Posted: Tue Aug 03, 2021 2:56 am
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.

Re: how to print a list of modules

Posted: Tue Aug 03, 2021 7:05 am
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.