Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

302 lines
6.7 KiB

  1. /*++
  2. Copyright (c) 1992 Microsoft Corporation
  3. Module Name:
  4. atstub.c
  5. Abstract:
  6. Client stubs of the Schedule service APIs.
  7. Author:
  8. Vladimir Z. Vulovic (vladimv) 06 - November - 1992
  9. Environment:
  10. User Mode - Win32
  11. Revision History:
  12. 06-Nov-1992 vladimv
  13. Created
  14. --*/
  15. #include "atclient.h"
  16. #undef IF_DEBUG // avoid wsclient.h vs. debuglib.h conflicts.
  17. #include <debuglib.h> // IF_DEBUG() (needed by netrpc.h).
  18. #include <lmserver.h>
  19. #include <lmsvc.h>
  20. #include <netlib.h> // NetpServiceIsStarted() (needed by netrpc.h).
  21. #include <netrpc.h> // NET_REMOTE macros.
  22. #include <lmstats.h>
  23. NET_API_STATUS
  24. NetScheduleJobAdd(
  25. IN LPCWSTR ServerName OPTIONAL,
  26. IN LPBYTE Buffer,
  27. OUT LPDWORD pJobId
  28. )
  29. /*++
  30. Routine Description:
  31. This is the DLL entrypoint for NetScheduleJobAdd. This API adds a job
  32. to the schedule.
  33. Arguments:
  34. ServerName - Pointer to a string containing the name of the computer
  35. that is to execute the API function.
  36. Buffer - Pointer to a buffer containing information about the job
  37. pJobId - Pointer to JobId of a newly added job.
  38. Return Value:
  39. NET_API_STATUS
  40. --*/
  41. {
  42. NET_API_STATUS status;
  43. NET_REMOTE_TRY_RPC
  44. //
  45. // Try RPC (local or remote) version of API.
  46. //
  47. status = NetrJobAdd(
  48. ServerName,
  49. (LPAT_INFO)Buffer,
  50. pJobId
  51. );
  52. NET_REMOTE_RPC_FAILED(
  53. "NetScheduleJobAdd",
  54. ServerName,
  55. status,
  56. NET_REMOTE_FLAG_NORMAL,
  57. SERVICE_SCHEDULE
  58. )
  59. status = ERROR_NOT_SUPPORTED;
  60. NET_REMOTE_END
  61. return( status);
  62. } // NetScheduleJobAdd
  63. NET_API_STATUS
  64. NetScheduleJobDel(
  65. IN LPCWSTR ServerName OPTIONAL,
  66. IN DWORD MinJobId,
  67. IN DWORD MaxJobId
  68. )
  69. /*++
  70. Routine Description:
  71. This is the DLL entrypoint for NetScheduleJobDel. This API removes
  72. from the schedule all jobs whose job ids are:
  73. - greater than or equal to the minimum job id
  74. and
  75. - less than or equal to the maximum job id
  76. Arguments:
  77. ServerName - Pointer to a string containing the name of the computer
  78. that is to execute the API function.
  79. MinJobId - minumum job id
  80. MaxJobId - maxumum job id
  81. Return Value:
  82. NET_API_STATUS
  83. --*/
  84. {
  85. NET_API_STATUS status;
  86. NET_REMOTE_TRY_RPC
  87. //
  88. // Try RPC (local or remote) version of API.
  89. //
  90. status = NetrJobDel(
  91. ServerName,
  92. MinJobId,
  93. MaxJobId
  94. );
  95. NET_REMOTE_RPC_FAILED(
  96. "NetScheduleJobDel",
  97. ServerName,
  98. status,
  99. NET_REMOTE_FLAG_NORMAL,
  100. SERVICE_SCHEDULE
  101. )
  102. status = ERROR_NOT_SUPPORTED;
  103. NET_REMOTE_END
  104. return( status);
  105. } // NetScheduleJobDel
  106. NET_API_STATUS
  107. NetScheduleJobEnum(
  108. IN LPCWSTR ServerName OPTIONAL,
  109. OUT LPBYTE * PointerToBuffer,
  110. IN DWORD PreferredMaximumLength,
  111. OUT LPDWORD EntriesRead,
  112. OUT LPDWORD TotalEntries,
  113. IN OUT LPDWORD ResumeHandle
  114. )
  115. /*++
  116. Routine Description:
  117. This is the DLL entrypoint for NetScheduleJobEnum. This API enumarates
  118. all jobs in the schedule.
  119. Arguments:
  120. ServerName - Pointer to a string containing the name of the computer
  121. that is to execute the API function.
  122. PointerToBuffer - Pointer to location where pointer to returned data will
  123. be stored
  124. PreferredMaximumLength - Indicates a maximum size limit that the caller
  125. will allow for the return buffer.
  126. EntriesRead - A pointer to the location where the number of entries
  127. (data structures)read is to be returned.
  128. TotalEntries - A pointer to the location which upon return indicates
  129. the total number of entries in the table.
  130. ResumeHandle - Pointer to a value that indicates where to resume
  131. enumerating data.
  132. Return Value:
  133. NET_API_STATUS
  134. --*/
  135. {
  136. NET_API_STATUS status;
  137. AT_ENUM_CONTAINER EnumContainer;
  138. EnumContainer.EntriesRead = 0;
  139. EnumContainer.Buffer = NULL;
  140. NET_REMOTE_TRY_RPC
  141. //
  142. // Try RPC (local or remote) version of API.
  143. //
  144. status = NetrJobEnum(
  145. ServerName,
  146. &EnumContainer,
  147. PreferredMaximumLength,
  148. TotalEntries,
  149. ResumeHandle
  150. );
  151. if ( status == NERR_Success || status == ERROR_MORE_DATA) {
  152. *EntriesRead = EnumContainer.EntriesRead;
  153. *PointerToBuffer = (LPBYTE)EnumContainer.Buffer;
  154. }
  155. NET_REMOTE_RPC_FAILED(
  156. "NetScheduleJobEnum",
  157. ServerName,
  158. status,
  159. NET_REMOTE_FLAG_NORMAL,
  160. SERVICE_SCHEDULE
  161. )
  162. status = ERROR_NOT_SUPPORTED;
  163. NET_REMOTE_END
  164. return( status);
  165. } // NetScheduleJobEnum
  166. NET_API_STATUS
  167. NetScheduleJobGetInfo(
  168. IN LPCWSTR ServerName OPTIONAL,
  169. IN DWORD JobId,
  170. OUT LPBYTE * PointerToBuffer
  171. )
  172. /*++
  173. Routine Description:
  174. This is the DLL entrypoint for NetScheduleGetInfo. This API obtains
  175. information about a particular job in the schedule.
  176. Arguments:
  177. ServerName - Pointer to a string containing the name of the computer
  178. that is to execute the API function.
  179. JobId - Id of job of interest.
  180. PointerToBuffer - Pointer to location where pointer to returned data will
  181. be stored
  182. Return Value:
  183. NET_API_STATUS
  184. --*/
  185. {
  186. NET_API_STATUS status;
  187. NET_REMOTE_TRY_RPC
  188. //
  189. // Try RPC (local or remote) version of API.
  190. //
  191. status = NetrJobGetInfo(
  192. ServerName,
  193. JobId,
  194. (LPAT_INFO *)PointerToBuffer
  195. );
  196. NET_REMOTE_RPC_FAILED(
  197. "NetScheduleJobGetInfo",
  198. ServerName,
  199. status,
  200. NET_REMOTE_FLAG_NORMAL,
  201. SERVICE_SCHEDULE
  202. )
  203. status = ERROR_NOT_SUPPORTED;
  204. NET_REMOTE_END
  205. return( status);
  206. } // NetScheduleJobGetInfo
  207.