Winamp & Shoutcast Forums

Winamp & Shoutcast Forums (http://forums.winamp.com/index.php)
-   NSIS Discussion (http://forums.winamp.com/forumdisplay.php?f=65)
-   -   get process info (http://forums.winamp.com/showthread.php?t=305810)

820815 28th April 2009 13:55

get process info
 
How can I get "I/O Write Bytes" info for process? :confused:

Static_VoiD 29th April 2009 00:28

Oh, man. You can read some manual on this at MSDN.
Them use System plugin to call the DLL and function required.

820815 29th April 2009 16:33

MSDN :eek:

If I could understand what is written there, I would not have to ask here

820815 25th August 2010 00:29

So... http://msdn.microsoft.com/en-us/libr...(v=VS.85).aspx

System::Call 'kernel32::OpenProcess(i 1040, i 0, i $PID)i .r0'

System::Alloc 48 ;6 counters * 8 bytes?
Pop $1

System::Call 'kernel32::ProcessGetIOCounters(i r0, p r1)' ??? :hang:

Animaether 25th August 2010 04:04

hmmm... good question - seems like it should work (except that 'p' is incorrect... that's the online docs vs included docs mismatch thing.. you'd want 'i')...

...except that it doesn't seem to. Perhaps the struct size isn't quite right - but doesn't seem to be anything wrong with it...

PHP Code:

OutFile "test.exe"

!define PROCESS_QUERY_INFORMATION 0x0400
!define PROCESS_VM_READ 0x0010

Section
    System
::Call "kernel32::GetCurrentProcessId(v)i.r0"
    
System::Call "kernel32::OpenProcess(i${PROCESS_QUERY_INFORMATION}|${PROCESS_VM_READ}, i0, ir0) i.r1 ? e"
    
Pop $7


    System
::Call "*(l, l, l, l, l, l) i.r2"

    
System::Call "kernel32::GetProcessIoCounters(ir1, i.r2) i.r5 ? e"
    
Pop $6
    System
::Call "*$2(l.R1, l.R2, l.R3, l.R4, l.R5, l.R6)"
    
MessageBox MB_OK "GetCurrentProcessId: $0$\nGetOpenProcess: $1$\nBuffer: $2$\nGetProcessIoCounters result: $5$\nGetLastError: $6$\n$\n[$R1][$R2][$R3][$R4][$R5][$R6]"
    
System::Free $2
SectionEnd 

PHP Code:

---------------------------
Name Setup
---------------------------
GetCurrentProcessId5420
GetOpenProcess
248
Buffer
<--- should remain pointer to struct address
GetProcessIoCounters result
<--- should be non-zero
GetLastError
998

[0][0][0][0][0][0]
---------------------------
OK   
--------------------------- 

No idea.. some System plugin wizard will hopefully step in %)

gringoloco023 25th August 2010 06:51

Dot
 
At least the following line should have a dot less on the second parameter. (it's a buffer 'out' so one has to supply the buffer handle)
PHP Code:

System::Call "kernel32::GetProcessIoCounters(ir1, ir2) i.r5 ? e" 

Results:
PHP Code:

GetCurrentProcessId700
GetOpenProcess
204
Buffer
1371680
GetProcessIoCounters result
1
GetLastError
80

[82][3][2529][66090][11408][98746

I'm not sure what I'm exactly looking for, so it's a bit hard to confirm the shape of IO_COUNTERS Structure to be right

Animaether 25th August 2010 11:30

Quote:

Originally Posted by gringoloco023 (Post 2691685)
At least the following line should have a dot less on the second parameter. (it's a buffer 'out' so one has to supply the buffer handle)
PHP Code:

System::Call "kernel32::GetProcessIoCounters(ir1, ir2) i.r5 ? e" 


Oh pish. Go figure.. I correlated the __out type as out in the System syntax, and not in.

Quote:

Originally Posted by gringoloco23 (Post 2691685)
I'm not sure what I'm exactly looking for, so it's a bit hard to confirm the shape of IO_COUNTERS Structure to be right

Open up Task Manager, add the IO columns if needed, compare to those :)

so, corrected code without the debuggery bits...
PHP Code:

OutFile "test.exe"

!define PROCESS_QUERY_INFORMATION 0x0400
!define PROCESS_VM_READ 0x0010

Section
    System
::Call "kernel32::GetCurrentProcessId(v)i.r0"
    
System::Call "kernel32::OpenProcess(i${PROCESS_QUERY_INFORMATION}|${PROCESS_VM_READ}, i0, ir0) i.r1"

    
System::Call "*(l, l, l, l, l, l) i.r2"

    
System::Call "kernel32::GetProcessIoCounters(ir1, ir2)"

    
System::Call "*$2(l.R1, l.R2, l.R3, l.R4, l.R5, l.R6)"

    
MessageBox MB_OK "PID: $0$\n$\nI/O Reads: $R1$\nI/O Writes: $R2$\nI/O Other: $R3$\nI/O Read Bytes: $R4$\nI/O Write Bytes: $R5$\nI/O Other Bytes: $R6"
    
System::Free $2
SectionEnd 

PHP Code:

---------------------------
Name Setup
---------------------------
PID3460

I
/O Reads75
I
/O Writes3
I
/O Other505
I
/O Read Bytes66122
I
/O Write Bytes11408
I
/O Other Bytes157458
---------------------------
OK   
--------------------------- 


820815 25th August 2010 16:29

Thank you! ;)


All times are GMT. The time now is 18:03.

Copyright © 1999 - 2010 Nullsoft. All Rights Reserved.