Remote API (RAPI)

The prototypes that are defined in the Rapi.h file enable desktop computer applications to remotely manage devices. Essentially, Remote API (RAPI) is a remote procedure call (RPC). RAPI communicates requests from a desktop computer application to invoke a function and returns the results of that function. The exported functions relate to the registry, file system, and databases, in addition to functions for querying the system configuration. Although most RAPI functions are duplicates of functions in the Microsoft® Windows® CE API, a few new functions extend the API. Use these functions to initialize the RAPI subsystem and enhance performance of the communication link by compressing iterative operations into one RAPI call.

RAPI Initialization

Before you can invoke any RAPI functions, you must initialize the underlying communications layer between the host computer and the mobile device, which must be connected to the host computer through a cable or a cradle. There are two versions of the RAPI initialization function you can use: CeRapiInit and CeRapiInitEx. CeRapiInit does not return until the connection is made, an error occurs, or another thread calls CeRapiUninit.

CeRapiInitEx works slightly differently. Instead of blocking the calling thread, it returns an event handle to indicate when initialization is complete. Use CeRapiInitEx to avoid blocking a thread inside a call to CeRapiInit. CeRapiInitEx returns immediately and continues initialization until the connection is made, until an error occurs, or until there is a call to CeRapiUninit. When CeRapiInitEx is complete, it sets the event specified in the heRapiInit member of the RAPIINIT structure. After calling CeRapiInitEx, check the return value to determine whether an error occurred. If the call was initially successful, call the MsgWaitForMultipleObjects function to wait for the event handle passed back in the heRapiInit member of the RAPIINIT structure. When the event is set, check the hrRapiInit member of the RAPIINIT structure to determine whether the connection was successful. To shut down or to stop the connection process, call the CeRapiUnInit function.

The following elements are associated with the Remote API feature area:

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.