summaryrefslogtreecommitdiff
path: root/packages/extra/winunits/jwalmat.pas
blob: 7aacca2189decb58a835cd6da6f6ce31ea156cec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
{******************************************************************************}
{                                                                              }
{ Lan Manager Scheduler API interface Unit for Object Pascal                   }
{                                                                              }
{ Portions created by Microsoft are Copyright (C) 1995-2001 Microsoft          }
{ Corporation. All Rights Reserved.                                            }
{                                                                              }
{ The original file is: lmat.h, released November 2001. The original Pascal    }
{ code is: LmAt.pas, released Februari 2002. The initial developer of the      }
{ Pascal code is Marcel van Brakel (brakelm att chello dott nl).               }
{                                                                              }
{ Portions created by Marcel van Brakel are Copyright (C) 1999-2001            }
{ Marcel van Brakel. All Rights Reserved.                                      }
{                                                                              }
{ Obtained through: Joint Endeavour of Delphi Innovators (Project JEDI)        }
{                                                                              }
{ You may retrieve the latest version of this file at the Project JEDI         }
{ APILIB home page, located at http://jedi-apilib.sourceforge.net              }
{                                                                              }
{ The contents of this file are used with permission, subject to the Mozilla   }
{ Public License Version 1.1 (the "License"); you may not use this file except }
{ in compliance with the License. You may obtain a copy of the License at      }
{ http://www.mozilla.org/MPL/MPL-1.1.html                                      }
{                                                                              }
{ Software distributed under the License is distributed on an "AS IS" basis,   }
{ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for }
{ the specific language governing rights and limitations under the License.    }
{                                                                              }
{ Alternatively, the contents of this file may be used under the terms of the  }
{ GNU Lesser General Public License (the  "LGPL License"), in which case the   }
{ provisions of the LGPL License are applicable instead of those above.        }
{ If you wish to allow use of your version of this file only under the terms   }
{ of the LGPL License and not to allow others to use your version of this file }
{ under the MPL, indicate your decision by deleting  the provisions above and  }
{ replace  them with the notice and other provisions required by the LGPL      }
{ License.  If you do not delete the provisions above, a recipient may use     }
{ your version of this file under either the MPL or the LGPL License.          }
{                                                                              }
{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html }
{                                                                              }
{******************************************************************************}

// $Id: jwalmat.pas,v 1.1 2005/04/04 07:56:10 marco Exp $

unit JwaLmAt;

{$WEAKPACKAGEUNIT}

{$HPPEMIT ''}
{$HPPEMIT '#include "lmat.h"'}
{$HPPEMIT ''}

{$I jediapilib.inc}

interface

uses
  JwaLmCons, JwaWinType;

//
//  The following bits are used with Flags field in structures below.
//

//
//  Do we exec programs for this job periodically (/EVERY switch)
//  or one time (/NEXT switch).
//

const
  JOB_RUN_PERIODICALLY           = $01;    //  set if EVERY
  {$EXTERNALSYM JOB_RUN_PERIODICALLY}

//
//  Was there an error last time we tried to exec a program on behalf of
//  this job.
//  This flag is meaningfull on output only!
//

  JOB_EXEC_ERROR                 = $02;    //  set if error
  {$EXTERNALSYM JOB_EXEC_ERROR}

//
//  Will this job run today or tomorrow.
//  This flag is meaningfull on output only!
//

  JOB_RUNS_TODAY                 = $04;    //  set if today
  {$EXTERNALSYM JOB_RUNS_TODAY}

//
//  Add current day of the month to DaysOfMonth input.
//  This flag is meaningfull on input only!
//

  JOB_ADD_CURRENT_DATE            = $08;    // set if to add current date
  {$EXTERNALSYM JOB_ADD_CURRENT_DATE}

//
//  Will this job be run interactively or not.  Windows NT 3.1 do not
//  know about this bit, i.e. they submit interactive jobs only.
//

  JOB_NONINTERACTIVE              = $10;    // set for noninteractive
  {$EXTERNALSYM JOB_NONINTERACTIVE}

  JOB_INPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_ADD_CURRENT_DATE or JOB_NONINTERACTIVE;
  {$EXTERNALSYM JOB_INPUT_FLAGS}

  JOB_OUTPUT_FLAGS = JOB_RUN_PERIODICALLY or JOB_EXEC_ERROR or JOB_RUNS_TODAY or JOB_NONINTERACTIVE;
  {$EXTERNALSYM JOB_OUTPUT_FLAGS}

type
  _AT_INFO = record
    JobTime: DWORD_PTR;
    DaysOfMonth: DWORD;
    DaysOfWeek: UCHAR;
    Flags: UCHAR;
    Command: LPWSTR;
  end;
  {$EXTERNALSYM _AT_INFO}
  AT_INFO = _AT_INFO;
  {$EXTERNALSYM AT_INFO}
  PAT_INFO = ^AT_INFO;
  {$EXTERNALSYM PAT_INFO}
  LPAT_INFO = ^AT_INFO;
  {$EXTERNALSYM LPAT_INFO}
  TAtInfo = AT_INFO;
  PAtInfo = PAT_INFO;

  _AT_ENUM = record
    JobId: DWORD;
    JobTime: DWORD_PTR;
    DaysOfMonth: DWORD;
    DaysOfWeek: UCHAR;
    Flags: UCHAR;
    Command: LPWSTR;
  end;
  {$EXTERNALSYM _AT_ENUM}
  AT_ENUM = _AT_ENUM;
  {$EXTERNALSYM AT_ENUM}
  PAT_ENUM = ^AT_ENUM;
  {$EXTERNALSYM PAT_ENUM}
  LPAT_ENUM = ^AT_ENUM;
  {$EXTERNALSYM LPAT_ENUM}
  TAtEnum = AT_ENUM;
  PAtEnum = PAT_ENUM;  

function NetScheduleJobAdd(Servername: LPCWSTR; Buffer: LPBYTE; JobId: LPDWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetScheduleJobAdd}

function NetScheduleJobDel(Servername: LPCWSTR; MinJobId, MaxJobId: DWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetScheduleJobDel}

function NetScheduleJobEnum(Servername: LPCWSTR; var PointerToBuffer: LPBYTE; PrefferedMaximumLength: DWORD; EntriesRead, TotalEntries, ResumeHandle: LPDWORD): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetScheduleJobEnum}

function NetScheduleJobGetInfo(Servername: LPCWSTR; JobId: DWORD; var PointerToBuffer: LPBYTE): NET_API_STATUS; stdcall;
{$EXTERNALSYM NetScheduleJobGetInfo}

implementation

{$IFDEF DYNAMIC_LINK}

var
  _NetScheduleJobAdd: Pointer;

function NetScheduleJobAdd;
begin
  GetProcedureAddress(_NetScheduleJobAdd, netapi32, 'NetScheduleJobAdd');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetScheduleJobAdd]
  end;
end;

var
  _NetScheduleJobDel: Pointer;

function NetScheduleJobDel;
begin
  GetProcedureAddress(_NetScheduleJobDel, netapi32, 'NetScheduleJobDel');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetScheduleJobDel]
  end;
end;

var
  _NetScheduleJobEnum: Pointer;

function NetScheduleJobEnum;
begin
  GetProcedureAddress(_NetScheduleJobEnum, netapi32, 'NetScheduleJobEnum');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetScheduleJobEnum]
  end;
end;

var
  _NetScheduleJobGetInfo: Pointer;

function NetScheduleJobGetInfo;
begin
  GetProcedureAddress(_NetScheduleJobGetInfo, netapi32, 'NetScheduleJobGetInfo');
  asm
        MOV     ESP, EBP
        POP     EBP
        JMP     [_NetScheduleJobGetInfo]
  end;
end;

{$ELSE}

function NetScheduleJobAdd; external netapi32 name 'NetScheduleJobAdd';
function NetScheduleJobDel; external netapi32 name 'NetScheduleJobDel';
function NetScheduleJobEnum; external netapi32 name 'NetScheduleJobEnum';
function NetScheduleJobGetInfo; external netapi32 name 'NetScheduleJobGetInfo';

{$ENDIF DYNAMIC_LINK}

end.