Microsoft KB Archive/248355

From BetaArchive Wiki

BUG: CeRapiInvoke fails with 0x80070002 while Active Sync synchronizes


The information in this article applies to:

  • The Windows CE Application Programmers Interface (API), version 1.0, on platform(s):
    • Microsoft Windows CE Operating System versions 1.0, 2.0, 2.11, 2.12


Calling CeRapiInvoke() while Active Sync is in the process of synchronizing files causes CeRapiInvoke() to fail with 0x80070002.


Microsoft has confirmed that this is a bug. The cause of the problem is due to a global variable that is used for tracking the return result from API calls on the device. When RAPI is used by more than one process, it is possible the return value from an API may become invalid.


Microsoft has provided a workaround to this problem. The following source code shows the workaround:

const DWORD MAX_TRIES = 3;

for (int i = 0; FAILED(hr) && i < MAX_TRIES; ++i)
    if (FAILED(hr = CeRapiInvoke(...)) && 0 != CeRapiGetError())
    // this is no normal error, something
    // is wrong with the connection

// did we try MAX_TRIES times without success?
if (FAILED(hr))

// now we can use the IRapiStream interface without any problems
hr = pStream->Read(...); 


Microsoft will fix this problem in future releases of Windows CE devices. For now, the workaround is the only way to avoid the problem.

Additional query words:

Keywords : kbAPI kbKernBase kbOSWinCEsearch _IK kbGrpDSKernBase
Issue type : kbbug
Technology : kbAudDeveloper kbZNotKeyword kbWINCEAPI

Last Reviewed: December 25, 1999
© 2001 Microsoft Corporation. All rights reserved. Terms of Use.