[DFT] z..::H.O.W...T.O...N.A.T.I.V.E::..z [PREVIEW]

Search This thread

Cotulla

Retired Senior Recognized Developer
Sep 8, 2007
881
5,448
..::H.O.W...T.O...N.A.T.I.V.E::..

Hello,
today I had decided to start this thread about native development for WP7.



At the current moment I don't upload/attach any working stuffs to this message. It will happen a bit later, after new DFT ROMs release. This is because it's very difficult to run them for now.


Let's start from current achieved results:

1) It's possible to run any EXE files (after "FullUnlock")
2) Those EXE files can do any operations in the system (after "FullUnlock")
3) It's possible to show some GUI from this applications. But GUI has legacy Windows CE style, it's impossible to create Metro-style applications for now.


How can it be used by community?

We can develop a lot of homebrew applications: like porting emulators, old native applications, video players and etc.
It can be possible to port famous TCPMP player for example and get ultimate playback on Windows Phone 7!


Is it possible to run old Windows Mobile 6.5 applications without modifications?

No, it's not possible. A lot of different APIs are missing for those applications.


Is it hard to modify old Windows Mobile 6.5 applications?

Well, it's almost same like porting to pure Windows CE, but a lot of Windows CE stuffs are "damaged" inside Windows Phone. They just doesn't work right, because nobody never used/tested them before :p


Photos of sample "WP7 Native test"

Information for developers you can find in the next messages.



So I will release demo WP7 native application, when we fix issues with FullUnlock.

Demo will be as binary EXE file. And as VS2008 project, which can be good start point for other developers.

Now this thread dedicated for discussion, share ideas and thoughts.



DFT, Cotulla
 

Attachments

  • IMAG0258.jpg
    IMAG0258.jpg
    95.5 KB · Views: 3,875
  • IMAG0267.jpg
    IMAG0267.jpg
    94.7 KB · Views: 2,673
  • IMAG0270.jpg
    IMAG0270.jpg
    93.6 KB · Views: 1,886
  • IMAG0275.jpg
    IMAG0275.jpg
    96.6 KB · Views: 1,601
Last edited:

Cotulla

Retired Senior Recognized Developer
Sep 8, 2007
881
5,448
Information about "FullUnlock"

Information about "FullUnlock"



DevUnlock actually allows only to deploy XAP files from external sources.
It doesn't give more privileges.

So we (DFT) developed "FullUnlock". FullUnlock is implemented as replacing some system files by wrappers, which allows any kind of access (disable access checking at all)

We replace LVMOD.DLL which used to check files and data (checksums, certificates and etc) and POLICYENGINE.DLL which implements internal objects access checking.

All written before means that FullUnlock at the current moment only possible by flashing custom ROM to device. In future maybe we can find good ways to do it without flashing, but for now I don't see any ideas how to do it without flashing.

Maybe we can replace DLLs inside \Windows\ directory (put a shadow copy), but I am not sure if it will work really. It's stuffs for future experiments.

It can be possible to do something near by editing policy values, but it need big research to find right way. As it still won't disable file checking, maybe we can add own certificate to right store and then sign files with them.

The last DFT 7720 MANGO ROMs contains FullUnlock, but it doesn't work as expected :( there few issues. as well some users got issues with debugging on those ROMs and etc. We will continue work under it ;)


So I will release demo WP7 native application, when we fix issues with FullUnlock.

Demo will be as binary EXE file. And as VS2008 project, which can be good start point for other developers.

Now this thread dedicated for discussion, share ideas and thoughts.

 

Cotulla

Retired Senior Recognized Developer
Sep 8, 2007
881
5,448
For developers

For developers
(users do not read! danger for brain!)



First of all I want to talk about abilities of native code.

Most applications built in inside WP7 are native. But they don't use usual Dialog UI style, they are using some kind of Silvelight scripts. This kind of UI is called "UIX".
Main idea of UIX that DLL files have UIX resources inside which describe whole UI.
Something similar is used inside CE 7.0 Slivelight - there some xml compiler which make binary data and put them as resources inside DLL. I don't know how to decode this binary data.
Seems Zune desktop application also using this framework.

So UIX used some kind of scripts for UI part and callbacks for all actions.
If we decode this UIX format, we will able to change/modify UI as we want, like it was before with regular resources inside DLL. But UIX must be much more powerful.

We can't use UIX for native application because we don't know how to use it, how to make proper binary data and etc. It's hard to reverse.

But native application can have some GUI with Windows CE style (you can see examples on the photos above)


Another issue: If you call API function "CreateWindowW" you won't see anything on the screen. It seems because shell handle all output, so window doesn't visible.
After some searching I found inside some test ROM nice DLL called "WindowTreeUpdater.dll". After looking inside and decoding functions parameters, it's working!
Basic idea: you create window and call function from this DLL and Window appear on the screen. There seems some kind of proxy engine to output legacy windows on top of shell output.
Nice, it's working... ;)

So we can use usual windows for UI inside native application.
There present standard controls, but they work rather laggy (hey, and looks too).
Basic controls like PushButton, Static, CheckBox, Radiobutton, Icon are working.
About extended controls: (Progress bar, list view, and etc)
they come from Commctrl.dll usually, it was present inside Initial/NODO releases, ut it was removed inside MANGO. I was able to run NODO Commctrl.dll under MANGO after some modifications. But all this controls are shown on screen, but they don't do anything on input. So you can see toolbar, but can't press any button.
CommDlg.dll is missing and never was inside WP7.

There present AYGSHELL.DLL, but most functions are broken. For example, I was not able to create menu bar.

So, a lot of functions are broken, like MessageBox not working.

But we still can create own custom controls and use them for developing.

For example porting TCPMP means that we will need reimplement UI fully - because toolbar doesn't work. slider also won't. Maybe get and reuse some source from ReactOS or NT40 CommCtrl :D
 

Jaxbot

Inactive Recognized Developer
Mar 14, 2009
1,224
548
windowsphonehacker.com
The UIX/UIB scripts are a real pain.. I tried going through them a while back to change the annoying notification system (10 seconds? Really, Microsoft?) and figured it would all boil down to the usual XML-style script that WM6.5 and other MS products use, but the format is newer and there doesn't seem to be an easy way to decompile them.
From what I do know, however, is that it's more of an encoding than a compilation, and can be decoded if we can figure out what all the different headers mean... but that's a serious reverse engineering project.
 
  • Like
Reactions: ajlunis
G

GuestK00306

Guest
Great work! Are there any multitasking restrictions for these apps? presumably because they are not Silverlight they will not be present in the task switcher & the app will be in charge of when the process terminates?

Looking forward to doing some nice low-level operations - hopefully this will open a whole new world for WP7 dev

Sent from my 7 Pro T7576 using Board Express
 

Jaxbot

Inactive Recognized Developer
Mar 14, 2009
1,224
548
windowsphonehacker.com
Great work! Are there any multitasking restrictions for these apps? presumably because they are not Silverlight they will not be present in the task switcher & the app will be in charge of when the process terminates?

Looking forward to doing some nice low-level operations - hopefully this will open a whole new world for WP7 dev

Sent from my 7 Pro T7576 using Board Express

I would suspect that they won't be killed unless there's an Out of Memory issue (you can see the whitelists for that in the registry), because these processes are not like the silverlight/xna apps that are launched in Taskman.exe. Whether they show up in multitask lists, idk, but they probably won't be killed in the traditional way..
 

Cotulla

Retired Senior Recognized Developer
Sep 8, 2007
881
5,448
but that's a serious reverse engineering project.
yes... :(
maybe it's precompiled XAML scripts, like inside Managed applications?

Great work! Are there any multitasking restrictions for these apps? presumably because they are not Silverlight they will not be present in the task switcher & the app will be in charge of when the process terminates?

I would suspect that they won't be killed unless there's an Out of Memory issue (you can see the whitelists for that in the registry), because these processes are not like the silverlight/xna apps that are launched in Taskman.exe. Whether they show up in multitask lists, idk, but they probably won't be killed in the traditional way..
Plain EXE can run without restrictions, but I guess it will be killed at OOM condition still. EXE with window seems all a bit more complex. When I press back button it usually disappear after few seconds. I think window got WM_CLOSE or something at that moment. It should be researched more in the future.


Furthermore, I forgot to say: Interesting thing, before MANGO WP7 supports native XAP files too!
There was few files nativeinstaller* which implements native installation. There references inside for setup.dll and _setup.xml like in old CAB files.
But it was removed from MANGO seems :(
 

Mr4eyes86

Member
Sep 21, 2010
34
0
Tampa,FL
For now it's only for HTC devices with flashing custom ROM :(


Would we be able to install an old application like fpsece for windows mobile? One of the biggest things I miss about windows mobile! I get paid today so I will be making a donation for your hard work! I'm currently using your custom rom on my HD7! Thanks again, and keep up the good work!
 

Top Liked Posts

  • There are no posts matching your filters.
  • 56
    ..::H.O.W...T.O...N.A.T.I.V.E::..

    Hello,
    today I had decided to start this thread about native development for WP7.



    At the current moment I don't upload/attach any working stuffs to this message. It will happen a bit later, after new DFT ROMs release. This is because it's very difficult to run them for now.


    Let's start from current achieved results:

    1) It's possible to run any EXE files (after "FullUnlock")
    2) Those EXE files can do any operations in the system (after "FullUnlock")
    3) It's possible to show some GUI from this applications. But GUI has legacy Windows CE style, it's impossible to create Metro-style applications for now.


    How can it be used by community?

    We can develop a lot of homebrew applications: like porting emulators, old native applications, video players and etc.
    It can be possible to port famous TCPMP player for example and get ultimate playback on Windows Phone 7!


    Is it possible to run old Windows Mobile 6.5 applications without modifications?

    No, it's not possible. A lot of different APIs are missing for those applications.


    Is it hard to modify old Windows Mobile 6.5 applications?

    Well, it's almost same like porting to pure Windows CE, but a lot of Windows CE stuffs are "damaged" inside Windows Phone. They just doesn't work right, because nobody never used/tested them before :p


    Photos of sample "WP7 Native test"

    Information for developers you can find in the next messages.



    So I will release demo WP7 native application, when we fix issues with FullUnlock.

    Demo will be as binary EXE file. And as VS2008 project, which can be good start point for other developers.

    Now this thread dedicated for discussion, share ideas and thoughts.



    DFT, Cotulla
    26
    Information about "FullUnlock"

    Information about "FullUnlock"



    DevUnlock actually allows only to deploy XAP files from external sources.
    It doesn't give more privileges.

    So we (DFT) developed "FullUnlock". FullUnlock is implemented as replacing some system files by wrappers, which allows any kind of access (disable access checking at all)

    We replace LVMOD.DLL which used to check files and data (checksums, certificates and etc) and POLICYENGINE.DLL which implements internal objects access checking.

    All written before means that FullUnlock at the current moment only possible by flashing custom ROM to device. In future maybe we can find good ways to do it without flashing, but for now I don't see any ideas how to do it without flashing.

    Maybe we can replace DLLs inside \Windows\ directory (put a shadow copy), but I am not sure if it will work really. It's stuffs for future experiments.

    It can be possible to do something near by editing policy values, but it need big research to find right way. As it still won't disable file checking, maybe we can add own certificate to right store and then sign files with them.

    The last DFT 7720 MANGO ROMs contains FullUnlock, but it doesn't work as expected :( there few issues. as well some users got issues with debugging on those ROMs and etc. We will continue work under it ;)


    So I will release demo WP7 native application, when we fix issues with FullUnlock.

    Demo will be as binary EXE file. And as VS2008 project, which can be good start point for other developers.

    Now this thread dedicated for discussion, share ideas and thoughts.

    22
    For developers

    For developers
    (users do not read! danger for brain!)



    First of all I want to talk about abilities of native code.

    Most applications built in inside WP7 are native. But they don't use usual Dialog UI style, they are using some kind of Silvelight scripts. This kind of UI is called "UIX".
    Main idea of UIX that DLL files have UIX resources inside which describe whole UI.
    Something similar is used inside CE 7.0 Slivelight - there some xml compiler which make binary data and put them as resources inside DLL. I don't know how to decode this binary data.
    Seems Zune desktop application also using this framework.

    So UIX used some kind of scripts for UI part and callbacks for all actions.
    If we decode this UIX format, we will able to change/modify UI as we want, like it was before with regular resources inside DLL. But UIX must be much more powerful.

    We can't use UIX for native application because we don't know how to use it, how to make proper binary data and etc. It's hard to reverse.

    But native application can have some GUI with Windows CE style (you can see examples on the photos above)


    Another issue: If you call API function "CreateWindowW" you won't see anything on the screen. It seems because shell handle all output, so window doesn't visible.
    After some searching I found inside some test ROM nice DLL called "WindowTreeUpdater.dll". After looking inside and decoding functions parameters, it's working!
    Basic idea: you create window and call function from this DLL and Window appear on the screen. There seems some kind of proxy engine to output legacy windows on top of shell output.
    Nice, it's working... ;)

    So we can use usual windows for UI inside native application.
    There present standard controls, but they work rather laggy (hey, and looks too).
    Basic controls like PushButton, Static, CheckBox, Radiobutton, Icon are working.
    About extended controls: (Progress bar, list view, and etc)
    they come from Commctrl.dll usually, it was present inside Initial/NODO releases, ut it was removed inside MANGO. I was able to run NODO Commctrl.dll under MANGO after some modifications. But all this controls are shown on screen, but they don't do anything on input. So you can see toolbar, but can't press any button.
    CommDlg.dll is missing and never was inside WP7.

    There present AYGSHELL.DLL, but most functions are broken. For example, I was not able to create menu bar.

    So, a lot of functions are broken, like MessageBox not working.

    But we still can create own custom controls and use them for developing.

    For example porting TCPMP means that we will need reimplement UI fully - because toolbar doesn't work. slider also won't. Maybe get and reuse some source from ReactOS or NT40 CommCtrl :D
    7
    Is it now possible to Port android to wp7?

    If I see this question again..... This thread is for hacking WP7 to run Fully Native code.. not for porting Android. As many other people have said, if you want an Android phone, buy an Android phone. :)
    4
    reserved3reserved3