jwalmat.pas 7.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  1. {******************************************************************************}
  2. { }
  3. { Lan Manager Scheduler API interface Unit for Object Pascal }
  4. { }
  5. { Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft }
  6. { Corporation. All Rights Reserved. }
  7. { }
  8. { The original file is: lmat.h, released November 2001. The original Pascal }
  9. { code is: LmAt.pas, released Februari 2002. The initial developer of the }
  10. { Pascal code is Marcel van Brakel (brakelm att chello dott nl). }
  11. { }
  12. { Portions created by Marcel van Brakel are Copyright (C) 1999-2001 }
  13. { Marcel van Brakel. All Rights Reserved. }
  14. { }
  15. { Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI) }
  16. { }
  17. { You may retrieve the latest version of this file at the Project JEDI }
  18. { APILIB home page, located at http://jedi-apilib.sourceforge.net }
  19. { }
  20. { The contents of this file are used with permission, subject to the Mozilla }
  21. { Public License Version 1.1 (the "License"); you may not use this file except }
  22. { in compliance with the License. You may obtain a copy of the License at }
  23. { http://www.mozilla.org/MPL/MPL-1.1.html }
  24. { }
  25. { Software distributed under the License is distributed on an "AS IS" basis, }
  26. { WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
  27. { the specific language governing rights and limitations under the License. }
  28. { }
  29. { Alternatively, the contents of this file may be used under the terms of the }
  30. { GNU Lesser General Public License (the "LGPL License"), in which case the }
  31. { provisions of the LGPL License are applicable instead of those above. }
  32. { If you wish to allow use of your version of this file only under the terms }
  33. { of the LGPL License and not to allow others to use your version of this file }
  34. { under the MPL, indicate your decision by deleting the provisions above and }
  35. { replace them with the notice and other provisions required by the LGPL }
  36. { License. If you do not delete the provisions above, a recipient may use }
  37. { your version of this file under either the MPL or the LGPL License. }
  38. { }
  39. { For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
  40. { }
  41. {******************************************************************************}
  42. // $Id: JwaLmAt.pas,v 1.10 2007/09/05 11:58:50 dezipaitor Exp $
  43. {$IFNDEF JWA_OMIT_SECTIONS}
  44. unit JwaLmAt;
  45. {$WEAKPACKAGEUNIT}
  46. {$ENDIF JWA_OMIT_SECTIONS}
  47. {$HPPEMIT ''}
  48. {$HPPEMIT '#include "lmat.h"'}
  49. {$HPPEMIT ''}
  50. {$IFNDEF JWA_OMIT_SECTIONS}
  51. {$I jediapilib.inc}
  52. interface
  53. uses
  54. JwaLmCons, JwaWinType;
  55. {$ENDIF JWA_OMIT_SECTIONS}
  56. {$IFNDEF JWA_IMPLEMENTATIONSECTION}
  57. //
  58. // The following bits are used with Flags field in structures below.
  59. //
  60. //
  61. // Do we exec programs for this job periodically (/EVERY switch)
  62. // or one time (/NEXT switch).
  63. //
  64. const
  65. JOB_RUN_PERIODICALLY = $01; // set if EVERY
  66. {$EXTERNALSYM JOB_RUN_PERIODICALLY}
  67. //
  68. // Was there an error last time we tried to exec a program on behalf of
  69. // this job.
  70. // This flag is meaningfull on output only!
  71. //
  72. JOB_EXEC_ERROR = $02; // set if error
  73. {$EXTERNALSYM JOB_EXEC_ERROR}
  74. //
  75. // Will this job run today or tomorrow.
  76. // This flag is meaningfull on output only!
  77. //
  78. JOB_RUNS_TODAY = $04; // set if today
  79. {$EXTERNALSYM JOB_RUNS_TODAY}
  80. //
  81. // Add current day of the month to DaysOfMonth input.
  82. // This flag is meaningfull on input only!
  83. //
  84. JOB_ADD_CURRENT_DATE = $08; // set if to add current date
  85. {$EXTERNALSYM JOB_ADD_CURRENT_DATE}
  86. //
  87. // Will this job be run interactively or not. Windows NT 3.1 do not
  88. // know about this bit, i.e. they submit interactive jobs only.
  89. //
  90. JOB_NONINTERACTIVE = $10; // set for noninteractive
  91. {$EXTERNALSYM JOB_NONINTERACTIVE}
  92. JOB_INPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_ADD_CURRENT_DATE or JOB_NONINTERACTIVE;
  93. {$EXTERNALSYM JOB_INPUT_FLAGS}
  94. JOB_OUTPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_EXEC_ERROR or JOB_RUNS_TODAY or JOB_NONINTERACTIVE;
  95. {$EXTERNALSYM JOB_OUTPUT_FLAGS}
  96. type
  97. _AT_INFO = record
  98. JobTime: DWORD_PTR;
  99. DaysOfMonth: DWORD;
  100. DaysOfWeek: UCHAR;
  101. Flags: UCHAR;
  102. Command: LPWSTR;
  103. end;
  104. {$EXTERNALSYM _AT_INFO}
  105. AT_INFO = _AT_INFO;
  106. {$EXTERNALSYM AT_INFO}
  107. PAT_INFO = ^AT_INFO;
  108. {$EXTERNALSYM PAT_INFO}
  109. LPAT_INFO = ^AT_INFO;
  110. {$EXTERNALSYM LPAT_INFO}
  111. TAtInfo = AT_INFO;
  112. PAtInfo = PAT_INFO;
  113. _AT_ENUM = record
  114. JobId: DWORD;
  115. JobTime: DWORD_PTR;
  116. DaysOfMonth: DWORD;
  117. DaysOfWeek: UCHAR;
  118. Flags: UCHAR;
  119. Command: LPWSTR;
  120. end;
  121. {$EXTERNALSYM _AT_ENUM}
  122. AT_ENUM = _AT_ENUM;
  123. {$EXTERNALSYM AT_ENUM}
  124. PAT_ENUM = ^AT_ENUM;
  125. {$EXTERNALSYM PAT_ENUM}
  126. LPAT_ENUM = ^AT_ENUM;
  127. {$EXTERNALSYM LPAT_ENUM}
  128. TAtEnum = AT_ENUM;
  129. PAtEnum = PAT_ENUM;
  130. function NetScheduleJobAdd(Servername: LPCWSTR; Buffer: LPBYTE; JobId: LPDWORD): NET_API_STATUS; stdcall;
  131. {$EXTERNALSYM NetScheduleJobAdd}
  132. function NetScheduleJobDel(Servername: LPCWSTR; MinJobId, MaxJobId: DWORD): NET_API_STATUS; stdcall;
  133. {$EXTERNALSYM NetScheduleJobDel}
  134. function NetScheduleJobEnum(Servername: LPCWSTR; var PointerToBuffer: LPBYTE; PrefferedMaximumLength: DWORD; EntriesRead, TotalEntries, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
  135. {$EXTERNALSYM NetScheduleJobEnum}
  136. function NetScheduleJobGetInfo(Servername: LPCWSTR; JobId: DWORD; var PointerToBuffer: LPBYTE): NET_API_STATUS; stdcall;
  137. {$EXTERNALSYM NetScheduleJobGetInfo}
  138. {$ENDIF JWA_IMPLEMENTATIONSECTION}
  139. {$IFNDEF JWA_OMIT_SECTIONS}
  140. implementation
  141. //uses ...
  142. {$ENDIF JWA_OMIT_SECTIONS}
  143. {$IFNDEF JWA_INTERFACESECTION}
  144. {$IFDEF DYNAMIC_LINK}
  145. var
  146. _NetScheduleJobAdd: Pointer;
  147. function NetScheduleJobAdd;
  148. begin
  149. GetProcedureAddress(_NetScheduleJobAdd, netapi32, 'NetScheduleJobAdd');
  150. asm
  151. MOV ESP, EBP
  152. POP EBP
  153. JMP [_NetScheduleJobAdd]
  154. end;
  155. end;
  156. var
  157. _NetScheduleJobDel: Pointer;
  158. function NetScheduleJobDel;
  159. begin
  160. GetProcedureAddress(_NetScheduleJobDel, netapi32, 'NetScheduleJobDel');
  161. asm
  162. MOV ESP, EBP
  163. POP EBP
  164. JMP [_NetScheduleJobDel]
  165. end;
  166. end;
  167. var
  168. _NetScheduleJobEnum: Pointer;
  169. function NetScheduleJobEnum;
  170. begin
  171. GetProcedureAddress(_NetScheduleJobEnum, netapi32, 'NetScheduleJobEnum');
  172. asm
  173. MOV ESP, EBP
  174. POP EBP
  175. JMP [_NetScheduleJobEnum]
  176. end;
  177. end;
  178. var
  179. _NetScheduleJobGetInfo: Pointer;
  180. function NetScheduleJobGetInfo;
  181. begin
  182. GetProcedureAddress(_NetScheduleJobGetInfo, netapi32, 'NetScheduleJobGetInfo');
  183. asm
  184. MOV ESP, EBP
  185. POP EBP
  186. JMP [_NetScheduleJobGetInfo]
  187. end;
  188. end;
  189. {$ELSE}
  190. function NetScheduleJobAdd; external netapi32 name 'NetScheduleJobAdd';
  191. function NetScheduleJobDel; external netapi32 name 'NetScheduleJobDel';
  192. function NetScheduleJobEnum; external netapi32 name 'NetScheduleJobEnum';
  193. function NetScheduleJobGetInfo; external netapi32 name 'NetScheduleJobGetInfo';
  194. {$ENDIF DYNAMIC_LINK}
  195. {$ENDIF JWA_INTERFACESECTION}
  196. {$IFNDEF JWA_OMIT_SECTIONS}
  197. end.
  198. {$ENDIF JWA_OMIT_SECTIONS}