mstask: Add stdcall to cdecl thunks for AT Service RPC API.
[wine.git] / dlls / mstask / mstask_main.c
blobe747af69e8db9c9c49c6664d2bf7d7a620cd6314
1 /*
2 * Copyright (C) 2008 Google (Roy Shea)
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.
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.
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
19 #include <stdarg.h>
21 #define COBJMACROS
23 #include "windef.h"
24 #include "winbase.h"
25 #include "objbase.h"
26 #include "rpcproxy.h"
27 #include "taskschd.h"
28 #include "mstask.h"
29 #include "mstask_private.h"
30 #include "atsvc.h"
31 #include "wine/debug.h"
33 WINE_DEFAULT_DEBUG_CHANNEL(mstask);
35 static HINSTANCE hInst;
36 LONG dll_ref = 0;
38 BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
40 TRACE("(%p, %d, %p)\n", hinstDLL, fdwReason, lpvReserved);
42 switch (fdwReason)
44 case DLL_WINE_PREATTACH:
45 return FALSE;
46 case DLL_PROCESS_ATTACH:
47 DisableThreadLibraryCalls(hinstDLL);
48 hInst = hinstDLL;
49 break;
52 return TRUE;
55 HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID iid, LPVOID *ppv)
57 TRACE("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(iid), ppv);
59 if (IsEqualGUID(rclsid, &CLSID_CTaskScheduler)) {
60 return IClassFactory_QueryInterface((LPCLASSFACTORY)&MSTASK_ClassFactory, iid, ppv);
63 FIXME("Not supported class: %s\n", debugstr_guid(rclsid));
64 return CLASS_E_CLASSNOTAVAILABLE;
67 HRESULT WINAPI DllCanUnloadNow(void)
69 return dll_ref != 0 ? S_FALSE : S_OK;
72 HRESULT WINAPI DllRegisterServer(void)
74 return __wine_register_resources( hInst );
77 HRESULT WINAPI DllUnregisterServer(void)
79 return __wine_unregister_resources( hInst );
82 DWORD WINAPI NetrJobAdd_wrapper(ATSVC_HANDLE server_name, LPAT_INFO info, LPDWORD jobid)
84 return NetrJobAdd(server_name, info, jobid);
87 DWORD WINAPI NetrJobDel_wrapper(ATSVC_HANDLE server_name, DWORD min_jobid, DWORD max_jobid)
89 return NetrJobDel(server_name, min_jobid, max_jobid);
92 DWORD WINAPI NetrJobEnum_wrapper(ATSVC_HANDLE server_name, LPAT_ENUM_CONTAINER container,
93 DWORD max_length, LPDWORD total, LPDWORD resume)
95 return NetrJobEnum(server_name, container, max_length, total, resume);
98 DWORD WINAPI NetrJobGetInfo_wrapper(ATSVC_HANDLE server_name, DWORD jobid, LPAT_INFO *info)
100 return NetrJobGetInfo(server_name, jobid, info);
103 DECLSPEC_HIDDEN void __RPC_FAR *__RPC_USER MIDL_user_allocate(SIZE_T n)
105 return HeapAlloc(GetProcessHeap(), 0, n);
108 DECLSPEC_HIDDEN void __RPC_USER MIDL_user_free(void __RPC_FAR *p)
110 HeapFree(GetProcessHeap(), 0, p);
113 DECLSPEC_HIDDEN handle_t __RPC_USER ATSVC_HANDLE_bind(ATSVC_HANDLE str)
115 static unsigned char ncalrpc[] = "ncalrpc";
116 unsigned char *binding_str;
117 handle_t rpc_handle = 0;
119 if (RpcStringBindingComposeA(NULL, ncalrpc, NULL, NULL, NULL, &binding_str) == RPC_S_OK)
121 RpcBindingFromStringBindingA(binding_str, &rpc_handle);
122 RpcStringFreeA(&binding_str);
124 return rpc_handle;
127 DECLSPEC_HIDDEN void __RPC_USER ATSVC_HANDLE_unbind(ATSVC_HANDLE ServerName, handle_t rpc_handle)
129 RpcBindingFree(&rpc_handle);