2 * Internet Messaging APIs
4 * Copyright 2006 Robert Shearman for CodeWeavers
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Lesser General Public
8 * License as published by the Free Software Foundation; either
9 * version 2.1 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Lesser General Public License for more details.
16 * You should have received a copy of the GNU Lesser General Public
17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
35 #include "inetcomm_private.h"
37 #include "wine/debug.h"
39 WINE_DEFAULT_DEBUG_CHANNEL(inetcomm
);
41 BOOL WINAPI
DllMain(HINSTANCE hinstDLL
, DWORD fdwReason
, LPVOID lpvReserved
)
43 static IMimeInternational
*international
;
45 TRACE("(%p, %d, %p)\n", hinstDLL
, fdwReason
, lpvReserved
);
49 case DLL_PROCESS_ATTACH
:
50 DisableThreadLibraryCalls(hinstDLL
);
51 if (!InternetTransport_RegisterClass(hinstDLL
))
53 MimeInternational_Construct(&international
);
55 case DLL_PROCESS_DETACH
:
56 if (lpvReserved
) break;
57 IMimeInternational_Release(international
);
58 InternetTransport_UnregisterClass(hinstDLL
);
64 /******************************************************************************
69 IClassFactory IClassFactory_iface
;
70 HRESULT (*create_object
)(IUnknown
*, void **);
73 static inline cf
*impl_from_IClassFactory( IClassFactory
*iface
)
75 return CONTAINING_RECORD(iface
, cf
, IClassFactory_iface
);
78 static HRESULT WINAPI
cf_QueryInterface( IClassFactory
*iface
, REFIID riid
, LPVOID
*ppobj
)
80 if (IsEqualGUID(riid
, &IID_IUnknown
) ||
81 IsEqualGUID(riid
, &IID_IClassFactory
))
83 IClassFactory_AddRef( iface
);
88 if (!IsEqualGUID(riid
, &IID_IInternetProtocolInfo
))
89 FIXME("interface %s not implemented\n", debugstr_guid(riid
));
94 static ULONG WINAPI
cf_AddRef( IClassFactory
*iface
)
99 static ULONG WINAPI
cf_Release( IClassFactory
*iface
)
104 static HRESULT WINAPI
cf_CreateInstance( IClassFactory
*iface
, LPUNKNOWN pOuter
,
105 REFIID riid
, LPVOID
*ppobj
)
107 cf
*This
= impl_from_IClassFactory( iface
);
111 TRACE("%p %s %p\n", pOuter
, debugstr_guid(riid
), ppobj
);
115 if (pOuter
&& !IsEqualGUID(&IID_IUnknown
, riid
))
116 return CLASS_E_NOAGGREGATION
;
118 r
= This
->create_object( pOuter
, (LPVOID
*) &punk
);
122 if (IsEqualGUID(&IID_IUnknown
, riid
)) {
127 r
= IUnknown_QueryInterface( punk
, riid
, ppobj
);
128 IUnknown_Release( punk
);
132 static HRESULT WINAPI
cf_LockServer( IClassFactory
*iface
, BOOL dolock
)
134 FIXME("(%p)->(%d),stub!\n",iface
,dolock
);
138 static const struct IClassFactoryVtbl cf_vtbl
=
147 static cf mime_body_cf
= { { &cf_vtbl
}, MimeBody_create
};
148 static cf mime_allocator_cf
= { { &cf_vtbl
}, MimeAllocator_create
};
149 static cf mime_message_cf
= { { &cf_vtbl
}, MimeMessage_create
};
150 static cf mime_security_cf
= { { &cf_vtbl
}, MimeSecurity_create
};
151 static cf virtual_stream_cf
= { { &cf_vtbl
}, VirtualStream_create
};
152 static cf mhtml_protocol_cf
= { { &cf_vtbl
}, MimeHtmlProtocol_create
};
154 /***********************************************************************
155 * DllGetClassObject (INETCOMM.@)
157 HRESULT WINAPI
DllGetClassObject(REFCLSID rclsid
, REFIID iid
, LPVOID
*ppv
)
159 IClassFactory
*cf
= NULL
;
161 TRACE("%s %s %p\n", debugstr_guid(rclsid
), debugstr_guid(iid
), ppv
);
163 if (IsEqualCLSID(rclsid
, &CLSID_ISMTPTransport
))
164 return SMTPTransportCF_Create(iid
, ppv
);
166 if (IsEqualCLSID(rclsid
, &CLSID_ISMTPTransport2
))
167 return SMTPTransportCF_Create(iid
, ppv
);
169 if (IsEqualCLSID(rclsid
, &CLSID_IIMAPTransport
))
170 return IMAPTransportCF_Create(iid
, ppv
);
172 if (IsEqualCLSID(rclsid
, &CLSID_IPOP3Transport
))
173 return POP3TransportCF_Create(iid
, ppv
);
175 if ( IsEqualCLSID( rclsid
, &CLSID_IMimeSecurity
))
177 cf
= &mime_security_cf
.IClassFactory_iface
;
179 else if( IsEqualCLSID( rclsid
, &CLSID_IMimeMessage
))
181 cf
= &mime_message_cf
.IClassFactory_iface
;
183 else if( IsEqualCLSID( rclsid
, &CLSID_IMimeBody
))
185 cf
= &mime_body_cf
.IClassFactory_iface
;
187 else if( IsEqualCLSID( rclsid
, &CLSID_IMimeAllocator
))
189 cf
= &mime_allocator_cf
.IClassFactory_iface
;
191 else if( IsEqualCLSID( rclsid
, &CLSID_IVirtualStream
))
193 cf
= &virtual_stream_cf
.IClassFactory_iface
;
195 else if( IsEqualCLSID( rclsid
, &CLSID_IMimeHtmlProtocol
))
197 cf
= &mhtml_protocol_cf
.IClassFactory_iface
;
202 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid
),debugstr_guid(iid
));
203 return CLASS_E_CLASSNOTAVAILABLE
;
206 return IClassFactory_QueryInterface( cf
, iid
, ppv
);