Nikolay Sivov : combase: Move CLSIDFromString().
Alexandre Julliard
julliard at winehq.org
Mon Aug 10 16:16:29 CDT 2020
Module: wine
Branch: master
Commit: b10d99a3713c7c1a579132446b26abeeed63b683
URL: https://source.winehq.org/git/wine.git/?a=commit;h=b10d99a3713c7c1a579132446b26abeeed63b683
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Mon Aug 10 11:12:52 2020 +0300
combase: Move CLSIDFromString().
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/combase/combase.c | 22 +++++++++++++++
dlls/combase/combase.spec | 2 +-
dlls/ole32/compobj.c | 69 -----------------------------------------------
dlls/ole32/ole32.spec | 2 +-
4 files changed, 24 insertions(+), 71 deletions(-)
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c
index 2d202c796d..2bfd1d79a7 100644
--- a/dlls/combase/combase.c
+++ b/dlls/combase/combase.c
@@ -1053,6 +1053,28 @@ HRESULT WINAPI DECLSPEC_HOTPATCH CLSIDFromProgID(LPCOLESTR progid, CLSID *clsid)
return clsid_from_string_reg(progid, clsid);
}
+/******************************************************************************
+ * CLSIDFromString (combase.@)
+ */
+HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
+{
+ CLSID tmp_id;
+ HRESULT hr;
+
+ if (!clsid)
+ return E_INVALIDARG;
+
+ if (guid_from_string(str, clsid))
+ return S_OK;
+
+ /* It appears a ProgID is also valid */
+ hr = clsid_from_string_reg(str, &tmp_id);
+ if (SUCCEEDED(hr))
+ *clsid = tmp_id;
+
+ return hr;
+}
+
static void init_multi_qi(DWORD count, MULTI_QI *mqi, HRESULT hr)
{
ULONG i;
diff --git a/dlls/combase/combase.spec b/dlls/combase/combase.spec
index 4e5c5a9dc9..97e8f254dc 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -68,7 +68,7 @@
@ stdcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr)
@ stub CLSIDFromOle1Class
@ stdcall CLSIDFromProgID(wstr ptr)
-@ stdcall CLSIDFromString(wstr ptr) ole32.CLSIDFromString
+@ stdcall CLSIDFromString(wstr ptr)
@ stub CleanupOleStateInAllTls
@ stdcall CleanupTlsOleState(ptr)
@ stub ClearCleanupFlag
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index 91ff812428..ff0c352c64 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2257,75 +2257,6 @@ static BOOL guid_from_string(LPCWSTR s, GUID *id)
return FALSE;
}
-/*****************************************************************************/
-
-static HRESULT clsid_from_string_reg(LPCOLESTR progid, CLSID *clsid)
-{
- static const WCHAR clsidW[] = { '\\','C','L','S','I','D',0 };
- WCHAR buf2[CHARS_IN_GUID];
- LONG buf2len = sizeof(buf2);
- HKEY xhkey;
- WCHAR *buf;
-
- memset(clsid, 0, sizeof(*clsid));
- buf = HeapAlloc( GetProcessHeap(),0,(lstrlenW(progid)+8) * sizeof(WCHAR) );
- if (!buf) return E_OUTOFMEMORY;
- lstrcpyW( buf, progid );
- lstrcatW( buf, clsidW );
- if (open_classes_key(HKEY_CLASSES_ROOT, buf, MAXIMUM_ALLOWED, &xhkey))
- {
- HeapFree(GetProcessHeap(),0,buf);
- WARN("couldn't open key for ProgID %s\n", debugstr_w(progid));
- return CO_E_CLASSSTRING;
- }
- HeapFree(GetProcessHeap(),0,buf);
-
- if (RegQueryValueW(xhkey,NULL,buf2,&buf2len))
- {
- RegCloseKey(xhkey);
- WARN("couldn't query clsid value for ProgID %s\n", debugstr_w(progid));
- return CO_E_CLASSSTRING;
- }
- RegCloseKey(xhkey);
- return guid_from_string(buf2, clsid) ? S_OK : CO_E_CLASSSTRING;
-}
-
-/******************************************************************************
- * CLSIDFromString [OLE32.@]
- *
- * Converts a unique identifier from its string representation into
- * the GUID struct.
- *
- * PARAMS
- * idstr [I] The string representation of the GUID.
- * id [O] GUID converted from the string.
- *
- * RETURNS
- * S_OK on success
- * CO_E_CLASSSTRING if idstr is not a valid CLSID
- *
- * SEE ALSO
- * StringFromCLSID
- */
-HRESULT WINAPI CLSIDFromString(LPCOLESTR idstr, LPCLSID id )
-{
- HRESULT ret = CO_E_CLASSSTRING;
- CLSID tmp_id;
-
- if (!id)
- return E_INVALIDARG;
-
- if (guid_from_string(idstr, id))
- return S_OK;
-
- /* It appears a ProgID is also valid */
- ret = clsid_from_string_reg(idstr, &tmp_id);
- if(SUCCEEDED(ret))
- *id = tmp_id;
-
- return ret;
-}
-
/******************************************************************************
* IIDFromString [OLE32.@]
*
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index ce5d7987d9..f71fd52032 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -5,7 +5,7 @@
@ stdcall CLIPFORMAT_UserUnmarshal(ptr ptr ptr) combase.CLIPFORMAT_UserUnmarshal
@ stdcall CLSIDFromProgID(wstr ptr) combase.CLSIDFromProgID
@ stdcall CLSIDFromProgIDEx(wstr ptr)
-@ stdcall CLSIDFromString(wstr ptr)
+@ stdcall CLSIDFromString(wstr ptr) combase.CLSIDFromString
@ stdcall CoAddRefServerProcess()
@ stdcall CoAllowSetForegroundWindow(ptr ptr)
@ stdcall CoBuildVersion()
More information about the wine-cvs
mailing list