yaochidong
驱动牛犊
驱动牛犊
  • 注册日期2002-07-09
  • 最后登录2002-11-03
  • 粉丝0
  • 关注0
  • 积分0分
  • 威望0点
  • 贡献值0点
  • 好评度0点
  • 原创分0分
  • 专家分0分
阅读:1290回复:3

有关pDriverObject和pRegistryPath的问题

楼主#
更多 发布于:2002-11-01 08:50
我知道系统向DriverEntry传递两个结构指针pDriverObject和pRegistryPath,但系统对这两个指针所指的结构初始化了吗?是怎么初始化的呢,我看到例程中都直接用pRegistryPath给驱动程序自已定义的uncode字符串赋值,系统在调用DriverEntry时是怎么知道RegistryPath的内容的呢,这个RegistryPath应该是和自己要添加的设备有关的呀?



 
zuowei999
驱动牛犊
驱动牛犊
  • 注册日期2002-03-21
  • 最后登录2018-02-05
  • 粉丝0
  • 关注0
  • 积分8分
  • 威望53点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
  • 社区居民
沙发#
发布于:2002-11-01 08:53
你在讨论什么?
guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2002-11-01 09:44
呵呵!系统传给你的这两个参数肯定都是已经初始化的了!你看看DDK的帮助吧!这个函数的原形
NTSTATUS
  DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING  RegistryPath
    );
前面不是已经标明了这两个参数是传进参数嘛!
guardee
驱动巨牛
驱动巨牛
  • 注册日期2002-11-08
  • 最后登录2010-05-29
  • 粉丝2
  • 关注1
  • 积分2分
  • 威望34点
  • 贡献值0点
  • 好评度6点
  • 原创分0分
  • 专家分0分
地板#
发布于:2002-11-01 09:45
还有就是后面的问题都可以在DDK的帮助里面获得回答

DriverEntry
[This is preliminary documentation and subject to change.]

DriverEntry is the first routine called after a driver is loaded, and is responsible for initializing the driver.

NTSTATUS
  DriverEntry(
    IN PDRIVER_OBJECT  DriverObject,
    IN PUNICODE_STRING  RegistryPath
    );
Parameters
DriverObject
Caller-supplied pointer to a DRIVER_OBJECT structure. This is the driver\'s driver object.
RegistryPath
Pointer to a counted Unicode string specifying the path to the driver\'s registry key.
Return Value
If the routine succeeds, it must return STATUS_SUCCESS. Otherwise, it must return one of the error status values defined in ntstatus.h.

Comments
The DriverObject parameter supplies the DriverEntry routine with a pointer to the driver\'s driver object, which is allocated by the I/O Manager. The DriverEntry routine must fill in the driver object with entry points for the driver\'s standard routines.

The DriverObject pointer gives the driver access to DriverObject->HardwareDatabase, which points to a counted Unicode string that specifies a path to the registry\'s \\Registry\\Machine\\Hardware tree.

The registry path string pointed to by RegistryPath is of the form \\Registry\\Machine\\System\\CurrentControlSet\\Services\\DriverName. A driver can use this path to store driver-specific information; see Driver Information in the Registry. The DriverEntry routine should save a copy of the Unicode string, not the pointer, since the I/O Manager frees the RegistryPath buffer after DriverEntry returns.

A driver\'s DriverEntry routine executes in a system thread context at IRQL PASSIVE_LEVEL.

For more information about implementing a DriverEntry routine, see Writing a DriverEntry Routine.

While it is possible to name this routine something other than DriverEntry, doing so is not recommended. The DDK-supplied build tools automatically inform the linker that the driver\'s entry point is called DriverEntry, so giving the routine another name requires you to modify the build tools. For more information about build tools, see Building a Driver.

游客

返回顶部