有关费尔防火墙一书TDI代码“网上邻居”不能访问功能的修复
本文首先发表于:http://bbs.driverdevelop.com/htm_data/10/0703/100349.html
有关费尔防火墙一书TDI代码“网上邻居”不能访问功能的修复
/*if (Irp->CurrentLocation == 1)
{
ULONG ReturnedInformation = 0;
DBGPRINT(("PacketDispatch encountered bogus current location/n"));
RC = STATUS_INVALID_DEVICE_REQUEST;
Irp->IoStatus.Status = RC;
Irp->IoStatus.Information = ReturnedInformation;
IoCompleteRequest(Irp, IO_NO_INCREMENT);
return( RC );
}*/
修正如下:
sequenceNumber = 0;
seq = InterlockedIncrement(&sequenceNumber);
if (Irp->CurrentLocation < DeviceObject->StackSize)
{
return PassThroughWithNewIrp(DeviceObject, Irp, seq);
}
else
{
NextIrpStack = IoGetNextIrpStackLocation(Irp);
*NextIrpStack = *IrpStack;
IoSetCompletionRoutine(Irp,PacketCompletion,NULL,TRUE,TRUE,TRUE);
return IoCallDriver(pTDIH_DeviceExtension->LowerDeviceObject,Irp);
}
上面用到的子函数体内容如下:
NTSTATUS NetPassOnNormally (PDEVICE_OBJECT HookDevice, IN PIRP Irp)
{
PTDIH_DeviceExtension hookExt = HookDevice->DeviceExtension;
// Back the stack up one
IoSkipCurrentIrpStackLocation(Irp);
// Call the next lower driver
return IoCallDriver(hookExt->LowerDeviceObject, Irp);
}
NTSTATUS NetOtherIRPCompletionRoutine (PDEVICE_OBJECT DeviceObject,
PIRP Irp, PVOID Context)
{
PIRP origIrp = (PIRP) Context;
ULONG seq;
KIRQL oldirql;
PCHAR eventBuffer;
// Extract the sequence number from the original IRP's UserEvent field,
// then restore that field's proper value from the new IRP's field
seq = (ULONG) origIrp->UserEvent;
origIrp->UserEvent = Irp->UserEvent;
// Copy important possibly returned fields in this IRP to the original IRP
origIrp->IoStatus = Irp->IoStatus;
origIrp->PendingReturned = Irp->PendingReturned;
origIrp->MdlAddress = Irp->MdlAddress;
// If this IRP was pending, mark the new and original IRP's pending
if (Irp->PendingReturned) {
IoMarkIrpPending(Irp);
IoMarkIrpPending(origIrp);
}
// Free the IRP we created
IoFreeIrp(Irp);
// Complete the original IRP
IoCompleteRequest(origIrp, IO_NO_INCREMENT);
// Return STATUS_MORE_PROCESSING_REQUIRED to indicate that we're going
// to take control of our IRP and finish handling it. Actually, we've
// already handled it by freeing it. If we didn't take control of it,
// the I/O Manager might try to process our IRP further, which would
// we bad since it's been freed.
return STATUS_MORE_PROCESSING_REQUIRED;
}
NTSTATUS PassThroughWithNewIrp(PDEVICE_OBJECT HookDevice, IN PIRP Irp, ULONG seq)
{
PTDIH_DeviceExtension hookExt = HookDevice->DeviceExtension;
PIRP newIrp;
PIO_STACK_LOCATION currentIrpStackLocation;
PIO_STACK_LOCATION newIrpFirstStackLocation;
// Allocate a new IRP with stack size sufficient for the next lower device
newIrp = IoAllocateIrp(hookExt->LowerDeviceObject->StackSize, FALSE);
DbgPrint("FilterTdiDriver.sys, lower stack, %d, current stack, %d",
hookExt->LowerDeviceObject->StackSize, hookExt->TargetDeviceObject->StackSize);
if (newIrp == NULL){
return NetPassOnNormally(HookDevice, Irp);
}
// Fill in important fields of new IRP with those of original IRP
newIrp->MdlAddress = Irp->MdlAddress;
newIrp->Flags = Irp->Flags;
newIrp->AssociatedIrp = Irp->AssociatedIrp;
newIrp->RequestorMode = Irp->RequestorMode;
newIrp->UserIosb = Irp->UserIosb;
newIrp->UserEvent = Irp->UserEvent;
newIrp->Overlay = Irp->Overlay;
newIrp->UserBuffer = Irp->UserBuffer;
newIrp->Tail.Overlay.AuxiliaryBuffer = Irp->Tail.Overlay.AuxiliaryBuffer;
newIrp->Tail.Overlay.OriginalFileObject = Irp->Tail.Overlay.OriginalFileObject;
newIrp->Tail.Overlay.Thread = Irp->Tail.Overlay.Thread;
// Copy current stack location to the first stack location in the new IRP
currentIrpStackLocation = IoGetCurrentIrpStackLocation(Irp);
newIrpFirstStackLocation = IoGetNextIrpStackLocation(newIrp);
*newIrpFirstStackLocation = *currentIrpStackLocation;
// Set the completion routine to VTrcNetOtherIRPCompletionRoutine, with
// the original IRP as context. Save the sequence number in the UserEvent
// field so that it can be used in the completion routine. (The completion
// routine will restore the original UserEvent field from the new IRP.)
Irp->UserEvent = (PKEVENT) seq;
IoSetCompletionRoutine(newIrp, NetOtherIRPCompletionRoutine, (PVOID) Irp, TRUE, TRUE, TRUE);
// Send the new IRP to the lower-level device
return IoCallDriver(hookExt->LowerDeviceObject, newIrp);
}
有关费尔防火墙一书TDI代码“网上邻居”不能访问功能的修复相关推荐
- 网上邻居不能访问问题集锦
xp不能访问共享文件夹? xp不能共享访问?? 例如:"//192.168.0.80无法访问.你可能没有使用网络的权限,请与这台服务器的管理员联系以查明您是否有访问权限.登录失败:未授予用户 ...
- WinXP下网上邻居不能访问的解决方法大全
WIN XP系统中,网上邻居不能访问,相信很多人都碰到过这样的问题,我通过一些案例进行测试分析和在网上查了一些资料,并将各种网上提供的常见解决方法做了相应测试,现在整理介绍一下.主要的现象有 1. ...
- 局域网网上邻居无法访问解决方案
现在公司最喜欢用WIN2000/XP,但是这个系统本身就带有些系统排斥,因为内网的资源是共享的,所以经常碰到登入不了的问题,系统提示:此工作组的服务器列表无法使用.下面就着手解决.但是首先,我们先来看 ...
- 网上邻居不能访问(方法总结)
大家可能遇到网上邻居不能访问的问题.我现在把所用方法总结如下: 首先,大家把Guest账户打开. 1. 在"运行"中输入gpedit.msc(组策略),然后点击左边菜单中&quo ...
- OpenWrt挂载U盘(NTFS)并在网上邻居共享访问
OpenWrt挂载U盘(NTFS)并在网上邻居共享访问 工具/原料 刷好OpenWrt(带LuCI界面)的路由器一台 当然必须带USB接口 软件:putty 用于命令行操作路由器 软件:WinSCP ...
- win10打开网路邻居计算机,win10系统下网上邻居不能访问其他电脑的解决方法
在 1.首先,右击桌面左下角的"Windows"按钮,从其 2.从打开的"运行"窗口中,输入命令"regedit"并按回车即可打开注册表编辑 ...
- w10无法访问其他计算机,win10系统下网上邻居不能访问其他电脑的解决方法
在win10系统中,许多用户为了方便多人共享文件或者打印机等,就会在局域网中进行共享,正常情况下我们可以通过局域网访问其他同事的电脑,但是win10系统用户却遇到网上邻居不能访问其他电脑的情况,该如何 ...
- 网上邻居无法访问本机及打印机之解…
1.检查guest账户是否开启 XP默认情况下不开启guest账户,因此些为了其他人能浏览你的计算机,请启用guest账户.同时,为了安全请为guest设置密码或相应的权限.当然,也可以为每一台机器设 ...
- 华为手机上的网上邻居怎么用_你的华为手机也可以通过PC网络共享(网上邻居)访问手机文件...
Jack码 最近在学习自媒体和视频制作,需要用手机拍摄一些图片和录制一些视频素材. 但是手机拍摄后需要导出到电脑上进行编辑,这个导出的过程是一个比较坑的过程.比如type-c数据线没带.有数据先线偏偏 ...
- 局域网网上邻居无法访问问题的解决
1.没有为局域网连接开启"Microsoft网络的文件和打印机共享" 请点击"开始菜单→控制面板→网络连接",在所出现窗口中的局域网连接(如"本地连接 ...
最新文章
- windows系统下Python环境的搭建
- 手机linux编译器,在linux上交叉编译helloWorld到android手机上去
- 正则表达式 运算 常见
- Firefox火狐浏览器自用技巧汇总--以备使用--13.5.16
- IE下var丢失造成的错误
- 分页插件PageHelper配置步骤(mybatis)
- 统计单词数(洛谷-P1308)
- linux 动态库系统目录,Linux共享库.so文件的命名和动态链接
- vscode python 远程调试_vscode 远程调试python的方法
- spark-1.2.0 集群环境搭建
- oracle 触发器入门,ORACLE PL/SQ入门 (存储过程、触发器)
- 数字图像处理课程设计-疲劳检测系统
- 直通车测图需要满足哪些数据?
- 联想计算机启机按F1,电脑开机提示按f1不能正常启动怎么办
- 发现CSDN发带图片的博文好麻烦,测试一下51的
- Windows 七种截图方式 快捷键 系统自带 工具软件
- 电脑开机提示 EFI PXE 0 for IPv6
- gitlab常用网址
- 计算机组成原理-Chapter1 计算机系统概述
- 贝壳 OLAP 平台架构及演进
热门文章
- 【人工智能】想要入坑机器学习?这是MIT在读博士的AI心得
- python与数据思维基础网课答案_智慧树知到_Python数据分析与数据可视化_答案免费查询...
- 《大数据》2022年第4期目次摘要
- 下载正版Origin Pro 2022 教程 及 如何 激 活
- uniapp windows 真机调试 ios iphone 踩坑指南 itunes 64位历史版本
- 菲尼克斯FL SWITCH SFN 16TX多端口交换机
- 12帧跑步动画分解图_跑步动画原理讲解
- Android移动应用基础教程知识整理
- 数字图像处理技术在智能交通中的应用
- 信号处理基础——傅里叶变换与短时傅里叶变换