Commit cd77c562 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

shlwapi: Forward SHOpenRegStream2() to shcore.

parent 9c91ba79
...@@ -397,135 +397,6 @@ static ISHRegStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength) ...@@ -397,135 +397,6 @@ static ISHRegStream *IStream_Create(HKEY hKey, LPBYTE pbBuffer, DWORD dwLength)
} }
/************************************************************************* /*************************************************************************
* 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.@] * SHCreateStreamWrapper [SHLWAPI.@]
* *
* Create an IStream object on a block of memory. * Create an IStream object on a block of memory.
......
...@@ -705,8 +705,8 @@ ...@@ -705,8 +705,8 @@
@ stdcall SHGetValueA ( long str str ptr ptr ptr ) @ stdcall SHGetValueA ( long str str ptr ptr ptr )
@ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr ) @ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr )
@ stdcall SHIsLowMemoryMachine(long) @ stdcall SHIsLowMemoryMachine(long)
@ stdcall SHOpenRegStream2A(long str str long) @ stdcall SHOpenRegStream2A(long str str long) shcore.SHOpenRegStream2A
@ stdcall SHOpenRegStream2W(long wstr wstr long) @ stdcall SHOpenRegStream2W(long wstr wstr long) shcore.SHOpenRegStream2W
@ stdcall SHOpenRegStreamA(long str str long) shcore.SHOpenRegStreamA @ stdcall SHOpenRegStreamA(long str str long) shcore.SHOpenRegStreamA
@ stdcall SHOpenRegStreamW(long wstr wstr long) shcore.SHOpenRegStreamW @ stdcall SHOpenRegStreamW(long wstr wstr long) shcore.SHOpenRegStreamW
@ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr) @ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr)
......
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