This code sample is named CEInvoke. It demonstrates a general-purpose mechanism to remotely execute software using the Remote API (RAPI) interface.
- CeRapiInvoke function
There are two projects for this sample:
This is the mobile device-side code. The project builds a DLL called CeInvoke.Dll which contains methods that are invoked by the client desktop program.
This is the desktop-side code.
The server project will build "ceinvoke.dll" while the client project will build "ceinvoke.exe".
To run the code sample
Navigate to a solution file (*.sln), and double-click it.
By default, the client solution file is copied to the following folder:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\CEInvoke\Client\``ceinvoke.sln
By default, the server solution file is copied to the following folder:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Samples\CPP\Win32\CEInvoke\Server\``ceinvoke.sln
Microsoft Visual Studio 2005 launches and loads the solution.
Build the solution (Ctrl+Shift+B).
Deploy the solution (F5).
If you have not installed the SDKSamplePrivDeveloper certificate, you will need to so that your Dll and CAB projects are signed correctly.
To install the certificate from the windows desktop
Click Start > Run.
Type the path-name to SDKSamplePrivDeveloper.pfx certificate, and click OK. By default, this is located in the following folder:
C:\Program Files\Windows CE Tools\wce500\Windows Mobile 5.0 Pocket PC SDK\Tools\
Double-click the SDKSamplePrivDeveloper.pfx certificate icon. The Certificate Import Wizard appears.
Click Next. The certificate path-name is filled-in.
Click Next (you do not need a password).
Click Next. Accept the default options; automatically select the certificate store based on certificate type.
9. Click Finish.
See Mobile device Security Model for further details on how to install the SDK certificates onto the mobile device, and how to use the privileged SDK certificate to sign this application.
Using the application
The desktop-side code is a Windows application without a user interface. The project builds an executable called "ceinvoke.exe". The results are displayed in a simple message box. You can run the executable from the command-line with the parameters in the following table.
|No param||Simple Block||Returns an error code|
|StoreInfo||Simple Block||Returns the store info on the mobile device|
|S1||Simple Stream||Returns text specifying Stream Mode 1|
|S2||Multiple Stream||Returns a list of all of the databases on the mobile device|
You can also run the executable from within Visual Studio by altering Project > Settings > Debug > General Category > Program Arguments.
The code sample runs on the desktop host computer, and is not supported for emulation.
This server application must run as Privileged, which means it must be signed with a security certificate that is in the privileged certificate store on the mobile device. You must install the SDKSamplePrivDeveloper.pfx certificate so that your DLL and CAB projects are signed correctly.
CeInvoke.dll must exist in the Windows folder on the mobile device (i.e., "\windows\ceinvoke.dll"), or at the root of the mobile device folder hierarchy (i.e., "\ceinvoke.dll").
It is the responsibility of the RAPI extension to release the IRAPIStream object (that is, to call pIRAPIStream->Release();).
As of Windows Mobile Version 5.0, the Remote Access Security Policy on Smartphone and Pocket PC is set to Restricted by default. These devices are considered "Locked," which prevents you from using CeRapiInvoke to invoke device-side DLLs — unless you take extra steps to satisfy the requirements of the Remote Access Security Policy. For more information on RAPI security, see Security for Windows Mobile-based Devices.
Note Although still locked, CeRapiInvoke is permitted on the non-phone version of Pocket PC.
CeRapiInvoke gives elevated privileges to any DLL that can be invoked on the Windows Mobile–based device.
Pocket PC SDK: Windows Mobile 5.0 Pocket PC SDK.
Smartphone SDK: Windows Mobile 5.0 Smartphone SDK.
Development Environment: Visual Studio 2005.
ActiveSync: Version 4.0.
Send Feedback on this topic to the authors