Nikolay Sivov : shlwapi: Forward SHOpenRegStream2() to shcore.

Alexandre Julliard julliard at winehq.org
Mon Dec 3 15:28:53 CST 2018


Module: wine
Branch: master
Commit: cd77c562bb0be19cfc868f3dfcc0739db659adaa
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=cd77c562bb0be19cfc868f3dfcc0739db659adaa

Author: Nikolay Sivov <nsivov at codeweavers.com>
Date:   Mon Dec  3 10:40:58 2018 +0300

shlwapi: Forward SHOpenRegStream2() to shcore.

Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 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 102d6b7..31df82a 100644
--- a/dlls/shlwapi/regstream.c
+++ b/dlls/shlwapi/regstream.c
@@ -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.@]
  *
  * Create an IStream object on a block of memory.
diff --git a/dlls/shlwapi/shlwapi.spec b/dlls/shlwapi/shlwapi.spec
index f9e2570..9c01c3f 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)




More information about the wine-cvs mailing list