| View previous topic :: View next topic |
| Author |
Message |
broly7 Advanced Cheater
Reputation: 0
Joined: 13 Aug 2015 Posts: 60
|
Posted: Tue Jan 30, 2018 5:35 pm Post subject: How CE sort Processes in order? |
|
|
Darkbyte, i'd like to know how can i sort same way as CE do with process list to attach.
Imo, is sorting for creation timestamp or something. I'd like to sort them out the same in Delphi.
How can i do it?
Thanks
|
|
| Back to top |
|
 |
Corroder Grandmaster Cheater Supreme
Reputation: 75
Joined: 10 Apr 2015 Posts: 1668
|
Posted: Tue Jan 30, 2018 7:19 pm Post subject: |
|
|
I think this is must be on lua section, but here is a sample :
| Code: | ---------------------------------------
--- GET PROCESS LIST
---------------------------------------
function GetTheProcessList()
local T = {}
local SL=createStringlist()
getProcesslist(SL)
for i=0,strings_getCount(SL)-1 do
T[i] = strings_getString(SL,i)
-- print(T[i]) -- Output
end
SL = nil
return T
end
---------------------------------------
--- SORT PROCESS LIST BY PID
---------------------------------------
function SortByPID(sender)
PIDsort = {}
for x = 1, #sender do
PIDsort[x] = sender[x]
end
table.sort(PIDsort)
return PIDsort --- retunr new table preserving old table
end
---------------------------------------
--- SORT PROCESS NAME
---------------------------------------
function SortByName(sender) --sorts table by name with incremental PID's
local A = SortByPID(sender)
local NameSort = {}
local FinalSort = {}
for x = 1,#A do
NameSort[x] = string.sub(A[x],10)..'-'..string.sub(A[x],0,8)
end
table.sort(NameSort) --- table with names first then PID
for x=1, #NameSort do --- FLIP PIDs and Name
FinalSort[x] = string.sub(NameSort[x],-8).."-"..string.sub(NameSort[x],0,-10)
end
A = nil
NameSort = nil
return FinalSort
end
---------------------------------------
--- REVERSE SORT DESCENDING TO ASCENDING AND VV
---------------------------------------
function ReverseOrder(sender)
local RevTable = {}
for x = #sender, 1,-1 do
RevTable[#RevTable+1] = sender[x]
end
return RevTable
end
--------------------------------------------------
------------ Usage Examples -------------------
--------------------------------------------------
PID = GetTheProcessList() --- A is returned table from GetTheProcessList()
Sort = SortByPID(PID) ---- call function with sender (A = table)
NamePid = SortByName(GetTheProcessList())
Rev = ReverseOrder(NamePid)
for x = 1,#PID do
print(PID[x]) ---- prints system table
end
for x = 1,#Sort do
print(Sort[x]) ---- prints system table by PIDs
end
for x = 1,#NamePid do
print(NamePid[x]) ---- prints system table by Soted PID's and Name
end
for x = 1,#Rev do
print(Rev[x]) ---- prints table in Reverse Order
end |
_________________
Stealing Code From Stolen Code...
And Admit It.. Hmmm....Typically LOL |
|
| Back to top |
|
 |
FreeER Grandmaster Cheater Supreme
Reputation: 53
Joined: 09 Aug 2013 Posts: 1091
|
|
| Back to top |
|
 |
Dark Byte Site Admin
Reputation: 471
Joined: 09 May 2003 Posts: 25813 Location: The netherlands
|
Posted: Wed Jan 31, 2018 2:40 am Post subject: |
|
|
toolhelp32snapshot returns it in that order
_________________
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 |
|
 |
broly7 Advanced Cheater
Reputation: 0
Joined: 13 Aug 2015 Posts: 60
|
Posted: Wed Jan 31, 2018 6:22 am Post subject: |
|
|
| Dark Byte wrote: | | toolhelp32snapshot returns it in that order |
I was thinking on that possibility, thanks.
|
|
| Back to top |
|
 |
|