init函数 [英] init function

查看:143
本文介绍了init函数的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是设备驱动程序概念的初学者。我看过init函数如下:



 DWORD XXX_Init(
LPCTSTR pContext,
DWORD dwBusContext
);

解决方案

通常使用注册表项启动驱动程序。 当驱动程序启动时,会在HKLM \Drivers\Active中创建一个新密钥。


pContext指向活动密钥。 然后,您可以使用
OpenDeviceKey()打开启动驱动程序的注册表项。 这很方便,因为它允许您在不修改注册表路径的情况下读取驱动程序中的注册表信息。 想象一下,使用不同参数加载多次的驱动程序,
这是非常必要的。


参见
http://geekswithblogs.net/BruceEitman/archive/2008/08/07/windows-ce -stream接口驱动器-xxx_init.aspx


Im begineer in device driver concepts.I have seen init function as follows:

DWORD XXX_Init(
 LPCTSTR pContext,
 DWORD dwBusContext
);

解决方案

Drivers are typically started using a registry key.  When the driver starts, a new key is created in HKLM\Drivers\Active.

The pContext points to the active key.  You can then use OpenDeviceKey() to open the registry key that started the driver.  This is handy because it allows you to read registry information in your driver without hardcoding a registry path.  Imagine a driver that loads multiple times with different paramenters, this would be very necessary.

See http://geekswithblogs.net/BruceEitman/archive/2008/08/07/windows-ce-stream-interface-driver-xxx_init.aspx


这篇关于init函数的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆