po: Update French translation.
[wine] / dlls / scrrun / scrrun.c
1 /*
2  * Copyright 2011 Hans Leidekker for CodeWeavers
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Lesser General Public License for more details.
13  *
14  * You should have received a copy of the GNU Lesser General Public
15  * License along with this library; if not, write to the Free Software
16  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
17  */
18 #define COBJMACROS
19
20 #include "config.h"
21 #include <stdarg.h>
22
23 #include "windef.h"
24 #include "winbase.h"
25 #include "ole2.h"
26 #include "rpcproxy.h"
27
28 #include <initguid.h>
29 #include "scrrun.h"
30
31 #include "wine/debug.h"
32
33 WINE_DEFAULT_DEBUG_CHANNEL(scrrun);
34
35 static HINSTANCE scrrun_instance;
36
37 typedef HRESULT (*fnCreateInstance)(LPVOID *ppObj);
38
39 extern HRESULT WINAPI FileSystem_CreateInstance(IClassFactory*,IUnknown*,REFIID,void**) DECLSPEC_HIDDEN;
40
41 static HRESULT WINAPI scrruncf_QueryInterface(IClassFactory *iface, REFIID riid, LPVOID *ppv )
42 {
43     *ppv = NULL;
44
45     if(IsEqualGUID(&IID_IUnknown, riid)) {
46         TRACE("(%p)->(IID_IUnknown %p)\n", iface, ppv);
47         *ppv = iface;
48     }else if(IsEqualGUID(&IID_IClassFactory, riid)) {
49         TRACE("(%p)->(IID_IClassFactory %p)\n", iface, ppv);
50         *ppv = iface;
51     }
52
53     if(*ppv) {
54         IUnknown_AddRef((IUnknown*)*ppv);
55         return S_OK;
56     }
57
58     FIXME("(%p)->(%s %p)\n", iface, debugstr_guid(riid), ppv);
59     return E_NOINTERFACE;
60 }
61
62 static ULONG WINAPI scrruncf_AddRef(IClassFactory *iface )
63 {
64     TRACE("(%p)\n", iface);
65     return 2;
66 }
67
68 static ULONG WINAPI scrruncf_Release(IClassFactory *iface )
69 {
70     TRACE("(%p)\n", iface);
71     return 1;
72 }
73
74 static HRESULT WINAPI scrruncf_LockServer(IClassFactory *iface, BOOL fLock)
75 {
76     TRACE("(%p)->(%x)\n", iface, fLock);
77     return S_OK;
78 }
79
80 static const struct IClassFactoryVtbl scrruncf_vtbl =
81 {
82     scrruncf_QueryInterface,
83     scrruncf_AddRef,
84     scrruncf_Release,
85     FileSystem_CreateInstance,
86     scrruncf_LockServer
87 };
88
89 static IClassFactory FileSystemFactory = { &scrruncf_vtbl };
90
91 BOOL WINAPI DllMain( HINSTANCE hinst, DWORD reason, LPVOID reserved )
92 {
93     TRACE("%p, %u, %p\n", hinst, reason, reserved);
94
95     switch (reason)
96     {
97         case DLL_WINE_PREATTACH:
98             return FALSE;    /* prefer native version */
99         case DLL_PROCESS_ATTACH:
100             DisableThreadLibraryCalls( hinst );
101             scrrun_instance = hinst;
102             break;
103         case DLL_PROCESS_DETACH:
104             break;
105     }
106     return TRUE;
107 }
108
109 /***********************************************************************
110  *      DllRegisterServer (scrrun.@)
111  */
112 HRESULT WINAPI DllRegisterServer(void)
113 {
114     TRACE("()\n");
115     return __wine_register_resources(scrrun_instance);
116 }
117
118 /***********************************************************************
119  *      DllUnregisterServer (scrrun.@)
120  */
121 HRESULT WINAPI DllUnregisterServer(void)
122 {
123     TRACE("()\n");
124     return __wine_unregister_resources(scrrun_instance);
125 }
126
127 /***********************************************************************
128  *      DllGetClassObject (scrrun.@)
129  */
130
131 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
132 {
133     if(IsEqualGUID(&CLSID_FileSystemObject, rclsid)) {
134         TRACE("(CLSID_WshShell %s %p)\n", debugstr_guid(riid), ppv);
135         return IClassFactory_QueryInterface(&FileSystemFactory, riid, ppv);
136     }
137
138     FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv);
139     return CLASS_E_CLASSNOTAVAILABLE;
140 }
141
142 /***********************************************************************
143  *      DllCanUnloadNow (scrrun.@)
144  */
145 HRESULT WINAPI DllCanUnloadNow(void)
146 {
147     return S_FALSE;
148 }