jwalmat.pas 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  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.8 2005/09/06 16:36:50 marquardt Exp $
  43. unit JwaLmAt;
  44. {$WEAKPACKAGEUNIT}
  45. {$HPPEMIT ''}
  46. {$HPPEMIT '#include "lmat.h"'}
  47. {$HPPEMIT ''}
  48. {$I jediapilib.inc}
  49. interface
  50. uses
  51. JwaWindows, JwaLmCons;
  52. //
  53. // The following bits are used with Flags field in structures below.
  54. //
  55. //
  56. // Do we exec programs for this job periodically (/EVERY switch)
  57. // or one time (/NEXT switch).
  58. //
  59. const
  60. JOB_RUN_PERIODICALLY = $01; // set if EVERY
  61. {$EXTERNALSYM JOB_RUN_PERIODICALLY}
  62. //
  63. // Was there an error last time we tried to exec a program on behalf of
  64. // this job.
  65. // This flag is meaningfull on output only!
  66. //
  67. JOB_EXEC_ERROR = $02; // set if error
  68. {$EXTERNALSYM JOB_EXEC_ERROR}
  69. //
  70. // Will this job run today or tomorrow.
  71. // This flag is meaningfull on output only!
  72. //
  73. JOB_RUNS_TODAY = $04; // set if today
  74. {$EXTERNALSYM JOB_RUNS_TODAY}
  75. //
  76. // Add current day of the month to DaysOfMonth input.
  77. // This flag is meaningfull on input only!
  78. //
  79. JOB_ADD_CURRENT_DATE = $08; // set if to add current date
  80. {$EXTERNALSYM JOB_ADD_CURRENT_DATE}
  81. //
  82. // Will this job be run interactively or not. Windows NT 3.1 do not
  83. // know about this bit, i.e. they submit interactive jobs only.
  84. //
  85. JOB_NONINTERACTIVE = $10; // set for noninteractive
  86. {$EXTERNALSYM JOB_NONINTERACTIVE}
  87. JOB_INPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_ADD_CURRENT_DATE or JOB_NONINTERACTIVE;
  88. {$EXTERNALSYM JOB_INPUT_FLAGS}
  89. JOB_OUTPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_EXEC_ERROR or JOB_RUNS_TODAY or JOB_NONINTERACTIVE;
  90. {$EXTERNALSYM JOB_OUTPUT_FLAGS}
  91. type
  92. _AT_INFO = record
  93. JobTime: DWORD_PTR;
  94. DaysOfMonth: DWORD;
  95. DaysOfWeek: UCHAR;
  96. Flags: UCHAR;
  97. Command: LPWSTR;
  98. end;
  99. {$EXTERNALSYM _AT_INFO}
  100. AT_INFO = _AT_INFO;
  101. {$EXTERNALSYM AT_INFO}
  102. PAT_INFO = ^AT_INFO;
  103. {$EXTERNALSYM PAT_INFO}
  104. LPAT_INFO = ^AT_INFO;
  105. {$EXTERNALSYM LPAT_INFO}
  106. TAtInfo = AT_INFO;
  107. PAtInfo = PAT_INFO;
  108. _AT_ENUM = record
  109. JobId: DWORD;
  110. JobTime: DWORD_PTR;
  111. DaysOfMonth: DWORD;
  112. DaysOfWeek: UCHAR;
  113. Flags: UCHAR;
  114. Command: LPWSTR;
  115. end;
  116. {$EXTERNALSYM _AT_ENUM}
  117. AT_ENUM = _AT_ENUM;
  118. {$EXTERNALSYM AT_ENUM}
  119. PAT_ENUM = ^AT_ENUM;
  120. {$EXTERNALSYM PAT_ENUM}
  121. LPAT_ENUM = ^AT_ENUM;
  122. {$EXTERNALSYM LPAT_ENUM}
  123. TAtEnum = AT_ENUM;
  124. PAtEnum = PAT_ENUM;
  125. function NetScheduleJobAdd(Servername: LPCWSTR; Buffer: LPBYTE; JobId: LPDWORD): NET_API_STATUS; stdcall;
  126. {$EXTERNALSYM NetScheduleJobAdd}
  127. function NetScheduleJobDel(Servername: LPCWSTR; MinJobId, MaxJobId: DWORD): NET_API_STATUS; stdcall;
  128. {$EXTERNALSYM NetScheduleJobDel}
  129. function NetScheduleJobEnum(Servername: LPCWSTR; var PointerToBuffer: LPBYTE; PrefferedMaximumLength: DWORD; EntriesRead, TotalEntries, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
  130. {$EXTERNALSYM NetScheduleJobEnum}
  131. function NetScheduleJobGetInfo(Servername: LPCWSTR; JobId: DWORD; var PointerToBuffer: LPBYTE): NET_API_STATUS; stdcall;
  132. {$EXTERNALSYM NetScheduleJobGetInfo}
  133. implementation
  134. uses
  135. JwaWinDLLNames;
  136. {$IFDEF DYNAMIC_LINK}
  137. var
  138. _NetScheduleJobAdd: Pointer;
  139. function NetScheduleJobAdd;
  140. begin
  141. GetProcedureAddress(_NetScheduleJobAdd, netapi32, 'NetScheduleJobAdd');
  142. asm
  143. MOV ESP, EBP
  144. POP EBP
  145. JMP [_NetScheduleJobAdd]
  146. end;
  147. end;
  148. var
  149. _NetScheduleJobDel: Pointer;
  150. function NetScheduleJobDel;
  151. begin
  152. GetProcedureAddress(_NetScheduleJobDel, netapi32, 'NetScheduleJobDel');
  153. asm
  154. MOV ESP, EBP
  155. POP EBP
  156. JMP [_NetScheduleJobDel]
  157. end;
  158. end;
  159. var
  160. _NetScheduleJobEnum: Pointer;
  161. function NetScheduleJobEnum;
  162. begin
  163. GetProcedureAddress(_NetScheduleJobEnum, netapi32, 'NetScheduleJobEnum');
  164. asm
  165. MOV ESP, EBP
  166. POP EBP
  167. JMP [_NetScheduleJobEnum]
  168. end;
  169. end;
  170. var
  171. _NetScheduleJobGetInfo: Pointer;
  172. function NetScheduleJobGetInfo;
  173. begin
  174. GetProcedureAddress(_NetScheduleJobGetInfo, netapi32, 'NetScheduleJobGetInfo');
  175. asm
  176. MOV ESP, EBP
  177. POP EBP
  178. JMP [_NetScheduleJobGetInfo]
  179. end;
  180. end;
  181. {$ELSE}
  182. function NetScheduleJobAdd; external netapi32 name 'NetScheduleJobAdd';
  183. function NetScheduleJobDel; external netapi32 name 'NetScheduleJobDel';
  184. function NetScheduleJobEnum; external netapi32 name 'NetScheduleJobEnum';
  185. function NetScheduleJobGetInfo; external netapi32 name 'NetScheduleJobGetInfo';
  186. {$ENDIF DYNAMIC_LINK}
  187. end.