[Main]
Title=Preconfig
Description=Getting some informations, preparing and decompressing source
Selected=none
Level=1
Author=Kare
Version=20.1
Date=01.03.2026
Translation_DE=MaineCoon

[Interface]
Panel=1
pTextLabel1=Windows Index:,10,0,Default,20,101,95,20
pScrollBox1=,1,1:0,0,120,100,250,20
pButton1=WimInfo,Refresh,0,,400,100,75,22
//
tHalt_1=Administrator rights needed
tHalt_2=Error reading Source DVD
tHalt_3=Directory to long !! Max. 15 chars#$x#$x%basedir%#$x#$xShould the project be copied to: '%NewDir%' and restarted?
tHalt_4=A %PrjDesc% source-DVD is required#$x#$xProject: %projectname%#$xSource: %os%
tHalt_9=Not enough free disk space.#$x#$xPresent:  %FSize% MB#$xNeeded:     %PSize% MB
tHalt_10=Windows Security Center / virus scanner is active !!#$x#$x%Name%#$x#$xIf virus scanners are active, the build may terminate prematurely.
//
tEcho_1=Starting Build...
tEcho_2=Decompressing Source DVD:#$x(%OS% %SourceEdition% %arch% %SP% %Distlang%) - [Part 1]
tEcho_3=Decompressing Source DVD:#$x(%OS% %arch% %SP% %Distlang%) - [Part 2]
tEcho_4=Source DVD: (%OS% %SourceEdition% %arch% %SP% %Distlang%)
tEcho_5=download 7z...
tEcho_6=decompress 7z...
tEcho_7=languages:

[Interface.07]
Description=Sammelt Informationen von der Quell-DVD und entpackt die WIM-Dateien
Panel=1
pTextLabel1=Windows Index:,10,0,Default,20,101,95,20
pScrollBox1=,1,1:0,0,120,100,250,20
pButton1=WimInfo,Auffrischen,0,,400,100,75,22
//
tHalt_1=Administratorrechte notwendig
tHalt_2=Fehler beim Erkennen der Quell-DVD
tHalt_3=Verzeichnis zu lang !! Max. 15 Zeichen#$x#$x%basedir%#$x#$xSoll das Projekt nach: '%NewDir%' kopiert und neu gestartet werden ?
tHalt_4=Eine %PrjDesc% Quell-DVD wird benötigt#$x#$xProjekt: %projectname%#$xQuelle: %os%
tHalt_9=Nicht genügend freier Festplattenspeicher.#$x#$xVorhanden:  %FSize% MB#$xBenötigt:      %PSize% MB
tHalt_10=Windows Sicherheits Center / Virenscanner ist aktiv !!#$x#$x%Name%#$x#$xBei aktiven Virenscanner kann es vorzeitig zu einem Build-Abbruch kommen.
//
tEcho_1=Zusammenstellung wird gestartet...
tEcho_2=Quell-DVD wird entpackt:#$x(%OS% %SourceEdition% %arch% %SP% %Distlang%) - [Teil 1]
tEcho_3=Quell-DVD wird entpackt:#$x(%OS% %arch% %SP% %Distlang%) - [Teil 2]
tEcho_4=Quell-DVD: (%OS% %SourceEdition% %arch% %SP% %Distlang%)
tEcho_5=Lade 7z...
tEcho_6=Entpacke 7z...
tEcho_7=Sprache:

[process]

// ********** Start Windows PE ************

Echo,%tEcho_1%
If,%Hostadmin%,=,0,then,Halt,%tHalt_1%

String,%len%,Len,%basedir%
if,%len%,>,15,Then,Run,%scriptfile%,Dirlen

System,GetAntiVir,State,%Var%
If,%Var%,=,1,then
  System,GetAntiVir,Name,%Name%
  Message,%tHalt_10%,Warning|LiveSystem pro
End

// get 7z
If,Not,ExistFile,%AppsDir%\7z\Files\7-Zip\7z.exe,then,run,%scriptfile%,Get7z
If,Not,ExistFile,%tools%\GetWaikTools.exe,then,Extract,%BaseDir%\Temp\Files\GWT.txt,GetWaikTools.exe,%tools%\GetWaikTools.exe

If,%SourceDir%,=,,Then,Halt,%tHalt_2%
If,ExistFile,%SourceDir%\Sources\Install.wim,then
	Set,%Installwim%,%SourceDir%\Sources\Install.wim,PERMANENT
else
	Set,%installwim%,%SourceDir%\Sources\Install.esd,PERMANENT
end
If,not,ExistFile,%Installwim%,Then,Halt,%tHalt_2%

string,%char%,Left,%pScrollBox1%,1
if,%char%,=,,or,%char%,=,-,Then
  Run,%Projectini%,source
Else
  String,%WIM_Index%,Split,%pScrollBox1%," ",1
  wim,info,%installwim%,%WIM_Index%,%ProjectDir%\project.cfg
  Update,ProjectVar
End

If,%Arch%,=,"",Then,Halt,%tHalt_2%
String,%Pos%,Find,-Win8-Win81-,-%OS%-
if,%pos%,=,0,then,message,%tHalt_4%,Halt|LSP

Set,%NT%,%WIM_MAJOR%.%WIM_MINOR%,PERMANENT

string,%tmp%,TLeft,%pScrollBox1%,4
//if,not,%tmp%,=,%os% %SourceEdition% (%Arch% %distlang% %WIM_BUILD%),then,Halt,%tHalt_3%

String,%Stmp%,Right,%WIM_BUILD%,1
IF,%WIM_SPBUILD%,=,17031,THEN,Set,%stmp%,U1
IF,%WIM_SPBUILD%,=,17056,THEN,Set,%stmp%,U1
Set, %SP%,SP%stmp%,PERMANENT

String,%SRCEdition%,REPLACE,%SourceEdition%,Professional,Pro
String,%SRCEdition%,REPLACE,%SRCEdition%,Core,Cor
String,%SRCEdition%,REPLACE,%SRCEdition%,Enterprise,Ent
String,%SRCEdition%,REPLACE,%SRCEdition%,Starter,Sta

set,%InstallSRC%,%Basedir%\Wim\%OS%%SRCEdition%%arch%%Distlang%%WIM_BUILD%.%WIM_SPBUILD%-I\%WIM_Index%,PERMANENT
set,%BootSRC%,%Basedir%\Wim\%OS%%arch%%Distlang%%WIM_BUILD%.%WIM_SPBUILD%-B,PERMANENT

// Calc Hdd Size in MB
// Wim extract
Set,%WimSize%,0
If,not,ExistFile,%InstallSRC%\ok,then
  if,%Arch%,=,x86,then, Set,%WimSize%,381
  if,%Arch%,=,x64,then, Set,%WimSize%,573
End
If,not,ExistFile,%BootSRC%\ok,then
  if,%Arch%,=,x86,then, math,%WimSize%,%WimSize%+299
  if,%Arch%,=,x64,then, math,%WimSize%,%WimSize%+361
End

system,GetPrjSize,%Var%,1:2:3:4:5:6:7,mb
// TargetWin
String,%TWSize%,Split,%Var%,:,1
// Boot.wim Size 
Math,%BWSize%,%TWSize%*0.413,Round_Up
// Target_CD
String,%TCSize%,Split,%Var%,:,2
Math,%TCSize%,%TCSize%+%BWSize%,Round_Up
// Provide Apps
String,%APSize%,Split,%Var%,:,3

Math,%PSize%,%WimSize%+%TWSize%+%TCSize%+%APSize%
// ISo size
If,SrtChecked,Finish\1-create_iso.srt,then,Math,%PSize%,%PSize%+%TCSize%+1,Round_Up

String,%Drive%,Left,%BaseDir%,2
System,GetFreeSpace,%Drive%,%FSize%
if,%PSize%,>,%FSize%,Then,Message,%tHalt_9%,Warning|LSP
//Message,WimSize:	%WimSize% MB#$xTargetWin:   %TWSize% MB#$xBoot.Wim: %BWSize% MB#$xTarget_CD: %TCSize% MB#$xAPPDir: %APSize% MB#$x#$xProjectsize inkl. iso: %PSize% MB#$xFreesize:		%FSize% MB,Speicherverbrauch

If,not,ExistFile,%InstallSRC%\ok,then
	echo,%tEcho_2% - (Base)
	Dirmake,%InstallSRC%
	Wim,Extract,FileList,%installwim%,%WIM_Index%,%scriptdir%\Regconfig\InstallWin8.txt,%InstallSRC%

	String,%Count%,SPLIT,%Distlang%:%FallBack%,:,0
	For,%x%,1,%count%
		String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
		filecopy,%scriptdir%\Regconfig\InstallWin8-Mui.txt,%ProjectTemp%\Instwim.txt
		TxtReplace,%ProjectTemp%\Instwim.txt,??-??,%mui%
		echo,%tEcho_2% - (%tEcho_7% %Mui%)
		Wim,Extract,FileList,%installwim%,%WIM_Index%,%ProjectTemp%\Instwim.txt,%InstallSRC%
	Next
	if,%arch%,=,x64,then
		echo,%tEcho_2% (Wow64)
		Wim,Extract,FileList,%installwim%,%WIM_Index%,%scriptdir%\Regconfig\WowWin8-I.txt,%InstallSRC%

		For,%x%,1,%count%
			String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
			filecopy,%scriptdir%\Regconfig\WowWin8-I-Mui.txt,%ProjectTemp%\Wow64-I.txt
			TxtReplace,%ProjectTemp%\Wow64-I.txt,??-??,%mui%
			echo,%tEcho_2% - (Wow64 %tEcho_7% %Mui%)
			Wim,Extract,FileList,%installwim%,%WIM_Index%,%ProjectTemp%\Wow64-I.txt,%InstallSRC%
		Next
	end
	FileCreateBlank,%InstallSRC%\ok
end

//SetMVar,%Wimfolder%,%WIM_Index%\

If,not,ExistFile,%BootSRC%\ok,then
	echo,%tEcho_3% - (Base)
	Dirmake,%BootSRC%\
	Wim,Extract,FileList,%SourceDir%\Sources\Boot.wim,2,%scriptdir%\Regconfig\BootWin8.txt,%BootSRC%

	String,%Count%,SPLIT,%Distlang%:%FallBack%,:,0
	For,%x%,1,%count%
		String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
		filecopy,%scriptdir%\Regconfig\BootWin8-Mui.txt,%ProjectTemp%\Bootwim.txt
		TxtReplace,%ProjectTemp%\Bootwim.txt,??-??,%mui%
		echo,%tEcho_3% - (%tEcho_7% %Mui%)
		Wim,Extract,FileList,%SourceDir%\Sources\Boot.wim,2,%ProjectTemp%\Bootwim.txt,%BootSRC%
	Next

	if,%arch%,=,x64,then
		echo,%tEcho_3% - (Wow64)
		wim,Extract,FileList,%SourceDir%\Sources\Boot.wim,2,%scriptdir%\Regconfig\WowWin8-B.txt,%BootSRC%

		For,%x%,1,%count%
			String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
			filecopy,%scriptdir%\Regconfig\WowWin8-B-Mui.txt,%ProjectTemp%\Bootwim.txt
			TxtReplace,%ProjectTemp%\Bootwim.txt,??-??,%mui%
			echo,%tEcho_3% - (Wow64 %tEcho_7% %Mui%)
			Wim,Extract,FileList,%SourceDir%\Sources\Boot.wim,2,%ProjectTemp%\Bootwim.txt,%BootSRC%
		Next
	end
	FileCreateBlank,%BootSRC%\ok
end

// Test
//set,%BootSRC%,I:\Win81x86SP0de-DE-B,PERMANENT
//set,%InstallSRC%,I:\Win81x86SP0de-DE-I,PERMANENT

// Set Variables
set,%RegUser%,%target_sys%\config\default,PERMANENT
if,%os%%PEMode%,=,win81os,then,set,%RegUser%,%TargetDir%\Users\Default\NTUSER.DAT,PERMANENT
if,%os%,=,win8,then,set,%PEMode%,,Permanent

Set,%TargetDir%,%BaseDir%\Target\%Projectfolder%,PERMANENT
Set,%ProjectTemp%,%BaseDir%\Temp\%Projectfolder%,PERMANENT

Set,%target_win%,%TargetDir%\Windows,PERMANENT
Set,%target_sys%,%TargetDir%\Windows\System32,PERMANENT
Set,%target_wow%,%TargetDir%\Windows\SysWoW64,PERMANENT

Set,%Install_win%,%InstallSRC%\Windows,PERMANENT
Set,%Install_sys%,%InstallSRC%\Windows\System32,PERMANENT
Set,%Install_wow%,%InstallSRC%\Windows\SysWoW64,PERMANENT

Set,%boot_win%,%BootSRC%\Windows,PERMANENT
Set,%boot_sys%,%BootSRC%\Windows\system32,PERMANENT
Set,%boot_wow%,%BootSRC%\Windows\SysWoW64,PERMANENT

// Set Macros
SetMacro,RunFromRAM,Run,%ProjectDir%\Macro.srt,RunFromRAM,#1,PERMANENT
SetMacro,SetProg32,Run,%ProjectDir%\Macro.srt,Process_SetProg32,#1,PERMANENT

// shortcut
//setmacro,Add_Shortcut,Shellexecute,hide,%Tools%\Shortcut.exe,#$q%TargetDir%#$q #$q%Projectini%#$q #$q#1#$q #$q#2#$q #$q#3#$q #$q#4#$q #$q#5#$q #$q#6#$q #$q#7#$q #$q#8#$q,PERMANENT
iniwrite,%Projectini%,Shortcut,StartMenu,\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
iniwrite,%Projectini%,Shortcut,Desktop,\Users\Default\Desktop
iniwrite,%Projectini%,Shortcut,QuickLaunch,\Users\Default\AppData\Roaming\Microsoft\Internet Explorer\Quick Launch

// Remove junction without ramdisk
Junc,GetTarget,%TargetDir%,%tmp%
if,not,%TargetDir%,=,%tmp%,Then
  if,not,ExistDir,%tmp%,then,DirRemove,%TargetDir%,3
end

//echo, Remove old Project...
echo,%tEcho_4%
DirRemove,%TargetDir%,7
DirRemove,%Target_CD%,3
FileDelete,%ProjectTemp%\MultiBoot\menu.lst,1

DirMake,%TargetDir%
dirmake,%Target_CD%

////Set the NTFS permissions on target folder to Full Control to everyone - this avoids the black screen on boot problem
ShellExecute,Hide,%Tools%\%HostArch%\SetAcl.exe," -ot #$qfile#$q -on #$q%TargetDir%#$q -actn ace -actn setprot -op #$qdacl:p_nc#$q -ace #$qn:S-1-1-0;p:full;s:y#$q"
ShellExecute,Hide,%Tools%\%HostArch%\SetAcl.exe," -ot #$qfile#$q -on #$q%Target_CD%#$q -actn ace -actn setprot -op #$qdacl:p_nc#$q -ace #$qn:S-1-1-0;p:full;s:y#$q"


[Get7z]

Set,%7zFile%,7z2501.msi
set,%UrlPath_1%,https://7-zip.org/a/%7zFile%

if,not,ExistFile,%BaseDir%\Temp\Files\%7zFile%,then
  echo,%tEcho_5%
  WebGet,%UrlPath_1%,%BaseDir%\Temp\Files\%7zFile%,1
end
Dirmake,%appsdir%\7z
echo,%tEcho_6%
ShellExecute,hide,%WindowsDir%\system32\msiexec.exe, /a #$q%BaseDir%\Temp\Files\%7zFile%#$q /qn TARGETDIR=#$q%appsdir%\7z#$q
FileCopy,%appsdir%\7z\Files\7-Zip\7z.dll,%tools%\
FileCopy,%appsdir%\7z\Files\7-Zip\7z.exe,%tools%\
FileCopy,%appsdir%\7z\Files\7-Zip\7z.sfx,%tools%\

[Dirlen]
Retrieve,%Size%,DirSize,%basedir%
if,%Size%,<,110000000,then
    String,%Drv%,Split,%basedir%,\,1
    String,%Ver%,Replace,%LSPVer%,.,
    Iniread,%Prj%,%basedir%\Config.ini,Main,ProjectPack
    Set,%NewDir%,%Drv%\%Prj%%Ver%
    message,%tHalt_3%,Question|LSP
    If,%Exitcode%,=,Yes,Then
	Dirmake,%NewDir%
	Dircopy,%Basedir%,%NewDir%
	Iniread,%Exe%,%basedir%\Config.ini,Main,PrgExe
	Start,Show,%NewDir%\%Exe%
	System,ShutDown
    End
End
Halt,%tHalt_3%#$x%basedir%

[WimInfo]
Update,InterfaceVar
Run,%ProjectDir%\project.man,Source

[Script-Pic]
0=3774,3136,ZLB64
1=eNq9l31UHOUVxp9UW21r2/Skx1M1Pdhqv6yt9ljbHnta29jYRI3HGL9KTQ21JmoTtICEJJAPs4BBNiQQQjaQLOzyEQKuMAO7DLs0u3yEnVlCAkSNwG7YCcybsCNLSFDIgvTObkIAa/X0j97Zmbvz8rvPfead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