From: Andreas Rossi on
It seem's that RegQueryInfoKey returns always 0 in lpcMaxValueNameLen for
registry keys in HKLM under Windows Vista.

Any idea?
From: Bercea Gabriel on
No, I have no ideea.

From: Scherbina Vladimir on
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?

From: Andreas Rossi on
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?
>
From: Norman Diamond on
> All works fine, if we disable User Account Control (UAC).

Aha. Here's my guess: the process doesn't have privileges to read all of
the values in the key, so Vista securely reported the longest length as 0.

<logic mode=on>
Your process should rely on that 0 and get Vista secured buffer overflows,
because your process only has enough privileges to destroy your own limited
account.
<logic mode=off>


"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?
>>