|
-
Nov 21st, 2008, 10:04 AM
#1
Thread Starter
New Member
Why can't I hook Notepad on Vista 64?
I've been trying to understand how hooking works and I found an excellent example:
http://www.vbforums.com/showthread.php?t=391338
This example works on a my 32 bit XP machine, but it does not work on my Vista Ultimate 64 bit machine. The example is supposed to hook notepad so that whenever I type a character in notepad, a text box recieves the same character. This works on XP, but on Vista 64, nothing happens.
I should probably say that when I first ported the example to Vista, I ran into 2 problems, which I think I correctly fixed.
1. I was getting a BadImageFormatException when the DLL was first trying to be accessed. I fixed this by setting the target platform in the VB project to be x86.
2. I was getting a DllNotFoundExeception, so I placed the "MainHook.dll" file in both:
C:\Windows\SysWOW64
C:\Windows\System32
I have a couple of theories, but I'm a bit of a beginner when it comes to hooking. Could this be happening because Notepad is a 64 bit application and the hook is written in 32 bit? I have the express version of VC++, so I can't create a dll targetted to 64 bit, so I haven't tried that. Any idea's?
-
Nov 21st, 2008, 11:15 AM
#2
Re: Why can't I hook Notepad on Vista 64?
This probably has something to do with security. I read somewhere that incoming windows messages are actually evaluated to decide if the sending process has enough privileges (to be taken seriously). Maybe someone with such an OS will help you more.
-
Nov 24th, 2008, 05:30 AM
#3
Member
Re: Why can't I hook Notepad on Vista 64?
Hi ya all,
I dont have the solution. I only have a comment that I have a similar problem with journal hooks with Vista. Local hooks are fine but global hooks return an "Access Denied" error.
From what I have read so far it is al to do with elevation. The work around for this is ??????
Not been able to get a simplified answer 
Although there is a lot written about this, it isnt clear enough for someone like me....novice using VB6. I have journal hooks working on 2000 and am afraid we will loose our functionality if we go to Vista. Any simplified help is greatfully accepted.
-
Nov 24th, 2008, 09:12 AM
#4
Re: Why can't I hook Notepad on Vista 64?
 Originally Posted by McBluffin
I have a couple of theories, but I'm a bit of a beginner when it comes to hooking. Could this be happening because Notepad is a 64 bit application and the hook is written in 32 bit? I have the express version of VC++, so I can't create a dll targetted to 64 bit, so I haven't tried that. Any idea's?
Two things.
1. Wrong forum. This is a Visual Basic forum.
2. I think you just found your own problem. Since you can't target 64-bit, how do you expect a 32-bit application to communicate directly with a 64-bit one? It's possible you may be able to do this in managed C++ but I'm familiar enough with hooking to give you any useful guidance.
 Originally Posted by tropix100
I dont have the solution. I only have a comment that I have a similar problem with journal hooks with Vista. Local hooks are fine but global hooks return an "Access Denied" error.
From what I have read so far it is al to do with elevation. The work around for this is ??????
Not been able to get a simplified answer 
Although there is a lot written about this, it isnt clear enough for someone like me....novice using VB6. I have journal hooks working on 2000 and am afraid we will loose our functionality if we go to Vista. Any simplified help is greatfully accepted.
There is no "work around". This is security. Vista requires applications that hook into system level items to be elevated (otherwise it's a security risk). Just like SendKeys are a bad idea and don't work on Vista anymore.
Check this out (first result on a Google search).
-
Nov 24th, 2008, 02:30 PM
#5
Member
Re: Why can't I hook Notepad on Vista 64?
There is no "work around". This is security. Vista requires applications that hook into system level items to be elevated (otherwise it's a security risk). Just like SendKeys are a bad idea and don't work on Vista anymore.
Im an far from experienced when it comes to hooks but I have searched enough to know that there is a work around....there are macro recorders out there that operate on my vista machine.
I would like assistance in learning how this is done so I can continue with my own little recorder project.
I dont understand about manifests so if you could help me out I would appreciate that.
-
Dec 23rd, 2009, 03:39 AM
#6
New Member
Re: Why can't I hook Notepad on Vista 64?
 Originally Posted by McBluffin
I've been trying to understand how hooking works and I found an excellent example:
http://www.vbforums.com/showthread.php?t=391338
This example works on a my 32 bit XP machine, but it does not work on my Vista Ultimate 64 bit machine. The example is supposed to hook notepad so that whenever I type a character in notepad, a text box recieves the same character. This works on XP, but on Vista 64, nothing happens.
I should probably say that when I first ported the example to Vista, I ran into 2 problems, which I think I correctly fixed.
1. I was getting a BadImageFormatException when the DLL was first trying to be accessed. I fixed this by setting the target platform in the VB project to be x86.
2. I was getting a DllNotFoundExeception, so I placed the "MainHook.dll" file in both:
C:\Windows\SysWOW64
C:\Windows\System32
I have a couple of theories, but I'm a bit of a beginner when it comes to hooking. Could this be happening because Notepad is a 64 bit application and the hook is written in 32 bit? I have the express version of VC++, so I can't create a dll targetted to 64 bit, so I haven't tried that. Any idea's?
-->Build MainHook.dll for x64 in Configuration Manager
-->Build clsHook (your app) for x64 in Configuration Manager
It will work.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|