枚举注册表

1.工程类型:IS2010 installscript

2.目的:枚举注册表中donet版本,如果注册表中存在的版本与要检测的版本一致,就返回true,否则返回false.

3.具体实现:


function BOOL LISTDonetVer(DefineVer)
  STRING   InstallVer,SPVer;
  LIST   listID;
  STRING nzItem, szSubKey,svString; 
  NUMBER nResult,nReturn, nItem,nvType,nvSize;
  LIST   listSubKeys, listNames;

begin
   listSubKeys = ListCreate(STRINGLIST);
      listNames = ListCreate(STRINGLIST);
      RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
      szSubKey = "SOFTWARE\\Microsoft\\NET Framework Setup\\NDP";
      nReturn = RegDBQueryKey ( szSubKey, REGDB_KEYS, listSubKeys );
     if (nReturn >=0) then
       nResult = ListGetFirstString (listSubKeys, svString);
      // Loop while list items continue to be retrieved.
          while (nResult != END_OF_LIST)
          // Get the next string in the list.
             nResult = ListGetNextString (listSubKeys, svString);
               if(svString=DefineVer)then
                 szSubKey=szSubKey+"\\"+svString;
                 RegDBGetKeyValueEx (szSubKey, "Install", nvType, InstallVer, nvSize);
                 RegDBGetKeyValueEx (szSubKey, "SP", nvType, SPVer, nvSize);
                if( StrCompare(InstallVer,"1")=0)&&(StrCompare(SPVer,"1")>=0) then
                      return  TRUE;
              else
                      return  FALSE;
   
               endif;
           endif; 
        endwhile;
 
     endif;
end;

转载于:https://www.cnblogs.com/sabrinahuang/archive/2011/09/21/2184457.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值