datas
驱动牛犊
驱动牛犊
  • 注册日期2007-05-28
  • 最后登录2007-06-28
  • 粉丝0
  • 关注0
  • 积分170分
  • 威望18点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
阅读:2603回复:6

我用is安装驱动,生成了ome*.inf,怎么在卸载的时候把这些oem*.inf也一起删除掉?

楼主#
更多 发布于:2007-06-11 10:12
就是把本安装程序生成的oem*.inf删掉,但是其它的不动,怎么实现呢?
danielxu22
驱动中牛
驱动中牛
  • 注册日期2002-11-22
  • 最后登录2014-03-24
  • 粉丝0
  • 关注1
  • 积分2分
  • 威望18点
  • 贡献值0点
  • 好评度7点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2007-06-11 17:20
InstallScript:

/**********************************************************************
* function    :  FindStrInFile(str)
* description : this function will delete the *.inf  and correspondent
*               *.pnf file of driver in inf directory.
*
***********************************************************************/
function FindStrInFile(str)
    string svMatchingFileName,svSubStr,svLine,svFileName;  
    NUMBER nResult,nvFileHandle;
begin
         // Get the first file that matches the file spec.
    nResult = FindAllFiles (infDir, "oem*.inf", svMatchingFileName, RESET);

    while(nResult = 0)  
    
         // Set the file mode to normal.
        OpenFileMode (FILE_MODE_NORMAL);
        StrSub ( svFileName, svMatchingFileName, StrLength (infDir), StrLength (svMatchingFileName)- StrLength (infDir));
        if (OpenFile ( nvFileHandle, infDir, svFileName ) < 0) then
            MessageBox (" Failed to open file "+infDir^svFileName, SEVERE);
        endif;
        // Get lines from the file into the list.
        while (GetLine (nvFileHandle, svLine) = 0)
           //str is the input string!
           //find the string and cancel the find in files!
            if(StrFind ( svLine, str ) >0)  then
                 //delete the inf file!
                 if (CloseFile ( nvFileHandle ) < 0) then
                     //MessageBox ("CloseFile failed.", SEVERE);
                 endif;
                 //MessageBox (svMatchingFileName+"Will be deleted.", SEVERE);
                 SetFileInfo (svMatchingFileName, FILE_ATTRIBUTE, FILE_ATTR_NORMAL, "");
                 DeleteFile ( svMatchingFileName );
                
                 //delete the pnf file!
                 StrSub ( svSubStr, svMatchingFileName, 0, StrLength (svMatchingFileName)-4 );
                 SetFileInfo (svSubStr+".PNF", FILE_ATTRIBUTE, FILE_ATTR_NORMAL, "");
                 DeleteFile ( svSubStr+".PNF" );
//               goto showmatches;    
            endif ;    
        endwhile;
        
        CloseFile ( nvFileHandle );
        // Find the next matching file name.
        nResult = FindAllFiles(infDir, "oem*.inf", svMatchingFileName, CONTINUE);
    endwhile;

//showmatches:
    // Free all files and folders accessed by FindAllFiles. If your
    // setup does not target the Windows NT platform, this step is
    // not necessary.
    FindAllFiles(infDir, "oem*.inf", svMatchingFileName, CANCEL);

end;
今天我发现我家的金鱼淹死了,:(
datas
驱动牛犊
驱动牛犊
  • 注册日期2007-05-28
  • 最后登录2007-06-28
  • 粉丝0
  • 关注0
  • 积分170分
  • 威望18点
  • 贡献值0点
  • 好评度17点
  • 原创分0分
  • 专家分0分
板凳#
发布于:2007-06-11 21:12
多谢,我去试一下
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
地板#
发布于:2007-09-18 16:28
需要的哦
leal
驱动牛犊
驱动牛犊
  • 注册日期2006-04-19
  • 最后登录2007-10-22
  • 粉丝0
  • 关注0
  • 积分10分
  • 威望2点
  • 贡献值0点
  • 好评度1点
  • 原创分0分
  • 专家分0分
地下室#
发布于:2007-09-19 17:47
注册表 HKEY_LOCAL_MACHINE\SYSTEM\ControlSet002\Control\Class\{4D36E96C-E325-11CE-BFC1-08002BE10318}

下有已安装驱动的相关信息,包括 inf文件的名字和位置

注意上述 ControlSet002   及 {4D36E96C-E325-11CE-BFC1-08002BE10318}
只是示例,请自行在注册表里搜索相关信息。
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
5楼#
发布于:2007-09-20 13:56
danielxu22 大哥,这个代码是Dephi的么?有没有VC的
zhoujiamurong
驱动小牛
驱动小牛
  • 注册日期2006-03-20
  • 最后登录2009-05-06
  • 粉丝4
  • 关注0
  • 积分1081分
  • 威望360点
  • 贡献值0点
  • 好评度215点
  • 原创分0分
  • 专家分0分
6楼#
发布于:2007-09-20 14:39
这个是InstallSheild中的脚本么?
游客

返回顶部