registry test incorrect for xp

James Hawkins truiken at gmail.com
Mon Nov 8 01:54:32 CST 2004


I just completed building the wine conformance tests with Visual
Studio .NET.  When I ran the advapi32/security tests, there were 28
failures (compiled and tested on XP).  The first error I looked at is:

registry.c:93: Test failed: data_count set to 24 instead of 7

Looking at registry.c, this test calls RegEnumValue with an output
data buffer that is too small,

LONG RegEnumValue(
  HKEY hKey,
  DWORD dwIndex,
  LPTSTR lpValueName,
  LPDWORD lpcValueName,
  LPDWORD lpReserved,
  LPDWORD lpType,
  LPBYTE lpData,
  LPDWORD lpcbData
);

so the lpcbData should contain the required size of the buffer on
return.  hKey is initialized to HKCU\Software\Wine\Test and dwIndex is
0, so we're reading this:

Name: Test1
Type: REG_EXPAND_SZ
Data: %LONGSYSTEMVAR%\subdir1

The current test expects RegEnumValue to expand the environment
variable %LONGSYSTEMVAR%, leaving nothing since the variable doesn't
exist.  If this were the case then lpcbData would return the length of
'subdir1' which is 7, which is what the test expects, but testing
shows that even though the type is REG_EXPAND_SZ, RegEnumValue does
not expand the environment variable, so lpcbData contains the length
of %LONGSYSTEMVAR%\subdir1 which is 24, and which is what is returned
when called with XP.  This is further clarified by msdn docs,

"Your application should call ExpandEnvironmentStrings before
attempting to read the value of a REG_EXPAND_SZ registry data type."

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/apcompat/apcompat/call_expandenvironmentstrings_before_reading_reg_expand_sz.asp

While it never says that RegEnumValue doesn't expand REG_EXPAND_SZ,
this evidence shows that this is the case.  If anyone has any thoughts
on this, please let me know.  Otherwise I will be sending a patch that
fixes this test and then checking the test in wine to see if our
RegEnumValue needs to be fixed as well.

-- 
James Hawkins



More information about the wine-devel mailing list