2 * exported dll functions for comcat.dll
4 * Copyright (C) 2002 John K. Hohm
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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #include "wine/debug.h"
26 WINE_DEFAULT_DEBUG_CHANNEL(ole);
29 HINSTANCE COMCAT_hInstance = 0;
31 /***********************************************************************
32 * Global string constant definitions
34 const WCHAR clsid_keyname[6] = { 'C', 'L', 'S', 'I', 'D', 0 };
36 /***********************************************************************
37 * Registration entries
39 static const WCHAR class_keyname[39] = {
40 '{', '0', '0', '0', '2', 'E', '0', '0', '5', '-', '0', '0',
41 '0', '0', '-', '0', '0', '0', '0', '-', 'C', '0', '0', '0',
42 '-', '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '4',
44 static const WCHAR class_name[26] = {
45 'S', 't', 'd', 'C', 'o', 'm', 'p', 'o', 'n', 'e', 'n', 't',
46 'C', 'a', 't', 'e', 'g', 'o', 'r', 'i', 'e', 's', 'M', 'g',
48 static const WCHAR ips32_keyname[15] = {
49 'I', 'n', 'P', 'r', 'o', 'c', 'S', 'e', 'r', 'v', 'e', 'r',
51 static const WCHAR tm_valname[15] = {
52 'T', 'h', 'r', 'e', 'a', 'd', 'i', 'n', 'g', 'M', 'o', 'd',
54 static const WCHAR tm_value[5] = { 'B', 'o', 't', 'h', 0 };
55 static struct regsvr_entry regsvr_entries[6] = {
56 { (int)HKEY_CLASSES_ROOT, 0, clsid_keyname },
57 { 0, 1, class_keyname },
58 { 1, 1, NULL, class_name },
59 { 1, 1, ips32_keyname },
60 { 3, 1, NULL, /*dynamic, path to dll module*/ },
61 { 3, 1, tm_valname, tm_value }
64 /***********************************************************************
67 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID fImpLoad)
69 TRACE("%p 0x%lx %p\n", hinstDLL, fdwReason, fImpLoad);
72 case DLL_PROCESS_ATTACH:
73 COMCAT_hInstance = hinstDLL;
76 case DLL_PROCESS_DETACH:
83 /***********************************************************************
84 * DllGetClassObject (COMCAT.@)
86 HRESULT WINAPI COMCAT_DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
89 if (IsEqualGUID(rclsid, &CLSID_StdComponentCategoriesMgr)) {
90 return IClassFactory_QueryInterface((LPCLASSFACTORY)&COMCAT_ClassFactory, iid, ppv);
92 FIXME("\n\tCLSID:\t%s,\n\tIID:\t%s\n",debugstr_guid(rclsid),debugstr_guid(iid));
93 return CLASS_E_CLASSNOTAVAILABLE;
96 /***********************************************************************
97 * DllCanUnloadNow (COMCAT.@)
99 HRESULT WINAPI COMCAT_DllCanUnloadNow()
101 return dll_ref != 0 ? S_FALSE : S_OK;
104 /***********************************************************************
105 * DllRegisterServer (COMCAT.@)
107 HRESULT WINAPI COMCAT_DllRegisterServer()
109 WCHAR dll_module[MAX_PATH];
113 if (!GetModuleFileNameW(COMCAT_hInstance, dll_module,
114 sizeof dll_module / sizeof(WCHAR)))
115 return HRESULT_FROM_WIN32(GetLastError());
117 regsvr_entries[4].value = dll_module;
118 return regsvr_register(regsvr_entries, 6);
121 /***********************************************************************
122 * DllUnregisterServer (COMCAT.@)
124 HRESULT WINAPI COMCAT_DllUnregisterServer()
126 WCHAR dll_module[MAX_PATH];
130 if (!GetModuleFileNameW(COMCAT_hInstance, dll_module,
131 sizeof dll_module / sizeof(WCHAR)))
132 return HRESULT_FROM_WIN32(GetLastError());
134 regsvr_entries[4].value = dll_module;
135 return regsvr_unregister(regsvr_entries, 6);