Commit 4ba3aa50 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

inetcomm: Add the beginnings of IMimeMessage_Load.

parent 9438ebfa
......@@ -1091,6 +1091,7 @@ typedef struct MimeMessage
const IMimeMessageVtbl *lpVtbl;
LONG refs;
IStream *stream;
} MimeMessage;
static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv)
......@@ -1130,6 +1131,7 @@ static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
refs = InterlockedDecrement(&This->refs);
if (!refs)
{
if(This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This);
}
......@@ -1155,9 +1157,22 @@ static HRESULT WINAPI MimeMessage_IsDirty(
static HRESULT WINAPI MimeMessage_Load(
IMimeMessage *iface,
LPSTREAM pStm){
FIXME("(%p)->(%p)\n", iface, pStm);
return E_NOTIMPL;
LPSTREAM pStm)
{
MimeMessage *This = (MimeMessage *)iface;
TRACE("(%p)->(%p)\n", iface, pStm);
if(This->stream)
{
FIXME("already loaded a message\n");
return E_FAIL;
}
IStream_AddRef(pStm);
This->stream = pStm;
return S_OK;
}
static HRESULT WINAPI MimeMessage_Save(
......@@ -1721,6 +1736,7 @@ HRESULT WINAPI MimeOleCreateMessage(IUnknown *pUnkOuter, IMimeMessage **ppMessag
This->lpVtbl = &MimeMessageVtbl;
This->refs = 1;
This->stream = NULL;
*ppMessage = (IMimeMessage *)&This->lpVtbl;
return S_OK;
......
......@@ -202,6 +202,34 @@ static void test_Allocator(void)
IMimeAllocator_Release(alloc);
}
static void test_CreateMessage(void)
{
HRESULT hr;
IMimeMessage *msg;
IStream *stream;
LARGE_INTEGER pos;
LONG ref;
hr = MimeOleCreateMessage(NULL, &msg);
ok(hr == S_OK, "ret %08x\n", hr);
CreateStreamOnHGlobal(NULL, TRUE, &stream);
IStream_Write(stream, msg1, sizeof(msg1) - 1, NULL);
pos.QuadPart = 0;
IStream_Seek(stream, pos, STREAM_SEEK_SET, NULL);
hr = IMimeMessage_Load(msg, stream);
ok(hr == S_OK, "ret %08x\n", hr);
IMimeMessage_Release(msg);
ref = IStream_AddRef(stream);
ok(ref == 2, "ref %d\n", ref);
IStream_Release(stream);
IStream_Release(stream);
}
START_TEST(mimeole)
{
OleInitialize(NULL);
......@@ -209,5 +237,6 @@ START_TEST(mimeole)
test_CreateSecurity();
test_CreateBody();
test_Allocator();
test_CreateMessage();
OleUninitialize();
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment