diff --git a/dlls/inetcomm/mimeole.c b/dlls/inetcomm/mimeole.c index 6b5c75d16c5..a353e5cfb2f 100644 --- a/dlls/inetcomm/mimeole.c +++ b/dlls/inetcomm/mimeole.c @@ -107,6 +107,7 @@ typedef struct MimeBody ENCODINGTYPE encoding; void *data; IID data_iid; + BODYOFFSETS body_offsets; } MimeBody; static inline MimeBody *impl_from_IMimeBody( IMimeBody *iface ) @@ -857,8 +858,13 @@ static HRESULT WINAPI MimeBody_GetOffsets( IMimeBody* iface, LPBODYOFFSETS pOffsets) { - FIXME("stub\n"); - return E_NOTIMPL; + MimeBody *This = impl_from_IMimeBody(iface); + TRACE("(%p)->(%p)\n", This, pOffsets); + + *pOffsets = This->body_offsets; + + if(This->body_offsets.cbBodyEnd == 0) return MIME_E_NO_DATA; + return S_OK; } static HRESULT WINAPI MimeBody_GetCurrentEncoding( @@ -1037,11 +1043,21 @@ static IMimeBodyVtbl body_vtbl = MimeBody_GetHandle }; +static HRESULT MimeBody_set_offsets(MimeBody *body, const BODYOFFSETS *offsets) +{ + TRACE("setting offsets to %d, %d, %d, %d\n", offsets->cbBoundaryStart, + offsets->cbHeaderStart, offsets->cbBodyStart, offsets->cbBodyEnd); + + body->body_offsets = *offsets; + return S_OK; +} + #define FIRST_CUSTOM_PROP_ID 0x100 HRESULT MimeBody_create(IUnknown *outer, void **obj) { MimeBody *This; + BODYOFFSETS body_offsets; *obj = NULL; @@ -1062,6 +1078,10 @@ HRESULT MimeBody_create(IUnknown *outer, void **obj) This->data = NULL; This->data_iid = IID_NULL; + body_offsets.cbBoundaryStart = body_offsets.cbHeaderStart = 0; + body_offsets.cbBodyStart = body_offsets.cbBodyEnd = 0; + MimeBody_set_offsets(This, &body_offsets); + *obj = (IMimeBody *)&This->lpVtbl; return S_OK; } diff --git a/dlls/inetcomm/tests/mimeole.c b/dlls/inetcomm/tests/mimeole.c index f5cd619da92..30451f35af9 100644 --- a/dlls/inetcomm/tests/mimeole.c +++ b/dlls/inetcomm/tests/mimeole.c @@ -94,6 +94,7 @@ static void test_CreateBody(void) ULONG count, found_param, i; MIMEPARAMINFO *param_info; IMimeAllocator *alloc; + BODYOFFSETS offsets; hr = CoCreateInstance(&CLSID_IMimeBody, NULL, CLSCTX_INPROC_SERVER, &IID_IMimeBody, (void**)&body); ok(hr == S_OK, "ret %08x\n", hr); @@ -138,6 +139,14 @@ static void test_CreateBody(void) ok(hr == S_OK, "ret %08x\n", hr); ok(enc == IET_8BIT, "encoding %d\n", enc); + memset(&offsets, 0xcc, sizeof(offsets)); + hr = IMimeBody_GetOffsets(body, &offsets); + ok(hr == MIME_E_NO_DATA, "ret %08x\n", hr); + ok(offsets.cbBoundaryStart == 0, "got %d\n", offsets.cbBoundaryStart); + ok(offsets.cbHeaderStart == 0, "got %d\n", offsets.cbHeaderStart); + ok(offsets.cbBodyStart == 0, "got %d\n", offsets.cbBodyStart); + ok(offsets.cbBodyEnd == 0, "got %d\n", offsets.cbBodyEnd); + hr = MimeOleGetAllocator(&alloc); ok(hr == S_OK, "ret %08x\n", hr);