From: Alexander Grigoriev on
What RegQueryInfoKey returns? What pcszSubKey you're trying to query? Is is
ANSI or UNICODE build? Under what kind of accound you're testing it?

"Andreas Rossi" <AndreasRossi(a)discussions.microsoft.com> wrote in message
news:C6D40868-CC20-40E7-89F6-FA06A7E64477(a)microsoft.com...
> The code is very simple:
>
> int rc = 0;
> HKEY hKey = 0;
> rc = RegOpenKeyEx( HKEY_LOCAL_MACHINE, pcszSubKey, 0L, KEY_READ, &hKey );
> if(ERROR_SUCCESS != rc)
> {
> return -1;
> }
> DWORD nbValues = 0;
> DWORD nbValueNameLen = 0;
> rc = RegQueryInfoKey( hKey, NULL, NULL, NULL,
> NULL, NULL, NULL,
> &nbValues, &nbValueNameLen, NULL,
> NULL, NULL );
> if(hKey) RegCloseKey( hKey );
> char szMsg[120];
> _snprintf( szMsg, 120, " HKEY_LOCAL_MACHINE\\%s\n Names: %d\n
> MaxNameLen: %d\n", pcszSubKey, nbValues,
> nbValueNameLen);
>
> MessageBox(NULL, szMsg, "RegQueryInfoTest", MB_OK | MB_ICONINFORMATION);
>
> We are testing with Vista x32.
> All works fine, if we disable User Account Control (UAC).
> Your sample works, because it didn't use the value of cchMaxValue.
>
>
>
> "Scherbina Vladimir" wrote:
>
>> It is not. On my Vista x64 following code works:
>> http://msdn2.microsoft.com/en-us/library/ms724256.aspx. Can you write
>> here a
>> snippet of code that causes problems?
>>
>> --Vladimir Scherbina
>>
>> "Andreas Rossi" <AndreasRossi(a)discussions.microsoft.com> wrote in message
>> news:0540DFC5-348B-4632-A41A-3F61A793826F(a)microsoft.com...
>> > It seem's that RegQueryInfoKey returns always 0 in lpcMaxValueNameLen
>> > for
>> > registry keys in HKLM under Windows Vista.
>> >
>> > Any idea?
>>