会员: 密码:  免费注册 | 忘记密码 | 会员登录 网页功能: 加入收藏 设为首页 网站搜索  
 安全技术技术文档
  · 安全配制
  · 工具介绍
  · 黑客教学
  · 防火墙
  · 漏洞分析
  · 破解专题
  · 黑客编程
  · 入侵检测
 安全技术论坛
  · 安全配制
  · 工具介绍
  · 防火墙
  · 黑客入侵
  · 漏洞检测
  · 破解方法
  · 杀毒专区
 安全技术工具下载
  · 扫描工具
  · 攻击程序
  · 后门木马
  · 拒绝服务
  · 口令破解
  · 代理程序
  · 防火墙
  · 加密解密
  · 入侵检测
  · 攻防演示
技术文档 > 其他文档
InstallShield应用中SetupRegistry()完整脚本
发表日期:2003-07-29 00:00:00作者: 出处:  

最近多数网友询问怎样在注册表中注册Access ODBC 及DBASE ODBC,下面版主将自己的InstallShield应用中一段SetupRegistry()完整脚本上载供大家参考,不足之处请高手指正!

下面是SetupRegistry()

///////////////////////////////////////////////////////////////////////////////

// //

// Function: SetupRegistry //

// //

// Purpose: This function makes the registry entries for this setup. //

// //

///////////////////////////////////////////////////////////////////////////////

function SetupRegistry()

STRING svDBprofile,svDB,szDriver,szSetup,svDBFile;

STRING svAccess,svDBASE,svSourceDB;

STRING svMStranslator,svMStransdriver;

STRING szXbdagl;

STRING szCommand, szCmdLine,svMsg;

begin

svMsg="正在更新注册表......";

SdShowMsg(svMsg,TRUE);

szXbdagl="SOFTWARE\\"+@COMPANY_NAME+"\\"+@PRODUCT_NAME+"\\"+@PRODUCT_VERSION;

//MessageBox(szXbdagl,INFORMATION);

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

//注册ODBC有关内容

if (ComponentIsItemSelected(MEDIA,"ODBC Driver") ) then

svMStranslator="MS Code Page Translator";

svMStransdriver=WINSYSDIR+"mscpxl32.dll";

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Core" , "" , REGDB_STRING , "" , -1 );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svMStranslator , "Setup" , REGDB_STRING , svMStransdriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svMStranslator , "Translator" , REGDB_STRING , svMStransdriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Translators" , svMStranslator , REGDB_STRING , "Installed" , -1 );//不用改

endif;

//注册Access数据库

if (ComponentIsItemSelected(MEDIA,"MS Access ODBC Driver") ) then

svDBprofile="MS Access Database for gzgl";

svDB="SOFTWARE\\ODBC\\ODBC.INI\\"+svDBprofile;

svDBFile = TARGETDIR+"\\dbms\\gzgl.mdb";//

szDriver = WINSYSDIR+"odbcjt32.dll";

svAccess="Microsoft Access Driver (*.mdb)";

RegDBSetDefaultRoot ( HKEY_CURRENT_USER );

RegDBSetKeyValueEx ( svDB , "DBQ" , REGDB_STRING , svDBFile , -1 );

RegDBSetKeyValueEx ( svDB , "Driver" , REGDB_STRING , szDriver , -1 );

RegDBSetKeyValueEx ( svDB , "FIL" , REGDB_STRING , "MS Access;" , -1 );

//RegDBSetKeyValueEx ( svDB , "DriverId" , REGDB_STRING , "25" , -1 );

RegDBSetKeyValueEx ( svDB , "DriverId" , REGDB_NUMBER , "25" , -1 );

RegDBSetKeyValueEx ( svDB , "SafeTransactions" , REGDB_STRING , "0" , -1 );

RegDBSetKeyValueEx ( svDB , "UID" , REGDB_STRING , "Admin" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Jet" , "ImplicitCommitSync" , REGDB_STRING , "" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Jet", "UserCommitSync" , REGDB_STRING , "Yes" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Jet", "MaxBufferSize" , REGDB_NUMBER , "512" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Jet" , "PageTimeout" , REGDB_NUMBER , "5" , -1);

RegDBSetKeyValueEx ( svDB +"\\Engines\\Jet", "Threads" , REGDB_NUMBER , "3" , -1 );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources",svDBprofile, REGDB_STRING , svAccess, -1 );

//注册Access ODBC Driver

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "APILevel" , REGDB_STRING , "1" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "ConnectFunctions" , REGDB_STRING , "YYN" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "Driver" , REGDB_STRING , szDriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "DriverODBCVer" , REGDB_STRING , "02.50" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "DSN" , REGDB_STRING , svDBprofile , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "FileExtns" , REGDB_STRING , "*.mdb" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "FileUsage" , REGDB_STRING , "2" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "Setup" , REGDB_STRING , szDriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "SQLLevel" , REGDB_STRING , "0" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "UID" , REGDB_STRING , "Admin" , -1 );//不用改

//RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "UsageCount" , REGDB_NUMBER , 4 , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers" , svAccess , REGDB_STRING , "Installed" , -1 );//不用改

endif;

//注册Hhctrl.OCX控件

if (ComponentIsItemSelected(MEDIA,"CHM帮助支持文件") ) then

szCommand = WINSYSDIR+APPLICATION_REG;

szCmdLine = WINSYSDIR+CMD_LINE_OCX;

if (LaunchApp(szCommand, szCmdLine) < 0) then

MessageBox("注册Hhctrl.ocx失败!", SEVERE);

endif;

endif;

//注册DBASE数据库

if (ComponentIsItemSelected(MEDIA,"DBASE ODBC Driver") ) then

svDBprofile="dBASE Files for gzgl";

svDB="SOFTWARE\\ODBC\\ODBC.INI\\"+svDBprofile;

svSourceDB = "c:\\gzgl";//原库的路径

szDriver = WINSYSDIR+"odbcjt32.dll";

szSetup=WINSYSDIR+"ODDBSE32.DLL";

svDBASE="Microsoft dBase Driver (*.dbf)";

RegDBSetDefaultRoot ( HKEY_CURRENT_USER );

RegDBSetKeyValueEx ( svDB , "DefaultDir" , REGDB_STRING , svSourceDB, -1 );

RegDBSetKeyValueEx ( svDB , "Driver" , REGDB_STRING , szDriver , -1 );

RegDBSetKeyValueEx ( svDB , "DriverId" , REGDB_NUMBER , "277" , -1 );

RegDBSetKeyValueEx ( svDB , "FIL" , REGDB_STRING , "dBase III", -1 );

RegDBSetKeyValueEx ( svDB , "SafeTransactions" , REGDB_NUMBER , "0", -1 );

RegDBSetKeyValueEx ( svDB , "UID" , REGDB_STRING , "" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase" , "CollatingSequence" , REGDB_STRING , "ASCII" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase" , "Deleted" , REGDB_BINARY , "00" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase" , "ImplicitCommitSync" , REGDB_STRING , "" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase" , "PageTimeout" , REGDB_NUMBER , "5" , -1);

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase" , "Statistics" , REGDB_BINARY , "00" , -1);

RegDBSetKeyValueEx ( svDB +"\\Engines\\Xbase", "Threads" , REGDB_NUMBER , "3" , -1 );

RegDBSetKeyValueEx ( svDB +"\\Engines\\XBase", "UserCommitSync" , REGDB_STRING , "Yes" , -1 );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBC.INI\\ODBC Data Sources",svDBprofile, REGDB_STRING , svDBASE, -1 );

//注册DBASE ODBC Driver

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "APILevel" , REGDB_STRING , "1" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "ConnectFunctions" , REGDB_STRING , "YYN" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "Driver" , REGDB_STRING , szDriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "DriverId" , REGDB_STRING , "533" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "DriverODBCVer" , REGDB_STRING , "02.50" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "DSN" , REGDB_STRING , svDBprofile , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "FileExtns" , REGDB_STRING , "*.dbf,*.ndx,*.mdx" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "FileUsage" , REGDB_STRING , "1" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "Setup" , REGDB_STRING , szSetup , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svDBASE , "SQLLevel" , REGDB_STRING , "0" , -1 );//不用改

//RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "UsageCount" , REGDB_NUMBER , 4 , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers" , svDBASE , REGDB_STRING , "Installed" , -1 );//不用改

endif;

SdShowMsg(svMsg,FALSE);

return 0;

end;

回页首

Installshield中注册SQL Anywhere 7.0 ODBC的完整脚本

function SetupRegistry()

STRING svDBprofile,svDB,szDriver,szDriver1,szSetup,svDBFile;

STRING svAccess,svAsa70;

STRING svMStranslator,svMStransdriver;

STRING szXbdagl,svStart,svAsa70app;

STRING szCommand, szCmdLine,svMsg;

begin

svMsg="正在更新注册表......";

SdShowMsg(svMsg,TRUE);

szXbdagl="SOFTWARE\\"+@COMPANY_NAME+"\\"+@PRODUCT_NAME+"\\"+@PRODUCT_VERSION;

//MessageBox(szXbdagl,INFORMATION);

RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);

//注册ASA70数据库

if (ComponentIsItemSelected(MEDIA,"asa70") ) then

svAsa70app="SOFTWARE\\Sybase\\Adaptive Server Anywhere\\7.0";

svDBprofile="kykq";

svDB="SOFTWARE\\ODBC\\ODBC.INI\\"+svDBprofile;

svDBFile = TARGETDIR+"\\database\\kykq.db";//kykq.db的全名

szDriver = TARGETDIR+"\\asa70\\dbodbc7.dll";

szDriver1=TARGETDIR+"\\asa70\\dbodtr7.dll";

svAccess="Adaptive Server Anywhere 7.0";

svAsa70="Adaptive Server Anywhere 7.0 Translator";

svStart= TARGETDIR+"\\asa70\\dbeng7.exe -c 8m";

RegDBSetDefaultRoot ( HKEY_CURRENT_USER );

RegDBSetKeyValueEx ( svDB , "AutoStop" , REGDB_STRING , "YES" , -1 );

RegDBSetKeyValueEx ( svDB , "DatabaseFile" , REGDB_STRING , svDBFile , -1 );

RegDBSetKeyValueEx ( svDB , "Debug" , REGDB_STRING , "NO" , -1 );

RegDBSetKeyValueEx ( svDB , "DisableMultiRowFetch" , REGDB_STRING , "NO" , -1 );

RegDBSetKeyValueEx ( svDB , "Driver" , REGDB_STRING , szDriver , -1 );

RegDBSetKeyValueEx ( svDB , "Integrated" , REGDB_STRING , "NO" , -1 );

RegDBSetKeyValueEx ( svDB , "PWD" , REGDB_STRING , "sql" , -1 );

RegDBSetKeyValueEx ( svDB , "UID" , REGDB_STRING , "dba" , -1 );

RegDBSetKeyValueEx ( svDB , "Start" , REGDB_STRING , svStart, -1 );

//注册ASA70 ODBC Driver

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "Driver" , REGDB_STRING , szDriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAccess , "Setup" , REGDB_STRING , szDriver , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAsa70 , "Driver" , REGDB_STRING , szDriver1 , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAsa70 , "Setup" , REGDB_STRING , szDriver1 , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\"+svAsa70 , "Translator" , REGDB_STRING , szDriver1 , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers" , svAccess , REGDB_STRING , "Installed" , -1 );//不用改

RegDBSetKeyValueEx ( "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Translators" , svAsa70 , REGDB_STRING , "Installed" , -1 );//不用改

//注册ASA7的应用,主要是设成中文版本

RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );

RegDBSetKeyValueEx ( svAsa70app , "Language" , REGDB_STRING , "ZH" , -1 );

RegDBSetKeyValueEx ( svAsa70app , "Location" , REGDB_STRING , TARGETDIR+"\\asa70" ,-1 );

RegDBSetKeyValueEx ( svAsa70app , "Shared Location" , REGDB_STRING ,TARGETDIR+"\\asa70" , -1 );

endif;

SdShowMsg(svMsg,FALSE);

return 0;

end;

返回顶部】 【打印本页】 【关闭窗口

关于我们 / 给我留言 / 版权举报 / 意见建议 / 网站编程QQ群   
Copyright ©2003- 2024 Lihuasoft.net webmaster(at)lihuasoft.net 加载时间 0.00175