parasoul
26th July 2011 23:44 UTC
Need help with GetLastInputInfo via System Plugin
Hi. I'm trying to get the GETLASTINFO structure from GetLastInputInfo function from user32.dll
here's my current code:
System::Alloc 32
Pop $1
# call
System::Call "user32::GetLastInputInfo(p r1)"
# get
System::Call "*$1(&l, i.r0)"
MessageBox MB_OK "$0"
# free
System::Free $1
this code crashes... not sure what the problem is.
I'd very much appreciate you guys taking a look @ it and offering some assistance.
Thanks!
parasoul
26th July 2011 23:51 UTC
I Think the problem may be that I need to set the first member of the struct in $1 to sizeof(struct) (by using &l, correct?) however, I do not know how to set the members of a struct with nsis.
Anders
26th July 2011 23:59 UTC
p type does not work in 2.46, use i
parasoul
27th July 2011 00:13 UTC
thank you.
Now it doesn't crash, but it just has one output for the second member of the struct (milliseconds since last input)...
${While} 1 == 1
System::Alloc 32
Pop $1
System::Call "*$1(&l, i.r0)" ;setting data in struct..
System::Call "user32::GetLastInputInfo(i r1)" ;call function..
# get
System::Call "*$1(&l, i.r0)" ;read struct output
DetailPrint "$0"
System::Free $1
${EndWhile}
note: it's in an inf. while loop so I can see if the time since last input values will change of course
it just constantly stays at zero regardless if my activity
do you see any reason why this will happen?
parasoul
27th July 2011 00:18 UTC
hmm,
when I replace line 4 in my code with this:
System::Call "*$1(&l, i 5)" ;setting data in struct..
then the "output" will just stay at 5... so it seems like GetLastInputInfo isn't manipulating the struct at all...
Anders
27th July 2011 14:57 UTC
System::Call '*(i 8,i)i.r0'
System::Call 'USER32::GetLastInputInfo(ir0)'
System::Call '*$0(i,i.r1)'
System::Free $0
DetailPrint $1
...
Afrow UK
27th July 2011 15:07 UTC
Not sure how you are supposed to use &l but this works without it:
System::Call `*(i 8, i 0) i.r0`
System::Call `user32::GetLastInputInfo(i r0)`
System::Call `*$0(i, i.r1)`
System::Free $0
DetailPrint $1
Edit: LOL^ :D
Stu
parasoul
28th July 2011 00:15 UTC
So awesome. Thanks guys.