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 ...@@ -1091,6 +1091,7 @@ typedef struct MimeMessage
const IMimeMessageVtbl *lpVtbl; const IMimeMessageVtbl *lpVtbl;
LONG refs; LONG refs;
IStream *stream;
} MimeMessage; } MimeMessage;
static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv) static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv)
...@@ -1130,6 +1131,7 @@ static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface) ...@@ -1130,6 +1131,7 @@ static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
refs = InterlockedDecrement(&This->refs); refs = InterlockedDecrement(&This->refs);
if (!refs) if (!refs)
{ {
if(This->stream) IStream_Release(This->stream);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
...@@ -1155,9 +1157,22 @@ static HRESULT WINAPI MimeMessage_IsDirty( ...@@ -1155,9 +1157,22 @@ static HRESULT WINAPI MimeMessage_IsDirty(
static HRESULT WINAPI MimeMessage_Load( static HRESULT WINAPI MimeMessage_Load(
IMimeMessage *iface, IMimeMessage *iface,
LPSTREAM pStm){ LPSTREAM pStm)
FIXME("(%p)->(%p)\n", iface, pStm); {
return E_NOTIMPL; 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( static HRESULT WINAPI MimeMessage_Save(
...@@ -1721,6 +1736,7 @@ HRESULT WINAPI MimeOleCreateMessage(IUnknown *pUnkOuter, IMimeMessage **ppMessag ...@@ -1721,6 +1736,7 @@ HRESULT WINAPI MimeOleCreateMessage(IUnknown *pUnkOuter, IMimeMessage **ppMessag
This->lpVtbl = &MimeMessageVtbl; This->lpVtbl = &MimeMessageVtbl;
This->refs = 1; This->refs = 1;
This->stream = NULL;
*ppMessage = (IMimeMessage *)&This->lpVtbl; *ppMessage = (IMimeMessage *)&This->lpVtbl;
return S_OK; return S_OK;
......
...@@ -202,6 +202,34 @@ static void test_Allocator(void) ...@@ -202,6 +202,34 @@ static void test_Allocator(void)
IMimeAllocator_Release(alloc); 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) START_TEST(mimeole)
{ {
OleInitialize(NULL); OleInitialize(NULL);
...@@ -209,5 +237,6 @@ START_TEST(mimeole) ...@@ -209,5 +237,6 @@ START_TEST(mimeole)
test_CreateSecurity(); test_CreateSecurity();
test_CreateBody(); test_CreateBody();
test_Allocator(); test_Allocator();
test_CreateMessage();
OleUninitialize(); 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