Jump to content
Sign in to follow this  
readmedottxt

Error with ProcessGetStats monitoring a system process

Recommended Posts

readmedottxt

Info - Win7 Enterprise, UAC off, attempted with/without 'Run as Admin', AutoIt 3.3.0.0

Here's some simple code that works properly with any process running as the logged in user account but fails to obtain details for any process running as SYSTEM:

$gui = GUICreate("", 400, 300)
GUISetState()
$label = GUICtrlCreateLabel("ProcessGetStats test", 10, 20, 380, 200)

for $i=1 to 60
    $mem = ProcessGetStats("wininit.exe", 1)
    GUICtrlSetData($label,  "Read Bytes: " & $mem[3] & @CRLF & _
                            "Write Bytes: " & $mem[4] & @CRLF & _
                            "Other Bytes: " & $mem[5] & @CRLF)
    sleep(150)
Next

It always errors with the following:

>"C:\Program Files\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\admin\Documents\AutoIt_Projects\Beta\test_ProcessGetStats.au3" /autoit3dir "C:\Program Files\AutoIt3" /UserParams    
+>09:10:47 Starting AutoIt3Wrapper v.2.0.0.1    Environment(Language:0409  Keyboard:00000409  OS:WIN_VISTA/  CPU:X64 OS:X86)
>Running AU3Check (1.54.14.0)  from:C:\Program Files\AutoIt3
+>09:10:47 AU3Check ended.rc:0
>Running:(3.3.0.0):C:\Program Files\AutoIt3\autoit3.exe "C:\Users\admin\Documents\AutoIt_Projects\Beta\test_ProcessGetStats.au3"    
C:\Users\admin\Documents\AutoIt_Projects\Beta\test_ProcessGetStats.au3 (7) : ==> Subscript used with non-Array variable.:
GUICtrlSetData($label,  "Read Bytes: " & $mem[3] & @CRLF & "Write Bytes: " & $mem[4] & @CRLF & "Other Bytes: " & $mem[5] & @CRLF)
GUICtrlSetData($label,  "Read Bytes: " & $mem^ ERROR
->09:10:47 AutoIT3.exe ended.rc:1
+>09:10:49 AutoIt3Wrapper Finished
>Exit code: 1    Time: 1.808

The changelog says bugfix #501 in version 3.3.0.0 resolved this issue. Is this a new Win7 problem? Is there a fix using the existing build because I have a lot of code using the InetGet functions and it will break in the newer release.

Thanks

Share this post


Link to post
Share on other sites
readmedottxt

I installed 3.3.4.0 on another Win7 machine and the problem is still there.

Have I made a mistake with the code?

TIA

Share this post


Link to post
Share on other sites
readmedottxt

Some more info,

It works when you append a second .exe on the code, eg:

$gui = GUICreate("", 400, 300)
GUISetState()
$label = GUICtrlCreateLabel("ProcessGetStats test", 10, 20, 380, 200)

for $i=1 to 60
    $mem = ProcessGetStats("wininit.exe.exe", 1)
    GUICtrlSetData($label,  "Read Bytes: " & $mem[3] & @CRLF & _
                            "Write Bytes: " & $mem[4] & @CRLF & _
                            "Other Bytes: " & $mem[5] & @CRLF)
    sleep(150)
Next

Bug or my mistake?

Share this post


Link to post
Share on other sites
readmedottxt

Nope I was wrong, it's not reading the correct process. If you put a process that doesn't exist, it supplies erroneous data or the current process.

It fails whether I use the PID or the name of SYSTEM processes.

Still stuck :D

Edited by readmedottxt

Share this post


Link to post
Share on other sites
readmedottxt

Anybody?

Share this post


Link to post
Share on other sites
readmedottxt

Anybody?

Hopeful bump

Share this post


Link to post
Share on other sites
whim

You might want to read about "Protected Processes" here: MSDN: Process Security

I'm by no means no expert in this kind of stuff, but it would certainly make sense to me

if processes like wininit & winlogon fell in the 'Protected Processes' category ...

HTH,

whim

[edit: speling]

Edited by whim

Share this post


Link to post
Share on other sites
darkjohn20

[edit: speling]

Haha.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×