View previous topic :: View next topic |
Author |
Message |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Sat Mar 09, 2013 8:58 pm Post subject: Get the peak working set of a process? |
|
|
I have two nearly identical processes, with the exception of PID and peak working set.
Luckily, the one I need always has a higher amount of memory consumption, so all I would need is a way to retrieve and compare the PWS of the 2 processes.
Is this possible via scripting?
|
|
Back to top |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Tue Mar 12, 2013 11:21 am Post subject: |
|
|
Alternatively... If this functionality is not built into CE 6.2, then are there any resources floating around on compiling the source code using MSVC (so that I may include it)?
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Tue Mar 12, 2013 11:27 am Post subject: |
|
|
If normal memory usage is useful as well (instead of working set) you could execute the tasklist.exe program in the windows path to get a processlist with the memory usage.
Parse through that list to find the proper pid
_________________
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 |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Tue Mar 19, 2013 6:37 pm Post subject: |
|
|
Dark Byte wrote: | If normal memory usage is useful as well (instead of working set) you could execute the tasklist.exe program in the windows path to get a processlist with the memory usage. |
I just ran several tests and found a couple scenarios where the current memory usage of the target process ends up being less than the other, so this won't always work as expected.
However, the PWS is always higher... Which means I would need to call GetProcessMemoryInfo() to retrieve a PROCESS_MEMORY_COUNTERS structure, which contains the member PeakWorkingSetSize.
And then I would need to somehow bind this to the lua interface and recompile...
Except, part of the source code is written in Delphi/Pascal, and I'm only familiar with C/C++ and *.NET languages... so it seems like an awful lot of work for something so little.
I suppose I'll just have to deal with opening the process manually every time I wish to use it.
Last edited by Rectangle on Tue Mar 19, 2013 6:45 pm; edited 2 times in total |
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Tue Mar 19, 2013 6:40 pm Post subject: |
|
|
There's really no other method?
E.g checking if a specific module is loaded using getAddress() ? Or checking if a specific address exists ? (e.g openProcess(pid) check if correct, if not, try other)
_________________
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 |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Tue Mar 19, 2013 6:50 pm Post subject: |
|
|
Dark Byte wrote: | There's really no other method?
E.g checking if a specific module is loaded using getAddress() ? Or checking if a specific address exists ? (e.g openProcess(pid) check if correct, if not, try other) |
This is for FlashPlayerPlugin, so results tend to vary from browser to browser as well as from version to version, as well as which and how many flash apps are currently in use within those browsers. It would seem that the only definite answer here is to check the PWS.
And actually... Is there any hope for new releases of CE? Because, if possible, I'd like to add a feature request: Plugins.
It'd be a great way to add extensibility to the lua bindings which the CE client currently uses, and could possibly finalize any need for future releases, aside from any known bug fixes.
You could have the client search through a local "plugins" folder for DLL files, load them in any particular order, and call their initialization/callback routines.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Tue Mar 19, 2013 7:22 pm Post subject: |
|
|
That's already in ce.
But instead of a folder it will load it from the registry in settings. (Although you could place a .lua file in the autorun folder that calls loadPlugin() to load the plugin)
The plugin system exposes the lua state pointer, so you can add new functions
_________________
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 |
|
 |
Gniarf Grandmaster Cheater Supreme
Reputation: 43
Joined: 12 Mar 2012 Posts: 1285
|
Posted: Tue Mar 19, 2013 7:48 pm Post subject: |
|
|
1-Cheat engine already supports plugins, look at your \Cheat Engine 6.2\plugins\example-c directory .
2-To get the pid of the MyProcess.exe with the highest peak working set via lua you can use the following, if you have powershell installed: Code: | local handle = io.popen("powershell \"$Targets=Get-Process -ProcessName 'MyProcess';$HighestPWS=$Targets[0].peakworkingset;$HighestPWSProcess=$Targets[0].id;foreach ($RunningProcess in $Targets){if ($RunningProcess.peakworkingset>$HighestPWS){$HighestPWS=$RunningProcess.peakworkingset;$HighestPWSProcess=$RunningProcess.id;}};$HighestPWSProcess\"")
local result = handle:read("*a")
handle:close()
print(result)) |
Sight, I've been bashing people for packing their if(...){...}else{...} on one single line and now look at what I'm doing...
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Tue Mar 19, 2013 8:03 pm Post subject: |
|
|
As an alternate to powershell you could write your own console application that outputs the data
_________________
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 |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Tue Mar 19, 2013 10:53 pm Post subject: |
|
|
Okay, so I made a basic win32 console app in C++ which, given a search token, finds any matching processes and outputs the pid with the highest PWS from that list of matches.
Tested several times, and it works perfectly.
And yet, for some reason, CE's output window refuses to display anything except a newline ('\n') character.
Here's the script I'm using:
Code: | local handle = io.popen("C:\\Program Files (x86)\\Cheat Engine 6.2\\win32\\pws.exe \"FlashPlayerPlugin\"")
local result = handle:read("*a")
handle:close()
print(result) |
I see the command prompt open briefly, so I know that the script is finding and executing the application just fine. It just refuses to display any output.
If you want to compile your own pws console app to test this with, I've posted the source code at: pastebin[dot]com/HfkKGvfe.
I've also posted the binary and project source here: www[dot]4shared[dot]com/folder/EZRY0a-h/_online[dot]html
(sorry, it seems I can't post URLs yet)
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Wed Mar 20, 2013 4:26 am Post subject: |
|
|
The 4shared link seems to be broken www.4shared.com/folder/EZRY0a-h/_online.html and pastebin as usual blocks me (probably too much damaging information posted about the dutch government so that they had to block it...)
All I can say is that the lua code is fine, as this code:
Code: |
local handle = io.popen("c:\\Windows\\system32\\PING.EXE \"google.com\"")
local result = handle:read("*a")
handle:close()
print(result)
|
returns:
Code: |
Pinging google.com [74.125.132.100] with 32 bytes of data:
Reply from 74.125.132.100: bytes=32 time=19ms TTL=48
Reply from 74.125.132.100: bytes=32 time=15ms TTL=48
Reply from 74.125.132.100: bytes=32 time=29ms TTL=48
Reply from 74.125.132.100: bytes=32 time=15ms TTL=48
Ping statistics for 74.125.132.100:
Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
Minimum = 15ms, Maximum = 29ms, Average = 19ms
|
(Visually it doesn't look like this since linebreaks aren't shown, but the paste does contain the \n characters)
I assume pws.exe just sends data to the stdout?
_________________
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 |
|
 |
Rectangle Advanced Cheater
Reputation: 1
Joined: 23 Feb 2013 Posts: 73
|
Posted: Wed Mar 20, 2013 5:29 am Post subject: |
|
|
Dark Byte wrote: | The 4shared link seems to be broken |
Try these instead...
Source: www[dot]4shared[dot]com/zip/aezm77Dl/pws_src[dot]html
Binary: www[dot]4shared[dot]com/file/gKTZuTNH/pws[dot]html
Dark Byte wrote: | and pastebin as usual blocks me (probably too much damaging information posted about the dutch government so that they had to block it...) |
Have you tried using a proxy server (i.e., proxify[dot]com or www[dot]hidemyass[dot]com)?
Dark Byte wrote: | I assume pws.exe just sends data to the stdout? |
I believe this is the default for std::cout, unless it is somehow sent to stderr instead?
I'm pretty sure, though, that if the standard command prompt can visibly see it's output, then it shouldn't be a problem for the CE client to read.
#EDIT: Ahh, I just figured it out... it was a permissions issue.
I seriously despise the Windows UAC... always looking down at me, as if I seriously require protection from myself.
"Are you sure you wish to rename that text file? You need to ask yourself for permission first." - Gah.
|
|
Back to top |
|
 |
Dark Byte Site Admin
Reputation: 470
Joined: 09 May 2003 Posts: 25791 Location: The netherlands
|
Posted: Wed Mar 20, 2013 6:07 am Post subject: |
|
|
It works for me
edit: ah ok, you found it. (yeah, uac sucks, which is why I usually have it disabled)
Description: |
|
Filesize: |
197.35 KB |
Viewed: |
13758 Time(s) |

|
_________________
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 |
|
 |
|