[PATCH 3/5] shlwapi: Forward SHOpenRegStream2() to shcore.
Nikolay Sivov
nsivov at codeweavers.com
Mon Dec 3 01:40:58 CST 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/shlwapi/regstream.c | 129 --------------------------------------
dlls/shlwapi/shlwapi.spec | 4 +-
2 files changed, 2 insertions(+), 131 deletions(-)
diff --git a/dlls/shlwapi/regstream.c b/dlls/shlwapi/regstream.c
index 102d6b7bb2..31df82aa8d 100644
--- a/dlls/shlwapi/regstream.c
+++ b/dlls/shlwapi/regstream.c
@@ -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.@]
*
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index f9e2570914..9c01c3f6d4 100644
--- a/dlls/shlwapi/shlwapi.spec
+++ b/dlls/shlwapi/shlwapi.spec
@@ -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)
--
2.19.2
More information about the wine-devel
mailing list