mirror of
https://github.com/reactos/reactos.git
synced 2025-08-04 03:05:40 +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 dwError;
|
||||||
DWORD dwSize;
|
DWORD dwSize;
|
||||||
DWORD dwType;
|
DWORD dwType;
|
||||||
|
DWORD dwSizeNeeded;
|
||||||
|
LPWSTR expanded = NULL;
|
||||||
LPBYTE ptr = NULL;
|
LPBYTE ptr = NULL;
|
||||||
|
|
||||||
*lpValue = NULL;
|
*lpValue = NULL;
|
||||||
|
@ -260,9 +262,22 @@ ScmReadString(HKEY hServiceKey,
|
||||||
|
|
||||||
if (dwType == REG_EXPAND_SZ)
|
if (dwType == REG_EXPAND_SZ)
|
||||||
{
|
{
|
||||||
/* FIXME: ... */
|
/* Expand the value... */
|
||||||
DPRINT1("Expand me!\n");
|
dwSizeNeeded = ExpandEnvironmentStringsW((LPCWSTR)ptr, NULL, 0);
|
||||||
*lpValue = (LPWSTR)ptr;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
@ -271,7 +286,10 @@ ScmReadString(HKEY hServiceKey,
|
||||||
|
|
||||||
done:;
|
done:;
|
||||||
if (dwError != ERROR_SUCCESS)
|
if (dwError != ERROR_SUCCESS)
|
||||||
|
{
|
||||||
HeapFree(GetProcessHeap(), 0, ptr);
|
HeapFree(GetProcessHeap(), 0, ptr);
|
||||||
|
HeapFree(GetProcessHeap(), 0, expanded);
|
||||||
|
}
|
||||||
|
|
||||||
return dwError;
|
return dwError;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue