b2科目四模拟试题多少题驾考考爆了怎么补救
b2科目四模拟试题多少题 驾考考爆了怎么补救

wdm设备驱动程序开发_windows驱动开发工具_u盘win7缺少驱动程序(4)

电脑杂谈  发布时间:2017-05-17 20:09:07  来源:网络整理

New or updated MSVC detected. Updating DDK environment....

Setting environment for using Microsoft Visual C++ tools.

Starting dirs creation...Completed.

C:\NTDDK>cd\

C:\>cd HelloWorld

C:\HelloWorld>build

BUILD: Object root set to: ==> objfre

BUILD: /i switch ignored

BUILD: Compile and Link for i386

BUILD: Loading c:\NTDDK\build.dat...

BUILD: Computing Include file dependencies:

BUILD: Examining c:\helloworld directory for files to compile.

c:\helloworld - 1 source files (127 lines)

BUILD: Saving c:\NTDDK\build.dat...

BUILD: Compiling c:\helloworld directory

Compiling - helloworld.c for i386

BUILD: Linking c:\helloworld directory

Linking Executable - i386\helloworld.sys for i386

BUILD: Done

1 file compiled

1 executable built

C:\HelloWorld>

现在C:\HelloWorld\i386目录下,就有了HelloWorld.sys。

=======================================================================================

=============

驱动程序的安装如同安装服务一样,唯一不同的是,创建服务时,类型是内核驱动,其他跟操作服务没什

么区别。

安装驱动程序流程:

1,调用OpenSCManager()打开服务控制管理器

2,调用CreateService()创建一个服务,服务类型为内核驱动

3,调用OpenService()取得服务句柄

启动服务

4,调用StartService()启动服务

停止服务

4,调用ControlService()停止服务

删除服务

4,调用DeleteService()删除服务

5,调用CloseServiceHandle()关闭服务句柄

操作驱动程序流程:

1,调用CreateFile()取得设备句柄

2,调用DeviceIoControl()传递I/O控制代码

3,调用CloseHandle()关闭设备句柄

这里有一个完整的驱动安装程序,所以我就不写了,只给出操作驱动程序的代码

完整代码:

#define DEBUGMSG

#include

#include

#include

#define DEVICE_HELLO_INDEX 0x860

#define START_HELLPWORLD

CTL_CODE(FILE_DEVICE_UNKNOWN,DEVICE_HELLO_INDEX,METHOD_BUFFERED,FILE_ANY_ACCESS)

#define STOP_HELLPWORLD


本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/tongxinshuyu/article-47708-4.html

相关阅读
    发表评论  请自觉遵守互联网相关的政策法规,严禁发布、暴力、反动的言论

    • 周孚先
      周孚先

      不然有点小卡

    • 侯金亮
      侯金亮

      台湾问题已经超出了政治范畴

    热点图片
    拼命载入中...