Nikolay Sivov : combase: Move IIDFromString().
Alexandre Julliard
julliard at winehq.org
Tue Aug 11 16:26:49 CDT 2020
Module: wine
Branch: master
Commit: e64908b9a8213aaf1cd28be8f376ef850ec76f64
URL: https://source.winehq.org/git/wine.git/?a=commit;h=e64908b9a8213aaf1cd28be8f376ef850ec76f64
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Tue Aug 11 08:43:10 2020 +0300
combase: Move IIDFromString().
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 | 23 ++++++++++
dlls/combase/combase.spec | 2 +-
dlls/ole32/compobj.c | 108 ----------------------------------------------
dlls/ole32/ole32.spec | 2 +-
4 files changed, 25 insertions(+), 110 deletions(-)
diff --git a/dlls/combase/combase.c b/dlls/combase/combase.c
index 2bfd1d79a7..205a27b811 100644
--- a/dlls/combase/combase.c
+++ b/dlls/combase/combase.c
@@ -1075,6 +1075,29 @@ HRESULT WINAPI CLSIDFromString(LPCOLESTR str, LPCLSID clsid)
return hr;
}
+/******************************************************************************
+ * IIDFromString (combase.@)
+ */
+HRESULT WINAPI IIDFromString(LPCOLESTR str, IID *iid)
+{
+ TRACE("%s, %p\n", debugstr_w(str), iid);
+
+ if (!str)
+ {
+ memset(iid, 0, sizeof(*iid));
+ return S_OK;
+ }
+
+ /* length mismatch is a special case */
+ if (lstrlenW(str) + 1 != CHARS_IN_GUID)
+ return E_INVALIDARG;
+
+ if (str[0] != '{')
+ return CO_E_IIDSTRING;
+
+ return guid_from_string(str, iid) ? S_OK : CO_E_IIDSTRING;
+}
+
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 97e8f254dc..c0c1f2ada6 100644
--- a/dlls/combase/combase.spec
+++ b/dlls/combase/combase.spec
@@ -231,7 +231,7 @@
@ stdcall HWND_UserSize(ptr long ptr)
@ stdcall HWND_UserUnmarshal(ptr ptr ptr)
@ stub HkOleRegisterObject
-@ stdcall IIDFromString(wstr ptr) ole32.IIDFromString
+@ stdcall IIDFromString(wstr ptr)
@ stub InternalAppInvokeExceptionFilter
@ stub InternalCCFreeUnused
@ stub InternalCCGetClassInformationForDde
diff --git a/dlls/ole32/compobj.c b/dlls/ole32/compobj.c
index ff0c352c64..9715868584 100644
--- a/dlls/ole32/compobj.c
+++ b/dlls/ole32/compobj.c
@@ -2186,114 +2186,6 @@ HRESULT WINAPI CoDisconnectObject( LPUNKNOWN lpUnk, DWORD reserved )
return S_OK;
}
-static inline BOOL is_valid_hex(WCHAR c)
-{
- if (!(((c >= '0') && (c <= '9')) ||
- ((c >= 'a') && (c <= 'f')) ||
- ((c >= 'A') && (c <= 'F'))))
- return FALSE;
- return TRUE;
-}
-
-static const BYTE guid_conv_table[256] =
-{
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x00 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x10 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x20 */
- 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 0, 0, 0, 0, 0, 0, /* 0x30 */
- 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x40 */
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* 0x50 */
- 0, 0xa, 0xb, 0xc, 0xd, 0xe, 0xf /* 0x60 */
-};
-
-/* conversion helper for CLSIDFromString/IIDFromString */
-static BOOL guid_from_string(LPCWSTR s, GUID *id)
-{
- int i;
-
- if (!s || s[0]!='{') {
- memset( id, 0, sizeof (CLSID) );
- if(!s) return TRUE;
- return FALSE;
- }
-
- TRACE("%s -> %p\n", debugstr_w(s), id);
-
- /* in form {XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX} */
-
- id->Data1 = 0;
- for (i = 1; i < 9; i++) {
- if (!is_valid_hex(s[i])) return FALSE;
- id->Data1 = (id->Data1 << 4) | guid_conv_table[s[i]];
- }
- if (s[9]!='-') return FALSE;
-
- id->Data2 = 0;
- for (i = 10; i < 14; i++) {
- if (!is_valid_hex(s[i])) return FALSE;
- id->Data2 = (id->Data2 << 4) | guid_conv_table[s[i]];
- }
- if (s[14]!='-') return FALSE;
-
- id->Data3 = 0;
- for (i = 15; i < 19; i++) {
- if (!is_valid_hex(s[i])) return FALSE;
- id->Data3 = (id->Data3 << 4) | guid_conv_table[s[i]];
- }
- if (s[19]!='-') return FALSE;
-
- for (i = 20; i < 37; i+=2) {
- if (i == 24) {
- if (s[i]!='-') return FALSE;
- i++;
- }
- if (!is_valid_hex(s[i]) || !is_valid_hex(s[i+1])) return FALSE;
- id->Data4[(i-20)/2] = guid_conv_table[s[i]] << 4 | guid_conv_table[s[i+1]];
- }
-
- if (s[37] == '}' && s[38] == '\0')
- return TRUE;
-
- return FALSE;
-}
-
-/******************************************************************************
- * IIDFromString [OLE32.@]
- *
- * Converts an interface identifier from its string representation to
- * the IID struct.
- *
- * PARAMS
- * idstr [I] The string representation of the GUID.
- * id [O] IID converted from the string.
- *
- * RETURNS
- * S_OK on success
- * CO_E_IIDSTRING if idstr is not a valid IID
- *
- * SEE ALSO
- * StringFromIID
- */
-HRESULT WINAPI IIDFromString(LPCOLESTR s, IID *iid)
-{
- TRACE("%s -> %p\n", debugstr_w(s), iid);
-
- if (!s)
- {
- memset(iid, 0, sizeof(*iid));
- return S_OK;
- }
-
- /* length mismatch is a special case */
- if (lstrlenW(s) + 1 != CHARS_IN_GUID)
- return E_INVALIDARG;
-
- if (s[0] != '{')
- return CO_E_IIDSTRING;
-
- return guid_from_string(s, iid) ? S_OK : CO_E_IIDSTRING;
-}
-
/******************************************************************************
* StringFromCLSID [OLE32.@]
* StringFromIID [OLE32.@]
diff --git a/dlls/ole32/ole32.spec b/dlls/ole32/ole32.spec
index f71fd52032..cd530763c2 100644
--- a/dlls/ole32/ole32.spec
+++ b/dlls/ole32/ole32.spec
@@ -171,7 +171,7 @@
@ stdcall HWND_UserMarshal(ptr ptr ptr) combase.HWND_UserMarshal
@ stdcall HWND_UserSize(ptr long ptr) combase.HWND_UserSize
@ stdcall HWND_UserUnmarshal(ptr ptr ptr) combase.HWND_UserUnmarshal
-@ stdcall IIDFromString(wstr ptr)
+@ stdcall IIDFromString(wstr ptr) combase.IIDFromString
@ stub I_RemoteMain
@ stdcall IsAccelerator(long long ptr ptr)
@ stdcall IsEqualGUID(ptr ptr)
More information about the wine-cvs
mailing list