dll: FSP_SERVICE: rename interactive mode to console mode

This commit is contained in:
Bill Zissimopoulos 2016-05-07 13:30:12 -07:00
parent ac2e9f9882
commit 8dd5a03b51
2 changed files with 16 additions and 16 deletions

View File

@ -859,8 +859,8 @@ typedef struct _FSP_SERVICE
SERVICE_STATUS_HANDLE StatusHandle; SERVICE_STATUS_HANDLE StatusHandle;
CRITICAL_SECTION ServiceStatusGuard; CRITICAL_SECTION ServiceStatusGuard;
SERVICE_STATUS ServiceStatus; SERVICE_STATUS ServiceStatus;
BOOLEAN AllowInteractive; BOOLEAN AllowConsoleMode;
HANDLE InteractiveEvent; HANDLE ConsoleModeEvent;
WCHAR ServiceName[]; WCHAR ServiceName[];
} FSP_SERVICE; } FSP_SERVICE;
#pragma warning(pop) #pragma warning(pop)
@ -870,7 +870,7 @@ FSP_API NTSTATUS FspServiceCreate(PWSTR ServiceName,
FSP_SERVICE_CONTROL *OnControl, FSP_SERVICE_CONTROL *OnControl,
FSP_SERVICE **PService); FSP_SERVICE **PService);
FSP_API VOID FspServiceDelete(FSP_SERVICE *Service); FSP_API VOID FspServiceDelete(FSP_SERVICE *Service);
FSP_API VOID FspServiceAllowInteractive(FSP_SERVICE *Service); FSP_API VOID FspServiceAllowConsoleMode(FSP_SERVICE *Service);
FSP_API VOID FspServiceAcceptControl(FSP_SERVICE *Service, ULONG Control); FSP_API VOID FspServiceAcceptControl(FSP_SERVICE *Service, ULONG Control);
FSP_API VOID FspServiceRequestTime(FSP_SERVICE *Service, ULONG Time); FSP_API VOID FspServiceRequestTime(FSP_SERVICE *Service, ULONG Time);
FSP_API VOID FspServiceSetExitCode(FSP_SERVICE *Service, ULONG ExitCode); FSP_API VOID FspServiceSetExitCode(FSP_SERVICE *Service, ULONG ExitCode);

View File

@ -92,8 +92,8 @@ FSP_API NTSTATUS FspServiceCreate(PWSTR ServiceName,
FSP_API VOID FspServiceDelete(FSP_SERVICE *Service) FSP_API VOID FspServiceDelete(FSP_SERVICE *Service)
{ {
if (0 != Service->InteractiveEvent) if (0 != Service->ConsoleModeEvent)
CloseHandle(Service->InteractiveEvent); CloseHandle(Service->ConsoleModeEvent);
DeleteCriticalSection(&Service->ServiceStatusGuard); DeleteCriticalSection(&Service->ServiceStatusGuard);
MemFree(Service); MemFree(Service);
@ -137,10 +137,10 @@ static VOID FspServiceSetStatus(FSP_SERVICE *Service, ULONG Flags, SERVICE_STATU
FspEventLog(EVENTLOG_ERROR_TYPE, FspEventLog(EVENTLOG_ERROR_TYPE,
L"" __FUNCTION__ ": error = %ld", GetLastError()); L"" __FUNCTION__ ": error = %ld", GetLastError());
} }
else if (0 != Service->InteractiveEvent && else if (0 != Service->ConsoleModeEvent &&
SERVICE_STOPPED == Service->ServiceStatus.dwCurrentState) SERVICE_STOPPED == Service->ServiceStatus.dwCurrentState)
{ {
SetEvent(Service->InteractiveEvent); SetEvent(Service->ConsoleModeEvent);
} }
LeaveCriticalSection(&Service->ServiceStatusGuard); LeaveCriticalSection(&Service->ServiceStatusGuard);
@ -148,9 +148,9 @@ static VOID FspServiceSetStatus(FSP_SERVICE *Service, ULONG Flags, SERVICE_STATU
#undef XCHG #undef XCHG
} }
FSP_API VOID FspServiceAllowInteractive(FSP_SERVICE *Service) FSP_API VOID FspServiceAllowConsoleMode(FSP_SERVICE *Service)
{ {
Service->AllowInteractive = TRUE; Service->AllowConsoleMode = TRUE;
} }
FSP_API VOID FspServiceAcceptControl(FSP_SERVICE *Service, ULONG Control) FSP_API VOID FspServiceAcceptControl(FSP_SERVICE *Service, ULONG Control)
@ -199,19 +199,19 @@ FSP_API NTSTATUS FspServiceRun(FSP_SERVICE *Service)
DWORD LastError; DWORD LastError;
LastError = GetLastError(); LastError = GetLastError();
if (!Service->AllowInteractive || ERROR_FAILED_SERVICE_CONTROLLER_CONNECT != LastError) if (!Service->AllowConsoleMode || ERROR_FAILED_SERVICE_CONTROLLER_CONNECT != LastError)
return FspNtStatusFromWin32(LastError); return FspNtStatusFromWin32(LastError);
/* enter INTERACTIVE mode! */ /* enter console mode! */
if (0 == Service->InteractiveEvent) if (0 == Service->ConsoleModeEvent)
{ {
Service->InteractiveEvent = CreateEventW(0, TRUE, FALSE, 0); Service->ConsoleModeEvent = CreateEventW(0, TRUE, FALSE, 0);
if (0 == Service->InteractiveEvent) if (0 == Service->ConsoleModeEvent)
return FspNtStatusFromWin32(GetLastError()); return FspNtStatusFromWin32(GetLastError());
} }
else else
ResetEvent(Service->InteractiveEvent); ResetEvent(Service->ConsoleModeEvent);
/* create a thread to mimic what StartServiceCtrlDispatcherW does */ /* create a thread to mimic what StartServiceCtrlDispatcherW does */
Thread = CreateThread(0, 0, FspServiceInteractiveThread, Service, 0, 0); Thread = CreateThread(0, 0, FspServiceInteractiveThread, Service, 0, 0);
@ -225,7 +225,7 @@ FSP_API NTSTATUS FspServiceRun(FSP_SERVICE *Service)
if (!SetConsoleCtrlHandler(FspServiceConsoleCtrlHandler, TRUE)) if (!SetConsoleCtrlHandler(FspServiceConsoleCtrlHandler, TRUE))
return FspNtStatusFromWin32(GetLastError()); return FspNtStatusFromWin32(GetLastError());
WaitResult = WaitForSingleObject(Service->InteractiveEvent, INFINITE); WaitResult = WaitForSingleObject(Service->ConsoleModeEvent, INFINITE);
if (WAIT_OBJECT_0 != WaitResult) if (WAIT_OBJECT_0 != WaitResult)
return FspNtStatusFromWin32(GetLastError()); return FspNtStatusFromWin32(GetLastError());
} }