首页
社区
课程
招聘
[求助]如何打开用IoCreateDevice创建的无名称设备!?求大佬解答
发表于: 2018-5-4 01:02 2919

[求助]如何打开用IoCreateDevice创建的无名称设备!?求大佬解答

2018-5-4 01:02
2919
在学习开发驱动的过程中 总会有各种各样的奇思怪想

使用IoCreateDevice 创建设备对象,第三个参数设置为NULL
创建一个没有名称的设备对象

那么问题来了
这样无名称的设备对象 能不能创建符号连接(据说WDM式驱动是可以的)

第二个问题 
内核中 使用ZwCreateFile来打开设备  能否打开获取句柄?

利用
InitializeObjectAttributes(&objectAttributes,
&logFileUnicodeString,//这里填写NULL?
OBJ_CASE_INSENSITIVE,
NULL,
NULL);
希望大佬能帮解答下



[培训]《安卓高级研修班(网课)》月薪三万计划,掌握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

收藏
免费 0
支持
分享
最新回复 (6)
雪    币: 405
活跃值: (2150)
能力值: ( LV4,RANK:50 )
在线值:
发帖
回帖
粉丝
2
无名设备自然无法创建符号链接,也无法和R3通信。不过你可以让系统给你个默认的名字。
  if  (DeviceCharacteristics  &  FILE_AUTOGENERATED_DEVICE_NAME)  {

                        //
                        //  The  caller  has  requested  that  we  automatically  generate  a  device
                        //  object  name.    Retrieve  the  next  available  number  to  use  for  this
                        //  purpose,  and  create  a  name  of  the  form  "\Device\<n>",  where  <n>
                        //  is  the  (8  hexadecimal  digit)  character  representation  of  the  unique
                        //  number  we  retrieve.
                        //

                        nextUniqueDeviceObjectNumber  =  InterlockedIncrement(  &IopUniqueDeviceObjectNumber  );
                        swprintf(  deviceNameBuffer,  L"\\Device\\%08lx",  nextUniqueDeviceObjectNumber  );

                        if  (retryWithNewName)  {

                                //
                                //  We've  already  done  this  once  (hence,  the  unicode  device  name  string
                                //  is  all  set  up,  as  is  all  the  security  information).    Thus,  we  can
                                //  skip  down  to  where  we  re-attempt  the  creation  of  the  device  object
                                //  using  our  new  name.
                                //

                                retryWithNewName  =  FALSE;
                                goto  attemptDeviceObjectCreation;

                        }  else  {

                                //
                                //  Set  the  DeviceName  parameter  to  point  to  our  unicode  string,  just  as
                                //  if  the  caller  had  specified  it  (note,  we  explicitly  ignore  anything
                                //  the  caller  passes  us  for  device  name  if  the  FILE_AUTOGENERATED_DEVICE_NAME
                                //  characteristic  is  specified.
                                //

                                RtlInitUnicodeString(  &autoGeneratedDeviceName,  deviceNameBuffer  );
                                DeviceName  =  &autoGeneratedDeviceName;
                        }
                }
2018-5-4 10:12
0
雪    币: 8865
活跃值: (2379)
能力值: ( LV12,RANK:760 )
在线值:
发帖
回帖
粉丝
3
DriverObject遍历到DeviceObject就行了,DriverObject都有名字...哎
2018-5-4 12:05
0
雪    币: 12
活跃值: (132)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
4
cvcvxk DriverObject遍历到DeviceObject就行了,DriverObject都有名字...哎
谢谢V大解答
话说你开源的那份POC,过WIN10PG    能在1803上跑吗?
2018-5-4 18:00
0
雪    币: 8865
活跃值: (2379)
能力值: ( LV12,RANK:760 )
在线值:
发帖
回帖
粉丝
5
青城往事 谢谢V大解答 话说你开源的那份POC,过WIN10PG 能在1803上跑吗?
1803默认不行,要关了虚化才行,不然驱动都在Guest空间里
2018-5-5 11:25
0
雪    币: 12
活跃值: (132)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
6
cvcvxk 1803默认不行,要关了虚化才行,不然驱动都在Guest空间里
谢谢大佬解答
不过我用你那份代码  跑KEY    每次KEY2都是0xcccccccc
奇怪了···
2018-5-5 15:30
0
雪    币: 12848
活跃值: (9108)
能力值: ( LV9,RANK:280 )
在线值:
发帖
回帖
粉丝
7
cvcvxk 1803默认不行,要关了虚化才行,不然驱动都在Guest空间里
其实关键在于pg的物理页没有写权限了,而且自己修改cr0.wp直接#GP炸裂
2018-5-7 11:02
0
游客
登录 | 注册 方可回帖
返回
//