ole32: Use nameless unions.
Signed-off-by: Jacek Caban <jacek@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
5d8dde1ab7
commit
903cf0ffe1
|
@ -2,7 +2,7 @@ MODULE = ole32.dll
|
|||
IMPORTLIB = ole32
|
||||
IMPORTS = uuid advapi32 user32 gdi32 combase rpcrt4
|
||||
DELAYIMPORTS = oleaut32
|
||||
EXTRADEFS = -D_OLE32_ -DWINE_NO_NAMELESS_EXTENSION
|
||||
EXTRADEFS = -D_OLE32_
|
||||
|
||||
EXTRADLLFLAGS = -mno-cygwin
|
||||
|
||||
|
|
|
@ -511,11 +511,11 @@ static HRESULT WINAPI IPropertyStorage_fnReadMultiple(
|
|||
{
|
||||
case PID_CODEPAGE:
|
||||
rgpropvar[i].vt = VT_I2;
|
||||
rgpropvar[i].u.iVal = This->codePage;
|
||||
rgpropvar[i].iVal = This->codePage;
|
||||
break;
|
||||
case PID_LOCALE:
|
||||
rgpropvar[i].vt = VT_I4;
|
||||
rgpropvar[i].u.lVal = This->locale;
|
||||
rgpropvar[i].lVal = This->locale;
|
||||
break;
|
||||
default:
|
||||
{
|
||||
|
@ -629,12 +629,12 @@ static HRESULT PropertyStorage_PropVariantCopy(PROPVARIANT *prop, const PROPVARI
|
|||
switch (propvar->vt)
|
||||
{
|
||||
case VT_LPSTR:
|
||||
hr = PropertyStorage_StringCopy(propvar->u.pszVal, srcCP, &prop->u.pszVal, targetCP);
|
||||
hr = PropertyStorage_StringCopy(propvar->pszVal, srcCP, &prop->pszVal, targetCP);
|
||||
if (SUCCEEDED(hr))
|
||||
prop->vt = VT_LPSTR;
|
||||
break;
|
||||
case VT_BSTR:
|
||||
if ((prop->u.bstrVal = SysAllocStringLen(propvar->u.bstrVal, SysStringLen(propvar->u.bstrVal))))
|
||||
if ((prop->bstrVal = SysAllocStringLen(propvar->bstrVal, SysStringLen(propvar->bstrVal))))
|
||||
prop->vt = VT_BSTR;
|
||||
else
|
||||
hr = E_OUTOFMEMORY;
|
||||
|
@ -802,7 +802,7 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
|
|||
if (dictionary_num_entries(This->propid_to_prop) == 0 &&
|
||||
rgpropvar[i].vt == VT_I2)
|
||||
{
|
||||
This->codePage = rgpropvar[i].u.iVal;
|
||||
This->codePage = rgpropvar[i].iVal;
|
||||
if (This->codePage == CP_UNICODE)
|
||||
This->grfFlags &= ~PROPSETFLAG_ANSI;
|
||||
else
|
||||
|
@ -815,7 +815,7 @@ static HRESULT WINAPI IPropertyStorage_fnWriteMultiple(
|
|||
/* Can only set the locale if nothing else has been set */
|
||||
if (dictionary_num_entries(This->propid_to_prop) == 0 &&
|
||||
rgpropvar[i].vt == VT_I4)
|
||||
This->locale = rgpropvar[i].u.lVal;
|
||||
This->locale = rgpropvar[i].lVal;
|
||||
else
|
||||
hr = STG_E_INVALIDPARAMETER;
|
||||
break;
|
||||
|
@ -1257,46 +1257,46 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
hr = S_OK;
|
||||
break;
|
||||
case VT_I1:
|
||||
hr = buffer_read_byte(buffer, offset, (BYTE *)&prop->u.cVal);
|
||||
TRACE("Read char 0x%x ('%c')\n", prop->u.cVal, prop->u.cVal);
|
||||
hr = buffer_read_byte(buffer, offset, (BYTE *)&prop->cVal);
|
||||
TRACE("Read char 0x%x ('%c')\n", prop->cVal, prop->cVal);
|
||||
break;
|
||||
case VT_UI1:
|
||||
hr = buffer_read_byte(buffer, offset, &prop->u.bVal);
|
||||
TRACE("Read byte 0x%x\n", prop->u.bVal);
|
||||
hr = buffer_read_byte(buffer, offset, &prop->bVal);
|
||||
TRACE("Read byte 0x%x\n", prop->bVal);
|
||||
break;
|
||||
case VT_BOOL:
|
||||
hr = buffer_read_word(buffer, offset, (WORD *)&prop->u.boolVal);
|
||||
TRACE("Read bool %d\n", prop->u.boolVal);
|
||||
hr = buffer_read_word(buffer, offset, (WORD *)&prop->boolVal);
|
||||
TRACE("Read bool %d\n", prop->boolVal);
|
||||
break;
|
||||
case VT_I2:
|
||||
hr = buffer_read_word(buffer, offset, (WORD *)&prop->u.iVal);
|
||||
TRACE("Read short %d\n", prop->u.iVal);
|
||||
hr = buffer_read_word(buffer, offset, (WORD *)&prop->iVal);
|
||||
TRACE("Read short %d\n", prop->iVal);
|
||||
break;
|
||||
case VT_UI2:
|
||||
hr = buffer_read_word(buffer, offset, &prop->u.uiVal);
|
||||
TRACE("Read ushort %d\n", prop->u.uiVal);
|
||||
hr = buffer_read_word(buffer, offset, &prop->uiVal);
|
||||
TRACE("Read ushort %d\n", prop->uiVal);
|
||||
break;
|
||||
case VT_INT:
|
||||
case VT_I4:
|
||||
hr = buffer_read_dword(buffer, offset, (DWORD *)&prop->u.lVal);
|
||||
TRACE("Read long %d\n", prop->u.lVal);
|
||||
hr = buffer_read_dword(buffer, offset, (DWORD *)&prop->lVal);
|
||||
TRACE("Read long %d\n", prop->lVal);
|
||||
break;
|
||||
case VT_UINT:
|
||||
case VT_UI4:
|
||||
hr = buffer_read_dword(buffer, offset, &prop->u.ulVal);
|
||||
TRACE("Read ulong %d\n", prop->u.ulVal);
|
||||
hr = buffer_read_dword(buffer, offset, &prop->ulVal);
|
||||
TRACE("Read ulong %d\n", prop->ulVal);
|
||||
break;
|
||||
case VT_I8:
|
||||
hr = buffer_read_uint64(buffer, offset, (ULARGE_INTEGER *)&prop->u.hVal);
|
||||
TRACE("Read long long %s\n", wine_dbgstr_longlong(prop->u.hVal.QuadPart));
|
||||
hr = buffer_read_uint64(buffer, offset, (ULARGE_INTEGER *)&prop->hVal);
|
||||
TRACE("Read long long %s\n", wine_dbgstr_longlong(prop->hVal.QuadPart));
|
||||
break;
|
||||
case VT_UI8:
|
||||
hr = buffer_read_uint64(buffer, offset, &prop->u.uhVal);
|
||||
TRACE("Read ulong long %s\n", wine_dbgstr_longlong(prop->u.uhVal.QuadPart));
|
||||
hr = buffer_read_uint64(buffer, offset, &prop->uhVal);
|
||||
TRACE("Read ulong long %s\n", wine_dbgstr_longlong(prop->uhVal.QuadPart));
|
||||
break;
|
||||
case VT_R8:
|
||||
hr = buffer_read_len(buffer, offset, &prop->u.dblVal, sizeof(prop->u.dblVal));
|
||||
TRACE("Read double %f\n", prop->u.dblVal);
|
||||
hr = buffer_read_len(buffer, offset, &prop->dblVal, sizeof(prop->dblVal));
|
||||
TRACE("Read double %f\n", prop->dblVal);
|
||||
break;
|
||||
case VT_LPSTR:
|
||||
{
|
||||
|
@ -1314,10 +1314,10 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
}
|
||||
else
|
||||
{
|
||||
prop->u.pszVal = allocate(allocate_data, count);
|
||||
if (prop->u.pszVal)
|
||||
prop->pszVal = allocate(allocate_data, count);
|
||||
if (prop->pszVal)
|
||||
{
|
||||
if (FAILED(hr = buffer_read_len(buffer, offset, prop->u.pszVal, count)))
|
||||
if (FAILED(hr = buffer_read_len(buffer, offset, prop->pszVal, count)))
|
||||
break;
|
||||
|
||||
/* This is stored in the code page specified in codepage.
|
||||
|
@ -1326,15 +1326,15 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
if (codepage == CP_UNICODE)
|
||||
{
|
||||
/* Make sure it's NULL-terminated */
|
||||
prop->u.pszVal[count / sizeof(WCHAR) - 1] = '\0';
|
||||
prop->pszVal[count / sizeof(WCHAR) - 1] = '\0';
|
||||
TRACE("Read string value %s\n",
|
||||
debugstr_w(prop->u.pwszVal));
|
||||
debugstr_w(prop->pwszVal));
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Make sure it's NULL-terminated */
|
||||
prop->u.pszVal[count - 1] = '\0';
|
||||
TRACE("Read string value %s\n", debugstr_a(prop->u.pszVal));
|
||||
prop->pszVal[count - 1] = '\0';
|
||||
TRACE("Read string value %s\n", debugstr_a(prop->pszVal));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1367,17 +1367,17 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
wcount = MultiByteToWideChar(codepage, 0, (LPCSTR)(buffer->data + offset), count, NULL, 0);
|
||||
}
|
||||
|
||||
prop->u.bstrVal = SysAllocStringLen(NULL, wcount); /* FIXME: use allocator? */
|
||||
prop->bstrVal = SysAllocStringLen(NULL, wcount); /* FIXME: use allocator? */
|
||||
|
||||
if (prop->u.bstrVal)
|
||||
if (prop->bstrVal)
|
||||
{
|
||||
if (codepage == CP_UNICODE)
|
||||
hr = buffer_read_len(buffer, offset, prop->u.bstrVal, count);
|
||||
hr = buffer_read_len(buffer, offset, prop->bstrVal, count);
|
||||
else
|
||||
MultiByteToWideChar(codepage, 0, (LPCSTR)(buffer->data + offset), count, prop->u.bstrVal, wcount);
|
||||
MultiByteToWideChar(codepage, 0, (LPCSTR)(buffer->data + offset), count, prop->bstrVal, wcount);
|
||||
|
||||
prop->u.bstrVal[wcount - 1] = '\0';
|
||||
TRACE("Read string value %s\n", debugstr_w(prop->u.bstrVal));
|
||||
prop->bstrVal[wcount - 1] = '\0';
|
||||
TRACE("Read string value %s\n", debugstr_w(prop->bstrVal));
|
||||
}
|
||||
else
|
||||
hr = STG_E_INSUFFICIENTMEMORY;
|
||||
|
@ -1393,11 +1393,11 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
|
||||
offset += sizeof(DWORD);
|
||||
|
||||
prop->u.blob.cbSize = count;
|
||||
prop->u.blob.pBlobData = allocate(allocate_data, count);
|
||||
if (prop->u.blob.pBlobData)
|
||||
prop->blob.cbSize = count;
|
||||
prop->blob.pBlobData = allocate(allocate_data, count);
|
||||
if (prop->blob.pBlobData)
|
||||
{
|
||||
hr = buffer_read_len(buffer, offset, prop->u.blob.pBlobData, count);
|
||||
hr = buffer_read_len(buffer, offset, prop->blob.pBlobData, count);
|
||||
TRACE("Read blob value of size %d\n", count);
|
||||
}
|
||||
else
|
||||
|
@ -1413,15 +1413,15 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
|
||||
offset += sizeof(DWORD);
|
||||
|
||||
prop->u.pwszVal = allocate(allocate_data, count * sizeof(WCHAR));
|
||||
if (prop->u.pwszVal)
|
||||
prop->pwszVal = allocate(allocate_data, count * sizeof(WCHAR));
|
||||
if (prop->pwszVal)
|
||||
{
|
||||
if (SUCCEEDED(hr = buffer_read_len(buffer, offset, prop->u.pwszVal, count * sizeof(WCHAR))))
|
||||
if (SUCCEEDED(hr = buffer_read_len(buffer, offset, prop->pwszVal, count * sizeof(WCHAR))))
|
||||
{
|
||||
/* make sure string is NULL-terminated */
|
||||
prop->u.pwszVal[count - 1] = '\0';
|
||||
PropertyStorage_ByteSwapString(prop->u.pwszVal, count);
|
||||
TRACE("Read string value %s\n", debugstr_w(prop->u.pwszVal));
|
||||
prop->pwszVal[count - 1] = '\0';
|
||||
PropertyStorage_ByteSwapString(prop->pwszVal, count);
|
||||
TRACE("Read string value %s\n", debugstr_w(prop->pwszVal));
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -1429,7 +1429,7 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
break;
|
||||
}
|
||||
case VT_FILETIME:
|
||||
hr = buffer_read_uint64(buffer, offset, (ULARGE_INTEGER *)&prop->u.filetime);
|
||||
hr = buffer_read_uint64(buffer, offset, (ULARGE_INTEGER *)&prop->filetime);
|
||||
break;
|
||||
case VT_CF:
|
||||
{
|
||||
|
@ -1445,22 +1445,22 @@ static HRESULT propertystorage_read_scalar(PROPVARIANT *prop, const struct read_
|
|||
if (len > 8)
|
||||
{
|
||||
len -= 8;
|
||||
prop->u.pclipdata = allocate(allocate_data, sizeof (CLIPDATA));
|
||||
prop->u.pclipdata->cbSize = len;
|
||||
prop->u.pclipdata->ulClipFmt = tag;
|
||||
prop->u.pclipdata->pClipData = allocate(allocate_data, len - sizeof(prop->u.pclipdata->ulClipFmt));
|
||||
hr = buffer_read_len(buffer, offset, prop->u.pclipdata->pClipData, len - sizeof(prop->u.pclipdata->ulClipFmt));
|
||||
prop->pclipdata = allocate(allocate_data, sizeof (CLIPDATA));
|
||||
prop->pclipdata->cbSize = len;
|
||||
prop->pclipdata->ulClipFmt = tag;
|
||||
prop->pclipdata->pClipData = allocate(allocate_data, len - sizeof(prop->pclipdata->ulClipFmt));
|
||||
hr = buffer_read_len(buffer, offset, prop->pclipdata->pClipData, len - sizeof(prop->pclipdata->ulClipFmt));
|
||||
}
|
||||
else
|
||||
hr = STG_E_INVALIDPARAMETER;
|
||||
}
|
||||
break;
|
||||
case VT_CLSID:
|
||||
if (!(prop->u.puuid = allocate(allocate_data, sizeof (*prop->u.puuid))))
|
||||
if (!(prop->puuid = allocate(allocate_data, sizeof (*prop->puuid))))
|
||||
return STG_E_INSUFFICIENTMEMORY;
|
||||
|
||||
if (SUCCEEDED(hr = buffer_test_offset(buffer, offset, sizeof(*prop->u.puuid))))
|
||||
StorageUtl_ReadGUID(buffer->data, offset, prop->u.puuid);
|
||||
if (SUCCEEDED(hr = buffer_test_offset(buffer, offset, sizeof(*prop->puuid))))
|
||||
StorageUtl_ReadGUID(buffer->data, offset, prop->puuid);
|
||||
|
||||
break;
|
||||
default:
|
||||
|
@ -1478,23 +1478,23 @@ static size_t propertystorage_get_elemsize(const PROPVARIANT *prop)
|
|||
|
||||
switch (prop->vt & ~VT_VECTOR)
|
||||
{
|
||||
case VT_I1: return sizeof(*prop->u.cac.pElems);
|
||||
case VT_UI1: return sizeof(*prop->u.caub.pElems);
|
||||
case VT_I2: return sizeof(*prop->u.cai.pElems);
|
||||
case VT_UI2: return sizeof(*prop->u.caui.pElems);
|
||||
case VT_BOOL: return sizeof(*prop->u.cabool.pElems);
|
||||
case VT_I4: return sizeof(*prop->u.cal.pElems);
|
||||
case VT_UI4: return sizeof(*prop->u.caul.pElems);
|
||||
case VT_R4: return sizeof(*prop->u.caflt.pElems);
|
||||
case VT_ERROR: return sizeof(*prop->u.cascode.pElems);
|
||||
case VT_I8: return sizeof(*prop->u.cah.pElems);
|
||||
case VT_UI8: return sizeof(*prop->u.cauh.pElems);
|
||||
case VT_R8: return sizeof(*prop->u.cadbl.pElems);
|
||||
case VT_CY: return sizeof(*prop->u.cacy.pElems);
|
||||
case VT_DATE: return sizeof(*prop->u.cadate.pElems);
|
||||
case VT_FILETIME: return sizeof(*prop->u.cafiletime.pElems);
|
||||
case VT_CLSID: return sizeof(*prop->u.cauuid.pElems);
|
||||
case VT_VARIANT: return sizeof(*prop->u.capropvar.pElems);
|
||||
case VT_I1: return sizeof(*prop->cac.pElems);
|
||||
case VT_UI1: return sizeof(*prop->caub.pElems);
|
||||
case VT_I2: return sizeof(*prop->cai.pElems);
|
||||
case VT_UI2: return sizeof(*prop->caui.pElems);
|
||||
case VT_BOOL: return sizeof(*prop->cabool.pElems);
|
||||
case VT_I4: return sizeof(*prop->cal.pElems);
|
||||
case VT_UI4: return sizeof(*prop->caul.pElems);
|
||||
case VT_R4: return sizeof(*prop->caflt.pElems);
|
||||
case VT_ERROR: return sizeof(*prop->cascode.pElems);
|
||||
case VT_I8: return sizeof(*prop->cah.pElems);
|
||||
case VT_UI8: return sizeof(*prop->cauh.pElems);
|
||||
case VT_R8: return sizeof(*prop->cadbl.pElems);
|
||||
case VT_CY: return sizeof(*prop->cacy.pElems);
|
||||
case VT_DATE: return sizeof(*prop->cadate.pElems);
|
||||
case VT_FILETIME: return sizeof(*prop->cafiletime.pElems);
|
||||
case VT_CLSID: return sizeof(*prop->cauuid.pElems);
|
||||
case VT_VARIANT: return sizeof(*prop->capropvar.pElems);
|
||||
default:
|
||||
FIXME("Unhandled type %#x.\n", prop->vt);
|
||||
return 0;
|
||||
|
@ -1540,9 +1540,9 @@ static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const struct read
|
|||
|
||||
offset += sizeof(DWORD);
|
||||
|
||||
if ((prop->u.capropvar.pElems = allocate(allocate_data, elemsize * count)))
|
||||
if ((prop->capropvar.pElems = allocate(allocate_data, elemsize * count)))
|
||||
{
|
||||
prop->u.capropvar.cElems = count;
|
||||
prop->capropvar.cElems = count;
|
||||
elem.vt = prop->vt & ~VT_VECTOR;
|
||||
|
||||
for (i = 0; i < count; ++i)
|
||||
|
@ -1550,7 +1550,7 @@ static HRESULT PropertyStorage_ReadProperty(PROPVARIANT *prop, const struct read
|
|||
if (SUCCEEDED(hr = propertystorage_read_scalar(&elem, buffer, offset + i * elemsize, codepage,
|
||||
allocate, allocate_data)))
|
||||
{
|
||||
memcpy(&prop->u.capropvar.pElems[i], &elem.u.lVal, elemsize);
|
||||
memcpy(&prop->capropvar.pElems[i], &elem.lVal, elemsize);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1870,14 +1870,14 @@ static HRESULT PropertyStorage_ReadFromStream(PropertyStorage_impl *This)
|
|||
{
|
||||
case PID_CODEPAGE:
|
||||
if (prop.vt == VT_I2)
|
||||
This->codePage = (UINT)prop.u.iVal;
|
||||
This->codePage = (UINT)prop.iVal;
|
||||
break;
|
||||
case PID_LOCALE:
|
||||
if (prop.vt == VT_I4)
|
||||
This->locale = (LCID)prop.u.lVal;
|
||||
This->locale = (LCID)prop.lVal;
|
||||
break;
|
||||
case PID_BEHAVIOR:
|
||||
if (prop.vt == VT_I4 && prop.u.lVal)
|
||||
if (prop.vt == VT_I4 && prop.lVal)
|
||||
This->grfFlags |= PROPSETFLAG_CASE_SENSITIVE;
|
||||
/* The format should already be 1, but just in case */
|
||||
This->format = 1;
|
||||
|
@ -2140,7 +2140,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
break;
|
||||
case VT_I1:
|
||||
case VT_UI1:
|
||||
hr = IStream_Write(This->stm, &var->u.cVal, sizeof(var->u.cVal),
|
||||
hr = IStream_Write(This->stm, &var->cVal, sizeof(var->cVal),
|
||||
&count);
|
||||
bytesWritten = count;
|
||||
break;
|
||||
|
@ -2149,7 +2149,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
{
|
||||
WORD wTemp;
|
||||
|
||||
StorageUtl_WriteWord(&wTemp, 0, var->u.iVal);
|
||||
StorageUtl_WriteWord(&wTemp, 0, var->iVal);
|
||||
hr = IStream_Write(This->stm, &wTemp, sizeof(wTemp), &count);
|
||||
bytesWritten = count;
|
||||
break;
|
||||
|
@ -2157,7 +2157,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
case VT_I4:
|
||||
case VT_UI4:
|
||||
{
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, var->u.lVal);
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, var->lVal);
|
||||
hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
|
||||
bytesWritten = count;
|
||||
break;
|
||||
|
@ -2165,21 +2165,21 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
case VT_I8:
|
||||
case VT_UI8:
|
||||
{
|
||||
StorageUtl_WriteULargeInteger(&ularge, 0, &var->u.uhVal);
|
||||
StorageUtl_WriteULargeInteger(&ularge, 0, &var->uhVal);
|
||||
hr = IStream_Write(This->stm, &ularge, sizeof(ularge), &bytesWritten);
|
||||
break;
|
||||
}
|
||||
case VT_LPSTR:
|
||||
{
|
||||
if (This->codePage == CP_UNICODE)
|
||||
len = (lstrlenW(var->u.pwszVal) + 1) * sizeof(WCHAR);
|
||||
len = (lstrlenW(var->pwszVal) + 1) * sizeof(WCHAR);
|
||||
else
|
||||
len = lstrlenA(var->u.pszVal) + 1;
|
||||
len = lstrlenA(var->pszVal) + 1;
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, len);
|
||||
hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
|
||||
if (FAILED(hr))
|
||||
goto end;
|
||||
hr = IStream_Write(This->stm, var->u.pszVal, len, &count);
|
||||
hr = IStream_Write(This->stm, var->pszVal, len, &count);
|
||||
bytesWritten = count + sizeof(DWORD);
|
||||
break;
|
||||
}
|
||||
|
@ -2187,17 +2187,17 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
{
|
||||
if (This->codePage == CP_UNICODE)
|
||||
{
|
||||
len = SysStringByteLen(var->u.bstrVal) + sizeof(WCHAR);
|
||||
len = SysStringByteLen(var->bstrVal) + sizeof(WCHAR);
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, len);
|
||||
hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
|
||||
if (SUCCEEDED(hr))
|
||||
hr = IStream_Write(This->stm, var->u.bstrVal, len, &count);
|
||||
hr = IStream_Write(This->stm, var->bstrVal, len, &count);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *str;
|
||||
|
||||
len = WideCharToMultiByte(This->codePage, 0, var->u.bstrVal, SysStringLen(var->u.bstrVal) + 1,
|
||||
len = WideCharToMultiByte(This->codePage, 0, var->bstrVal, SysStringLen(var->bstrVal) + 1,
|
||||
NULL, 0, NULL, NULL);
|
||||
|
||||
str = heap_alloc(len);
|
||||
|
@ -2207,7 +2207,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
goto end;
|
||||
}
|
||||
|
||||
WideCharToMultiByte(This->codePage, 0, var->u.bstrVal, SysStringLen(var->u.bstrVal),
|
||||
WideCharToMultiByte(This->codePage, 0, var->bstrVal, SysStringLen(var->bstrVal),
|
||||
str, len, NULL, NULL);
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, len);
|
||||
hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
|
||||
|
@ -2221,13 +2221,13 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
}
|
||||
case VT_LPWSTR:
|
||||
{
|
||||
len = lstrlenW(var->u.pwszVal) + 1;
|
||||
len = lstrlenW(var->pwszVal) + 1;
|
||||
|
||||
StorageUtl_WriteDWord(&dwTemp, 0, len);
|
||||
hr = IStream_Write(This->stm, &dwTemp, sizeof(dwTemp), &count);
|
||||
if (FAILED(hr))
|
||||
goto end;
|
||||
hr = IStream_Write(This->stm, var->u.pwszVal, len * sizeof(WCHAR),
|
||||
hr = IStream_Write(This->stm, var->pwszVal, len * sizeof(WCHAR),
|
||||
&count);
|
||||
bytesWritten = count + sizeof(DWORD);
|
||||
break;
|
||||
|
@ -2236,7 +2236,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
{
|
||||
FILETIME temp;
|
||||
|
||||
StorageUtl_WriteULargeInteger(&temp, 0, (const ULARGE_INTEGER *)&var->u.filetime);
|
||||
StorageUtl_WriteULargeInteger(&temp, 0, (const ULARGE_INTEGER *)&var->filetime);
|
||||
hr = IStream_Write(This->stm, &temp, sizeof(temp), &count);
|
||||
bytesWritten = count;
|
||||
break;
|
||||
|
@ -2245,14 +2245,14 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
{
|
||||
DWORD cf_hdr[2];
|
||||
|
||||
len = var->u.pclipdata->cbSize;
|
||||
len = var->pclipdata->cbSize;
|
||||
StorageUtl_WriteDWord(&cf_hdr[0], 0, len + 8);
|
||||
StorageUtl_WriteDWord(&cf_hdr[1], 0, var->u.pclipdata->ulClipFmt);
|
||||
StorageUtl_WriteDWord(&cf_hdr[1], 0, var->pclipdata->ulClipFmt);
|
||||
hr = IStream_Write(This->stm, cf_hdr, sizeof(cf_hdr), &count);
|
||||
if (FAILED(hr))
|
||||
goto end;
|
||||
hr = IStream_Write(This->stm, var->u.pclipdata->pClipData,
|
||||
len - sizeof(var->u.pclipdata->ulClipFmt), &count);
|
||||
hr = IStream_Write(This->stm, var->pclipdata->pClipData,
|
||||
len - sizeof(var->pclipdata->ulClipFmt), &count);
|
||||
if (FAILED(hr))
|
||||
goto end;
|
||||
bytesWritten = count + sizeof cf_hdr;
|
||||
|
@ -2262,7 +2262,7 @@ static HRESULT PropertyStorage_WritePropertyToStream(PropertyStorage_impl *This,
|
|||
{
|
||||
CLSID temp;
|
||||
|
||||
StorageUtl_WriteGUID(&temp, 0, var->u.puuid);
|
||||
StorageUtl_WriteGUID(&temp, 0, var->puuid);
|
||||
hr = IStream_Write(This->stm, &temp, sizeof(temp), &count);
|
||||
bytesWritten = count;
|
||||
break;
|
||||
|
@ -2407,7 +2407,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This)
|
|||
PropVariantInit(&var);
|
||||
|
||||
var.vt = VT_I2;
|
||||
var.u.iVal = This->codePage;
|
||||
var.iVal = This->codePage;
|
||||
hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_CODEPAGE,
|
||||
&var, §ionOffset);
|
||||
if (FAILED(hr))
|
||||
|
@ -2416,7 +2416,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This)
|
|||
if (This->locale != LOCALE_SYSTEM_DEFAULT)
|
||||
{
|
||||
var.vt = VT_I4;
|
||||
var.u.lVal = This->locale;
|
||||
var.lVal = This->locale;
|
||||
hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_LOCALE,
|
||||
&var, §ionOffset);
|
||||
if (FAILED(hr))
|
||||
|
@ -2426,7 +2426,7 @@ static HRESULT PropertyStorage_WriteToStream(PropertyStorage_impl *This)
|
|||
if (This->grfFlags & PROPSETFLAG_CASE_SENSITIVE)
|
||||
{
|
||||
var.vt = VT_I4;
|
||||
var.u.lVal = 1;
|
||||
var.lVal = 1;
|
||||
hr = PropertyStorage_WritePropertyToStream(This, prop++, PID_BEHAVIOR,
|
||||
&var, §ionOffset);
|
||||
if (FAILED(hr))
|
||||
|
|
Loading…
Reference in New Issue