[XAP][SOURCE][ROOT] XapHandler (RELEASE for Root Tools or full-unlock!)

Search This thread

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Hi folks,

FIRST RELEASE:
Wow, lots of bugs that needed fixing. There are still some things I'd like to improve, but they can wait. This is officially the first release of XapHandler, for stock ROMs with WP7 Root Tools, and optionally for custom ROMs as well.

INSTRUCTIONS:
1) Install XapHandler.
2) Run WP7 Root Tools.
3) Pivot to Policies, and set XapHandler as trusted (stock ROMs only).
4) Run XapHandler.
5) When prompted to set the file association, hit OK.
6) Exit XapHandler.
7) Open a XAP file from email, IE, or an app.
8) Check the data about the app given in XapHandler.
9) If the app is already installed and you want to do a clean install, exit XapHanderl and delete the app from your phone normally, then open the XAP file again.
10) Hit the Clean Install or Update button.
11) Wait for the Success message box.
12) Close XapHandler.

SOURCE CODE:
I don't have permission to release the actual XAP installation source code, which is from @ultrashot. Therefore, the source release just contains a pre-compiled static library (it's the same code as is used in the native XAP installer on custom ROMs, and the Bazaar app). You're able to build the full app, though.

The app has two parts: the native ARM DLL that has the COM library and does the actual installation, and the C#/Silverlight WP7 app that provides the UI and calls the COM library. You should unpack both parts to the same folder. Then, build the native part first (requires Visual Studio 2008 with the Windows Mobile 6.5 compiler). This will copy the native DLL into the managed app. Make sure the managed app includes the COM DLL, and then build it to produce a XAP file.

PROBLEMS:
If you have any issues, please report the following info:
A) Your phone model.
B) Your ROM (including version and firmware)
C) The problems or exception messageboxes you encountered.

RESTORING THE REGISTRY:
For stock ROMs, if you want to put the registry back the way it was so XAP files open in the built-in XAP handler of your custom ROM:
1) Open a registry editor
2) Go to HKEY_CLASSES_ROOT (HKCR)\.xap
3) Change the default value back to what it used to be
3.1) The original value on most custom ROMs should be "xapfile" which is the same value the app uses; don't panic if it's unchanged!
3.2) The old default value *should* be backed up in a registry value simply called "0"
4) If there's a value called 0, delete it
5) Go to HKCR\<originalClassName>
5.1) For most people, that's HKCR\xapfile
6) Change the default value back to what it used to be
6.1) The original value on most custom ROMs should be empty
6.2) This step is not important; the value is cosmetic and intended for the user
6.3) The old default value *should* be backed up in a registry value simply called "0"
7) If there's a value called 0, delete it
8) If you have a registry key called BrowseInPlace (eg. HKCR\xapfile\BrowseInPlace) you can delete it
8.1) I don't *think* it'll hurt anything if left, though
9) Set the registry value EditFlags to DWORD 65536 (0x00010000)
9.1) This value is set by release versions of XapHandler
9.2) If the value is missing, create it with the data listed above
10) Go into the registry keys "shell", "open", and "command"
10.1) For example, HKCR\xapfile\shell\open\command
11) Change the default value back to what it used to be
11.1) The default value on most custom ROMs should be "XAPDeployer.exe "%1"" (remove first and last quotes)
11.3) The old default value *should* be backed up in a registry value simply called "0"
12) If there's a value called 0, delete it
13) If you had to change anything in step 3, go to HKCR
13.1) Don't do this step if you didn't have to change anything in step 3!
14) Delete HKCR\xapfile and all its contents
14.1) This step isn't needed, just cleanup
14.2) Don't do this step unless you had a different original progID than "xapfile"!

Have fun!

Please feel free to include this app in WP7 homebrew collections or custom ROMs, so long as the Author attribution is not removed.

Total downloads of the test versions: 330.
 

Attachments

  • XapHandler.xap
    71 KB · Views: 86,031
  • XapHandler.zip
    1.3 MB · Views: 34,786
Last edited:

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Big Thanks to useful reports, of course!

I'm also looking at releasing an app that allows people to edit their file associations on the phone - things like add new filetypes that will open in Word (works for any plain-text file), or do complex things like "open" a Mobi file by putting it in the Kindle app's isostore, then launching the Kindle app. That will build on some of the work done in this app. It's also related to some stuff for the next version of Root Webserver. I really want to figure out what's going on here, though...
 

voluptuary

Senior Member
Dec 29, 2010
960
753
Mukwonago
a.) Samsung Focus v1.3
b.) My ROM (see sig) firmware 2124.11.9.4
c.) xapfile
d.) no change, errors: system.io.filenotfoundexception the system can not find the specified at xaphandler.xapdeployerinterop.setfileassociation() and so on and on then crashes to home screen
e.) reboot changes nothing, no other steps apply.
 
  • Like
Reactions: GoodDayToDie

ultrashot

Inactive Recognized Developer
May 26, 2009
1,478
2,046
St.Petersburg
Mozart
5.13-based custom rom (fully unlocked of course)
FileNotFound exception when trying to associate, IndexOutOfRangeException when trying to launch xap (after manual association)
 

Attachments

  • xaphandler-error.jpg
    xaphandler-error.jpg
    36.8 KB · Views: 1,266
  • Like
Reactions: GoodDayToDie

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Thanks, guys. I know where the error is for you - I took a shortcut testing for the existence of certain registry entries and didn't check for FileNotFound, which I should have. Expect a new version in a day or so!
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
XapDeploy.exe can't be used on stock ROMs until we break the policy system to allow homebrew executables. This app runs under TskHost.exe, like any other executable. Using WP7 Root Tools v0.9, it should be possible to run this app on stock ROMs.

Additionally, it's an alternative to XapDeploy.exe for users of custom ROMs. It displays more info about the XAP before installing it - not enough in any way to prevent Trojan malware, but enough to stop you from accidentally installing v1.15 when you wanted 1.16.
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Please do post test results for the second test version. I still can't get it working on my phone, but I want to know if it works on a full-unlock - if not, there's a bug in the app, but if so then the issue is in the way I elevate. Please give it a try!
 
  • Like
Reactions: pdaimatejam

ultrashot

Inactive Recognized Developer
May 26, 2009
1,478
2,046
St.Petersburg
Please do post test results for the second test version. I still can't get it working on my phone, but I want to know if it works on a full-unlock - if not, there's a bug in the app, but if so then the issue is in the way I elevate. Please give it a try!
OOM exception while checking association, on minimizing-resuming it asks for associating (and does it correctly), but then SUCCESS on installation :)
 

Attachments

  • xaphandler-oom.jpg
    xaphandler-oom.jpg
    38.7 KB · Views: 209
  • xaphandler-operamobile.jpg
    xaphandler-operamobile.jpg
    21.1 KB · Views: 231

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Now *that* is bloody weird; even without elevation the app gets further than that. This happens when you open a XAP file after associating the app with XAP files, right? (Was it really too much to ask that people actually provide a proper report?) There's only two places that the app uses GetResourceStream - one to open the XAP file, and one to open the manifest from within the XAP file.

I've made some changes to the app, which should make it more resilient to unexpected parameters and will hopefully help make the GetResourceStream calls less likely to fail. Please remove any manual file association you created for the app (set it back to the defaults) and run the test procedure again with the new test3 build (will be uploaded momentarily). The app was able to associate itself correctly on my phone starting with test2.

I'd also like to see this tried on some different custom ROMs. It *should* work but I still can't get the actual install to succeed on my phone (though it does get that far...).
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
@ultrashot: Wow, the OOM is weird and I haven't seen that in my testing, but hey, if it worked the second time... OK then! Thanks for the success report! Time to look into what level of unlock is required and figure out how to get it on a stock ROM, because elevating the app doesn't seem to be enough...
 

Kr3i0s

Senior Member
Jun 30, 2011
107
28
Hi GoodDayToDie, I am using HTC Gold with Dyanamic7 Rom. Firmware 51201.401. Have installed the XapHandlerTest2.xap and I am able to install Xap files which are stored in the device. Please let me know if you require any more details.
 
  • Like
Reactions: GoodDayToDie

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
Can you do updates? I'm *sometimes* able to install an app that is not yet installed, but if the app is installed, either an update or a clean install always fails. Clean install seems more reliable immediately after rebooting the phone, but it still appears non-deterministic to me.

I hate Schroedenbugs... although HtcRoot seems to have a lot of them. I need to work on that some more.

Still, it's progress. Hopefully, by the time WP7 Root Tools 0.9 is out and the app can be used on more stock ROMs, it'll be fully working...
 

Top Liked Posts

  • There are no posts matching your filters.
  • 29
    Hi folks,

    FIRST RELEASE:
    Wow, lots of bugs that needed fixing. There are still some things I'd like to improve, but they can wait. This is officially the first release of XapHandler, for stock ROMs with WP7 Root Tools, and optionally for custom ROMs as well.

    INSTRUCTIONS:
    1) Install XapHandler.
    2) Run WP7 Root Tools.
    3) Pivot to Policies, and set XapHandler as trusted (stock ROMs only).
    4) Run XapHandler.
    5) When prompted to set the file association, hit OK.
    6) Exit XapHandler.
    7) Open a XAP file from email, IE, or an app.
    8) Check the data about the app given in XapHandler.
    9) If the app is already installed and you want to do a clean install, exit XapHanderl and delete the app from your phone normally, then open the XAP file again.
    10) Hit the Clean Install or Update button.
    11) Wait for the Success message box.
    12) Close XapHandler.

    SOURCE CODE:
    I don't have permission to release the actual XAP installation source code, which is from @ultrashot. Therefore, the source release just contains a pre-compiled static library (it's the same code as is used in the native XAP installer on custom ROMs, and the Bazaar app). You're able to build the full app, though.

    The app has two parts: the native ARM DLL that has the COM library and does the actual installation, and the C#/Silverlight WP7 app that provides the UI and calls the COM library. You should unpack both parts to the same folder. Then, build the native part first (requires Visual Studio 2008 with the Windows Mobile 6.5 compiler). This will copy the native DLL into the managed app. Make sure the managed app includes the COM DLL, and then build it to produce a XAP file.

    PROBLEMS:
    If you have any issues, please report the following info:
    A) Your phone model.
    B) Your ROM (including version and firmware)
    C) The problems or exception messageboxes you encountered.

    RESTORING THE REGISTRY:
    For stock ROMs, if you want to put the registry back the way it was so XAP files open in the built-in XAP handler of your custom ROM:
    1) Open a registry editor
    2) Go to HKEY_CLASSES_ROOT (HKCR)\.xap
    3) Change the default value back to what it used to be
    3.1) The original value on most custom ROMs should be "xapfile" which is the same value the app uses; don't panic if it's unchanged!
    3.2) The old default value *should* be backed up in a registry value simply called "0"
    4) If there's a value called 0, delete it
    5) Go to HKCR\<originalClassName>
    5.1) For most people, that's HKCR\xapfile
    6) Change the default value back to what it used to be
    6.1) The original value on most custom ROMs should be empty
    6.2) This step is not important; the value is cosmetic and intended for the user
    6.3) The old default value *should* be backed up in a registry value simply called "0"
    7) If there's a value called 0, delete it
    8) If you have a registry key called BrowseInPlace (eg. HKCR\xapfile\BrowseInPlace) you can delete it
    8.1) I don't *think* it'll hurt anything if left, though
    9) Set the registry value EditFlags to DWORD 65536 (0x00010000)
    9.1) This value is set by release versions of XapHandler
    9.2) If the value is missing, create it with the data listed above
    10) Go into the registry keys "shell", "open", and "command"
    10.1) For example, HKCR\xapfile\shell\open\command
    11) Change the default value back to what it used to be
    11.1) The default value on most custom ROMs should be "XAPDeployer.exe "%1"" (remove first and last quotes)
    11.3) The old default value *should* be backed up in a registry value simply called "0"
    12) If there's a value called 0, delete it
    13) If you had to change anything in step 3, go to HKCR
    13.1) Don't do this step if you didn't have to change anything in step 3!
    14) Delete HKCR\xapfile and all its contents
    14.1) This step isn't needed, just cleanup
    14.2) Don't do this step unless you had a different original progID than "xapfile"!

    Have fun!

    Please feel free to include this app in WP7 homebrew collections or custom ROMs, so long as the Author attribution is not removed.

    Total downloads of the test versions: 330.
    4
    As i promised, new application interaction api is in progress and it has a bunch of new possibilities. It consists of everything I actually digged to date.
    What's done currently:
    • Deployment tools - installing, updating, uninstalling.
    • Progress notifications :)
    • App launch functions
    • Foreground app check
    • Application information viewer
    • App enumeration
    also i am remaking Xap Deployer's silverlight ui from the scratch.
    3
    Little preview of new xap deployer. What do you think about it?
    Progressbar is in statusbar - hard to catch it :)
    3
    XapHandler first release version is out! I've fixed a number of bugs (setting association correctly in the registry, hitting Update, blocking Clean Install if it's already installed, more informative messages). I've also removed HtcRoot to save space.

    This release also comes with source code. The actual XAP installation code is not owned by me, and its developer (@Ultrashot) requested that I not share the source to it, so that part is a pre-compiled static library. The source to everything else is included, though.

    Tested on interop-unlocked HTC HD7 with WP7 Root Tools v0.9. Setting the file association, opening from IE, doing installs, and doing updates have all been tested successfully.
    2
    @dotcompt: I'd love to, and if I find a way, I will. Unfortunately, I get no information from the XAP installation code of the install progress. I could add a purely cosmetic effect, but there's no way to tell (until finished) how long the installation will take.
    There is a way to get progress. I will share info later.