Commit 1ed4c150 authored by Akihiro Sagawa's avatar Akihiro Sagawa Committed by Alexandre Julliard

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

parent 90f79099
...@@ -3247,6 +3247,12 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer ...@@ -3247,6 +3247,12 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
result = RegQueryValueExW(hKey, pwszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData); result = RegQueryValueExW(hKey, pwszValue, NULL, &dwValueType, (LPBYTE)pwszTempBuffer, &cbData);
if (result != ERROR_SUCCESS) goto cleanup; 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. */ /* Expand environment variables, if appropriate, or copy the original string over. */
if (dwValueType == REG_EXPAND_SZ) { if (dwValueType == REG_EXPAND_SZ) {
cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR); cbData = ExpandEnvironmentStringsW(pwszTempBuffer, NULL, 0) * sizeof(WCHAR);
...@@ -3262,14 +3268,8 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer ...@@ -3262,14 +3268,8 @@ LSTATUS WINAPI RegLoadMUIStringW(HKEY hKey, LPCWSTR pwszValue, LPWSTR pwszBuffer
memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData); memcpy(pwszExpandedBuffer, pwszTempBuffer, cbData);
} }
/* If the value references a resource based string, parse the value and load the 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 {
WCHAR *pComma = strrchrW(pwszExpandedBuffer, ','), *pNewBuffer; WCHAR *pComma = strrchrW(pwszExpandedBuffer, ','), *pNewBuffer;
const WCHAR backslashW[] = {'\\',0}; const WCHAR backslashW[] = {'\\',0};
UINT uiStringId; UINT uiStringId;
......
...@@ -3857,14 +3857,14 @@ static void test_RegLoadMUIString(void) ...@@ -3857,14 +3857,14 @@ static void test_RegLoadMUIString(void)
BOOL todo; BOOL todo;
} test_case[] = { } test_case[] = {
/* 0 */ /* 0 */
{ "", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE }, { "", REG_SZ, FALSE, ERROR_INVALID_DATA },
{ "not a MUI string", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE }, { "not a MUI string", REG_SZ, FALSE, ERROR_INVALID_DATA },
{ "@unknown.dll", REG_SZ, TRUE, ERROR_INVALID_DATA, 0, TRUE }, { "@unknown.dll", REG_SZ, TRUE, ERROR_INVALID_DATA, 0, TRUE },
{ "@unknown.dll,-10", REG_SZ, TRUE, ERROR_FILE_NOT_FOUND }, { "@unknown.dll,-10", REG_SZ, TRUE, ERROR_FILE_NOT_FOUND },
/* 4 */ /* 4 */
{ with_env_var, REG_SZ, FALSE, ERROR_SUCCESS, 0, TRUE }, { with_env_var, REG_SZ, FALSE, ERROR_SUCCESS, 0, TRUE },
{ with_env_var, REG_EXPAND_SZ, FALSE, ERROR_SUCCESS }, { 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 }, { "@%WineMuiTest2%", REG_EXPAND_SZ, TRUE, ERROR_SUCCESS },
/* 8 */ /* 8 */
{ "@%WineMuiExe%,a", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE }, { "@%WineMuiExe%,a", REG_SZ, FALSE, ERROR_INVALID_DATA, 0, TRUE },
......
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