cab-install forced to SD-card

P

Peter Hartlén

Hi!

1. Is it possible using WM2003SE, CF2, and VS2005 to create cab files that
install on a device's storage card regardless of the storage card's path?
I've been unsuccessfull in my attempts to find an attribute you can use in
your INF-file for this.

2. Is the path to the storage card standardized to "Storage Card" in WM2005?
Or is it anarchy just like in WM2003?

Thanks in advance!

/ Peter
 
H

Hilton

Apps don't run reliably on a card - don't install the app there. You even
have to be very careful with data files on the card.

Hilton
 
P

Peter Hartlén

Apps don't run reliably on a card - don't install the app there. You even
have to be very careful with data files on the card.
Is this really true? We've been doing this for years, and I haven't noticed
any problems with installing the app on the card (except for the bloody
anarchy when it comes to naming conventions on the SD card).

Atleast I think this is highly dependent on the PDA you are using, and
definitely which SD-card.

We are using industrial PDAs, and high-end SD-cards. We did have some
trouble with the initialization of the SD-card on PowerDown/PowerUp, which
caused major problems with the application, and database stored on the card.
This was however fixed by the manufacturer of the PDA. I can see that this
might be a big problem if you target all PDAs/SD-Cards out there...

I have to admit there are still problems with PowerUp when the application
is running, which from time to time forces the user to restart the
application. I don't think this has to do with the application beeing stored
on the card though, but rather the database beeing stored there. Keeping an
open connection to the database stored on a card when the device is Powered
off sounds more like a source of error to me.

The reason why I want to install on the SD-card is because of memory usage.

Thanks,

Peter
 
G

Guest

So you are experiencing problems like Hilton said. Power down and power up
can cause major problems for for the app exe and for data stores. If you
are using one device and only one device, and that device OEM took the time
to carefully craft suspend and resume, you might have decent luck, but for
general distribution it can be a difficult thing to achieve without a high
support load.

Running tha pp from a card where the OS pages in the app can easily lead to
access violations after a suspend/resume, which could be the problem you're
seeing. These errors are very hard to reliably reproduce as well becasue
you don't control how the OS pages.
 
P

Peter Hartlén

Yeah I guess you can't get it all. I think we have to live with the downside
of this (although, as I said, we don't experience this problems very often)
as we need to free all the memory we can. The main usage of our application
is also Turn On, Start Application, Work ... Work ... Work, Turn of
application, Turn off device, but I admit you can't rely on this to be the
case all the time.

But is there a general recomendation from MS not to install applications on
SDcards? You'd think it should work like a harddrive on a normal computer.

Is there a higher probability that the OS would Page if the unit is turned
off for a longer period of time?

Chris, would you ever install a application/database on a storage card?

/ Peter
 
G

Guest

But is there a general recomendation from MS not to install applications
on SDcards? You'd think it should work like a harddrive on a normal
computer.

You never suspend your PC like you do a device. A CE device turns off the
processor and puts RAM in self refresh. When it wakes, it reinitializes all
hardware, but the RAM contents remain. External storage is especially tough
becasue the controller is shut down and the volume is unmounted. When you
power back up it's repoered and mounted. Expecting the OS to be able to
keep track of a handle is a lot to ask. It's essntially like asking in XP
that you can open a program from a USB storage device - while it's running,
pull the storage at random, plug it back in, and expect no adverse effects.

Is there a higher probability that the OS would Page if the unit is turned
off for a longer period of time?

Nope. It's simply how the driver is set up - to either pull the whole app
into RAM or to page as necessary. Most OEMs opt for paging, since pulling
the whole thing into RAM is expensive when you don't need it.
Chris, would you ever install a application/database on a storage card?

I hate to say "never" but I'd lean strongly against it. If it must be on
external storage (which due to size it sometimes must) then I recommend all
data transactions be connect/change/close operations. You cannot keep the
DB open. Then your window for error gets a lot smaller. Beyond that you
need to add power event handling to know when you come back up from suspend.

I never run apps from storage. If the customer wants it there for
safekeeping, then I make a launcher that copies the actual app to RAM and
runs it from there.


--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--
 
H

Hilton

Chris said:
So you are experiencing problems like Hilton said. Power down and power
up can cause major problems for for the app exe and for data stores. If
you are using one device and only one device, and that device OEM took the
time to carefully craft suspend and resume, you might have decent luck,
but for general distribution it can be a difficult thing to achieve
without a high support load.

Running tha pp from a card where the OS pages in the app can easily lead
to access violations after a suspend/resume, which could be the problem
you're seeing. These errors are very hard to reliably reproduce as well
becasue you don't control how the OS pages.

Chris, your last sentence is the reason why it took me ages to figure out
why 'my code' was crashing. Turned out that it was the card/pwr-off
problem.

BTW: If you'd like the code that I gave to Microsoft to show the bug, let me
know. On my Dell Axims, it is reproducable 100% of the time.

Hilton
 
G

Guest

Yeah, I've had to fix it for a few customers, on everything from Symbol to
Dell PDAs. This is a classic example of where a desktop developer would be
completely lost, and in fact not understanding how the device and OS work at
a platform level can leave you with unexplainable issues and instability.

If you have a short repro I could use it and blog about this very
misunderstood scenario.
 
H

Hilton

Chris,

The code is straightforward. Create a form with a button (I used a main
menu item). Run the program on the Pocket PC. At this point (I'm assuming
from observation) that the OS has paged in the main form and whatever else
it needs at that point. Now power-off, thousand one, thousand two,
power-on. Tap on the button (or main menu). The tap causes code like this
to run:

private void menuItem2_Click(object sender, System.EventArgs e)
{
Form form00000 = new Form00000(); form00000.Show();
form00000.Close(); form00000.Dispose();
Form form00001 = new Form00001(); form00001.Show();
form00001.Close(); form00001.Dispose();
Form form00002 = new Form00002(); form00002.Show();
form00002.Close(); form00002.Dispose();
etc.
}

This causes the paging which causes the crash when run on a card, no crash
in main memory or on the desktop. Works 100% of the time for me. I forget
exactly when it dies, but it was really soon after starting, perhaps even on
the first form.

I'll email the code to you so that you can test it (perhaps modify it) and
blog it.

Thanks,

Hilton
 
P

Peter Hartlén

Thanks guys for correcting me and explaining why you shouldn't put the
program on a memory card. It is however quite confusing that Microsoft let's
you do this without any warning when installing through ActiveSync.

Happy blogging!
 
H

Hilton

Chris said:
Yeah, I've had to fix it for a few customers, on everything from Symbol to
Dell PDAs. This is a classic example of where a desktop developer would
be completely lost, and in fact not understanding how the device and OS
work at a platform level can leave you with unexplainable issues and
instability.

If you have a short repro I could use it and blog about this very
misunderstood scenario.

Chris,

Did you get the repro source I emailed to you a couple of weeks ago? If
not, I could resend it.

Thanks,

Hilton
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top