Re: wceload breaks on Axim51
- From: "<ctacke/>" <ctacke[@]opennetcf[dot]com>
- Date: Tue, 24 Oct 2006 08:10:08 -0400
Define it yourself:
#define TH32CS_SNAPNOHEAPS 0x40000000
--
Chris Tacke
OpenNETCF Consulting
Managed Code in the Embedded World
www.opennetcf.com
--
"JamesFielding" <JamesFielding@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:047550FE-A527-4893-B990-B80C9F81E43E@xxxxxxxxxxxxxxxx
One further complication that's come to light.
So... you've started running wceload.exe on your device, and want
to know when it's finished.
With *some* .cab files, running the following command will
make the device hang completely:
if (pi.hProcess)
WaitForSingleObject(pi.hProcess,INFINITE);
Changing the INFINITE to a number gets around this, but this
kinda assumes that your .cab file WILL have finished installing
within X seconds.
So, the alternative, you can write a function to repeatedly go through
the list of running processes, until "wceload.exe" *isn't* found in the
list.
The complication...?
You'll need to use the toolhelp.lib functions, and
CloseToolhelp32Snapshot(hand);
is *not* reliable on WM5 devices.
It's a known bug, documented on some of the newsgroups, but
there doesn't seem to be a workaround for it. Basically, this
function will work 99.9% of the time, then, for no reason, it'll throw
an exception.
For example, I can use wceload.exe to start installing
"NETCFv2.wm.armv4i.cab" on my WM5 device, and 99 times
it'll work a treat. On the 100'th time, with the same code,
and same .cab file... paff.. my application's just thrown an
exception.
My code deliberately goes through the list of processes..
does nothing for a second, then tries again... so i'm not
overloading the CPU or anything.
One newsgroup article suggests using TH32CS_SNAP_NOHEAPS
when running CreateToolhelp32Snapshot() as this'll return less
data... but this doesn't seem to exist on my environment.
Does anyone know a way around this problem ?
James
"JamesFielding" wrote:
This is a really interesting thread for us, as we've also hit all the
problems you've been seeing, whilst developing our "PocketPC
Installer" app.
The bottom line is this (here goes our trade secrets...):
For nearly all .cab files, you can kick off wceload.exe on a
PPC2002/WM2003/5 device, and wait for wceload.exe to
finish using something like this:
LPTSTR CABfilename = _T("\\Example.ARMv4.CAB");
PROCESS_INFORMATION pi = {0};
BOOL bSuccess = (CreateProcess(_T("\\windows\\wceload.exe"), CABfilename,
NULL, NULL, NULL, NULL, NULL, NULL, NULL, &pi) != 0);
if (bSuccess)
{
if (pi.hProcess != NULL)
{
// Wait for the .cab file to finish installing..
WaitForSingleObject(pi.hProcess,INFINITE);
}
}
Lovely.
But... for a small number of .cab files, this won't work. Some
.cab files will start installing (the "Installing MyCompany Someapp"
will appear on the PDA's screen) then hang there. The status bar
doesn't show any progress at all, and you have to go into
System\Memory to shut down this process.
Remove that WaitForSingleObject() command, or replace
INFINITE with a number, and it'll install fine.
Unfortunately, wceload.exe documentation is scarce, and MS
generally tends to avoid mentioning features that have been
changed/removed, such as where the /noaskdest parameter
has mysteriously disappeared to, on WM5 devices...
The safest way to run wceload.exe and wait for it to finish
is to write a small function to go through the list of processes
running on your device, and when you find a wceload.exe one,
wait a second or two (DON'T use the Sleep() function - it
doesn't work correctly), then check for that process again.
What should be a very simple process often ends up taking
many hours to get around.
By the way, one glaringly obvious question:
Why, when I take a Microsoft .Net CF library .cab file from
Microsoft Visual Studio 2003, and install it on a PDA running
a Microsoft OS, does the device complain that it doesn't trust
/ identify the manufacturer...?
Shouldn't the default library .cab files that come with
VS2003 be signed already...? We get a lot of complaints
from users wanting to install the Microsoft .Net CF, SQL
and SQLCE .cab files silently, but they can't, as they aren't
signed. It's a little ironic, if you ask me...
James
http://www.PocketPCinstaller.com
"Bill Stelzel [MSFT]" wrote:
Use the PROCESS_INFORMATION parameter (the last parameter in the call
to
CreateProcess and do a WaitForSingleObject on hProcess. Be sure to call
Closeandle for both the hThread and hProcess fields.
--
Bill Stelzel (MSFT)
This posting is provided "AS IS" with no warranties, and confers no
rights.
"Dario Salvi" <dsalvi@xxxxxxxxxxxxxx> wrote in message
news:450e5ec5@xxxxxxxxxxxxxx
Hi,
I have the same needs !!
I have programmed an autostart program that installs some cabs
silently.
I need it to be used on a PocketPC2003 and on a WindowsMobile 5.
I have more than one cab to be in stalled, and I need a special order
of
installation, so I need to block the execution of the program untill
the
cab installation has ended.
I am using CreateProcess:
CreateProcess( L"\\windows\\wceload.exe", L" /noui \\Storage
Card\\*.cab",
NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL))
Any suggestion?
Dario
.
- References:
- Re: wceload breaks on Axim51
- From: JamesFielding
- Re: wceload breaks on Axim51
- From: JamesFielding
- Re: wceload breaks on Axim51
- Prev by Date: Re: wceload breaks on Axim51
- Next by Date: Re: warning after deploying an application für debugging
- Previous by thread: Re: wceload breaks on Axim51
- Next by thread: Returning to pocket pc programming - help please
- Index(es):
Relevant Pages
|
Loading