Windows Hooking

K

kann181

I would like to know how to use SetWindowsHookEx in perl for
WH_JOURNALRECORD & WH_JOURNALPLAYBACK..
i tried the following but didn't work
1. Win32::API->Import("User32", "HHOOK SetWindowsHookEx(int idHook,
HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)");

This says that HOOKPROC is Unknown Parameter type.

2. my $setWindowsHookEx = new Win32::API('User32',
'SetWindowsHookEx','IKPL', 'P');
my $callback = Win32::API::Callback->new(
sub
{
my($Code, $wParam, $lParam)
= @_;
if($Code eq "0")
{
print "Welcome to
Hooking";
}
else
{
return
CallNextHookEx($hook_handle, $code,$wParam, $lparam);
}
return 0;
},"DD", "P",
);
my $hook_handle = $setWindowsHookEx->Call(13, $callback, NULL, 0);

This also didn't work.

Please if any could rectify my mistakes.....
 
D

Dave

I would like to know how to use SetWindowsHookEx in perl for
WH_JOURNALRECORD & WH_JOURNALPLAYBACK..
i tried the following but didn't work
1. Win32::API->Import("User32", "HHOOK SetWindowsHookEx(int idHook,
HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)");

This says that HOOKPROC is Unknown Parameter type.

2. my $setWindowsHookEx = new Win32::API('User32',
'SetWindowsHookEx','IKPL', 'P');
my $callback = Win32::API::Callback->new(
sub
{
my($Code, $wParam, $lParam)
= @_;
if($Code eq "0")
{
print "Welcome to
Hooking";
}
else
{
return
CallNextHookEx($hook_handle, $code,$wParam, $lparam);
}
return 0;
},"DD", "P",
);
my $hook_handle = $setWindowsHookEx->Call(13, $callback, NULL, 0);

This also didn't work.

Please if any could rectify my mistakes.....

I can tell you that at HOOKPROC what is expected is the address of the
callback function (as a long integer pointer). I cannot tell you how or if
you can do this from perl although I expect the various docs online about
how to do this from VB should give some pointers (no pun intended).
 
R

robic0

I would like to know how to use SetWindowsHookEx in perl for
WH_JOURNALRECORD & WH_JOURNALPLAYBACK..
i tried the following but didn't work
1. Win32::API->Import("User32", "HHOOK SetWindowsHookEx(int idHook,
HOOKPROC lpfn, HINSTANCE hmod, DWORD dwThreadId)");

This says that HOOKPROC is Unknown Parameter type.

2. my $setWindowsHookEx = new Win32::API('User32',
'SetWindowsHookEx','IKPL', 'P');
my $callback = Win32::API::Callback->new(
sub
{
my($Code, $wParam, $lParam)
= @_;
if($Code eq "0")
{
print "Welcome to
Hooking";
}
else
{
return
CallNextHookEx($hook_handle, $code,$wParam, $lparam);
}
return 0;
},"DD", "P",
);
my $hook_handle = $setWindowsHookEx->Call(13, $callback, NULL, 0);

This also didn't work.

Please if any could rectify my mistakes.....

Hahahaaaaaaaaaaaaaaaaaa!!!!!
Now theres a new one, hooking the api with Perl.
Don't stop there, go straight to Perl::Rootkit!!
 
R

robic0

Hahahaaaaaaaaaaaaaaaaaa!!!!!
Now theres a new one, hooking the api with Perl.
Don't stop there, go straight to Perl::Rootkit!!

BTW, there's no doubt that a user mode dll with a
Perl interface cannot be used to control '.sys' drivers.
Now all you have to do is get somebody to do the driver
as well. Hint: I won't do it for free...
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top