Registry Entries to call a Batch file

G

Guest

I am trying to make SQL Mobile persist following a hard reset.
I have created a batch file to run the cab file but how can I call the batch
file from start up? The FlashDisk does not have an auto-start mechanism. Are
there some registry entries I have to create to achieve this?

Alternatively my batch file exists only to perform the following:-
wceload.exe /noui /delete 0 /nodetect
\FlashDisk\SQLMobile\sqlce30.wce5.x86.cab
Could I use a registry entry to perfrom this?
 
P

Paul G. Tobey [eMVP]

What device and version are you talking about? Every device might be
different and your meaning of "hard reset" is important, too.

Paul T.
 
G

Guest

Its a Windows CE 5.0 Device (x86 based). This is a third-party board which is
supplied with the OS image pre-installed. By 'hard reset', I mean any time
the power is cycled.
 
P

Paul G. Tobey [eMVP]

And the registry is maintained when the power is cycled in this way? If so,
you could put a native code executable in the Init key in the registry and,
on startup, decide that, yes, this item needs to be installed and do that.
You'd need to be sure that whatever filesystem contains the installer file
is mounted, of course, and you'd need to be sure that any OS services needed
by the install process have started (GWES, window manager, shell, etc.),
too.

It seems to me that, if I were you, I'd contact the device manufacturer and
ask for suggestions. They're going to know the device and its capabilities
a lot better than we will.

Paul T.
 
G

Guest

Yes, the registry is maintained when the power is cycled.

Could you give me some direction how to create the native code executable
and what it should contain to install the cab file. My understaning is that,
on startup, I always require wceload to install the .cab file. for example
"wceload.exe /noui /delete 0 /nodetect
\FlashDisk\SQLMobile\sqlce30.wce5.x86.cab" How do I implement this in an
executable?

I have created an entry in the Init key which waits for the device manager
and desktop to initialise before calling an executable.

I have approached the board manufacturer and they tell me they cannot
include SQL Mobile in the CE OS image build as it is not supported for the
x86 based platform. They suggest programmatically spawning WCELOAD to install
the .cab file, which I guess is similar to what you are saying but I am
struggling to understand how to implement this.

I thought I could do this with a batch file but the manufacturer tells me
that it is not recommended to try and execute a batch file on startup within
Windows CE. I can run this batch file manually following startup and all is
ok.

Kind Regards,
D Smart
 
P

Paul G. Tobey [eMVP]

It will be an EXE which takes the parameter that it gets on the command line
and calls SignalStarted() with it (this is how the dependency processing in
the Init keys works).

After that, it will presumably call IsApiReady() or wait on a suitable
event. When everything that you need to be ready to do the install is ready,
call ShellExecuteEx() to launch the CAB file that you want launched. Then
it will exit, making sure that SignalStarted() has been called (maybe the
semantics you want are that SignalStarted isn't called until the install is
done; I don't know).

Paul T.
 
G

Guest

Thanks for your help! I was able to search examples of ShellExecuteEx to
produce a solution. However I couldn't find a way of getting ShellExecuteEx
to wait for the .cab file to be installed so I used ShellExecuteEx to call a
batch file which does the WCELoad command, and this does return when
installation complete. Don't know if this is good/bad practice?
Once the cab file is installed I need to use SignalStarted to indicate
complete, in case there could be other applications dependent on its launch.

I'm using VB.Net, do you know how I can obtain the sequence identifier
passed on the command line?
For Each argument As String In My.Application.CommandLineArgs()
complains that Application is not a member of My.

Kind Regards,
D Smart
 
P

Paul G. Tobey [eMVP]

That's more complicated than it needs to be. Why can't you get the process
handle from the ShellExecuteEx() structure and do a WaitForSingleObject() on
that?

The entire command line to your application, if started from an Init key, is
a single integer corresponding to the integer that you're supposed to pass
to SignalStarted().

You really don't want to use managed code to do this, either. The managed
run-time needs a bunch of stuff to be ready before *it* will start. Do this
in C/unmanaged code, *not* with C# or VB.NET.

Paul T.
 

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