
#include "ifx.h"
export prototype LoadReportTool(HWND);
export prototype InstallFW(HWND);
export prototype Update_WebConfig(HWND);
//Launch the report publishing tool
function LoadReportTool(hMSI)
begin
LaunchApp(TARGETDIR^"Report Tool\\RSExplorer.exe","");
end;
//check the dot net framework
function InstallFW(hMSI)
NUMBER nvType,nvSize;
STRING svvalue,szKey,szName,checkText,preText;
begin
szKey="SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5";
szName="Version";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx(szKey,szName,nvType,svvalue,nvSize);
if(svvalue != "3.5.30729.01") then
//MessageBox("Dot Net FW has been installed!",INFORMATION);
//else
//MessageBox("Dot Net FW is not installed!",INFORMATION);
//LaunchApp(TARGETDIR^"FW\\dotnetfx35setup.exe","");
//if (LaunchAppAndWait(TARGETDIR^"FW\\dotnetfx35setup.exe", "", WAIT) < 0) then
// MessageBox ("Unable to launch .",SEVERE);
// endif;
preText = "IIS ";
endif;
if (preText = "") then
checkText = "竒杆IIS ㎝.Net Framework 3.5";
else
checkText = "﹟ゼ杆"^preText;
endif;
MsiSetProperty(hMSI,"CheckSetting", checkText);
end;
//Encrypt the SQL login user's Password and update other info
function Update_WebConfig(hMSI)
OBJECT oNode;
OBJECT oDom;
number nvBuff, nTemp ;
string strFSName;
OBJECT nodeServer,nodeDatabase,nodeUserName,nodePassword;
string strServer,strDatabase,strUserName,strPassword;
STRING netDllPath;
OBJECT objNetDll;
begin
try
nvBuff = 256;
set oDom = CreateObject( "MSXML.DOMDocument" );
strFSName = INSTALLDIR^"web.config";
oDom.Load(strFSName);
MsiGetProperty(hMSI,"IS_SQLSERVER_SERVER",strServer,nvBuff);
set nodeServer = oDom.selectSingleNode("/configuration/appSettings/add[@key='DatabaseServerAddress']");
nodeServer.Attributes.getNamedItem("value").nodeValue = strServer;
MsiGetProperty(hMSI,"IS_SQLSERVER_DATABASE",strDatabase,nvBuff);
set nodeDatabase = oDom.selectSingleNode("/configuration/appSettings/add[@key='Database']");
nodeDatabase.Attributes.getNamedItem("value").nodeValue = strDatabase;
MsiGetProperty(hMSI,"IS_SQLSERVER_USERNAME",strUserName,nvBuff);
set nodePassword = oDom.selectSingleNode("/configuration/appSettings/add[@key='MSQLUserID']");
nodePassword.Attributes.getNamedItem("value").nodeValue = strUserName;
MsiGetProperty(hMSI,"IS_SQLSERVER_PASSWORD",strPassword,nvBuff);
//use .net dll to encrypt the password
netDllPath = TARGETDIR^"Net DLL\\ENPWD.dll";
set objNetDll = CoCreateObjectDotNet(netDllPath,"NetMethod.EnDecryptPWD");
strPassword = objNetDll.EngEncrypt(strPassword);
set nodeUserName = oDom.selectSingleNode("/configuration/appSettings/add[@key='MSQLUserPW']");
nodeUserName.Attributes.getNamedItem("value").nodeValue = strPassword;
oDom.save(strFSName);
catch
nTemp = Err.Number;
/* Handle the exception based on its cause. */
endcatch;
set nodeServer = NOTHING;
set nodeDatabase = NOTHING;
set nodeUserName = NOTHING;
set nodePassword = NOTHING;
set oDom = NOTHING;
end;
export prototype LoadReportTool(HWND);
export prototype InstallFW(HWND);
export prototype Update_WebConfig(HWND);
//Launch the report publishing tool
function LoadReportTool(hMSI)
begin
LaunchApp(TARGETDIR^"Report Tool\\RSExplorer.exe","");
end;
//check the dot net framework
function InstallFW(hMSI)
NUMBER nvType,nvSize;
STRING svvalue,szKey,szName,checkText,preText;
begin
szKey="SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v3.5";
szName="Version";
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
RegDBGetKeyValueEx(szKey,szName,nvType,svvalue,nvSize);
if(svvalue != "3.5.30729.01") then
//MessageBox("Dot Net FW has been installed!",INFORMATION);
//else
//MessageBox("Dot Net FW is not installed!",INFORMATION);
//LaunchApp(TARGETDIR^"FW\\dotnetfx35setup.exe","");
//if (LaunchAppAndWait(TARGETDIR^"FW\\dotnetfx35setup.exe", "", WAIT) < 0) then
// MessageBox ("Unable to launch .",SEVERE);
// endif;
preText = "IIS ";
endif;
if (preText = "") then
checkText = "竒杆IIS ㎝.Net Framework 3.5";
else
checkText = "﹟ゼ杆"^preText;
endif;
MsiSetProperty(hMSI,"CheckSetting", checkText);
end;
//Encrypt the SQL login user's Password and update other info
function Update_WebConfig(hMSI)
OBJECT oNode;
OBJECT oDom;
number nvBuff, nTemp ;
string strFSName;
OBJECT nodeServer,nodeDatabase,nodeUserName,nodePassword;
string strServer,strDatabase,strUserName,strPassword;
STRING netDllPath;
OBJECT objNetDll;
begin
try
nvBuff = 256;
set oDom = CreateObject( "MSXML.DOMDocument" );
strFSName = INSTALLDIR^"web.config";
oDom.Load(strFSName);
MsiGetProperty(hMSI,"IS_SQLSERVER_SERVER",strServer,nvBuff);
set nodeServer = oDom.selectSingleNode("/configuration/appSettings/add[@key='DatabaseServerAddress']");
nodeServer.Attributes.getNamedItem("value").nodeValue = strServer;
MsiGetProperty(hMSI,"IS_SQLSERVER_DATABASE",strDatabase,nvBuff);
set nodeDatabase = oDom.selectSingleNode("/configuration/appSettings/add[@key='Database']");
nodeDatabase.Attributes.getNamedItem("value").nodeValue = strDatabase;
MsiGetProperty(hMSI,"IS_SQLSERVER_USERNAME",strUserName,nvBuff);
set nodePassword = oDom.selectSingleNode("/configuration/appSettings/add[@key='MSQLUserID']");
nodePassword.Attributes.getNamedItem("value").nodeValue = strUserName;
MsiGetProperty(hMSI,"IS_SQLSERVER_PASSWORD",strPassword,nvBuff);
//use .net dll to encrypt the password
netDllPath = TARGETDIR^"Net DLL\\ENPWD.dll";
set objNetDll = CoCreateObjectDotNet(netDllPath,"NetMethod.EnDecryptPWD");
strPassword = objNetDll.EngEncrypt(strPassword);
set nodeUserName = oDom.selectSingleNode("/configuration/appSettings/add[@key='MSQLUserPW']");
nodeUserName.Attributes.getNamedItem("value").nodeValue = strPassword;
oDom.save(strFSName);
catch
nTemp = Err.Number;
/* Handle the exception based on its cause. */
endcatch;
set nodeServer = NOTHING;
set nodeDatabase = NOTHING;
set nodeUserName = NOTHING;
set nodePassword = NOTHING;
set oDom = NOTHING;
end;