Commit e798d25f authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

advapi32: Expand environment variables even if REG_SZ type is used.

parent 1ed4c150
......@@ -3253,8 +3253,7 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
goto cleanup;
}
/* Expand environment variables, if appropriate, or copy the original string over. */
if (dwValueType == REG_EXPAND_SZ) {
/* Expand environment variables regardless of the type. */
cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
if (!cbData) goto cleanup;
pwszExpandedBuffer = heap_alloc(cbData);
......@@ -3263,10 +3262,6 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
goto cleanup;
}
ExpandEnvironmentStringsW(pwszTempBuffer, pwszExpandedBuffer, cbData / sizeof(WCHAR));
} else {
pwszExpandedBuffer = heap_alloc(cbData);
memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
}
/* Parse the value and load the string. */
{
......
......@@ -3862,7 +3862,7 @@ static void test_RegLoadMUIString(void)
{ "@unknown.dll", REG_SZ, TRUE, ERROR_INVALID_DATA, 0, TRUE },
{ "@unknown.dll,-10", REG_SZ, TRUE, ERROR_FILE_NOT_FOUND },
/* 4 */
{ with_env_var, REG_SZ, FALSE, ERROR_SUCCESS, 0, TRUE },
{ with_env_var, REG_SZ, FALSE, ERROR_SUCCESS },
{ with_env_var, REG_EXPAND_SZ, FALSE, ERROR_SUCCESS },
{ "%WineMuiTest1%", REG_EXPAND_SZ, TRUE, ERROR_INVALID_DATA },
{ "@%WineMuiTest2%", REG_EXPAND_SZ, TRUE, ERROR_SUCCESS },
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment