It is currently Fri Jan 22, 2021 3:12 am

All times are UTC + 1 hour




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: (Solved) Mousehook troubles (Win10)
PostPosted: Mon Sep 23, 2019 1:57 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 770
Location: Linz, Austria
I'm having troubles to port an old program of mine (based on this code) to Windows 10 (coming from Win7)

When I start nlh.exe as a non-elevated process, only non-elevated programs seems to react to the hook. Starting nlh.exe with admin-rights only works on elevated, but not on non-elevated programs. I've already tried uiAccess=true inside the manifest, test-signed my program (Jimmy Brush's reply) and installed the .cert on Win10, but I still get the "A referral was returned from the server."-Message. Is there anything else I have to do, to make it work on Win10? Is uiAccess=true the only way?

All suggestions are welcome ;) Thx


edit1: Seems like I made a mistake installing the certificate... uiAccess=true works now without the error message, but I still don't get a signal from non-elevated and elevated programs at the same time

_________________
Et cetera is my worst enemy


Last edited by chi on Tue Sep 24, 2019 1:48 pm, edited 1 time in total.

Top
 Profile  
Reply with quote  
 Post subject: Re: Mousehook troubles (Win10)
PostPosted: Mon Sep 23, 2019 10:05 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Wed Jun 25, 2014 5:25 pm
Posts: 430
Location: Germany
The mouse hook procedure should be outsourced in a DLL. Is that the case with you?

_________________
Image
Why OpenSource should have a license :: DarkColor-Scheme for PureBasic
PureBasic-CodeArchiv-Rebirth: Git-Repository / Download – Any help is welcome!
Manjaro Xfce x64 (Main system) :: Windows 7 x64 (VirtualBox) :: Newest PureBasic version


Top
 Profile  
Reply with quote  
 Post subject: Re: Mousehook troubles (Win10)
PostPosted: Tue Sep 24, 2019 12:06 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 770
Location: Linz, Austria
Sicro wrote:
The mouse hook procedure should be outsourced in a DLL. Is that the case with you?
Yes, the dll is separate, of course (code).

The mousehook currently works on Win7 without UAC for both non-elevated and elevated programs simultaneously. With UAC on, I need to launch the exe with admin rights to catch all elevated programs, but this wont catch any non-elevated programs. And launching it without admin rights just collects messages from non-elevated programs. Same behavior on Windows 10, except that it doesn't matter anymore if UAC is on or off...

_________________
Et cetera is my worst enemy


Top
 Profile  
Reply with quote  
 Post subject: Re: Mousehook troubles (Win10)
PostPosted: Tue Sep 24, 2019 12:16 pm 
Offline
Enthusiast
Enthusiast

Joined: Mon Dec 21, 2015 8:12 pm
Posts: 179
Use ChangeWindowMessageFilter_() or ChangeWindowMessageFilterEx_() in your exe
and allow it to receive the message your dll sends.


Top
 Profile  
Reply with quote  
 Post subject: Re: Mousehook troubles (Win10)
PostPosted: Tue Sep 24, 2019 1:43 pm 
Offline
Enthusiast
Enthusiast
User avatar

Joined: Sat May 05, 2007 5:31 pm
Posts: 770
Location: Linz, Austria
You gotta love the PB community ;)

Thank you, fryquez! Exactly what I was looking for (but didn't know)...

Adding
Code:
ChangeWindowMessageFilter_(#NLH_DLL_CONTROL, #MSGFLT_ADD)
to the program and running it with admin rights, catches now both elevated and non-elevated messages!

_________________
Et cetera is my worst enemy


Top
 Profile  
Reply with quote  
 Post subject: Re: (Solved) Mousehook troubles (Win10)
PostPosted: Sat Sep 28, 2019 8:57 am 
Offline
Addict
Addict

Joined: Sat Jun 30, 2007 8:04 pm
Posts: 3371
Cool. I've been using Win32 for years and never knew about this. Always learning something new. :)


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC + 1 hour


Who is online

Users browsing this forum: No registered users and 8 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  

 


Powered by phpBB © 2008 phpBB Group
subSilver+ theme by Canver Software, sponsor Sanal Modifiye