installshield 判断mdmcpq.inf和usbser.sys 是否 存在

1.产品上位机程序,需要驱动支持,在安装  exe程序的时候,连同NET框架4.0和 .inf驱动文件,一起安装,

   安装驱动的时候,会发现,

   如果系统 C:\Windows\Inf 缺少mdmcpq.inf文件和 C:\Windows\System32 缺少usbser.sys 文件,

   就会出现

安装设备时出现一个错误,这个INF中的服务安装段落无效

  所以在安装的时候,要用脚本判断一下,是否存在这两个文件。

  我建立的是Installshield script项目。 在organization 目录新建features,命名为 DriverPatch

export prototype DriverPatch_Installed();
function DriverPatch_Installed()
string s; 
number r;
begin   
    if(FindFile ("C:\\Windows\\Inf","mdmcpq.inf",s)  <0)
    then   
       r=  CopyFile (TARGETDIR^"\\mdmcpq.inf", "C:\\Windows\\Inf\\mdmcpq.inf");   
    endif;   
    
     if(FindFile ("C:\\Windows\\System32","usbser.sys",s)  <0)
    then   
       r=  CopyFile (TARGETDIR^"\\usbser.sys", "C:\\Windows\\System32\\usbser.sys");   
    endif;   
end;

 

posted @ 2014-02-17 00:35  正定聚  阅读(704)  评论(0编辑  收藏  举报