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)
.



Relevant Pages

  • Re: Is the following little function UNICODE-safe? ...
    ... static DWORD dwDefID; ... That code is not going to compile in a Unicode build, ... extensions and assumes it can store three characters in a DWORD, ... What does this have to do with returning a string? ...
    (microsoft.public.vc.mfc)
  • BUG: timeSetEvent() wraps after inteval of 429496
    ... There is a bug in timeSetEvent, which is used to schedule a callback ... milliseconds the actual time period will wrap back to x-429496. ... The actual exports for these time functions are in winmm.dll, and this bug ... void CALLBACK TimerProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, DWORD ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: timeSetEvent() wraps after inteval of 429496
    ... setting a period of 430000 which generate a callback in 504ms. ... > The actual exports for these time functions are in winmm.dll, and this bug ... > // This code reproduces a bug in timeSetEvent() where if a periodic timing ... > void CALLBACK TimerProc(UINT uID, UINT uMsg, DWORD dwUser, DWORD dw1, ...
    (microsoft.public.win32.programmer.mmedia)
  • Re: Reading a Unicode text file
    ... Even though the files are "Unicode", it's possible that one or both ... esoteric) that is causing trouble. ... perhaps you could share some mock files that exhibit the bug. ... Stonehenge Perl Training ...
    (perl.beginners)
  • Re: What is the best way to remove sp3
    ... How to remove Windows XP SP3 from your computer ... consolidation of previous bug fixes and critical updates, ... It includes more than all the updates. ... "If it waddles like a duck and quacks like a duck, ...
    (microsoft.public.windowsupdate)