a
This commit is contained in:
@@ -0,0 +1,405 @@
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// IIIIIII SSSSSS
|
||||
// II SS InstallShield (R)
|
||||
// II SSSSSS (c) 1996-2002, InstallShield Software Corporation
|
||||
// II SS All rights reserved.
|
||||
// IIIIIII SSSSSS
|
||||
//
|
||||
//
|
||||
// This template script provides the code necessary to build an entry-point
|
||||
// function to be called in an InstallScript custom action.
|
||||
//
|
||||
//
|
||||
// File Name: Setup.rul
|
||||
//
|
||||
// Description: InstallShield script
|
||||
//
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
#define dpinst64_FILE "dpinst_amd64\\dpinst_amd64.exe"
|
||||
#define dpinst32_FILE "dpinst_x86\\dpinst_x86.exe"
|
||||
#define vcp32_FILE "x86\\dpinst_x86.exe"
|
||||
#define vcp64_FILE "x64\\dpinst_amd64.exe"
|
||||
#define autoDriver32_PATH "C:\\WINDOWS\\system32\\drivers\\"
|
||||
#define autoDriver64_PATH "C:\\WINDOWS\\system64\\drivers\\"
|
||||
#define accessDBEngine "AccessDatabaseEngine.exe"
|
||||
#define PSAPI_FILE "psapi.dll"
|
||||
#define runInstallName "\\Geomative_setup.exe"
|
||||
#define setInstDirverReg "set_driver.bat"
|
||||
#define allExe "*.exe"
|
||||
#define allBat "*.bat"
|
||||
#define allTxt "*.txt"
|
||||
#define allAccdb "*.accdb"
|
||||
#define allInf "*.Inf"
|
||||
// Include Ifx.h for built-in InstallScript function prototypes, for Windows
|
||||
// Installer API function prototypes and constants, and to declare code for
|
||||
// the OnBegin and OnEnd events.
|
||||
#include "ifx.h"
|
||||
|
||||
|
||||
// The keyword export identifies MyFunction() as an entry-point function.
|
||||
// The argument it accepts must be a handle to the Installer database.
|
||||
export prototype MyFunction(HWND);
|
||||
//prototype OnResumeUIBefore();
|
||||
|
||||
// To Do: Declare global variables, define constants, and prototype user-
|
||||
// defined and DLL functions here.
|
||||
|
||||
prototype BOOL SetAutoInstallDirver(NUMBER);
|
||||
|
||||
function OnFirstUIBefore()
|
||||
STRING szStrName, svStrValue;
|
||||
NUMBER nvSize, nvType;
|
||||
begin
|
||||
RegDBSetDefaultRoot ( HKEY_LOCAL_MACHINE );
|
||||
if (RegDBGetKeyValueEx ("第三方程序的注册表项", "Path", nvType, svStrValue, nvSize) < 0) then
|
||||
LaunchAppAndWait("AccessDatabaseEngine.exe" , "/i "+SUPPORTDIR^"第三方程序文件名.msi"+""+" /qn" ,WAIT) ;
|
||||
endif ;
|
||||
end;
|
||||
// To Do: Create a custom action for this entry-point function:
|
||||
// 1. Right-click on "Custom Actions" in the Sequences/Actions view.
|
||||
// 2. Select "Custom Action Wizard" from the context menu.
|
||||
// 3. Proceed through the wizard and give the custom action a unique name.
|
||||
// 4. Select "Run InstallScript code" for the custom action type, and in
|
||||
// the next panel select "MyFunction" (or the new name of the entry-
|
||||
// point function) for the source.
|
||||
// 5. Click Next, accepting the default selections until the wizard
|
||||
// creates the custom action.
|
||||
//
|
||||
// Once you have made a custom action, you must execute it in your setup by
|
||||
// inserting it into a sequence or making it the result of a dialog's
|
||||
// control event.
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Function: MyFunction
|
||||
//
|
||||
// Purpose: This function will be called by the script engine when
|
||||
// Windows(TM) Installer executes your custom action (see the "To
|
||||
// Do," above).
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
STRING strInstallStatus;
|
||||
function MyFunction(hMSI)
|
||||
// To Do: Declare local variables.
|
||||
STRING strDriverPath, strOSVer, strRes, strInfo,strODBCPath;
|
||||
NUMBER nResult,nvSize,nvType;
|
||||
STRING strODBCRegPath, strGeoKey,strGeoJetKey,strODBCDataSourceKey,strODBCInstKey,strRegVal;
|
||||
BOOL bIsNeedWriteGeoKey;
|
||||
STRING strInstDriBasePath,strExtInstDriverPath;
|
||||
|
||||
begin
|
||||
|
||||
strDriverPath = INSTALLDIR + "GD_10\\";
|
||||
strODBCPath = INSTALLDIR + "DBConntEngine\\";
|
||||
MessageBox("Ready to install hardware driver ,please wait for a moment",INFORMATION);
|
||||
bIsNeedWriteGeoKey = FALSE;
|
||||
//this is a test
|
||||
// if (LaunchAppAndWait(strODBCPath^accessDBEngine, "AUTORUN",LAAW_OPTION_WAIT) < 0) then
|
||||
// Sprintf(strInfo, "Unable to launch %s, path = %s", accessDBEngine, strODBCPath);
|
||||
// MessageBox (strInfo, WARNING);
|
||||
// else
|
||||
// MessageBox ("install DB compelete!",INFORMATION);
|
||||
//regedit ODBC in System DSN
|
||||
RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE);
|
||||
strODBCRegPath= "\\SOFTWARE\\Wow6432Node\\ODBC";
|
||||
strGeoKey = "\\ODBC.INI\\AccessDB For Geomative";
|
||||
strGeoJetKey = strGeoKey + "\\Engines\\Jet";
|
||||
strODBCInstKey = "\\ODBCINST.INI\\Microsoft Access Driver (*.mdb, *.accdb)";
|
||||
if(RegDBKeyExist(strODBCRegPath) < 0) then
|
||||
strODBCRegPath = "\\SOFTWARE\\ODBC";
|
||||
if(RegDBKeyExist(strODBCRegPath)<0) then
|
||||
MessageBox ("regidit info error!",INFORMATION);
|
||||
else
|
||||
//write strGeoKey if there was not strGeoKey
|
||||
if(RegDBKeyExist(strODBCRegPath^strGeoKey)<0) then
|
||||
// MessageBox("need to wirte GeoDB key in 32 bit!", INFORMATION);
|
||||
bIsNeedWriteGeoKey = TRUE;
|
||||
// else
|
||||
// MessageBox("don't need to wirte GeoDB key in 32 bit!", INFORMATION);
|
||||
endif;
|
||||
endif;
|
||||
else
|
||||
if(RegDBKeyExist(strODBCRegPath^strGeoKey)<0)then
|
||||
//MessageBox("need to wirte GeoDB key in 64 bit!", INFORMATION);
|
||||
bIsNeedWriteGeoKey = TRUE;
|
||||
//else
|
||||
// MessageBox("don't need to wirte GeoDB key in 64 bit!", INFORMATION);
|
||||
endif;
|
||||
endif;
|
||||
//endif;
|
||||
|
||||
//wirte geomative odbc
|
||||
if(TRUE == bIsNeedWriteGeoKey) then
|
||||
nvType=REGDB_STRING;
|
||||
strRegVal = "";
|
||||
strODBCDataSourceKey = strODBCRegPath + "\\ODBC.INI\\ODBC Data Sources";
|
||||
if(0 == RegDBGetKeyValueEx(strODBCRegPath^strODBCInstKey, "Driver",nvType,strRegVal,nvSize)) then
|
||||
//write geo key
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoKey,"Driver",REGDB_STRING,strRegVal,-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoKey,"DriverId",REGDB_NUMBER,"25",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoKey,"FIL",REGDB_STRING,"MS Access;",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoKey,"SafeTransactions",REGDB_NUMBER,"0",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoKey,"UID",REGDB_STRING,"",-1);
|
||||
//set jetkey val
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoJetKey,"ImplicitCommitSync",REGDB_STRING,"",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoJetKey,"MaxBufferSize",REGDB_NUMBER,"2048",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoJetKey,"PageTimeout",REGDB_NUMBER,"5",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoJetKey,"Threads",REGDB_NUMBER,"3",-1);
|
||||
RegDBSetKeyValueEx(strODBCRegPath^strGeoJetKey,"UserCommitSync",REGDB_STRING,"Yes",-1);
|
||||
//wirte ODBC Data Sources
|
||||
RegDBSetKeyValueEx(strODBCDataSourceKey,"AccessDB For Geomative",REGDB_STRING,"Microsoft Access Driver (*.mdb, *.accdb)",-1);
|
||||
else
|
||||
MessageBox("can't get ODBC install information", INFORMATION);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
//SetObjectPermissions(INSTALLDIR, IS_PERMISSIONS_TYPE_FOLDER, "", "Everyone", DELETE|GENERIC_ALL|FILE_ALL_ACCESS,0);
|
||||
|
||||
// SetAutoInstallDirver(0);
|
||||
|
||||
// if(AskYesNo("Do you want to exec set_driver reg?",YES) = YES) then
|
||||
// if(LaunchAppAndWait(strDriverPath^setInstDirverReg, "", LAAW_OPTION_WAIT | LAAW_OPTION_HIDDEN) < 0) then
|
||||
//if (LaunchApp(, "") < 0) then
|
||||
// Sprintf(strInfo, "Unable to launch %s", strDriverPath^setInstDirverReg);
|
||||
// MessageBox (strInfo, WARNING);
|
||||
// else
|
||||
// MessageBox ("start set_driver success", WARNING);
|
||||
// endif;
|
||||
// endif;
|
||||
|
||||
// endif;
|
||||
|
||||
if(SYSINFO.bIsWow64) then
|
||||
strOSVer = "this is 64 bit platform";
|
||||
//MessageBox (strOSVer, INFORMATION);
|
||||
nResult = XCopyFile (strDriverPath ^ "*.*", autoDriver64_PATH ^ "*.*",INCLUDE_SUBDIR);
|
||||
if ( nResult < 0) then
|
||||
strInfo = FormatMessage(nResult);
|
||||
MessageBox (strInfo, WARNING);
|
||||
endif;
|
||||
|
||||
if(FindFile(strDriverPath,vcp64_FILE,strRes) < 0) then
|
||||
Sprintf (strInfo, "Find %s failed,path = %s", vcp64_FILE,strDriverPath);
|
||||
MessageBox (strInfo, WARNING);
|
||||
|
||||
else
|
||||
if (LaunchApp(strDriverPath^vcp64_FILE, "") < 0) then
|
||||
//if (LaunchAppAndWait(strDriverPath^vcp64_FILE, "",LAAW_OPTION_HIDDEN) < 0) then
|
||||
Sprintf(strInfo, "Unable to launch %s, path = %s. Are you running installation file as Adimistrator?", vcp64_FILE, strDriverPath);
|
||||
MessageBox (strInfo, WARNING);
|
||||
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
|
||||
else
|
||||
strOSVer = "this is 32 bit platform";
|
||||
// MessageBox (strOSVer, INFORMATION);
|
||||
//copy file to auto_driver
|
||||
nResult = XCopyFile (strDriverPath ^ "*.*", autoDriver32_PATH ^ "*.*",INCLUDE_SUBDIR);
|
||||
if ( nResult < 0) then
|
||||
strInfo = FormatMessage(nResult);
|
||||
MessageBox (strInfo, WARNING);
|
||||
endif;
|
||||
|
||||
if(FindFile(strDriverPath,vcp32_FILE,strRes) < 0) then
|
||||
Sprintf (strInfo, "Find %s failed,path = %s", vcp32_FILE, strDriverPath);
|
||||
MessageBox (strInfo, WARNING);
|
||||
else
|
||||
if (LaunchApp(strDriverPath^vcp32_FILE, "") < 0) then
|
||||
// if (LaunchAppAndWait(strDriverPath^vcp32_FILE, "",LAAW_OPTION_HIDDEN) < 0) then
|
||||
Sprintf(strInfo, "Unable to launch %s, path = %s", vcp32_FILE, strDriverPath);
|
||||
MessageBox (strInfo, WARNING);
|
||||
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
endif;
|
||||
|
||||
// SetObjectPermissions(INSTALLDIR, IS_PERMISSIONS_TYPE_FOLDER, "", "Everyone",
|
||||
//DELETE|GENERIC_ALL|FILE_ALL_ACCESS,0);
|
||||
|
||||
// To Do: Write script that will be executed when MyFunction is called.
|
||||
|
||||
end;
|
||||
|
||||
export prototype SetupCheck(HWND);
|
||||
function SetupCheck(hMSI)
|
||||
// To Do: Declare local variables.
|
||||
STRING strNoteInfo1,strNoteInfo2;
|
||||
begin
|
||||
//dasdasdasdad
|
||||
strNoteInfo1 = "NOTE:\n1.For WIN7,WIN8,WIN10 system,please ensure right-click \"Geomative_setup.exe\",then click \"Run as administrator\" to install;\n if not,please cancel and install again.\n";
|
||||
strNoteInfo2 = "2.During installation,please ensure the destination path has full read-write access.\n\nDo you want to continue running setup?";
|
||||
|
||||
// MessageBox(strNoteInfo1+strNoteInfo2,INFORMATION);
|
||||
//abort;
|
||||
// To Do: Write script that will be executed when MyFunction is called.
|
||||
if(AskYesNo(strNoteInfo1+strNoteInfo2,YES) = NO) then
|
||||
// InstallFinalize();
|
||||
abort;
|
||||
endif;
|
||||
|
||||
end;
|
||||
//test
|
||||
export prototype StartSetupAfterUpgrade(HWND);
|
||||
function StartSetupAfterUpgrade(hMSI)
|
||||
STRING SETUPEXEDIR[MAX_PATH + 1]; //获取安装程序Setup.exe自身所在的路径
|
||||
//STRING strCurDir;
|
||||
STRING strShow;
|
||||
//STRING szProductName,szBmpPath;
|
||||
NUMBER nBuffer; // local buffer-size variable
|
||||
begin
|
||||
if(""=UNINSTALL_STRING) then
|
||||
MessageBox("not stalled status",INFORMATION);
|
||||
|
||||
else
|
||||
MessageBox("stalled status",INFORMATION);
|
||||
nBuffer = MAX_PATH + 1; // initialize size buffer before calling siGetProperty
|
||||
MsiGetProperty(ISMSI_HANDLE, "SETUPEXEDIR", SETUPEXEDIR, nBuffer);
|
||||
//Sprintf(strShow, "installdir0 = %s", SETUPEXEDIR);
|
||||
//MessageBox(strShow,WARNING);
|
||||
|
||||
if (LaunchApp(SETUPEXEDIR^runInstallName, "") < 0) then
|
||||
Sprintf(strShow, "installdir1 = %s", SETUPEXEDIR);
|
||||
MessageBox(strShow,WARNING);
|
||||
MessageBox ("load setup.exe failed!", WARNING);
|
||||
endif;
|
||||
endif;
|
||||
|
||||
|
||||
end;
|
||||
|
||||
function BOOL SetAutoInstallDirver(nvSetVal)
|
||||
|
||||
STRING strInstDriBasePath;
|
||||
STRING strExtInstDriverPath;
|
||||
STRING strAutoInstKey;
|
||||
STRING strShow;
|
||||
STRING strResVal;
|
||||
|
||||
begin
|
||||
if(RegDBSetDefaultRoot(HKEY_LOCAL_MACHINE) < 0) then
|
||||
MessageBox("set local_machine failed!",WARNING);
|
||||
endif;
|
||||
|
||||
strInstDriBasePath = "\\SOFTWARE";
|
||||
strExtInstDriverPath = "\\Microsoft\\Windows\\CurrentVersion";
|
||||
if(RegDBKeyExist(strInstDriBasePath^strExtInstDriverPath) < 0) then
|
||||
Sprintf(strShow, "path1 = %s", strInstDriBasePath^strExtInstDriverPath);
|
||||
MessageBox(strShow,WARNING);
|
||||
strExtInstDriverPath = "\\Policies\\Microsoft\\Windows\\DriverSearching";
|
||||
//如果都查找不到,则返回错误
|
||||
if(RegDBKeyExist(strInstDriBasePath^strExtInstDriverPath) < 0) then
|
||||
MessageBox("can't found installDriver Information!",WARNING);
|
||||
return FALSE;
|
||||
//如果查找到该项,则认为是XP,2003的需要验证
|
||||
//由于在XP里的项用的是DontSearchWindowsUpdate,所以最后得到的值也要取反
|
||||
else
|
||||
strAutoInstKey = "DontSearchWindowsUpdate";
|
||||
Sprintf(strResVal,"%d",!nvSetVal);
|
||||
Sprintf(strShow, "found installdirver in xp,org = %d, res = %s", nvSetVal,strResVal);
|
||||
MessageBox(strShow,WARNING);
|
||||
endif;
|
||||
//如果可以找到,则认为是WIN7,8,10
|
||||
else
|
||||
strExtInstDriverPath = strExtInstDriverPath + "\\DriverSearching";
|
||||
strAutoInstKey = "SearchOrderConfig";
|
||||
Sprintf(strResVal,"%d",nvSetVal);
|
||||
endif;
|
||||
|
||||
if(RegDBSetKeyValueEx(strInstDriBasePath^"\\"^strExtInstDriverPath,strAutoInstKey,REGDB_NUMBER,strResVal,-1)<0)then
|
||||
Sprintf(strShow,"set dirvieconfig failed, path = %s, value = %s",strInstDriBasePath^"\\"^strExtInstDriverPath, strResVal);
|
||||
MessageBox(strShow,WARNING);
|
||||
return FALSE;
|
||||
endif;
|
||||
|
||||
return TRUE;
|
||||
end;
|
||||
|
||||
|
||||
export prototype test(HWND);
|
||||
function test(hMSI)
|
||||
STRING strTest1,strBase,strInfo;
|
||||
|
||||
begin
|
||||
strBase = "C:\\Geomative\\Geomative_setup\\";
|
||||
strTest1 = "Geomative\\*.*";
|
||||
strInfo = strBase+strTest1;
|
||||
MessageBox(strBase^strTest1,INFORMATION);
|
||||
MessageBox(strInfo,INFORMATION);
|
||||
strTest1="*.*";
|
||||
Sprintf(strInfo,"%s %s",strBase,strTest1);
|
||||
MessageBox(strInfo,INFORMATION);
|
||||
Sprintf(strInfo,"%s%s",strBase,strTest1);
|
||||
MessageBox(strInfo,INFORMATION);
|
||||
end;
|
||||
|
||||
|
||||
|
||||
//this is a test dsadada
|
||||
export prototype UnInstallPreVersion(HWND);
|
||||
function UnInstallPreVersion(hMSI)
|
||||
|
||||
//STRING strDstFile,strShow,strDelFile;
|
||||
INT installlDirID;
|
||||
STRING folder,strInstDir;
|
||||
begin
|
||||
|
||||
//MessageBox("unstall dir = 133333...",INFORMATION);
|
||||
strInstDir = INSTALLDIR;
|
||||
/*
|
||||
strDstFile = strInstDir+"Geomative\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDstFile);
|
||||
|
||||
strDstFile = strInstDir + "Geomative\\LOG\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDelFile);
|
||||
|
||||
strDstFile = strInstDir + "Geomative\\DB\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDelFile);
|
||||
|
||||
strDstFile = strInstDir + "Geomative\\firmware\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDelFile);
|
||||
|
||||
|
||||
strDstFile = strInstDir + "GD_10\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDelFile);
|
||||
|
||||
|
||||
strDstFile = strInstDir + "DBConntEngine\\*.*";
|
||||
MessageBox(strDstFile,INFORMATION);
|
||||
DeleteFile(strDelFile);
|
||||
//test
|
||||
*/
|
||||
//find the first file form folder
|
||||
installlDirID = ListCreate(STRINGLIST);
|
||||
FindAllDirs(strInstDir,INCLUDE_SUBDIR,installlDirID);
|
||||
ListGetFirstString(installlDirID,folder);
|
||||
SetFileInfo(folder, FILE_ATTRIBUTE, FILE_ATTR_NORMAL,"");
|
||||
while(ListGetNextString(installlDirID,folder) = 0)
|
||||
SetFileInfo(folder, FILE_ATTRIBUTE, FILE_ATTR_NORMAL,"");
|
||||
endwhile;
|
||||
|
||||
DeleteDir(strInstDir^"Geomative Studio",ALLCONTENTS);
|
||||
DeleteDir(strInstDir^"GD_10",ALLCONTENTS);
|
||||
DeleteDir(strInstDir^"DBConntEngine",ALLCONTENTS);
|
||||
|
||||
//MessageBox("unstall preversion complete",INFORMATION);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
end;
|
||||
|
||||
Reference in New Issue
Block a user