taskmgr: Make some functions static.
[wine/multimedia.git] / dlls / infosoft / infosoft_main.c
blobe095ab48ce4bb6683e2bc371749fe37b5ab8e6a9
1 /*
2 * Word splitter Implementation
4 * Copyright 2006 Mike McCormack
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
21 #define COBJMACROS
23 #include "config.h"
25 #include <stdarg.h>
26 #include <stdio.h>
28 #include "windef.h"
29 #include "winbase.h"
30 #include "winuser.h"
31 #include "winreg.h"
32 #include "ole2.h"
33 #include "indexsrv.h"
34 #include "initguid.h"
36 #include "wine/debug.h"
38 WINE_DEFAULT_DEBUG_CHANNEL(infosoft);
40 DEFINE_GUID(CLSID_wb_Neutral,0x369647e0,0x17b0,0x11ce,0x99,0x50,0x00,0xaa,0x00,0x4b,0xbb,0x1f);
42 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
44 switch(fdwReason)
46 case DLL_WINE_PREATTACH:
47 return FALSE; /* prefer native version */
48 case DLL_PROCESS_ATTACH:
49 DisableThreadLibraryCalls(hInstDLL);
50 break;
51 case DLL_PROCESS_DETACH:
52 break;
54 return TRUE;
57 extern HRESULT WINAPI wb_Constructor(IUnknown*, REFIID, LPVOID *);
59 typedef HRESULT (CALLBACK *LPFNCREATEINSTANCE)(IUnknown*, REFIID, LPVOID*);
61 typedef struct
63 const IClassFactoryVtbl *lpVtbl;
64 LPFNCREATEINSTANCE lpfnCI;
65 } CFImpl;
67 static HRESULT WINAPI infosoftcf_fnQueryInterface ( LPCLASSFACTORY iface,
68 REFIID riid, LPVOID *ppvObj)
70 CFImpl *This = (CFImpl *)iface;
72 TRACE("(%p)->(%s)\n",This,debugstr_guid(riid));
74 *ppvObj = NULL;
76 if (IsEqualIID(riid, &IID_IUnknown) ||
77 IsEqualIID(riid, &IID_IClassFactory))
79 *ppvObj = This;
80 return S_OK;
83 TRACE("-- E_NOINTERFACE\n");
84 return E_NOINTERFACE;
87 static ULONG WINAPI infosoftcf_fnAddRef (LPCLASSFACTORY iface)
89 return 2;
92 static ULONG WINAPI infosoftcf_fnRelease(LPCLASSFACTORY iface)
94 return 1;
97 static HRESULT WINAPI infosoftcf_fnCreateInstance( LPCLASSFACTORY iface,
98 LPUNKNOWN pUnkOuter, REFIID riid, LPVOID *ppvObject)
100 CFImpl *This = (CFImpl *)iface;
102 TRACE("%p->(%p,%s,%p)\n", This, pUnkOuter, debugstr_guid(riid), ppvObject);
104 *ppvObject = NULL;
106 return This->lpfnCI(pUnkOuter, riid, ppvObject);
109 static HRESULT WINAPI infosoftcf_fnLockServer(LPCLASSFACTORY iface, BOOL fLock)
111 FIXME("%p %d\n", iface, fLock);
112 return E_NOTIMPL;
115 static const IClassFactoryVtbl infosoft_cfvt =
117 infosoftcf_fnQueryInterface,
118 infosoftcf_fnAddRef,
119 infosoftcf_fnRelease,
120 infosoftcf_fnCreateInstance,
121 infosoftcf_fnLockServer
124 static CFImpl wb_cf = { &infosoft_cfvt, wb_Constructor };
126 /***********************************************************************
127 * DllGetClassObject (INFOSOFT.@)
129 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
131 IClassFactory *pcf = NULL;
133 TRACE("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
135 if (!ppv)
136 return E_INVALIDARG;
137 *ppv = NULL;
139 if (IsEqualIID(rclsid, &CLSID_wb_Neutral))
140 pcf = (IClassFactory*) &wb_cf;
141 else
142 return CLASS_E_CLASSNOTAVAILABLE;
144 return IClassFactory_QueryInterface(pcf, iid, ppv);
148 HRESULT WINAPI DllCanUnloadNow(void)
150 FIXME("\n");
151 return S_FALSE;
154 static HRESULT add_key_val( LPCSTR key, LPCSTR valname, LPCSTR value )
156 HKEY hkey;
158 if (RegCreateKeyA( HKEY_CLASSES_ROOT, key, &hkey ) != ERROR_SUCCESS) return E_FAIL;
159 RegSetValueA( hkey, valname, REG_SZ, value, strlen( value ) + 1 );
160 RegCloseKey( hkey );
161 return S_OK;
164 static HRESULT add_wordbreaker_clsid( LPCSTR lang, const CLSID *id)
166 CHAR key[100], val[50];
168 strcpy(key, "CLSID\\");
169 sprintf(key+6, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}",
170 id->Data1, id->Data2, id->Data3,
171 id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
172 id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7]);
173 sprintf(val, "%s Word Breaker", lang);
174 add_key_val( key, NULL, val );
175 strcat(key, "\\InProcServer32");
176 add_key_val( key, NULL, "infosoft.dll" );
177 add_key_val( key, "ThreadingModel", "Both" );
178 return S_OK;
181 #define ADD_BREAKER(name) add_wordbreaker_clsid( #name, &CLSID_wb_##name )
183 static HRESULT add_content_index_keys(void)
185 ADD_BREAKER(Neutral); /* in query.dll on Windows */
186 return S_OK;
189 /***********************************************************************
190 * DllRegisterServer (INFOSOFT.@)
192 HRESULT WINAPI DllRegisterServer(void)
194 add_content_index_keys();
195 return S_OK;