设置 MofImagePath 注册表值

可以通过在单独的文件(如 DLL)中包含已编译的 MOF 资源并将注册表中的 MofImagePath 设置为该文件的路径来发布驱动程序的架构。 以这种方式发布的架构无需重新编译驱动程序即可更新。

若要在单独的文件中发布驱动程序的架构,请执行以下操作:

  1. 编译 MOF 文件,如 编译驱动程序的 MOF 文件中所述。

  2. 将编译的 MOF 文件作为资源包含在文件(如 DLL)中。

  3. 在驱动程序的服务项下添加 MofImagePath 注册表值。 例如,下面显示了名为 DriverName 的驱动程序的注册表值:

    HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services
        \DriverName
            MofImagePath    "\SystemRoot\System32\Drivers\DriverNameMof.dll"
    

可以在驱动程序的 INF 文件中设置此密钥,如下所示:

; This is the Services section for the driver
[Driver_service_install_section]
AddReg=Driver_AddReg

; This is the Services AddReg section declared above.
[Driver_AddReg]
HKR,,MofImagePath,,DriverMof.dll 

有关详细信息,请参阅 INF DDInstall.Services 节INF AddReg 指令