Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1466338
  • 博文数量: 596
  • 博客积分: 0
  • 博客等级: 民兵
  • 技术积分: 173
  • 用 户 组: 普通用户
  • 注册时间: 2016-07-06 15:50
个人简介

在线笔记

文章分类

全部博文(596)

文章存档

2016年(1)

2015年(104)

2014年(228)

2013年(226)

2012年(26)

2011年(11)

分类: 虚拟化

2015-04-08 16:33:25


  1. //
  2. // @1. 返回支持的DDI版本号
  3. // @2. 返回回调函数接口
  4. //
  5. /* Display Driver entry point,
  6.  * Returns DDI version number and callbacks supported by driver.
  7.  */
  8. BOOL DrvEnableDriver(ULONG iEngineVersion, ULONG cj, PDRVENABLEDATA pded)
  9. {
  10.     /*@todo: can't link with hal.lib
  11.     int irc = RTR0Init(0);
  12.     if (RT_FAILURE(irc))
  13.     {
  14.         LOGREL(("failed to init IPRT (rc=%#x)", irc));
  15.         return FALSE;
  16.     }
  17.     */

  18.     LOGF(("iEngineVersion=%#08X, cj=%d", iEngineVersion, cj));

  19.     g_EngineVersionDDI = iEngineVersion;

  20.     /* Driver can't work if we can't fill atleast first 3 fields in passed PDRVENABLEDATA */
  21.     if (cj < (2*sizeof(ULONG)+sizeof(DRVFN*)))
  22.     {
  23.         WARN(("cj<%d, terminating\n", sizeof(DRVENABLEDATA)));
  24.         return FALSE;
  25.     }

  26.     /* Report driver DDI version and appropriate callbacks table based on engine DDI */
  27.     if (iEngineVersion>=DDI_DRIVER_VERSION_NT5)
  28.     {
  29. // @1. 返回支持的DDI版本号
  30.         /* WIN2K and above */
  31.         pded->iDriverVersion = DDI_DRIVER_VERSION_NT5;
  32. // @2. 返回回调函数接口
  33.         pded->pdrvfn = g_aDrvFnTableNT5;
  34.         pded->c = RT_ELEMENTS(g_aDrvFnTableNT5);
  35.     }
  36.     else
  37.     {
  38.         /* NT4_SP3 and below*/
  39.         pded->iDriverVersion = DDI_DRIVER_VERSION_NT4;
  40.         pded->pdrvfn = g_aDrvFnTableNT4;
  41.         pded->c = RT_ELEMENTS(g_aDrvFnTableNT4);
  42.     }

  43.     LOGF_LEAVE();
  44.     return TRUE;
  45. }


阅读(1524) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~