Microsoft KB Archive/248355

From BetaArchive Wiki
< Microsoft KB Archive
Revision as of 12:35, 21 July 2020 by X010 (talk | contribs) (Text replacement - "&" to "&")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

BUG: CeRapiInvoke fails with 0x80070002 while Active Sync synchronizes

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 kbOSWinCEsearch _IK kbGrpDSKernBase
Issue type : kbbug
Technology : kbAudDeveloper kbZNotKeyword kbWINCEAPI


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