[Q] Pause rom building process in EVK - Windows Mobile

Hi
How do I pause the rom building process in EVK? I've tried adding "PAUSE" in kitchen_build_rom.bat, and it shows "Press any key to continue" in the EVK interface but it just continues regardless of whether I press any key or not. I want to pause before imgfsfromdump.exe runs.
Any help would be appreciated,
Thanks

Is this for your Initflashfiles.dat via Mortscript project? I'm guessing you want the kitchen to pause and wait while your external script runs. If it's another batch file, use the CALL command. Otherwise if it's an executable, use START /wait. Either one will pause execution until the called script/program completes. As a test, try inserting "START /WAIT NOTEPAD.EXE" after the last SET statement in kitchen_build_rom.bat and then build a rom - after platformrebuilder.exe finishes, Notepad will open and the kitchen will pause. Close notepad, and the kitchen resumes.
A couple of weeks ago I wrote a quick hack that does this - it's a batch file that auto-generates a .provxml and drops it in the \dump folder before ImgfsFromDump runs. I've attached it here if you'd like to take a look. (Check the comments in AutoVersion.bat)

computhug said:
Is this for your Initflashfiles.dat via Mortscript project? I'm guessing you want the kitchen to pause and wait while your external script runs. If it's another batch file, use the CALL command. Otherwise if it's an executable, use START /wait. Either one will pause execution until the called script/program completes. As a test, try inserting "START /WAIT NOTEPAD.EXE" after the last SET statement in kitchen_build_rom.bat and then build a rom - after platformrebuilder.exe finishes, Notepad will open and the kitchen will pause. Close notepad, and the kitchen resumes.
A couple of weeks ago I wrote a quick hack that does this - it's a batch file that auto-generates a .provxml and drops it in the \dump folder before ImgfsFromDump runs. I've attached it here if you'd like to take a look. (Check the comments in AutoVersion.bat)
Click to expand...
Click to collapse
Awesome! That's exactly what I needed! And yes it is for that project, it doesn't seem to be getting much response though, but I'm still going hehe.

I am using this (I also use a naked initialflashes.dat and cook a provxml file with mortscript in the desktop computer and "inject" it to the rom):
paste it into a file called Start-Wait.cmd. simply include in your kicthen rom bat a line like "Start-Wait yourmortscript.mscr" and the kitchen rom bat will stop until your mscr concludes.
edit: I use this because the call function did not work well for me sometimes and sometimes icons and provxml files did not much (I build the provxml and also copy and zip files...)
Code:
@ECHO OFF
:: NAME
:: Start-Wait.cmd
::
:: SYNOPSIS
:: Suspend script activity as long as the specified program and its sub
:: process are running
::
:: SYNTAX
:: Start-Wait Program SubProcess
:: Start-Wait "Program Arg1 [...]" SubProcess
::
:: DETAILED DESCRIPTION
:: The Start-Wait.cmd batch file suspends script activity as long as the
:: specified program and its sub process are running. You can use it in a
:: batch script to wait for a setup program to complete completely.
::
:: AUTHOR
:: Frank-Peter Schultze
::
:: DATE
:: 17:02 04.04.2008
SETLOCAL ENABLEDELAYEDEXPANSION
IF "%1"=="/?" (
TYPE "%~f0" | findstr.exe /R "^:: "
GOTO :END
)
SET Program=%~1
IF NOT DEFINED Program (
ECHO %~n0 : Cannot bind argument to parameter 'Program' because it is empty.
GOTO :END
)
SET SubProcess=%2
IF NOT DEFINED SubProcess (
ECHO %~n0 : Cannot bind argument to parameter 'SubProcess' because it is empty.
GOTO :END
)
SET IGNOREPIDS=
::----- First, get all PIDs that we don't want to check later by mistake
FOR /F "tokens=2 skip=3" %%i IN (
'tasklist.exe /FI "USERNAME eq %USERDOMAIN%\%USERNAME%" /FI "IMAGENAME eq %SubProcess%"'
) DO (
SET IGNOREPIDS=!IGNOREPIDS! %%~i
)
::----- Start the program and wait for its termination
START /WAIT %Program%
::----- Now, get the PID of the sub process that we need to check
FOR /F "tokens=2 skip=3" %%i IN (
'tasklist.exe /FI "USERNAME eq %USERDOMAIN%\%USERNAME%" /FI "IMAGENAME eq %SubProcess%"'
) DO (
ECHO #%IGNOREPIDS%# | find.exe "%%~i" >NUL || CALL :TASKWAIT %SubProcess% %%~i
)
:END
ENDLOCAL
EXIT /B
::
:TASKWAIT
::
ECHO Sleep 5s . . .
ping.exe -n 6 -w 1000 127.0.0.1 >NUL
tasklist.exe /FI "USERNAME eq %USERDOMAIN%\%USERNAME%" /FI "IMAGENAME eq %1" /FI "PID eq %2" 2>NUL | find.exe "%1" >NUL && GOTO %0
ECHO %1 stopped.
EXIT /B

Your project for mortscript and initflashfiles is interesting... but is over my head... once you get it working let us know in normal language what does it do.
Keep it up

Related

request to developers, kitchen app

Hi guys (girls??)
One thing that is a little annoying when you create a new rom in your kitchen, is that when you add a updatet oem version of in.ex mms or comm manager or w/e is that you manually have to locate the old files and remove them before you can build the rom.
What if it could be devoloped a little prog that remove/replace them automaticly?
I can see that there might be a downside to having such an option, maybe you wanna keep some of the old ones for compability issues, but I was thinking that the program could create a list where you could check what files that you wanna replace and witch ones you wanna keep.
I dont have a big problem removing them myself, but I would not be unhappy having a prog that could do this for me, and I know many other chefs has this on their wishlist aswell
cheers
itje
Little batch file can do the job:
Code:
cls
@echo off
echo Starting to search
echo.
for /f %%a in ('dir /w /b %1') do (
echo Looking for %%a in OEM :
dir /w /b /s oem\%%a
echo.
echo Looking for %%a in SYS :
dir /w /b /s sys\%%a
echo.
echo.
)
save as search.bat in your build folder
launch it by "search.bat (name of folder)" and it will look for every file in oem and sys
bye
aje_fr said:
Little batch file can do the job:
Code:
cls
@echo off
echo Starting to search
echo.
for /f %%a in ('dir /w /b %1') do (
echo Looking for %%a in OEM :
dir /w /b /s oem\%%a
echo.
echo Looking for %%a in SYS :
dir /w /b /s sys\%%a
echo.
echo.
)
save as search.bat in your build folder
launch it by "search.bat (name of folder)" and it will look for every file in oem and sys
bye
Click to expand...
Click to collapse
hahahaha..!
Aje_fr my friend.Smart way use *bat file.Here we go..

[BATCH]CREATEDUMP.BAT - Dumping a NK.BIN made easy

Always frustrated to manually perform these 3 steps
1) viewbin.exe nk.bin => write down START and LENGTH
2) cvrtbin -r -a START -w 32 -l LENGTH nk.bin
3) dumprom.exe -d dump -v -5 nk.nb0
Click to expand...
Click to collapse
needed to dump a NK.BIN? You can get helped by using CREATEDUMP.BAT instead, a one-click-solution.
Supposed you already have folder 'Nkbintools' at your desktop PC, you simply put CREATEDUMP.BAT in folder 'Nkbintools', also copy the NK.BIN file to be dumped into folder 'Nkbintools' and run CREATEDUMP.BAT.
Code:
@ECHO OFF
cls
REM Purpose: This batch file creates complete dump of NK.BIN provided
REM Author: jwoegerbauer
REM Date: 2013-01-03
REM License: GPL v3
REM
:START
if "%~1" == "" (
echo CREATEDUMP.BAT&echo Using NK.BIN in current directory
set nkbin=nk.bin
) else (
set nkbin="%~1"
)
setlocal enabledelayedexpansion
if not exist %nkbin% goto :FAILURE1
REM clean up
if exist viewbin.txt del viewbin.txt
if exist nk.nb0 del nk.nb0
REM determine start and length of NK.BIN
echo Determining exact length of %nkbin% ...
viewbin %nkbin% > viewbin.txt
if not exist viewbin.txt goto :FAILURE2
REM
REM that's how contents of first 2 lines of file viewbin.txt might look
REM ViewBin... nk.bin
REM Image Start = 0x80100000, length = 0x01EDAD34
REM
set start=""
set length=""
for /f "skip=1 tokens=2,4 delims=,=" %%A in (viewbin.txt) do (
set start=%%A
for /f %%N in ("%%A") do set start=%%N
set length=%%B
for /f %%N in ("%%B") do set length=%%N
goto :BREAK
)
:BREAK
if ".%start%" == "." goto :FAILURE3
if ".%length%" == "." goto :FAILURE3
REM convert the nk.bin provided to a nk.nb0
echo Converting %nkbin% to nk.nb0 ...
cvrtbin -r -a %start% -w 32 -l %length% %nkbin% > NUL
if not exist nk.nb0 goto :FAILURE4
REM content of the nk.nb0 will be written in the directory "dump".
REM directory dump must exist, otherwise an error occurs.
mkdir dump > NUL
echo Extracting all files and modules from the kernel&echo This may take some minutes ...
dumprom -d dump -v -5 nk.nb0 > NUL
echo Dumping finshed&echo Dumped files should be in ..\dump&goto :END
:FAILURE1
echo Error:&echo File nk.bin not found&echo Aborting ...&goto :END
:FAILURE2
echo Error:&echo Failed to create file viewbin.txt&echo Aborting ...&goto :END
:FAILURE3
echo Error:&echo Failed to determine image's start and/or length&echo Aborting ...&goto :END
:FAILURE4
echo Error:&echo Failed to create temporary file nk.nb0&echo Aborting ...
:END
endlocal
pause
@ECHO ON
exit
For your convenience I have uploaded the whole 'Nkbintools' package here.
UPDATE:
The Dumprom.exe in 'Nkbintools' package provided sets the 'machine type" for all PE-files dumped as MIPS R4000. Might be that's not what you wanted. Hence you should know that Dumprom.exe contains at offset 0x1E64 the "machine type" for the PE-files it generates.
Examples:
C0 01 => 0x1C0 => ARM
C2 01 => 0x1C2 => ARM Thumb
66 01 => 0x166 => MIPS R4000
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Advice: Simply hex-edit Dumprom.exe ...
And you always can manually rewrite each dumped PE-file's "machine type" using CFF Explorer ...
Enjoy!
corrected [BATCH]CREATEDUMP.BAT - Dumping a NK.BIN made easy
Thanks for the script. Here is the batch working also within Win7 command prompt:
Code:
@ECHO OFF
cls
REM Purpose: This batch file creates complete dump of NK.BIN provided
REM Author: jwoegerbauer
REM Date: 2013-01-03
REM License: GPL v3
REM
:START
if "%~1" == "" (
echo CREATEDUMP.BAT&echo Using NK.BIN in current directory
set nkbin=nk.bin
) else (
set nkbin="%~1"
)
echo Using %nkbin%
REM pause
setlocal enabledelayedexpansion
if not exist %nkbin% goto :FAILURE1
REM clean up
if exist viewbin.txt del viewbin.txt
if exist nk.nb0 del nk.nb0
REM determine start and length of NK.BIN
echo Determining exact length of %nkbin% ...
REM remove double quotes around var as viewbin does not like these
set nkbin=%nkbin:"=%
viewbin.exe %nkbin% > viewbin.txt
REM pause
if not exist viewbin.txt goto :FAILURE2
REM
REM that's how contents of first 2 lines of file viewbin.txt might look
REM ViewBin... nk.bin
REM Image Start = 0x80100000, length = 0x01EDAD34
REM
set start=""
set length=""
for /f "skip=1 tokens=2,4 delims=,=" %%A in (viewbin.txt) do (
set start=%%A
for /f %%N in ("%%A") do set start=%%N
set length=%%B
for /f %%N in ("%%B") do set length=%%N
goto :BREAK
)
:BREAK
if ".%start%" == "." goto :FAILURE3
if ".%length%" == "." goto :FAILURE3
REM convert the nk.bin provided to a nk.nb0
set NKBIN0=%nkbin:.bin=.nb0%
echo Converting %nkbin% to %NKBIN0% ...
cvrtbin -r -a %start% -w 32 -l %length% %nkbin% > NUL
if not exist %NKBIN0% goto :FAILURE4
REM content of the nk.nb0 will be written in the directory "dump".
REM directory dump must exist, otherwise an error occurs.
mkdir dump > NUL
echo Extracting all files and modules from the kernel&echo This may take some minutes ...
dumprom -d dump -v -5 %NKBIN0% > NUL
echo Dumping finshed&echo Dumped files should be in ..\dump&goto :END
:FAILURE1
echo Error:&echo File nk.bin not found&echo Aborting ...&goto :END
:FAILURE2
echo Error:&echo Failed to create file viewbin.txt&echo Aborting ...&goto :END
:FAILURE3
echo Error:&echo Failed to determine image's start and/or length&echo Aborting ...&goto :END
:FAILURE4
echo Error:&echo Failed to create temporary file nb0 file&echo Aborting ...
:END
endlocal
pause
@ECHO ON
REM exit
THANKS

[Guide][WIN-Utility] Porting, adding languages from ROM apk files to another (19/Jul)

This tutorial is going to help ROM chiefs on how to add and integrate different languages and csc codes from different regions in their cooked custom ROM​
Have you ever wanted to port your language across custom ROMs but you don't know how?
Yes after searching the xda, you knew that you need to integrate your language value folder in each ROM apk in order to have your language ported to the custom ROM; however heh, it will be very long journey of decompiling and compiling, making integrating your language value folder in each ROM apk is like a hell..!!
So from this side, I decided to make a tool that will decompile and extract languages values folders and after extracting all values folders from all apks of the same name (e.g, SystemUI.apk) from all ROMs' different regions, you can integrate all languages in one multi-languages apk; making the whole process a much less painful than the manual way..!!
So in short, this tool will add languages from ROM's apk files to another of the same name..
How to use:
1. Run apk-lang-extractor.bat file; this will create all needed folders.
2. Install your ROM dependencies (Only once) by putting them in "put-dependencies-here" folder and choose option #0.
3. Put all same apks from different region ROM's releases in "put-apk-here" folder; you can give them numbers in order to not get confused; ensure no space in apk name (e.g, SystemUI1.apk, SystemUI2.apk, SystemUI3.apk... etc).
4. Set Current-apk for one of them (option #1), and start extracting job (option #2) and do the same for the rest of apk files.
5. Let the apk file that you will integrate all languages in to be the last apk to extract the languages from; this is important to ensure the least error during compiling.
6. After you extracted all languages from all apk files, and being the last extracted apk is set as Current-apk, start languages integrating process (option #3) that will result in one apk file that contains all extracted languages. :laugh:
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Credits:
1. Igor Pavlov: for 7za command line.
2. Brut.all & iBotPeaches: for the awesome apktool.jar :good:
3. atomicdryad: for SignApk.jar
4. Google: for android SDK
and to dedicate the contribution of such elite developers, the credits are shown in the utility splash screen..
- apk-languages-Extractor-Integrator_v1.05 @19/July/2013 - [the most recent]
- apk-languages-Extractor-Integrator_v1.00 @ 17/July/2013 - [old]
Change-log:
@ 19/July/2013 (v1.05):
- Fixed error message during language integration "The process cannot access the file because it is being used by another process".
- Fixed compression function. Now the whole final apk file is compressed by level specified, instead of signature only (my bad!!).
- Fixed open "finished-apk" folder delay after language integrating process.
- Deleting existing signed file apk of same name before signing (no more overlapping).
- New option added in the main menu to link the utility with this thread page (you can check update anytime now).
@ 17/July/2013 (v1.00):
- First release.
You just finished integrating languages values folders in each apk file in your custom ROM; however, we haven't finish porting languages yet..!! Continue with the next post
<<In this post, we will concentrate on making the added languages visible and usable in your cooked ROM. Also we will learn how to add different CSC code regions in the cooked ROM>>​
How to add languages to language display and language input:
1. Navigate to system\csc\common\system\csc folder and open language.xml file. Here we will concentrate in this section:
Code:
<LanguageSet>
[B][COLOR="Blue"]<Display>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for displayed languages[/COLOR][/B]
en_GB;en_US;fr_FR;
ar_AE;fa_FA;ur_PK;
</Display>
[B][COLOR="Blue"]<Input>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for input languages[/COLOR][/B]
<SupportList>
en_GB;en_US;fr;ar;fa;ur;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
for each section you can add iso code language for each region. Here is the code again after applying iso code languages:
Code:
<LanguageSet>
<Display>
en_GB;ar_AE;az_AZ;bg_BG;ca_ES;cs_CZ;da_DK;de_AT;de_CH;de_DE;
el_GR;en_AU;en_IE;en_NZ;en_PH;en_US;en_ZA;es_ES;es_US;et_EE;
eu_ES;f_FI;fa_FA;fr_CH;fr_FR;ga_IE;gl_ES;hr_HR;hu_HU;hy_AM;
in_ID;is_IS;it_IT;ka_GE;kk_KZ;ko_KR;lt_LT;lv_LV;mk_MK;ms_MY;
nb_NO;nl_BE;nl_NL;pl_PL;pt_BR;pt_PT;ro_RO;ru_RU;sk_SK;sl_SI;
sr_RS;sv_SE;th_TH;tr_TR;ur_PK;uk_UA;uz_UZ;vi_VN;zh_CN;zh_HK;
zh_TW;
</Display>
<Input>
<SupportList>
en_GB;ar;az;bg;bn;ca;cs;da;de;el;
en_US;es;et;eu;fa;fi;fr;gl;gu;hi;
hr;hu;hy;id;is;it;ka;kk;kn;ko;
lt;lv;ml;ms;mr;nb;nl;pa;pl;pt;
ro;ru;sk;sl;sr;sv;ta;te;th;tr;
uk;ur;vi;zh_CN;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
of course after extracting a lot of ROMs from specific regions, you can just add their iso code language in your cooked ROM language.xml after having the iso codes from their language.xml files
2. Now copy this modified language.xml and paste it on system\csc directory
3. Now to display language name in your device, you need to decompile ResourceManager.apk and navigate to res\values folder and open strings.xml and add new languages resources strings there in this form:
Code:
<string name="vo_rm_authority">com.visionobjects.resourcemanager</string>
<string name="[B][COLOR="Red"]en_GB[/COLOR][/B]">[B][COLOR="Blue"]English(UK)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]en_US[/COLOR][/B]">[B][COLOR="Blue"]English(US)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]az[/COLOR][/B]">[B][COLOR="Blue"]Azərbaycan[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]ca[/COLOR][/B]">[B][COLOR="Blue"]Català[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]cs[/COLOR][/B]">[B][COLOR="Blue"]Čeština[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]da[/COLOR][/B]">[B][COLOR="Blue"]Dansk[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]de[/COLOR][/B]">[B][COLOR="Blue"]Deutsch[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]et[/COLOR][/B]">[B][COLOR="Blue"]Eesti[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]es[/COLOR][/B]">[B][COLOR="Blue"]Español[/COLOR][/B]</string>
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
Here the red texts are regional iso codes for the added language, and the blue texts are the displayed language name in your device (you can decompile ResourceManager.apk from different ROMs' regions in order to have the iso codes and the corresponding languages strings).
4. Now you need to add input database for different languages. After extracting different ROMs' regions, copy all the content of system\T9DB and paste it in same directory of the ROM that you will make it support different languages.
N.B: To have all input languages activated, you need to add all values folder in the ROM keyboard app for the specific language you want to activate.
Click to expand...
Click to collapse
5. Now you will need to integrate languages data base; after extracting different ROMs' regions, copy all the content of system\hdic folder and paste it in same directory of the ROM that you will make it support different languages.
How to set default language in initial setup wizard:
Go to system\csc folder and open customer.xml and edit this section:
Code:
<Phone>
<DefLanguage>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguage>
<DefLanguageNoSIM>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguageNoSIM>
<DateTimeFormat>
<DateFormat>ddmmyyyy</DateFormat>
</DateTimeFormat>
<VisiblePassword>off</VisiblePassword>
</Phone>
Just change the blue colored iso code and substitute it with your favorite one from language.xml display section
CSC codes:
How to set default csc code:
Go to system\csc\%yourCSCfolder%\system\csc folder and copy all its content (usually contents.db, customer.xml, others.xml, and sales_code.dat) and paste it on system\csc directory.
Alternatively, you can edit the files in system\csc folder that includes:
customer.xml
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
change it to your csc iso code (that is the csc folder name in system\csc folder).
language.xml:
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
the same as change in customer.xml
sales_code.dat
Code:
[B][COLOR="Blue"]KSA[/COLOR][/B]
the same as change in customer.xml
How to add extra CSC codes:
After extracting all CSC folders from different ROMs region, first copy and paste them in system\csc folder then you need to go to system directory and open SW_Configuration.xml and add all CSC folders you just paste:
Code:
<NbCustomer>[B][COLOR="Blue"]67[/COLOR][/B]</NbCustomer> [B][COLOR="Green"]<!-- Here enter how many csc code folders you have in system\csc[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ABS[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFG[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFR[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |--- Here add CSC folders[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ALO[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ARB[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
And now you are ready to create your multi-languages and multi-csc ROM,,
For developers only..!!
Here is all codes I used to build up this utility, any suggestion for improvement is welcomed.. !!
Real CMD codes language used in the utility (v1.05):
Code:
@echo off
setlocal enabledelayedexpansion
COLOR 0A
title [APK LANGUAGES EXTRACTOR TOOL - majdinj - xda]
if (%1)==(0) goto logo
mode con:cols=64 lines=55
echo.
echo.
echo **************************************************
echo **************************************************
echo ** **
echo ** Checking java version... **
echo ** **
echo **************************************************
echo **************************************************
echo.
java -version
IF errorlevel 1 goto errjava
echo.
echo.
echo Java is installed on your machine...
echo.
echo.
ECHO.
ECHO.
ECHO.
echo **************************************************
echo **************************************************
echo ** **
echo ** USED TOOLS, VERSIONS AND CREDITS **
echo ** **
echo **************************************************
echo **************************************************
ECHO.
cd "%~dp0tools"
type versions.txt
echo.
echo WELCOME TO ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR TOOL
ECHO BY: majdinj - XDA-DEVELOPERS.COM
echo.
echo.
echo.
echo.
ECHO.
ECHO.
ECHO.
ECHO.
ECHO.
PAUSE
cd "%~dp0"
set capp=None
set heap=1024
set comp=9
set /A count=0
FOR %%F IN (put-apk-here/*.apk) DO (
set /A count+=1
set tmpstore=%%~nF%%~xF
)
if %count%==1 (set capp=%tmpstore%)
IF NOT EXIST "%~dp0/put-apk-here" mkdir put-apk-here
IF NOT EXIST "%~dp0/put-dependencies-here" mkdir put-dependencies-here
IF NOT EXIST "%~dp0/extracted-languages" mkdir extracted-languages
IF NOT EXIST "%~dp0/finished-apk" mkdir finished-apk
IF NOT EXIST "%~dp0/temp" mkdir temp
echo. >> log.log
echo. >> log.log
echo ---------------------------------------------------------------------------- >> log.log
echo ^|%date% -- %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%^| >> log.log
echo ---------------------------------------------------------------------------- >> log.log
apk-lang-extractor.bat 0 2>> log.log
:logo
cls
COLOR 0A
echo.
echo .- .:`
echo .//. `/+-
echo -/- .+/.
echo .//` ```..--------..``` `:+:
echo `:/--://++++++++++++++++//:.--.
echo `-://++++++++++++++++++++/:-`
echo `-://///++++++++++++++++++:.`
echo `:///////:://+++++++++++++:` `..``
echo `:///////. ./++++++++++:` -/+++/.
echo -///////// /++++++++/. :/++++-
echo -//////////:.``.:++++++++/` `-:/:-
echo -///////////////+++++++++/`
echo .///////////////+++++++++/
echo ////////////////++++++++.
echo ////////////////+++++++:
echo ////////////////++++++:
echo `::::::::::::::::::::::.
echo.
echo **********************************************************
echo **********************************************************
echo * *
echo * ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR *
echo * *
echo * *
echo * BY majdinj - xda *
echo * *
echo **********************************************************
echo **********************************************************
echo.
echo.
echo How to use:
echo -----------
echo 1- Install your ROM dependencies (Only once).
echo 2- Put all same apks from different region ROM's releases in
echo "put-apk-here" folder; you can give them numbers in order
echo to not get confused; ensure no space in apk name.
echo 3- Set Current-apk for one of them, and start extracting job
echo and do the same for the rest of apk files.
echo 4- Let the apk file that you will integrate all languages in
echo to be the last apk to extract the languages from; this is
echo important to ensure the least error during compiling.
echo 5- After you extracted all languages from all apk files, and
echo being the last extracted apk is set as Current-apk, start
echo languages integrating process that will result in one apk
echo file that contains all extracted languages.
echo.
echo Note:
echo -----
echo There is an option to sign your finished apk file, this is
echo an extra step for non system apk ONLY, so you will be able
echo to install the apk on your device.
echo.
PAUSE
:restart
COLOR 0E
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo 7za Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo ANDROID APK LANGUAGES EXTRACTOR AND INTEGRATOR v1.05
echo.
echo --------------------------------------------------------------
echo.
echo 0 - Install Dependencies From "put-dependencies-here"
echo 1 - Set Current-apk From "put-apk-here"
echo.
echo 2 - Extract Language Folders From Current-apk File
echo 3 - Integrate Extracted Languages With Current-apk File
echo 4 - Sign Finished apk (Don't do this if it's a system apk)
echo.
echo 5 - Set Maximum Java Heap Memory Size
echo 6 - Set 7za Archiver Compression Level
echo.
echo 7 - Read Log File
echo 8 - Clean Folders
echo U - Open XDA Utility Thread Page To Check For Update
echo X - Exit
echo.
echo --------------------------------------------------------------
echo.
SET /P menu=Please make your decision: %=%
IF %menu%==0 (goto Install)
IF %menu%==1 (goto SetCapk)
IF %menu%==2 (goto Extract)
IF %menu%==3 (goto Inegrate)
IF %menu%==4 (goto Sign)
IF %menu%==5 (goto heapsize)
IF %menu%==6 (goto compression)
IF %menu%==7 (goto log)
IF %menu%==8 (goto clean)
IF %menu%==U (goto update)
IF %menu%==u (goto update)
IF %menu%==X (goto exit)
IF %menu%==x (goto exit)
::If you got here, it wasn't valid key
echo.
echo ************************************************
echo * Are you crazy.. choose something exist *
echo ************************************************
echo.
pause
goto restart
:Install
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo App Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo WHICH FILE DEPENDENCY DO YOU WANT TO INSTALL
echo.
echo --------------------------------------------------------------
echo.
ECHO 1 - Install framework-res.apk
ECHO 2 - Install twframework-res.apk
ECHO 3 - Install com.htc.resources.apk
ECHO 4 - Install SystemUI.apk
ECHO 5 - Install SemcGenericUxpRes.apk
ECHO 6 - Install lidroid-res.apk
ECHO.
ECHO 7 - Install Other Dependency
ECHO.
ECHO M - Go Back to the MAIN MENU
echo.
echo --------------------------------------------------------------
ECHO.
SET /P menud=Please make your decision: %=%
IF %menud%==1 (goto d1)
IF %menud%==2 (goto d2)
IF %menud%==3 (goto d3)
IF %menud%==4 (goto d4)
IF %menud%==5 (goto d5)
IF %menud%==6 (goto d6)
IF %menud%==7 (goto d7)
IF %menud%==M (goto restart)
IF %menud%==m (goto restart)
::If you got here, it wasn't valid key
echo.
echo ************************************************
echo * *
echo * Are you crazy.. choose something exist *
echo * *
echo ************************************************
echo.
pause
goto Install
:d1
IF NOT EXIST "%~dp0put-dependencies-here/framework-res.apk" (goto Pd1)
IF EXIST "%~dp0put-dependencies-here/framework-res.apk" (goto Yd1)
:Pd1
ECHO.
echo framework-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP1=Any key for YES or n, no for NO: %=%
IF %INPUTP1%==n (goto Install)
IF %INPUTP1%==no (goto Install)
IF %INPUTP1%==nO (goto Install)
IF %INPUTP1%==N (goto Install)
IF %INPUTP1%==No (goto Install)
IF %INPUTP1%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling framework-res.apk from device,,
adb pull system/framework/framework-res.apk "../put-dependencies-here/framework-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying framework-res.apk installation
goto d1
:Yd1
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/framework-res.apk
echo.
echo framework-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d2
IF NOT EXIST "%~dp0put-dependencies-here/twframework-res.apk" (goto Pd2)
IF EXIST "%~dp0put-dependencies-here/twframework-res.apk" (goto Yd2)
:Pd2
ECHO.
echo twframework-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP2=Any key for YES or n, no for NO: %=%
IF %INPUTP2%==n (goto Install)
IF %INPUTP2%==no (goto Install)
IF %INPUTP2%==nO (goto Install)
IF %INPUTP2%==N (goto Install)
IF %INPUTP2%==No (goto Install)
IF %INPUTP2%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling twframework-res.apk from device,,
adb pull system/framework/twframework-res.apk "../put-dependencies-here/twframework-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying twframework-res.apk installation
goto d2
:Yd2
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/twframework-res.apk
echo.
echo twframework-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d3
IF NOT EXIST "%~dp0put-dependencies-here/com.htc.resources.apk" (goto Pd3)
IF EXIST "%~dp0put-dependencies-here/com.htc.resources.apk" (goto Yd3)
:Pd3
ECHO.
echo com.htc.resources.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP3=Any key for YES or n, no for NO: %=%
IF %INPUTP3%==n (goto Install)
IF %INPUTP3%==no (goto Install)
IF %INPUTP3%==nO (goto Install)
IF %INPUTP3%==N (goto Install)
IF %INPUTP3%==No (goto Install)
IF %INPUTP3%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling com.htc.resources.apk from device,,
adb pull system/framework/com.htc.resources.apk "../put-dependencies-here/com.htc.resources.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying com.htc.resources.apk installation
goto d3
:Yd3
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/com.htc.resources.apk
echo.
echo com.htc.resources.apk was installed successfully..
timeout 3 > nul
goto Install
:d4
IF NOT EXIST "%~dp0put-dependencies-here/SystemUI.apk" (goto Pd4)
IF EXIST "%~dp0put-dependencies-here/SystemUI.apk" (goto Yd4)
:Pd4
ECHO.
echo SystemUI.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP4=Any key for YES or n, no for NO: %=%
IF %INPUTP4%==n (goto Install)
IF %INPUTP4%==no (goto Install)
IF %INPUTP4%==nO (goto Install)
IF %INPUTP4%==N (goto Install)
IF %INPUTP4%==No (goto Install)
IF %INPUTP4%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling SystemUI.apk from device,,
adb pull system/app/SystemUI.apk "../put-dependencies-here/SystemUI.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying SystemUI.apk installation
goto d4
:Yd4
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/SystemUI.apk
echo.
echo SystemUI.apk was installed successfully..
timeout 3 > nul
goto Install
:d5
IF NOT EXIST "%~dp0put-dependencies-here/SemcGenericUxpRes.apk" (goto Pd5)
IF EXIST "%~dp0put-dependencies-here/SemcGenericUxpRes.apk" (goto Yd5)
:Pd5
ECHO.
echo SemcGenericUxpRes.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP5=Any key for YES or n, no for NO: %=%
IF %INPUTP5%==n (goto Install)
IF %INPUTP5%==no (goto Install)
IF %INPUTP5%==nO (goto Install)
IF %INPUTP5%==N (goto Install)
IF %INPUTP5%==No (goto Install)
IF %INPUTP5%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling SemcGenericUxpRes.apk from device,,
adb pull system/framework/SemcGenericUxpRes.apk "../put-dependencies-here/SemcGenericUxpRes.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying SemcGenericUxpRes.apk installation
goto d5
:Yd5
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/SemcGenericUxpRes.apk
echo.
echo SemcGenericUxpRes.apk was installed successfully..
timeout 3 > nul
goto Install
:d6
IF NOT EXIST "%~dp0put-dependencies-here/lidroid-res.apk" (goto Pd6)
IF EXIST "%~dp0put-dependencies-here/lidroid-res.apk" (goto Yd6)
:Pd6
ECHO.
echo lidroid-res.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP6=Any key for YES or n, no for NO: %=%
IF %INPUTP6%==n (goto Install)
IF %INPUTP6%==no (goto Install)
IF %INPUTP6%==nO (goto Install)
IF %INPUTP6%==N (goto Install)
IF %INPUTP6%==No (goto Install)
IF %INPUTP6%==NO (goto Install)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling lidroid-res.apk from device,,
adb pull system/framework/lidroid-res.apk "../put-dependencies-here/lidroid-res.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying lidroid-res.apk installation
goto d6
:Yd6
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/lidroid-res.apk
echo.
echo lidroid-res.apk was installed successfully..
timeout 3 > nul
goto Install
:d7
echo.
echo Type the dependency file name without apk extension.
set /P OTHER=Type Entery: %=%
IF NOT EXIST "%~dp0put-dependencies-here/%OTHER%.apk" (goto Pd7)
IF EXIST "%~dp0put-dependencies-here/%OTHER%.apk" (goto Yd7)
:Pd7
ECHO.
echo %OTHER%.apk was not found in "put-dependencies-here"
echo folder. Do you want to pull it from your device?
set /P INPUTP7=Any key for YES or n, no for NO: %=%
IF %INPUTP7%==n (goto Install)
IF %INPUTP7%==no (goto Install)
IF %INPUTP7%==nO (goto Install)
IF %INPUTP7%==N (goto Install)
IF %INPUTP7%==No (goto Install)
IF %INPUTP7%==NO (goto Install)
echo.
echo From which system folder you want to pull it from?
set /P INPUTP8=Type any key for FRAMEWORK, or type (a) for APP folder: %=%
IF %INPUTP8%==a (goto Pd7a)
IF %INPUTP8%==A (goto Pd7a)
IF %INPUTP8%==(a) (goto Pd7a)
IF %INPUTP8%==(A) (goto Pd7a)
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling %OTHER%.apk from device,,
adb pull system/framework/%OTHER%.apk "../put-dependencies-here/%OTHER%.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying %OTHER%.apk installation
goto Yd7
:Pd7a
echo.
cd "%~dp0tools"
ECHO Waiting for device USB connection...
adb kill-server
adb wait-for-device
ECHO.
ECHO Pulling %OTHER%.apk from device,,
adb pull system/app/%OTHER%.apk "../put-dependencies-here/%OTHER%.apk"
if errorlevel 1 (goto err_adb)
ECHO.
echo System pull complete.. Killing ADB..
adb kill-server
ECHO.
echo ADB killed.. Retrying %OTHER%.apk installation
goto Yd7
:Yd7
echo.
cd "%~dp0tools"
echo Installing dependencies,,
java -Xmx%heap%M -jar apktool.jar if %~dp0put-dependencies-here/%OTHER%.apk
echo.
echo %OTHER%.apk was installed successfully..
timeout 3 > nul
goto Install
:Extract
if %capp%==None goto noproject1
::to ensure having empty temp folder
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo ************************************************
echo * *
echo * Extracting Languages Process,, *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo A. Decompiling %capp%,,
java -Xmx%heap%M -jar apktool.jar d "../put-apk-here/%capp%" "../temp/%capp%"
IF errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo B. Extracting languages values from %capp%,,
::Extracting all folders that start with value name
cd "%~dp0"
FOR /d %%a in (temp\%capp%\res\value*) Do XCOPY %%a "extracted-languages\%%a" /S /Y /I /Q > nul
xcopy "%~dp0extracted-languages\temp\%capp%\res\*" "%~dp0extracted-languages\" /S /Y /I /Q > nul
rmdir /S /Q %~dp0extracted-languages\temp > nul
timeout 2 > nul
rmdir /S /Q temp
mkdir temp
echo.
goto OpenExtract
:eek:penExtract
echo.
echo Finished %capp% languages extracting...
echo All extracted values-folder from the apk file are saved in:
echo "extracted-languages" folder.
echo.
echo Do you want to open the "extracted-languages" folder?
set /P INPUT4=Any key for YES or n, no for NO: %=%
IF %INPUT4%==n (goto :restart)
IF %INPUT4%==no (goto :restart)
IF %INPUT4%==nO (goto :restart)
IF %INPUT4%==N (goto :restart)
IF %INPUT4%==No (goto :restart)
IF %INPUT4%==NO (goto :restart)
start "" "%~dp0/extracted-languages/"
goto restart
:Inegrate
if %capp%==None goto noproject1
IF EXIST "%~dp0/finished-apk/system_%capp%" (del /Q "%~dp0\finished-apk\system_%capp%")
::to ensure having empty temp folder
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo ************************************************
echo * *
echo * Integrating Languages Into apk Process,, *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo A. Decompiling %capp%,,
java -Xmx%heap%M -jar apktool.jar d "../put-apk-here/%capp%" "../temp/%capp%"
IF errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo B. Integrating extracted languages into %capp%,,,
xcopy "..\extracted-languages" "..\temp\%capp%\res" /S /Y /I /Q > nul
timeout 2 > nul
echo.
echo C. Compiling the new %capp%,,
java -Xmx%heap%M -jar apktool.jar b "../temp/%capp%" "..\temp\New_%capp%"
if errorlevel 1 (goto error)
timeout 2 > nul
echo.
echo D. Copying original signature and compressing the final apk,,,
:::::Extracting signature from original apk file:::::
7za x -o"../temp/tempOr" "../put-apk-here/%capp%" META-INF -r > nul
7za x -o"../temp/tempOr" "../put-apk-here/%capp%" AndroidManifest.xml -r > nul
:::::Extracting the new apk file for original signature integration and compression:::::
:::::1.Extracting the new apk...
7za x -o"../temp/tempAPK" "../temp/New_%capp%" -r > nul
:::::2.Copying original signature from tempOr to tempAPK...
xcopy "..\temp\tempOr" "..\temp\tempAPK" /S /Y /I /Q > nul
:::::3.Compressing the whole tempAPK folder into new2 compressed apk file...
7za a -tzip "../temp/New2_%capp%" "../temp/tempAPK/*" -mx%comp% -r > nul
if errorlevel 1 (goto error)
timeout 2 > nul
echo.
ECHO E. Zipaligning the final %capp%,,
zipalign -f 4 "%~dp0temp\New2_%capp%" "%~dp0finished-apk\system_%capp%" > nul
if errorlevel 1 (goto error)
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
echo DONE.. Your file is saved in "finished-apk" Folder as:
echo system_%capp%
goto OpenFinish
:eek:penFinish
echo.
echo Do you want to open the "finished-apk" folder?
set /P INPUT2=Any key for YES or n, no for NO: %=%
IF %INPUT2%==n (goto :restart)
IF %INPUT2%==no (goto :restart)
IF %INPUT2%==nO (goto :restart)
IF %INPUT2%==N (goto :restart)
IF %INPUT2%==No (goto :restart)
IF %INPUT2%==NO (goto :restart)
start "" "%~dp0/finished-apk/"
goto restart
:Sign
if %capp%==None goto noproject1
IF NOT EXIST "%~dp0/finished-apk/system_%capp%" (goto :SignError)
IF EXIST "%~dp0/finished-apk/signed_%capp%" (del /Q "%~dp0\finished-apk\signed_%capp%")
echo.
echo ************************************************
echo * *
echo * Signing Finished apk With New Signature. *
echo * *
echo ************************************************
echo.
cd "%~dp0tools"
echo Signing system_%capp%,,
java -Xmx%heap%M -jar signapk.jar -w testkey.x509.pem testkey.pk8 "../finished-apk/system_%capp%" "../finished-apk/signed_%capp%"
if errorlevel 1 (goto error)
echo.
echo DONE.. Your file is saved in "finished-apk" Folder as:
echo signed_%capp%
goto OpenFinish
:SetCapk
cls
echo.
echo --------------------------------------------------------------
echo Please select a file from the list bellow to
echo be set as Current-apk in "put-apk-here" folder
echo --------------------------------------------------------------
echo.
set /A count=0
FOR %%F IN (put-apk-here/*.apk) DO (
set /A count+=1
set a!count!=%%F
if /I !count! LEQ 9 (echo ^- !count! - %%F )
if /I !count! GTR 9 (echo ^- !count! - %%F )
)
echo.
echo.
echo --------------------------------------------------------------
echo (Any letter or other number to return back to MAIN MENU)
echo --------------------------------------------------------------
ECHO.
set /P INPUT3=Please Enter The File Number: %=%
if /I %INPUT3% GTR !count! (goto non1)
if /I %INPUT3% LSS 1 (goto non1)
set capp=!a%INPUT3%!
set jar=0
set ext=jar
IF "!capp:%ext%=!" NEQ "%capp%" set jar=1
goto restart
:non1
set capp=None
goto restart
:clean
cls
cd "%~dp0"
echo Date: %date%
echo Time: %TIME:~0,2%:%TIME:~3,2%:%TIME:~6,2%
echo.
echo Java Heap Memory Size: %heap% MB
echo App Compression Level: %comp%
echo.
echo Current-apk: %capp%
echo.
echo --------------------------------------------------------------
echo.
echo CLEANING MENU
echo.
echo --------------------------------------------------------------
echo.
echo 1 - Clean "put-apk-here" Folder
echo 2 - Clean "put-dependencies-here" Folder
echo 3 - Clean "extracted-languages" Folder
echo 4 - Clean "finished-apk" Folder
echo 5 - Clean "temp" Folder
echo.
echo 6 - Clean All Working Folders
echo.
echo M - Go Back To The MAIN MENU
echo.
echo.
echo --------------------------------------------------------------
echo.
SET /P menuc=Please make your decision: %=%
IF %menuc%==1 (goto pfhf)
IF %menuc%==2 (goto fd)
IF %menuc%==3 (goto el)
IF %menuc%==4 (goto ff)
IF %menuc%==5 (goto tf)
IF %menuc%==6 (goto allf)
IF %menuc%==M (goto restart)
IF %menuc%==m (goto restart)
[user=228282]@Rem[/user] If you got here, it wasn't valid key
echo.
echo ************************************************
echo * *
echo * Are you crazy.. choose something exist *
echo * *
echo ************************************************
echo.
pause
goto clean
:pfhf
rmdir /S /Q put-apk-here
mkdir put-apk-here
echo.
echo "put-apk-here" folder is cleaned.
echo.
pause
set capp=None
goto clean
:fd
rmdir /S /Q put-dependencies-here
mkdir put-dependencies-here
echo.
echo "put-dependencies-here" folder is cleaned.
echo.
pause
goto clean
:el
rmdir /S /Q extracted-languages
mkdir extracted-languages
echo.
echo "extracted-languages" folder is cleaned.
echo.
pause
goto clean
:ff
rmdir /S /Q finished-apk
mkdir finished-apk
echo.
echo "finished-apk" folder is cleaned.
echo.
pause
goto clean
:tf
rmdir /S /Q temp
mkdir temp
echo.
echo "temp" folder is cleaned.
echo.
pause
goto clean
:allf
rmdir /S /Q put-apk-here
rmdir /S /Q put-dependencies-here
rmdir /S /Q extracted-languages
rmdir /S /Q finished-apk
rmdir /S /Q temp
mkdir put-apk-here
mkdir put-dependencies-here
mkdir extracted-languages
mkdir finished-apk
mkdir temp
echo.
echo All working folders are cleaned.
echo.
pause
set capp=None
goto clean
:heapsize
echo.
echo Enter maximum java heap size in megabytes (16-1400)
set /P INPUTH=(default 1024): %=%
set heap=%INPUTH%
if "%INPUTH%"=="" (set heap=1024)
if /I %INPUTH% GTR 1400 (set heap=1400)
if /I %INPUTH% LSS 16 (set heap=16)
goto restart
:compression
echo.
echo Enter Compression Level For 7za Archiver (0-9)
set /P INPUTCO=(default 9): %=%
set comp=%INPUTCO%
if "%INPUTCO%"=="" (set comp=9)
if /I %INPUTCO% GTR 9 (set comp=9)
if /I %INPUTCO% LSS 0 (set comp=0)
goto restart
:noproject1
echo.
echo *************
echo * ERROR *
echo *************
echo.
echo Please Set Current-apk. (Option 1)
echo.
echo.
PAUSE
goto restart
:SignError
echo.
echo *************
echo * ERROR *
echo *************
echo.
echo There is no system_%capp% file in "finished-apk" folder
echo.
echo.
PAUSE
goto restart
:error
echo.
echo "An Error Occured, Check The log File (option 7)"
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
echo.
PAUSE
goto restart
:err_adb
echo.
adb kill-server
adb kill-server
ECHO "An Error Occured, Please Check The Log (option 7)"
echo.
cd "%~dp0"
rmdir /S /Q temp
mkdir temp
PAUSE
goto restart
:errjava
COLOR 0C
CLS
echo.
echo.
echo.
echo **************************************************
echo **************************************************
echo ** **
ECHO ** Java was not found,,,, **
echo ** You will not be able to use this tool, **
echo ** until you install Java environment **
echo ** **
echo **************************************************
echo **************************************************
echo.
echo.
echo.
PAUSE
goto logo
:log
cd "%~dp0/tools"
Start "[APK LANGUAGES EXTRACTOR TOOL - majdinj - xda] READING LOG FILE FROM" logscript 1
goto restart
:update
echo.
echo Opening XDA Utility Thread Page,,, Please Wait,,,
timeout 2 > nul
start http://forum.xda-developers.com/showthread.php?p=43669667#post43669667
goto restart
:exit
echo.
echo.
echo.
echo.
echo Bye Bye, see ya later :)
echo.
echo.
echo.
timeout 3
EXIT
Nice tool, I'll test it for a next release. ^_^
It seems there is error code in the script that throw some error messages in the utility,,
I will look at it very soon,,
At work on the moment,,, but within hours hopefully, the fix will be online
New update added:
@ 19/July/2013 (v1.05) change-log:
- Fixed error message during language integration "The process cannot access the file because it is being used by another process".
- Fixed compression function. Now the whole final apk file is compressed by level specified, instead of signature only (my bad!!).
- Fixed open "finished-apk" folder delay after language integrating process.
- Deleting existing signed file apk of same name before signing (no more overlapping).
- New option added in the main menu to link the utility with this thread page (you can check update anytime now).
so so so..thank you so much, i need this tool at a long time..
sir, in my rom nothing language.xml file.
how to fixed that?
my device SGY Duos.
Thanks.
wawan999 said:
sir, in my rom nothing language.xml file.
how to fixed that?
my device SGY Duos.
Thanks.
Click to expand...
Click to collapse
You need to search the corresponding xml that contains all languages in system\csc folder.. It could be named with different name..!!
Can this use for MIUI V5 to add multi-language support?
thanks
Ruling said:
Can this use for MIUI V5 to add multi-language support?
thanks
Click to expand...
Click to collapse
Why not..!!! All what this tool did, is just combine all languages values of the specific same apk files into one multi-languages apk file of that specific type.
Very Helpful .Thanks mate for this :thumbup: .
A lil' suggestion ..please Include post #3 in Hide tags ...its soo big
majdinj said:
Why not..!!! All what this tool did, is just combine all languages values of the specific same apk files into one multi-languages apk file of that specific type.
Click to expand...
Click to collapse
Thank you
thank you so much, i need this tool at a long time.
thank pro. how to edit or sing files sec_csc.zip.
:good: great tool
kermage said:
:good: great tool
Click to expand...
Click to collapse
Can this tool sign sec_csc.zip to flash through the stock 3e? Thanks Pro
Hi, how can i export language.xml from S5 (international) add import to USA S5 ?
because Samsung removed my languages support on the new updates, the US variants used to languages-less.
http://forum.xda-developers.com/galaxy-s5/help/languages-missing-s5-t2833249
majdinj said:
<<In this post, we will concentrate on making the added languages visible and usable in your cooked ROM. Also we will learn how to add different CSC code regions in the cooked ROM>>​
How to add languages to language display and language input:
1. Navigate to system\csc\common\system\csc folder and open language.xml file. Here we will concentrate in this section:
Code:
<LanguageSet>
[B][COLOR="Blue"]<Display>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for displayed languages[/COLOR][/B]
en_GB;en_US;fr_FR;
ar_AE;fa_FA;ur_PK;
</Display>
[B][COLOR="Blue"]<Input>[/COLOR][/B] [B][COLOR="Green"]<!-- This section is for input languages[/COLOR][/B]
<SupportList>
en_GB;en_US;fr;ar;fa;ur;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
for each section you can add iso code language for each region. Here is the code again after applying iso code languages:
Code:
<LanguageSet>
<Display>
en_GB;ar_AE;az_AZ;bg_BG;ca_ES;cs_CZ;da_DK;de_AT;de_CH;de_DE;
el_GR;en_AU;en_IE;en_NZ;en_PH;en_US;en_ZA;es_ES;es_US;et_EE;
eu_ES;f_FI;fa_FA;fr_CH;fr_FR;ga_IE;gl_ES;hr_HR;hu_HU;hy_AM;
in_ID;is_IS;it_IT;ka_GE;kk_KZ;ko_KR;lt_LT;lv_LV;mk_MK;ms_MY;
nb_NO;nl_BE;nl_NL;pl_PL;pt_BR;pt_PT;ro_RO;ru_RU;sk_SK;sl_SI;
sr_RS;sv_SE;th_TH;tr_TR;ur_PK;uk_UA;uz_UZ;vi_VN;zh_CN;zh_HK;
zh_TW;
</Display>
<Input>
<SupportList>
en_GB;ar;az;bg;bn;ca;cs;da;de;el;
en_US;es;et;eu;fa;fi;fr;gl;gu;hi;
hr;hu;hy;id;is;it;ka;kk;kn;ko;
lt;lv;ml;ms;mr;nb;nl;pa;pl;pt;
ro;ru;sk;sl;sr;sv;ta;te;th;tr;
uk;ur;vi;zh_CN;
</SupportList>
<EnableList>
</EnableList>
</Input>
</LanguageSet>
of course after extracting a lot of ROMs from specific regions, you can just add their iso code language in your cooked ROM language.xml after having the iso codes from their language.xml files
2. Now copy this modified language.xml and paste it on system\csc directory
3. Now to display language name in your device, you need to decompile ResourceManager.apk and navigate to res\values folder and open strings.xml and add new languages resources strings there in this form:
Code:
<string name="vo_rm_authority">com.visionobjects.resourcemanager</string>
<string name="[B][COLOR="Red"]en_GB[/COLOR][/B]">[B][COLOR="Blue"]English(UK)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]en_US[/COLOR][/B]">[B][COLOR="Blue"]English(US)[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]az[/COLOR][/B]">[B][COLOR="Blue"]Azərbaycan[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]ca[/COLOR][/B]">[B][COLOR="Blue"]Català[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]cs[/COLOR][/B]">[B][COLOR="Blue"]Čeština[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]da[/COLOR][/B]">[B][COLOR="Blue"]Dansk[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]de[/COLOR][/B]">[B][COLOR="Blue"]Deutsch[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]et[/COLOR][/B]">[B][COLOR="Blue"]Eesti[/COLOR][/B]</string>
<string name="[B][COLOR="Red"]es[/COLOR][/B]">[B][COLOR="Blue"]Español[/COLOR][/B]</string>
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
Here the red texts are regional iso codes for the added language, and the blue texts are the displayed language name in your device (you can decompile ResourceManager.apk from different ROMs' regions in order to have the iso codes and the corresponding languages strings).
4. Now you need to add input database for different languages. After extracting different ROMs' regions, copy all the content of system\T9DB and paste it in same directory of the ROM that you will make it support different languages.
5. Now you will need to integrate languages data base; after extracting different ROMs' regions, copy all the content of system\hdic folder and paste it in same directory of the ROM that you will make it support different languages.
How to set default language in initial setup wizard:
Go to system\csc folder and open customer.xml and edit this section:
Code:
<Phone>
<DefLanguage>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguage>
<DefLanguageNoSIM>[B][COLOR="Blue"]ar_AE[/COLOR][/B]</DefLanguageNoSIM>
<DateTimeFormat>
<DateFormat>ddmmyyyy</DateFormat>
</DateTimeFormat>
<VisiblePassword>off</VisiblePassword>
</Phone>
Just change the blue colored iso code and substitute it with your favorite one from language.xml display section
CSC codes:
How to set default csc code:
Go to system\csc\%yourCSCfolder%\system\csc folder and copy all its content (usually contents.db, customer.xml, others.xml, and sales_code.dat) and paste it on system\csc directory.
Alternatively, you can edit the files in system\csc folder that includes:
customer.xml
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
change it to your csc iso code (that is the csc folder name in system\csc folder).
language.xml:
Code:
<SalesCode>[B][COLOR="Blue"]KSA[/COLOR][/B]</SalesCode>
the same as change in customer.xml
sales_code.dat
Code:
[B][COLOR="Blue"]KSA[/COLOR][/B]
the same as change in customer.xml
How to add extra CSC codes:
After extracting all CSC folders from different ROMs region, first copy and paste them in system\csc folder then you need to go to system directory and open SW_Configuration.xml and add all CSC folders you just paste:
Code:
<NbCustomer>[B][COLOR="Blue"]67[/COLOR][/B]</NbCustomer> [B][COLOR="Green"]<!-- Here enter how many csc code folders you have in system\csc[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ABS[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFG[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]AFR[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |--- Here add CSC folders[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ALO[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
<CustomerData src="/Customer/[B][COLOR="Blue"]ARB[/COLOR][/B]/customer.xml" />[B][COLOR="Green"] |[/COLOR][/B]
..
..
[B][COLOR="Green"]and so on[/COLOR][/B]
And now you are ready to create your multi-languages and multi-csc ROM,,
Click to expand...
Click to collapse
salam alaikom
but lanuage.xml not found in my phone
even i show hiden files
hi @majdinj can you put new apktool for this tool or tell my how to update? i put apktool 2.2.2 in tool dir but get error when decompiling?

Hacking Clarity Ensemble phone

The Clarity Ensemble phone is an Android-based captioning land-line phone. The newest model has an 8" touchscreen. Older model has 7" touchscreen. It comes with an app that runs at startup and keeps you from gaining access to the Android home screen or any other Android apps or settings. While booting up you momentarily see the time and can pull down to touch on Settings and bring up the regular Android settings but very soon as the boot process continues the splash screen and later the ThorB app will take over the screen.
In order to telnet to the device, you first need to start telnetd running on the Ensemble. This can be done by configuring your computer to appear to the Ensemble to be the update server. I directly connected the phone to a laptop Ethernet port. On the laptop, I installed a DHCP server, a DNS server, and a web server. I am running Windows and I used "DHCP Server for Windows" version 2.5.1, ApateDNS, and WWebserver with PHP 5.4.45. I set the laptop to a static IP of 8.8.4.4 since Wireshark revealed that the Ensemble was using that as the DNS server. I set ApateDNS server to return 8.8.4.4 as the IP address for all queries.
In my htdocs folder, I created a directory called thorbfota and inside that a directory called purple_prod. Inside purple_prod I created three files, download_file.php, query_site.php, and query_versions.php.
Code:
<?php
//download_file.php
ignore_user_abort(true);
set_time_limit(0);
//Replace with actual path to your files
$path = "C:/Users/User/Documents/ClarityEnsembleFiles/";
$dl_file = preg_replace("([^\w\s\d\-_~,;:\[\]\(\).]|[\.]{2,})", '', $_GET['filename']);
$dl_file = filter_var($dl_file, FILTER_SANITIZE_URL);
$fullPath = $path.$dl_file;
if ($fd = fopen ($fullPath, "r")) {
$fsize = filesize($fullPath);
$path_parts = pathinfo($fullPath);
$ext = strtolower($path_parts["extension"]);
switch ($ext) {
case "pdf":
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "bin":
header("Content-type: application/octet-stream");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "zip":
header("Content-type: application/zip");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
case "apk":
header("Content-type: application/vnd.android.package-archive");
header("Content-Disposition: attachment; filename=\"".$path_parts["basename"]."\"");
break;
//Add more headers for other content types here
default;
header("Content-type: application/octet-stream");
header("Content-Disposition: filename=\"".$path_parts["basename"]."\"");
break;
}
header("Content-length: $fsize");
header("Cache-control: private");
while(!feof($fd)) {
$buffer = fread($fd, 2048);
echo $buffer;
}
}
fclose ($fd);
exit;
Code:
<?php
//query_site.php
//This forum would not allow me to post links since this is my first post.
//Feel free to move the "h" below right up against the "ttp..."
echo "h" . "ttp://clarityengineering.us/thorbfota/purple_prod/";
?>
Code:
<?php
//query_versions.php
//Replace with actual path to your files
$path = "C:/Users/User/Documents/ClarityEnsembleFiles/";
//Replace file versions with your current version numbers
//To cause phone to update a file, use a number larger that the current version
$file = "ThorB.apk";
$file_ver = "2.63";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "thorb-ota.zip";
$file_ver = "20150305.182516";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "dcx.bin";
$file_ver = "b033";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\r";
$file = "eep.bin";
$file_ver = "be25";
$fullPath = $path.$file;
echo $file . "=" . $file_ver . "," . strtoupper(md5_file($fullPath)) . "|\n";
echo "survey=0,0|";
?>
I found that eep.bin was actually just a shell script that is downloaded to the device and run as root. I put my update files in "C:\Users\User\Documents\ClarityEnsembleFiles" but you can put them anywhere you like, just make sure to update the php files above to reflect their location. So far I have only used eep.bin but to keep my php script happy I also created placeholder files, dcx.bin, thorb-ota.zip, and ThorB.apk and placed them with eep.bin in my ClarityEnsembleFiles folder. Below is my eep.bin that starts telnet and simulates pressing the Home button. Just touch "Home Sample" when the "Complete action using" window pops up on the Ensemble. The semicolon at the end of the line avoids having the carriage return kill the command. Alternatively, you could run dos2unix on the eep.bin file and not need the semicolon at the line end.
Code:
#eep.bin
telnetd -l /system/bin/sh;am start -a android.intent.action.MAIN -c android.intent.category.HOME;
Every time you change the eep.bin file and want to run it on the phone make sure to close the Software upgrade screen and touch "Check now" button and then "Upgrade" button.
To install apps on the phone, first download the apk file to the phone with wget and then run "pm install -r YourApp.apk".
I have not found a physical Home, Back or Menu button on the phone so one of the first things you may want to install is a software solution for those. I installed "To Home" and it didn't work when configured with the root option for "Floating Buttons". It works fine when configured with the non-root option for "Floating Buttons". I have not tried any of the several other soft button apps available.
There is a 14 pin connector on the underside of the phone that presumably is used in the factory to connect to a dock for programming. I have not investigated the function of any of the pins but I suspect USB is there as well as possibly serial port(s) and maybe JTAG.
Before connecting the phone to the internet, you probably will want to either disable/uninstall the ThorB.apk app or create a firewall on the phone or on your router to keep it from being able to automatically update and from being able to report back to it's maker.
Besides being available for purchase, the phone is also available from ClearCaptions at no charge if you provide them with a 3rd party certification of being hard of hearing.
As far as using the phone, "Federal law prohibits anyone but registered users with hearing loss from using this device with the captions on." So if your hearing it fine, make sure to turn captions off or don't turn them on.
Telnet is great but I wanted a more secure connection to the phone so I set up an Android cross-compiler and compiled the latest version of dropbear (dropbear-2016.73). I don't have a 64-bit computer so in order to use the latest version of the Android toolchain, I had to boot into Windows and install Cygwin.
Thanks to serasihay for patches to an earlier version of dropbear. I adapted them to work with the latest version of dropbear. The patch can be found by searching dropbear-2016.73-android-20160427.patch on pastebin. Most of the warnings generated during compile were from pre-patched dropbear code and can be viewed on pastebin by searching for "Compile warnings for compiling dropbear-2016.73.android"
After setting up the toolchain, dropbear can be compiled with the following commands:
Code:
tar jxf dropbear-2016.73.tar.bz2
cd dropbear-2016.73
patch -p1 < /path/to/patch/dropbear-2016.73-android-20160426.patch
./configure --build=x86-windows --host=arm-linux-androideabi --disable-zlib --disable-largefile --disable-loginfunc --disable-shadow --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx --disable-pututline --disable-pututxline --disable-lastlog
make MULTI=1 SCPPROGRESS=1 PROGRAMS="dropbear dropbearkey scp dbclient"
arm-linux-androideabi-strip.exe dropbearmulti
This generates a single binary file, dropbearmulti which you will want to copy to the phone to /system/xbin/dropbearmulti. Next, you will want to create symbolic links like this:
Code:
cd /system/xbin
ln -s dropbearmulti dbclient
ln -s dropbearmulti dropbear
ln -s dropbearmulti dropbearkey
ln -s dropbearmulti scp
I should probably redo the patch to enable the -R option to create the host keys but for now you can do it with:
Code:
mkdir /etc/dropbear
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
dropbearkey -t ecdsa -f /etc/dropbear/dropbear_ecdsa_host_key
dropbearkey -t rsa -f /etc/dropbear/dropbear_rsa_host_key
To start dropbear every time the phone boots, I put my startup command in /system/etc/install-recovery.sh since it is called by init.rc. I would have put it straight in init.rc but init.rc is recreated from boot.img every boot and I didn't feel like getting into changing boot.img yet. Just make sure to make install-recovery.sh executable. The following line is what I use to start dropbear:
Code:
dropbear -A -N root -R /data/.ssh/authorized_keys -U 0 -G 0
Next you will need to copy your public key(s) into /data/.ssh/authorized_keys. You should now be able to ssh to your Clarity Ensemble phone. You can also use scp to copy files to and from the phone. If you use Putty pscp to transfer files, make sure to use the -scp option to force SCP protocol. If not, you will get the error "/usr/libexec/sftp-server: not found" since pscp tries to use sftp which is not installed on the phone.
So can you post a video or pics of what the device screen looks like now? can you actually use the device as a tablet?

Development Create your own Windows 11 modded ISO image

Hi!
This was not my idea! It belongs to @jenneh, i only had done trough batch files.
You need to create this batchs files bellow:
But first you need to do this:
* Need Notepad++ to be easy to read files.
* Use MediaCreationToolW11.exe and download ISO image or create a Pendrive with system.
* Extract from ISO or Pendrive all in to a work folder on descktop
* Batchs will request administrator permissions.
* At end delete/cut what ever, the batch files and any other extra file, that you see inside the work folder.
* Done!
This are the batchs files:
1- First one it show the images inside install.esd file and the option the select and work on one. ( Copy to inside the work folder)
Spoiler: 1-Preparing_and_extracting_img.bat
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [43m[31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
mkdir %~dp0ISO
powershell.exe Dism /Get-WimInfo /WimFile:"%~dp0sources\install.esd"
@echo. & set /p index=" Type Image Index number to extract image: "
powershell.exe Dism /export-image /SourceImageFile:"%~dp0sources\install.esd" /SourceIndex:%index% /DestinationImageFile:"%~dp0ISO\install.esd" /Compress:max /CheckIntegrity
pause
2- Second one will mount the image and ask if you want to add a windows key to image.( Copy to inside the work folder)
Spoiler: 2-Mount_Windows_image.bat
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [43m[31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
@echo. & @echo Doing backup from stock install.esd windows image to desktop.
@echo To rollbackp delete install.esd file from sources folder and paste stock install.esd file. & @echo.
mkdir %userprofile%\Desktop\install.esd_backup
move /y "%~dp0sources\install.esd" "%userprofile%\Desktop\install.esd_backup\install.esd"
move /y "%~dp0ISO\install.esd" "%~dp0sources\install.esd"
mkdir "%~dp0PATH"
dism.exe /mount-wim /wimfile:"%~dp0sources\install.esd" /mountdir:"%~dp0PATH" /index:1 /CheckIntegrity
@echo. & @echo.
:repeat
set /p ask= " type 1 to add a key, type 0 to exite: "
if /i %ask% EQU 0 (goto exit)
if /i %ask% EQU 1 (goto key) else (goto repeat)
:key
set /p key=" Insert Windows Key here if you have it: "
dism.exe /Image:%~dp0PATH /Set-ProductKey:%key%
:exit
@echo. & @echo Press any key to exit
pause >nul
exit
3-In this one you can check the Optional Features windows state then use batch to enable or disable them, but some of them aren't possible to change state, it gives error.( Copy to inside the work folder)
Spoiler: 3-Enable_Disable_options.bat
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [43m[31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
:start
cls
@echo. & @echo Open WindowsOptionalFeature.txt to check Optional Feature state & @echo.
Timeout /t 3 >nul
powershell.exe Get-WindowsOptionalFeature -Path "%~dp0PATH" > WindowsOptionalFeature.txt
type WindowsOptionalFeature.txt
@echo.
set /p Feature=" Optional Feature name:-"
set /p state=" Enable or disable ? -"
powershell.exe %state%-WindowsOptionalFeature -Path "%~dp0PATH" -FeatureName "%Feature%"
@echo. & @echo Press any key to continue. & pause >nul
goto start
3.1- This one Will Install or remove apps from Windows image, you can install apps from windows app Store in Windows Offline image.( Copy to inside the work folder)
Spoiler: 3.1-Add_or_remove_Apps_to_Offline_Windows_Image.bat
Code:
@echo off
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [43m[31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
@echo. & @echo [43m[31mAdd apps to offline Windows image. [4m[1mImage must be mounted![0m
@echo. & @echo [41mOpenning Windows App Store...[0m & @echo Press any key to coninue... & pause >nul
start "windows_app_store" https://www.microsoft.com/pt-pt/store/apps/windows
@echo. & @echo [1mFind your app and copy link.[0m
@echo. & @echo [41mOppening https://store.rg-adguard.net/ to [1m[4mget app link to download without install it.[0m & @echo Press any key to coninue... & pause >nul
start "store_rg-adguard.net/" https://store.rg-adguard.net/
@echo. & @echo [1m[31 PPaste the link you copy from App Store in store.rg-adguard.net link bar, select Retail and search links.[0m
@echo. & @echo [1mDownload to desktop [1m[4m[31mthe right [103mappx or appxbundle[0m [31mversion that match your windows version[0m, example for Windows 64 bits download x64 [31m[103mappx or appxbundle[0m version.
@echo [33m Note: * If download doesn t show the extencion just paste the name, to check extencion do right click and check app propertys.
@echo * Some apps have more than 1 package, The app package and its dependencies like Frameworks or VClibs as example.[0m
rem Lets start...
@echo.
dism.exe /Image:%~dp0PATH /Get-ProvisionedAppxPackages >ProvisionedAppxPackages.txt
@echo. & @echo Installed packages:
type %~dp0ProvisionedAppxPackages.txt
:repeat
@echo.
Set /p option=" Type 1 to remove Appx Packages, type 2 to add Appx Packages: "
if /i %option% EQU 1 (goto remove)
if /i %option% EQU 2 (goto add) else (goto repeat)
:remove
@echo. [31m
set /p remove=" Type/paste Appx Package name here: "
Dism /Image:%~dp0PATH /Remove-ProvisionedAppxPackage /PackageName:%remove%
@echo. [0m & @echo Press any key to remove more apps!
pause >nul
goto repeat
:add
@echo.
@echo [44mAdding the Apps...[0m
@echo. [33m
set /p app=" Type/Paste the downloaded app name and extension here and press ENTER: "
@echo.
Dism /Image:%~dp0PATH /Add-ProvisionedAppxPackage /PackagePath:%userprofile%\Desktop\%app% /SkipLicense /Region:"all"
@echo. [0m & @echo Press any key to add more apps!
pause >nul
goto repeat
4-This one dismount image.( Copy to inside the work folder)
Spoiler: 4-Dismount_Windows_Image.bat
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [43m[31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
powershell Dismount-WindowsImage -CheckIntegrity -Path "%~dp0PATH" -Save
RD /S /Q ISO >NUL
RD /S /Q PATH >NUL
move WindowsOptionalFeature.txt %userprofile%\Desktop
move ProvisionedAppxPackages.txt %userprofile%\Desktop
pause
5- This one and the last one create a ISO image from Your Windows modded image but first you need to Install Windows_Kits10ADK.
Download this tool, extract and execute: adksetup.zip
After you execute it, in selection window of tools, only select Deployment Tools like image bellow and install:
Spoiler: Selection Window from Windows Assessement and Deployment Kit
View attachment 5543165
After installation is easy, After cleanning your Windows Work folder execute this bat bellow in YOUR DESKTOP, reade what is writted in there to execute it right!!!
Spoiler: 5-Build_ISO.bat
Code:
@echo off
setlocal
CD /d "%~dp0"
cls
@echo. & @echo Building ISO image... & @echo.
Set /p dir=" Type here the Work dir name: " & @echo.
echo oscdimg.exe -m -oc -u2 -udfver102 -bootdata:2#p0,e,bC:\Users\perso\Desktop\%dir%\boot\etfsboot.com#pEF,e,bC:\Users\perso\Desktop\%dir%\efi\microsoft\boot\efisys.bin "C:\Users\perso\Desktop\%dir%" "C:\Users\perso\Desktop\%dir%.iso"|"%systemroot%\system32\cmd.exe" /k "%systemdrive%\Program Files (x86)\Windows Kits\10\Assessment and Deployment Kit\Deployment Tools\DandISetEnv.bat"
@echo. & @echo DONE!!!
pause
exit /b
Is Done!!! Your Image is ready!
But if you want to copy to Pendrive you will need to do one more step, need to spllit image or copy will fail because image will be bigger than 4GB and can´t be copy to fat32 format!
So copy this batch bellow to desktop and execute it, the you will able to copy to Pendrive.
Spoiler: Spliting install.esd to be able to copy to Pendrive
Code:
@echo off & @echo.
:: BatchGotAdmin
:-------------------------------------
REM --> Check for permissions
IF "%PROCESSOR_ARCHITECTURE%" EQU "amd64" (
>nul 2>&1 "%SYSTEMROOT%\SysWOW64\cacls.exe" "%SYSTEMROOT%\SysWOW64\config\system"
) ELSE (
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"
)
REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
@echo. & @echo [31mRequesting administrative privileges...[0m
goto UACPrompt
goto UACPrompt
) else ( goto gotAdmin )
:UACPrompt
echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
set params= %*
echo UAC.ShellExecute "cmd.exe", "/c ""%~s0"" %params:"=""%", "", "runas", 1 >> "%temp%\getadmin.vbs"
"%temp%\getadmin.vbs"
del "%temp%\getadmin.vbs"
exit /B
:gotAdmin
rem :To CD to the location of the batch script file (%0)
CD /d "%~dp0"
@echo. & @echo Splitting install.esd bigger than 4GB
@echo Windows Setup recognizes the two split files with the .SWM file name extensions and uses them to create the new installation.
@echo.
set /p win=" write/paste the root to modded install.win folder here: "
Dism /Split-Image /ImageFile:%win%\install.esd /SWMFile:%win%\install.swm /FileSize:2400 /CheckIntegrity
mkdir %userprofile%\Desktop\backup-install.esd >nul
@echo. & @echo Making backup from old install.esd to descktop backup-install.esd folder
move %win%\install.esd %userprofile%\Desktop\backup-install.esd >nul
@echo. & @echo Done! Press any key to exit
pause >nul
I let you here a video tutorial:
THE END!
Tell me if worked for you to!
Updated 26-02-2022
You can isntall or remove packages from windows.
@Oswald Boelcke Hello Sir, Is it possible on XDA to include a copy all code shortcut in our threads somehow?
I'm testing your stuffs now I just got sidetracked wondering if there was an easier way to copy pasta~!
Cause I feel like if this forum doesnt already have it, we're gonna need it
@persona78
Spoiler: A+++ S Tier
First off, Can I say How Impressed I am with your Dedication and Work!! Also YAY~! A new system for us to learn, Windows Assessment and Deployment Kit!~ I haven't used this one before, how fun!!
You wrote out the instructions very clear and the code in a way that, someone who has never wrote their own Extensive scripts, can read and start to understand what is going on behind the scenes. You also solved our problem of creating the iso there at the end, entirely from Hand Scripting, which is Super Impressive~! I have finished extracting Your batch code and converting it, Hopefully I did everything right here....
How Neat, Windows Assesment and Deployment kit, contains the SDK that I was convinced I could only get through Visual Studio, cause Microsoft Docs kept pushing it~!
I have finally tested the batches, this is tooo dang cool seriously. I had some sort of error at the end I think? I will let you review the footage because this one went slightly over my comprehension. I'm sure this is my fault [User Error] Have any ideas?
I
jenneh said:
@persona78
Spoiler: A+++ S Tier
First off, Can I say How Impressed I am with your Dedication and Work!! Also YAY~! A new system for us to learn, Windows Assessment and Deployment Kit!~ I haven't used this one before, how fun!!
You wrote out the instructions very clear and the code in a way that, someone who has never wrote their own Extensive scripts, can read and start to understand what is going on behind the scenes. You also solved our problem of creating the iso there at the end, entirely from Hand Scripting, which is Super Impressive~! I have finished extracting Your batch code and converting it, Hopefully I did everything right here....
How Neat, Windows Assesment and Deployment kit, contains the SDK that I was convinced I could only get through Visual Studio, cause Microsoft Docs kept pushing it~!
I have finally tested the batches, this is tooo dang cool seriously. I had some sort of error at the end I think? I will let you review the footage because this one went slightly over my comprehension. I'm sure this is my fault [User Error] Have any ideas?
I
Click to expand...
Click to collapse
Hmmm...
I check the video, don't understand for sure what is the bug, maybe copy paste failed, maybe is better to upload de batch files and paste links!
But tomorrow, I'm going to bed, work early tomorrow.
persona78 said:
Hmmm...
I check the video, don't understand for sure what is the bug, maybe copy paste failed, maybe is better to upload de batch files and paste links!
But tomorrow, I'm going to bed, work early tomorrow.
Click to expand...
Click to collapse
Yes I think that would be a great idea.. I'm sure I did something wrong and I'll try again later as well!
jenneh said:
Yes I think that would be a great idea.. I'm sure I did something wrong and I'll try again later as well!
Click to expand...
Click to collapse
Hi!
@jenneh I copy the batchs 1 more time before upload the batch himselfe.
Try now.
jenneh said:
@Oswald Boelcke Hello Sir, Is it possible on XDA to include a copy all code shortcut in our threads somehow?
Click to expand...
Click to collapse
Hello, thanks for pinging me. However, I don't understand what you mean. Are you talking about BB Codes (but I assume most likely not):
BB codes
The list of BB codes you can use to spice up the look of your messages. This page shows a list of all BB codes that are available.
forum.xda-developers.com
If you like contact me by PM although I'm not convinced I'd be able to help. But we wouldn't clutter this thread with off-topic posts.
Regards
Oswald Boelcke
Oswald Boelcke said:
Hello, thanks for pinging me. However, I don't understand what you mean. Are you talking about BB Codes (but I assume most likely not):
BB codes
The list of BB codes you can use to spice up the look of your messages. This page shows a list of all BB codes that are available.
forum.xda-developers.com
If you like contact me by PM although I'm not convinced I'd be able to help. But we wouldn't clutter this thread with off-topic posts.
Regards
Oswald Boelcke
Click to expand...
Click to collapse
Hi!
I think he means to add a copy all icon in code window, like that it will be easier to copy all code without the need of selecting all.
I'm going to pm, I'm sorry for cluttering the thread and Thanks to XDA for always being kind with us sillys that diidn't read or comprehend the rules here~!
Updated!
I had a video tutorial on main post.
Spoiler: SUCCESS
It was user error on my part, I was finally able to get everything programmed using just your batch scripts~! Thank You so much for taking the time to do this. This is such a great learning resource~!

Categories

Resources