advapi32: RegLoadMUIString doesn't accept a string without '@' prefix.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2019-05-26 21:15:03 +09:00 committed by Alexandre Julliard
parent 90f79099a4
commit 1ed4c150a2
2 changed files with 11 additions and 11 deletions

View File

@ -3247,6 +3247,12 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
result = RegQueryValueExW(hKey, pwszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData);
if (result != ERROR_SUCCESS) goto cleanup;
/* '@' is the prefix for resource based string entries. */
if (*pwszTempBuffer != '@') {
result = ERROR_INVALID_DATA;
goto cleanup;
}
/* Expand environment variables, if appropriate, or copy the original string over. */
if (dwValueType == REG_EXPAND_SZ) {
cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
@ -3262,14 +3268,8 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
}
/* If the value references a resource based string, parse the value and load the string.
* Else just copy over the original value. */
result = ERROR_SUCCESS;
if (*pwszExpandedBuffer != '@') { /* '@' is the prefix for resource based string entries. */
lstrcpynW(pwszBuffer, pwszExpandedBuffer, cbBuffer / sizeof(WCHAR));
if (pcbData)
*pcbData = (strlenW(pwszExpandedBuffer) + 1) * sizeof(WCHAR);
} else {
/* Parse the value and load the string. */
{
WCHAR *pComma = strrchrW(pwszExpandedBuffer, ','), *pNewBuffer;
const WCHAR backslashW[] = {'\\',0};
UINT uiStringId;

View File

@ -3857,14 +3857,14 @@ static void test_RegLoadMUIString(void)
BOOL todo;
} test_case[] = {
/* 0 */
{ "", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE },
{ "not a MUI string", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE },
{ "", REG_SZ, FALSE, ERROR_INVALID_DATA },
{ "not a MUI string", REG_SZ, FALSE, ERROR_INVALID_DATA },
{ "@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_EXPAND_SZ, FALSE, ERROR_SUCCESS },
{ "%WineMuiTest1%", REG_EXPAND_SZ, TRUE, ERROR_INVALID_DATA, 0, TRUE },
{ "%WineMuiTest1%", REG_EXPAND_SZ, TRUE, ERROR_INVALID_DATA },
{ "@%WineMuiTest2%", REG_EXPAND_SZ, TRUE, ERROR_SUCCESS },
/* 8 */
{ "@%WineMuiExe%,a", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE },