• HOWTO:如果制作卸载时需要确认密码的安装包


    版权声明: 可以任意转载,转载时请务必以超链接形式标明文章原始出处和作者信息。 

    很早之前记得有朋友问到如何让自己的安装包在目标机上卸载时,进行密码确认,避免本机其他用户误卸载程序。

    卸载需要密码确认,那自然是在安装时由用户设置卸载密码,代码如下:

    代码
     1 function OnBegin()  
     2     string szQuestion, szDefault, svResult, svValue;
     3 begin
     4     // TODO: Perform custom initialization steps, check requirements, etc.
     5     
     6     if (!MAINTENANCEthen
     7         // set variable value during first time install
     8         szQuestion = "Please enter your uninstall password";
     9         szDefault = "Default";
    10         AskText ( szQuestion , szDefault , svResult );    
    11   
    12         //set the variable using the TextSub object
    13         TextSub.Value("MyVar"= svResult;  
    14     else
    15         // retrieve value during maintenance setup 
    17         svValue = TextSub("MyVar");
    18         
    19         szQuestion = "Please enter your uninstall password";
    20         szDefault = "";
    21         AskText ( szQuestion , szDefault , svResult );   
    22         
    23         if ( StrCompare(svResult,svValue) != 0 ) then 
    24             MessageBox("Uninstall password is invalid, please contact with your adminstrator."SEVERE);
    25             abort;        
    26         endif;
    27     endif;  
    28 end;

    还有一种情况,就是安装时不提示设置密码,将密码直接通过硬编码的方式设置到安装包中,这种主要是避免用户随意卸载,当然卸载口令掌握在该软件的Vendor手中。

    将上述代码稍作修改就可以做到,记得没错的话,这种安装包在杀毒软件Norton的安装包中见过,不过好像是企业重新打包添加进去的。

  • 相关阅读:
    Premiere Pro 2020 教程(二)
    程序员的10个好习惯(转自四猿外)
    HtmlAgilityPack 抓取页面的乱码处理
    【Python爬虫】 学习笔记 ajax下爬取豆瓣请求第一页
    【Python爬虫】 学习笔记 get请求的方法
    【Python爬虫】 学习笔记 post请求的方法
    【Python爬虫】 学习笔记 post请求的方法(Cookie反爬)
    jQuery选择器实例手册
    弹出模态窗口并传递数值
    java synchronized详解
  • 原文地址:https://www.cnblogs.com/wanbinghong/p/1827129.html
Copyright © 2020-2023  润新知