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