From f5a0a63165d9e6b57719f48322baac60e29a2e6a Mon Sep 17 00:00:00 2001 From: WindowsAddict Date: Tue, 15 Apr 2025 08:39:39 +0530 Subject: [PATCH] Cleanup leftover branding.xml related code --- MAS/All-In-One-Version-KL/MAS_AIO.cmd | 61 ++----------------- .../Activators/Ohook_Activation_AIO.cmd | 15 ----- .../Activators/Online_KMS_Activation.cmd | 41 ++----------- .../Activators/TSforge_Activation.cmd | 15 ----- 4 files changed, 12 insertions(+), 120 deletions(-) diff --git a/MAS/All-In-One-Version-KL/MAS_AIO.cmd b/MAS/All-In-One-Version-KL/MAS_AIO.cmd index 4410980..fc5db47 100644 --- a/MAS/All-In-One-Version-KL/MAS_AIO.cmd +++ b/MAS/All-In-One-Version-KL/MAS_AIO.cmd @@ -2608,7 +2608,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -2862,20 +2861,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]" @@ -4790,7 +4780,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -4910,9 +4899,6 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - if exist "%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) else if exist "%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( @@ -4924,12 +4910,6 @@ call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -10951,7 +10931,7 @@ set _prids= set _config= set _version= set _License= -set _oBranding= +set _oMSI= exit /b ::======================================================================================================================================== @@ -11033,7 +11013,7 @@ exit /b for %%# in (%_oIds%) do ( set skipprocess= -if %_NoEditionChange%==1 if not defined _oBranding ( +if %_NoEditionChange%==1 if not defined _oMSI ( set foundprod= call :ksdata chkprod %%# if not defined foundprod ( @@ -11082,7 +11062,7 @@ if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic call :dk_inskey "[!key!] [!_prod!]" ) else ( -if not defined _oBranding ( +if not defined _oMSI ( set error=1 call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" call :dk_color %Blue% "Make sure you are using Latest MAS script." @@ -11105,6 +11085,7 @@ exit /b :: Process Office MSI Version call :ks_reset +set _oMSI=1 if "%1"=="14" ( call :dk_actids 59a52881-a989-479d-af46-f275c6370663 @@ -11125,21 +11106,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - -call :ksdata getmsiprod %2 -call :msiofficedata %2 getmsiret +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -12159,18 +12130,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) @@ -12443,7 +12409,7 @@ if /i "%2"=="%%D" ( set key=%%B set _actid=%%A set _allactid=!_allactid! %%A -) else if not defined _oBranding if %_NoEditionChange%==0 ( +) else if not defined _oMSI if %_NoEditionChange%==0 ( echo: %%E | find /i "-%2-" %nul% && ( set key=%%B set _altoffid=%%D @@ -12453,21 +12419,6 @@ set _allactid=!_allactid! %%A ) ) -if %1==getmsiprod if "%oVer%"=="%%C" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%D | find /i "Visio" %nul% && set prodId=0057 -) -reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) -) -) -) - ) ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd index e97586c..04b78db 100644 --- a/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd +++ b/MAS/Separate-Files-Version/Activators/Ohook_Activation_AIO.cmd @@ -823,7 +823,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -1077,20 +1076,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - call :msiofficedata %2 echo: echo Activating Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found, aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found, aborting activation...]" @@ -2475,18 +2465,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) diff --git a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd index 6c652a2..d8759e2 100644 --- a/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/Online_KMS_Activation.cmd @@ -1029,7 +1029,7 @@ set _prids= set _config= set _version= set _License= -set _oBranding= +set _oMSI= exit /b ::======================================================================================================================================== @@ -1143,7 +1143,7 @@ exit /b for %%# in (%_oIds%) do ( set skipprocess= -if %_NoEditionChange%==1 if not defined _oBranding ( +if %_NoEditionChange%==1 if not defined _oMSI ( set foundprod= call :ksdata chkprod %%# if not defined foundprod ( @@ -1192,7 +1192,7 @@ if not "!key!"=="" ( echo "!allapps!" | find /i "!_actid!" %nul1% || call :oh_installlic call :dk_inskey "[!key!] [!_prod!]" ) else ( -if not defined _oBranding ( +if not defined _oMSI ( set error=1 call :dk_color %Red% "Checking Product In Script [Office %oVer%.0 !_prod! not found in script]" call :dk_color %Blue% "Make sure you are using Latest MAS script." @@ -1215,6 +1215,7 @@ exit /b :: Process Office MSI Version call :ks_reset +set _oMSI=1 if "%1"=="14" ( call :dk_actids 59a52881-a989-479d-af46-f275c6370663 @@ -1235,21 +1236,11 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - -call :ksdata getmsiprod %2 -call :msiofficedata %2 getmsiret +call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -3450,18 +3441,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) ) @@ -3734,7 +3720,7 @@ if /i "%2"=="%%D" ( set key=%%B set _actid=%%A set _allactid=!_allactid! %%A -) else if not defined _oBranding if %_NoEditionChange%==0 ( +) else if not defined _oMSI if %_NoEditionChange%==0 ( echo: %%E | find /i "-%2-" %nul% && ( set key=%%B set _altoffid=%%D @@ -3744,21 +3730,6 @@ set _allactid=!_allactid! %%A ) ) -if %1==getmsiprod if "%oVer%"=="%%C" ( -for /f "tokens=*" %%x in ('findstr /i /c:"%%A" "%_oBranding%"') do set "prodId=%%x" -set prodId=!prodId:"/>=! -set prodId=!prodId:~-4! -if "%oVer%"=="14" ( -REM Exception case for Visio because wrong primary product ID is mentioned in Branding.xml -echo %%D | find /i "Visio" %nul% && set prodId=0057 -) -reg query "%2\Registration\{%%A}" /v ProductCode %nul2% | find /i "-!prodId!-" %nul% && ( -reg query "%2\Common\InstalledPackages" %nul2% | find /i "-!prodId!-" %nul% && ( -if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) -) -) -) - ) ) exit /b diff --git a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd index 3330a77..7da980b 100644 --- a/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd +++ b/MAS/Separate-Files-Version/Activators/TSforge_Activation.cmd @@ -1499,7 +1499,6 @@ set _prids= set _config= set _version= set _License= -set _oBranding= exit /b ::======================================================================================================================================== @@ -1679,9 +1678,6 @@ set "_common=%CommonProgramFiles%" if defined PROCESSOR_ARCHITEW6432 set "_common=%CommonProgramW6432%" set "_common2=%CommonProgramFiles(x86)%" -for /r "%_common%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" -if not defined _oBranding for /r "%_common2%\Microsoft Shared\OFFICE%oVer%\" %%f in (BRANDING.XML) do if exist "%%f" set "_oBranding=%%f" - if exist "%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( set "pkeypath=%_common%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ) else if exist "%_common2%\Microsoft Shared\OFFICE%oVer%\Office Setup Controller\pkeyconfig-office.xrm-ms" ( @@ -1693,12 +1689,6 @@ call :msiofficedata %2 echo: echo Processing Office... [MSI ^| %_version% ^| %_oArch%] -if not defined _oBranding ( -set error=1 -call :dk_color %Red% "Checking BRANDING.XML [Not Found. Aborting activation...]" -exit /b -) - if not defined _oIds ( set error=1 call :dk_color %Red% "Checking Installed Products [Product IDs not found. Aborting activation...]" @@ -7195,18 +7185,13 @@ for %%# in ( ) do ( for /f "tokens=1-5 delims=_" %%A in ("%%#") do ( -set getIds=1 if "%oVer%"=="%%A" ( -if /i "%2"=="getmsiret" (echo %%D | findstr /i "Volume VL" %nul% && set getIds=) - -if defined getIds ( reg query "%1\Registration\{%%B}" /v ProductCode %nul2% | find /i "-%%C-" %nul% && ( reg query "%1\Common\InstalledPackages" %nul2% | find /i "-%%C-" %nul% && ( if defined _oIds (set _oIds=!_oIds! %%D) else (set _oIds=%%D) ) ) ) -) ) )