[INETCOMM]

* Sync with Wine 1.7.1.
CORE-7469

svn path=/trunk/; revision=60233
This commit is contained in:
Amine Khaldi 2013-09-20 09:41:39 +00:00
parent 021683b242
commit 7c0681b920
7 changed files with 192 additions and 211 deletions

View file

@ -1,7 +1,4 @@
remove_definitions(-D_WIN32_WINNT=0x502)
add_definitions(-D_WIN32_WINNT=0x600)
add_definitions(-D__WINESRC__) add_definitions(-D__WINESRC__)
include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine) include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
spec2def(inetcomm.dll inetcomm.spec ADD_IMPORTLIB) spec2def(inetcomm.dll inetcomm.spec ADD_IMPORTLIB)
@ -14,22 +11,11 @@ list(APPEND SOURCE
mimeole.c mimeole.c
pop3transport.c pop3transport.c
smtptransport.c smtptransport.c
inetcomm.rc
${CMAKE_CURRENT_BINARY_DIR}/inetcomm_stubs.c ${CMAKE_CURRENT_BINARY_DIR}/inetcomm_stubs.c
${CMAKE_CURRENT_BINARY_DIR}/inetcomm.def) ${CMAKE_CURRENT_BINARY_DIR}/inetcomm.def)
add_library(inetcomm SHARED ${SOURCE}) add_library(inetcomm SHARED ${SOURCE} inetcomm.rc)
set_module_type(inetcomm win32dll) set_module_type(inetcomm win32dll)
target_link_libraries(inetcomm uuid wine) target_link_libraries(inetcomm uuid wine)
add_importlibs(inetcomm ole32 oleaut32 ws2_32 user32 msvcrt kernel32 ntdll)
add_importlibs(inetcomm
ole32
oleaut32
ws2_32
user32
advapi32
msvcrt
kernel32
ntdll)
add_cd_file(TARGET inetcomm DESTINATION reactos/system32 FOR all) add_cd_file(TARGET inetcomm DESTINATION reactos/system32 FOR all)

View file

@ -54,7 +54,7 @@ static HRESULT WINAPI IMAPTransport_QueryInterface(IIMAPTransport *iface, REFIID
IsEqualIID(riid, &IID_IIMAPTransport)) IsEqualIID(riid, &IID_IIMAPTransport))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IIMAPTransport_AddRef(iface);
return S_OK; return S_OK;
} }
*ppv = NULL; *ppv = NULL;
@ -447,30 +447,30 @@ HRESULT WINAPI CreateIMAPTransport(IIMAPTransport **ppTransport)
return S_OK; return S_OK;
} }
static HRESULT WINAPI IMAPTransportCF_QueryInterface(LPCLASSFACTORY iface, static HRESULT WINAPI IMAPTransportCF_QueryInterface(IClassFactory *iface,
REFIID riid, LPVOID *ppv) REFIID riid, LPVOID *ppv)
{ {
*ppv = NULL; *ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IClassFactory_AddRef(iface);
return S_OK; return S_OK;
} }
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI IMAPTransportCF_AddRef(LPCLASSFACTORY iface) static ULONG WINAPI IMAPTransportCF_AddRef(IClassFactory *iface)
{ {
return 2; /* non-heap based object */ return 2; /* non-heap based object */
} }
static ULONG WINAPI IMAPTransportCF_Release(LPCLASSFACTORY iface) static ULONG WINAPI IMAPTransportCF_Release(IClassFactory *iface)
{ {
return 1; /* non-heap based object */ return 1; /* non-heap based object */
} }
static HRESULT WINAPI IMAPTransportCF_CreateInstance(LPCLASSFACTORY iface, static HRESULT WINAPI IMAPTransportCF_CreateInstance(IClassFactory *iface,
LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv) LPUNKNOWN pUnk, REFIID riid, LPVOID *ppv)
{ {
HRESULT hr; HRESULT hr;
@ -493,7 +493,7 @@ static HRESULT WINAPI IMAPTransportCF_CreateInstance(LPCLASSFACTORY iface,
return hr; return hr;
} }
static HRESULT WINAPI IMAPTransportCF_LockServer(LPCLASSFACTORY iface, BOOL fLock) static HRESULT WINAPI IMAPTransportCF_LockServer(IClassFactory *iface, BOOL fLock)
{ {
FIXME("(%d), stub!\n",fLock); FIXME("(%d), stub!\n",fLock);
return S_OK; return S_OK;

View file

@ -62,11 +62,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
MimeInternational_Construct(&international); MimeInternational_Construct(&international);
break; break;
case DLL_PROCESS_DETACH: case DLL_PROCESS_DETACH:
if (lpvReserved) break;
IMimeInternational_Release(international); IMimeInternational_Release(international);
InternetTransport_UnregisterClass(hinstDLL); InternetTransport_UnregisterClass(hinstDLL);
break; break;
default:
break;
} }
return TRUE; return TRUE;
} }

View file

@ -98,8 +98,8 @@ typedef struct
typedef struct MimeBody typedef struct MimeBody
{ {
const IMimeBodyVtbl *lpVtbl; IMimeBody IMimeBody_iface;
LONG refs; LONG ref;
HBODY handle; HBODY handle;
@ -114,9 +114,9 @@ typedef struct MimeBody
BODYOFFSETS body_offsets; BODYOFFSETS body_offsets;
} MimeBody; } MimeBody;
static inline MimeBody *impl_from_IMimeBody( IMimeBody *iface ) static inline MimeBody *impl_from_IMimeBody(IMimeBody *iface)
{ {
return (MimeBody *)((char*)iface - FIELD_OFFSET(MimeBody, lpVtbl)); return CONTAINING_RECORD(iface, MimeBody, IMimeBody_iface);
} }
static LPSTR strdupA(LPCSTR str) static LPSTR strdupA(LPCSTR str)
@ -527,22 +527,24 @@ static HRESULT WINAPI MimeBody_QueryInterface(IMimeBody* iface,
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI MimeBody_AddRef(IMimeBody* iface) static ULONG WINAPI MimeBody_AddRef(IMimeBody *iface)
{ {
MimeBody *This = impl_from_IMimeBody(iface); MimeBody *This = impl_from_IMimeBody(iface);
TRACE("(%p)->()\n", iface); LONG ref = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->refs);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
} }
static ULONG WINAPI MimeBody_Release(IMimeBody* iface) static ULONG WINAPI MimeBody_Release(IMimeBody *iface)
{ {
MimeBody *This = impl_from_IMimeBody(iface); MimeBody *This = impl_from_IMimeBody(iface);
ULONG refs; LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n", iface); TRACE("(%p) ref=%d\n", This, ref);
refs = InterlockedDecrement(&This->refs); if (!ref)
if (!refs)
{ {
empty_header_list(&This->headers); empty_header_list(&This->headers);
empty_new_prop_list(&This->new_props); empty_new_prop_list(&This->new_props);
@ -555,7 +557,7 @@ static ULONG WINAPI MimeBody_Release(IMimeBody* iface)
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return refs; return ref;
} }
static HRESULT WINAPI MimeBody_GetClassID( static HRESULT WINAPI MimeBody_GetClassID(
@ -574,19 +576,14 @@ static HRESULT WINAPI MimeBody_IsDirty(
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI MimeBody_Load( static HRESULT WINAPI MimeBody_Load(IMimeBody *iface, IStream *pStm)
IMimeBody* iface,
LPSTREAM pStm)
{ {
MimeBody *This = impl_from_IMimeBody(iface); MimeBody *This = impl_from_IMimeBody(iface);
TRACE("(%p)->(%p)\n", iface, pStm); TRACE("(%p)->(%p)\n", iface, pStm);
return parse_headers(This, pStm); return parse_headers(This, pStm);
} }
static HRESULT WINAPI MimeBody_Save( static HRESULT WINAPI MimeBody_Save(IMimeBody *iface, IStream *pStm, BOOL fClearDirty)
IMimeBody* iface,
LPSTREAM pStm,
BOOL fClearDirty)
{ {
FIXME("stub\n"); FIXME("stub\n");
return E_NOTIMPL; return E_NOTIMPL;
@ -1101,20 +1098,17 @@ static HRESULT MimeBody_set_offsets(MimeBody *body, const BODYOFFSETS *offsets)
#define FIRST_CUSTOM_PROP_ID 0x100 #define FIRST_CUSTOM_PROP_ID 0x100
HRESULT MimeBody_create(IUnknown *outer, void **obj) static MimeBody *mimebody_create(void)
{ {
MimeBody *This; MimeBody *This;
BODYOFFSETS body_offsets; BODYOFFSETS body_offsets;
*obj = NULL;
if(outer) return CLASS_E_NOAGGREGATION;
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This)
return NULL;
This->lpVtbl = &body_vtbl; This->IMimeBody_iface.lpVtbl = &body_vtbl;
This->refs = 1; This->ref = 1;
This->handle = NULL; This->handle = NULL;
list_init(&This->headers); list_init(&This->headers);
list_init(&This->new_props); list_init(&This->new_props);
@ -1129,68 +1123,84 @@ HRESULT MimeBody_create(IUnknown *outer, void **obj)
body_offsets.cbBodyStart = body_offsets.cbBodyEnd = 0; body_offsets.cbBodyStart = body_offsets.cbBodyEnd = 0;
MimeBody_set_offsets(This, &body_offsets); MimeBody_set_offsets(This, &body_offsets);
*obj = &This->lpVtbl; return This;
return S_OK;
} }
HRESULT MimeBody_create(IUnknown *outer, void **ppv)
{
MimeBody *mb;
if(outer)
return CLASS_E_NOAGGREGATION;
if ((mb = mimebody_create()))
{
*ppv = &mb->IMimeBody_iface;
return S_OK;
}
else
{
*ppv = NULL;
return E_OUTOFMEMORY;
}
}
typedef struct typedef struct
{ {
IStreamVtbl *lpVtbl; IStream IStream_iface;
LONG refs; LONG ref;
IStream *base; IStream *base;
ULARGE_INTEGER pos, start, length; ULARGE_INTEGER pos, start, length;
} sub_stream_t; } sub_stream_t;
static inline sub_stream_t *impl_from_IStream( IStream *iface ) static inline sub_stream_t *impl_from_IStream(IStream *iface)
{ {
return (sub_stream_t *)((char*)iface - FIELD_OFFSET(sub_stream_t, lpVtbl)); return CONTAINING_RECORD(iface, sub_stream_t, IStream_iface);
} }
static HRESULT WINAPI sub_stream_QueryInterface( static HRESULT WINAPI sub_stream_QueryInterface(IStream *iface, REFIID riid, void **ppv)
IStream* iface,
REFIID riid,
void **ppvObject)
{ {
sub_stream_t *This = impl_from_IStream(iface); sub_stream_t *This = impl_from_IStream(iface);
TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppvObject); TRACE("(%p)->(%s, %p)\n", This, debugstr_guid(riid), ppv);
*ppvObject = NULL; *ppv = NULL;
if(IsEqualIID(riid, &IID_IUnknown) || if(IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_ISequentialStream) || IsEqualIID(riid, &IID_ISequentialStream) ||
IsEqualIID(riid, &IID_IStream)) IsEqualIID(riid, &IID_IStream))
{ {
IStream_AddRef(iface); IStream_AddRef(iface);
*ppvObject = iface; *ppv = iface;
return S_OK; return S_OK;
} }
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI sub_stream_AddRef( static ULONG WINAPI sub_stream_AddRef(IStream *iface)
IStream* iface)
{ {
sub_stream_t *This = impl_from_IStream(iface); sub_stream_t *This = impl_from_IStream(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p)\n", This); TRACE("(%p) ref=%d\n", This, ref);
return InterlockedIncrement(&This->refs);
return ref;
} }
static ULONG WINAPI sub_stream_Release( static ULONG WINAPI sub_stream_Release(IStream *iface)
IStream* iface)
{ {
sub_stream_t *This = impl_from_IStream(iface); sub_stream_t *This = impl_from_IStream(iface);
LONG refs; LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)\n", This); TRACE("(%p) ref=%d\n", This, ref);
refs = InterlockedDecrement(&This->refs);
if(!refs) if(!ref)
{ {
IStream_Release(This->base); IStream_Release(This->base);
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return refs; return ref;
} }
static HRESULT WINAPI sub_stream_Read( static HRESULT WINAPI sub_stream_Read(
@ -1407,15 +1417,15 @@ static HRESULT create_sub_stream(IStream *stream, ULARGE_INTEGER start, ULARGE_I
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if(!This) return E_OUTOFMEMORY; if(!This) return E_OUTOFMEMORY;
This->lpVtbl = &sub_stream_vtbl; This->IStream_iface.lpVtbl = &sub_stream_vtbl;
This->refs = 1; This->ref = 1;
This->start = start; This->start = start;
This->length = length; This->length = length;
This->pos.QuadPart = 0; This->pos.QuadPart = 0;
IStream_AddRef(stream); IStream_AddRef(stream);
This->base = stream; This->base = stream;
*out = (IStream*)&This->lpVtbl; *out = &This->IStream_iface;
return S_OK; return S_OK;
} }
@ -1424,7 +1434,7 @@ typedef struct body_t
{ {
struct list entry; struct list entry;
DWORD index; DWORD index;
IMimeBody *mime_body; MimeBody *mime_body;
struct body_t *parent; struct body_t *parent;
struct list children; struct list children;
@ -1432,15 +1442,19 @@ typedef struct body_t
typedef struct MimeMessage typedef struct MimeMessage
{ {
const IMimeMessageVtbl *lpVtbl; IMimeMessage IMimeMessage_iface;
LONG ref;
LONG refs;
IStream *stream; IStream *stream;
struct list body_tree; struct list body_tree;
DWORD next_index; DWORD next_index;
} MimeMessage; } MimeMessage;
static inline MimeMessage *impl_from_IMimeMessage(IMimeMessage *iface)
{
return CONTAINING_RECORD(iface, MimeMessage, IMimeMessage_iface);
}
static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv) static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID riid, void **ppv)
{ {
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv); TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
@ -1452,7 +1466,7 @@ static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID rii
IsEqualIID(riid, &IID_IMimeMessage)) IsEqualIID(riid, &IID_IMimeMessage))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IMimeMessage_AddRef(iface);
return S_OK; return S_OK;
} }
@ -1463,9 +1477,12 @@ static HRESULT WINAPI MimeMessage_QueryInterface(IMimeMessage *iface, REFIID rii
static ULONG WINAPI MimeMessage_AddRef(IMimeMessage *iface) static ULONG WINAPI MimeMessage_AddRef(IMimeMessage *iface)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
TRACE("(%p)->()\n", iface); ULONG ref = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->refs);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
} }
static void empty_body_list(struct list *list) static void empty_body_list(struct list *list)
@ -1475,20 +1492,19 @@ static void empty_body_list(struct list *list)
{ {
empty_body_list(&body->children); empty_body_list(&body->children);
list_remove(&body->entry); list_remove(&body->entry);
IMimeBody_Release(body->mime_body); IMimeBody_Release(&body->mime_body->IMimeBody_iface);
HeapFree(GetProcessHeap(), 0, body); HeapFree(GetProcessHeap(), 0, body);
} }
} }
static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface) static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
ULONG refs; ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n", iface); TRACE("(%p) ref=%d\n", This, ref);
refs = InterlockedDecrement(&This->refs); if (!ref)
if (!refs)
{ {
empty_body_list(&This->body_tree); empty_body_list(&This->body_tree);
@ -1496,7 +1512,7 @@ static ULONG WINAPI MimeMessage_Release(IMimeMessage *iface)
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
} }
return refs; return ref;
} }
/*** IPersist methods ***/ /*** IPersist methods ***/
@ -1516,7 +1532,7 @@ static HRESULT WINAPI MimeMessage_IsDirty(
return E_NOTIMPL; return E_NOTIMPL;
} }
static body_t *new_body_entry(IMimeBody *mime_body, DWORD index, body_t *parent) static body_t *new_body_entry(MimeBody *mime_body, DWORD index, body_t *parent)
{ {
body_t *body = HeapAlloc(GetProcessHeap(), 0, sizeof(*body)); body_t *body = HeapAlloc(GetProcessHeap(), 0, sizeof(*body));
if(body) if(body)
@ -1621,28 +1637,29 @@ end:
static body_t *create_sub_body(MimeMessage *msg, IStream *pStm, BODYOFFSETS *offset, body_t *parent) static body_t *create_sub_body(MimeMessage *msg, IStream *pStm, BODYOFFSETS *offset, body_t *parent)
{ {
IMimeBody *mime_body; MimeBody *mime_body;
HRESULT hr; HRESULT hr;
body_t *body; body_t *body;
ULARGE_INTEGER cur; ULARGE_INTEGER cur;
LARGE_INTEGER zero; LARGE_INTEGER zero;
MimeBody_create(NULL, (void**)&mime_body); mime_body = mimebody_create();
IMimeBody_Load(mime_body, pStm); IMimeBody_Load(&mime_body->IMimeBody_iface, pStm);
zero.QuadPart = 0; zero.QuadPart = 0;
hr = IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &cur); hr = IStream_Seek(pStm, zero, STREAM_SEEK_CUR, &cur);
offset->cbBodyStart = cur.u.LowPart + offset->cbHeaderStart; offset->cbBodyStart = cur.u.LowPart + offset->cbHeaderStart;
if(parent) MimeBody_set_offsets(impl_from_IMimeBody(mime_body), offset); if (parent) MimeBody_set_offsets(mime_body, offset);
IMimeBody_SetData(mime_body, IET_BINARY, NULL, NULL, &IID_IStream, pStm); IMimeBody_SetData(&mime_body->IMimeBody_iface, IET_BINARY, NULL, NULL, &IID_IStream, pStm);
body = new_body_entry(mime_body, msg->next_index++, parent); body = new_body_entry(mime_body, msg->next_index++, parent);
if(IMimeBody_IsContentType(mime_body, "multipart", NULL) == S_OK) if(IMimeBody_IsContentType(&mime_body->IMimeBody_iface, "multipart", NULL) == S_OK)
{ {
MIMEPARAMINFO *param_info; MIMEPARAMINFO *param_info;
ULONG count, i; ULONG count, i;
IMimeAllocator *alloc; IMimeAllocator *alloc;
hr = IMimeBody_GetParameters(mime_body, "Content-Type", &count, &param_info); hr = IMimeBody_GetParameters(&mime_body->IMimeBody_iface, "Content-Type", &count,
&param_info);
if(hr != S_OK || count == 0) return body; if(hr != S_OK || count == 0) return body;
MimeOleGetAllocator(&alloc); MimeOleGetAllocator(&alloc);
@ -1678,11 +1695,9 @@ static body_t *create_sub_body(MimeMessage *msg, IStream *pStm, BODYOFFSETS *off
return body; return body;
} }
static HRESULT WINAPI MimeMessage_Load( static HRESULT WINAPI MimeMessage_Load(IMimeMessage *iface, IStream *pStm)
IMimeMessage *iface,
LPSTREAM pStm)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
body_t *root_body; body_t *root_body;
BODYOFFSETS offsets; BODYOFFSETS offsets;
ULARGE_INTEGER cur; ULARGE_INTEGER cur;
@ -1706,17 +1721,14 @@ static HRESULT WINAPI MimeMessage_Load(
zero.QuadPart = 0; zero.QuadPart = 0;
IStream_Seek(pStm, zero, STREAM_SEEK_END, &cur); IStream_Seek(pStm, zero, STREAM_SEEK_END, &cur);
offsets.cbBodyEnd = cur.u.LowPart; offsets.cbBodyEnd = cur.u.LowPart;
MimeBody_set_offsets(impl_from_IMimeBody(root_body->mime_body), &offsets); MimeBody_set_offsets(root_body->mime_body, &offsets);
list_add_head(&This->body_tree, &root_body->entry); list_add_head(&This->body_tree, &root_body->entry);
return S_OK; return S_OK;
} }
static HRESULT WINAPI MimeMessage_Save( static HRESULT WINAPI MimeMessage_Save(IMimeMessage *iface, IStream *pStm, BOOL fClearDirty)
IMimeMessage *iface,
LPSTREAM pStm,
BOOL fClearDirty)
{ {
FIXME("(%p)->(%p, %s)\n", iface, pStm, fClearDirty ? "TRUE" : "FALSE"); FIXME("(%p)->(%p, %s)\n", iface, pStm, fClearDirty ? "TRUE" : "FALSE");
return E_NOTIMPL; return E_NOTIMPL;
@ -1738,12 +1750,11 @@ static HRESULT WINAPI MimeMessage_InitNew(
} }
/*** IMimeMessageTree methods ***/ /*** IMimeMessageTree methods ***/
static HRESULT WINAPI MimeMessage_GetMessageSource( static HRESULT WINAPI MimeMessage_GetMessageSource(IMimeMessage *iface, IStream **ppStream,
IMimeMessage *iface,
IStream **ppStream,
DWORD dwFlags) DWORD dwFlags)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
FIXME("(%p)->(%p, 0x%x)\n", iface, ppStream, dwFlags); FIXME("(%p)->(%p, 0x%x)\n", iface, ppStream, dwFlags);
IStream_AddRef(This->stream); IStream_AddRef(This->stream);
@ -1826,13 +1837,10 @@ static HRESULT find_body(struct list *list, HBODY hbody, body_t **body)
return S_FALSE; return S_FALSE;
} }
static HRESULT WINAPI MimeMessage_BindToObject( static HRESULT WINAPI MimeMessage_BindToObject(IMimeMessage *iface, const HBODY hBody, REFIID riid,
IMimeMessage *iface,
const HBODY hBody,
REFIID riid,
void **ppvObject) void **ppvObject)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
HRESULT hr; HRESULT hr;
body_t *body; body_t *body;
@ -1844,8 +1852,8 @@ static HRESULT WINAPI MimeMessage_BindToObject(
if(IsEqualIID(riid, &IID_IMimeBody)) if(IsEqualIID(riid, &IID_IMimeBody))
{ {
IMimeBody_AddRef(body->mime_body); IMimeBody_AddRef(&body->mime_body->IMimeBody_iface);
*ppvObject = body->mime_body; *ppvObject = &body->mime_body->IMimeBody_iface;
return S_OK; return S_OK;
} }
@ -1937,13 +1945,10 @@ static HRESULT WINAPI MimeMessage_InsertBody(
return E_NOTIMPL; return E_NOTIMPL;
} }
static HRESULT WINAPI MimeMessage_GetBody( static HRESULT WINAPI MimeMessage_GetBody(IMimeMessage *iface, BODYLOCATION location, HBODY hPivot,
IMimeMessage *iface, HBODY *phBody)
BODYLOCATION location,
HBODY hPivot,
LPHBODY phBody)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
body_t *body; body_t *body;
HRESULT hr; HRESULT hr;
@ -1985,14 +1990,11 @@ static void count_children(body_t *body, boolean recurse, ULONG *count)
} }
} }
static HRESULT WINAPI MimeMessage_CountBodies( static HRESULT WINAPI MimeMessage_CountBodies(IMimeMessage *iface, HBODY hParent, boolean fRecurse,
IMimeMessage *iface,
HBODY hParent,
boolean fRecurse,
ULONG *pcBodies) ULONG *pcBodies)
{ {
HRESULT hr; HRESULT hr;
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
body_t *body; body_t *body;
TRACE("(%p)->(%p, %s, %p)\n", iface, hParent, fRecurse ? "TRUE" : "FALSE", pcBodies); TRACE("(%p)->(%p, %s, %p)\n", iface, hParent, fRecurse ? "TRUE" : "FALSE", pcBodies);
@ -2006,9 +2008,8 @@ static HRESULT WINAPI MimeMessage_CountBodies(
return S_OK; return S_OK;
} }
static HRESULT find_next(IMimeMessage *msg, body_t *body, LPFINDBODY find, HBODY *out) static HRESULT find_next(MimeMessage *This, body_t *body, FINDBODY *find, HBODY *out)
{ {
MimeMessage *This = (MimeMessage *)msg;
struct list *ptr; struct list *ptr;
HBODY next; HBODY next;
@ -2028,7 +2029,8 @@ static HRESULT find_next(IMimeMessage *msg, body_t *body, LPFINDBODY find, HBODY
body = LIST_ENTRY( ptr, body_t, entry ); body = LIST_ENTRY( ptr, body_t, entry );
next = UlongToHandle( body->index ); next = UlongToHandle( body->index );
find->dwReserved = body->index; find->dwReserved = body->index;
if (IMimeBody_IsContentType(body->mime_body, find->pszPriType, find->pszSubType) == S_OK) if (IMimeBody_IsContentType(&body->mime_body->IMimeBody_iface, find->pszPriType,
find->pszSubType) == S_OK)
{ {
*out = next; *out = next;
return S_OK; return S_OK;
@ -2037,23 +2039,19 @@ static HRESULT find_next(IMimeMessage *msg, body_t *body, LPFINDBODY find, HBODY
return MIME_E_NOT_FOUND; return MIME_E_NOT_FOUND;
} }
static HRESULT WINAPI MimeMessage_FindFirst( static HRESULT WINAPI MimeMessage_FindFirst(IMimeMessage *iface, FINDBODY *pFindBody, HBODY *phBody)
IMimeMessage *iface,
LPFINDBODY pFindBody,
LPHBODY phBody)
{ {
MimeMessage *This = impl_from_IMimeMessage(iface);
TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody); TRACE("(%p)->(%p, %p)\n", iface, pFindBody, phBody);
pFindBody->dwReserved = 0; pFindBody->dwReserved = 0;
return find_next( iface, NULL, pFindBody, phBody ); return find_next(This, NULL, pFindBody, phBody);
} }
static HRESULT WINAPI MimeMessage_FindNext( static HRESULT WINAPI MimeMessage_FindNext(IMimeMessage *iface, FINDBODY *pFindBody, HBODY *phBody)
IMimeMessage *iface,
LPFINDBODY pFindBody,
LPHBODY phBody)
{ {
MimeMessage *This = (MimeMessage *)iface; MimeMessage *This = impl_from_IMimeMessage(iface);
body_t *body; body_t *body;
HRESULT hr; HRESULT hr;
@ -2061,7 +2059,7 @@ static HRESULT WINAPI MimeMessage_FindNext(
hr = find_body( &This->body_tree, UlongToHandle( pFindBody->dwReserved ), &body ); hr = find_body( &This->body_tree, UlongToHandle( pFindBody->dwReserved ), &body );
if (hr != S_OK) return MIME_E_NOT_FOUND; if (hr != S_OK) return MIME_E_NOT_FOUND;
return find_next( iface, body, pFindBody, phBody ); return find_next(This, body, pFindBody, phBody);
} }
static HRESULT WINAPI MimeMessage_ResolveURL( static HRESULT WINAPI MimeMessage_ResolveURL(
@ -2565,13 +2563,13 @@ HRESULT MimeMessage_create(IUnknown *outer, void **obj)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->lpVtbl = &MimeMessageVtbl; This->IMimeMessage_iface.lpVtbl = &MimeMessageVtbl;
This->refs = 1; This->ref = 1;
This->stream = NULL; This->stream = NULL;
list_init(&This->body_tree); list_init(&This->body_tree);
This->next_index = 1; This->next_index = 1;
*obj = &This->lpVtbl; *obj = &This->IMimeMessage_iface;
return S_OK; return S_OK;
} }
@ -2607,54 +2605,53 @@ HRESULT WINAPI MimeOleCreateVirtualStream(IStream **ppStream)
typedef struct MimeSecurity typedef struct MimeSecurity
{ {
const IMimeSecurityVtbl *lpVtbl; IMimeSecurity IMimeSecurity_iface;
LONG ref;
LONG refs;
} MimeSecurity; } MimeSecurity;
static HRESULT WINAPI MimeSecurity_QueryInterface( static inline MimeSecurity *impl_from_IMimeSecurity(IMimeSecurity *iface)
IMimeSecurity* iface,
REFIID riid,
void** obj)
{ {
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), obj); return CONTAINING_RECORD(iface, MimeSecurity, IMimeSecurity_iface);
}
static HRESULT WINAPI MimeSecurity_QueryInterface(IMimeSecurity *iface, REFIID riid, void **ppv)
{
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
if (IsEqualIID(riid, &IID_IUnknown) || if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IMimeSecurity)) IsEqualIID(riid, &IID_IMimeSecurity))
{ {
*obj = iface; *ppv = iface;
IUnknown_AddRef(iface); IMimeSecurity_AddRef(iface);
return S_OK; return S_OK;
} }
FIXME("no interface for %s\n", debugstr_guid(riid)); FIXME("no interface for %s\n", debugstr_guid(riid));
*obj = NULL; *ppv = NULL;
return E_NOINTERFACE; return E_NOINTERFACE;
} }
static ULONG WINAPI MimeSecurity_AddRef( static ULONG WINAPI MimeSecurity_AddRef(IMimeSecurity *iface)
IMimeSecurity* iface)
{ {
MimeSecurity *This = (MimeSecurity *)iface; MimeSecurity *This = impl_from_IMimeSecurity(iface);
TRACE("(%p)->()\n", iface); LONG ref = InterlockedIncrement(&This->ref);
return InterlockedIncrement(&This->refs);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
} }
static ULONG WINAPI MimeSecurity_Release( static ULONG WINAPI MimeSecurity_Release(IMimeSecurity *iface)
IMimeSecurity* iface)
{ {
MimeSecurity *This = (MimeSecurity *)iface; MimeSecurity *This = impl_from_IMimeSecurity(iface);
ULONG refs; LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->()\n", iface); TRACE("(%p) ref=%d\n", This, ref);
refs = InterlockedDecrement(&This->refs); if (!ref)
if (!refs)
{
HeapFree(GetProcessHeap(), 0, This); HeapFree(GetProcessHeap(), 0, This);
}
return refs; return ref;
} }
static HRESULT WINAPI MimeSecurity_InitNew( static HRESULT WINAPI MimeSecurity_InitNew(
@ -2779,10 +2776,10 @@ HRESULT MimeSecurity_create(IUnknown *outer, void **obj)
This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) return E_OUTOFMEMORY; if (!This) return E_OUTOFMEMORY;
This->lpVtbl = &MimeSecurityVtbl; This->IMimeSecurity_iface.lpVtbl = &MimeSecurityVtbl;
This->refs = 1; This->ref = 1;
*obj = &This->lpVtbl; *obj = &This->IMimeSecurity_iface;
return S_OK; return S_OK;
} }
@ -2794,11 +2791,6 @@ HRESULT WINAPI MimeOleCreateSecurity(IMimeSecurity **ppSecurity)
return MimeSecurity_create(NULL, (void **)ppSecurity); return MimeSecurity_create(NULL, (void **)ppSecurity);
} }
typedef struct
{
IMimeAllocatorVtbl *lpVtbl;
} MimeAllocator;
static HRESULT WINAPI MimeAlloc_QueryInterface( static HRESULT WINAPI MimeAlloc_QueryInterface(
IMimeAllocator* iface, IMimeAllocator* iface,
REFIID riid, REFIID riid,
@ -2811,7 +2803,7 @@ static HRESULT WINAPI MimeAlloc_QueryInterface(
IsEqualIID(riid, &IID_IMimeAllocator)) IsEqualIID(riid, &IID_IMimeAllocator))
{ {
*obj = iface; *obj = iface;
IUnknown_AddRef(iface); IMimeAllocator_AddRef(iface);
return S_OK; return S_OK;
} }
@ -2980,7 +2972,7 @@ static IMimeAllocatorVtbl mime_alloc_vtbl =
MimeAlloc_PropVariantClear MimeAlloc_PropVariantClear
}; };
static MimeAllocator mime_allocator = static IMimeAllocator mime_allocator =
{ {
&mime_alloc_vtbl &mime_alloc_vtbl
}; };

View file

@ -315,11 +315,10 @@ static HRESULT parse_top_response(POP3Transport *This, POP3TOP *top)
} }
} }
static void init_parser(POP3Transport *This, POP3COMMAND command, POP3CMDTYPE type) static void init_parser(POP3Transport *This, POP3COMMAND command)
{ {
This->state = STATE_NONE; This->state = STATE_NONE;
This->command = command; This->command = command;
This->type = type;
} }
static HRESULT POP3Transport_ParseResponse(POP3Transport *This, char *pszResponse, POP3RESPONSE *pResponse) static HRESULT POP3Transport_ParseResponse(POP3Transport *This, char *pszResponse, POP3RESPONSE *pResponse)
@ -663,7 +662,7 @@ static void POP3Transport_CallbackProcessUSERResp(IInternetTransport *iface, cha
strcat(command, This->InetTransport.ServerInfo.szPassword); strcat(command, This->InetTransport.ServerInfo.szPassword);
strcat(command, "\r\n"); strcat(command, "\r\n");
init_parser(This, POP3_PASS, POP3_NONE); init_parser(This, POP3_PASS);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -733,7 +732,7 @@ static HRESULT WINAPI POP3Transport_QueryInterface(IPOP3Transport *iface, REFIID
IsEqualIID(riid, &IID_IPOP3Transport)) IsEqualIID(riid, &IID_IPOP3Transport))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IPOP3Transport_AddRef(iface);
return S_OK; return S_OK;
} }
*ppv = NULL; *ppv = NULL;
@ -804,7 +803,7 @@ static HRESULT WINAPI POP3Transport_Connect(IPOP3Transport *iface,
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
init_parser(This, POP3_USER, POP3_NONE); init_parser(This, POP3_USER);
return InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackSendUSERCmd); return InternetTransport_ReadLine(&This->InetTransport, POP3Transport_CallbackSendUSERCmd);
} }
@ -889,7 +888,7 @@ static HRESULT WINAPI POP3Transport_CommandUSER(IPOP3Transport *iface, LPSTR use
strcat(command, username); strcat(command, username);
strcat(command, "\r\n"); strcat(command, "\r\n");
init_parser(This, POP3_USER, POP3_NONE); init_parser(This, POP3_USER);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUSERResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUSERResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -912,7 +911,7 @@ static HRESULT WINAPI POP3Transport_CommandPASS(IPOP3Transport *iface, LPSTR pas
strcat(command, password); strcat(command, password);
strcat(command, "\r\n"); strcat(command, "\r\n");
init_parser(This, POP3_PASS, POP3_NONE); init_parser(This, POP3_PASS);
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvPASSResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -938,7 +937,8 @@ static HRESULT WINAPI POP3Transport_CommandLIST(
} }
else command = list_all; else command = list_all;
init_parser(This, POP3_LIST, cmdtype); init_parser(This, POP3_LIST);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvLISTResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvLISTResp);
if (dwPopId) HeapFree(GetProcessHeap(), 0, command); if (dwPopId) HeapFree(GetProcessHeap(), 0, command);
@ -960,7 +960,8 @@ static HRESULT WINAPI POP3Transport_CommandTOP(
sprintf(command, top, dwPopId, cPreviewLines); sprintf(command, top, dwPopId, cPreviewLines);
This->preview_lines = cPreviewLines; This->preview_lines = cPreviewLines;
init_parser(This, POP3_TOP, cmdtype); init_parser(This, POP3_TOP);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvTOPResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvTOPResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -976,7 +977,7 @@ static HRESULT WINAPI POP3Transport_CommandQUIT(IPOP3Transport *iface)
InternetTransport_ChangeStatus(&This->InetTransport, IXP_DISCONNECTING); InternetTransport_ChangeStatus(&This->InetTransport, IXP_DISCONNECTING);
init_parser(This, POP3_QUIT, POP3_NONE); init_parser(This, POP3_QUIT);
return InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvQUITResp); return InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvQUITResp);
} }
@ -987,7 +988,7 @@ static HRESULT WINAPI POP3Transport_CommandSTAT(IPOP3Transport *iface)
TRACE("\n"); TRACE("\n");
init_parser(This, POP3_STAT, POP3_NONE); init_parser(This, POP3_STAT);
InternetTransport_DoCommand(&This->InetTransport, stat, POP3Transport_CallbackRecvSTATResp); InternetTransport_DoCommand(&This->InetTransport, stat, POP3Transport_CallbackRecvSTATResp);
return S_OK; return S_OK;
} }
@ -999,7 +1000,7 @@ static HRESULT WINAPI POP3Transport_CommandNOOP(IPOP3Transport *iface)
TRACE("\n"); TRACE("\n");
init_parser(This, POP3_NOOP, POP3_NONE); init_parser(This, POP3_NOOP);
InternetTransport_DoCommand(&This->InetTransport, noop, POP3Transport_CallbackRecvNOOPResp); InternetTransport_DoCommand(&This->InetTransport, noop, POP3Transport_CallbackRecvNOOPResp);
return S_OK; return S_OK;
} }
@ -1011,7 +1012,7 @@ static HRESULT WINAPI POP3Transport_CommandRSET(IPOP3Transport *iface)
TRACE("\n"); TRACE("\n");
init_parser(This, POP3_RSET, POP3_NONE); init_parser(This, POP3_RSET);
InternetTransport_DoCommand(&This->InetTransport, rset, POP3Transport_CallbackRecvRSETResp); InternetTransport_DoCommand(&This->InetTransport, rset, POP3Transport_CallbackRecvRSETResp);
return S_OK; return S_OK;
} }
@ -1035,7 +1036,8 @@ static HRESULT WINAPI POP3Transport_CommandUIDL(
} }
else command = uidl_all; else command = uidl_all;
init_parser(This, POP3_UIDL, cmdtype); init_parser(This, POP3_UIDL);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUIDLResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvUIDLResp);
if (dwPopId) HeapFree(GetProcessHeap(), 0, command); if (dwPopId) HeapFree(GetProcessHeap(), 0, command);
@ -1056,7 +1058,8 @@ static HRESULT WINAPI POP3Transport_CommandDELE(
if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE; if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE;
sprintf(command, dele, dwPopId); sprintf(command, dele, dwPopId);
init_parser(This, POP3_DELE, cmdtype); init_parser(This, POP3_DELE);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvDELEResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvDELEResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -1077,7 +1080,8 @@ static HRESULT WINAPI POP3Transport_CommandRETR(
if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE; if (!(command = HeapAlloc(GetProcessHeap(), 0, len))) return S_FALSE;
sprintf(command, retr, dwPopId); sprintf(command, retr, dwPopId);
init_parser(This, POP3_RETR, cmdtype); init_parser(This, POP3_RETR);
This->type = cmdtype;
InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvRETRResp); InternetTransport_DoCommand(&This->InetTransport, command, POP3Transport_CallbackRecvRETRResp);
HeapFree(GetProcessHeap(), 0, command); HeapFree(GetProcessHeap(), 0, command);
@ -1143,7 +1147,7 @@ static HRESULT WINAPI POP3TransportCF_QueryInterface(LPCLASSFACTORY iface,
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IClassFactory_AddRef(iface);
return S_OK; return S_OK;
} }
return E_NOINTERFACE; return E_NOINTERFACE;

View file

@ -536,7 +536,7 @@ static HRESULT WINAPI SMTPTransport_QueryInterface(ISMTPTransport2 *iface, REFII
IsEqualIID(riid, &IID_ISMTPTransport2)) IsEqualIID(riid, &IID_ISMTPTransport2))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); ISMTPTransport2_AddRef(iface);
return S_OK; return S_OK;
} }
*ppv = NULL; *ppv = NULL;
@ -993,7 +993,7 @@ static HRESULT WINAPI SMTPTransportCF_QueryInterface(LPCLASSFACTORY iface,
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory)) if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_IClassFactory))
{ {
*ppv = iface; *ppv = iface;
IUnknown_AddRef(iface); IClassFactory_AddRef(iface);
return S_OK; return S_OK;
} }
return E_NOINTERFACE; return E_NOINTERFACE;

View file

@ -84,7 +84,7 @@ reactos/dll/win32/ieframe # Synced to Wine-1.7.1
reactos/dll/win32/imaadp32.acm # Synced to Wine-1.7.1 reactos/dll/win32/imaadp32.acm # Synced to Wine-1.7.1
reactos/dll/win32/imagehlp # Synced to Wine-1.7.1 reactos/dll/win32/imagehlp # Synced to Wine-1.7.1
reactos/dll/win32/imm32 # Synced to Wine-1.5.19 reactos/dll/win32/imm32 # Synced to Wine-1.5.19
reactos/dll/win32/inetcomm # Synced to Wine-1.5.4 reactos/dll/win32/inetcomm # Synced to Wine-1.7.1
reactos/dll/win32/inetmib1 # Synced to Wine-1.5.4 reactos/dll/win32/inetmib1 # Synced to Wine-1.5.4
reactos/dll/win32/initpki # Synced to Wine-1.5.19 reactos/dll/win32/initpki # Synced to Wine-1.5.19
reactos/dll/win32/inseng # Synced to Wine-1.5.4 reactos/dll/win32/inseng # Synced to Wine-1.5.4