ehxz 发表于 2008-3-8 18:11:38

[转帖]用SETUP FACTORY打包PB程序

<p><font face="Verdana">这是我第一次在自己的BLOG上发文,经过多次试验,终于用SETUP FACTORY成功的为PB程序打包。</font></p>
<p><font face="Verdana">SETUP FACTORY是一个非常简单的打包工具,本次打包的难点在于注册数据源(对于我来说!)</font></p>
<p><font face="Verdana">1、在脱离PB的环境下所需要的支持文件:</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana">PB8的供参考:</font></p>
<p><font face="Verdana">序 文件名 日期 大小(KB) 作用<br/>1 PBVM80.dll 01-05-25 4,405 PowerBuilder虚拟机,必须的<br/>2 LIBJCC.dll 01-05-25 230 必须的???<br/>3 PBDWE80.dll 01-05-29 2,092 数据窗口和报表<br/>4 PBRTC80.DLL 01-05-25 873 丰富文本<br/>5 PBAEN70.tlb 01-05-25 4 OLE自动服务器<br/>6 PBODB80.dll 01-05-25 476 Powersoft ODBC接口<br/>7 PBODB80.ini 01-05-25 67 Powersoft ODBC接口<br/>8 DBENG7.exe 00-06-24 41 Adaptive Server Anywhere DataBase访问<br/>9 DBODBC7.dll 00-06-24 500 <br/>10 PBMSS80.dll 01-05-25 258 MS SQL Server 6.5 后台数据库访问<br/>11 NTWDBLIB.dll 96-12-17 270 <br/>12 NTWDBLIB.dll 00-08-17 272 MS Server 2k(打sp3后一定要用新版003-04-07)<br/>13 DBNETLIB.dll 00-08-06 84 MS Server 2k 打sp3后用到)<br/>14 DBBACKUP.exe 00-06-24 91 Adaptive Server Anywhere DataBase备份<br/>15 DBLIB7.DLL 00-06-24 375</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana">其中可能有多余的。这些文件在PB的安装目录下的Shared\PowerBuilder文件夹和SQL Anywhere 9\win32文件夹下均可找到。</font></p>
<p><font face="Verdana"></font>&nbsp;</p>
<p><font face="Verdana">2、在安装目录下建立文件config.ini,文件内容为:<br/><br/>dsn=test&nbsp;&nbsp; //根据具体的数据改变数值<br/>uid=dba<br/>pwd=sql<br/>在APPLICATION中输入:<br/>//从Config.ini文件中读取ODBC数据源信息<br/>string lsDSN,lsUID,lsPWD<br/>lsDSN = ProfileString("Config.ini","database","dsn","none")<br/>lsUID = ProfileString("Config.ini","database","uid","none")<br/>lsPWD = ProfileString("Config.ini","database","pwd","none")<br/>// SQLCA配置<br/>SQLCA.DBMS = "ODBC"<br/>SQLCA.AutoCommit = False<br/>SQLCA.DBParm = "Connectstring='DSN="+lsDSN+";UID="+lsUID+";PWD="+lsPWD+"'"<br/>3、在SF的“操作”-“关机时”代码栏中输入:(要读懂这些代码的大致意思,以便根据具体情况修改)<br/>-- 从注册表中导入的值:<br/>local AppDir = SessionVar.Get("%AppFolder%");<br/>if&nbsp;&nbsp;&nbsp; (not Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0")) then<br/>Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0")<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Driver", AppDir.."\\dbodbc8.dll", REG_SZ)<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Setup", AppDir.."\\dbodbc8.dll", REG_SZ);<br/>Registry.CreateKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers")<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers", "Adaptive Server Anywhere 9.0", "Installed", REG_SZ);<br/>end<br/>local dsnName = "test";<br/>--判段ODBC数据源是否存在,如果存在则改名,自动在原名字上加"1"<br/>while Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName) do<br/>&nbsp;&nbsp;&nbsp;&nbsp; dsnName = dsnName.."1"<br/>end<br/>--修改注册表,注册ODBC数据源<br/>Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName)<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Driver", AppDir.."\\dbodbc9.dll", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "UID", "dba", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "PWD", "sql", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Description", "", REG_SZ); <br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "DatabaseFile", AppDir.."\\test.db", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "AutoStop", "Yes", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Integrated", "No", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Debug", "No", "REG_MULTI_SZ");<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "DisableMultiRowFetch", "No", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName, "Compress", "No", REG_SZ);<br/>Registry.SetValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\ODBC Data Sources", dsnName, "Adaptive Server Anywhere 9.0", REG_SZ);<br/>--修改ini文件<br/>INIFile.SetValue(SessionVar.Expand(AppDir.."\\Config.ini"), "database", "DSN", dsnName);</font></p>
<p><font face="Verdana">-- 在所有其他"关机时"操作之后在结束时调用该函数。<br/>-- 如果需要的话,这将导致系统重新启动。<br/>-- 定义 _SUF70_Global_Functions.lua<br/>-- 不要编辑该脚本,除非您知道您所做的<br/>g_HandleSystemReboot();<br/>4、在SF的“卸载”-“卸载前”的代码栏中输入:(要读懂这些代码的大致意思,以便根据具体情况修改)<br/>--系统文件夹<br/>local AppDir = SessionVar.Get("%AppFolder%");<br/>local productName = SessionVar.Get("%ProductName%");</font></p>
<p><font face="Verdana">--确定是否删除ASA注册<br/>if Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Driver",false) == AppDir.."\\dbodbc9.dll" <br/>&nbsp;&nbsp;&nbsp;&nbsp; and <br/>&nbsp;&nbsp;&nbsp;&nbsp; Registry.GetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0", "Setup",false) == AppDir.."\\dbodbc9.dll"&nbsp; <br/>&nbsp;&nbsp;&nbsp;&nbsp; then<br/>&nbsp;&nbsp;&nbsp;&nbsp; Registry.DeleteKey(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 9.0");<br/>&nbsp;&nbsp;&nbsp;&nbsp; Registry.DeleteValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers", "Adaptive Server Anywhere 9.0");<br/>end<br/>--删除ODBC数据源<br/>local dsnName = INIFile.GetValue(AppDir.."\\Config.ini", "database", "dsn");<br/>if Registry.DoesKeyExist(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName) and dsnName ~= "" then<br/>Registry.DeleteKey(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\"..dsnName);<br/>Registry.DeleteValue(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBC.INI\\ODBC Data Sources", dsnName);<br/>end</font></p>

ribut922 发表于 2008-3-17 09:10:12

好贴
页: [1]
查看完整版本: [转帖]用SETUP FACTORY打包PB程序

免责声明:
本站所发布的一切破解补丁、注册机和注册信息及软件的解密分析文章仅限用于学习和研究目的;不得将上述内容用于商业或者非法用途,否则,一切后果请用户自负。本站信息来自网络,版权争议与本站无关。您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容。如果您喜欢该程序,请支持正版软件,购买注册,得到更好的正版服务。如有侵权请邮件与我们联系处理。

Mail To:Admin@SybaseBbs.com