CeRapiInvoke

This function can be used as a general-purpose mechanism to remotely execute a routine.

STDAPI_( HRESULT ) CeRapiInvoke(
  LPCWSTR pDllPath,
  LPCWSTR pFunctionName,
  DWORD cbInput,
  BYTE * pInput,
  DWORD * pcbOutput,
  BYTE ** ppOutput,
  IRAPIStream ** ppIRAPIStream,
  DWORD dwReserved
);

Parameters

  • pDllPath
    [in] Pointer to a string buffer containing the name of a DLL that is on the Microsoft® Windows® CE-based device and that contains the function identified in pFunctionName.
  • pFunctionName
    [in] Pointer to a string buffer containing the name of the function that RAPI should call on the Windows CE-based device.
  • cbInput
    [in] Number of bytes in the input buffer *pInput.
  • pInput
    [in] Pointer to a buffer containing the input data.
  • pcbOutput
    [out] Pointer to a variable that is set to the number of bytes in the output buffer ppOutput when the function returns.
  • ppOutput
    [out] Pointer to a variable that is set to the location of the output buffer upon return.
  • ppIRAPIStream
    [in, out] The ppIRAPIStream parameter specifies block mode or stream mode. Select block mode by supplying the value NULL. Select stream mode by supplying a valid pointer to a variable of type IRAPIStream; this IRAPIStream interface can be used for a direct transfer of data. If ppIRAPIStream is not NULL, the pFunctionName parameter on the Windows CE-based device will be passed a pointer to the IRAPIStream interface.
  • dwReserved
    Reserved.

Return Values

If RAPI services on the Windows CE-based device successfully locate and call the client function, then in Block Mode the return value is that which is returned on the Windows CE-based device by the called function. In Stream Mode, the return value is S_OK. If the function was not called successfully, or an exception occurred during its execution, an error code is returned.

The CeGetLastError function can be used to get the error code, which takes the value set by pFunctionName, including the following values:

  • HRESULT_FROM_WIN32(ERROR_MOD_NOT_FOUND)
    The LoadLibrary pDllPath call failed on the device.
  • HRESULT_FROM_WIN32(ERROR_INVALID_PARAMETER)
    The GetProcAddress of pFunctionName call on the device failed.
  • HRESULT_FROM_WIN32(ERROR_EXCEPTION_IN_SERVICE)
    An exception occurred during execution of pFunctionName.

Requirements

Smartphone Platforms: Smartphone 2002 and later
OS Versions: Windows CE 3.0 and later
Header: rapi.h
Library: rapi.lib

Send feedback on this topic to the authors.

© 2005 Microsoft Corporation. All rights reserved.