资源简介

Windows内核安全编程从入门到实践 此书的代码部分

资源截图

代码片段和文件信息

#include “stdafx.h“

void GetOpenBlockUnload(IN PDRIVER_object Driverobject);
NTSTATUS GetOpenBlockCreateClose(IN PDEVICE_object Deviceobject IN PIRP Irp);
NTSTATUS GetOpenBlockDefaultHandler(IN PDEVICE_object Deviceobject IN PIRP Irp);

NTSTATUS DriverEntry(IN PDRIVER_object Driverobject IN PUNICODE_STRING  RegistryPath)
{
UNICODE_STRING DeviceNameWin32Device;
PDEVICE_object Deviceobject = NULL;
NTSTATUS status;
unsigned i;

RtlInitUnicodeString(&DeviceNameL“\\Device\\GetOpenBlock0“);
RtlInitUnicodeString(&Win32DeviceL“\\DosDevices\\GetOpenBlock0“);

for (i = 0; i <= IRP_MJ_MAXIMUM_FUNCTION; i++)
Driverobject->MajorFunction[i] = GetOpenBlockDefaultHandler;

Driverobject->MajorFunction[IRP_MJ_CREATE] = GetOpenBlockCreateClose;
Driverobject->MajorFunction[IRP_MJ_CLOSE] = GetOpenBlockCreateClose;

Driverobject->DriverUnload = GetOpenBlockUnload;
status = IoCreateDevice(Driverobject
0
&DeviceName
FILE_DEVICE_UNKNOWN
0
FALSE
&Deviceobject);
if (!NT_SUCCESS(status))
return status;
if (!Deviceobject)
return STATUS_UNEXPECTED_IO_ERROR;

Deviceobject->Flags |= DO_DIRECT_IO;
Deviceobject->AlignmentRequirement = FILE_WORD_ALIGNMENT;
status = IoCreateSymboliclink(&Win32Device &DeviceName);

Deviceobject->Flags &= ~DO_DEVICE_INITIALIZING;

ShowOpenBlock(Driverobject);

return STATUS_SUCCESS;
}

void GetOpenBlockUnload(IN PDRIVER_object Driverobject)
{
UNICODE_STRING Win32Device;
RtlInitUnicodeString(&Win32DeviceL“\\DosDevices\\GetOpenBlock0“);
IoDeleteSymboliclink(&Win32Device);
IoDeleteDevice(Driverobject->Deviceobject);
}

NTSTATUS GetOpenBlockCreateClose(IN PDEVICE_object Deviceobject IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_SUCCESS;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp IO_NO_INCREMENT);
return STATUS_SUCCESS;
}

NTSTATUS GetOpenBlockDefaultHandler(IN PDEVICE_object Deviceobject IN PIRP Irp)
{
Irp->IoStatus.Status = STATUS_NOT_SUPPORTED;
Irp->IoStatus.Information = 0;
IoCompleteRequest(Irp IO_NO_INCREMENT);
return Irp->IoStatus.Status;
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       2150  2010-07-30 18:45  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.cpp

     文件       1242  2010-07-30 15:02  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.sln

    ..A..H.     23148  2010-07-31 15:16  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.suo

     文件       9887  2010-07-30 22:52  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.vcproj

     文件       2615  2010-07-31 15:16  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.vcproj.L01-PC.L01.user

     文件        408  2010-07-30 15:02  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.Win32.vddklaunch

     文件        408  2010-07-30 15:02  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\GetOpenBlock.x64.vddklaunch

     文件       7143  2010-07-31 14:59  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\OpenBlock.cpp

     文件       2185  2010-07-31 14:57  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\OpenBlock.h

     文件         70  2010-07-30 15:02  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\stdafx.cpp

     文件        542  2010-07-30 22:31  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\stdafx.h

     文件       1055  2010-07-30 15:02  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlock\GetOpenBlock\VisualDDKHelpers.h

     文件       2332  2010-07-31 15:21  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.cpp

     文件       1271  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.sln

    ..A..H.     24576  2011-02-17 20:30  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.suo

     文件      10018  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.vcproj

     文件       1409  2011-02-17 20:30  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.vcproj.L01-PC.L01.user

     文件        450  2010-07-31 15:20  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.Win32.vddklaunch

     文件        450  2010-07-31 15:20  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject.x64.vddklaunch

     文件      11373  2011-02-17 14:51  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\ShowOpenBlock.cpp

     文件       4533  2010-08-01 19:44  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\ShowOpenBlock.h

     文件         70  2010-07-31 15:20  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\stdafx.cpp

     文件        518  2010-07-31 21:21  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\stdafx.h

     文件       1786  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\UpgradeLog.xml

     文件       1055  2010-07-31 15:20  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\VisualDDKHelpers.h

     文件       3348  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\_UpgradeReport_Files\UpgradeReport.css

     文件      12505  2008-01-11 01:25  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\_UpgradeReport_Files\UpgradeReport.xslt

     文件         69  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\_UpgradeReport_Files\UpgradeReport_Minus.gif

     文件         71  2011-01-20 19:43  Projects\chapter 10 网络\GetNDISOpenBlock\GetOpenBlockByDriverobject\GetOpenBlockByDriverobject\_UpgradeReport_Files\UpgradeReport_Plus.gif

     文件       1082  2010-07-31 23:17  Projects\chapter 10 网络\GetNDISOpenBlock\Readme.txt

............此处省略260个文件信息

评论

共有 条评论