Jacek Caban : ole32: Forward BSTR functions to oleaut32.
Alexandre Julliard
julliard at winehq.org
Wed Jul 18 12:44:41 CDT 2012
Module: wine
Branch: master
Commit: 1eda4ac4baf1b825eb700394fc35d9c41bba7f6a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=1eda4ac4baf1b825eb700394fc35d9c41bba7f6a
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jul 18 16:55:44 2012 +0200
ole32: Forward BSTR functions to oleaut32.
---
dlls/ole32/Makefile.in | 1 +
dlls/ole32/ole2.c | 74 +++--------------------------------------------
2 files changed, 6 insertions(+), 69 deletions(-)
diff --git a/dlls/ole32/Makefile.in b/dlls/ole32/Makefile.in
index ea9c9cb..f24f035 100644
--- a/dlls/ole32/Makefile.in
+++ b/dlls/ole32/Makefile.in
@@ -1,6 +1,7 @@
MODULE = ole32.dll
IMPORTLIB = ole32
IMPORTS = uuid advapi32 user32 gdi32 rpcrt4
+DELAYIMPORTS = oleaut32
EXTRADEFS = -D_OLE32_ -DCOM_NO_WINDOWS_H \
-DENTRY_PREFIX=OLE32_ -DPROXY_CLSID=CLSID_PSFactoryBuffer -DWINE_REGISTER_DLL
diff --git a/dlls/ole32/ole2.c b/dlls/ole32/ole2.c
index 4680f40..6d37aa6 100644
--- a/dlls/ole32/ole2.c
+++ b/dlls/ole32/ole2.c
@@ -2816,86 +2816,22 @@ static void OLE_FreeClipDataArray(ULONG count, CLIPDATA * pClipDataArray)
/***********************************************************************
* PropSysAllocString [OLE32.@]
- * NOTES:
- * Basically a copy of SysAllocStringLen.
+ * NOTES
+ * Forward to oleaut32.
*/
BSTR WINAPI PropSysAllocString(LPCOLESTR str)
{
- DWORD bufferSize;
- DWORD* newBuffer;
- WCHAR* stringBuffer;
- int len;
-
- if (!str) return 0;
-
- len = lstrlenW(str);
- /*
- * Find the length of the buffer passed-in, in bytes.
- */
- bufferSize = len * sizeof (WCHAR);
-
- /*
- * Allocate a new buffer to hold the string.
- * Don't forget to keep an empty spot at the beginning of the
- * buffer for the character count and an extra character at the
- * end for the NULL.
- */
- newBuffer = HeapAlloc(GetProcessHeap(), 0,
- bufferSize + sizeof(WCHAR) + sizeof(DWORD));
-
- /*
- * If the memory allocation failed, return a null pointer.
- */
- if (newBuffer==0)
- return 0;
-
- /*
- * Copy the length of the string in the placeholder.
- */
- *newBuffer = bufferSize;
-
- /*
- * Skip the byte count.
- */
- newBuffer++;
-
- memcpy(newBuffer, str, bufferSize);
-
- /*
- * Make sure that there is a nul character at the end of the
- * string.
- */
- stringBuffer = (WCHAR*)newBuffer;
- stringBuffer[len] = '\0';
-
- return stringBuffer;
+ return SysAllocString(str);
}
/***********************************************************************
* PropSysFreeString [OLE32.@]
* NOTES
- * Copy of SysFreeString.
+ * Forward to oleaut32.
*/
void WINAPI PropSysFreeString(LPOLESTR str)
{
- DWORD* bufferPointer;
-
- /* NULL is a valid parameter */
- if(!str) return;
-
- /*
- * We have to be careful when we free a BSTR pointer, it points to
- * the beginning of the string but it skips the byte count contained
- * before the string.
- */
- bufferPointer = (DWORD*)str;
-
- bufferPointer--;
-
- /*
- * Free the memory from its "real" origin.
- */
- HeapFree(GetProcessHeap(), 0, bufferPointer);
+ SysFreeString(str);
}
/******************************************************************************
More information about the wine-cvs
mailing list