Thursday, 18 March 2010

WP7 Emulator "Unlocked"

I still cannot believe it but I did it... After a good idea, 6 hours of work and a lot a lot of digging I've unlocked the ROM image in the emulator CTP. I will describe tomorrow the method but right now I will just post some screenshots, upload the bin somewhere so I can give you the link and go to sleep cause it's almost 2 o'clock in the morning.


I will also test it better tomorrow put I saw that it has a file explorer :) and a VERY nice task manager:

I have decided to take down the link because Microsoft could get upset and I don't really want that (if someone at Microsoft will tell me that it doesn't bother them I will put it back).

Anyway I will explain later how I was able to do it (cause it was done for educational purposes only) and I think this won't cause me problems. Right? :)

WP7 Black Listed Applications

Also in the registry there is an entry for a package manager (HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\PackageManager) with a Blacklist key inside. Blacklist contains a lot of id's. I think this is the way Microsoft intends to block the applications.
I am starting to understand the reason why they want the device so closed. Imagine if you would have access at the file system you would be able to modify the registry and remove the entries in the blacklist.
Anyway combining this mechanism with the update service gives Microsoft the power to remotely block/blacklist an application running on your device (something like Apple is doing now)

Looks like there is already the list explained:
REGEDIT4
[HKEY_LOCAL_MACHINE\Software\Microsoft\PackageManager\BlackList]
"{5B04B775-356B-4AA0-AAF8-6491FFEA5600}"=dword:0 ;Shortcut
"{5B04B775-356B-4AA0-AAF8-6491FFEA5602}"=dword:0 ;Say It
"{5B04B775-356B-4AA0-AAF8-6491FFEA5603}"=dword:0 ;Calculator
"{5B04B775-356B-4AA0-AAF8-6491FFEA5605}"=dword:0 ;~About
"{5B04B775-356B-4AA0-AAF8-6491FFEA5606}"=dword:0 ;~Date Time
"{5B04B775-356B-4AA0-AAF8-6491FFEA5607}"=dword:0 ;~Phone Lock Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5609}"=dword:0 ;Speed Type
"{5B04B775-356B-4AA0-AAF8-6491FFEA5610}"=dword:0 ;Text
"{5B04B775-356B-4AA0-AAF8-6491FFEA5611}"=dword:0 ;Call History
"{5B04B775-356B-4AA0-AAF8-6491FFEA5612}"=dword:0 ;Calendar
"{5B04B775-356B-4AA0-AAF8-6491FFEA5614}"=dword:0 ;Email
"{5B04B775-356B-4AA0-AAF8-6491FFEA5615}"=dword:0 ;People
"{5B04B775-356B-4AA0-AAF8-6491FFEA5616}"=dword:0 ;AccountsManage
"{5B04B775-356B-4AA0-AAF8-6491FFEA5617}"=dword:0 ;Word Mobile
"{5B04B775-356B-4AA0-AAF8-6491FFEA5618}"=dword:0 ;Excel Mobile
"{5B04B775-356B-4AA0-AAF8-6491FFEA5619}"=dword:0 ;PowerPoint Mobile
"{5B04B775-356B-4AA0-AAF8-6491FFEA561A}"=dword:0 ;SharePoint Mobile
"{5B04B775-356B-4AA0-AAF8-6491FFEA561B}"=dword:0 ;OneNote Mobile
"{5B04B775-356B-4AA0-AAF8-6491FFEA561C}"=dword:0 ;~Call Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA561D}"=dword:0 ;~Contacts Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA561F}"=dword:0 ;~Cell Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5620}"=dword:0 ;~Bluetooth Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5621}"=dword:0 ;~Flightmode
"{5B04B775-356B-4AA0-AAF8-6491FFEA5622}"=dword:0 ;~Office Mobile Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5623}"=dword:0 ;~Wifi Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5624}"=dword:0 ;~OBExParser
"{5B04B775-356B-4AA0-AAF8-6491FFEA5625}"=dword:0 ;~Find My Phone
"{5B04B775-356B-4AA0-AAF8-6491FFEA5626}"=dword:0 ;~Backup Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5630}"=dword:0 ;Zune
"{5B04B775-356B-4AA0-AAF8-6491FFEA5631}"=dword:0 ;Camera
"{5B04B775-356B-4AA0-AAF8-6491FFEA5632}"=dword:0 ;Pictures
"{5B04B775-356B-4AA0-AAF8-6491FFEA5633}"=dword:0 ;Marketplace
"{5B04B775-356B-4AA0-AAF8-6491FFEA5634}"=dword:0 ;Games
"{5B04B775-356B-4AA0-AAF8-6491FFEA5635}"=dword:0 ;Picture Camera CPL
"{5B04B775-356B-4AA0-AAF8-6491FFEA5640}"=dword:0 ;~Device Update Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5641}"=dword:0 ;~Location Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5642}"=dword:0 ;~Location Settings
"{5B04B775-356B-4AA0-AAF8-6491FFEA5661}"=dword:0 ;Maps
"{5B04B775-356B-4AA0-AAF8-6491FFEA5671}"=dword:0 ;Convert
"{5B04B775-356B-4AA0-AAF8-6491FFEA5672}"=dword:0 ;StartKITL
"{5687D2BD-E507-46ff-84FD-FBE296DAF170}"=dword:0 ;~brightness
"{4e466928-cdd9-438e-be16-3b2dfb18cbc9}"=dword:0 ;~sounds
"{eec1f6e1-c3b6-4da6-bbf6-0aaee694f7a1}"=dword:0 ;~about
"{3B1D7EA1-F8F2-434c-B09B-116589ED54AE}"=dword:0 ;Alarms
"{be937011-98b7-45d2-9735-6828d4c9a750}"=dword:0 ;SystemInfo
"{D76C40E0-616D-4e29-929C-B40697732696}"=dword:0 ;OfficeUrlStartToken
"{534c16be-a6d3-4560-a537-f5c9ccdb6ddc}"=dword:0 ;Microsoft Office

Maybe if we could remove those entries and rebuild the ROM image we will be able to run all the built in applications.

WP7 Under the hood - Part 1

As you probably know from my previous post the guys at XDA already made a dump of the emulator binary file. Looking a little in the registry file default.hv (my main reason is to find a way to enable all the hubs as all the files are already in the image file). Some interesting facts from the registry:

1. The new shell program it's called telshell.exe (the old one was shell32.exe). This is how the init sequence looks for the emulator:
"Launch20"="device.dll"
"Depend20"=hex:06,00
"Launch21"="coldinit.exe"
"Depend21"=hex:14,00
"Launch30"="gwes.dll"
"Depend30"=hex:15,00
"Launch35"="coreoslaunch.dll"
"Depend35"=hex:1E,00
"Launch40"="telshell.exe"
"Depend40"=hex:23,00
"Launch41"="ssupdate.exe"
"Depend41"=hex:28,00
"Launch55"="dmsrv.exe"
"Depend55"=hex:15,00
"Launch60"="servicesStart.exe"
"Depend60"=hex:14,00
"Launch61"="ciphase2.exe"
"Depend61"=hex:28,00,3C,00
"Launch95"="cprog.exe"
"Depend95"=hex:3D,00
"Launch98"="EmulatorStub.exe"
"Depend98"=hex:14,00
"Launch140"="k.mscoree3_7.dll"

2. The second interesting fact is the presence of the program ssupdate.exe which I think it's the UpdateAgent. In fact looking at HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows we find DeviceUpdate\Agent and inside Protocol we have:
"MuReDirCabUrl1"="http://wm7dudftest/TestTrust/duredir.cab"
"MuReDirCabUrl2"="http://download.microsoft.com/WM/7/microsoftsupdate/redir/duredir.cab"
"MuReDirCabUrl3"="http://windows.update.microsoft.com/WM/7/microsoftsupdate/redir/duredir.cab"
"ReportingServerUrl"="http://test.stats.update.microsoft.com"

So it seems like Microsoft will be able to update the devices using Windows Update Service. Of course right now none of the links works.

3. The Silverlight version currently running on the emulator is "Version"="3.0.41020.0"

4. There is explorer.exe inside the image file. It would be enought to change default.hv and inside the Init sequence put explorer.exe to launch. This way we would have access to the file system

Still digging.....

Wednesday, 17 March 2010

WP7 Emulator Build 7.0.0.6077

Tonight I start looking how the new emulator is integrated in Visual Studio 2010. Using Process Explorer I saw that VS launches this command:
"C:\Program Files\Microsoft XDE\1.0\XDE.exe" "C:\Program Files\Microsoft SDKs\WindowsPhone\v7.0\Emulation\Images\WM70C1.bin"

So the new Device Emulator changed name in XDE (version 10.0.30128.39) and we have the bin file that contains the emulator image. I then remembered that you can extract the files from a bin image, but the guys at XDA were already ahead. They made a dump of the ROM files. A lot of people are digging up and we might see some interested things in the next couple of days.

This is what I've found out. The new OS, build 7.0.0.6077, has NET CF 3.7 embedded. I then remembered that there was a CF 3.7 cab version that was running on WM 6.5 and I got this "crazy" idea that I have to try... What if we could run the Silverlight applications that we compile for WP 7 on WM 6.5? I'm gonna dig this up tomorrow.

Anyway in the dump files I could find the Silverlight assemblies:
GAC_System.Windows.Browser_v2_0_5_0_cneutral_1.dll 129.328
GAC_System.Windows.RuntimeHost_v2_0_5_0_cneutral_1.dll 35.120
GAC_System.Windows_v2_0_5_0_cneutral_1.dll 1.038.640
that might just work on WM 6.5

and also the XNA assemblies:
GAC_Microsoft.Xna.Framework.GamerServices_v4_0_0_0_cneutral_1.dll 112.088
GAC_Microsoft.Xna.Framework.Game_v4_0_0_0_cneutral_1.dll 71.128
GAC_Microsoft.Xna.Framework.Graphics_v4_0_0_0_cneutral_1.dll 189.912
GAC_Microsoft.Xna.Framework.Input.Touch_v4_0_0_0_cneutral_1.dll 34.264
GAC_Microsoft.Xna.Framework_v4_0_0_0_cneutral_1.dll 382.424
XnaFrameworkCore.dll 357.848

XnaFrameworkCore.dll it's a native file so I think we would need one from a real device not emulator.

There is also SQL Ce Compact 3.5
GAC_System.Data.SqlServerCe_v3_5_1_0_cneutral_1.dll the version is 3.5.5722.1

And more managed assemblies:
GAC_Microsoft.Devices_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Controls.Navigation_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Controls.WebBrowserInterop_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Controls.WebBrowser_v1_0_0_0_cneutral_1.dll
GAC_Microsoft.Phone.Controls_v1_0_0_0_cneutral_1.dll
GAC_Microsoft.Phone.Execution_v1_0_0_0_cneutral_1.dll
GAC_Microsoft.Phone.Info_v1_0_0_0_cneutral_1.dll
GAC_Microsoft.Phone.License_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Notification_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Shell.Interop_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Shell_v1_0_0_0_cneutral_1.dll
GAC_Microsoft.Phone.TaskModel.Interop_v2_0_5_0_cneutral_1.dll
GAC_Microsoft.Phone.Tasks_v2_0_5_0_cneutral_1.dll
GAC_System.Device.Location_v2_0_5_0_cneutral_1.dll
GAC_CaptureApiManaged_v1_0_0_0_cneutral_1.dll


It's a start...We can look a little under the hood of WP 7 and see how it is designed. Pretty interesting, right?






WP7 Series - Phone Interface

Back in February I was really upset when they didn't show the phone interface of the new WP7. For me it is still the most important part of a Phone. Today, when I saw the videos published on Engadget I understood why... Not only that it looks unfinished, but it's like they didn't really start developing that part. Why did they invest a lot of work in the XBox Live hub (avatar movements with the accelerometer) and they didn't developed a decent CTP phone interface ? (it could be my impression but they focused too much on Zune aspects - Joe Belfiore was on the Zune team right? - I once said that it looks more like iPod Touch for the iPhone instead of the iPhone itself). Don't understand me wrong... I like a lot the new WP7 but it lacks so many things that it seems a step backward. I was disappointed when Microsoft launched WM 6.5 from a developer point of view (a year after the release of 6.1 there were not many new things added) but I always thought that they were investing everything on WM7. I think a lot of developers hoped for more as they are investing time and resources developing on Microsoft mobile platform (I don't think Microsoft can afford loosing developers on the mobile platform)

But let's go back to the phone interface. I always thought that Microsoft will learn from the mistakes he made and will get a decent phone interface. Let's start with Windows Mobile 6.1:


It is a really ugly phone interface (useless to say that it was released after WM 5 phone interface which was the same). Really small buttons that usually you will have to use the pen to dial a number, a lot of space used without being optimized, informations missing.
HTC understood that this interface was a real problem for selling massmarket devices so they rewrote the interface:

they used bigger buttons, better phone dial-pad, but still a lot of space was not optimized (also because of the OS that didn't let them to)
After they saw the "decent" phone interface developed by HTC Microsoft didn't learned too much and released in 6.5 a better interface than the standard in 6.1 but worse than the one created by HTC


Why don't they learn from the iPhone or even Android? In my opinion the phone interface of the iPhone is the most usable one.


Really nice big buttons that you can press easily, essential information (I can always see the clock cause I want to know if it's not too late when I am dialing someone, or if someone calls me), the battery power and also the power of my radio signal. Nice modern UI. Anyway I think both iPhone and Android interface could be improved.

Let's see a little the WP 7 Phone interface as it is today:

The button size is ridiculous, a lot of unused space, essentially information missing. The only thing that I like is the dial-pad buttons. Remember that your potential client is buying a phone and after that everything that comes with it. If it isn't a decent phone he won't buy it.

I hope someone from Microsoft will read this post and start treating the phone interface as one of the most important pieces of the device (especially now that the OEM will not be able to personalize it). You got the background right (with silverlight you can develop awesome UI), so don't ruin it. We, developers, need that you get WP7 right as some of our work depend on it.

P.S. Going home to watch episode 8 from Lost - The final season Simplified by Windows 7 :)

Tuesday, 16 March 2010

Sqlite for WP 7 Series - Proof of concept

I was really excited a month ago when they announced Windows Phone 7 Series, but also disappointed because it looked unfinished. Yesterday when they released a CTP for Windows Phone development I was surprised that there is no local database support (in my opinion a step backward from Windows Mobile 6.5 and an essential feature for developing business applications).
What I've developed is a proof of concept application that implements Sqlite db engine inside Windows Phone 7 series. I've used csharp-sqlite developed by noah.hart and modified it to work with IsolatedStorage and WP7 Phone Tools CTP.
After some initial struggle with the library I wrote a simple test program:



Hope you will find it useful...
csharp-sqlite.wp.zip


My first post

This is my first post... I intend to focus on mobile development so let's write a second post more interesting...