Giriş yap
En iyi yollayıcılar
Hello EMO | ||||
EMO | ||||
eMoStyLe | ||||
BesimBICER | ||||
GameKinG | ||||
Crysis | ||||
~>!.DεvιLρяιεsт.!<~ | ||||
MeTaL | ||||
TrueCrime | ||||
djhayal3t |
Istatistikler
Toplam 203 kayıtlı kullanıcımız varSon kaydolan kullanıcımız: crayzboy76
Kullanıcılarımız toplam 1186 mesaj attılar bunda 862 konu
Arama
Sosyal yer imi
Sosyal bookmarking sitesinde Emo, Emo nedir, Emo resimleri, Emo Kıyafetleri, Emo Sözleri, Emo Oyunları, EmoTurkey, Emo Nickler, Emo Avatarları, Punk, Punk Resimleri, Punk Avatarları, Rock, Rock Resimleri, Rock Avatarları, Msn Nickleri, Msn Avatarları, Müzik adresi saklayın ve paylaşın
Sosyal bookmarking sitesinde EMO Style ForumPro - Hos Geldiniz adresi saklayın ve paylaşın
Kimler hatta?
Toplam 3 kullanıcı online :: 0 Kayıtlı, 0 Gizli ve 3 Misafir Yok
Sitede bugüne kadar en çok 217 kişi C.tesi Tem. 29, 2017 1:46 am tarihinde online oldu.
En son konular
Reklam
Basic Keyboard Hooks
1 sayfadaki 1 sayfası
Basic Keyboard Hooks
First off this is obviously my first post on MPGH.net and i wanna post something actually contributory.
To create a Basic Keyboard hook you are going to need to understand basic C# and .NET basics.
To start make a new Windows Form project and name it whatever you want.
Then go into the Forms Code and add the following namespaces
Code:
using System.IO;
using System****ntime.InteropServices;
using Microsoft.Win32;
using System.Diagnostics;
Now that you have those you want to add a new struct above your main form class.
Code:
[StructLayout(LayoutKind.Sequential)]
public struct KeyHook
{
public Keys key;
public int Code;
public int flags;
public int time;
public IntPtr extra;
}
Now that you have a new struct you want to go into your forms class and add the following Fields.
Code:
private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int id, LowLevelKeyboardProc callback, IntPtr hMod, uint dwThreadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool UnhookWindowsHookEx(IntPtr hook);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr CallNextHookEx(IntPtr hook, int nCode, IntPtr wp, IntPtr lp);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string name);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern short GetAsyncKeyState(Keys key);
private IntPtr ptrHook;
private LowLevelKeyboardProc objKeyboardProcess;
Now in your forms class add the following void
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
now into your forms main void default (Form1()) or
Code:
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
objKeyboardProcess = new LowLevelKeyboardProc(captureKey);
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0);
Now go to your Forms Designer.cs and add the name spaces
Code:
using System;
then in the designers Desposing() bool replace it with
Code:
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
if (ptrHook != IntPtr.Zero)
{
UnhookWindowsHookEx(ptrHook);
ptrHook = IntPtr.Zero;
}
base.Dispose(disposing);
}
Now we have added the code to catch the keybaord hooks to use this to do functions or other stuff we go to the CaptureKey void
To Disable a Key's input you add the code
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
if (objKeyInfo.key == /*Key to disable*/)
return (IntPtr)1;
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
To have it do a function do
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
//if (objKeyInfo.key == /*Key*/)
Application.Exit();
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
That is basic Keyboard Hooks, You can do many things with this code.
-Kantanomo leaving it short and sweet
To create a Basic Keyboard hook you are going to need to understand basic C# and .NET basics.
To start make a new Windows Form project and name it whatever you want.
Then go into the Forms Code and add the following namespaces
Code:
using System.IO;
using System****ntime.InteropServices;
using Microsoft.Win32;
using System.Diagnostics;
Now that you have those you want to add a new struct above your main form class.
Code:
[StructLayout(LayoutKind.Sequential)]
public struct KeyHook
{
public Keys key;
public int Code;
public int flags;
public int time;
public IntPtr extra;
}
Now that you have a new struct you want to go into your forms class and add the following Fields.
Code:
private delegate IntPtr LowLevelKeyboardProc(int nCode, IntPtr wParam, IntPtr lParam);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr SetWindowsHookEx(int id, LowLevelKeyboardProc callback, IntPtr hMod, uint dwThreadId);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern bool UnhookWindowsHookEx(IntPtr hook);
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr CallNextHookEx(IntPtr hook, int nCode, IntPtr wp, IntPtr lp);
[DllImport("kernel32.dll", CharSet = CharSet.Auto, SetLastError = true)]
private static extern IntPtr GetModuleHandle(string name);
[DllImport("user32.dll", CharSet = CharSet.Auto)]
private static extern short GetAsyncKeyState(Keys key);
private IntPtr ptrHook;
private LowLevelKeyboardProc objKeyboardProcess;
Now in your forms class add the following void
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
now into your forms main void default (Form1()) or
Code:
ProcessModule objCurrentModule = Process.GetCurrentProcess().MainModule;
objKeyboardProcess = new LowLevelKeyboardProc(captureKey);
ptrHook = SetWindowsHookEx(13, objKeyboardProcess, GetModuleHandle(objCurrentModule.ModuleName), 0);
Now go to your Forms Designer.cs and add the name spaces
Code:
using System;
then in the designers Desposing() bool replace it with
Code:
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
if (ptrHook != IntPtr.Zero)
{
UnhookWindowsHookEx(ptrHook);
ptrHook = IntPtr.Zero;
}
base.Dispose(disposing);
}
Now we have added the code to catch the keybaord hooks to use this to do functions or other stuff we go to the CaptureKey void
To Disable a Key's input you add the code
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
if (objKeyInfo.key == /*Key to disable*/)
return (IntPtr)1;
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
To have it do a function do
Code:
private IntPtr captureKey(int nCode, IntPtr wp, IntPtr lp)
{
if (nCode >= 0)
{
KeyHook objKeyInfo = (KeyHook)Marshal.PtrToStructure(lp, typeof(KeyHook));
//if (objKeyInfo.key == /*Key*/)
Application.Exit();
}
http://this.TopMost = true;
return CallNextHookEx(ptrHook, nCode, wp, lp);
}
That is basic Keyboard Hooks, You can do many things with this code.
-Kantanomo leaving it short and sweet
EMO- EMO Team
- Cinsiyet :
Burçlar :
Mesaj Sayısı : 184
Puan : 247393
Rep Puanı : 5
Doğum tarihi : 28/11/89
Kayıt tarihi : 18/05/11
Yaş : 34
Nerden : EMO world
İş/Hobiler : RCE Student / Game Hacking / Learn Beginner C#,C++,Delphi
Lakap : EMO
Similar topics
» Simple Keyboard Hook within a DLL
» Basic C# DLL injector
» [C++] Basic Game Hacking (Memory Editing)
» [Tutorial] Basic Packet Hacking
» [Tutorial] Trainer Visual Basic 6
» Basic C# DLL injector
» [C++] Basic Game Hacking (Memory Editing)
» [Tutorial] Basic Packet Hacking
» [Tutorial] Trainer Visual Basic 6
1 sayfadaki 1 sayfası
Bu forumun müsaadesi var:
Bu forumdaki mesajlara cevap veremezsiniz
Cuma Ağus. 29, 2014 8:33 am tarafından Hello EMO
» goldenchase.net maden yaparak para kazanma
Cuma Ağus. 29, 2014 8:18 am tarafından Hello EMO
» etichal hacker görsel egitim seti
Çarş. Ağus. 06, 2014 4:57 am tarafından Hello EMO
» KO TBL Source C#
Ptsi Ara. 09, 2013 6:36 am tarafından Hello EMO
» x86 Registers
C.tesi Ağus. 24, 2013 5:02 am tarafından Hello EMO
» [Tutorial] Pegando Address, Pointers de WYD
Çarş. Tem. 10, 2013 7:25 am tarafından Hello EMO
» [Tutorial] Pegando Address, Pointers de CS Metodo²
Çarş. Tem. 10, 2013 7:23 am tarafından Hello EMO
» [Tutorial] Aprendendo basico deASM OLLYDBG
Çarş. Tem. 10, 2013 7:22 am tarafından Hello EMO
» Basic C# DLL injector
Ptsi Tem. 08, 2013 7:48 am tarafından Hello EMO