Bug in CryptEnumProviderTypesW under XP SP3



Hi,

We encountered recently a bug in the unicode version of
CryptEnumProviderTypes under Windows XP SP3 (advapi32 version 5.1.2600.5512)
that renders it unusable: it always fails with the error code ERROR_MORE_DATA
each time the pszTypeName parameter is filled, no matter what the value of
pcbTypeName is.
To see the bug, just run the MSDN sample given in the documentation of the
function CryptEnumProviderTypes on XP SP3 after compiling it in UNICODE. Here
is the link to it :
http://msdn.microsoft.com/en-us/library/aa379930(VS.85).aspx
The ANSI version runs with no problem.

Can someone from Microsoft tell us i this bug is known and if a correction
is on its way? There are deployed applications using the unicode version of
this function that run correctly under all Windows platform except Windows XP
SP3.

Here is also a simpler program that also shows the problem under XP SP3 :

#include <windows.h>
#include <tchar.h>

void main()
{
WCHAR pszName[4096];
DWORD cbName = sizeof(pszName);
DWORD dwType = 0;
BOOL bStatus = CryptEnumProviderTypesW(
0,
NULL,
0,
&dwType,
pszName,
&cbName);
if (bStatus)
wprintf(L"Type Name = %s\n", pszName);
else
{
DWORD dwErr = GetLastError();
if (ERROR_MORE_DATA == dwErr)
wprintf(L"Bug!!\n");
else
wprintf(L"Error 0x%.8X\n", dwErr);
}
}

Thank you in advance,
Cheers,
--
Mounir IDRASSI
IDRIX
http://www.idrix.fr

To reach me: mounir_idrix_fr (replace the underscores with the at and dot
characters respectively)
.