boyempire
驱动牛犊
驱动牛犊
  • 注册日期2004-03-27
  • 最后登录2004-09-17
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1144回复:1

如何在驱动程序一中打开其他的驱动程序二,并获取其驱动程序二的DriverObject

楼主#
更多 发布于:2004-09-11 08:50
1、如何在驱动程序一中打开其他的驱动程序二,并获取其驱动程序二的DriverObject。
2、向一个驱动程序发出电源关闭的信号。

最新喜欢:

cyliucyliu
piggy
驱动牛犊
驱动牛犊
  • 注册日期2001-08-24
  • 最后登录2012-01-14
  • 粉丝0
  • 关注0
  • 积分4分
  • 威望27点
  • 贡献值0点
  • 好评度16点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2004-09-14 23:15
问题一:如果你知道驱动程序二的文件名就可以获得它的DriverObject。方法如下:

extern POBJECT_TYPE *IoDriverObjectType;

/*---------------------------------------------------------
*
* FUNCTION ObReferenceObjectByName
*
* DESCRIPTION ObReferenceObjectByName() is an undocument kernel
*               API. It is used to get the driver object from
*               the driver name. We have to define the prototype
*               here in order to use this function
*
* INPUTS ObjectName --> Pointer to a counted unicode string
*                              that holds the name of the object
*               Attributes --> We set this para as OBJ_CASE_INSENSITIVE
*               PassedAccessState --> OPTIONAL, we set it as NULL
*               DesiredAccess --> OPTIONAL, we set it as 0
*               ObjectType --> Driver object type
*               AccessMode --> We set this para to KernelMode
*               ParseContext --> A pointer that is passed uninterpreted
*                                to any parse procedure that is called
*                                during the course of performing the name lookup
*               Object --> Address of the variable that receives a
*                          pointer to the object if the object is found
*
* RETURNS STATUS_SUCCESS if successful, else the appropriate
* error code
*
*--------------------------------------------------------*/
extern
NTKERNELAPI
NTSTATUS
ObReferenceObjectByName (
    IN PUNICODE_STRING  ObjectName,
    IN ULONG            Attributes,
    IN PACCESS_STATE    PassedAccessState OPTIONAL,
    IN ACCESS_MASK      DesiredAccess OPTIONAL,
    IN POBJECT_TYPE     ObjectType,
    IN KPROCESSOR_MODE  AccessMode,
    IN OUT PVOID        ParseContext OPTIONAL,
    OUT PVOID           *Object
);

对于问题二,是不是发送相应的IRP_MJ_POWER,PoSetPowerState()就可以了。具体不是很清楚,没做过。查看DDK的文档吧。
游客

返回顶部