This commit is contained in:
Igor Pavlov
2014-11-23 00:00:00 +00:00
committed by Kornel Lesiński
parent 83f8ddcc5b
commit f08f4dcc3c
1158 changed files with 76451 additions and 35082 deletions
Executable → Regular
+20 -4
View File
@@ -28,7 +28,7 @@ BSTR SysAllocStringByteLen(LPCSTR psz, UINT len)
BSTR bstr = (BSTR)((UINT *)p + 1);
if (psz)
{
memmove(bstr, psz, len);
memcpy(bstr, psz, len);
Byte *pb = ((Byte *)bstr) + len;
for (unsigned i = 0; i < sizeof(OLECHAR) * 2; i++)
pb[i] = 0;
@@ -36,6 +36,22 @@ BSTR SysAllocStringByteLen(LPCSTR psz, UINT len)
return bstr;
}
BSTR SysAllocStringLen(const OLECHAR *sz, UINT len)
{
int realLen = sizeof(UINT) + len * sizeof(OLECHAR) + sizeof(OLECHAR);
void *p = AllocateForBSTR(realLen);
if (p == 0)
return 0;
*(UINT *)p = len * sizeof(OLECHAR);
BSTR bstr = (BSTR)((UINT *)p + 1);
if (sz)
{
memcpy(bstr, sz, len * sizeof(OLECHAR));
bstr[len] = 0;
}
return bstr;
}
BSTR SysAllocString(const OLECHAR *sz)
{
if (sz == 0)
@@ -45,9 +61,9 @@ BSTR SysAllocString(const OLECHAR *sz)
void *p = AllocateForBSTR(len + sizeof(UINT));
if (p == 0)
return 0;
*(UINT *)p = strLen;
*(UINT *)p = strLen * sizeof(OLECHAR);
BSTR bstr = (BSTR)((UINT *)p + 1);
memmove(bstr, sz, len);
memcpy(bstr, sz, len);
return bstr;
}
@@ -77,7 +93,7 @@ HRESULT VariantClear(VARIANTARG *prop)
return S_OK;
}
HRESULT VariantCopy(VARIANTARG *dest, VARIANTARG *src)
HRESULT VariantCopy(VARIANTARG *dest, const VARIANTARG *src)
{
HRESULT res = ::VariantClear(dest);
if (res != S_OK)