Подготовка Setup ПКМ8 для InnoSetup
Раздел Установка дополнительных компонентов
Где-то среди функций, которые в секции [Code] есть функция CurStepChanged, если нет, то надо определить её оригинальное содержимое из дистрибутива следующее:
- procedure CurStepChanged(CurStep: TSetupStep);
- var
- addSetupProgressPage: TOutputProgressWizardPage;
- begin
- addSetupProgressPage := CreateOutputProgressPage('Подождите...', 'Установка дополнительных компонентов');
-
- case CurStep of
- ssInstall:
- begin
- NBGetCurState();
- end;
- ssPostInstall:
- begin
- addSetupProgressPage.SetText('Установка дополнительного ПО','');
- addSetupProgressPage.SetProgress(0,9);
- addSetupProgressPage.Show();
- addSetupProgressPage.SetText('Установка распространяемого компонента Microsoft Visual C++','');
- addSetupProgressPage.SetProgress(1,9);
- VCRedistSetup();
-
- addSetupProgressPage.SetText('Установка Microsoft Access Database Engine','');
- addSetupProgressPage.SetProgress(2,9);
- AccessDataBaseEngineSetup();
-
- addSetupProgressPage.SetText('Установка .NET Framework 4.6.1','');
- addSetupProgressPage.SetProgress(3,9);
- NetSetup();
-
- addSetupProgressPage.SetText('Установка Microsoft SQL Server 2012 Express LocalDB','');
- addSetupProgressPage.SetProgress(4,9);
- SQLLocalDBSetup();
-
- addSetupProgressPage.SetText('Регистрация компонентов','');
- addSetupProgressPage.SetProgress(5,9);
- //NBUpdateTxt();
-
- addSetupProgressPage.SetText('Настройка путей','');
- addSetupProgressPage.SetProgress(6,9);
- NBSetupInf();
- addSetupProgressPage.SetText('Инициализация настроек','');
- addSetupProgressPage.SetProgress(7,9);
- MebelIni();
- K32Ini()
- K3TalkIni();
- K3RefEditorMetapathsIni();
- addSetupProgressPage.SetText('Установка драйвера CodeMeter','');
- addSetupProgressPage.SetProgress(8,9);
- NBTasks();
- addSetupProgressPage.SetText('Готово','');
- addSetupProgressPage.SetProgress(9,9);
- addSetupProgressPage.Hide();
- //зарегистрируем тут, чтобы в случае неудачи ничего не накрылось
- try
- NBRegisterDLL();
- except
- begin
- MsgBox('K3ViewAX is not registered!', mbConfirmation, MB_OK);
- end
- end;
- end;
- end;
- end;
Секция ssPostInstall
Содержимое секции ssInstall старое, а вот в секции ssPostInstall выполняются как раз пункты установки всякого стороннего ПО
сначала ставятся microsoft'овские библиотеки с++, для этого где-то повыше надо определить функцию
- function VCRedistSetup() : Boolean;
- var
- ErrorCode: Integer;
- ErrorMsg: String;
- begin
- if not ShellExec('', ExpandConstant('{app}\Kit\VCRedist\VC_redist.x86.exe'),
- '/install /quiet /norestart', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
- begin
- ErrorMsg := Format('Не установлен распространяемый компонент Microsoft Visual C++ для Visual Studio 2015, 2017 и 2019. Ошибка %d', [ErrorCode]);
- MsgBox(ErrorMsg, mbError, MB_OK);
- end;
- end;
Затем ставится access database engine с помощью функции
- function AccessDataBaseEngineSetup() : Boolean;
- var
- ErrorCode: Integer;
- ErrorMsg: String;
- begin
- if not ShellExec('', ExpandConstant('{app}\Kit\Acсess DataBase Engine\accessdatabaseengine.exe'),
- '/q', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then
- begin
- ErrorMsg := Format('Проблемы при установке accessdatabaseengine.exe. Ошибка %d', [ErrorCode]);
- MsgBox(ErrorMsg, mbError, MB_OK);
- end;
- end;
net
следующий по списку .net
- function IsDotNetDetected(version: string; service: cardinal): boolean;
- var
- key, versionKey: string;
- install, release, serviceCount, versionRelease: cardinal;
- success: boolean;
- begin
- versionKey := version;
- versionRelease := 0;
- if version = 'v1.1' then begin
- versionKey := 'v1.1.4322';
- end else if version = 'v2.0' then begin
- versionKey := 'v2.0.50727';
- end
-
- else if Pos('v4.', version) = 1 then begin
- versionKey := 'v4\Full';
- case version of
- 'v4.6.1': versionRelease := 394254;
- end;
- end;
- key := 'SOFTWARE\Microsoft\NET Framework Setup\NDP\' + versionKey;
- if Pos('v4', version) = 1 then begin
- success := success and RegQueryDWordValue(HKLM, key, 'Servicing', serviceCount);
- end else begin
- success := success and RegQueryDWordValue(HKLM, key, 'SP', serviceCount);
- end;
- if versionRelease > 0 then begin
- success := success and RegQueryDWordValue(HKLM, key, 'Release', release);
- success := success and (release >= versionRelease);
- end;
-
- result := success and (install = 1) and (serviceCount >= service);
- end;
- function NetSetup() : Boolean;
- var
- value: String;
- ErrorCode: Integer;
- ErrorMsg: String;
- section: String;
- ini: String;
- bNetSetupRes: Boolean;
- bdotNET_Framework_4_6: Boolean;
- begin
- bdotNET_Framework_4_6 := IsDotNetDetected('v4.6.1', 0);
- ini := ExpandConstant('{app}\Bin\SetupInf.ini');
- section := 'Log';
- if (not bdotNET_Framework_4_6) then begin
- bNetSetupRes := ShellExec('', ExpandConstant('{app}\Kit\dotNet\NDP461-KB3102436-x86-x64-AllOS-ENU.exe'), '/quiet', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
- if(not bNetSetupRes) then begin
- value := Format('Установка .NET Framework 4.6.1 (%d)', [0]);
- SetIniString(section, 'dotNETInstall', value, ini);
- ErrorMsg := Format('Не удалось установить .NET Framework 4.6.1 Ошибка %d', [ErrorCode]);
- MsgBox(ErrorMsg, mbError, MB_OK);
- end
- else begin
- value := Format('Успешная установка .NET Framework 4.6.1 (%d)', [1]);
- SetIniString(section, 'dotNETInstall', value, ini);
- end;
- end;
- end;
sqllocaldb
следующий на очереди sqllocaldb, там только одна "хитрость", после установки надо ещё на всякий стартануть дефолтный экземпляр
- function SQLLocalDBSetup() : Boolean;
- var
- FileName : String;
- value : String;
- bRes : Boolean;
- ErrorCode: Integer;
- begin
- //*** удалить файл блокировки
- Filename := ExpandConstant(szMasterAppData + '\Base\NGuidesSQLNew_log.ldf');
- if FileExists(Filename) then
- DeleteFile(Filename);
- //*** установить SQL
- if IsWin64 then
- value := ExpandConstant('{app}\Kit\SQLLocalDB\x64\SqlLocaLDB.msi')
- else
- value := ExpandConstant('{app}\Kit\SQLLocalDB\x86\SqlLocaLDB.msi');
- msg := Format('SqlLocaLDB: Exist = %d%s(%s)', [FileExists(value), newline, value]);
- if not ShellExec('', value, '/qn IACCEPTSQLLOCALDBLICENSETERMS=YES', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode) then begin
- msg := Format('Не удалось установить SQLLocalDB Ошибка %d', [ErrorCode]);
- MsgBox(msg, mbInformation, MB_OK);
- end;
- bRes := ShellExec('', 'SqlLocalDb', 'start v11.0', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
- bRes := ShellExec('', 'SqlLocalDb', 'share v11.0 v11.0', '', SW_HIDE, ewWaitUntilTerminated, ErrorCode);
- msg := Format('SqlLocalDb: bRes = %d, err = %d,%s(%s)', [bRes, ErrorCode, newline, value]);
- end;
Дальше идёт "загадочный" пункт настройка путей, ра хотели сами разбраться, что надо, а что нет, то даю в оригинале, сами решайте, что с этой портянкой вам делать, с большой долей вероятности здесь нет каких-то отличий с 7.4, даже сама функция, наверное, называется также, поэтому гадайте, какой содержимое оставить AppPostSetup, который в конце запускается определён для мебели так #define AppPostSetup "MPostSetup"
- function NBSetupInf(): Boolean;
- var
- Section, Filename, szMenuName1, szMenuName2, msg, szCutting, szCuttingPath, s1, s2: String;
- ResultCode: Integer;
- begin
- Filename := ExpandConstant('{app}\Bin\SetupInf.ini');
- szMasterAppData := GetAppData(''); //ExpandConstant(AddBackslash('{commonappdata}') + '{#MasterAppDataTail}');
- szSlaveAppData := GetAppData(''); //ExpandConstant(AddBackslash('{commonappdata}') + '{#SlaveAppDataTail}');
- szMenuName2:=''
- if (GetAppPower()=0) then begin //ПКМ
- szMenuName1 := 'MebelMenuFullPKM.xml';
- end;
- if (GetAppPower()=1) then begin // Салон
- szMenuName1 := 'MebelMenuFullSalon.xml';
- end;
- if (GetAppPower()=3) then begin // Амби
- szMenuName1 := 'MebelMenuFullAmbi.xml';
- end;
- if (GetAppPower()=4) then begin // Фасад
- szMenuName1 := 'MebelMenuFullFasade.xml';
- end;
- #ifdef TRIAL
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting Trial\8.0',
- 'App', szCutting) then
- begin
- szCutting:='';
- end;
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting Trial\8.0',
- 'AppData', szCuttingPath) then
- begin
- szCuttingPath:='';
- end;
- #endif
- #ifdef VPN
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting VPN\8.0',
- 'App', szCutting) then
- begin
- szCutting:='';
- end;
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting VPN\8.0',
- 'AppData', szCuttingPath) then
- begin
- szCuttingPath:='';
- end;
- #endif
- #ifdef WORK
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting\8.0',
- 'App', szCutting) then
- begin
- szCutting:='';
- end;
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting\8.0',
- 'AppData', szCuttingPath) then
- begin
- szCuttingPath:='';
- end;
- #endif
- #ifdef DEMO
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting Demo\8.0',
- 'App', szCutting) then
- begin
- szCutting:='';
- end;
- if Not RegQueryStringValue(HKLM, 'SOFTWARE\Wow6432Node\GeoS\K3-Mebel Cutting Demo\8.0',
- 'AppData', szCuttingPath) then
- begin
- szCuttingPath:='';
- end;
- #endif
- #ifdef VPN
- Section := 'VPN';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, 'Name', 'GeoS_VPN', Filename);
- SetIniString(Section, 'VpnIp', '{#CmGeoSVPNServer}', Filename);
- #endif
- Section := 'Setup';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, 'Version', '3', Filename);
- SetIniString(Section, 'Silent', '0', Filename);
- SetIniString(Section, 'Language', '25', Filename);
- SetIniString(Section, 'MasterAppDataFolder', AddBackslash(szMasterAppData), Filename);
- SetIniString(Section, 'CommonAppDataPrefix', AddBackslash(szMasterAppData), Filename);
- SetIniString(Section, 'CommonAppDataSuffix', '{#MasterAppDataTail}', Filename);
- SetIniString(Section, 'ProjectPath', AddBackslash(szProjectPath), Filename);
- SetIniString(Section, 'RootPath', AddBackslash(ExpandConstant('{app}')), Filename);
- SetIniString(Section, 'SQLInstance', szSQLInstance, Filename);
- SetIniBool(Section, ExpandConstant('{#AppBase}'), bExistAppMain, Filename);
- SetIniBool(Section, ExpandConstant('{#SlaveAppBase}'), bExistSlaveAppMain, Filename);
- SetIniBool(Section, 'DemoKit', bDemoKit, Filename);
- SetIniInt(Section, 'Salon', GetAppPower(), Filename);
- SetIniInt(Section, 'Network', 0, Filename);
- msg := '{#ThisGuid}';
- Delete(msg, 1, 1);
- SetIniString(Section, 'GUID', msg, Filename);
- SetIniString(Section, 'GUID2', szGuid2, Filename);
- // Section [Rendering]
- Section := 'Rendering';
- DeleteIniSection(Section, Filename);
- SetIniInt(Section, 'Overwrite', 1, Filename);
- SetIniInt(Section, 'TotalML',10, Filename);
- SetIniString(Section, 'ML1', 'pkm7_1.ml', Filename);
- SetIniString(Section, 'ML2', 'room3.ml', Filename);
- SetIniString(Section, 'ML3', 'Fasads.ml', Filename);
- SetIniString(Section, 'ML4', 'm_mebel7_1.ml', Filename);
- SetIniString(Section, 'ML5', 'BumpLib.ml', Filename);
- SetIniString(Section, 'ML6', 'CS.ml', Filename);
- SetIniString(Section, 'ML7', 'pkm6_3.ml', Filename);
- SetIniString(Section, 'ML8', 'RAL_Classic_K7.ml', Filename);
- SetIniString(Section, 'ML9', 'room1.ml', Filename);
- SetIniString(Section, 'ML10', 'room2.ml', Filename);
-
- // Section [exRDT]
- Section := 'exRDT';
- DeleteIniSection(Section, Filename);
- SetIniInt(Section, 'Overwrite', 1, Filename);
- SetIniInt(Section, 'Who', 0, Filename);
- SetIniInt(Section, 'TotalLines', 20, Filename);
- SetIniString(Section, 'Line1', 'pkm7_1.ml', Filename);
- SetIniString(Section, 'Line2', szCutting, Filename);
- SetIniString(Section, 'Line3', AddBackslash(szCuttingPath), Filename);
- #if APPLICATION_POWER == PKM_INS || APPLICATION_POWER == FASADE_INS || APPLICATION_POWER == PKM_BETA_INS
- #ifndef DEMO
- SetIniString(Section, 'Line4', '%ROOTPATH%\Bin\k3cncw.exe', Filename);
- SetIniString(Section, 'Line5', '%MASTERAPPDATAFOLDER%\Data\PKM\PROTO\CNC\', Filename);
- #else
- SetIniString(Section, 'Line4', '', Filename);
- SetIniString(Section, 'Line5', '', Filename);
- #endif
- #else
- SetIniString(Section, 'Line4', '', Filename);
- SetIniString(Section, 'Line5', '', Filename);
- #endif
- SetIniString(Section, 'Line6', '<Proto>=%MASTERAPPDATAFOLDER%\Data\PKM\Proto', Filename);
- #if APPLICATION_POWER != FASADE_INS
- SetIniString(Section, 'Line7', '<Models>=%MASTERAPPDATAFOLDER%\Data\PKM\Models', Filename);
- #else
- SetIniString(Section, 'Line7', '<Models>=', Filename);
- #endif
- SetIniString(Section, 'Line8', '<Projects>=%PROJECTPATH%', Filename);
- SetIniString(Section, 'Line9', '<App>=%ROOTPATH%\Bin', Filename);
- SetIniString(Section, 'Line10', '<Reports>=%MASTERAPPDATAFOLDER%\Bin\Reports', Filename);
- SetIniString(Section, 'Line11', '<Textures>=%MASTERAPPDATAFOLDER%\Bin\MatLib', Filename);
- SetIniString(Section, 'Line12', '<K3Files>=%MASTERAPPDATAFOLDER%\Data\PKM\K3Files', Filename);
- #if APPLICATION_POWER == FASADE_INS
- SetIniString(Section, 'Line13', '<Pictures>=', Filename);
- #else
- SetIniString(Section, 'Line13', '<Pictures>=%MASTERAPPDATAFOLDER%\Data\PKM\Pictures', Filename);
- #endif
- SetIniString(Section, 'Line14', '<CommonAppData>=%MASTERAPPDATAFOLDER%\BIN', Filename);
- SetIniString(Section, 'Line15', '<OrderRemoveToArchive>=%PROJECTPATH%\OrderRemoveToArchive', Filename);
- SetIniString(Section, 'Line16', '<ExportImport>=%PROJECTPATH%\ExportImport', Filename);
- #if APPLICATION_POWER == FASADE_INS
- SetIniString(Section, 'Line17', '<Tests>=', Filename);
- #else
- SetIniString(Section, 'Line17', '<Tests>=%MASTERAPPDATAFOLDER%\Data\PKM\Tests', Filename);
- #endif
- SetIniString(Section, 'Line18', '%MASTERAPPDATAFOLDER%\Data\PKM\NGuides.mdb', Filename);
- SetIniString(Section, 'Line19', '0', Filename);
- SetIniString(Section, 'Line20', '<PyEnv>=%MASTERAPPDATAFOLDER%\Data\PKM\PyEnv', Filename);
- SetIniInt(Section, 'Id1', 10, Filename);
- SetIniInt(Section, 'Id2', 12, Filename);
- SetIniInt(Section, 'Id3', 13, Filename);
- SetIniInt(Section, 'Id4', 2, Filename);
- SetIniInt(Section, 'Id5', 3, Filename);
- SetIniInt(Section, 'Id6', 300, Filename);
- SetIniInt(Section, 'Id7', 301, Filename);
- SetIniInt(Section, 'Id8', 302, Filename);
- SetIniInt(Section, 'Id9', 303, Filename);
- SetIniInt(Section, 'Id10', 304, Filename);
- SetIniInt(Section, 'Id11', 305, Filename);
- SetIniInt(Section, 'Id12', 306, Filename);
- SetIniInt(Section, 'Id13', 307, Filename);
- SetIniInt(Section, 'Id14', 308, Filename);
- SetIniInt(Section, 'Id15', 309, Filename);
- SetIniInt(Section, 'Id16', 310, Filename);
- SetIniInt(Section, 'Id17', 320, Filename);
- SetIniInt(Section, 'Id18', 4, Filename);
- SetIniInt(Section, 'Id19', 1, Filename);
- SetIniInt(Section, 'Id20', 321, Filename);
- // Section [WDefs]
- #if 0
- Section := 'WDefs';
- DeleteIniSection(Section, Filename);
- SetIniInt(Section, 'Overwrite', 1, Filename);
- SetIniInt(Section, 'Line0', 10, Filename);
- SetIniInt(Section, 'Line1', 11, Filename);
- SetIniInt(Section, 'Line2', 0, Filename);
- SetIniInt(Section, 'Line3', 0, Filename);
- SetIniInt(Section, 'Line4', 0, Filename);
- #endif
- // Section [STPath]
- #if 0
- Section := 'STPath';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, 'ExePath', '%ROOTPATH%\Bin\Mebel.exe', Filename);
- SetIniString(Section, 'K32ExePath', '%ROOTPATH%\Bin\K32.exe', Filename);
- SetIniString(Section, 'MainPath', '%MASTERAPPDATAFOLDER%\BIN\', Filename);
- SetIniString(Section, 'K32MainPath', '%MASTERAPPDATAFOLDER%\BIN\', Filename);
- SetIniString(Section, 'GuidesPath', '%MASTERAPPDATAFOLDER%\Data\PKM\tmguidesv7.mdb', Filename);
- SetIniString(Section, 'NGuidesPath', '%MASTERAPPDATAFOLDER%\Data\PKM\NGuides.mdb', Filename);
- SetIniString(Section, 'K7ProtoPath', '%MASTERAPPDATAFOLDER%\Data\PKM\K7Proto.mdb', Filename);
- #if APPLICATION_POWER == FASADE_INS
- SetIniString(Section, 'ModelsPath', '', Filename);
- #else
- SetIniString(Section, 'ModelsPath', '%MASTERAPPDATAFOLDER%\Data\PKM\MODELS\', Filename);
- #endif
- SetIniString(Section, 'CustPrjPath', '%PROJECTPATH%\', Filename);
- SetIniString(Section, 'ProtoPath', '%MASTERAPPDATAFOLDER%\Data\PKM\PROTO\', Filename);
- SetIniString(Section, 'TObjPath', '', Filename);
- SetIniString(Section, 'TObjMacPath', '', Filename);
- SetIniString(Section, 'ImlPath', '%MASTERAPPDATAFOLDER%\BIN\MatLib\pkm7_1.ml', Filename);
- SetIniString(Section, 'EditorPath', '%WINDIR%\notepad.exe', Filename);
- SetIniString(Section, 'CuttingPath', szCutting, Filename);
- SetIniString(Section, 'CutDataPath', AddBackslash(szCuttingPath), Filename);
- SetIniString(Section, 'FReportPath', '%MASTERAPPDATAFOLDER%\Bin\Reports\', Filename);
- SetIniString(Section, 'K3FilesPath', '%MASTERAPPDATAFOLDER%\Data\PKM\K3Files\', Filename);
- #if APPLICATION_POWER == FASADE_INS
- SetIniString(Section, 'PicturesPath', '', Filename);
- #else
- SetIniString(Section, 'PicturesPath', '%MASTERAPPDATAFOLDER%\Data\PKM\Pictures\', Filename);
- #endif
- SetIniString(Section, 'OrderRemoveToArchive', '%PROJECTPATH%\OrderRemoveToArchive\', Filename);
- SetIniString(Section, 'ExportImport', '%PROJECTPATH%\ExportImport\', Filename);
- SetIniString(Section, 'TestsPath', '%MASTERAPPDATAFOLDER%\Data\PKM\Tests\', Filename);
- #if APPLICATION_POWER == PKM_INS || APPLICATION_POWER == FASADE_INS || APPLICATION_POWER == PKM_BETA_INS
- #ifndef DEMO
- SetIniString(Section, 'CNCPath', '%ROOTPATH%\Bin\k3cncw.exe', Filename);
- SetIniString(Section, 'CNCDataPath', '%MASTERAPPDATAFOLDER%\Data\PKM\PROTO\CNC\', Filename);
- #else
- SetIniString(Section, 'CNCPath', '', Filename);
- SetIniString(Section, 'CNCDataPath', '', Filename);
- #endif
- #else
- SetIniString(Section, 'CNCPath', '', Filename);
- SetIniString(Section, 'CNCDataPath', '', Filename);
- #endif
- SetIniString(Section, 'PyEnv', '%MASTERAPPDATAFOLDER%\Data\PKM\PyEnv\', Filename);
- // Section [Menu]
- Section := 'Menu';
- DeleteIniSection(Section, Filename);
- SetIniInt(Section, 'TotalLines', 1, Filename);
- SetIniInt(Section, 'Overwrite', 1, Filename);
- SetIniString(Section, 'Menu1', '<Commonappdata>\'+szMenuName1, Filename);
- // Section [CorePath]
- Section := 'CorePath';
- DeleteIniSection(Section, Filename);
- SetIniInt(Section, 'Overwrite', 1, Filename);
- SetIniString(Section, 'Proto', '%MASTERAPPDATAFOLDER%\Data\PKM\NGuides.mdb', Filename);
- SetIniString(Section, 'K32Proto', '%MASTERAPPDATAFOLDER%\Data\PKM\K7Proto.mdb', Filename);
- #endif
-
- //*** переименовать MebelCfg.xml
- s1 := ExpandConstant('{commonappdata}\{#MasterAppDataTail}\MebelCfg.xml');
- s2 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\MebelCfg.xml');
- if not FileExists(s2) then begin
- CreateDir(ExpandConstant('{userappdata}\{#MasterAppDataTail}'));
- FileCopy(s1, s2, false);
- end;
- if (bExistAppMain) then begin
- s1 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\' + szAppCfg);
- s2 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\' + szSaveAppCfg);
- RenameFile(s1, s2);
- end;
- //*** переименовать K32Cfg.xml
- s1 := ExpandConstant('{commonappdata}\{#MasterAppDataTail}\K32Cfg.xml');
- s2 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\K32Cfg.xml');
- if not FileExists(s2) then begin
- CreateDir(ExpandConstant('{userappdata}\{#MasterAppDataTail}'));
- FileCopy(s1, s2, false);
- end;
- if (bExistAppMain) then begin
- s1 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\' + szK32Cfg);
- s2 := ExpandConstant('{userappdata}\{#MasterAppDataTail}\' + szSaveK32Cfg);
- RenameFile(s1, s2);
- end;
-
- //*** Update base
- // Запуск PostSetup
- Filename := ExpandConstant('{app}\Bin\{#AppPostSetup}.exe');
- if not Exec(Filename, '\q', '', SW_SHOW, ewWaitUntilTerminated, ResultCode) then begin
- msg := Format(ExpandConstant('Ошибка {#AppPostSetup}: %s'), [SysErrorMessage(ResultCode)]);
- MsgBox(msg, mbCriticalError, MB_OK);
- end;
-
- Result := True;
- end;
инициализация настроек
в пункте 7, "инициализация настроек", для вас, наверное, полезным будет только настройка путей к спровочникам, но могу дать содержимое всех фунцкий
- function MebelIni(): Boolean;
- var
- Section, Filename : String;
- begin
- Filename := ExpandConstant('{app}\Bin\Mebel.ini');
- // Section [MetaFolders]
- Section := 'MetaFolders';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, '<commonappdata>', AddBackslash(GetAppData(''))+'Bin', Filename);
- SetIniString(Section, '<appdata>', ExpandConstant(AddBackslash('%APPDATA%')+'{#SlaveAppDataTail}'), Filename);
- Result := True;
- end;
-
- function K32Ini(): Boolean;
- var
- Section, Filename : String;
- begin
- Filename := ExpandConstant('{app}\Bin\K32.ini');
- // Section [MetaFolders]
- Section := 'MetaFolders';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, '<commonappdata>', AddBackslash(GetAppData(''))+'Bin', Filename);
- SetIniString(Section, '<appdata>', ExpandConstant(AddBackslash('%APPDATA%')+'{#SlaveAppDataTail}'), Filename);
- Result := True;
- end;
-
- function K3TalkIni(): Boolean;
- var
- Section, Filename : String;
- begin
- Filename := ExpandConstant('{app}\Bin\K3Talk.ini');
- // Section [MetaFolders]
- Section := 'K3Talk';
- DeleteIniSection(Section, Filename);
- SetIniString(Section, 'RealIni', AddBackslash(GetAppData(''))+'Bin\K3Talk.ini', Filename);
- Result := True;
- end;
-
- function K3RefEditorMetapathsIni(): Boolean;
- var
- Section, Filename, FilenameUtf8 : String;
- var s: TArrayOfString;
- begin
- Filename := szMasterAppData + ExpandConstant('\K3RefEditor\K3RefEditorMetaPathsANSI.ini');
- FilenameUtf8 := szMasterAppData + ExpandConstant('\K3RefEditor\K3RefEditorMetaPaths.ini');
- // Section [Main]
- Section := 'Main';
- DeleteIniSection(Section, Filename);
-
- SetIniString(Section, 'Proto', szMasterAppData + '\Data\PKM\Proto', Filename);
- SetIniString(Section, 'Models', szMasterAppData + '\Data\PKM\Models', Filename);
- SetIniString(Section, 'Textures', szMasterAppData + '\Bin\MatLib', Filename);
- SetIniString(Section, 'K3Files', szMasterAppData + '\Data\PKM\K3Files', Filename);
- SetIniString(Section, 'Pictures', szMasterAppData + '\Data\PKM\Pictures', Filename);
- SetIniString(Section, 'K3Mebel', ExpandConstant('{app}\Bin'), Filename);
- SetIniString(Section, 'K3MebelData', szMasterAppData, Filename);
- SetIniString(Section, 'DBFile', szMasterAppData + '\Base\NGuidesSQLNew.mdf', Filename);
- SetIniString(Section, 'DBUpgrades', szMasterAppData + '\Bin\K3Upgrades.mdb', Filename);
- SetIniString(Section, 'LDBInstanceName', 'v11.0', Filename);
- SetIniString(Section, 'Proto', szMasterAppData + '\Data\PKM\Proto', Filename);
- if LoadStringsFromFile(FileName, s) then
- if SaveStringsToUTF8File(FilenameUtf8, s, false) then
- DeleteFile(FileName);
- Result := True;
- end;
Установка драйвера ключа и ещё некоторые приблуды
Ну и последний содержательный пункт - установка драйвера ключа и ещё некоторые приблуды, которые выполняются в это же время, а перед этим пара вспомогательных функций для определения надо ставить или нет, которые тоже используются
- function IsCmDriver(): Boolean;
- begin
- Result := RegValueExists(RootKeyHKLM, 'SOFTWARE\WIBU-SYSTEMS\CodeMeter', 'RuntimeVersion');
- end;
-
- //####################################( [NB] Драйвер не установлен или устарел )
- function IsObsoledCmDriver(): Boolean;
- var
- valS : String;
- begin
- if RegQueryStringValue(RootKeyHKLM, 'SOFTWARE\WIBU-SYSTEMS\CodeMeter', 'RuntimeVersion', valS) then begin
- #ifndef Online
- if CompareText(valS, '{#CmDriver}') < 0 then
- #else
- if CompareText(valS, '{#CmDriverOnline}') < 0 then
- #endif
- Result := True // драйвер установлен, но устарел
- else
- Result := False; // драйвер установлен, версия не старее, чем в дистрибутиве
- end else // драйвер не установлен
- Result := True;
- end;
-
- //###################################################( [NB] Сервер ключа есть? )
- function IsCmServerList(): Boolean;
- var
- Names: TArrayOfString;
- I: Integer;
- valS, branch, branch2: String;
- begin
- //*** серверы ключей
- branch := 'Software\WIBU-SYSTEMS\CodeMeter\Server\CurrentVersion\ServerSearchList';
- if not RegGetSubkeyNames(RootKeyHKLM, branch, Names) then begin // списка нет вообще
- Result := false;
- exit;
- end;
- Result := false;
- for I := 0 to GetArrayLength(Names)-1 do begin
- branch2 := Format('%s\\%s', [branch, Names[I]]);
- valS := '?';
- RegQueryStringValue(RootKeyHKLM, branch2, 'Address', valS);
- #ifdef Online
- if (0 = CompareText(valS, '{#CmGeoSServer}')) and (0 = CompareText(valS, '{#CmGeoSServerReserve}')) then Result := true;
- #endif
- #ifdef TRIAL
- if 0 = CompareText(valS, '{#CmGeoSServer}') then Result := true;
- #endif
- #ifdef VPN
- if 0 = CompareText(valS, '{#CmGeoSVPNServer}') then Result := true;
- #endif
- end;
- end;
- function NBTasks(): Boolean;
- var
- ErrorCode: Integer;
- bRes: Boolean;
- Filename: String;
- ini, section, value: String;
- ErrorMsg: String;
- begin
- ini := ExpandConstant('{app}\Bin\SetupInf.ini');
- section := 'Log';
- //-- Создать папки с экспортом/импортом и архивом
- if (not DirExists(AddBackslash(szProjectPath)+'ExportImport')) then
- begin
- if (not CreateDir(AddBackslash(szProjectPath)+'ExportImport')) then
- value := Format('Не удалось создать папку для Экспорта/Импорта', [])
- else
- value := Format('Папка для Экспорта/Импорта успешно создана', [])
- end
- else
- value := Format('Папка для Экспорта/Импорта уже присутствует', []);
- SetIniString(section, 'ExportImport', value, ini);
- if (not DirExists(AddBackslash(szProjectPath)+'OrderRemoveToArchive')) then
- begin
- if (not CreateDir(AddBackslash(szProjectPath)+'OrderRemoveToArchive')) then
- value := Format('Не удалось создать папку для хранения архива', [])
- else
- value := Format('Папка для хранения архива успешно создана', [])
- end
- else
- value := Format('Папка для хранения архива уже присутствует', []);
- SetIniString(section, 'OrderRemoveToArchive', value, ini);
- //***
- //*** Версия Windows
- SetIniBool(section, 'AppV78', bVista, ini);
- //*** установить драйвер ключа
- #if 0
- if IsTaskSelected('DongleRunTime') then begin
- bRes := ShellExec('', ExpandConstant('{app}\Kit\CodeMeter Driver\CodeMeterRuntime.exe'), '/ComponentArgs "*":"/q"', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
- CMExecErr := ErrorCode;
-
- value := Format('Установка драйвера ключа (%d)', [bRes]);
- SetIniString(section, 'CodeMeterInstall', value, ini);
- end;
- #endif
- #ifndef DEMO
- if not IsCmDriver() or IsObsoledCmDriver then begin //[15.10.19]
- bRes := ShellExec('', ExpandConstant('{app}\Kit\CodeMeter Driver\CodeMeterRuntime.exe'), '/ComponentArgs "*":"/q"', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
- CMExecErr := ErrorCode;
- end;
- #endif
-
- //*** обновить список поиска сервера ключей
- if IsCmDriver() {and not IsCmServerList()} then begin
- CmServerListUpdate();
- end;
- // end;
- //*** установить видеокодек Xvid
- if IsTaskSelected('Xvid') then begin
- bRes := ShellExec('', ExpandConstant('{app}\Kit\Xvid\Xvid-1.3.4-20150621.exe'), '/q', '', SW_SHOW, ewWaitUntilTerminated, ErrorCode);
- value := Format('Установка видеокодека Xvid (%d)', [bRes]);
- SetIniString(section, 'XvidInstall', value, ini);
- end;
- Result := True;
- end;
регистрация ActiveX
ну и вишенка на торте - регистрация ActiveX компонента визуализации
function NBRegisterDLL(): Boolean; var s: String; begin s := szMasterAppData + ExpandConstant('\K3ViewAX\K3ViewAX.ocx'); if FileExists(s) then RegisterServer(False, s, True); Result := True; end;
Комментарии
Отправить комментарий