Remote API Functions

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 functions are used with the Remote API (RAPI).

Function Description
CeCheckPassword Compares a specified string to the system password.
CeCloseHandle Closes an open object handle.
CeCopyFile Copies an existing file to a new file.
CeCreateDatabase Creates a new database.
CeCreateDatabaseEx Creates a new database in the object store or in a mounted volume.
CeCreateDirectory Creates a new directory.
CeCreateFile Creates, opens, or truncates a file, pipe, communications resource, disk device, or console. Returns a handle that can be used to access the object. Opens and returns a handle to a directory.
CeCreateProcess Runs a new program. Creates a new process and its primary thread. The new process executes the specified executable file.
CeDeleteDatabase Removes a database from the object store.
CeDeleteDatabaseEx Removes a database from the object store or a mounted database volume.
CeDeleteFile Deletes an existing file from the object store.
CeDeleteRecord Deletes a record from a database.
CeEnumDBVolumes Enumerates all mounted database volumes and returns the name for each.
CeFindAllDatabases Retrieves information about all databases of a given type residing on the Microsoft® Windows® CE device. Also, copies information to an array of CEDB_FIND_DATA structures.
CeFindAllFiles Retrieves information about all files and directories in the given directory of the Windows CE object store. Also, copies information to an array of CE_FIND_DATA structures.
CeFindClose Closes the specified search handle. The CeFindFirstFile and CeFindNextFile functions use the search handle to locate files with names that match a specified name.
CeFindFirstDatabase Opens an enumeration context to enable an application to enumerate all databases in the object store.
CeFindFirstDatabaseEx Opens an enumeration context for all databases in a database volume.
CeFindFirstFile Searches a directory for a file whose name matches the specified file name. CeFindFirstFile examines subdirectory names in addition to file names.
CeFindNextDatabase Retrieves the next database in an enumeration context.
CeFindNextDatabaseEx Retrieves the next database in an enumeration context.
CeFindNextFile Continues a file search from a previous call to the CeFindFirstFile function.
CeFlushDBVol Flushes information from a database volume to permanent storage.
CeGetClassName Retrieves the name of the class to which the specified window belongs.
CeGetDesktopDeviceCaps Retrieves device-specific information about a specified device.
CeGetFileAttributes Returns attributes for a specified file or directory.
CeGetFileSize Retrieves the size, in bytes, of the specified file.
CeGetFileTime Retrieves the date and time that a file was created, last accessed, and last modified.
CeGetLastError Returns the calling thread's last-error code value.
CeGetSpecialFolderPath Gets the path to a special shell folder.
CeGetStoreInformation Fills in a STORE_INFORMATION structure with the size of the object store and the amount of free space currently in the object store.
CeGetSystemInfo Returns information about the current system.
CeGetSystemMetrics Retrieves the dimensions, widths, and heights of Windows display elements and system configuration settings.
CeGetSystemPowerStatusEx Retrieves the power status of the system.
CeGetTempPath Gets the path to the directory designated for temporary files.
CeGetVersionEx Obtains extended information about the version of the operating system that is currently running.
CeGetWindow Retrieves the handle to a window that has the specified relationship to the specified window.
CeGetWindowLong Retrieves information about the specified window. Also retrieves the 32-bit (long) value at the specified offset into the extra window memory of a window.
CeGetWindowText Copies the text of the specified window's title bar — if it has one — into a buffer. If the specified window is a control, the text of the control is copied.
CeGlobalMemoryStatus Gets information on the physical and virtual memory of the system.
CeMountDBVol Issues a mount request for a database volume that contains both data and an integrity log. Also, returns a CEGUID that is the globally unique identifier (GUID) of a mounted database.
CeMoveFile Renames an existing file or a directory, including all its children.
CeOidGetInfo Retrieves information about an object in the object store.
CeOidGetInfoEx Retrieves information about an object in the object store or a mounted database volume.
CeOpenDatabase Opens an existing database.
CeOpenDatabaseEx Opens an existing database on any database volume, including mounted databases.
CeRapiFreeBuffer Frees the memory on the desktop computer allocated by a call to CeFindAllDatabases, CeFindAllFiles, or CeReadRecordProps.
CeRapiGetError Reports remote API related failures, and can be used to determine whether a call failed due to a failure in the remote API.
CeRapiInit Attempts to initialize the Windows CE remote application-programming interface.
CeRapiInitEx Attempts to initialize the Windows CE remote application-programming interface and initially returns an event handle.
CeRapiInvoke Can be used as a general-purpose mechanism to remotely execute a routine.
CeRapiUninit Uninitializes the Windows CE remote application-programming interface.
CeReadFile Reads data from a file, starting at the position indicated by the file pointer.
CeReadRecordProps Reads properties from the current record.
CeReadRecordPropsEx Reads properties from the current record.
CeRegCloseKey Releases the handle of the specified key.
CeRegCreateKeyEx Creates the specified key. If the key already exists in the registry, the function opens it.
CeRegDeleteKey Deletes a named subkey from the specified registry key. The subkey to be deleted cannot have any subkeys.
CeRegDeleteValue Removes a named value from the specified registry key.
CeRegEnumKeyEx Enumerates subkeys of the specified open registry key.
CeRegEnumValue Enumerates the values for the specified open registry key. Also, copies one indexed value name and data block for the key each time it is called.
CeRegOpenKeyEx Opens the specified key.
CeRegQueryInfoKey Retrieves information about a specified registry key.
CeRegQueryValueEx Retrieves the type and data for a specified value name that is associated with an open registry key.
CeRegSetValueEx Stores data in the value field of an open registry key. It can also set additional value and type information for the specified key.
CeRemoveDirectory Deletes an existing empty directory.
CeSeekDatabase Seeks the specified record in an open database.
CeSetDatabaseInfo Sets various database parameters, including the name, type, and sort-order descriptions.
CeSetDatabaseInfoEx Sets various database parameters, including the name, type, sort-order descriptions, and compression of the database.
CeSetEndOfFile Moves the end-of-file position for the specified file to the current position of the file pointer.
CeSetFileAttributes Sets a file's attributes.
CeSetFilePointer Moves the file pointer of an open file.
CeSetFileTime Sets the date and time that a file was created, last accessed, or last modified.
CeSHCreateShortcut Creates a shortcut.
CeSHGetShortcutTarget Retrieves the shortcut's target path.
CeUnmountDBVol Unmounts a database volume.
CeWriteFile Writes data to a file. It starts writing data to the file at the position indicated by the file pointer.
CeWriteRecordProps Writes a set of properties to a single record, creating the record if necessary.
RAPIEXT Used to create a RAPI extension on a Windows CE function.

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.