ReactOS 0.4.16-dev-1247-g7d8d8a6
precomp.h File Reference
#include <limits.h>
#include <stdarg.h>
#include <stdio.h>
#include <windef.h>
#include <winbase.h>
#include <winreg.h>
#include <winsvc.h>
#include <winuser.h>
#include <ndk/rtlfuncs.h>
#include <atsvc_s.h>
#include <wine/debug.h>
Include dependency graph for precomp.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  _JOB
 

Macros

#define WIN32_NO_STATUS
 
#define _INC_WINDOWS
 
#define COM_NO_WINDOWS_H
 
#define JOB_NAME_LENGTH   9
 

Typedefs

typedef struct _JOB JOB
 
typedef struct _JOBPJOB
 

Functions

NTSYSAPI ULONG NTAPI RtlRandomEx (PULONG Seed)
 
VOID GetNextJobTimeout (HANDLE hTimer)
 
VOID RunCurrentJobs (VOID)
 
LONG SaveJob (PJOB pJob)
 
LONG DeleteJob (PJOB pJob)
 
LONG LoadJobs (VOID)
 
VOID CalculateNextStartTime (_In_ PJOB pJob)
 
VOID InsertJobIntoStartList (_In_ PLIST_ENTRY StartListHead, _In_ PJOB pJob)
 
VOID DumpStartList (_In_ PLIST_ENTRY StartListHead)
 
DWORD WINAPI RpcThreadRoutine (LPVOID lpParameter)
 

Variables

DWORD dwNextJobId
 
DWORD dwJobCount
 
LIST_ENTRY JobListHead
 
RTL_RESOURCE JobListLock
 
LIST_ENTRY StartListHead
 
RTL_RESOURCE StartListLock
 
HANDLE Events [3]
 

Macro Definition Documentation

◆ _INC_WINDOWS

#define _INC_WINDOWS

Definition at line 5 of file precomp.h.

◆ COM_NO_WINDOWS_H

#define COM_NO_WINDOWS_H

Definition at line 6 of file precomp.h.

◆ JOB_NAME_LENGTH

#define JOB_NAME_LENGTH   9

Definition at line 22 of file precomp.h.

◆ WIN32_NO_STATUS

#define WIN32_NO_STATUS

Definition at line 4 of file precomp.h.

Typedef Documentation

◆ JOB

typedef struct _JOB JOB

◆ PJOB

typedef struct _JOB * PJOB

Function Documentation

◆ CalculateNextStartTime()

VOID CalculateNextStartTime ( _In_ PJOB  pJob)

Definition at line 468 of file job.c.

470{
471 SYSTEMTIME CurrentSystemTime, StartSystemTime;
472 FILETIME StartFileTime;
473 WORD wDaysOffset, wTempOffset, i, wJobDayOfWeek, wJobDayOfMonth;
474 DWORD_PTR CurrentTimeMs;
475 BOOL bDaysOffsetValid;
476 ULARGE_INTEGER LocalStartTime;
477
478 TRACE("CalculateNextStartTime(%p)\n", pJob);
479 TRACE("JobTime: %lu\n", pJob->JobTime);
480 TRACE("DaysOfWeek: 0x%x\n", pJob->DaysOfWeek);
481 TRACE("DaysOfMonth: 0x%x\n", pJob->DaysOfMonth);
482
483 GetLocalTime(&CurrentSystemTime);
484
485 CurrentTimeMs = (DWORD_PTR)CurrentSystemTime.wHour * 3600000 +
486 (DWORD_PTR)CurrentSystemTime.wMinute * 60000;
487
488 bDaysOffsetValid = FALSE;
489 wDaysOffset = 0;
490 if ((pJob->DaysOfWeek == 0) && (pJob->DaysOfMonth == 0))
491 {
492 if (CurrentTimeMs >= pJob->JobTime)
493 {
494 TRACE("Tomorrow!\n");
495 wDaysOffset = 1;
496 }
497
498 bDaysOffsetValid = TRUE;
499 }
500 else
501 {
502 if (pJob->DaysOfWeek != 0)
503 {
504 TRACE("DaysOfWeek!\n");
505 for (i = 0; i < 7; i++)
506 {
507 if (pJob->DaysOfWeek & (1 << i))
508 {
509 /* Adjust the range */
510 wJobDayOfWeek = (i + 1) % 7;
511 TRACE("wJobDayOfWeek: %hu\n", wJobDayOfWeek);
512 TRACE("CurrentSystemTime.wDayOfWeek: %hu\n", CurrentSystemTime.wDayOfWeek);
513
514 /* Calculate the days offset */
515 if ((CurrentSystemTime.wDayOfWeek > wJobDayOfWeek ) ||
516 ((CurrentSystemTime.wDayOfWeek == wJobDayOfWeek) && (CurrentTimeMs >= pJob->JobTime)))
517 {
518 wTempOffset = 7 - CurrentSystemTime.wDayOfWeek + wJobDayOfWeek;
519 TRACE("wTempOffset: %hu\n", wTempOffset);
520 }
521 else
522 {
523 wTempOffset = wJobDayOfWeek - CurrentSystemTime.wDayOfWeek;
524 TRACE("wTempOffset: %hu\n", wTempOffset);
525 }
526
527 /* Use the smallest offset */
528 if (bDaysOffsetValid == FALSE)
529 {
530 wDaysOffset = wTempOffset;
531 bDaysOffsetValid = TRUE;
532 }
533 else
534 {
535 if (wTempOffset < wDaysOffset)
536 wDaysOffset = wTempOffset;
537 }
538 }
539 }
540 }
541
542 if (pJob->DaysOfMonth != 0)
543 {
544 FIXME("Support DaysOfMonth!\n");
545 for (i = 0; i < 31; i++)
546 {
547 if (pJob->DaysOfMonth & (1 << i))
548 {
549 /* Adjust the range */
550 wJobDayOfMonth = i + 1;
551 FIXME("wJobDayOfMonth: %hu\n", wJobDayOfMonth);
552 FIXME("CurrentSystemTime.wDay: %hu\n", CurrentSystemTime.wDay);
553
554 if ((CurrentSystemTime.wDay > wJobDayOfMonth) ||
555 ((CurrentSystemTime.wDay == wJobDayOfMonth) && (CurrentTimeMs >= pJob->JobTime)))
556 {
557 wTempOffset = DaysOfMonth(CurrentSystemTime.wMonth, CurrentSystemTime.wYear) -
558 CurrentSystemTime.wDay + wJobDayOfMonth;
559 FIXME("wTempOffset: %hu\n", wTempOffset);
560 }
561 else
562 {
563 wTempOffset = wJobDayOfMonth - CurrentSystemTime.wDay;
564 FIXME("wTempOffset: %hu\n", wTempOffset);
565 }
566
567 /* Use the smallest offset */
568 if (bDaysOffsetValid == FALSE)
569 {
570 wDaysOffset = wTempOffset;
571 bDaysOffsetValid = TRUE;
572 }
573 else
574 {
575 if (wTempOffset < wDaysOffset)
576 wDaysOffset = wTempOffset;
577 }
578 }
579 }
580 }
581 }
582
583 TRACE("wDaysOffset: %hu\n", wDaysOffset);
584
585 CopyMemory(&StartSystemTime, &CurrentSystemTime, sizeof(SYSTEMTIME));
586
587 StartSystemTime.wMilliseconds = 0;
588 StartSystemTime.wSecond = 0;
589 StartSystemTime.wHour = (WORD)(pJob->JobTime / 3600000);
590 StartSystemTime.wMinute = (WORD)((pJob->JobTime % 3600000) / 60000);
591
592 SystemTimeToFileTime(&StartSystemTime, &StartFileTime);
593
594 LocalStartTime.u.LowPart = StartFileTime.dwLowDateTime;
595 LocalStartTime.u.HighPart = StartFileTime.dwHighDateTime;
596 if (bDaysOffsetValid && wDaysOffset != 0)
597 {
598 LocalStartTime.QuadPart += ((ULONGLONG)wDaysOffset * 24 * 60 * 60 * 10000);
599 }
600
601 pJob->StartTime.dwLowDateTime = LocalStartTime.u.LowPart;
602 pJob->StartTime.dwHighDateTime = LocalStartTime.u.HighPart;
603}
static WORD DaysOfMonth(WORD wMonth, WORD wYear)
Definition: job.c:456
#define FIXME(fmt,...)
Definition: precomp.h:53
#define TRUE
Definition: types.h:120
#define FALSE
Definition: types.h:117
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
VOID WINAPI GetLocalTime(OUT LPSYSTEMTIME lpSystemTime)
Definition: time.c:286
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned short WORD
Definition: ntddk_ex.h:93
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
Definition: glfuncs.h:248
#define TRACE(s)
Definition: solgame.cpp:4
DWORD dwHighDateTime
Definition: mapidefs.h:66
DWORD dwLowDateTime
Definition: mapidefs.h:65
WORD wYear
Definition: winbase.h:946
WORD wMilliseconds
Definition: winbase.h:953
WORD wMonth
Definition: winbase.h:947
WORD wHour
Definition: winbase.h:950
WORD wSecond
Definition: winbase.h:952
WORD wMinute
Definition: winbase.h:951
WORD wDay
Definition: winbase.h:949
WORD wDayOfWeek
Definition: winbase.h:948
struct _ULARGE_INTEGER::@4307 u
ULONGLONG QuadPart
Definition: ms-dtyp.idl:185
#define DWORD_PTR
Definition: treelist.c:76
uint32_t DWORD_PTR
Definition: typedefs.h:65
uint64_t ULONGLONG
Definition: typedefs.h:67
#define CopyMemory
Definition: winbase.h:1751

Referenced by LoadJobs(), and NetrJobAdd().

◆ DeleteJob()

LONG DeleteJob ( PJOB  pJob)

◆ DumpStartList()

VOID DumpStartList ( _In_ PLIST_ENTRY  StartListHead)

Referenced by LoadJobs(), NetrJobAdd(), and NetrJobDel().

◆ GetNextJobTimeout()

VOID GetNextJobTimeout ( HANDLE  hTimer)

Definition at line 45 of file job.c.

46{
47 PLIST_ENTRY CurrentEntry;
49 PJOB CurrentJob;
50
52 CurrentEntry = JobListHead.Flink;
53 while (CurrentEntry != &JobListHead)
54 {
55 CurrentJob = CONTAINING_RECORD(CurrentEntry, JOB, JobEntry);
56
58 {
59 CopyMemory(&NextJobStartTime, &CurrentJob->StartTime, sizeof(FILETIME));
61 }
62 else
63 {
64 if (CompareFileTime(&NextJobStartTime, &CurrentJob->StartTime) > 0)
65 CopyMemory(&NextJobStartTime, &CurrentJob->StartTime, sizeof(FILETIME));
66 }
67
68 CurrentEntry = CurrentEntry->Flink;
69 }
70
72 {
73 TRACE("No valid job!\n");
74 return;
75 }
76
78
79 SetWaitableTimer(hTimer,
81 0,
82 NULL,
83 NULL,
84 TRUE);
85}
LIST_ENTRY JobListHead
Definition: job.c:30
BOOL bValidNextJobStartTime
Definition: job.c:36
FILETIME NextJobStartTime
Definition: job.c:35
#define NULL
Definition: types.h:112
LONG WINAPI CompareFileTime(IN CONST FILETIME *lpFileTime1, IN CONST FILETIME *lpFileTime2)
Definition: time.c:106
BOOL WINAPI LocalFileTimeToFileTime(IN CONST FILETIME *lpLocalFileTime, OUT LPFILETIME lpFileTime)
Definition: time.c:253
Definition: precomp.h:31
FILETIME StartTime
Definition: precomp.h:34
Definition: typedefs.h:120
struct _LIST_ENTRY * Flink
Definition: typedefs.h:121
BOOL WINAPI SetWaitableTimer(IN HANDLE hTimer, IN const LARGE_INTEGER *pDueTime, IN LONG lPeriod, IN PTIMERAPCROUTINE pfnCompletionRoutine OPTIONAL, IN OPTIONAL LPVOID lpArgToCompletionRoutine, IN BOOL fResume)
Definition: synch.c:382
#define CONTAINING_RECORD(address, type, field)
Definition: typedefs.h:260
_In_ WDFTIMER _In_ LONGLONG DueTime
Definition: wdftimer.h:190

Referenced by SchedServiceMain().

◆ InsertJobIntoStartList()

VOID InsertJobIntoStartList ( _In_ PLIST_ENTRY  StartListHead,
_In_ PJOB  pJob 
)

◆ LoadJobs()

LONG LoadJobs ( VOID  )

Definition at line 319 of file job.c.

320{
321 SCHEDULE Schedule;
322 WCHAR szNameBuffer[JOB_NAME_LENGTH];
323 DWORD dwNameLength, dwIndex, dwSize;
324 HKEY hJobsKey = NULL, hJobKey = NULL;
325 PJOB pJob = NULL;
326 LONG lError;
327
328 TRACE("LoadJobs()\n");
329
331 L"System\\CurrentControlSet\\Services\\Schedule\\Jobs",
332 0,
333 NULL,
335 KEY_READ,
336 NULL,
337 &hJobsKey,
338 NULL);
339 if (lError != ERROR_SUCCESS)
340 goto done;
341
342 for (dwIndex = 0; dwIndex < 1000; dwIndex++)
343 {
344 dwNameLength = JOB_NAME_LENGTH;
345 lError = RegEnumKeyEx(hJobsKey,
346 dwIndex,
347 szNameBuffer,
348 &dwNameLength,
349 NULL,
350 NULL,
351 NULL,
352 NULL);
353 if (lError != ERROR_SUCCESS)
354 {
355 lError = ERROR_SUCCESS;
356 break;
357 }
358
359 TRACE("KeyName: %S\n", szNameBuffer);
360
361 lError = RegOpenKeyEx(hJobsKey,
362 szNameBuffer,
363 0,
364 KEY_READ,
365 &hJobKey);
366 if (lError != ERROR_SUCCESS)
367 break;
368
369 dwSize = sizeof(SCHEDULE);
370 lError = RegQueryValueEx(hJobKey,
371 L"Schedule",
372 NULL,
373 NULL,
374 (PBYTE)&Schedule,
375 &dwSize);
376 if (lError == ERROR_SUCCESS)
377 {
378 dwSize = 0;
379 RegQueryValueEx(hJobKey,
380 L"Command",
381 NULL,
382 NULL,
383 NULL,
384 &dwSize);
385 if (dwSize != 0)
386 {
387 /* Allocate a new job object */
388 pJob = HeapAlloc(GetProcessHeap(),
390 sizeof(JOB) + dwSize - sizeof(WCHAR));
391 if (pJob == NULL)
392 {
393 lError = ERROR_OUTOFMEMORY;
394 break;
395 }
396
397 lError = RegQueryValueEx(hJobKey,
398 L"Command",
399 NULL,
400 NULL,
401 (PBYTE)pJob->Command,
402 &dwSize);
403 if (lError != ERROR_SUCCESS)
404 break;
405
406 wcscpy(pJob->Name, szNameBuffer);
407 pJob->JobTime = Schedule.JobTime;
408 pJob->DaysOfMonth = Schedule.DaysOfMonth;
409 pJob->DaysOfWeek = Schedule.DaysOfWeek;
410 pJob->Flags = Schedule.Flags;
411
412 /* Acquire the job list lock exclusively */
414
415 /* Assign a new job ID */
416 pJob->JobId = dwNextJobId++;
417 dwJobCount++;
418
419 /* Append the new job to the job list */
421
422 /* Calculate the next start time */
424
425#if 0
427#endif
428
429 /* Release the job list lock */
431
432 pJob = NULL;
433 }
434 }
435
436 RegCloseKey(hJobKey);
437 hJobKey = NULL;
438 }
439
440done:
441 if (pJob != NULL)
442 HeapFree(GetProcessHeap(), 0, pJob);
443
444 if (hJobKey != NULL)
445 RegCloseKey(hJobKey);
446
447 if (hJobsKey != NULL)
448 RegCloseKey(hJobsKey);
449
450 return lError;
451}
struct _SCHEDULE SCHEDULE
RTL_RESOURCE JobListLock
Definition: job.c:31
DWORD dwJobCount
Definition: job.c:29
LIST_ENTRY StartListHead
Definition: job.c:33
VOID CalculateNextStartTime(_In_ PJOB pJob)
Definition: job.c:468
DWORD dwNextJobId
Definition: job.c:28
#define JOB_NAME_LENGTH
Definition: precomp.h:22
VOID DumpStartList(_In_ PLIST_ENTRY StartListHead)
#define RegCloseKey(hKey)
Definition: registry.h:49
wcscpy
#define ERROR_OUTOFMEMORY
Definition: deptool.c:13
#define ERROR_SUCCESS
Definition: deptool.c:10
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
Definition: reg.c:1096
#define GetProcessHeap()
Definition: compat.h:736
#define HeapAlloc
Definition: compat.h:733
#define HeapFree(x, y, z)
Definition: compat.h:735
#define HEAP_ZERO_MEMORY
Definition: compat.h:134
#define InsertTailList(ListHead, Entry)
unsigned long DWORD
Definition: ntddk_ex.h:95
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
Definition: env.c:56
NTSYSAPI BOOLEAN NTAPI RtlAcquireResourceExclusive(_In_ PRTL_RESOURCE Resource, _In_ BOOLEAN Wait)
NTSYSAPI VOID NTAPI RtlReleaseResource(_In_ PRTL_RESOURCE Resource)
#define KEY_READ
Definition: nt_native.h:1023
#define REG_OPTION_NON_VOLATILE
Definition: nt_native.h:1057
#define L(x)
Definition: ntvdm.h:50
BYTE * PBYTE
Definition: pedump.c:66
long LONG
Definition: pedump.c:60
UCHAR DaysOfWeek
Definition: precomp.h:40
UCHAR Flags
Definition: precomp.h:41
LIST_ENTRY JobEntry
Definition: precomp.h:32
WCHAR Name[JOB_NAME_LENGTH]
Definition: precomp.h:35
WCHAR Command[1]
Definition: precomp.h:42
DWORD_PTR JobTime
Definition: precomp.h:38
DWORD DaysOfMonth
Definition: precomp.h:39
DWORD JobId
Definition: precomp.h:37
Definition: job.c:20
UCHAR Flags
Definition: job.c:24
DWORD JobTime
Definition: job.c:21
DWORD DaysOfMonth
Definition: job.c:22
UCHAR DaysOfWeek
Definition: job.c:23
#define HKEY_LOCAL_MACHINE
Definition: winreg.h:12
#define RegOpenKeyEx
Definition: winreg.h:520
#define RegQueryValueEx
Definition: winreg.h:524
#define RegEnumKeyEx
Definition: winreg.h:510
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by ServiceInit().

◆ RpcThreadRoutine()

DWORD WINAPI RpcThreadRoutine ( LPVOID  lpParameter)

Definition at line 20 of file rpcserver.c.

22{
24
25 Status = RpcServerUseProtseqEpW(L"ncacn_np", 20, L"\\pipe\\browser", NULL);
26 if (Status != RPC_S_OK)
27 {
28 ERR("RpcServerUseProtseqEpW() failed (Status %lx)\n", Status);
29 return 0;
30 }
31
32 Status = RpcServerRegisterIf(browser_v0_0_s_ifspec, NULL, NULL);
33 if (Status != RPC_S_OK)
34 {
35 ERR("RpcServerRegisterIf() failed (Status %lx)\n", Status);
36 return 0;
37 }
38
40 if (Status != RPC_S_OK)
41 {
42 ERR("RpcServerListen() failed (Status %lx)\n", Status);
43 }
44
45 return 0;
46}
#define ERR(fmt,...)
Definition: precomp.h:57
Status
Definition: gdiplustypes.h:25
RPC_STATUS WINAPI RpcServerListen(UINT MinimumCallThreads, UINT MaxCalls, UINT DontWait)
Definition: rpc_server.c:1520
RPC_STATUS WINAPI RpcServerRegisterIf(RPC_IF_HANDLE IfSpec, UUID *MgrTypeUuid, RPC_MGR_EPV *MgrEpv)
Definition: rpc_server.c:1116
RPC_STATUS WINAPI RpcServerUseProtseqEpW(RPC_WSTR Protseq, UINT MaxCalls, RPC_WSTR Endpoint, LPVOID SecurityDescriptor)
Definition: rpc_server.c:927
#define RPC_C_LISTEN_MAX_CALLS_DEFAULT
Definition: rpcdce.h:122
#define RPC_S_OK
Definition: rpcnterr.h:22
long RPC_STATUS
Definition: rpc.h:48

◆ RtlRandomEx()

NTSYSAPI ULONG NTAPI RtlRandomEx ( PULONG  Seed)

Referenced by get_uuid(), GetJobName(), and KsecGenRandom().

◆ RunCurrentJobs()

VOID RunCurrentJobs ( VOID  )

Definition at line 123 of file job.c.

124{
125 PROCESS_INFORMATION ProcessInformation;
126 STARTUPINFOW StartupInfo;
127 PLIST_ENTRY CurrentEntry;
128 PJOB CurrentJob;
129 BOOL bRet;
130
131 CurrentEntry = JobListHead.Flink;
132 while (CurrentEntry != &JobListHead)
133 {
134 CurrentJob = CONTAINING_RECORD(CurrentEntry, JOB, JobEntry);
135
136 if (CompareFileTime(&NextJobStartTime, &CurrentJob->StartTime) == 0)
137 {
138 TRACE("Run job %ld: %S\n", CurrentJob->JobId, CurrentJob->Command);
139
140 ZeroMemory(&StartupInfo, sizeof(StartupInfo));
141 StartupInfo.cb = sizeof(StartupInfo);
142 StartupInfo.lpTitle = CurrentJob->Command;
143 StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
144 StartupInfo.wShowWindow = SW_SHOWDEFAULT;
145
146 if ((CurrentJob->Flags & JOB_NONINTERACTIVE) == 0)
147 {
148 StartupInfo.dwFlags |= STARTF_INHERITDESKTOP;
149 StartupInfo.lpDesktop = L"WinSta0\\Default";
150 }
151
152 bRet = CreateProcessW(NULL,
153 CurrentJob->Command,
154 NULL,
155 NULL,
156 FALSE,
158 NULL,
159 NULL,
160 &StartupInfo,
161 &ProcessInformation);
162 if (bRet == FALSE)
163 {
164 ERR("CreateProcessW() failed (Error %lu)\n", GetLastError());
165 }
166 else
167 {
168 CloseHandle(ProcessInformation.hThread);
169 CloseHandle(ProcessInformation.hProcess);
170 }
171 }
172
173 CurrentEntry = CurrentEntry->Flink;
174 }
175}
#define CloseHandle
Definition: compat.h:739
BOOL WINAPI DECLSPEC_HOTPATCH CreateProcessW(LPCWSTR lpApplicationName, LPWSTR lpCommandLine, LPSECURITY_ATTRIBUTES lpProcessAttributes, LPSECURITY_ATTRIBUTES lpThreadAttributes, BOOL bInheritHandles, DWORD dwCreationFlags, LPVOID lpEnvironment, LPCWSTR lpCurrentDirectory, LPSTARTUPINFOW lpStartupInfo, LPPROCESS_INFORMATION lpProcessInformation)
Definition: proc.c:4598
#define JOB_NONINTERACTIVE
Definition: atsvc.idl:38
LPWSTR lpDesktop
Definition: winbase.h:889
DWORD cb
Definition: winbase.h:887
DWORD dwFlags
Definition: winbase.h:898
LPWSTR lpTitle
Definition: winbase.h:890
WORD wShowWindow
Definition: winbase.h:899
#define STARTF_INHERITDESKTOP
Definition: undocuser.h:167
#define ZeroMemory
Definition: winbase.h:1753
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define STARTF_USESHOWWINDOW
Definition: winbase.h:524
#define CREATE_NEW_CONSOLE
Definition: winbase.h:190
#define SW_SHOWDEFAULT
Definition: winuser.h:791

Referenced by SchedServiceMain().

◆ SaveJob()

LONG SaveJob ( PJOB  pJob)

Variable Documentation

◆ dwJobCount

DWORD dwJobCount
extern

Definition at line 29 of file job.c.

Referenced by LoadJobs(), NetrJobAdd(), NetrJobDel(), and NetrJobEnum().

◆ dwNextJobId

DWORD dwNextJobId
extern

Definition at line 28 of file job.c.

Referenced by LoadJobs(), and NetrJobAdd().

◆ Events

◆ JobListHead

◆ JobListLock

RTL_RESOURCE JobListLock
extern

◆ StartListHead

LIST_ENTRY StartListHead
extern

Definition at line 33 of file job.c.

Referenced by LoadJobs(), NetrJobAdd(), NetrJobDel(), and ServiceInit().

◆ StartListLock

RTL_RESOURCE StartListLock
extern

Definition at line 34 of file job.c.

Referenced by ServiceInit().