BUG: CeRapiInvoke fails with 0x80070002 while Active Sync synchronizes

ID: Q248355


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


SYMPTOMS

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


CAUSE

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.


RESOLUTION

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


const DWORD MAX_TRIES = 3;
HRESULT hr = E_FAIL;

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
	return;
    }
}

// did we try MAX_TRIES times without success?
if (FAILED(hr))
{
    return;
}

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


STATUS

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 kbWinCE kbDSupport kbGrpKernBase
Version : n/a:1.0,2.0,2.11,2.12
Platform : n/a
Issue type : kbbug


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