Approaches to deployment/setup

J

JoelB

I have been messing around for far too long with CEAppMgr and Windows
Installer trying to come up with a clean way to install my PPC app, copy
some files from the PC to the PDA, and set some registry values on the PDA.

Does anyone have any suggestions? Can I do this without using CEAppMgr,
which seems cryptic and problematic?

TIA,
Joel
 
R

r_z_aret

I have been messing around for far too long with CEAppMgr and Windows
Installer trying to come up with a clean way to install my PPC app, copy
some files from the PC to the PDA, and set some registry values on the PDA.

Does anyone have any suggestions? Can I do this without using CEAppMgr,
which seems cryptic and problematic?

I agree that it is cryptic, so getting started is a pain. Making
changes can also be a pain. But now that I have a setup working, it is
reliable. And it does a lot of nitty book keeping for me. In
particular, it automatically chooses the appropriate CAB file for the
target, by looking at the target's registry and by reading the CAB
files I create.

If you want to build a replacement, you can use RAPI (CeCreateFile and
relatives) to write a desktop app that can choose the appropriate CAB
file, and/or make sure the target matches one of the CAB files, then
copy the file to the target, and then "run" it. The matching target
and CAB file will be a bit tedious. The rest shouldn't be.

For some alternatives, try using google to search for
install
in one of these newsgroups. You might also try searching for
setup
And look at:
http://www.pocketpcdn.com/sections/installation.html

TIA,
Joel

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
 
I

Ilya Tumanov [MS]

Actually, CEAppMgr.exe is not at all cryptic and problematic. It's in fact
very easy to use.

Here's how:

1. Create CAB file(s) for your application. Make sure CPU ID is and OS
version are correctly set in CAB INF file.
If you have more than one CAB, you HAVE to have ProcessorType set or it
won't deploy.
If you have one CAB only, there's no need to set ProcessorType. Consider
dropping all unneeded CABs.
For example, to cover ~99% of PPCs, provide ARM CAB only.

If you can't - add CPU ID. For example:

[CEDevice]
UnsupportedPlatforms = "HPC","Jupiter"
VersionMin = 3.000
VersionMax = 5.999

[CEDevice.x86]
ProcessorType=686

[CEDevice.SH3]
ProcessorType=10003

[CEDevice.SH4]
ProcessorType=10005

[CEDevice.MIPSII]
ProcessorType=4000

[CEDevice.MIPSIV]
ProcessorType=5000

[CEDevice.ARM]
ProcessorType=2577

2. Create INI file for CEAppMgr.exe as follows:
-------------- Cut
[CEAppManager]
Version = 1.0
Component = MyCoolApp_ThisHaveToMatch

[MyCoolApp_ThisHaveToMatch]
Description = My really cool application. You can type whatever here.
CabFiles = myCoolApp.ARM.CAB, myCoolApp.x86.CAB
-------------- Cut

Cab files for different CPUs are separated by comma, not to exceed 255
characters. Do NOT change Version and [CEAppManager] line.

Test it by invoking CEAppManager.exe, pass FULL path to INI file.

3. Add INI file to you MSI project and invoke CEAPPMGR.EXE as a custom
action with FULL path to INI file as argument.
Do an appsearch, path to CEAPPMGR.EXE is in registry:
SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\CEAPPMGR.EXE
Add condition to show error message if CEAPPMGR.EXE not found.
You would have to ignore exit code from CEAPPMGR.EXE, that could be done by
editing MSI with Orca tool.

Best regards,

Ilya

This posting is provided "AS IS" with no warranties, and confers no rights.
--------------------
 
J

JoelB

Thanks, Ilya. I spent hours and hours doing exactly the steps you
outlined. At one point it was finally working, and then it stopped working,
and I never was able to figure out why. Finally it just wasn't worth it any
more.

I have since spent a similar amount of time writing a setup program from the
ground up using the object class that Robert mentioned (RAPI). There have
been kinks to work out there too, but it is a matter of learning new
objects, not adding a space here, taking a comma out there, and hoping the
enigmatic ceappmgr works the next time. Not only have the file copy and
installation steps been completed, but the registry updates work great too!
AFAICT, I only have one more bump to iron out and I'm done -- and I have
complete control over it.

Anyway, thank you both for your help.

Joel
 
R

r_z_aret

I agree that it is cryptic, so getting started is a pain. Making
changes can also be a pain. But now that I have a setup working, it is
reliable. And it does a lot of nitty book keeping for me. In
particular, it automatically chooses the appropriate CAB file for the
target, by looking at the target's registry and by reading the CAB
files I create.

If you want to build a replacement, you can use RAPI (CeCreateFile and
relatives) to write a desktop app that can choose the appropriate CAB
file, and/or make sure the target matches one of the CAB files, then
copy the file to the target, and then "run" it. The matching target
and CAB file will be a bit tedious. The rest shouldn't be.

For various reasons, I decided to bypass CeAppMgr this week. So I'm
ready to share at least some of the "secrets". I'm still using CAB
files, but the following steps could be adapted to avoid them, too.

Step 1:
Use RAPI to determine whether a device _is_ connected. The code I use
for this is too heavily buried in private classes for me to share. I'm
pretty sure the most important piece is calling CeRapiInitEx and
checking the return code. NOTE: CeRapiInitEx and CeRapiInit are very
similar but CeRapiInitEx always returns immediately, and is thus the
right one to use for this purpose.

Step 2:
Look in the registry on the _desktop_ to determine the platform of the
attached device. See a 7 Feb 05 contribution by Peter Foot to thread
called "How can I tell which OS Platform a CE device is using?" in
microsoft.public.pocketpc.developer.

Step 3:
Look in the registry on the _desktop_ to determine the CPU in the
attached device. I found an appropriate setting (variable?) called
"DeviceProcessorType" right next to the setting for platform. Get it
as a DWORD, and compare to values in winnt.h (yes, a header that ships
with Visual Studio!!). Look for PROCESSOR_STRONGARM and relatives.

Step 4:
Use the information you've gathered to choose the appropriate CAB
file, and then copy that file to the attached device. I copy a buffer
at a time using:
a) CreateFile to open the input file on the desktop
b) CeCreateFile to open the output file on the handheld.
c) ReadFile to read a buffer from the input file
d) WriteFile to write the buffer to the output file
I repeat c and d until the file is done. Nothing deep here. Just some
careful bookkeeping. Sorry, but I can't share this code, either.

Step 5:
Use CeCreateProcess to "run" the CAB file. See a 17 Oct 02
contribution by Alexander Shargin to thread called "installing
..CAB-files" in microsoft.public.win32.programmer.wince and
microsoft.public.windowsce.embedded.vc. Note that the string arguments
passed to this function must be UNICODE (WCHAR).

For some alternatives, try using google to search for
install
in one of these newsgroups. You might also try searching for
setup
And look at:
http://www.pocketpcdn.com/sections/installation.html



-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
 
N

Norman Bullen

See inserted comment.

For various reasons, I decided to bypass CeAppMgr this week. So I'm
ready to share at least some of the "secrets". I'm still using CAB
files, but the following steps could be adapted to avoid them, too.

Step 1:
Use RAPI to determine whether a device _is_ connected. The code I use
for this is too heavily buried in private classes for me to share. I'm
pretty sure the most important piece is calling CeRapiInitEx and
checking the return code. NOTE: CeRapiInitEx and CeRapiInit are very
similar but CeRapiInitEx always returns immediately, and is thus the
right one to use for this purpose.

One thing that I learned the hard way: call CeRapiInitEx() from your GUI
thread, not a separate thread even if you wish to have a separate thread
that manages the connection. CeRapiInitEx() creates a hidden window
belonging to the thread that calls it. This window receives a posted
message when the connection is completed. If the window belongs to a
thread with no message loop, it never gets the message.

Norm
 
R

r_z_aret

See inserted comment.


clip



One thing that I learned the hard way: call CeRapiInitEx() from your GUI
thread, not a separate thread even if you wish to have a separate thread
that manages the connection. CeRapiInitEx() creates a hidden window
belonging to the thread that calls it. This window receives a posted
message when the connection is completed. If the window belongs to a
thread with no message loop, it never gets the message.

I can imagine the struggle involved with tracking down this "feature".
Thank you for saving the rest of us.

Might it be related to problems I've had reconnecting? I find that at
least one of my programs cannot disconnect and reconnect, unless I
stop and restart the whole program. For various reasons, it hasn't
been a high priority, but I should find a solution.

Otherwise, I'm not sure how this might cause real harm.

-----------------------------------------
To reply to me, remove the underscores (_) from my email address (and please indicate which newsgroup and message).

Robert E. Zaret, eMVP
PenFact, Inc.
500 Harrison Ave., Suite 3R
Boston, MA 02118
www.penfact.com
 

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