oleaut32: VarCmp - Corrected function description.
[wine] / dlls / inseng / inseng_main.c
1 /*
2  *    INSENG Implementation
3  *
4  * Copyright 2006 Mike McCormack
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 #define COBJMACROS
22
23 #include "config.h"
24
25 #include <stdarg.h>
26
27 #include "windef.h"
28 #include "winbase.h"
29 #include "winuser.h"
30 #include "winreg.h"
31 #include "ole2.h"
32 #include "initguid.h"
33
34 #include "wine/debug.h"
35
36 WINE_DEFAULT_DEBUG_CHANNEL(inseng);
37
38 DEFINE_GUID(CLSID_DLManager, 0xBFC880F1,0x7484,0x11D0,0x83,0x09,0x00,0xAA,0x00,0xB6,0x01,0x5C);
39 DEFINE_GUID(CLSID_ActiveSetupEng, 0x6e449686,0xc509,0x11cf,0xaa,0xfa,0x00,0xaa,0x00,0xb6,0x01,0x5c );
40
41 BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv)
42 {
43     switch(fdwReason)
44     {
45     case DLL_WINE_PREATTACH:
46         return FALSE;  /* prefer native version */
47     case DLL_PROCESS_ATTACH:
48         DisableThreadLibraryCalls(hInstDLL);
49         break;
50     case DLL_PROCESS_DETACH:
51         break;
52     }
53     return TRUE;
54 }
55
56 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
57 {
58     FIXME("%s %s %p\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
59
60     return CLASS_E_CLASSNOTAVAILABLE;
61 }
62
63 HRESULT WINAPI DllCanUnloadNow(void)
64 {
65     FIXME("\n");
66     return S_FALSE;
67 }
68
69 static HRESULT register_clsid(LPCGUID guid)
70 {
71     static const WCHAR clsid[] =
72         {'C','L','S','I','D','\\',0};
73     static const WCHAR ips[] =
74         {'\\','I','n','p','r','o','c','S','e','r','v','e','r','3','2',0};
75     static const WCHAR inseng[] =
76         {'i','n','s','e','n','g','.','d','l','l',0};
77     static const WCHAR threading_model[] =
78         {'T','h','r','e','a','d','i','n','g','M','o','d','e','l',0};
79     static const WCHAR apartment[] =
80         {'A','p','a','r','t','m','e','n','t',0};
81     WCHAR path[80];
82     HKEY key = NULL;
83     LONG r;
84
85     lstrcpyW(path, clsid);
86     StringFromGUID2(guid, &path[6], 80);
87     lstrcatW(path, ips);
88     r = RegCreateKeyW(HKEY_CLASSES_ROOT, path, &key);
89     if (r != ERROR_SUCCESS)
90         return E_FAIL;
91
92     RegSetValueExW(key, NULL, 0, REG_SZ, (LPBYTE)inseng, sizeof inseng);
93     RegSetValueExW(key, threading_model, 0, REG_SZ, (LPBYTE)apartment, sizeof apartment);
94     RegCloseKey(key);
95
96     return S_OK;
97 }
98
99 HRESULT WINAPI DllRegisterServer(void)
100 {
101     HRESULT r;
102
103     r = register_clsid(&CLSID_ActiveSetupEng);
104     if (SUCCEEDED(r))
105         r = register_clsid(&CLSID_DLManager);
106
107     return r;
108 }
109
110 BOOL WINAPI CheckTrustEx( LPVOID a, LPVOID b, LPVOID c, LPVOID d, LPVOID e )
111 {
112     FIXME("%p %p %p %p %p\n", a, b, c, d, e );
113     return TRUE;
114 }