[ARCHIVED] Windows Editions Reconstruction Project

Discussion in 'Windows 10' started by whatever127, Jan 10, 2020.

Thread Status:
Not open for further replies.
  1. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,861
    1,521
    60
    Code:
    @echo off
    cd /d "%~dp0"
    
    if NOT EXIST Windows11.0-KB50*.msu (
        echo.
        echo Could not find *.msu
        echo.
        goto :END
    )
    
    set start=%time%
    
    set "_Null2=1>nul 2>nul"
    
    set a7z=files\7z.exe
    set TU=temp
    
    :: Modded_CU=Yes, No
    set Modded_CU=Yes
    set Modded_Parent=EnterpriseS
    set Modded_Parent_Edition=%Modded_Parent%Edition
    if %Modded_CU% EQU Yes (
        if EXIST files\Package_%Modded_Parent% (
            set TP=files\Package_%Modded_Parent%
        ) else (
            set Modded_CU=No
        )
    )
    
    
    setlocal enabledelayedexpansion
    
    for %%i in (Windows11.0-KB50*.msu) do (
        if EXIST %TU% (rd /s /q %TU% & md %TU%) else (md %TU%)
    
        echo.
        echo Extract %%~nxi
        echo.
        %a7z% x "%%i" -y -o%TU% >nul
        
        for %%k in (%TU%\Windows11.0-KB50*.psf) do (
            set LCU_Name=%%~nk
            for /f "tokens=2,3 delims=-" %%a in ("!LCU_Name!") do (
                set CU_BuildNumber=%%a
                set UARC=%%b
                echo.
                echo CU_BuildNumber = !CU_BuildNumber!
                echo UARC = !UARC!
            )
        )
        
        if EXIST %TU%\!LCU_Name!.wim (
            %a7z% e %TU%\!LCU_Name!.wim -y -o"%TU%\!LCU_Name!" >nul
        ) else if EXIST %TU%\!LCU_Name!.cab (
            %a7z% e %TU%\!LCU_Name!.cab -y -o"%TU%\!LCU_Name!" >nul
        ) else (
            echo.
            echo Could not find !LCU_Name!.wim or .cab
            echo.
            goto :END   
        )
        
        for %%k in (%TU%\!LCU_Name!\Microsoft-Windows-ProfessionalEdition~31bf3856ad364e35~*.mum) do (
            set name_tmp=%%~nk
            for /f tokens^=3^,4^,5^,6^,7^ delims^=~^. %%k in ("!name_tmp!") do (
                set ARCH=%%k
                set LVER=%%l.%%m.%%n.%%o
                set SVER=%%n.%%o
    
                set V1=%%l
                set V2=%%m
                set V3=%%n
                set V4=%%o
    
                echo ARCH = !ARCH!
                echo LVER = !LVER!
                echo SVER = !SVER!
                echo.
            )
        )
    
        
        echo ============================================================================================================
        echo !LCU_Name!_!SVER!
        echo ============================================================================================================
        
        if !UARC! EQU x64 (
            %a7z% e %TU%\DesktopDeployment.cab "dpx.dll" -o%TU% -y -aos -r >nul   
            if !V3! GEQ 25000 (
                %a7z% e %TU%\DesktopDeployment.cab "updatecompression.dll" -o%TU% -y -aos -r >nul
                ren %TU%\updatecompression.dll msdelta.dll
                copy /y files\expand-x64_25398.1.exe %TU%\expand.exe %_Null2%
            ) else if !V3! GEQ 22000 (
                copy /y files\msdelta-x64_22621.1.dll %TU%\msdelta.dll %_Null2%
                copy /y files\expand-x64_22621.1.exe %TU%\expand.exe %_Null2%
            ) else (
                copy /y files\msdelta-x64_19045.3208.dll %TU%\msdelta.dll %_Null2%
                copy /y files\expand-x64_19045.3208.exe %TU%\expand.exe %_Null2%
            )       
        ) else if !UARC! EQU arm64 (
            if !V3! GEQ 25000 (
                copy /y files\dpx-x64_25398.1.dll %TU%\dpx.dll %_Null2%
                copy /y files\msdelta-x64_25398.1.dll %TU%\msdelta.dll %_Null2%
                copy /y files\expand-x64_25398.1.exe %TU%\expand.exe %_Null2%
            ) else if !V3! GEQ 22000 (
                copy /y files\dpx-x64_22621.1.dll %TU%\dpx.dll %_Null2%
                copy /y files\msdelta-x64_22621.1.dll %TU%\msdelta.dll %_Null2%
                copy /y files\expand-x64_22621.1.exe %TU%\expand.exe %_Null2%
            ) else (
                copy /y files\dpx-x64_19045.3208.dll %TU%\dpx.dll %_Null2%
                copy /y files\msdelta-x64_19045.3208.dll %TU%\msdelta.dll %_Null2%
                copy /y files\expand-x64_19045.3208.exe %TU%\expand.exe %_Null2%
            )
        ) else (
            echo x86
            echo.
            goto :END
        )
     
        copy /y %TU%\!LCU_Name!\express.psf.cix.xml %TU% %_Null2%
        copy /y files\PSFExtractor-x64.exe %TU% %_Null2%
    
    
        echo.
        echo Extract !LCU_Name!.psf
        echo.
        %TU%\PSFExtractor-x64.exe -v2 %TU%\!LCU_Name!.psf %TU%\express.psf.cix.xml %TU%\!LCU_Name!
    
        
        if EXIST !LCU_Name!_!SVER! (rd /s /q !LCU_Name!_!SVER! & md !LCU_Name!_!SVER!) else (md !LCU_Name!_!SVER!)
        md !LCU_Name!_!SVER!\update\lcu
        md !LCU_Name!_!SVER!\update\ssu
        
    
        if !Modded_CU! EQU Yes (
            (findstr /i %Modded_Parent_Edition% %TU%\!LCU_Name!\update.mum) && (
                echo.
                echo Cumulative Update Support %Modded_Parent%, Not Modded
                echo.
                set Modded_CU=No
            )
        )
    
        rem copy /y !TU!\update_LCU.mum %TU%\!LCU_Name!\update.mum %_Null2%
        rem copy /y !TU!\update_SSU.mum %TU%\!SSU_Name!\update.mum %_Null2%
        if !Modded_CU! EQU Yes (
            echo.
            echo Modded Servicing Stack and Latest Cumulative Update
            echo.
            
            for %%k in (%TU%\SSU-*.cab) do (
                set SSU_Name=%%~nk
                if EXIST %TU%\!SSU_Name! (rd /s /q %TU%\!SSU_Name! & md %TU%\!SSU_Name!) else (md %TU%\!SSU_Name!)
                echo.
                echo Extract !SSU_Name!.cab
                echo.
                %TU%\expand.exe -f:* %%k %TU%\!SSU_Name! >nul
            )
            
            rem copy /y %TU%\!LCU_Name!\update.mum !TU!\update_LCU.mum %_Null2%
            rem copy /y %TU%\!SSU_Name!\update.mum !TU!\update_SSU.mum %_Null2%
            (findstr /i enterpriseevaledition %TU%\!LCU_Name!\update.mum %_Null2%) && (
                powershell -Command "(gc %TU%\!LCU_Name!\update.mum) -replace 'enterpriseevaledition', '%Modded_Parent_Edition%' | sc %TU%\!LCU_Name!\update.mum" %_Null2%
                powershell -Command "(gc %TU%\!SSU_Name!\update.mum) -replace 'enterpriseevaledition', '%Modded_Parent_Edition%' | sc %TU%\!SSU_Name!\update.mum" %_Null2%
            ) || (
                (findstr /i serverdatacentercoredition %TU%\!LCU_Name!\update.mum %_Null2%) && (
                    powershell -Command "(gc %TU%\!LCU_Name!\update.mum) -replace 'serverdatacentercoredition', '%Modded_Parent_Edition%' | sc %TU%\!LCU_Name!\update.mum" %_Null2%
                    powershell -Command "(gc %TU%\!SSU_Name!\update.mum) -replace 'serverdatacentercoredition', '%Modded_Parent_Edition%' | sc %TU%\!SSU_Name!\update.mum" %_Null2%
                ) || (
                    powershell -Command "(gc %TU%\!LCU_Name!\update.mum) -replace 'professionaledition', '%Modded_Parent_Edition%' | sc %TU%\!LCU_Name!\update.mum" %_Null2%
                    powershell -Command "(gc %TU%\!SSU_Name!\update.mum) -replace 'professionaledition', '%Modded_Parent_Edition%' | sc %TU%\!SSU_Name!\update.mum" %_Null2%
                )
            )
            rem copy /y %TU%\!LCU_Name!\update.mum %TU%\update_LCU_N.mum %_Null2%
            rem copy /y %TU%\!SSU_Name!\update.mum %TU%\update_SSU_N.mum %_Null2%
    
    rem copy /y %TU_LCU%\microsoft-windows-professionaledition-Wrapper~31bf3856ad364e35~amd64~~%LVER_N%.* %TP_N% %_Null2%
    rem copy /y %TU_LCU%\microsoft-windows-%Modded_Parent_Edition%-Wrapper~31bf3856ad364e35~amd64~~%LVER_N%.* %TP_N% %_Null2%
    
    setlocal enabledelayedexpansion
    
    if EXIST LVER_List.txt (del /q LVER_List.txt)
    for %%i in (%TP%\*.mum) do (
       call :SplitName_Package %%i
       echo !PackageName!>tmp.txt
       echo !Package_LVER!>>LVER_List.txt
       powershell -Command "(gc tmp.txt) -replace '%Modded_Parent%', 'Professional' | sc tmp.txt" >NUL 2>&1
       for /f "delims=" %%a in (tmp.txt) do (
           if EXIST %TU_LCU%\%%a*.mum (
               for %%x in (%TU_LCU%\%%a*.mum) do (
                   call :GetVersion_SubPackage %%x %%a
               )
               set PackageName_N=!PackageName!!SubPackage_LVER!
               echo     Exist Professional Version: !PackageName!!SubPackage_LVER!
           ) else (
               set PackageName_N=!PackageName!!LVER_N!
               echo Not Exist Professional Version: !PackageName!!SubPackage_LVER!!LVER_N!
           )
       )
    )
        echo ========================================================================================================
        echo Delete No exist files !%TP%!
        echo ========================================================================================================
       pause
    if EXIST LVER_List.txt (del /q LVER_List.txt)
    for %%i in (%TP%\*.mum) do (
       call :SplitName_Package %%i
       echo !PackageName!>tmp.txt
       echo !Package_LVER!>>LVER_List.txt
       powershell -Command "(gc tmp.txt) -replace '%Modded_Parent%', 'Professional' | sc tmp.txt" >NUL 2>&1
       for /f "delims=" %%a in (tmp.txt) do (
           if EXIST %TU_LCU%\%%a*.mum (
               for %%x in (%TU_LCU%\%%a*.mum) do (
                   call :GetVersion_SubPackage %%x %%a
               )
               set PackageName_N=!PackageName!!SubPackage_LVER!
               echo     Exist Professional Version: !SubPackage_LVER!
           ) else (
               set PackageName_N=!PackageName!!LVER_N!
               echo Not Exist Professional Version: !LVER_N!
           )
       )
       copy /y %TP%\!PackageName!!Package_LVER!.cat %TP_N%\!PackageName_N!.cat %_Null2%
       copy /y %TP%\!PackageName!!Package_LVER!.mum %TU_LCU%\!PackageName_N!.mum %_Null2%
    )
    (for %%i in (%TP_N%\*.cat) do (
       call :SplitName_Package %%i
       set /p LVER=
       set PackageName_N=%%~ni
      
       echo.
        echo ========================================================================================================
        echo Modded: !PackageName!
       echo         !LVER! ---^> !Package_LVER!
        echo ========================================================================================================
    
            echo.
            echo Compress Modded !SSU_Name!.cab
            echo.
            pushd %~dp0%TU%\!SSU_Name!
            %~dp0files\cabarc.exe -m LZX:21 -r -p N %~dp0!LCU_Name!_!SVER!\update\ssu\!SSU_Name!.cab *.* >nul
            popd
            echo.
            echo Modded %Modded_Parent% Package
            echo.
            set TP_N=files\Package_%Modded_Parent%_!SVER!
            call Modded_CU_Package.cmd !LVER! !SVER! %Modded_Parent% %~dp0%TU%\!LCU_Name! %~dp0%TP% %~dp0!TP_N! !CU_BuildNumber!
    
        ) else (
            copy /y %TU%\SSU-*.cab !LCU_Name!_!SVER!\update\ssu
        )
    
        echo.
        echo Compress !LCU_Name!.psf and !LCU_Name!.win to !LCU_Name!.esd
        echo.   
        rem del /q %TU%\!LCU_Name!\*.psf.cix.xml
        files\wimlib-imagex capture %TU%\!LCU_Name! .\!LCU_Name!_!SVER!\update\lcu\!LCU_Name!.esd !LCU_Name! --check --solid
      
    )
    
    echo.   
    xcopy .\!LCU_Name!_!SVER! .\files /e /y /h
    
    rem if EXIST temp (rd /s /q temp)
    
    
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    set end=%time%
    set options="tokens=1-4 delims=:.,"
    for /f %options% %%a in ("%start%") do set start_h=%%a&set /a start_m=100%%b %% 100&set /a start_s=100%%c %% 100&set /a start_ms=100%%d %% 100
    for /f %options% %%a in ("%end%") do set end_h=%%a&set /a end_m=100%%b %% 100&set /a end_s=100%%c %% 100&set /a end_ms=100%%d %% 100
    
    set /a hours=%end_h%-%start_h%
    set /a mins=%end_m%-%start_m%
    set /a secs=%end_s%-%start_s%
    set /a ms=%end_ms%-%start_ms%
    if %ms% lss 0 set /a secs = %secs% - 1 & set /a ms = 100%ms%
    if %secs% lss 0 set /a mins = %mins% - 1 & set /a secs = 60%secs%
    if %mins% lss 0 set /a hours = %hours% - 1 & set /a mins = 60%mins%
    if %hours% lss 0 set /a hours = 24%hours%
    if 1%ms% lss 100 set ms=0%ms%
    
    :: Mission accomplished
    set /a totalsecs = %hours%*3600 + %mins%*60 + %secs%
    echo.
    echo Mission took %hours%:%mins%:%secs%.%ms% (%totalsecs%.%ms%s total)
    echo.
    echo.
    ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
    
    
    :END
    
    pause
    exit
    
    not working, cmd just open & close.
     
  2. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,861
    1,521
    60
    enough time wasted on MSU_to_esd_and_Modded_CU, in the bin it goes, shame could have been an excellent tool.
     
  3. xinso

    xinso MDL Guru

    Mar 5, 2009
    13,685
    14,419
    340
  4. xinso

    xinso MDL Guru

    Mar 5, 2009
    13,685
    14,419
    340
  5. febrero2048

    febrero2048 MDL Member

    Oct 19, 2017
    114
    72
    10
  6. xinso

    xinso MDL Guru

    Mar 5, 2009
    13,685
    14,419
    340
  7. xinso

    xinso MDL Guru

    Mar 5, 2009
    13,685
    14,419
    340
    #13609 xinso, Nov 30, 2023
    Last edited: Nov 30, 2023
    Sorry. I don't. Oh. HP Smart. No, I have no idea about it. It installed itself on 22621.3. But not on the latest UBR.
     
  8. zwl29107

    zwl29107 MDL Addicted

    Jul 10, 2022
    600
    700
    30
    This is Microsoft's problem, it not only appears on 22621.3. It has nothing to do with reconstruction.
     
  9. febrero2048

    febrero2048 MDL Member

    Oct 19, 2017
    114
    72
    10
    I have published the full code with the changes that the creator has indicated https://forums.mydigitallife.net/th...struction-project.80939/page-681#post-1816656, in case someone is interested in those modifications.
     
  10. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,861
    1,521
    60
  11. febrero2048

    febrero2048 MDL Member

    Oct 19, 2017
    114
    72
    10
    Why, what?
    Do not agree that I have published the complete code, or what sense do the changes have?
     
  12. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,861
    1,521
    60
    what sense do the changes have ?
     
  13. febrero2048

    febrero2048 MDL Member

    Oct 19, 2017
    114
    72
    10
    #13617 febrero2048, Nov 30, 2023
    Last edited: Nov 30, 2023
    If in a mum file, all packages are 25398.1, the name of the mum file I think it should be 25398.1 (and no exist in update file, it´s already in the OS to update).
    And the modification of the SSU solves the error update 25398.1 IoT Enterprise S en-us.
     
  14. Ace2

    Ace2 MDL Expert

    Oct 10, 2014
    1,861
    1,521
    60
    #13618 Ace2, Nov 30, 2023
    Last edited: Dec 1, 2023
    anyone can mod SSU manually, its two file, CU mod is where the magic is needed.
     
  15. xinso

    xinso MDL Guru

    Mar 5, 2009
    13,685
    14,419
    340
    #13619 xinso, Nov 30, 2023
    Last edited: Nov 30, 2023
    News about your 25398.531 language packs? KB5032202.esd won't work for me. This is the reason why I tried to get language experience packs. Thanks.

    PS:
    KB5032202.esd can be installed, but Icon and Item on Settings do not match. e.g. Icon A shown\worked as Item B.
     
  16. Wuyouzi067

    Wuyouzi067 MDL Novice

    Oct 4, 2023
    31
    76
    0
    @febrero2048, You can use and correct modify my code, but you can not publish and disseminate my code like this, please delete.

    And #13607 I explicitly modify Modded_CU_Package.cmd 202311241750 line 47-62 , you didn't modify it correctly.