[PATCH 2/5] shcore: Add StrDupA()/StrDupW().
Nikolay Sivov
nsivov at codeweavers.com
Wed Nov 28 00:59:03 CST 2018
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/shcore/main.c | 46 +++++++++++++++++++++++++++++++++++++++++
dlls/shcore/shcore.spec | 4 ++--
2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/dlls/shcore/main.c b/dlls/shcore/main.c
index 93effef6ad..bf477aefcc 100644
--- a/dlls/shcore/main.c
+++ b/dlls/shcore/main.c
@@ -1409,3 +1409,49 @@ BOOL WINAPI SHCreateThread(LPTHREAD_START_ROUTINE thread_proc, void *data, DWORD
return called;
}
+
+/*************************************************************************
+ * SHStrDupW [SHCORE.@]
+ */
+HRESULT WINAPI SHStrDupW(const WCHAR *src, WCHAR **dest)
+{
+ size_t len;
+
+ TRACE("(%s, %p)\n", debugstr_w(src), dest);
+
+ *dest = NULL;
+
+ if (!src)
+ return E_INVALIDARG;
+
+ len = (strlenW(src) + 1) * sizeof(WCHAR);
+ *dest = CoTaskMemAlloc(len);
+ if (!*dest)
+ return E_OUTOFMEMORY;
+
+ memcpy(*dest, src, len);
+
+ return S_OK;
+}
+
+/*************************************************************************
+ * SHStrDupA [SHCORE.@]
+ */
+HRESULT WINAPI SHStrDupA(const char *src, WCHAR **dest)
+{
+ DWORD len;
+
+ *dest = NULL;
+
+ if (!src)
+ return E_INVALIDARG;
+
+ len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
+ *dest = CoTaskMemAlloc(len * sizeof(WCHAR));
+ if (!*dest)
+ return E_OUTOFMEMORY;
+
+ MultiByteToWideChar(CP_ACP, 0, src, -1, *dest, len);
+
+ return S_OK;
+}
diff --git a/dlls/shcore/shcore.spec b/dlls/shcore/shcore.spec
index a08c2da7e0..1473bf7b0a 100644
--- a/dlls/shcore/shcore.spec
+++ b/dlls/shcore/shcore.spec
@@ -73,8 +73,8 @@
@ stdcall SHSetThreadRef(ptr)
@ stdcall SHSetValueA(long str str long ptr long) shlwapi.SHSetValueA
@ stdcall SHSetValueW(long wstr wstr long ptr long) shlwapi.SHSetValueW
-@ stdcall SHStrDupA(str ptr) shlwapi.SHStrDupA
-@ stdcall SHStrDupW(wstr ptr) shlwapi.SHStrDupW
+@ stdcall SHStrDupA(str ptr)
+@ stdcall SHStrDupW(wstr ptr)
@ stdcall SHUnicodeToAnsi(wstr ptr ptr) shlwapi.SHUnicodeToAnsi
@ stdcall SHUnicodeToUnicode(wstr ptr long) shlwapi.SHUnicodeToUnicode
@ stdcall SetCurrentProcessExplicitAppUserModelID(wstr)
--
2.19.2
More information about the wine-devel
mailing list