Skip to content

Commit

Permalink
20240216
Browse files Browse the repository at this point in the history
  • Loading branch information
abbodi1406 committed Feb 16, 2024
1 parent c05b1e7 commit 3738b6c
Show file tree
Hide file tree
Showing 9 changed files with 453 additions and 305 deletions.
271 changes: 149 additions & 122 deletions esd-decrypter-wimlib/decrypt.cmd

Large diffs are not rendered by default.

77 changes: 38 additions & 39 deletions esd-decrypter-wimlib/multi_arch_iso.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@ set Preserve=0

set "_Null=1>nul 2>nul"

set quedit=
set qerel=
set _elev=
set _args=
set _args=%*
set "_args="
set "_args=%~1"
if not defined _args goto :NoProgArgs
if "%~1"=="" set "_args="&goto :NoProgArgs
set "_args="
for %%# in (%*) do (
if /i "%%~#"=="-elevated" (set _elev=1)
if /i "%%~#"=="-qedit" (set quedit=1&reg.exe add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f >nul)
if /i "%%~#"=="-qedit" (set qerel=1)
)

:NoProgArgs
Expand Down Expand Up @@ -60,7 +61,6 @@ wmic path Win32_ComputerSystem get CreationClassName /value 2>nul | find /i "Com
set _pwsh=1
for %%# in (powershell.exe) do @if "%%~$PATH:#"=="" set _pwsh=0
if not exist "%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" set _pwsh=0
2>nul %_psc% $ExecutionContext.SessionState.LanguageMode | find /i "Full" 1>nul || set _pwsh=0
if %_cwmi% equ 0 if %_pwsh% EQU 0 goto :E_PWS

set _uac=-elevated
Expand All @@ -70,13 +70,7 @@ set _uac=-elevated
if defined _elev goto :E_Admin
)

if not defined quedit reg.exe query HKCU\Console /v QuickEdit 2>nul | find /i "0x0" >nul || (
reg.exe add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f >nul
set _uac=-elevated -qedit
)

set _PSarg="""%~f0""" %_uac%
if defined _args set _PSarg="""%~f0""" %_args:"="""% %_uac%
set _PSarg=%_PSarg:'=''%

(%_Null% cscript //NoLogo "%~f0?.wsf" //job:ELAV /File:"%~f0" %_uac%) && (
Expand All @@ -91,18 +85,29 @@ set _PSarg=%_PSarg:'=''%
)

:Passed
if %winbuild% LSS 10586 (
reg.exe query HKCU\Console /v QuickEdit 2>nul | find /i "0x0" >nul && set qerel=1
)
if defined qerel goto :skipQE
if %_pwsh% EQU 0 goto :skipQE
set _PSarg="""%~f0""" -qedit
set _PSarg=%_PSarg:'=''%
set "d1=$t=[AppDomain]::CurrentDomain.DefineDynamicAssembly(4, 1).DefineDynamicModule(2, $False).DefineType(0);"
set "d2=$t.DefinePInvokeMethod('GetStdHandle', 'kernel32.dll', 22, 1, [IntPtr], @([Int32]), 1, 3).SetImplementationFlags(128);"
set "d3=$t.DefinePInvokeMethod('SetConsoleMode', 'kernel32.dll', 22, 1, [Boolean], @([IntPtr], [Int32]), 1, 3).SetImplementationFlags(128);"
set "d4=$k=$t.CreateType(); $b=$k::SetConsoleMode($k::GetStdHandle(-10), 0x0080);"
setlocal EnableDelayedExpansion
%_psc% "!d1! !d2! !d3! !d4! & cmd.exe '/c' '!_PSarg!'" &exit /b
exit /b

:skipQE
set "_batf=%~f0"
set "_log=%~dpn0"
set "_work=%~dp0"
set "_work=%_work:~0,-1%"
for /f "skip=2 tokens=2*" %%a in ('reg.exe query "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders" /v Desktop') do call set "_dsk=%%b"
if exist "%PUBLIC%\Desktop\desktop.ini" set "_dsk=%PUBLIC%\Desktop"
setlocal EnableDelayedExpansion
if not defined quedit reg.exe query HKCU\Console /v QuickEdit 2>nul | find /i "0x0" >nul || (
reg.exe add HKCU\Console /v QuickEdit /t REG_DWORD /d 0 /f >nul
start cmd.exe /c ""!_batf!" %* -qedit"
exit /b
)

if %_Debug% equ 0 (
set "_Nul1=1>nul"
Expand Down Expand Up @@ -204,7 +209,7 @@ setlocal DisableDelayedExpansion
set _erriso=0
set _iso1=
echo %line%
echo Enter / Paste the complete path to 1st ISO file
echo Enter the full path to 1st ISO file
echo %line%
echo.
set /p _iso1=
Expand All @@ -225,7 +230,7 @@ set _erriso=0
set _iso2=
echo.
echo %line%
echo Enter / Paste the complete path to 2nd ISO file
echo Enter the full path to 2nd ISO file
echo %line%
echo.
set /p _iso2=
Expand Down Expand Up @@ -745,7 +750,7 @@ del /f /q "!_fvr1!" "!_fvr2!" "!_fvr3!" "!_fvr4!" %_Nul3%
exit /b

:checkQE
if not defined quedit reg.exe query HKCU\Console /v QuickEdit 2>nul | find /i "0x0" >nul || (
if not defined qerel reg.exe query HKCU\Console /v QuickEdit 2>nul | find /i "0x0" >nul || (
echo ### WARNING ###
echo.
echo Console "Quick Edit Mode" is active.
Expand All @@ -759,9 +764,6 @@ exit /b
%_err%
echo This script require administrator privileges.
echo To do so, right click on this script and select 'Run as administrator'
if "%_uac%"=="-elevated -qedit" (
reg.exe add HKCU\Console /v QuickEdit /t REG_DWORD /d 1 /f >nul
)
goto :E_Exit

:E_PWS
Expand Down Expand Up @@ -796,6 +798,7 @@ if exist bin\temp\ rmdir /s /q bin\temp\
if exist ISOx64\ rmdir /s /q ISOx64\
if exist ISOx86\ rmdir /s /q ISOx86\
popd
@color 07
if %_Debug% neq 0 exit /b
if defined qmsg echo.&echo %qmsg%
echo Press 0 or q to exit.
Expand All @@ -805,22 +808,18 @@ if errorlevel 1 (exit /b) else (rem.)
----- Begin wsf script --->
<package>
<job id="ELAV">
<script language="VBScript">
Set strArg=WScript.Arguments.Named
If Not strArg.Exists("File") Then
Wscript.Echo "Switch /File:<File> is missing."
WScript.Quit 1
End If
Set strRdlproc = CreateObject("WScript.Shell").Exec("rundll32 kernel32,Sleep")
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & strRdlproc.ProcessId & "'")
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & .ParentProcessId & "'")
If InStr (.CommandLine, WScript.ScriptName) <> 0 Then
strLine = Mid(.CommandLine, InStr(.CommandLine , "/File:") + Len(strArg("File")) + 8)
End If
End With
.Terminate
End With
CreateObject("Shell.Application").ShellExecute "cmd.exe", "/c " & chr(34) & chr(34) & strArg("File") & chr(34) & strLine & chr(34), "", "runas", 1
</script>
<script language="VBScript">
Set strArg=WScript.Arguments.Named
Set strRdlproc = CreateObject("WScript.Shell").Exec("rundll32 kernel32,Sleep")
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & strRdlproc.ProcessId & "'")
With GetObject("winmgmts:\\.\root\CIMV2:Win32_Process.Handle='" & .ParentProcessId & "'")
If InStr (.CommandLine, WScript.ScriptName) <> 0 Then
strLine = Mid(.CommandLine, InStr(.CommandLine , "/File:") + Len(strArg("File")) + 8)
End If
End With
.Terminate
End With
CreateObject("Shell.Application").ShellExecute "cmd.exe", "/c " & chr(34) & chr(34) & strArg("File") & chr(34) & strLine & chr(34), "", "runas", 1
</script>
</job>
</package>
Binary file modified uup-converter-wimlib/bin/APAP.exe
Binary file not shown.
82 changes: 82 additions & 0 deletions uup-converter-wimlib/bin/APAP.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
@exit /b

:embed:
[Environment]::CurrentDirectory = (Get-Location -PSProvider FileSystem).ProviderPath
Add-Type -Path .\Microsoft.Dism.dll
$Dism = [Microsoft.Dism.DismApi]

function ATA($Mnt, $Log = [NullString]::Value, $Tmp = [NullString]::Value, $Stub = 0) {

try
{
$Dism::InitializeEx(2, $Log, $Tmp)
$sesn = $Dism::OpenOfflineSession($Mnt)
$lst = [IO.File]::ReadAllLines('AppsToAdd.txt', [Text.Encoding]::ASCII)
}
catch
{
Write-Host -Fore Red -Back Black $_.Exception.Message
return
}

[bool]$bError = $FALSE

ForEach ($itm in $lst)
{
$drc = [IO.Path]::GetDirectoryName($itm)

if ($drc.Equals('MSIXFramework', 'OrdinalIgnoreCase'))
{
Write-Host ([IO.Path]::GetFileNameWithoutExtension($itm))
try
{
$Dism::AddProvisionedAppxPackage($sesn, $itm, $null, $null, $null)
}
catch
{
Write-Host -Fore Red -Back Black $_.Exception.Message
$bError = $TRUE
break
}
continue
}

Write-Host ($drc)
[bool]$isStub = ([IO.Directory]::Exists($drc + '\AppxMetadata\Stub')) -and ([IO.Directory]::GetFiles($drc + '\AppxMetadata\Stub').Length -gt 0)
if ($isStub)
{
$stb = 2
if ($Stub -ne 0) {$stb = 1}
}
else
{
$stb = 0
}
try
{
$Dism::AddProvisionedAppxPackage($sesn, $itm, $null, $null, $drc + '\License.xml', $null, 'all', $stb)
}
catch
{
Write-Host -Fore Red -Back Black $_.Exception.Message
$bError = $TRUE
break
}
}

if ($bError)
{
try {$Dism::CloseSession($sesn)} catch {}
try {$Dism::CloseSession($sesn)} catch {}
try {$sesn = $Dism::OpenOfflineSession($Mnt)} catch {}
try {$Dism::CloseSession($sesn)} catch {}
$Dism::Shutdown()
}
else
{
$Dism::CloseSession($sesn)
$Dism::Shutdown()
}

}
:embed:
Binary file modified uup-converter-wimlib/bin/Microsoft.Dism.dll
Binary file not shown.
10 changes: 9 additions & 1 deletion uup-converter-wimlib/bin/bootwim.txt
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,12 @@ win32ui.dll
WinDlp.dll
winsetup.dll
wpx.dll
xmllite.dll
xmllite.dll
pnppropmig.dll
testplugin.dll
UnattendMgr.dll
UpdateCompression.dll
WinSetupBoot.hiv
WinSetupBoot.sys
WinSetupMon.hiv
WinSetupMon.sys
Loading

0 comments on commit 3738b6c

Please sign in to comment.