diff --git a/dlls/inetcomm/Makefile.in b/dlls/inetcomm/Makefile.in index 462294c713b..ee03db03f70 100644 --- a/dlls/inetcomm/Makefile.in +++ b/dlls/inetcomm/Makefile.in @@ -9,6 +9,7 @@ IMPORTS = uuid ole32 ws2_32 user32 advapi32 kernel32 C_SRCS = \ inetcomm_main.c \ internettransport.c \ + mimeintl.c \ mimeole.c \ regsvr.c diff --git a/dlls/inetcomm/inetcomm.spec b/dlls/inetcomm/inetcomm.spec index 36a5d8bd52f..4db2c7dbbd2 100644 --- a/dlls/inetcomm/inetcomm.spec +++ b/dlls/inetcomm/inetcomm.spec @@ -76,7 +76,7 @@ @ stub MimeOleGetFileExtension @ stub MimeOleGetFileInfo @ stub MimeOleGetFileInfoW -@ stub MimeOleGetInternat +@ stdcall MimeOleGetInternat(ptr) @ stub MimeOleGetPropA @ stub MimeOleGetPropW @ stub MimeOleGetPropertySchema diff --git a/dlls/inetcomm/inetcomm_main.c b/dlls/inetcomm/inetcomm_main.c index 15350df89e2..579b05f65c0 100644 --- a/dlls/inetcomm/inetcomm_main.c +++ b/dlls/inetcomm/inetcomm_main.c @@ -37,6 +37,8 @@ WINE_DEFAULT_DEBUG_CHANNEL(inetcomm); BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) { + IMimeInternational *international; + TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved); switch (fdwReason) @@ -47,8 +49,10 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved) DisableThreadLibraryCalls(hinstDLL); if (!InternetTransport_RegisterClass(hinstDLL)) return FALSE; + MimeInternational_Construct(&international); break; case DLL_PROCESS_DETACH: + IMimeInternational_Release(international); InternetTransport_UnregisterClass(hinstDLL); break; default: diff --git a/dlls/inetcomm/inetcomm_private.h b/dlls/inetcomm/inetcomm_private.h index bf6e5ce31dd..5587ae7ec98 100644 --- a/dlls/inetcomm/inetcomm_private.h +++ b/dlls/inetcomm/inetcomm_private.h @@ -71,3 +71,5 @@ void InternetTransport_UnregisterClass(HINSTANCE hInstance); HRESULT MimeBody_create(IUnknown *outer, void **obj); HRESULT MimeAllocator_create(IUnknown *outer, void **obj); + +HRESULT MimeInternational_Construct(IMimeInternational **internat); diff --git a/dlls/inetcomm/internettransport.c b/dlls/inetcomm/internettransport.c index bba6aaba110..0d3c679d1bd 100644 --- a/dlls/inetcomm/internettransport.c +++ b/dlls/inetcomm/internettransport.c @@ -26,8 +26,12 @@ #include "windef.h" #include "winbase.h" #include "winnt.h" +#include "winuser.h" #include "winsock2.h" #include "ws2tcpip.h" +#include "objbase.h" +#include "ole2.h" +#include "mimeole.h" #include "wine/debug.h" diff --git a/dlls/inetcomm/mimeintl.c b/dlls/inetcomm/mimeintl.c new file mode 100644 index 00000000000..6cc1d96f601 --- /dev/null +++ b/dlls/inetcomm/mimeintl.c @@ -0,0 +1,241 @@ +/* + * MIME OLE International interface + * + * Copyright 2008 Huw Davies for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#define COBJMACROS +#define NONAMELESSUNION + +#include +#include + +#include "windef.h" +#include "winbase.h" +#include "winuser.h" +#include "winnls.h" +#include "objbase.h" +#include "ole2.h" +#include "mimeole.h" + +#include "wine/list.h" +#include "wine/debug.h" + +#include "inetcomm_private.h" + +WINE_DEFAULT_DEBUG_CHANNEL(inetcomm); + +typedef struct +{ + const IMimeInternationalVtbl *lpVtbl; + LONG refs; +} internat; + +static inline internat *impl_from_IMimeInternational( IMimeInternational *iface ) +{ + return (internat *)((char*)iface - FIELD_OFFSET(internat, lpVtbl)); +} + +static HRESULT WINAPI MimeInternat_QueryInterface( IMimeInternational *iface, REFIID riid, LPVOID *ppobj ) +{ + if (IsEqualGUID(riid, &IID_IUnknown) || + IsEqualGUID(riid, &IID_IMimeInternational)) + { + IMimeInternational_AddRef( iface ); + *ppobj = iface; + return S_OK; + } + + FIXME("interface %s not implemented\n", debugstr_guid(riid)); + return E_NOINTERFACE; +} + +static ULONG WINAPI MimeInternat_AddRef( IMimeInternational *iface ) +{ + internat *This = impl_from_IMimeInternational( iface ); + return InterlockedIncrement(&This->refs); +} + +static ULONG WINAPI MimeInternat_Release( IMimeInternational *iface ) +{ + internat *This = impl_from_IMimeInternational( iface ); + ULONG refs; + + refs = InterlockedDecrement(&This->refs); + if (!refs) + { + HeapFree(GetProcessHeap(), 0, This); + } + + return refs; +} + +static HRESULT WINAPI MimeInternat_SetDefaultCharset(IMimeInternational *iface, HCHARSET hCharset) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_GetDefaultCharset(IMimeInternational *iface, LPHCHARSET phCharset) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_GetCodePageCharset(IMimeInternational *iface, CODEPAGEID cpiCodePage, + CHARSETTYPE ctCsetType, + LPHCHARSET phCharset) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_FindCharset(IMimeInternational *iface, LPCSTR pszCharset, + LPHCHARSET phCharset) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_GetCharsetInfo(IMimeInternational *iface, HCHARSET hCharset, + LPINETCSETINFO pCsetInfo) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_GetCodePageInfo(IMimeInternational *iface, CODEPAGEID cpiCodePage, + LPCODEPAGEINFO pCodePageInfo) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_DecodeHeader(IMimeInternational *iface, HCHARSET hCharset, + LPCSTR pszData, + LPPROPVARIANT pDecoded, + LPRFC1522INFO pRfc1522Info) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_EncodeHeader(IMimeInternational *iface, HCHARSET hCharset, + LPPROPVARIANT pData, + LPSTR *ppszEncoded, + LPRFC1522INFO pRfc1522Info) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_ConvertBuffer(IMimeInternational *iface, CODEPAGEID cpiSource, + CODEPAGEID cpiDest, + LPBLOB pIn, + LPBLOB pOut, + ULONG *pcbRead) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_ConvertString(IMimeInternational *iface, CODEPAGEID cpiSource, + CODEPAGEID cpiDest, + LPPROPVARIANT pIn, + LPPROPVARIANT pOut) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_MLANG_ConvertInetReset(IMimeInternational *iface) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_MLANG_ConvertInetString(IMimeInternational *iface, CODEPAGEID cpiSource, + CODEPAGEID cpiDest, + LPCSTR pSource, + int *pnSizeOfSource, + LPSTR pDestination, + int *pnDstSize) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_Rfc1522Decode(IMimeInternational *iface, LPCSTR pszValue, + LPCSTR pszCharset, + ULONG cchmax, + LPSTR *ppszDecoded) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static HRESULT WINAPI MimeInternat_Rfc1522Encode(IMimeInternational *iface, LPCSTR pszValue, + HCHARSET hCharset, + LPSTR *ppszEncoded) +{ + FIXME("stub\n"); + return E_NOTIMPL; +} + +static IMimeInternationalVtbl mime_internat_vtbl = +{ + MimeInternat_QueryInterface, + MimeInternat_AddRef, + MimeInternat_Release, + MimeInternat_SetDefaultCharset, + MimeInternat_GetDefaultCharset, + MimeInternat_GetCodePageCharset, + MimeInternat_FindCharset, + MimeInternat_GetCharsetInfo, + MimeInternat_GetCodePageInfo, + MimeInternat_DecodeHeader, + MimeInternat_EncodeHeader, + MimeInternat_ConvertBuffer, + MimeInternat_ConvertString, + MimeInternat_MLANG_ConvertInetReset, + MimeInternat_MLANG_ConvertInetString, + MimeInternat_Rfc1522Decode, + MimeInternat_Rfc1522Encode +}; + +static internat *global_internat; + +HRESULT MimeInternational_Construct(IMimeInternational **internat) +{ + global_internat = HeapAlloc(GetProcessHeap(), 0, sizeof(*global_internat)); + global_internat->lpVtbl = &mime_internat_vtbl; + global_internat->refs = 0; + + *internat = (IMimeInternational*)&global_internat->lpVtbl; + + IMimeInternational_AddRef(*internat); + return S_OK; +} + +HRESULT WINAPI MimeOleGetInternat(IMimeInternational **internat) +{ + TRACE("(%p)\n", internat); + + *internat = (IMimeInternational *)&global_internat->lpVtbl; + IMimeInternational_AddRef(*internat); + return S_OK; +} diff --git a/dlls/inetcomm/regsvr.c b/dlls/inetcomm/regsvr.c index 620cfa78ef4..a21b85b7de9 100644 --- a/dlls/inetcomm/regsvr.c +++ b/dlls/inetcomm/regsvr.c @@ -31,8 +31,8 @@ #include "ocidl.h" #include "initguid.h" -#include "inetcomm_private.h" #include "mimeole.h" +#include "inetcomm_private.h" #include "wine/debug.h"