[XAP] [Source] [Mango] Webserver

Search This thread

dragonide

Senior Member
Jul 9, 2010
284
67
Rome
We do really need the ability to delete the files in the Isolated Storage :(
Otherwise you have to remove the app everytime to recover used space ... :(
 

aristeua

Member
Oct 5, 2009
14
1
This app is really cool, but it would even nicer if we could get a delete button and the option use the webserver as a html server (currently, it downloads any html file we put into the isolated storage). It also would be very cool if we could access the uploaded files through the phone.
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
@Magpir: This version allows anybody with a developer-unlocked phone to browse their phone's Windows directory (read-only, but you can download files that aren't locked) and to browse the app's IsolatedStore folder, which allows uploading and downloading of files (you can kind of use the phone like a flashdrive, by uploading files to it using the web browser on one computer, then connecting the phone to the network the second computer is on and using that computer's web browser to download the files).

To use this app, it's best to be connected via WiFi. When you run the app, it will tell you several IP addresses that it sees. The WiFi one (often a 192.168.X.Y address and often labeled starting with BCM, which stands for Broadcom who are a common maker of WiFi chips) can be accessed via the web browser on a PC connected to the same network.
 

GoodDayToDie

Inactive Recognized Developer
Jan 20, 2011
6,066
2,933
Seattle
@fiinix (or soembody else): You might want to look at back-porting some of my changes from the HtcRoot Webserver project to this one. I've tried to keep the abstraction fairly clean, so simply removing (or even just putting behind #if checks) the HtcRoot stuff should result in something runnable on phones without HtcRoot compatibility.

Features I've added that would be useful:
File attributes, including identifying ROM Modules (can't be downloaded).
File sizes for everything, including ROM Modules.
A *MUCH* faster way to list the \Windows directory.
A "Content" folder that includes files which can be served directly to the browser (instead of downloading them as files).
Some improvements to error handling.

Stuff that would need to be taken out:
Anything that writes to the filesystem outside of IsoStore (actually, probably the whole /FileSystem handler; turn it back into the /Windows handler instead).
Maybe move the "Content" folder to IsoStore (or put one there) so people can upload to it.
Anything which initializes HtcRoot.
ID_CAP_INTEROPSERVICES in the manifest.


As a side note, if anybody knows of a good Mango-ready registry library that is open-source, that would be awesome. I'm guessing the one distributed with this app (and not included in the project build) is not Mango-comptible (I could fix this, but it might be a waste of time if somebody already has).
 

Lanex777

Senior Member
Nov 24, 2012
104
11
@fiinix (or soembody else): You might want to look at back-porting some of my changes from the HtcRoot Webserver project to this one. I've tried to keep the abstraction fairly clean, so simply removing (or even just putting behind #if checks) the HtcRoot stuff should result in something runnable on phones without HtcRoot compatibility.

Features I've added that would be useful:
File attributes, including identifying ROM Modules (can't be downloaded).
File sizes for everything, including ROM Modules.
A *MUCH* faster way to list the \Windows directory.
A "Content" folder that includes files which can be served directly to the browser (instead of downloading them as files).
Some improvements to error handling.

Stuff that would need to be taken out:
Anything that writes to the filesystem outside of IsoStore (actually, probably the whole /FileSystem handler; turn it back into the /Windows handler instead).
Maybe move the "Content" folder to IsoStore (or put one there) so people can upload to it.
Anything which initializes HtcRoot.
ID_CAP_INTEROPSERVICES in the manifest.


As a side note, if anybody knows of a good Mango-ready registry library that is open-source, that would be awesome. I'm guessing the one distributed with this app (and not included in the project build) is not Mango-comptible (I could fix this, but it might be a waste of time if somebody already has).

I have a question - is it possible to make a list of files and open them with installed apps? For example, send a pdf file, open it and it will be saved this way? It is important for developer unlocked devices!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    Webserver (for Mango)

    Webserver is now supported for Mango devices!

    During NoDo this tool was used much for exploring the "\Windows" directory, but when Mango came none could explore it.
    There is probably many new things to find in the new OEM Mangos (that could not be extracted till now (Exception's: ROM dumps))

    Source code is available in attachment and should build without any problems (except for the dll reference)
    - Follow stem 6 for Microsoft.Phone.InteropServices.dll errors


    Install XAP => Navigate to the phone's IP shown in application => Browse and enjoy.
    - Change password on first launch (its randomized)


    Many thanks to davux for creating the base for this tool.
    - Orginal NoDo thread Here


    Changelog:
    v0.1 - Initial Mango version release
    v0.2 (iconizer)
    - Thanks MarysFetus aka Suicide Clown for the great icon set and start screen, love em :)
    - Many thanks to GoodDayToDie for informing me that this app can / and will run from now without the <"ID_CAP_INTEROPSERVICES">
    - Removed old OEM dll's that where not used (xap size: 812 KB => 250 KB)

    //fiinix
    1
    Now slimmer, and no ID_CAP_INTEROPSERVICES

    OK, this is just a modification of the XAP file - I didn't even recompile the source (thank you so much for including it, though!)

    Things I did:
    Removed ID_CAP_INTEROPSERVICES from the AppManifest. This will allow the app to be installed on interop-locked phones. It wasn't using it anyhow.
    Removed the OEM-specific DLLs that are only useful if you have ID_CAP_INTEROPSERVICES. They weren't being used, but they made the download and install bigger.

    Result: A smaller app that works exactly the same and can be installed on any Dev-unlocked Mango phone.
    1
    Hi Rudelm,

    I can't answer exactly what Fiinix did, but I can resolve a couple other points for you.

    The OEM DLLs allow higher-than-normal app permissions (breaking out of the low-privilege "sandbox" that apps normally operate in). However, there are a few parts of the filesystem that can be accessed even without them, by design. One of those is the Isolated Storage for the app, which obviously needs to be readable and writable by the app. Another one is the install directory, which only needs to be readable so libraries and resources can be loaded (the webserver app doesn't allow you to browse this folder, but I'm confident that it could if it was coded to). The third is the Windows directory, which is also read-only (and many files and folders within it can't be read) but is similarly required because the app needs to be able to load system libraries (including the TaskHost.exe binary that hosts the app DLL). "Normal" apps can't access these folders simply because the Silverlight API doesn't have a function to open or list an arbitrary location on the filesystem (only within the isostore, which it abstracts the path to).

    I don't know what happens if ID_CAP_NETWORKING is removed. It's quite likely the app would break, since that capability may be checked any time the app tries to open a socket (directly as this app does, or indirectly via the Silverlight APIs). You could experiment and do some research to find out, though. It would be interesting to see.

    I wouldn't worry too much about apps in the marketplace running amok with native code (even in the low-privileged process, they could still do some harm). The ComBridge Silverlight API that is required to access native code at all is prohibited from use by independent software vendors - only Microsoft and their partners are allowed to use it for Marketplace apps. Somebody tried submitting a Homebrew app to the marketplace (another opportunity for some research, if you'd like to find out more) and discovered that the use of ComBridge is detected and blocked during the submission process.
    1
    thanks for the explaination!

    It seems like a plausible idea that the native code and the WP7 app needs to access some of the folders to work. So the silverlight managed code won't grant access by design to the Windows folder. Can you tell me where this folder for the installation packages is?

    Regarding the capabilities: I've checked it with the marketplace capability test tool:


    Result Details
    [INFORMATION] : Capabilities used by application :
    ID_CAP_PUSH_NOTIFICATION
    ID_CAP_NETWORKING
    ID_CAP_IDENTITY_DEVICE


    I've removed ID_CAP_NETWORKING and it immediately stopped working. No dialogue that shows the IP address, only username and password. That is at least good to hear :)

    Regarding the marketplace certification: You could be right, I've also read somewhere that COM is only available to some third parties like Adobe and manufacturers. Maybe I try to submit a little test app that uses interop.
    The Capabilities Test only checks through managed code and its caller references (Dll references, method usage within dll)

    Why the ID_CAP_NETWORKING is needed is because of the WP7 policy system; ID_CAP_NETWORKING allows usage to those resource locations:

    Allowance to "WINSOCK", windows socket API
    Code:
    <Rule Description="Authorization rule for capability ID_CAP_NETWORKING" ResourceIri="$(GLOBAL_RESOURCES)/WINSOCK/CONNECT" SpeakerAccountId="$(SYSTEM_USER_NAME)" PriorityCategoryId="PRIORITY_STANDARD">
    - <Match AccountId="$(CAPMACRO_ID_CAP_NETWORKING)" AuthorizationIds="GENERIC_ALL" />
    <Rule Description="Authorization rule for capability ID_CAP_NETWORKING" ResourceIri="$(GLOBAL_RESOURCES)/WINSOCK/LISTEN" SpeakerAccountId="$(SYSTEM_USER_NAME)" PriorityCategoryId="PRIORITY_STANDARD">
    - <Match AccountId="$(CAPMACRO_ID_CAP_NETWORKING)" AuthorizationIds="GENERIC_ALL" />
    <Rule Description="Authorization rule for capability ID_CAP_NETWORKING" ResourceIri="$(GLOBAL_RESOURCES)/WINSOCK/ACCEPT" SpeakerAccountId="$(SYSTEM_USER_NAME)" PriorityCategoryId="PRIORITY_STANDARD">
    - <Match AccountId="$(CAPMACRO_ID_CAP_NETWORKING)" AuthorizationIds="GENERIC_ALL" />
    <Rule Description="Authorization rule for capability ID_CAP_NETWORKING" ResourceIri="$(GLOBAL_RESOURCES)/WINSOCK/SERVICE_PROVIDER_CHAIN" SpeakerAccountId="$(SYSTEM_USER_NAME)" PriorityCategoryId="PRIORITY_STANDARD">
    - <Match AccountId="$(CAPMACRO_ID_CAP_NETWORKING)" AuthorizationIds="GENERIC_READ" />

    "Can you tell me where this folder for the installation packages is?"
    \Applications\Install\9bfacecd-c655-4e5b-b024-1e6c2a7456ac\Install\