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

[Interface]
pTextLabel1=Windows Index:,10,0,Default,20,101,95,20
pScrollBox1=,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
tHalt_4=A
tHalt_5=source-DVD is required#$x#$xProject:
tHalt_6=Source
//
tEcho_1=Starting Build...
tEcho_2=Decompressing Source DVD:#$x(%OS% %SourceEdition% %arch% %SP% %Distlang%) - [Part 1]
tEcho_3=Decompressing Source DVD:#$x(%OS% %SourceEdition% %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
pTextLabel1=Windows Index:,10,0,Default,20,101,95,20
pScrollBox1=,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
tHalt_4=Eine
tHalt_5=Quell-DVD wird benötigt#$x#$xProjekt:
tHalt_6=Quelle:
//
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]

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

String,%len%,Len,%basedir%
if,%len%,>,15,Then,Halt,%tHalt_3%#$x%basedir%

Set,%Installwim%,%SourceDir%\Sources\Install.wim,PERMANENT
If,not,ExistFile,%Installwim%,then,Halt,%tHalt_2%
// get 7z
If,Not,ExistFile,%tools%\7z.exe,then,run,%scriptfile%,Get7z
If,Not,ExistFile,%tools%\GetWaikTools.exe,then,Extract,%AppsDir%\GWT.txt,GetWaikTools.exe,%tools%\GetWaikTools.exe
If,ExistFile,%SourceDir%\MediaMeta.xml,Then,Halt,This source is not supported.,Halt

string,%char%,Left,%pScrollBox1%,1
if,%char%,=,,or,%char%,=,-,Then,Run,%Projectini%,source
String,%WIM_Index%,left,%pScrollBox1%,1
wim,info,%Installwim%,%WIM_Index%,%ProjectDir%\project.cfg
Update,ProjectVar

IF,%WIM_MAJOR%%WIM_MINOR%,=,60,Then,Set,%OS%,WinVista,PERMANENT
IF,%WIM_MAJOR%%WIM_MINOR%,=,61,Then,Set,%OS%,Win7,PERMANENT
IF,%WIM_MAJOR%%WIM_MINOR%,=,62,Then,Set,%OS%,Win8,PERMANENT
IF,%WIM_MAJOR%%WIM_MINOR%,=,63,Then,Set,%OS%,Win81,PERMANENT
IF,%WIM_MAJOR%%WIM_MINOR%,=,100,Then,Set,%OS%,Win10,PERMANENT

String,%Pos%,Find,-Win7-WinVista-,-%OS%-
if,%pos%,=,0,then,message,%tHalt_4% Windows 7/Vista %tHalt_5% Win7PE#$x%tHalt_6% %os%,Halt

String,%SP%,Right,%WIM_BUILD%,1
Set,%SP%,SP%SP%,PERMANENT

if,%WIM_arch%,=,0,then
	set,%Arch%,x86,PERMANENT
else
	set,%Arch%,x64,PERMANENT
end
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,%SRCEdition%,REPLACE,%SourceEdition%,Professional,Pro
String,%SRCEdition%,REPLACE,%SRCEdition%,HomeBasic,HBa
String,%SRCEdition%,REPLACE,%SRCEdition%,Enterprise,Ent
String,%SRCEdition%,REPLACE,%SRCEdition%,Starter,Sta
String,%SRCEdition%,REPLACE,%SRCEdition%,HomePremium,HPr
String,%SRCEdition%,REPLACE,%SRCEdition%,Ultimate,Ult
String,%SRCEdition%,REPLACE,%SRCEdition%,Business,Bus

if,%OS%%SP%,=,WinVistaSp2,then
  if,ExistFile,%Basedir%\Wim\%OS%%arch%%Distlang%%WIM_BUILD%-B\Windows\system32\aclui.dll,Then
    Retrieve,%Var%,FileVersion,%Basedir%\Wim\%OS%%arch%%Distlang%%WIM_BUILD%-B\Windows\system32\aclui.dll
    String,%ver%,Split,%var%,.,3
    if,%ver%,=,6000,then,message,Windows Vista Source Cd not supported#$x#$xInstall.wim = SP2#$xBoot.wim = Sp0,Halt
  else
    DirRemove,%Projecttemp%\Windows,3
    Wim,Extract,File,%SourceDir%\sources\Boot.wim,2,Windows\system32\aclui.dll,%Projecttemp%
    Retrieve,%Var%,FileVersion,%Projecttemp%\Windows\system32\aclui.dll
    String,%ver%,Split,%var%,.,3
    if,%ver%,=,6000,then,message,Windows Vista Source Cd not supported#$x#$xInstall.wim = SP2#$xBoot.wim = Sp0,Halt
  end
end

set,%InstallSRC%,%Basedir%\Wim\%OS%%SRCEdition%%arch%%Distlang%%WIM_BUILD%-I\%WIM_Index%,PERMANENT
If,not,ExistFile,%InstallSRC%\ok,then
	echo,%tEcho_2% - (Base)
	Dirmake,%InstallSRC%
	Wim,Extract,FileList,%installwim%,%WIM_Index%,%scriptdir%\Regconfig\InstallWin7.txt,%InstallSRC%

	String,%Count%,SPLIT,%Distlang%:%FallBack%,:,0
	For,%x%,1,%count%
		String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
		filecopy,%scriptdir%\Regconfig\InstallWin7-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\WowWin7-I.txt,%InstallSRC%

		For,%x%,1,%count%
			String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
			filecopy,%scriptdir%\Regconfig\WowWin7-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%\

set,%BootSRC%,%Basedir%\Wim\%OS%%arch%%Distlang%%WIM_BUILD%-B,PERMANENT
If,not,ExistFile,%BootSRC%\ok,then
	echo,%tEcho_3% - (Base)
	Dirmake,%BootSRC%\
	Wim,Extract,FileList,%SourceDir%\Sources\Boot.wim,2,%scriptdir%\Regconfig\BootWin7.txt,%BootSRC%

	String,%Count%,SPLIT,%Distlang%:%FallBack%,:,0
	For,%x%,1,%count%
		String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
		filecopy,%scriptdir%\Regconfig\BootWin7-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\WowWin7-B.txt,%BootSRC%

		For,%x%,1,%count%
			String,%mui%,SPLIT,%Distlang%:%FallBack%,:,%x%
			filecopy,%scriptdir%\Regconfig\WowWin7-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


//set,%BootSRC%,F:\test9\Wim\Win7x86SP1de-DE-B\2,PERMANENT
//set,%BootSRC%,h:\BootWim-Win7SP1-x86-ger,PERMANENT

// Set Variables
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,FileDecInst,Wim,Extract,File,%SourceDir%\Sources\Install.wim,%WIM_Index%,#1,%InstallSRC%,PERMANENT
SetMacro,FileDecBoot,Wim,Extract,File,%SourceDir%\Sources\Boot.wim,%WIM_Index%,#1,%BootSRC%,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
//iniwrite,%Projectini%,Shortcut,Autostart,\Users\Default\AppData\Roaming\Microsoft\Windows\Start Menu\Programs
//IniWrite,%Target_sys%\PEinit.ini,Init,005,CMD|%RamDrive%\UserRam.exe -o%RamDrive% -y


// 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%,7z2107.msi
set,%UrlPath_1%,https://7-zip.org/a/%7zFile%

echo,%tEcho_5%
WebGet,%UrlPath_1%,%appsdir%\%7zFile%,1
Dirmake,%appsdir%\7z
echo,%tEcho_6%
ShellExecute,hide,%WindowsDir%\system32\msiexec.exe, /a #$q%appsdir%\%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%\

[WimInfo]
Run,%Projectini%,Source

[Script-Pic]
0=3774,3136,ZLB64
1=eNq9l31UHOUVxp9UW21r2/Skx1M1Pdhqv6yt9ljbHnta29jYRI3HGL9KTQ21JmoTtICEJJAPs4BBNiQQQjaQLOzyEQKuMAO7DLs0u3yEnVlCAkSNwG7YCcybsCNLSFDIgvTObkIAa/X0j97Zmbvz8rvPfeadmZ0BmEfL3XeDttfj0NeBGwH8iFYawipExsPxZVyNeZdXiufvvwsJD96JNYt/gRefehRrVz6NV1b9GfGrViDp5RjExv4TcXHxSExMwqbkzah48SHY1z2I12NXIT3hBbyZ8HfsSFyLzA1rsXfjauQkv4SClBfxRkoitm5IQsu6B9D4ysM4GvcgxLjFaE5YCvG1pTi2cRlObHoYTeufgrj+MUjJT+Jo8rOQUv4K49aXoX89EVm6Dcje9ip26Tbh4M4tMKW+BlNGAkozk1GemQJOnwB+5waYd6XAlr0RQm4yHPkp6Ni6Al2Zz0Ha9jw8O2LQvmM1POmvQHwzFh2718FNGm05G+E1p0AuW4/U7duRsSMD+/Sp2KPfgbzdehiy9dDv3IXs3bthyM1F7l4D8gz7kZ9fAFNOKiw5W/H2/nSYc99EVe522A+korQgB+aD+agq3AlL0V6UFe5HhakAnDkf9RX5MBqLUVpcgsOmIljKS1BcUo7KikpUmUvhKCsEV1GGukoL7NWHYa2thb22BkeEGjjsdhzbsw1S0Xa0mLLQW7odvkNpOFGUAW9JBjrL9Th9eAdc5dlofvsAvGW70FG5B97K3XDzRnTxeeitysFpfj/6305DX1km+g5nYqAqHf01egwKmThTmY1+PgeBeso1+ThbY4AiGHBGMEKpLwBzFCDgyMfIkYMQLUUQq8rQbK3Eu7VFOCkUo1swodnOw2UVcNRhh2ItpDoTztYXk44Fgw2HwI5U4bwzC0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