• linkedu视频
  • 平面设计
  • 电脑入门
  • 操作系统
  • 办公应用
  • 电脑硬件
  • 动画设计
  • 3D设计
  • 网页设计
  • CAD设计
  • 影音处理
  • 数据库
  • 程序设计
  • 认证考试
  • 信息管理
  • 信息安全
菜单
linkedu.com
  • 网页制作
  • 数据库
  • 程序设计
  • 操作系统
  • CMS教程
  • 游戏攻略
  • 脚本语言
  • 平面设计
  • 软件教程
  • 网络安全
  • 电脑知识
  • 服务器
  • 视频教程
  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号
您的位置:首页 > 程序设计 >嵌入式开发 > DriverProc的问题

DriverProc的问题

作者:佚名 字体:[增加 减小] 来源:互联网 时间:2017-06-05

佚名通过本文主要向大家介绍了严以律己存在的问题,严以修身存在的问题,严以修身方面的问题,不成问题的问题,没问题的英语怎么写等相关知识,希望对您有所帮助,也希望大家支持linkedu.com www.linkedu.com
问题: DriverProc的问题
描述:

用MSDN的例子,写了个最简单的
#include <windows.h>
LONG DriverProc(DWORD dwDriverId, HDRVR hdrvr, UINT msg, 
    LONG lParam1, LONG lParam2)
{
    DWORD dwRes = 0L;
    switch (msg) {
    case DRV_LOAD:
    // Sent when the driver is loaded. This is always   
    // the first message received by a driver. 
dwRes = 1L;  // returns 0L to fail
        break;
    case DRV_FREE:
    // Sent when the driver is about to be discarded.
    // This is the last message a driver receives
    // before it is freed.
        dwRes = 1L;  // return value ignored
        break;
    case DRV_OPEN:
    // Sent when the driver is opened.
        dwRes = 1L;  // returns 0L to fail
        break;       // value subsequently used
                     // for dwDriverId.
    case DRV_CLOSE:
    // Sent when the driver is closed. Drivers are
    // unloaded when the open count reaches zero.
        dwRes = 1L;  // returns 0L to fail
        break;
    case DRV_ENABLE:
    // Sent when the driver is loaded or reloaded and
    // when Windows is enabled. Install interrupt
    // handlers and initialize hardware. Expect the
    // driver to be in memory only between the enable
    // and disable messages.
        dwRes = 1L;  // return value ignored
        break;
    case DRV_DISABLE:
    // Sent before the driver is freed or when Windows
    // is disabled. Remove interrupt handlers and place
    // hardware in an inactive state.
        dwRes = 1L;  // return value ignored
        break;
    case DRV_INSTALL:
    // Sent when the driver is installed.
        dwRes = DRVCNF_OK;  // Can also return 
        break;              // DRVCNF_CANCEL
                            // and DRV_RESTART
    case DRV_REMOVE:
    // Sent when the driver is removed.
        dwRes = 1L;  // return value ignored
        break;
    case DRV_QUERYCONFIGURE:
    // Sent to determine if the driver can be
    // configured.
        dwRes = 0L;  // Zero indicates configuration
        break;       // NOT supported
    case DRV_CONFIGURE:
    // Sent to display the configuration
    // dialog box for the driver.
        dwRes = DRVCNF_OK;  // Can also return
        break;              // DRVCNF_CANCEL
                            // and DRVCNF_RESTART
    default:
    // Process any other messages.
        return DefDriverProc (dwDriverId, hdrvr, 
            msg, lParam1, lParam2);
    }
    return dwRes;
}
#include <windows.h>
int main()
{
HDRVR hdr;
if ((hdr = OpenDriver(L"test", NULL, NULL)) <= 0)
return -1;
CloseDriver(hdr, NULL, NULL);
return 0;
}
用这个main调用的时候怎么出First-chance exception in test.exe (NTDLL.DLL): 0xC0000005: Access Violation.


分享到:QQ空间新浪微博腾讯微博微信百度贴吧QQ好友复制网址打印

您可能想查找下面的文章:

  • DriverStudio31的问题
  • DriverProc的问题

相关文章

  • 2017-06-05 关于MIPS指令集中的J型指令的问题
  • 2017-06-05 本人最近在做驱动(ds),希望能同大家交流心得。
  • 2017-06-05 如何制作安卓Rom
  • 2017-06-05 如何像CDN服务一样提供一个子域名让用户cname解析
  • 2017-06-05 请教关于flash的读写问题!
  • 2017-06-05 关于单片机pwm控制直流有刷电机电路
  • 2017-06-05 现在智能手环很火,如何设计啊
  • 2017-06-05 谁又STM32F103C8T6的PCB封装呀
  • 2017-06-05 wincewinform程序给datagrid添加checkbox
  • 2017-06-05 文章标题人机接口设备(HID)和USB设备问题

文章分类

  • JavaScript
  • ASP.NET
  • PHP
  • 正则表达式
  • AJAX
  • JSP
  • ASP
  • Flex
  • XML
  • 编程技巧
  • Android
  • swift
  • C#教程
  • vb
  • vb.net
  • C语言
  • Java
  • Delphi
  • 易语言
  • vc/mfc
  • 嵌入式开发
  • 游戏开发
  • ios
  • 编程问答
  • 汇编语言
  • 微信小程序
  • 数据结构
  • OpenGL
  • 架构设计
  • qt
  • 微信公众号

最近更新的内容

    • 8051控制數碼管問題
    • PowerPC下位段空间分配方向问题!
    • ARM的JTAG接口
    • 请问使用softice如何进入一个程序的领空?
    • EVC工程无法添加新的CPU
    • stm32f103zet6编译环境mdk517usb部分函数库函数求解释!头文件:rl_usbh
    • wince下clock函数使用
    • 手机连接监控
    • 平时用的安卓手机支持433MHz的无线数据接收么?
    • 有做过SmartCard智能卡非接触式读卡器驱动开发的吗?SmartcardInitialize返回失败,如何破?

关于我们 - 联系我们 - 免责声明 - 网站地图

©2020-2025 All Rights Reserved. linkedu.com 版权所有