Cheat Engine Forum Index Cheat Engine
The Official Site of Cheat Engine
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


CE Function

 
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming
View previous topic :: View next topic  
Author Message
cleiton
Newbie cheater
Reputation: 0

Joined: 05 Mar 2014
Posts: 21

PostPosted: Sun Mar 29, 2015 8:43 pm    Post subject: CE Function Reply with quote

I'm looking for dissectcodeunit, im using this code with "withSystemModules" as false but it is showing all system modules, where's the problem?

Code:
procedure GetModuleList(ModuleList: TStrings; withSystemModules: boolean);
var ths: thandle;
    me32: MODULEENTRY32;
    x: pchar;
    moduledata: tmoduledata;
    i: integer;
    alreadyInTheList: boolean;
begin
  cleanModuleList(modulelist);
  ths:=CreateToolhelp32Snapshot(TH32CS_SNAPMODULE,  GetCurrentProcessId);
  if ths<>0 then
  begin
    try
      zeromemory(@me32,sizeof(me32));
      me32.dwSize:=sizeof(me32);
      if module32first(ths,me32) then
      repeat
        x:[email protected][0];

        if (withSystemModules) or (not inSystemModule(ptrUint(me32.modBaseAddr))) then
        begin
          alreadyInTheList:=false;
          for i:=0 to ModuleList.count-1 do
          begin
            moduledata:=tmoduledata(ModuleList.objects[i]);
            if moduledata.moduleaddress=ptrUint(me32.modBaseAddr) then
            begin
              alreadyInTheList:=true;
              break;
            end;
          end;

          if not alreadyInTheList then
          begin
            moduledata:=tmoduledata.Create;
            moduledata.moduleaddress:=ptrUint(me32.modBaseAddr);
            moduledata.modulesize:=me32.modBaseSize;
            ModuleList.AddObject(x,moduledata);
          end;
        end;
      until module32next(ths,me32)=false;

    finally
      closehandle(ths);
    end;
  end;
end;



ALL FUNCTIONS:
Code:

type
{$IFNDEF FPC}
{$IFDEF CPUX64}
  PtrInt = Int64;
  PtrUInt = UInt64;
{$ELSE}
  PtrInt = longint;
  PtrUInt = Longword;
{$ENDIF}
{$ENDIF}
  SuperInt = Int64;
type TModuleInfo=record
  modulename: string;
  modulepath: string;
  isSystemModule: boolean;
  baseaddress: ptrUint;
  basesize: dword;
  is64bitmodule: boolean;
  symbolsLoaded: boolean; //true if the api symbols have been handled
end;
type
  NTSTATUS = ULONG;
  THREADINFOCLASS = DWORD;

type tmoduledata =class
  public
    moduleaddress: ptrUint;
    modulesize: dword;
end;

TModuleInfoArray=array of TModuleInfo;
var
  modulelistpos: integer;
  modulelist: TModuleInfoArray;

procedure cleanModuleList(ModuleList: TStrings);
var i: integer;
begin
  for i:=0 to ModuleList.Count-1 do
    if ModuleList.Objects[i]<>nil then
    begin
      tmoduledata(ModuleList.Objects[i]).Free;
      ModuleList.Objects[i]:=nil;
    end;

  ModuleList.Clear;
end;
function getmodulebyaddress(address: ptrUint; var mi: TModuleInfo):BOOLEAN;
var i: integer;
begin
  result:=false;
  for i:=0 to modulelistpos-1 do
    if (address>=modulelist[i].baseaddress) and (address<modulelist[i].baseaddress+modulelist[i].basesize) then
    begin
      mi:=modulelist[i];

      result:=true;
      break;
    end;
end;
function inSystemModule(address: ptrUint): BOOLEAN;
var mi: TModuleInfo;
begin
  result:=false;
  if getmodulebyaddress(address,mi) then
    result:=mi.isSystemModule;
end;
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25818
Location: The netherlands

PostPosted: Mon Mar 30, 2015 2:15 am    Post subject: Reply with quote

don't use inSystemModule in GetModuleList but check it another way
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
cleiton
Newbie cheater
Reputation: 0

Joined: 05 Mar 2014
Posts: 21

PostPosted: Mon Mar 30, 2015 10:24 am    Post subject: Reply with quote

Dark Byte wrote:
don't use inSystemModule in GetModuleList but check it another way


Why not?
I wanna do as the Cheat Engine does, it's simply all I want is that working as cheat engine dissect code..

Thaks
Back to top
View user's profile Send private message
cleiton
Newbie cheater
Reputation: 0

Joined: 05 Mar 2014
Posts: 21

PostPosted: Wed Apr 01, 2015 4:46 pm    Post subject: Reply with quote

Dark Byte wrote:
don't use inSystemModule in GetModuleList but check it another way


Please, reply me
Back to top
View user's profile Send private message
Dark Byte
Site Admin
Reputation: 471

Joined: 09 May 2003
Posts: 25818
Location: The netherlands

PostPosted: Wed Apr 01, 2015 5:22 pm    Post subject: Reply with quote

check if the path is inside the windows folder, and if so, it's a system module
_________________
Do not ask me about online cheats. I don't know any and wont help finding them.

Like my help? Join me on Patreon so i can keep helping
Back to top
View user's profile Send private message MSN Messenger
Display posts from previous:   
Post new topic   Reply to topic    Cheat Engine Forum Index -> General programming All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Powered by phpBB © 2001, 2005 phpBB Group

CE Wiki   IRC (#CEF)   Twitter
Third party websites