Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

SetWindowsHookEx does not return (hangs)

238 views
Skip to first unread message

John Smith

unread,
Feb 13, 2012, 8:34:58 AM2/13/12
to
I am doing a WH_JOURNALRECORD:

myval=SetWindowsHookEx(WH_JOURNALRECORD,(HOOKPROC)myhookproc,mhinst,(DWORD)NULL);
The hook proc (myhookproc) is in a DLL. All works fine in NT, 2000 and XP but not
in Windows 7 32-bit (haven't tried 64). The main exe is a Windows 32 exuciutable
an dthe DLL is also 32.

I tried to figure what is going on and under debugger executing line with
"myval=SetWindowsHo.." bring the the systems to a stand-still (mouse moves). If
I do Ctrl+Alt+Del the teh debugger gets control back and "myval" appears to have
valid value.

Since the code works ok in a number of other systems I reckon there must to some
issue with rights. I am running with Admin rights (I am the only user).

I tried to google solutions but came of short.

Any suggestion what is causing the hang?

John Smith

unread,
Feb 15, 2012, 4:24:45 AM2/15/12
to
Does anyone have a working (in Windows 7) sample where SetWindowsHookEx does not
cause crash. I downloaded a few samples - all cause bluescreen crash.

Is SetWindowsHookEx in some way less supported?

Fred

unread,
Feb 15, 2012, 6:06:36 AM2/15/12
to

"John Smith" <do_no...@invalid.address.com> a écrit dans le message de
news: bq3ij7dk4is7hbjc7...@4ax.com...
> Since the code works ok in a number of other systems I reckon there must
> to some
> issue with rights. I am running with Admin rights (I am the only user).

Yes, probably a problem with rights , the doc. says :

"
A lower privilege process cannot:

a.. Perform a window handle validation of higher process privilege.

b.. SendMessage or PostMessage to higher privilege application windows.
These application programming interfaces (APIs) return success but silently
drop the window message.

c.. Use thread hooks to attach to a higher privilege process.

d.. Use Journal hooks to monitor a higher privilege process.

e.. Perform dynamic link-library (DLL) injection to a higher privilege
process.

"


John Smith

unread,
Feb 15, 2012, 7:06:15 AM2/15/12
to
How do I elevate my right higher so that SetWindowsHookEx(WH_JOURNALRECOR... does
not crash? I am the only user on this computer.

Stefan Kuhr

unread,
Feb 16, 2012, 3:04:24 AM2/16/12
to
Hello John,

On 2/15/2012 10:24 AM, John Smith wrote:
> John Smith<do_no...@invalid.address.com> wrote:
>
> <snip>
> Does anyone have a working (in Windows 7) sample where SetWindowsHookEx does not
> cause crash. I downloaded a few samples - all cause bluescreen crash.
>


If innocent user mode code BSODs your box, then by very definition, your
system's choice of hardware or kernel mode drivers must be at fault.

Start replacing drivers. A good place to start is your video driver.
Replace it with one that ships with windows and see if your problem goes
away.

--
S


John Smith

unread,
Feb 16, 2012, 9:01:44 AM2/16/12
to
I don't think BSOD is caused by some driver. When I googled hooking other
reported same thing on diffrent Win 7 systems.

Stefan Kuhr

unread,
Feb 16, 2012, 9:31:24 AM2/16/12
to
Hello John,

On 2/16/2012 3:01 PM, John Smith wrote:
><snip>
> I don't think BSOD is caused by some driver. When I googled hooking other
> reported same thing on diffrent Win 7 systems.



Think again.


--
S


0 new messages