' ########################################################################################
' Microsoft Windows
' File: LMat.inc
' Contents: Structures, function prototypes, and definitions for the schedule service API-s
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_LMat_PBI)
#DEFINE PBX_LMat_PBI
%LMAT_INC = 1
#include once "lmcons.inc"
'//
'// 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).
'//
%JOB_RUN_PERIODICALLY = &H01? ' // set if EVERY
'//
'// 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 = &H02? ' // set if error
'//
'// Will this job run today or tomorrow.
'// This flag is meaningfull on output only!
'//
%JOB_RUNS_TODAY = &H04? ' // set if today
'//
'// Add current day of the month to DaysOfMonth input.
'// This flag is meaningfull on input only!
'//
%JOB_ADD_CURRENT_DATE = &H08? ' // set if to 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 = &H10? ' // set for noninteractive
%JOB_INPUT_FLAGS = %JOB_RUN_PERIODICALLY OR %JOB_ADD_CURRENT_DATE OR %JOB_NONINTERACTIVE
%JOB_OUTPUT_FLAGS = %JOB_RUN_PERIODICALLY OR %JOB_EXEC_ERROR OR %JOB_RUNS_TODAY OR %JOB_NONINTERACTIVE
' // Size = 16 bytes
TYPE AT_INFO DWORD FILL
 JobTime AS DWORD ' DWORD_PTR
 DaysOfMonth AS DWORD
 DaysOfWeek AS BYTE ' UCHAR
 Flags AS BYTE ' UCHAR
 Command AS WSTRINGZ PTR
END TYPE
' // Size = 20 bytes
TYPE AT_ENUM DWORD FILL
 JobId AS DWORD
 JobTime AS DWORD ' DWORD_PTR
 DaysOfMonth AS DWORD
 DaysOfWeek AS BYTE ' UCHAR
 Flags AS BYTE ' UCHAR
 Command AS WSTRINGZ PTR
END TYPE
DECLARE FUNCTION NetScheduleJobAdd LIB "netapi32.dll" ALIAS "NetScheduleJobAdd" ( BYREF Servername AS WSTRINGZ , BYREF Buffer AS ANY , BYREF JobId AS QUAD ) AS QUAD ' NET_API_STATUS
DECLARE FUNCTION NetScheduleJobDel LIB "netapi32.dll" ALIAS "NetScheduleJobDel" ( BYREF Servername AS WSTRINGZ , BYVAL MinJobId AS QUAD , BYVAL MaxJobId AS QUAD ) AS QUAD ' NET_API_STATUS
DECLARE FUNCTION NetScheduleJobEnum LIB "netapi32.dll" ALIAS "NetScheduleJobEnum" ( BYREF Servername AS WSTRINGZ , BYREF PointerToBuffer AS ANY , BYVAL PrefferedMaximumLength AS QUAD , BYREF EntriesRead AS QUAD , BYREF TotalEntries AS QUAD , BYREF ResumeHandle AS QUAD ) AS QUAD ' NET_API_STATUS
DECLARE FUNCTION NetScheduleJobGetInfo LIB "netapi32.dll" ALIAS "NetScheduleJobGetInfo" ( BYREF Servername AS WSTRINGZ , BYVAL JobId AS QUAD , BYREF PointerToBuffer AS ANY ) AS QUAD ' NET_API_STATUS