~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

Wine Cross Reference
wine/dlls/msi/msi_main.c

Version: ~ [ wine-1.5.30 ] ~ [ wine-1.5.29 ] ~ [ wine-1.5.28 ] ~ [ wine-1.5.27 ] ~ [ wine-1.5.26 ] ~ [ wine-1.5.25 ] ~ [ wine-1.5.24 ] ~ [ wine-1.5.23 ] ~ [ wine-1.5.22 ] ~ [ wine-1.5.21 ] ~ [ wine-1.5.20 ] ~ [ wine-1.5.19 ] ~ [ wine-1.5.18 ] ~ [ wine-1.5.17 ] ~ [ wine-1.5.16 ] ~ [ wine-1.5.15 ] ~ [ wine-1.5.14 ] ~ [ wine-1.5.13 ] ~ [ wine-1.5.12 ] ~ [ wine-1.5.11 ] ~ [ wine-1.5.10 ] ~ [ wine-1.5.9 ] ~ [ wine-1.5.8 ] ~ [ wine-1.5.7 ] ~ [ wine-1.4.1 ] ~ [ wine-1.5.6 ] ~ [ wine-1.5.5 ] ~ [ wine-1.5.4 ] ~ [ wine-1.5.3 ] ~ [ wine-1.5.2 ] ~ [ wine-1.5.1 ] ~ [ wine-1.5.0 ] ~ [ wine-1.4 ] ~ [ wine-1.4-rc6 ] ~ [ wine-1.4-rc5 ] ~ [ wine-1.4-rc4 ] ~ [ wine-1.4-rc3 ] ~ [ wine-1.4-rc2 ] ~ [ wine-1.4-rc1 ] ~ [ wine-1.3.37 ] ~ [ wine-1.3.36 ] ~ [ wine-1.3.35 ] ~ [ wine-1.3.34 ] ~ [ wine-1.3.33 ] ~ [ wine-1.3.32 ] ~ [ wine-1.3.31 ] ~ [ wine-1.3.30 ] ~ [ wine-1.3.29 ] ~ [ wine-1.3.28 ] ~ [ wine-1.3.27 ] ~ [ wine-1.3.26 ] ~ [ wine-1.3.25 ] ~ [ wine-1.3.24 ] ~ [ wine-1.3.23 ] ~ [ wine-1.3.22 ] ~ [ wine-1.3.21 ] ~ [ wine-1.3.20 ] ~ [ wine-1.3.19 ] ~ [ wine-1.3.18 ] ~ [ wine-1.2.3 ] ~ [ wine-1.3.17 ] ~ [ wine-1.3.16 ] ~ [ wine-1.3.15 ] ~ [ wine-1.3.14 ] ~ [ wine-1.3.13 ] ~ [ wine-1.3.12 ] ~ [ wine-1.3.11 ] ~ [ wine-1.3.10 ] ~ [ wine-1.3.9 ] ~ [ wine-1.2.2 ] ~ [ wine-1.3.8 ] ~ [ wine-1.3.7 ] ~ [ wine-1.3.6 ] ~ [ wine-1.3.5 ] ~ [ wine-1.2.1 ] ~ [ wine-1.3.4 ] ~ [ wine-1.3.3 ] ~ [ wine-1.3.2 ] ~ [ wine-1.3.1 ] ~ [ wine-1.3.0 ] ~ [ wine-1.2 ] ~ [ wine-1.2-rc7 ] ~ [ wine-1.2-rc6 ] ~ [ wine-1.2-rc5 ] ~ [ wine-1.2-rc4 ] ~ [ wine-1.2-rc3 ] ~ [ wine-1.2-rc2 ] ~ [ wine-1.2-rc1 ] ~ [ wine-1.1.44 ] ~ [ wine-1.1.43 ] ~ [ wine-1.1.42 ] ~ [ wine-1.1.41 ] ~ [ wine-1.1.40 ] ~ [ wine-1.1.39 ] ~ [ wine-1.1.38 ] ~ [ wine-1.1.37 ] ~ [ wine-1.1.36 ] ~ [ wine-1.1.35 ] ~ [ wine-1.1.34 ] ~ [ wine-1.1.33 ] ~ [ wine-1.1.32 ] ~ [ wine-1.1.31 ] ~ [ wine-1.1.30 ] ~ [ wine-1.1.29 ] ~ [ wine-1.1.28 ] ~ [ wine-1.1.27 ] ~ [ wine-1.1.26 ] ~ [ wine-1.1.25 ] ~ [ wine-1.1.24 ] ~ [ wine-1.1.23 ] ~ [ wine-1.1.22 ] ~ [ wine-1.1.21 ] ~ [ wine-1.1.20 ] ~ [ wine-1.1.19 ] ~ [ wine-1.1.18 ] ~ [ wine-1.1.17 ] ~ [ wine-1.1.16 ] ~ [ wine-1.1.15 ] ~ [ wine-1.1.14 ] ~ [ wine-1.1.13 ] ~ [ wine-1.1.12 ] ~ [ wine-1.1.11 ] ~ [ wine-1.1.10 ] ~ [ wine-1.1.9 ] ~ [ wine-1.1.8 ] ~ [ wine-1.1.7 ] ~ [ wine-1.0.1 ] ~ [ wine-1.1.6 ] ~ [ wine-1.1.5 ] ~ [ wine-1.1.4 ] ~ [ wine-1.1.3 ] ~ [ wine-1.1.2 ] ~ [ wine-1.1.1 ] ~ [ wine-1.1.0 ] ~ [ wine-1.0 ] ~

  1 /*
  2  * Implementation of the Microsoft Installer (msi.dll)
  3  *
  4  * Copyright 2006 Mike McCormack for CodeWeavers
  5  *
  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.
 10  *
 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.
 15  *
 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
 19  */
 20 
 21 #include <stdarg.h>
 22 
 23 #define COBJMACROS
 24 #define NONAMELESSUNION
 25 
 26 #include "windef.h"
 27 #include "winbase.h"
 28 #include "winreg.h"
 29 #include "shlwapi.h"
 30 #include "oleauto.h"
 31 #include "rpcproxy.h"
 32 #include "msipriv.h"
 33 #include "msiserver.h"
 34 
 35 #include "wine/debug.h"
 36 
 37 WINE_DEFAULT_DEBUG_CHANNEL(msi);
 38 
 39 static LONG dll_count;
 40 
 41 /* the UI level */
 42 INSTALLUILEVEL           gUILevel         = INSTALLUILEVEL_BASIC;
 43 HWND                     gUIhwnd          = 0;
 44 INSTALLUI_HANDLERA       gUIHandlerA      = NULL;
 45 INSTALLUI_HANDLERW       gUIHandlerW      = NULL;
 46 INSTALLUI_HANDLER_RECORD gUIHandlerRecord = NULL;
 47 DWORD                    gUIFilter        = 0;
 48 LPVOID                   gUIContext       = NULL;
 49 WCHAR                   *gszLogFile       = NULL;
 50 HINSTANCE msi_hInstance;
 51 
 52 
 53 /*
 54  * Dll lifetime tracking declaration
 55  */
 56 static void LockModule(void)
 57 {
 58     InterlockedIncrement(&dll_count);
 59 }
 60 
 61 static void UnlockModule(void)
 62 {
 63     InterlockedDecrement(&dll_count);
 64 }
 65 
 66 /******************************************************************
 67  *      DllMain
 68  */
 69 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
 70 {
 71     switch (fdwReason)
 72     {
 73     case DLL_PROCESS_ATTACH:
 74         msi_hInstance = hinstDLL;
 75         DisableThreadLibraryCalls(hinstDLL);
 76         break;
 77     case DLL_PROCESS_DETACH:
 78         msi_dialog_unregister_class();
 79         msi_free_handle_table();
 80         msi_free( gszLogFile );
 81         break;
 82     }
 83     return TRUE;
 84 }
 85 
 86 typedef struct tagIClassFactoryImpl {
 87     IClassFactory IClassFactory_iface;
 88     HRESULT (*create_object)( IUnknown*, LPVOID* );
 89 } IClassFactoryImpl;
 90 
 91 static inline IClassFactoryImpl *impl_from_IClassFactory(IClassFactory *iface)
 92 {
 93     return CONTAINING_RECORD(iface, IClassFactoryImpl, IClassFactory_iface);
 94 }
 95 
 96 static HRESULT WINAPI MsiCF_QueryInterface(LPCLASSFACTORY iface,
 97                 REFIID riid,LPVOID *ppobj)
 98 {
 99     IClassFactoryImpl *This = impl_from_IClassFactory(iface);
100 
101     TRACE("%p %s %p\n",This,debugstr_guid(riid),ppobj);
102 
103     if( IsEqualCLSID( riid, &IID_IUnknown ) ||
104         IsEqualCLSID( riid, &IID_IClassFactory ) )
105     {
106         IClassFactory_AddRef( iface );
107         *ppobj = iface;
108         return S_OK;
109     }
110     return E_NOINTERFACE;
111 }
112 
113 static ULONG WINAPI MsiCF_AddRef(LPCLASSFACTORY iface)
114 {
115     LockModule();
116     return 2;
117 }
118 
119 static ULONG WINAPI MsiCF_Release(LPCLASSFACTORY iface)
120 {
121     UnlockModule();
122     return 1;
123 }
124 
125 static HRESULT WINAPI MsiCF_CreateInstance(LPCLASSFACTORY iface,
126     LPUNKNOWN pOuter, REFIID riid, LPVOID *ppobj)
127 {
128     IClassFactoryImpl *This = impl_from_IClassFactory(iface);
129     IUnknown *unk = NULL;
130     HRESULT r;
131 
132     TRACE("%p %p %s %p\n", This, pOuter, debugstr_guid(riid), ppobj);
133 
134     r = This->create_object( pOuter, (LPVOID*) &unk );
135     if (SUCCEEDED(r))
136     {
137         r = IUnknown_QueryInterface( unk, riid, ppobj );
138         IUnknown_Release( unk );
139     }
140     return r;
141 }
142 
143 static HRESULT WINAPI MsiCF_LockServer(LPCLASSFACTORY iface, BOOL dolock)
144 {
145     TRACE("%p %d\n", iface, dolock);
146 
147     if (dolock)
148         LockModule();
149     else
150         UnlockModule();
151 
152     return S_OK;
153 }
154 
155 static const IClassFactoryVtbl MsiCF_Vtbl =
156 {
157     MsiCF_QueryInterface,
158     MsiCF_AddRef,
159     MsiCF_Release,
160     MsiCF_CreateInstance,
161     MsiCF_LockServer
162 };
163 
164 static IClassFactoryImpl MsiServer_CF = { { &MsiCF_Vtbl }, create_msiserver };
165 static IClassFactoryImpl WineMsiCustomRemote_CF = { { &MsiCF_Vtbl }, create_msi_custom_remote };
166 static IClassFactoryImpl WineMsiRemotePackage_CF = { { &MsiCF_Vtbl }, create_msi_remote_package };
167 
168 /******************************************************************
169  * DllGetClassObject          [MSI.@]
170  */
171 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv)
172 {
173     TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
174 
175     if ( IsEqualCLSID (rclsid, &CLSID_MsiInstaller) )
176     {
177         *ppv = &MsiServer_CF;
178         return S_OK;
179     }
180 
181     if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemoteCustomAction) )
182     {
183         *ppv = &WineMsiCustomRemote_CF;
184         return S_OK;
185     }
186 
187     if ( IsEqualCLSID (rclsid, &CLSID_WineMsiRemotePackage) )
188     {
189         *ppv = &WineMsiRemotePackage_CF;
190         return S_OK;
191     }
192 
193     if( IsEqualCLSID (rclsid, &CLSID_MsiServerMessage) ||
194         IsEqualCLSID (rclsid, &CLSID_MsiServer) ||
195         IsEqualCLSID (rclsid, &CLSID_PSFactoryBuffer) ||
196         IsEqualCLSID (rclsid, &CLSID_MsiServerX3) )
197     {
198         FIXME("create %s object\n", debugstr_guid( rclsid ));
199     }
200 
201     return CLASS_E_CLASSNOTAVAILABLE;
202 }
203 
204 /******************************************************************
205  * DllGetVersion              [MSI.@]
206  */
207 HRESULT WINAPI DllGetVersion(DLLVERSIONINFO *pdvi)
208 {
209     TRACE("%p\n",pdvi);
210 
211     if (pdvi->cbSize < sizeof(DLLVERSIONINFO))
212         return E_INVALIDARG;
213 
214     pdvi->dwMajorVersion = MSI_MAJORVERSION;
215     pdvi->dwMinorVersion = MSI_MINORVERSION;
216     pdvi->dwBuildNumber = MSI_BUILDNUMBER;
217     pdvi->dwPlatformID = DLLVER_PLATFORM_WINDOWS;
218 
219     return S_OK;
220 }
221 
222 /******************************************************************
223  * DllCanUnloadNow            [MSI.@]
224  */
225 HRESULT WINAPI DllCanUnloadNow(void)
226 {
227     return dll_count == 0 ? S_OK : S_FALSE;
228 }
229 
230 /***********************************************************************
231  *  DllRegisterServer (MSI.@)
232  */
233 HRESULT WINAPI DllRegisterServer(void)
234 {
235     return __wine_register_resources( msi_hInstance );
236 }
237 
238 /***********************************************************************
239  *  DllUnregisterServer (MSI.@)
240  */
241 HRESULT WINAPI DllUnregisterServer(void)
242 {
243     return __wine_unregister_resources( msi_hInstance );
244 }
245 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~ [ freetext search ] ~ [ file search ] ~

This page was automatically generated by the LXR engine.
Visit the LXR main site for more information.