# [Tutorial]How reinstall/uninstall cab



## the_R4K_ (Jul 20, 2017)

Hi, if you try install the cab's on your w10m you can get the errors. Sometimes package can be installed incorrectly. Today I show you how reinstall cab package.

*WARNING: IT'S IMPORTANT SYSTEM PART, YOU CAN GET BOOT LOOP.*

you need:
PC with telnet;
device on w10m build higer 10586;
interopTools;

Let's go:
//if you don't have telnet and reg.exe(if you have go to 2)
1. you need get ssh access https://forum.xda-developers.com/windows-10-mobile/guide-filesystem-access-sftp-windows-10-t3185766
(interopTools have section about this. you need: set password, allow tmp cmd access, allow application running)
download attachment file and extract it
upload it on you device in documents directory.
connect over ssh(telnet if installed) and go to documents directory
enter: install
(it's installing: telnetd,ftpd,bootsh,reg,xcopy,reboot,shutdown)

2. (optional)(or not if you try remove package)
PS1: I think if you try reinstall package, files be rewrited automaticly. but i not sure...
PS2: try ignore this step, if next instalation be failed try do this step

 now you need find cab file which you tryed install and extract it(can use 7z)
open .manifest file, whom name consist mainos1

// only if you removing package
it's registry editions doed by this package you can try restore it back.
but facticaly you need remove only drivers and services 
for edit registry use reg.exe because interopTools can't remove some keys
// only if you removing package

open .mum file with notepad++(or other program with color xml code)
you find list of files, like this
<file name="..." cabPath=".." />
for you intrested field "name" - it's path to this file in system
you need try remove this files(if you can't delete some file ignore it =) )

3. open cmd.exe on your PC and enter telnet "phoneIp"
now you need remove keys, use "reg.exe delete"
keys to delete you can find in key:
HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Component Based Servicing\PackageIndex\
and 
HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\
here keys of all installed packages
in final you get command like this:
reg delete "HKEY_LOCAL_MACHINE\software\Microsoft\Windows\CurrentVersion\Component Based Servicing\Packages\PACKAGENAME"
then reboot

//for install package agin
4. connect over telnet, agin)
cd /windows/servicing
UpdateApp.exe getinstalledpackages
if in this list no your package, you doed step 3 correctly
now you can upload correct cab file and enter this command:
updateApp install "fullPathToCab"
PS dont try write in c:\windows\servicing

good luck!


----------



## spavlin (Jul 20, 2017)

```
UpdateApp - Update Application for Windows Mobile

[B]UpdateApp.exe install[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Installs the list of packages to the existing/mounted image. Same as stage + commit.
	Note: this may cause a device reboot.
[B]UpdateApp.exe installinprocnoreboot[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Same as stageinproc + commit noreboot.
[B]UpdateApp.exe installfromsdinprocnoreboot [/B]<path to package/actionlist> <path to package/optional actionlist root> ...
	Installs the list of packages to the existing/mounted image. Same as stagetosdinproc + commit noreboot.
[B]UpdateApp.exe installfromsd[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Installs the list of packages to the existing/mounted image. Same as stagetosd + commit.
	Note: this may cause a device reboot.
[B]UpdateApp.exe mountandinstall[/B] <path to image> <path to package/actionlist> <path to package/optional actionlist root> ...
	Mounts the given image, runs the 'install' path, then dismounts the image.
	Note: this may cause a device reboot.
[B]UpdateApp.exe stage[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Stages the list of packages to the image.
	Can also be a single action list ending in .xml.
	Use the commit option afterwards.
[B]UpdateApp.exe stageinproc[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Stages the list of packages to the image in proc instead of via service.
	Can also be a single action list ending in .xml.
	Use the commit option afterwards.
[B]UpdateApp.exe stagetosd[/B] <path to package/actionlist> <path to package/optional actionlist root> ...
	Stages the list of packages to the SD card.
	Can also be a single action list ending in .xml.
	Use the commit option afterwards.
[B]UpdateApp.exe stagetosdinproc [/B]<path to package/actionlist> <path to package/optional actionlist root> ...
	Stages the list of packages to the SD card in proc instead of via service.
	Can also be a single action list ending in .xml.
	Use the commit option afterwards.
[B]UpdateApp.exe commit [/B][migratedata] [noreboot]
	Commits a previously staged update to the image.
	data migration will run only if specified.
	Note: this may cause a device reboot unless noreboot is specified.
[B]UpdateApp.exe cleanup[/B]
	Cleans up all update-related files.
[B]UpdateApp.exe renamepackages [/B] <folder>
	Renames filenames to PackageName.cab. Useful for renaming numbered cabs or mangled filenames.
[B]UpdateApp.exe getinstalledpackages[/B]
	Prints all installed packages in the image to the console.
[B]UpdateApp.exe loadlibrary [/B]<dll>
	Loads the library given in the path. Good to test downlevel compatibility.
[B]UpdateApp.exe compress[/B] <file/folder> [compress (default)|decompress] [recursive for folder]
	Compresses the file at the given path, or if a folder, all files within the folder, optionally recursive.
[B]UpdateApp.exe getlatestpayload[/B] <existing payload dir> <root of udpates> <output folder> <canonical|canonical_paper>
	Loads the existing payload and copies files with identical names out of the update root to the output folder.
	Root of updates for a diff is the v2\<build>, while for canonical/canonical_paper use v2\common.
[B]UpdateApp.exe precommitfixup[/B]
	Saves the last boot committed information after a warm boot.
[B]UpdateApp.exe postcommitfixup[/B]
	Fixes up merged REG_BINARIES and Capabilities.
[B]UpdateApp.exe getupdateresults[/B]
	Get update result from the last commit.

Any option that has a list of packages supports wildcard mode.
Example: UpdateApp.exe [install|installwithcopy|mountandinstall <path to vhd>|stage] <path to directory with packages>
A directory alone will include all files in the directory non-recursively, this is equivalent to <directory> *
```


```
D:\>C:\Windows\servicing\UpdateApp.exe install D:\BackUp\*.cab 
UpdateApp - Update Application for Windows Mobile

Staging update...
[00:00:00] Generated new CbsLite session ID: {632E4775-694B-448E-B997-BE4E65F0372C}
[00:00:00] Entered IUPhase Staging
[00:00:00] Entered IUSubphase Default
[00:00:00] Staging progress: 1%
[00:00:00] UpdateDLL: Staging update.
[00:00:00] Cleaning staging root.
[00:00:00]  - UpdateOS dismounted.
[00:00:00]  - StagingRoot cleaned.
[00:00:00]  - Default StagingRoot cleaned.
[00:00:00] Entered IUSubphase WimMount
[00:00:07] onecore\base\cbs\mobile\iucore\iustore.cpp, IUStore::MountPendingUpdateOS, line 707, Failed to mount UpdateOS WIM at '\\?\U:\USERS\System\AppData\Local\UpdateStagingRoot\Pending_UPDATEOS.wim' to '\\?\U:\USERS\System\AppData\Local\UpdateStagingRoot\UPDATEOS_Mount', error is 0x80070522
[00:00:07] Staging progress: 5%
[00:00:07] onecore\base\cbs\mobile\iucore\iustore.cpp, IUStore::AddPackage, line 472, Failed to add partition updateos, error is 0x80070522
[00:00:07] onecore\base\cbs\mobile\iucore\iustore.cpp, IUStore::AddPackage, line 419, Failed to add package \\?\U:\SharedData\DuShared\PackagesToInstall\*.cab, error is 0x80070522
[00:00:07] onecore\base\cbs\mobile\updatedll\lib\updatemain.cpp, UpdateMain::ReadConfig, line 252, Failed to add package \\?\U:\SharedData\DuShared\PackagesToInstall\*.cab to store, error is 0x80070522
[00:00:07] onecore\base\cbs\mobile\updatedll\lib\prepareupdate.cpp, UpdateMain::PrepareUpdate, line 102, Failed to read input file, error is 0x80070522
[00:00:07] Cleaning staging root.
[00:00:07]  - UpdateOS dismounted.
[00:00:07]  - StagingRoot cleaned.
[00:00:07]  - Default StagingRoot cleaned.
[00:00:07] UpdateDLL: Staging completed unsuccessfully
[00:00:07] hr = 0x80070522
[00:00:07] Output file written to: \\?\U:\SharedData\DuShared\UpdateOutput.xml
[00:00:08] Staging failed at: 5% progress
[00:00:08] UpdateDLL: Performance Measures:
[00:00:08] 	Total staging time: seconds = 8 (tickcount=8281)

failed, error is 0x80070522. Internal storage bytes required: 0, SD bytes required: 0

install completed unsuccessfully
hr = 0x80070522
```


----------



## nate0 (Jul 20, 2017)

Thanks for posting this.  

Also @spavlin thanks for the extra tool info for updateapp.exe.

I recently pushed an incorrect .cab file to a phone, or so I thought...Iutool will not let you send the same package again if an already higher version one is there or the same version number is there.  I found also that if you have full filesystem access you can go to path C:\Windows\servicing\Packages and remove the associated .cat and .mum file for .cab/package file you sent.  This will then let you resend the same package or different version of the same .cab/package again.


----------



## the_R4K_ (Jul 20, 2017)

nate0 said:


> Thanks for posting this.
> 
> Also @spavlin thanks for the extra tool info for updateapp.exe.
> 
> I recently pushed an incorrect .cab file to a phone, or so I thought...Iutool will not let you send the same package again if an already higher version one is there or the same version number is there.  I found also that if you have full filesystem access you can go to path C:\Windows\servicing\Packages and remove the associated .cat and .mum file for .cab/package file you sent.  This will then let you resend the same package or different version of the same .cab/package again.

Click to collapse



this directory can be protected for write. more correctly edit registry


----------



## nate0 (Jul 20, 2017)

Correct and why I worded what I wrote with "if".  Most folks pushing cabs to their phones are familiar with interop unlocking anyway so figured I would mention that even if it was already known.  

Edit: Also I only had to reinstall the same services just different version. I see now your instructions aid in removing everything (drivers reg settings etc.).


----------



## nate0 (Jul 22, 2017)

Are we using the user system/LocalSystem for this access (telnet/ssh)?


----------



## the_R4K_ (Jul 22, 2017)

nate0 said:


> Are we using the user system/LocalSystem for this access (telnet/ssh)?

Click to collapse



yes, because other defApps don't have access to same folders and registry values.


----------

