xref: /reactos/dll/win32/mstask/mstask_main.c (revision d5b576b2)
1 /*
2  * Copyright (C) 2008 Google (Roy Shea)
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 
19 #include <stdio.h>
20 
21 #include "mstask_private.h"
22 #include "objbase.h"
23 #include "rpcproxy.h"
24 
25 #include "wine/debug.h"
26 
27 
28 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
29 
30 static HINSTANCE hInst;
31 LONG dll_ref = 0;
32 
33 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
34 {
35     TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
36 
37     switch (fdwReason)
38     {
39         case DLL_WINE_PREATTACH:
40             return FALSE;
41         case DLL_PROCESS_ATTACH:
42             DisableThreadLibraryCalls(hinstDLL);
43             hInst = hinstDLL;
44             break;
45     }
46 
47     return TRUE;
48 }
49 
50 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
51 {
52     TRACE("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
53 
54     if (IsEqualGUID(rclsid, &CLSID_CTaskScheduler)) {
55         return IClassFactory_QueryInterface((LPCLASSFACTORY)&MSTASK_ClassFactory, iid, ppv);
56     }
57 
58     FIXME("Not supported class: %s\n", debugstr_guid(rclsid));
59     return CLASS_E_CLASSNOTAVAILABLE;
60 }
61 
62 HRESULT WINAPI DllCanUnloadNow(void)
63 {
64     return dll_ref != 0 ? S_FALSE : S_OK;
65 }
66 
67 HRESULT WINAPI DllRegisterServer(void)
68 {
69     return __wine_register_resources( hInst );
70 }
71 
72 HRESULT WINAPI DllUnregisterServer(void)
73 {
74     return __wine_unregister_resources( hInst );
75 }
76