archiveren

Tagarchief: development

  • First of all, you can’t play with this unless your phone is completely unlocked. Since the new version of the wp marketplace, all xap files are completely encrypted. So you can’t download them, and unzip them as before…
  • Second of all: this is only a very basic post on this matter, but it’s a good start for more šŸ™‚

Well, let us start with a random no-name application.
You’ll need a .net decompiler as well! Just google one šŸ™‚
I’ll use ilspy because it’s fast and portable šŸ™‚

Here you can read some things about how wp7 trials CAN work, using the istrial() method.
This function is added, making sure the xap you’ve downloaded is the trial version.
Developers are given the choice on the marketplace to upload two different versions of any application: a trial version and a “full/paid” version.

Next, you’ll need the wp7 app (or parts from it) on your computer.
As mentioned earlier, Microsoft now encrypts the entire xap file (which I don’t blame them for). So we’ll have to install the app on the phone and copy the necessary files from our phone to a desktop computer šŸ™‚

You can do this using a file managers. I used the “root webserver” application to download some dll’s from my phone to my computer.
Just fire up a browser, or even a WMDC/USB connection, browse to \Applications\Install\*applicationid*\Install\, and take a look around. This is the place you applications are actually stored.

So, when you’ve got your dll-files, open them in your decompiler!

Next, the real “hacking” begins. Take your time to examine the source code, and find a way to exploit it šŸ˜›
If you can write an application, you can read one as well šŸ˜‰ (reading is not always easier than writing šŸ˜‰ )

You’re looking for a boolean value, or a method you can bypass, or something you don’t like that you want to disable (or want to enable!)

In our example we find the method istrial(), which pretty much says it all…
You notice the code is a bit obfuscated, again to make it a bit harder for you like hashsums, dynamic memory allocation, … I’ll blog about this subject later šŸ˜‰

If we let this function always return “true”, we’re done already.

This gives the biggest challenge: making it actually work. This “easy” method described above definitely won’t work in all cases. Most of the time there are more functions and checks you’ll need to bypass.

Maybe in another part of the dll there’s a piece of code checking the date. You can adjust that specific call, always returning a day in 2017.
Or even funnier, maybe there is a config file with a boolean “istrial”, and you can change it to “false”, and you’re done as well.

Be creative!

To wrap up: you decompile the dll completely. Open the result in visual studio, just change the stupid line to always return the boolean value “true”, compile the new dll and you put that back onto your phone!

This posts only describes a very basic technique in .net for wp7, but at least it gives you an idea how to start exploring the wonderful world of reverse engineering, and you can go WAY deeper. Start google’ing about software instrumentation (extremely cool technique), disassemblers (bypass loops in x86 assembly code), debuggers, hex editors and you’ll probably never stop reading.

Maybe I’ll write something about reverse engineering pc apps as well šŸ™‚

Advertenties

Mark the 26th of September in your calendar, ‘cause a part of the world will die šŸ™‚

The part of me being a WP7 developer šŸ™‚

(some people will actually laugh now, thank you matsoo…)

But anyway, I’m not really planning to pay 75ā‚¬ to have a few apps in the marketplace I’m giving away for free.
Especially because this 75ā‚¬ is annually… (my windows license is cheaper than that…)

The really big downside: my apps will be removed from the WP7 marketplace… šŸ˜¦

Maybe if someone reads this, and actually likes my apps, please comment on this blogpost, maybe I’ll reconsider…

I had some comments on my apps, thanks for the support you guys!
I’ll upload the xap’s to the internet, if your phone is unlocked, you can still use them!

Today, I’ve submitted my 5th application the Windows Phone 7 marketplace šŸ™‚

Basically, it gives you the ability to type a text message on your computer and send it to your phone for sending it to someone…

You can find some screenshots and links to the app on this project page.

 

I’m impressed my msdn account is still valid, so I’m happy for that šŸ™‚ (but that’s another story)

Anyway, the app is in a pretty rough form, but it works, and it’s something you might use as well šŸ™‚

Jeah, it’s a rainy Sunday, so what do you do =)
Let me share some stuff I’ve learned today…

 

1. Browser

First, I needed a way to open the browser externally. Just dropping the user at a website…
This is done pretty easily.

First you need to include the following namespace

using Microsoft.Phone.Tasks;

and after that a whole lot of “tasks” become available.
Code for jumping towards IE:

WebBrowserTask webBrowserTask = new WebBrowserTask();
webBrowserTask.URL = "http://www.mendelonline.be";
webBrowserTask.Show();

so that’s one thing šŸ™‚ (thx to windowsphonegeek)

 

2. SMS

Another thing was sending an sms…
This is also done by using a special task.

SmsComposeTask composeSMS = new SmsComposeTask();
composeSMS.Body = "SIM TOPUP 15";
composeSMS.To = "8989";
composeSMS.Show();

It’s the value of the body that is send towards the number of “to” (obviously =) )
More information on ginktage (thx!)

 

3. MessageBox

For some feedback towards the user I needed a confirmation dialog.
The one I used was a eventually a simple messagebox.
Code is as follows:

if(MessageBox.Show("are you sure?", "do something", MessageBoxButton.OKCancel) == MessageBoxResult.OK)
 {
Ā Ā  //some actions
}

Code taken from create.msdn.

 

4. IsolatedStorageSettings

Another thing, I needed settings to be saved.
I had done this previously using IsolatedStorageSettings, but today I encountered some problems…
The returning error was “ArgumentException was unhandled. Value does not fall within the expected range.”.

Apparently this is Microsoft’s way of saying “there is a duplicate value in the storage” šŸ˜›

So a “remove” before the “add” solved some issues.

Further I noticed that not everything was saved.
Luckily there is a “save” method available for saving (no shit šŸ˜› )

private IsolatedStorageSettings appSettings = IsolatedStorageSettings.ApplicationSettings;
appSettings.Remove("email");
appSettings.Add("email", "someone@contoso.com");
appSettings.Save();
tbResults.Text = (string)appSettings["email"];

Inspiration was found on msdn.

 

5. Weird numbers

While debugging I noticed some weird numbers showing up on the right side of my screen…

No idea what they where doing there, no idea where they came from…

But, Markus Egger brought me the solution

The numbers are some performance counters from VisualStudio, and they only appear while debugging šŸ™‚

Indeed, while running in release or without VisualStudio the numbers don’t even exist.

Another solved problem! Thx @ Markus!

 

6. Pin-to-start

My last submission failed because of the “pin-to-start” icon was still the default…

No idea what this meant, so I rushed to Google. Finding dzone.com with some explanation.

The icon is described in the “WMAPPManifest.xml” file.
Default it’s the file “Background.png”.

So this can of course easily be changed…

 

7. ProgressBar

Last one! Yet again from windowsphonegeek.

I wanted a nice pretty loadingbar as you’ve probably seen in many apps already.

Didn’t found out how to fix this, but eventually it isn’t hard (if you know how to do it! šŸ˜› )

The code is really easy:

ProgressBar bar = new ProgressBar();
bar.IsIndeterminate = true;

this.ContentPanel.Children.Add(bar);

And removing is done by

this.ContentPanel.Children.Remove(bar);

if you make the ProgressBar global available…

 

So, that’s it for today šŸ™‚

Maybe someone can use it šŸ™‚

You saw also some screenshots from 2 apps. Both are pending in the marketplace šŸ™‚ Further updates are coming šŸ˜‰

One of the best initiatives Microsoft has created for us, poor students, is the platform called DreamSpark https://www.dreamspark.com

For the people that are not familiar with it: it offers a lot of ide’s and tools, and even some full featured os’ses so you can start develop within a couple of hours, read: visual studio, windows server, sql server, windows embedded, etc… And all of this is for free if you are a student. NIIIIICE šŸ˜Ž

Anyway, when you want to develop something for Windows Phone, you get the emulator. But eventually, you want to test your app on a real world device (at least, I want that šŸ˜€ ).
The privilege of placing your app in the appstore, and thus being able to test this on a physical device, is reserved for developers who pay $99… And for students, when you register via DreamSpark… NIIICE again! šŸ˜Ž

Because you are getting a spot in the marketplace for free, you have to be authenticated. This authentication process is done by geotrust, a third party doing Microsoft’s work šŸ˜›

The process exisits out of 3 steps

  1. creating an application in visual studio and debugging using the emulator
  2. uploading your app to the app hub
  3. getting authenticated by geotrust

And you’re ready to go šŸ˜Ž

Currently, IĀ  passed the authentication process from geotrust by scanning my Belgian ID and e-mailing this towards geotrust. (A couple of stupid errors came trough, like for example “mendel alias” is not my real name of-course… šŸ˜€ , but the guys are geotrust where wonderful, thx again if you’re reading this!)

So, from now on, I’m an official WindowsPhone developer! Lol ^^

First app in the marketplace (still needs to be approved) is a check tool (like for example the mobilevikings tool) for the download statistics of my ISP: Dommel.

We’ll see how everything turns out in the future šŸ˜Ž