mirror of
https://github.com/reactos/reactos.git
synced 2025-08-03 19:55:41 +00:00
Expand the value if we have a REG_EXPAND_SZ entry
svn path=/trunk/; revision=20299
This commit is contained in:
parent
d86cf51518
commit
9b36d74ce9
1 changed files with 21 additions and 3 deletions
|
@ -231,6 +231,8 @@ ScmReadString(HKEY hServiceKey,
|
|||
DWORD dwError;
|
||||
DWORD dwSize;
|
||||
DWORD dwType;
|
||||
DWORD dwSizeNeeded;
|
||||
LPWSTR expanded = NULL;
|
||||
LPBYTE ptr = NULL;
|
||||
|
||||
*lpValue = NULL;
|
||||
|
@ -260,9 +262,22 @@ ScmReadString(HKEY hServiceKey,
|
|||
|
||||
if (dwType == REG_EXPAND_SZ)
|
||||
{
|
||||
/* FIXME: ... */
|
||||
DPRINT1("Expand me!\n");
|
||||
*lpValue = (LPWSTR)ptr;
|
||||
/* Expand the value... */
|
||||
dwSizeNeeded = ExpandEnvironmentStringsW((LPCWSTR)ptr, NULL, 0);
|
||||
if (dwSizeNeeded == 0)
|
||||
{
|
||||
dwError = GetLastError();
|
||||
goto done;
|
||||
}
|
||||
expanded = HeapAlloc(GetProcessHeap(), 0, dwSizeNeeded);
|
||||
if (dwSizeNeeded < ExpandEnvironmentStringsW((LPCWSTR)ptr, expanded, dwSizeNeeded))
|
||||
{
|
||||
dwError = GetLastError();
|
||||
goto done;
|
||||
}
|
||||
*lpValue = expanded;
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
dwError = ERROR_SUCCESS;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -271,7 +286,10 @@ ScmReadString(HKEY hServiceKey,
|
|||
|
||||
done:;
|
||||
if (dwError != ERROR_SUCCESS)
|
||||
{
|
||||
HeapFree(GetProcessHeap(), 0, ptr);
|
||||
HeapFree(GetProcessHeap(), 0, expanded);
|
||||
}
|
||||
|
||||
return dwError;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue