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
43 // $Id: JwaLmAt.pas,v 1.10 2007/09/05 11:58:50 dezipaitor Exp $
44 {$IFNDEF JWA_OMIT_SECTIONS}
45 unit JwaLmAt;
46
47 {$WEAKPACKAGEUNIT}
48 {$ENDIF JWA_OMIT_SECTIONS}
49
50 {$HPPEMIT ''}
51 {$HPPEMIT '#include "lmat.h"'}
52 {$HPPEMIT ''}
53
54
55 {$IFNDEF JWA_OMIT_SECTIONS}
56 {$I jediapilib.inc}
57
58 interface
59
60 uses
61 JwaLmCons, JwaWinType;
62 {$ENDIF JWA_OMIT_SECTIONS}
63 {$IFNDEF JWA_IMPLEMENTATIONSECTION}
64
65 //
66 // The following bits are used with Flags field in structures below.
67 //
68
69 //
70 // Do we exec programs for this job periodically (/EVERY switch)
71 // or one time (/NEXT switch).
72 //
73
74 const
75 JOB_RUN_PERIODICALLY = $01; // set if EVERY
76 {$EXTERNALSYM JOB_RUN_PERIODICALLY}
77
78 //
79 // Was there an error last time we tried to exec a program on behalf of
80 // this job.
81 // This flag is meaningfull on output only!
82 //
83
84 JOB_EXEC_ERROR = $02; // set if error
85 {$EXTERNALSYM JOB_EXEC_ERROR}
86
87 //
88 // Will this job run today or tomorrow.
89 // This flag is meaningfull on output only!
90 //
91
92 JOB_RUNS_TODAY = $04; // set if today
93 {$EXTERNALSYM JOB_RUNS_TODAY}
94
95 //
96 // Add current day of the month to DaysOfMonth input.
97 // This flag is meaningfull on input only!
98 //
99
100 JOB_ADD_CURRENT_DATE = $08; // set if to add current date
101 {$EXTERNALSYM JOB_ADD_CURRENT_DATE}
102
103 //
104 // Will this job be run interactively or not. Windows NT 3.1 do not
105 // know about this bit, i.e. they submit interactive jobs only.
106 //
107
108 JOB_NONINTERACTIVE = $10; // set for noninteractive
109 {$EXTERNALSYM JOB_NONINTERACTIVE}
110
111 JOB_INPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_ADD_CURRENT_DATE or JOB_NONINTERACTIVE;
112 {$EXTERNALSYM JOB_INPUT_FLAGS}
113
114 JOB_OUTPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_EXEC_ERROR or JOB_RUNS_TODAY or JOB_NONINTERACTIVE;
115 {$EXTERNALSYM JOB_OUTPUT_FLAGS}
116
117 type
118 _AT_INFO = record
119 JobTime: DWORD_PTR;
120 DaysOfMonth: DWORD;
121 DaysOfWeek: UCHAR;
122 Flags: UCHAR;
123 Command: LPWSTR;
124 end;
125 {$EXTERNALSYM _AT_INFO}
126 AT_INFO = _AT_INFO;
127 {$EXTERNALSYM AT_INFO}
128 PAT_INFO = ^AT_INFO;
129 {$EXTERNALSYM PAT_INFO}
130 LPAT_INFO = ^AT_INFO;
131 {$EXTERNALSYM LPAT_INFO}
132 TAtInfo = AT_INFO;
133 PAtInfo = PAT_INFO;
134
135 _AT_ENUM = record
136 JobId: DWORD;
137 JobTime: DWORD_PTR;
138 DaysOfMonth: DWORD;
139 DaysOfWeek: UCHAR;
140 Flags: UCHAR;
141 Command: LPWSTR;
142 end;
143 {$EXTERNALSYM _AT_ENUM}
144 AT_ENUM = _AT_ENUM;
145 {$EXTERNALSYM AT_ENUM}
146 PAT_ENUM = ^AT_ENUM;
147 {$EXTERNALSYM PAT_ENUM}
148 LPAT_ENUM = ^AT_ENUM;
149 {$EXTERNALSYM LPAT_ENUM}
150 TAtEnum = AT_ENUM;
151 PAtEnum = PAT_ENUM;
152
NetScheduleJobAddnull153 function NetScheduleJobAdd(Servername: LPCWSTR; Buffer: LPBYTE; JobId: LPDWORD): NET_API_STATUS; stdcall;
154 {$EXTERNALSYM NetScheduleJobAdd}
155
NetScheduleJobDelnull156 function NetScheduleJobDel(Servername: LPCWSTR; MinJobId, MaxJobId: DWORD): NET_API_STATUS; stdcall;
157 {$EXTERNALSYM NetScheduleJobDel}
158
NetScheduleJobEnumnull159 function NetScheduleJobEnum(Servername: LPCWSTR; var PointerToBuffer: LPBYTE; PrefferedMaximumLength: DWORD; EntriesRead, TotalEntries, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
160 {$EXTERNALSYM NetScheduleJobEnum}
161
NetScheduleJobGetInfonull162 function NetScheduleJobGetInfo(Servername: LPCWSTR; JobId: DWORD; var PointerToBuffer: LPBYTE): NET_API_STATUS; stdcall;
163 {$EXTERNALSYM NetScheduleJobGetInfo}
164
165 {$ENDIF JWA_IMPLEMENTATIONSECTION}
166
167 {$IFNDEF JWA_OMIT_SECTIONS}
168 implementation
169 //uses ...
170 {$ENDIF JWA_OMIT_SECTIONS}
171
172 {$IFNDEF JWA_INTERFACESECTION}
173 {$IFDEF DYNAMIC_LINK}
174
175 var
176 _NetScheduleJobAdd: Pointer;
177
NetScheduleJobAddnull178 function NetScheduleJobAdd;
179 begin
180 GetProcedureAddress(_NetScheduleJobAdd, netapi32, 'NetScheduleJobAdd');
181 asm
182 MOV ESP, EBP
183 POP EBP
184 JMP [_NetScheduleJobAdd]
185 end;
186 end;
187
188 var
189 _NetScheduleJobDel: Pointer;
190
NetScheduleJobDelnull191 function NetScheduleJobDel;
192 begin
193 GetProcedureAddress(_NetScheduleJobDel, netapi32, 'NetScheduleJobDel');
194 asm
195 MOV ESP, EBP
196 POP EBP
197 JMP [_NetScheduleJobDel]
198 end;
199 end;
200
201 var
202 _NetScheduleJobEnum: Pointer;
203
NetScheduleJobEnumnull204 function NetScheduleJobEnum;
205 begin
206 GetProcedureAddress(_NetScheduleJobEnum, netapi32, 'NetScheduleJobEnum');
207 asm
208 MOV ESP, EBP
209 POP EBP
210 JMP [_NetScheduleJobEnum]
211 end;
212 end;
213
214 var
215 _NetScheduleJobGetInfo: Pointer;
216
NetScheduleJobGetInfonull217 function NetScheduleJobGetInfo;
218 begin
219 GetProcedureAddress(_NetScheduleJobGetInfo, netapi32, 'NetScheduleJobGetInfo');
220 asm
221 MOV ESP, EBP
222 POP EBP
223 JMP [_NetScheduleJobGetInfo]
224 end;
225 end;
226
227 {$ELSE}
228
NetScheduleJobAddnull229 function NetScheduleJobAdd; external netapi32 name 'NetScheduleJobAdd';
NetScheduleJobDelnull230 function NetScheduleJobDel; external netapi32 name 'NetScheduleJobDel';
NetScheduleJobEnumnull231 function NetScheduleJobEnum; external netapi32 name 'NetScheduleJobEnum';
NetScheduleJobGetInfonull232 function NetScheduleJobGetInfo; external netapi32 name 'NetScheduleJobGetInfo';
233
234 {$ENDIF DYNAMIC_LINK}
235
236 {$ENDIF JWA_INTERFACESECTION}
237
238
239 {$IFNDEF JWA_OMIT_SECTIONS}
240 end.
241 {$ENDIF JWA_OMIT_SECTIONS}
242