shlwapi: Forward SHOpenRegStream2() to shcore.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
9c91ba7986
commit
cd77c562bb
|
@ -396,135 +396,6 @@ static ISHRegStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength)
|
|||
return regStream;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHOpenRegStream2A [SHLWAPI.@]
|
||||
*
|
||||
* Create a stream to read binary registry data.
|
||||
*
|
||||
* PARAMS
|
||||
* hKey [I] Registry handle
|
||||
* pszSubkey [I] The sub key name
|
||||
* pszValue [I] The value name under the sub key
|
||||
* dwMode [I] Unused
|
||||
*
|
||||
* RETURNS
|
||||
* Success: An IStream interface referring to the registry data
|
||||
* Failure: NULL, if the registry key could not be opened or is not binary.
|
||||
*/
|
||||
IStream * WINAPI SHOpenRegStream2A(HKEY hKey, LPCSTR pszSubkey,
|
||||
LPCSTR pszValue,DWORD dwMode)
|
||||
{
|
||||
ISHRegStream *tmp;
|
||||
HKEY hStrKey = NULL;
|
||||
LPBYTE lpBuff = NULL;
|
||||
DWORD dwLength = 0;
|
||||
LONG ret;
|
||||
|
||||
TRACE("(%p,%s,%s,0x%08x)\n", hKey, pszSubkey, pszValue, dwMode);
|
||||
|
||||
if (dwMode == STGM_READ)
|
||||
ret = RegOpenKeyExA(hKey, pszSubkey, 0, KEY_READ, &hStrKey);
|
||||
else /* in write mode we make sure the subkey exits */
|
||||
ret = RegCreateKeyExA(hKey, pszSubkey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hStrKey, NULL);
|
||||
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
if (dwMode == STGM_READ || dwMode == STGM_READWRITE)
|
||||
{
|
||||
/* read initial data */
|
||||
ret = RegQueryValueExA(hStrKey, pszValue, 0, 0, 0, &dwLength);
|
||||
if (ret == ERROR_SUCCESS && dwLength)
|
||||
{
|
||||
lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength);
|
||||
RegQueryValueExA(hStrKey, pszValue, 0, 0, lpBuff, &dwLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dwLength)
|
||||
lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength);
|
||||
|
||||
tmp = IStream_Create(hStrKey, lpBuff, dwLength);
|
||||
if(tmp)
|
||||
{
|
||||
if(pszValue)
|
||||
{
|
||||
int len = lstrlenA(pszValue) + 1;
|
||||
tmp->u.keyNameA = HeapAlloc(GetProcessHeap(), 0, len);
|
||||
memcpy(tmp->u.keyNameA, pszValue, len);
|
||||
}
|
||||
|
||||
tmp->dwMode = dwMode;
|
||||
tmp->bUnicode = FALSE;
|
||||
return &tmp->IStream_iface;
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpBuff);
|
||||
if (hStrKey)
|
||||
RegCloseKey(hStrKey);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHOpenRegStream2W [SHLWAPI.@]
|
||||
*
|
||||
* See SHOpenRegStream2A.
|
||||
*/
|
||||
IStream * WINAPI SHOpenRegStream2W(HKEY hKey, LPCWSTR pszSubkey,
|
||||
LPCWSTR pszValue, DWORD dwMode)
|
||||
{
|
||||
ISHRegStream *tmp;
|
||||
HKEY hStrKey = NULL;
|
||||
LPBYTE lpBuff = NULL;
|
||||
DWORD dwLength = 0;
|
||||
LONG ret;
|
||||
|
||||
TRACE("(%p,%s,%s,0x%08x)\n", hKey, debugstr_w(pszSubkey),
|
||||
debugstr_w(pszValue), dwMode);
|
||||
|
||||
if (dwMode == STGM_READ)
|
||||
ret = RegOpenKeyExW(hKey, pszSubkey, 0, KEY_READ, &hStrKey);
|
||||
else /* in write mode we make sure the subkey exits */
|
||||
ret = RegCreateKeyExW(hKey, pszSubkey, 0, NULL, 0, KEY_READ | KEY_WRITE, NULL, &hStrKey, NULL);
|
||||
|
||||
if (ret == ERROR_SUCCESS)
|
||||
{
|
||||
if (dwMode == STGM_READ || dwMode == STGM_READWRITE)
|
||||
{
|
||||
/* read initial data */
|
||||
ret = RegQueryValueExW(hStrKey, pszValue, 0, 0, 0, &dwLength);
|
||||
if (ret == ERROR_SUCCESS && dwLength)
|
||||
{
|
||||
lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength);
|
||||
RegQueryValueExW(hStrKey, pszValue, 0, 0, lpBuff, &dwLength);
|
||||
}
|
||||
}
|
||||
|
||||
if (!dwLength)
|
||||
lpBuff = HeapAlloc(GetProcessHeap(), 0, dwLength);
|
||||
|
||||
tmp = IStream_Create(hStrKey, lpBuff, dwLength);
|
||||
if(tmp)
|
||||
{
|
||||
if(pszValue)
|
||||
{
|
||||
int len = lstrlenW(pszValue) + 1;
|
||||
tmp->u.keyNameW = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
|
||||
memcpy(tmp->u.keyNameW, pszValue, len * sizeof(WCHAR));
|
||||
}
|
||||
|
||||
tmp->dwMode = dwMode;
|
||||
tmp->bUnicode = TRUE;
|
||||
return &tmp->IStream_iface;
|
||||
}
|
||||
}
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, lpBuff);
|
||||
if (hStrKey)
|
||||
RegCloseKey(hStrKey);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* SHCreateStreamWrapper [SHLWAPI.@]
|
||||
*
|
||||
|
|
|
@ -705,8 +705,8 @@
|
|||
@ stdcall SHGetValueA ( long str str ptr ptr ptr )
|
||||
@ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr )
|
||||
@ stdcall SHIsLowMemoryMachine(long)
|
||||
@ stdcall SHOpenRegStream2A(long str str long)
|
||||
@ stdcall SHOpenRegStream2W(long wstr wstr long)
|
||||
@ stdcall SHOpenRegStream2A(long str str long) shcore.SHOpenRegStream2A
|
||||
@ stdcall SHOpenRegStream2W(long wstr wstr long) shcore.SHOpenRegStream2W
|
||||
@ stdcall SHOpenRegStreamA(long str str long) shcore.SHOpenRegStreamA
|
||||
@ stdcall SHOpenRegStreamW(long wstr wstr long) shcore.SHOpenRegStreamW
|
||||
@ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr)
|
||||
|
|
Loading…
Reference in New Issue