如何解决非管理员进程的 Windows NDIS FilterDriver 对象 IO 访问
我有 Windows Ndis FilterDriver,它的名字是 \\Device\\MyFilter
。
用户应用程序使用 FilterDriver 执行一些 DeviceIoControl 操作并调用以下代码打开设备句柄:
LPSecurity_ATTRIBUTES lpSecurityAttributes = NULL;
DWORD Creationdistribution = OPEN_EXISTING;
DWORD FlagsAndAttributes = FILE_FLAG_OVERLAPPED;
DWORD DesiredAccess = GENERIC_READ | GENERIC_WRITE;
DWORD ShareMode = FILE_SHARE_READ | FILE_SHARE_WRITE;
DWORD lastErr = 0;
m_hFilter = CreateFileA(MY_FILTER_NAME,/* "\\\\.\\\\MyFilter" */
DesiredAccess,ShareMode,lpSecurityAttributes,Creationdistribution,FlagsAndAttributes,NULL);
if (m_hFilter == INVALID_HANDLE_VALUE)
{
lastErr = GetLastError();
return false;
}
如果用户应用程序以“管理员身份”运行,则效果很好,否则(如果以普通用户身份运行)CreateFileA 返回 INVALID_HANDLE_VALUE,并且 lastErr = 5(拒绝访问)
返回“拒绝访问”的原因很清楚。 如何让用户的应用打开Filter Driver对象?
使用 IoRegisterDeviceInterface() 创建接口的想法看起来很有希望,但它需要指向 PDO 的指针,我不知道从哪里获取 Ndis 过滤器。
解决方法
应正确设置 NDIS_DEVICE_OBJECT_ATTRIBUTES 参数的 DefaultSDDLString 字段以调用 NdisRegisterDeviceEx()
<div class="modal fade" id="agregarClienteModal">
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header bg-info text-white">
<h5 class="modal-title">Agregar Cliente</h5>
<button class="close" data-dismiss="modal">
<span>×</span>
</button>
</div>
<form action="${pageContext.request.contextPath}/servlet?accion=insertar"
method="POST" class="was-validated">
<div class="modal-body">
<div class="form-group">
<label for="nombre">Nombre</label>
<input type="text" class="form-control" name="nombre" required>
</div>
<div class="form-group">
<label for="apellido">Apellido</label>
<input type="text" class="form-control" name="apellido" required>
</div>
<div class="form-group">
<label for="email">Email</label>
<input type="email" class="form-control" name="email" required>
</div>
<div class="form-group">
<label for="telefono">Teléfono</label>
<input type="tel" class="form-control" name="telefono" required>
</div>
<div class="form-group">
<label for="saldo">Saldo</label>
<input type="number" class="form-control" name="saldo" required step="any">
</div>
</div>
<div class="modal-footer">
<button class="btn btn-primary" type="submit">Guardar</button>
</div>
</form>
</div>
</div>
</div>
谢谢,Scott_Noone_(OSR)!
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。