阅读:1144回复:1
如何在驱动程序一中打开其他的驱动程序二,并获取其驱动程序二的DriverObject
1、如何在驱动程序一中打开其他的驱动程序二,并获取其驱动程序二的DriverObject。
2、向一个驱动程序发出电源关闭的信号。 |
|
最新喜欢:cyliu |
沙发#
发布于: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的文档吧。 |
|