Implementation of the ReleaseStgMedium method.

This commit is contained in:
Francis Beaudet 1999-03-10 13:24:39 +00:00 committed by Alexandre Julliard
parent 026d9db8c5
commit e4828b6ba6
2 changed files with 100 additions and 1 deletions

View file

@ -500,6 +500,105 @@ HRESULT WINAPI OleSetMenuDescriptor(
return E_FAIL;
}
/***********************************************************************
* ReleaseStgMedium [OLE32.140]
*/
void WINAPI ReleaseStgMedium(
STGMEDIUM* pmedium)
{
switch (pmedium->tymed)
{
case TYMED_HGLOBAL:
{
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hGlobal!=0) )
GlobalFree(pmedium->u.hGlobal);
pmedium->u.hGlobal = 0;
break;
}
case TYMED_FILE:
{
if (pmedium->u.lpszFileName!=0)
{
if (pmedium->pUnkForRelease==0)
{
DeleteFileW(pmedium->u.lpszFileName);
}
CoTaskMemFree(pmedium->u.lpszFileName);
}
pmedium->u.lpszFileName = 0;
break;
}
case TYMED_ISTREAM:
{
if (pmedium->u.pstm!=0)
{
IStream_Release(pmedium->u.pstm);
}
pmedium->u.pstm = 0;
break;
}
case TYMED_ISTORAGE:
{
if (pmedium->u.pstg!=0)
{
IStorage_Release(pmedium->u.pstg);
}
pmedium->u.pstg = 0;
break;
}
case TYMED_GDI:
{
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hGlobal!=0) )
DeleteObject(pmedium->u.hGlobal);
pmedium->u.hGlobal = 0;
break;
}
case TYMED_MFPICT:
{
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hMetaFilePict!=0) )
{
DeleteMetaFile(pmedium->u.hMetaFilePict);
GlobalFree(pmedium->u.hMetaFilePict);
}
pmedium->u.hMetaFilePict = 0;
break;
}
case TYMED_ENHMF:
{
if ( (pmedium->pUnkForRelease==0) &&
(pmedium->u.hEnhMetaFile!=0) )
{
DeleteEnhMetaFile(pmedium->u.hEnhMetaFile);
}
pmedium->u.hEnhMetaFile = 0;
break;
}
case TYMED_NULL:
default:
break;
}
/*
* After cleaning up, the unknown is released
*/
if (pmedium->pUnkForRelease!=0)
{
IUnknown_Release(pmedium->pUnkForRelease);
pmedium->pUnkForRelease = 0;
}
}
/***
* OLEDD_Initialize()
*

View file

@ -140,7 +140,7 @@ type win32
137 stub ReadOleStg
138 stub ReadStringStream
139 stdcall RegisterDragDrop(long ptr) RegisterDragDrop
140 stub ReleaseStgMedium
140 stdcall ReleaseStgMedium(ptr) ReleaseStgMedium
141 stdcall RevokeDragDrop(long) RevokeDragDrop
142 stub SetConvertStg
143 stub SetDocumentBitStg