ReactOS Fundraising Campaign 2012
 
€ 4,410 / € 30,000

Information | Donate

Home | Info | Community | Development | myReactOS | Contact Us

  1. Home
  2. Community
  3. Development
  4. myReactOS
  5. Fundraiser 2012

  1. Main Page
  2. Alphabetical List
  3. Data Structures
  4. Directories
  5. File List
  6. Data Fields
  7. Globals
  8. Related Pages

ReactOS Development > Doxygen

main.c
Go to the documentation of this file.
00001 /*
00002  * Copyright 2007 Jacek Caban for CodeWeavers
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2.1 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General Public
00015  * License along with this library; if not, write to the Free Software
00016  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
00017  */
00018 
00019 #include "config.h"
00020 
00021 #include <stdarg.h>
00022 #include <stdio.h>
00023 
00024 #define COBJMACROS
00025 
00026 #include "windef.h"
00027 #include "winbase.h"
00028 #include "wingdi.h"
00029 #include "winuser.h"
00030 #include "ole2.h"
00031 #include "rpcproxy.h"
00032 #include "dimm.h"
00033 
00034 #include "wine/debug.h"
00035 
00036 WINE_DEFAULT_DEBUG_CHANNEL(msimtf);
00037 
00038 extern HRESULT ActiveIMMApp_Constructor(IUnknown *punkOuter, IUnknown **ppOut);
00039 
00040 static HINSTANCE msimtf_instance;
00041 
00042 /******************************************************************
00043  *              DllMain (msimtf.@)
00044  */
00045 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
00046 {
00047     switch(fdwReason)
00048     {
00049     case DLL_WINE_PREATTACH:
00050         return FALSE;  /* prefer native version */
00051     case DLL_PROCESS_ATTACH:
00052         msimtf_instance = hInstDLL;
00053         DisableThreadLibraryCalls(hInstDLL);
00054         break;
00055     case DLL_PROCESS_DETACH:
00056         break;
00057     }
00058     return TRUE;
00059 }
00060 
00061 typedef struct {
00062     IClassFactory IClassFactory_iface;
00063 
00064     HRESULT (*cf)(IUnknown*,IUnknown**);
00065 } ClassFactory;
00066 
00067 static inline ClassFactory *impl_from_IClassFactory(IClassFactory *iface)
00068 {
00069     return CONTAINING_RECORD(iface, ClassFactory, IClassFactory_iface);
00070 }
00071 
00072 static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface,
00073         REFIID riid, void **ppv)
00074 {
00075     *ppv = NULL;
00076 
00077     if(IsEqualGUID(&IID_IUnknown, riid)) {
00078         TRACE("(IID_IUnknown %p)\n", ppv);
00079         *ppv = iface;
00080     }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
00081         TRACE("IID_IClassFactory %p)\n", ppv);
00082         *ppv = iface;
00083     }
00084 
00085     if(*ppv) {
00086         IUnknown_AddRef((IUnknown*)*ppv);
00087         return S_OK;
00088     }
00089 
00090     FIXME("(%s %p)\n", debugstr_guid(riid), ppv);
00091     return E_NOINTERFACE;
00092 }
00093 
00094 static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface)
00095 {
00096     return 2;
00097 }
00098 
00099 static ULONG WINAPI ClassFactory_Release(IClassFactory *iface)
00100 {
00101     return 1;
00102 }
00103 
00104 static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface,
00105         IUnknown *pOuter, REFIID riid, void **ppv)
00106 {
00107     ClassFactory *This = impl_from_IClassFactory(iface);
00108     HRESULT ret;
00109     IUnknown *obj;
00110     TRACE("(%p, %p, %s, %p)\n", iface, pOuter, debugstr_guid(riid), ppv);
00111 
00112     ret = This->cf(pOuter, &obj);
00113     if (FAILED(ret))
00114         return ret;
00115 
00116     ret = IUnknown_QueryInterface(obj,riid,ppv);
00117     IUnknown_Release(obj);
00118     return ret;
00119 }
00120 
00121 static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock)
00122 {
00123     FIXME("(%d)\n", dolock);
00124     return S_OK;
00125 }
00126 
00127 static const IClassFactoryVtbl ClassFactoryVtbl = {
00128     ClassFactory_QueryInterface,
00129     ClassFactory_AddRef,
00130     ClassFactory_Release,
00131     ClassFactory_CreateInstance,
00132     ClassFactory_LockServer
00133 };
00134 
00135 /******************************************************************
00136  *      DllGetClassObject (msimtf.@)
00137  */
00138 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
00139 {
00140     if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) {
00141         static ClassFactory cf = {
00142             { &ClassFactoryVtbl },
00143             ActiveIMMApp_Constructor,
00144         };
00145 
00146         return IClassFactory_QueryInterface((IClassFactory*)&cf, riid, ppv);
00147     }
00148 
00149     FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
00150     return CLASS_E_CLASSNOTAVAILABLE;
00151 }
00152 
00153 /******************************************************************
00154  *              DllCanUnloadNow (msimtf.@)
00155  */
00156 HRESULT WINAPI DllCanUnloadNow(void)
00157 {
00158     return S_FALSE;
00159 }
00160 
00161 /***********************************************************************
00162  *          DllRegisterServer (msimtf.@)
00163  */
00164 HRESULT WINAPI DllRegisterServer(void)
00165 {
00166     return __wine_register_resources( msimtf_instance );
00167 }
00168 
00169 /***********************************************************************
00170  *          DllUnregisterServer (msimtf.@)
00171  */
00172 HRESULT WINAPI DllUnregisterServer(void)
00173 {
00174     return __wine_unregister_resources( msimtf_instance );
00175 }

Generated on Sun May 27 2012 04:16:43 for ReactOS by doxygen 1.7.6.1

ReactOS is a registered trademark or a trademark of ReactOS Foundation in the United States and other countries.