[Windows Mobile Development and Hacking General] TheBlasphemer:
Introduction

Transcend and several other manufacturers make 4GB SD cards these days. They're great if you use your HTC device as MP3 player or Camera, as they offer enough space for thousands of songs and pictures.

My device, the HTC Universal, handles them just fine. However some applications, most notably the Camera application, don't like it.

Why some apps don't like it

The main problem here is the way in which they calculate the free space.

the processor is 32-bit, which means it can handle numbers ranging from 0 to 2^32. 4GB is exactly 2^32 bytes, so that shouldn't be the problem.

The problem is that applications sometimes handle the number as signed, which means that it differentiates between negative and positive numbers.

With signed numbers, the last bit is actually used as the sign (positive or negative), and the new range stretches from -2^31 (-2GB) to 2^31 (2GB).

Up to 2^31, the unsigned numbers and signed numbers are the same, but after that the last bit is set in unsigned numbers, which means that if treated as signed it will be seen as a negative number.

So if you have more than 2GB free, and the application mistreats the number of bytes free as being signed, the application actually thinks you have less than 0 bytes free ;)

How to fix this?

There are several ways to fix this. The most simple one would be to have a simple dummy file so you always have less than 2GB free. This works for the camera application, but any miscoded application taking a look at the actual size of the disk will still screw up ;)

The other solution is partitioning your SD-card. This means that you actually split the SD-card up into several virtual SD-cards of smaller sizes. So one SD-card of 4GB could be seen as four of 1GB (my set up).

This way you still have 4GB of storage, but applications will not get confused as it's split up into several chunks.

WARNING

Before you start remember to back up the current data on your SD-Card. the procedure will completely erase your SD-card. You might be able to retain the data by using partitionmagic's resize partition features, but you'd have to test yourself.

Also I'd like to mention that although I tested this procedure myself, I can't garantuee it will work for you. If it renders your SD-card useless, I can not be held responsible.

My set-up

This tutorial was written using:

- T-Mobile MDA Pro (HTC Universal)

- Windows XP SP2 MCE (equivilant to Pro)

- Transcend 150x 4GB SD-Card

It might work with a different set-up, but I can't garantuee anything ;)

Requirements

- Windows Mobile 5

- WM5Storage (do not use CardExport2, you need the ability to turn off "Removable Class"!)

- Big SD-Card

Let's get started

Just follow the following steps :)

First, make a backup of your SD-card! the following procedure will erase it!

Next, install WM5Storage. I will attach a copy of version 1.53 with this post, but you can get the latest version here.

Just copy the .cab file to your device, and execute it from the file explorer. Just make sure you

install on the main memory

, as the SD-card becomes inaccessible during the procedure ;)

Start WM5Storage. On my device, WM5Storage did not put anything in the start menu or the today screen, so I had to launch it through the file-explorer. You can find it at My Device\Program Files\WM5Storage\.

Be sure to untick both "Read-Only" and "Removable Class". Optionally you can set it to light a LED on read/write, but that's not neccesarry for this procedure.

Disconnect your device from your computer.

Insert the SD-Card if you haven't done so already

Hit "Activate" (bottom, right)

Re-connect your device to your computer.

From now on all steps are done from the PC

Wait until windows has recognized all "new hardware", and you have new a new hard-drive listed in "My Computer".

Open the control panel (Start -> Control Panel)

Go to either Performance and Maintenance -> Administrative Tools (category view) or directly to Administrative Tools (Classic View)

Double-Click Computer Management

Go to Computer Management (Local) -> Storage -> Disk Management (might take a little while to find all drives)

In the bottom view, find the disk that has your SD-card in it (You can find out by looking at the contents through "My Computer", or by seeing which disk is added once you plug in your WM device)

Right click the partition (white block ;)), and choose for Delete Partition

In the just created "Unallocated" space, right click, and choose for New Partition

In the wizard:

choose for a Primary Partition

For size, enter 1024MB (or if there is no more remaining, just the remainder). Ofcourse you can also choose your own size

Assign any drive-letter you want (or none if you only want it to be accessible on the WM Device).

Format the partition as Filesystem FAT32, Allocation unit size Default, and pick any volume label you want (You will only see the volume label on the PC, on the WM Device it will just be "Storage Card X". Also tick "Perform a quick format"

Wait until the bottom line in the new partition reads "Healthy" (wait for it to format basically ;))

Create as much partitions as you'd like (just resume from right-clicking and picking New partition)

You're done partitioning! If you want, you can fill the contents of the SD-Card now before you deactivate WM5Storage :)

Disconnect the device from the computer

Next few steps on the Device

Click "Deactivate" (same place as "Activate" was before ;))

Close WM5Storage

You're all done! have fun with the multiple storage cards you have now :P

Afterword

I've put quite a bit of time in this tutorial, I'd appreciate if you at least told me if it worked ;)

If you can spare a few coins, I'd also appreciate a donation. You can donate with PayPal to "paypal@iavatars.com".