Windows CE下流驱动的动态加载
来源:互联网 发布:mac创建win7安装u盘 编辑:程序博客网 时间:2024/06/05 12:36
HANDLE ActivateDevice (
LPCWSTR lpszDevKey,
DWORD dwClientInfo
);
Parameters
lpszDevKey
[in] Pointer to the registry path string of thedevice's driver key under HKEY_LOCAL_MACHINE. Adriver key contains the DLL name, the device prefix, friendly name,and other device information.
dwClientInfo
[in] Data that will be stored in the device'sActive key in the ClientInfovalue. The registry path to the driver's Activekey is passed in as the context parameter to the device'sXXX_Init function. The value in dwClientInfo isstored in the registry before XXX_Init iscalled.
Return Values
On success, ActivateDevice returns a handle to thedevice that can be used in subsequent calls to DeactivateDevice.
Remarks
This function is superseded by ActivateDeviceEx.
ActivateDevice loads a device driver. ActivateDevicereads the registry key specified in lpszDevKey to get the DLL name,device prefix, index, and other values. Next it adds the device tothe active device list in the registry branchHKEY_LOCAL_MACHINE\Drivers\Active, and stores therelevant values there. If no device index was specified in the keynamed in lpszDevKey, then it assigns a free index. Then itloads the device driver DLL in the process space of the DeviceManager. Then it broadcasts a WM_DEVICECHANGE message for the newdevice and triggers a NOTIFICATION_EVENT_DEVICE_CHANGE event in theapplication notification system to notify applications of thepresence of the new device.
从上面的描述中可以看到,在使用该函数时,我们只要给出第一个参数就可以,而这个参数是注册表中的一个路径字符串。所以,要想很方便的动态加载任意一个驱动,我们还要了解一下有关注册表的内容。但其中最核心的就是一条,把你驱动的相关注册表信息放到HKEY_LOCAL_MACHINE下,主要内容包括Prefix、DLL、Index、Order等信息。这里就不展开说明了。
如果在测试时,发现驱动有问题,那么你可以选择“卸载驱动”,然后将修改好的新的驱动拷贝过来,再点击“激活驱动”菜单。如此往复,直至调试成功。
至此,我们采用了通过导入注册表文件的方法激活驱动。下面再说说在没有注册表文件时直接通过浏览DLL文件本身来加载驱动的方法。先把刚刚加载的驱动卸载了。
运行驱动调试助手软件,点击“驱动调试”菜单——选择“浏览DLL文件”,浏览到我们准备好的DrvDemo.dll文件。在弹出的对话框中设置正确的Prefix、Order、Index信息,点击“确定”。
同样,此时你可以直接通过“驱动调试”下的“激活驱动”直接激活该驱动,或者从“驱动列表”中激活.
其余的操作跟上面讲的完全一样了,不再重复。
好了,我相信到这里,大家应该对动态加载流驱动的原理和方法都了解了,也能从此摆脱不断MakeImg和Download的梦魇,节省很多宝贵的开发时间。
1.
2.
3.
4.
5.
6.
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- Windows CE下流驱动的动态加载
- 四极管 Windows CE下流驱动的动态加载
- windows API 动态加载驱动
- Window CE 6.0流驱动开发动态加载实验
- CTL_CODE 定义说明
- WinCE下开发程序常见问题(非常实…
- 小小的太阳
- 快速应用一款新MCU的方法总结
- wince——配置文件
- Windows CE下流驱动的动态加载
- No enclosing instance of type E is accessible. Must qualify the allocation with an enclosing instanc
- 如何把如何给flash 分两个FAT区域
- YUV 与RGB之间的变换
- 2016.09.03 YLOI 结题报告
- WINCE6.0串口调试信息开关
- WINCE下创建多个文件分区
- Eboot 中给nandflash分区实现
- WinCE6.0中应用程序如何直接访问物…