ReactOS  0.4.14-dev-297-g23e575c
schedule.c
Go to the documentation of this file.
1 /*
2  * COPYRIGHT: See COPYING in the top level directory
3  * PROJECT: NetAPI DLL
4  * FILE: reactos/dll/win32/netapi32/schedule.c
5  * PURPOSE: Scheduler service interface code
6  *
7  * PROGRAMMERS: Eric Kohl
8  */
9 
10 /* INCLUDES ******************************************************************/
11 
12 #include "netapi32.h"
13 #include "atsvc_c.h"
14 
16 
17 /* FUNCTIONS *****************************************************************/
18 
21 {
23  LPWSTR pszStringBinding;
25 
26  TRACE("ATSVC_HANDLE_bind() called\n");
27 
29  L"ncacn_np",
30  (RPC_WSTR)pszSystemName,
31  L"\\pipe\\atsvc",
32  NULL,
33  &pszStringBinding);
34  if (status)
35  {
36  TRACE("RpcStringBindingCompose returned 0x%x\n", status);
37  return NULL;
38  }
39 
40  /* Set the binding handle that will be used to bind to the server. */
41  status = RpcBindingFromStringBindingW(pszStringBinding,
42  &hBinding);
43  if (status)
44  {
45  TRACE("RpcBindingFromStringBinding returned 0x%x\n", status);
46  }
47 
48  status = RpcStringFreeW(&pszStringBinding);
49  if (status)
50  {
51 // TRACE("RpcStringFree returned 0x%x\n", status);
52  }
53 
54  return hBinding;
55 }
56 
57 
58 void __RPC_USER
61 {
63 
64  TRACE("ATSVC_HANDLE_unbind() called\n");
65 
67  if (status)
68  {
69  TRACE("RpcBindingFree returned 0x%x\n", status);
70  }
71 }
72 
73 
75 WINAPI
77  LPCWSTR ServerName,
78  LPBYTE Buffer,
79  LPDWORD JobId)
80 {
82 
83  TRACE("NetScheduleJobAdd(%s, %p, %p)\n", debugstr_w(ServerName),
84  Buffer, JobId);
85 
87  {
88  status = NetrJobAdd(ServerName,
90  JobId);
91  }
93  {
95  }
97 
98  return status;
99 }
100 
101 
103 WINAPI
105  LPCWSTR ServerName,
106  DWORD MinJobId,
107  DWORD MaxJobId)
108 {
110 
111  TRACE("NetScheduleJobDel(%s, %d, %d)\n", debugstr_w(ServerName),
112  MinJobId, MaxJobId);
113 
115  {
116  status = NetrJobDel(ServerName,
117  MinJobId,
118  MaxJobId);
119  }
121  {
123  }
124  RpcEndExcept;
125 
126  return status;
127 }
128 
129 
131 WINAPI
133  LPCWSTR ServerName,
134  LPBYTE *PointerToBuffer,
135  DWORD PreferredMaximumLength,
136  LPDWORD EntriesRead,
137  LPDWORD TotalEntries,
138  LPDWORD ResumeHandle)
139 {
140  AT_ENUM_CONTAINER EnumContainer;
142 
143  TRACE("NetScheduleJobEnum(%s, %p, %d, %p, %p, %p)\n", debugstr_w(ServerName),
144  PointerToBuffer, PreferredMaximumLength, EntriesRead, TotalEntries, ResumeHandle);
145 
146  EnumContainer.EntriesRead = 0;
147  EnumContainer.Buffer = NULL;
148 
150  {
151  status = NetrJobEnum(ServerName,
152  &EnumContainer,
153  PreferredMaximumLength,
154  TotalEntries,
155  ResumeHandle);
157  {
158  *PointerToBuffer = (LPBYTE)EnumContainer.Buffer;
159  *EntriesRead = EnumContainer.EntriesRead;
160  }
161  }
163  {
165  }
166  RpcEndExcept;
167 
168  return status;
169 }
170 
171 
173 WINAPI
175  LPCWSTR ServerName,
176  DWORD JobId,
177  LPBYTE *PointerToBuffer)
178 {
180 
181  TRACE("NetScheduleJobGetInfo(%s, %d, %p)\n", debugstr_w(ServerName),
182  JobId, PointerToBuffer);
183 
185  {
186  status = NetrJobGetInfo(ServerName,
187  JobId,
188  (LPAT_INFO *)PointerToBuffer);
189  }
191  {
193  }
194  RpcEndExcept;
195 
196  return status;
197 }
198 
199 /* EOF */
RPC_STATUS WINAPI RpcBindingFromStringBindingW(RPC_WSTR StringBinding, RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:877
NET_API_STATUS WINAPI NetScheduleJobDel(LPCWSTR ServerName, DWORD MinJobId, DWORD MaxJobId)
Definition: schedule.c:104
#define RpcEndExcept
Definition: rpc.h:128
RPC_STATUS WINAPI RpcBindingFree(RPC_BINDING_HANDLE *Binding)
Definition: rpc_binding.c:784
const WCHAR * LPCWSTR
Definition: xmlstorage.h:185
handle_t hBinding
Definition: ctx_c.c:54
RPC_STATUS WINAPI RpcStringFreeW(RPC_WSTR *String)
Definition: rpcrt4_main.c:177
const wchar_t * ATSVC_HANDLE
Definition: atsvc.idl:7
NET_API_STATUS WINAPI NetScheduleJobAdd(LPCWSTR ServerName, LPBYTE Buffer, LPDWORD JobId)
Definition: schedule.c:76
unsigned short * RPC_WSTR
Definition: rpcdce.h:46
RPC_STATUS WINAPI RpcStringBindingComposeW(RPC_WSTR ObjUuid, RPC_WSTR Protseq, RPC_WSTR NetworkAddr, RPC_WSTR Endpoint, RPC_WSTR Options, RPC_WSTR *StringBinding)
Definition: rpc_binding.c:511
void __RPC_USER ATSVC_HANDLE_unbind(ATSVC_HANDLE pszSystemName, handle_t hBinding)
Definition: schedule.c:59
#define NERR_Success
Definition: lmerr.h:5
NET_API_STATUS WINAPI NetrJobDel(ATSVC_HANDLE ServerName, DWORD MinJobId, DWORD MaxJobId)
Definition: rpcserver.c:147
long RPC_STATUS
Definition: rpc.h:52
unsigned char * LPBYTE
Definition: typedefs.h:52
#define debugstr_w
Definition: kernel32.h:32
#define RpcTryExcept
Definition: rpc.h:126
#define EXCEPTION_EXECUTE_HANDLER
Definition: excpt.h:85
smooth NULL
Definition: ftsmooth.c:416
Definition: bufpool.h:45
WINE_DEFAULT_DEBUG_CHANNEL(netapi32)
#define __RPC_USER
Definition: rpc.h:65
NET_API_STATUS WINAPI NetrJobAdd(ATSVC_HANDLE ServerName, LPAT_INFO pAtInfo, LPDWORD pJobId)
Definition: rpcserver.c:84
NET_API_STATUS WINAPI NetScheduleJobGetInfo(LPCWSTR ServerName, DWORD JobId, LPBYTE *PointerToBuffer)
Definition: schedule.c:174
DWORD NET_API_STATUS
Definition: ms-dtyp.idl:91
#define RpcExceptionCode()
Definition: rpc.h:132
#define TRACE(s)
Definition: solgame.cpp:4
NET_API_STATUS WINAPI NetScheduleJobEnum(LPCWSTR ServerName, LPBYTE *PointerToBuffer, DWORD PreferredMaximumLength, LPDWORD EntriesRead, LPDWORD TotalEntries, LPDWORD ResumeHandle)
Definition: schedule.c:132
Definition: lmat.h:22
#define WINAPI
Definition: msvc.h:8
unsigned long DWORD
Definition: ntddk_ex.h:95
static const WCHAR L[]
Definition: oid.c:1250
handle_t __RPC_USER ATSVC_HANDLE_bind(ATSVC_HANDLE pszSystemName)
Definition: schedule.c:20
NET_API_STATUS WINAPI NetrJobGetInfo(ATSVC_HANDLE ServerName, DWORD JobId, LPAT_INFO *ppAtInfo)
Definition: rpcserver.c:339
#define ERROR_MORE_DATA
Definition: dderror.h:13
NET_API_STATUS __stdcall NetrJobEnum(ATSVC_HANDLE ServerName, LPAT_ENUM_CONTAINER pEnumContainer, DWORD PreferedMaximumLength, LPDWORD pTotalEntries, LPDWORD pResumeHandle)
Definition: rpcserver.c:208
DWORD EntriesRead
Definition: atsvc.idl:30
uint32_t * LPDWORD
Definition: typedefs.h:57
WCHAR * LPWSTR
Definition: xmlstorage.h:184
static SERVICE_STATUS status
Definition: service.c:31
#define RpcExcept(expr)
Definition: rpc.h:127
LPAT_ENUM Buffer
Definition: atsvc.idl:31
LONG WINAPI I_RpcMapWin32Status(RPC_STATUS status)
Definition: rpcrt4_main.c:741
Definition: ps.c:97