Question

CAB Download to Pocket PC Device

Asked by: chollis

I have PDA's that I use at customer sites for data collection.  These are PocketPC2003SE devices.  (Symbol MC50).  In the field, these devices connect through an Ethernet Cradle to a Linux Server via HTTP.  Data is uploaded and downloaded to/from the linux server.   There is no Windows based workstation at the site, meaning there is no MS Active Sync program.  

I need to load a new version of my application to the PDA's in field.  I have manually created a CAB by building my own .inf file and running cabwiz.exe on my development system and the CAB builds without errors.  The CAB is designed to move all of the support DLL's and application CAB's into place in the PDA static file store (/Application.)   This is Symbol's recommendation for persistent storage so when you Cold Boot the device the application can automatically re-install itself.

I know the CAB is built correctly because if I use Active Sync to download it to the PDA and then Tap on the CAB file.  Everything is installed correctly.

But, if I copy the CAB to the linux server and create a web page for downloading.  On the PDA using Pocket IE, I can navigate to a download page and download the CAB.  PIE will autorun the application once it has downloaded and I get the following message:  "The file "....CAB" is not a valid Windows CE setup file.

I have been working on this for a while.  I have searched and tweaked code per recommendations found on EE, Google and MSDN, but I can't get it to work.

Either the CAB is getting corrupt on Download from the web page or Active Sync does some kind of additional conversion on the CAB when it is downloaded to the PDA.   (The CAB is not compressed, PocketPC2003SE does not support compressed CABs).

What am I missing?

FYI The PHP program to download the CAB looks like:

<?php
$ffilename = "Base.CAB";
$fsize = filesize($ffilename);
$fp=fopen($ffilename,"r");

header("Content-Type: application/x-download");      # must use unknown format or IE will try to display                        
header("Content-Type: application/force-download");
header("Content-Disposition: attachment; filename=\"Base.CAB\"");

$header_str = "Content-Length: ".$fsize;
header($header_str);
header("Content-Transfer-Encoding: quoted-printable\n");

fpassthru($fp);      # transfer the file
fclose($fp);
header("Connection: close");
exit;
 ?>

I have tried many different values for content-type.


This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2008-12-07 at 15:56:17ID23964695
Tags

Microsoft

,

Windows Mobile

,

Pocket PC 2003 SE

,

CAB Creation

,

CAB Download

Topics

Pocket PC Other

,

Windows Mobile (Pocket PC / Win CE) Operating Systems

,

Windows MobileProgramming

Participating Experts
1
Points
300
Comments
7

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. PDA (Pocket PC) Application and Access database
    I'm about to write my first PDA application. I'm fairly knowledgeable about VB.NET in general. I know (think) that you can't just copy an Access database to a PDA and use it just like you would on a desktop. The question then, is how do I get to a point of using an access dat...

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: alexey_gusevPosted on 2008-12-07 at 16:07:55ID: 23118025

you could try to do the following:

- just download that CAB with PIE
- copy it to your Windows environment (with ActiveSync or without it, ie via some kind of Storage Card)
- unpack it with WinZip or whatever archiver
- compare it with original one

I guess that CAB file is stored or sent in not exactly correct format (some few bytes as it always happens)

 

by: chollisPosted on 2008-12-07 at 16:21:32ID: 23118052

Thanks for the quick response Alexey.

I think you are right, something is stepping on the format.

I tried just downloading from a link with PIE and got the same ...invalid setup file error.  The previous docs that I have found said that you have to play with the Content-Type header and that is why I went to using php to stream the file down.

The storage card option would work, but is not really feasible for my situation (50 different sites with multiple PDA's per site.  These guys can barly use the PDA if I send them a screwdriver to open up the unit I'll have a support nightmare.  (MC50 you have to unscrew the port for the SD card.)

This evening, I'll try unpacking it with WINZIP on the PDA and see if I can see a difference

 

by: alexey_gusevPosted on 2008-12-07 at 16:24:54ID: 23118063

another thing to try: what if you just provide the link to download that CAB, like any other file for the download, without ANY involvement of PHP? potentially it should be enough

 

by: chollisPosted on 2008-12-07 at 16:45:15ID: 23118105

If I just set up the CAB file as a link on the web page (<a href="Base.CAB">Download</a>)

When I click the download link it opens the file and trys to display the contents in the browser.  According to the docs I've read so far, that is because the content-type is not set to something the PIE does not understand.

That is why I was setting HTTP headers and then streaming the file.

But, I agree with you, this should be as easy as clicking on the link.  I think there is a minor step that I am missing

 

by: alexey_gusevPosted on 2008-12-07 at 17:36:54ID: 23118257

hmm, look at e.g. www.franson.com from PIE - it is ASP page where you're redirected to finally, but it contains a link  as follows (taken from View Page Source):

<HTML>
<HEAD>
<META NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
</HEAD>
<BODY>
 
<b>Franson GpsGate</b><br>
<br>
Download Windows Mobile version here:<br>
<a href="GpsGatePPC.ARM.CAB">
<b>Download!</b></a><br>
                  
14 day free trial.<br>
Supports devices with touch screen.<br>
<br>
For more information, please visit franson.com from a desktop computer.<br>
 
</BODY>
</HTML>

Such page in PIE offers me to save the CAB file (both in PPC 2003 and WM6)

 

by: chollisPosted on 2008-12-09 at 12:31:46ID: 23133246

Hi Alexey,

Yes, that application downloads fine to my PDA, so I ran the download with WireShark so I could view the http headers.

When I tap the link to initiate the download the server does an HTTP GET /gpsgate/Gps...ARM.CAB
The HTTP header on this packet contains a meta tag:  Accept-Encoding: gzip, deflate\r\n

The next packet, which is the start of the download is displayed a TCP segment data (Not HTTP) but I can see the HTTP header in this segment.  The HTTP header contains:
Content-Length:  3171410
Content Type: application/octet-stream

I guess the remainder after that is the cab file for the next 3 Meg of data packets.

I am going to try some variation on my download with Content-Type and Accept Encoding


 

by: chollisPosted on 2008-12-10 at 23:06:27ID: 23146325

OK,  Problem Solved.  This solution makes absolutely no sense.  I must have looked at 100 different sites and as Alexey stated above, I should just be able to use a hyper-link and point directly to the CAB file.   Most of the sites that did this successfully were IIS based web servers.  My belief is that under IIS, this probably works as expected.

On Apache based server, it looks like to use just a hyper-link, you must account for the .CAB mime type in .htaccess or in the httpd config file with the Add Type:  application/x-cab-compressed.   I could not get this approach to work for me.  Every time I used this method to download, my CAB file displayed in the browser.

This solution came from trying about 100 variations based on what I saw other people doing.  The end result mostly matches the readfile() example from the PHP Manual located at: http://www.php.net/manual/en/function.readfile.php

But even that example did not work out of the box.  

Here is how I got this to work for my situation:
(1) On your development system, build a .inf file and use cabwiz.exe to create your cab file.  Use active-sync to copy the .CAB file to your PDA so you can verify it works.  Once it is working, FTP (binary transfer) or SCP the file to your web server and place it where where it is available, like in the document root.  You can do an MD5 checksum to verify that the file image is identical. (use md5sum on Linux and there are hundreds of MD5 hash calc programs you can download on Windows, I used HashCalc from SlavaSoft)

(2) Build a selection web page that looks like the following html.  You will use Pocket IE to navigate to this page on your PDA
<html>
<head>
  <title>PDA Setup</title>
     <meta http-equiv="content-type" content="text/html;charset=ISO-8859-1" />
</head>
<body>
The Symbol MC50 PDA requires the following files.  Click on each file to download it to the pda.
Once all the files have been downloaded, a COLD BOOT will automatically install the application.<br><br>
Base Files:&nbsp;<a href="pda2.php?x=1">Base.CAB</a>
Application Files:&nbsp;<a href="pda2.php?x=2">App.CAB</a>
</body>
</html>

(3) Your pda2.php program should look like:
<?php
$dir = #full path to the CAB files
switch ($x) {
        case 1:
           $fname = "Base.CAB";
           break;
        case 2:
           $fname = "App.CAB";
           break;
}
$fullname = $dir . $fname;
$fsize = filesize($fullname);

header('Content-Description: File Transfer');
header('Content-Type: application/x-download');
header('Content-Disposition: attachment; filename=' . $fname);
header('Content-Transfer-Encoding: binary');
header('Expires: 0');
header('Cache-Control: must-revalidate, post-check=0, pre-check=0');
header('Pragma: public');
header('Content-Length: ' . $fsize);
flush();
readfile($fullname);
exit;
?>

This will download the CAB file through Pocket IE to the My Documents directory on the PDA.  When the download is finished, I guess  winceload will auto-start and install the CAB file.  The CAB is removed once the files are installed.

All that I can guess is that either Apache/PocketIE or winceload.exe is extremely picky about the format of the file download.  Any extra characters seem to cause the install to fail or the CAB to become corrupt.   The code segment that I was trying to use in my original post came from the download mechanism that I have used for years to download files to windows workstations through IE.  That original mechanism has downloaded tens of thousands of files with any problem until it tried to download to a PDA.

I guess what bugs me about this is that if you crawl around the Internet, there are hundreds of variations of this download that work or dont work depending on the situation.  I guess I would like to see a solution that is a little more universal or at least consistent across the board.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...