|
|
メモリ上にストリーム(IStream)を作成
SHCreateMemStream APIの互換関数
|
(2004.11.29) |
// shlwapi.dll version 5.0 or later 互換
static IStream *Emulete_SHCreateMemStream(
const BYTE *pInit,
UINT cbInit)
{
if ((pInit == NULL) && (cbInit > 0))
{
return NULL;
}
HRESULT hr = S_OK;
IStreamPtr spStream;
hr = ::CreateStreamOnHGlobal(0, TRUE, &spStream);
if (FAILED(hr))
{
return NULL;
}
if (cbInit > 0)
{
ULONG cbWritten = 0;
hr = spStream->Write(pInit, cbInit, &cbWritten);
if (FAILED(hr))
{
return NULL;
}
hr = CStreamHelper::Emulete_IStream_Reset(spStream);
if (FAILED(hr))
{
ATLASSERT(0);
}
}
return spStream.Detach();
}
|
|
 |
| © 2003 WAC.com All Right Reserved. |
 |
|