ntoskrnl.exe: Use the same timeout for service startup like in other wine modules.
Signed-off-by: Sebastian Lackner <sebastian@fds-team.de> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
bd31e320dd
commit
b1c36e7583
|
@ -2701,9 +2701,9 @@ NTSTATUS WINAPI ZwLoadDriver( const UNICODE_STRING *service_name )
|
||||||
{
|
{
|
||||||
SERVICE_STATUS_PROCESS service_status;
|
SERVICE_STATUS_PROCESS service_status;
|
||||||
SC_HANDLE service_handle;
|
SC_HANDLE service_handle;
|
||||||
|
ULONGLONG start_time;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
DWORD bytes;
|
DWORD bytes;
|
||||||
int i;
|
|
||||||
|
|
||||||
TRACE( "(%s)\n", debugstr_us(service_name) );
|
TRACE( "(%s)\n", debugstr_us(service_name) );
|
||||||
|
|
||||||
|
@ -2712,21 +2712,24 @@ NTSTATUS WINAPI ZwLoadDriver( const UNICODE_STRING *service_name )
|
||||||
|
|
||||||
TRACE( "trying to start %s\n", debugstr_us(service_name) );
|
TRACE( "trying to start %s\n", debugstr_us(service_name) );
|
||||||
|
|
||||||
for (i = 0; i < 100; i++) /* 10 sec timeout */
|
start_time = GetTickCount64();
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
if (StartServiceW( service_handle, 0, NULL )) break;
|
if (StartServiceW( service_handle, 0, NULL )) break;
|
||||||
if (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) break;
|
if (GetLastError() == ERROR_SERVICE_ALREADY_RUNNING) break;
|
||||||
if (GetLastError() != ERROR_SERVICE_DATABASE_LOCKED) goto error;
|
if (GetLastError() != ERROR_SERVICE_DATABASE_LOCKED) goto error;
|
||||||
Sleep(100);
|
if (GetTickCount64() - start_time > 30000) goto error;
|
||||||
|
Sleep( 100 );
|
||||||
}
|
}
|
||||||
if (i == 100) goto error;
|
|
||||||
|
|
||||||
for (i = 0; i < 100; i++) /* 10 sec timeout */
|
start_time = GetTickCount64();
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!QueryServiceStatusEx( service_handle, SC_STATUS_PROCESS_INFO,
|
if (!QueryServiceStatusEx( service_handle, SC_STATUS_PROCESS_INFO,
|
||||||
(BYTE *)&service_status, sizeof(service_status), &bytes )) goto error;
|
(BYTE *)&service_status, sizeof(service_status), &bytes )) goto error;
|
||||||
if (service_status.dwCurrentState != SERVICE_START_PENDING) break;
|
if (service_status.dwCurrentState != SERVICE_START_PENDING) break;
|
||||||
Sleep(100);
|
if (GetTickCount64() - start_time > 30000) goto error;
|
||||||
|
Sleep( 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service_status.dwCurrentState == SERVICE_RUNNING)
|
if (service_status.dwCurrentState == SERVICE_RUNNING)
|
||||||
|
@ -2756,8 +2759,8 @@ NTSTATUS WINAPI ZwUnloadDriver( const UNICODE_STRING *service_name )
|
||||||
{
|
{
|
||||||
SERVICE_STATUS service_status;
|
SERVICE_STATUS service_status;
|
||||||
SC_HANDLE service_handle;
|
SC_HANDLE service_handle;
|
||||||
|
ULONGLONG start_time;
|
||||||
NTSTATUS status;
|
NTSTATUS status;
|
||||||
int i;
|
|
||||||
|
|
||||||
TRACE( "(%s)\n", debugstr_us(service_name) );
|
TRACE( "(%s)\n", debugstr_us(service_name) );
|
||||||
|
|
||||||
|
@ -2767,11 +2770,13 @@ NTSTATUS WINAPI ZwUnloadDriver( const UNICODE_STRING *service_name )
|
||||||
if (!ControlService( service_handle, SERVICE_CONTROL_STOP, &service_status ))
|
if (!ControlService( service_handle, SERVICE_CONTROL_STOP, &service_status ))
|
||||||
goto error;
|
goto error;
|
||||||
|
|
||||||
for (i = 0; i < 100; i++) /* 10 sec timeout */
|
start_time = GetTickCount64();
|
||||||
|
for (;;)
|
||||||
{
|
{
|
||||||
if (!QueryServiceStatus( service_handle, &service_status )) goto error;
|
if (!QueryServiceStatus( service_handle, &service_status )) goto error;
|
||||||
if (service_status.dwCurrentState != SERVICE_STOP_PENDING) break;
|
if (service_status.dwCurrentState != SERVICE_STOP_PENDING) break;
|
||||||
Sleep(100);
|
if (GetTickCount64() - start_time > 30000) goto error;
|
||||||
|
Sleep( 100 );
|
||||||
}
|
}
|
||||||
|
|
||||||
if (service_status.dwCurrentState == SERVICE_STOPPED)
|
if (service_status.dwCurrentState == SERVICE_STOPPED)
|
||||||
|
|
Loading…
Reference in New Issue