33 for (
i = 0;
i < 7;
i++)
47 for (
i = 0;
i < 7;
i++)
80 WCHAR szHour[3], szMinute[3], szAmPm[5];
81 PWSTR startPtr, endPtr;
82 ULONG ulHour = 0, ulMinute = 0;
92 while (*startPtr !=
L'\0' &&
iswdigit(*startPtr))
105 if (*startPtr !=
L':')
113 while (*startPtr !=
L'\0' &&
iswdigit(*startPtr))
127 while (*startPtr !=
L'\0')
143 ulHour =
wcstoul(szHour, &endPtr, 10);
148 ulMinute =
wcstoul(szMinute, &endPtr, 10);
169 if (ulHour == 0 || ulHour > 12)
181 if (ulHour >= 1 && ulHour <= 11)
194 if (pulJobHour !=
NULL)
195 *pulJobHour = ulHour;
197 if (pulJobMinute !=
NULL)
198 *pulJobMinute = ulMinute;
210 PWSTR startPtr, endPtr;
216 ulId =
wcstoul(startPtr, &endPtr, 10);
235 PWSTR startPtr, endPtr;
238 if (
wcslen(pszBuffer) == 0)
241 startPtr = pszBuffer;
245 ulValue =
wcstoul(startPtr, &endPtr, 10);
249 if (ulValue > 0 && ulValue <= 31)
250 *pulDaysOfMonth |= (1 << (ulValue - 1));
255 startPtr = endPtr + 1;
269 PWSTR startPtr, endPtr;
272 if (
wcslen(pszBuffer) == 0)
275 startPtr = pszBuffer;
279 endPtr =
wcschr(startPtr,
L',');
285 for (
i = 0;
i < 7;
i++)
290 *pucDaysOfWeek |= (1 <<
i);
298 startPtr = endPtr + 1;
333 for (
i = 0;
i < 79;
i++)
346 WCHAR szYesBuffer[8];
372 if (szInput[0] == szYesBuffer[0])
377 else if (szInput[0] == 13 || szInput[0] == szNoBuffer[0])
416 return 1UL << (
Time.wDay - 1);
431 Time.wMinute = wMinute;
445 PWSTR pszComputerName,
450 WCHAR szStatusBuffer[16];
451 WCHAR szScheduleBuffer[60];
452 WCHAR szTimeBuffer[16];
453 WCHAR szInteractiveBuffer[16];
454 WCHAR szDateBuffer[8];
455 INT i, nDateLength, nScheduleLength;
482 nScheduleLength =
wcslen(szScheduleBuffer);
483 for (
i = 0;
i < 31;
i++)
485 if (
pBuffer->DaysOfMonth & (1 <<
i))
488 nDateLength =
wcslen(szDateBuffer);
489 if (nScheduleLength + nDateLength <= 55)
491 wcscat(szScheduleBuffer, szDateBuffer);
492 nScheduleLength += nDateLength;
496 wcscat(szScheduleBuffer,
L"...");
502 else if (
pBuffer->DaysOfWeek != 0)
509 nScheduleLength =
wcslen(szScheduleBuffer);
510 for (
i = 0;
i < 7;
i++)
515 nDateLength =
wcslen(szDateBuffer);
516 if (nScheduleLength + nDateLength <= 55)
518 wcscat(szScheduleBuffer, szDateBuffer);
519 nScheduleLength += nDateLength;
523 wcscat(szScheduleBuffer,
L"...");
532 if (CurrentTime >
pBuffer->JobTime)
564 PWSTR pszComputerName)
567 DWORD dwRead = 0, dwTotal = 0;
572 WCHAR szScheduleBuffer[32];
573 WCHAR szTimeBuffer[16];
574 WCHAR szDateBuffer[8];
576 INT j, nDateLength, nScheduleLength;
601 for (
i = 0;
i < dwRead;
i++)
610 nScheduleLength =
wcslen(szScheduleBuffer);
611 for (
j = 0;
j < 31;
j++)
616 nDateLength =
wcslen(szDateBuffer);
617 if (nScheduleLength + nDateLength <= 19)
619 wcscat(szScheduleBuffer, szDateBuffer);
620 nScheduleLength += nDateLength;
624 wcscat(szScheduleBuffer,
L"...");
630 else if (
pBuffer[
i].DaysOfWeek != 0)
637 nScheduleLength =
wcslen(szScheduleBuffer);
638 for (
j = 0;
j < 7;
j++)
643 nDateLength =
wcslen(szDateBuffer);
644 if (nScheduleLength + nDateLength <= 55)
646 wcscat(szScheduleBuffer, szDateBuffer);
647 nScheduleLength += nDateLength;
651 wcscat(szScheduleBuffer,
L"...");
660 if (CurrentTime >
pBuffer[
i].JobTime)
672 L" %6lu %-21s %-11s %s\n",
688 PWSTR pszComputerName,
693 BOOL bInteractiveJob,
707 InfoBuffer.
Command = pszCommand;
727 PWSTR pszComputerName,
733 if (ulJobId == (
ULONG)-1 && bForceDelete ==
FALSE)
741 (ulJobId == (
ULONG)-1) ? 0 : ulJobId,
742 (ulJobId == (
ULONG)-1) ? -1 : ulJobId);
763 ULONG ulDaysOfMonth = 0;
764 UCHAR ucDaysOfWeek = 0;
781 pszComputerName =
argv[
i];
821 bInteractiveJob =
TRUE;
836 bPeriodicJob =
FALSE;
860 if (bDeleteJob ==
TRUE)
863 if (bInteractiveJob ==
TRUE ||
864 ulJobHour != (
ULONG)-1 ||
865 ulJobMinute != (
ULONG)-1 ||
866 ulDaysOfMonth != 0 ||
881 if (ulJobHour != (
ULONG)-1 && ulJobMinute != (
ULONG)-1)
884 if (bForceDelete ==
TRUE ||
892 nResult =
AddJob(pszComputerName,
904 if (bForceDelete ==
TRUE ||
905 bInteractiveJob ==
TRUE ||
906 ulDaysOfMonth != 0 ||
915 if (ulJobId == (
ULONG)-1)
930 if (bPrintUsage ==
TRUE)
static DWORD_PTR GetTimeAsJobTime(VOID)
static BOOL ParseId(PWSTR pszId, PULONG pulId)
static BOOL ParseTime(PWSTR pszTime, PULONG pulJobHour, PULONG pulJobMinute)
static INT PrintJobDetails(PWSTR pszComputerName, ULONG ulJobId)
static INT PrintAllJobs(PWSTR pszComputerName)
static BOOL ParseDaysOfWeek(PWSTR pszBuffer, PUCHAR pucDaysOfWeek)
static VOID JobTimeToTimeString(PWSTR pszBuffer, INT cchBuffer, WORD wHour, WORD wMinute)
static BOOL Confirm(VOID)
static VOID PrintHorizontalLine(VOID)
static VOID PrintErrorMessage(DWORD dwError)
static BOOL ParseDaysOfMonth(PWSTR pszBuffer, PULONG pulDaysOfMonth)
static ULONG GetCurrentDayOfMonth(VOID)
static VOID FreeDaysOfWeekArray(VOID)
static INT DeleteJob(PWSTR pszComputerName, ULONG ulJobId, BOOL bForceDelete)
static BOOL InitDaysOfWeekArray(VOID)
PWSTR pszDaysOfWeekArray[7]
#define IDS_CONFIRM_QUESTION
#define IDS_CONFIRM_INVALID
#define ConInitStdStreams()
void ConPrintf(FILE *fp, LPCWSTR psz,...)
void ConResPrintf(FILE *fp, UINT nID,...)
void ConResPuts(FILE *fp, UINT nID)
static WORD DaysOfMonth(WORD wMonth, WORD wYear)
HANDLE WINAPI GetStdHandle(IN DWORD nStdHandle)
#define HeapFree(x, y, z)
BOOL WINAPI GetConsoleMode(HANDLE hConsoleHandle, LPDWORD lpMode)
BOOL WINAPI DECLSPEC_HOTPATCH SetConsoleMode(HANDLE hConsoleHandle, DWORD dwMode)
BOOL WINAPI DECLSPEC_HOTPATCH ReadConsoleW(IN HANDLE hConsoleInput, OUT LPVOID lpBuffer, IN DWORD nNumberOfCharsToRead, OUT LPDWORD lpNumberOfCharsRead, IN PCONSOLE_READCONSOLE_CONTROL pInputControl OPTIONAL)
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
NET_API_STATUS WINAPI NetApiBufferFree(LPVOID Buffer)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint GLint GLint j
HLOCAL NTAPI LocalFree(HLOCAL hMem)
_Check_return_ unsigned long __cdecl wcstoul(_In_z_ const wchar_t *_Str, _Out_opt_ _Deref_post_z_ wchar_t **_EndPtr, _In_ int _Radix)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define JOB_NONINTERACTIVE
#define JOB_RUN_PERIODICALLY
#define MAX_PREFERRED_LENGTH
static PLARGE_INTEGER Time
#define LOCALE_USER_DEFAULT
NET_API_STATUS WINAPI NetScheduleJobGetInfo(LPCWSTR ServerName, DWORD JobId, LPBYTE *PointerToBuffer)
NET_API_STATUS WINAPI NetScheduleJobAdd(LPCWSTR ServerName, LPBYTE Buffer, LPDWORD JobId)
NET_API_STATUS WINAPI NetScheduleJobDel(LPCWSTR ServerName, DWORD MinJobId, DWORD MaxJobId)
NET_API_STATUS WINAPI NetScheduleJobEnum(LPCWSTR ServerName, LPBYTE *PointerToBuffer, DWORD PreferredMaximumLength, LPDWORD EntriesRead, LPDWORD TotalEntries, LPDWORD ResumeHandle)
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscat(_Inout_updates_z_(_String_length_(_Dest)+_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
_Check_return_ _CRTIMP int __cdecl _wcsnicmp(_In_reads_or_z_(_MaxCount) const wchar_t *_Str1, _In_reads_or_z_(_MaxCount) const wchar_t *_Str2, _In_ size_t _MaxCount)
#define FORMAT_MESSAGE_FROM_SYSTEM
#define FORMAT_MESSAGE_ALLOCATE_BUFFER
#define ENABLE_ECHO_INPUT
#define ENABLE_LINE_INPUT
#define LOCALE_SABBREVDAYNAME1
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
_Must_inspect_result_ _In_ ULONG Flags