services: Properly initialize service status at creation time.

This commit is contained in:
Alexandre Julliard 2008-11-25 11:56:33 +01:00
parent 3c88a2f060
commit 42fb9fe779
2 changed files with 4 additions and 4 deletions

View File

@ -364,7 +364,7 @@ DWORD svcctl_CreateServiceW(
err = service_create(lpServiceName, &entry);
if (err != ERROR_SUCCESS)
return err;
entry->config.dwServiceType = dwServiceType;
entry->config.dwServiceType = entry->status.dwServiceType = dwServiceType;
entry->config.dwStartType = dwStartType;
entry->config.dwErrorControl = dwErrorControl;
entry->config.lpBinaryPathName = strdupW(lpBinaryPathName);

View File

@ -71,6 +71,9 @@ DWORD service_create(LPCWSTR name, struct service_entry **entry)
return ERROR_NOT_ENOUGH_SERVER_MEMORY;
}
(*entry)->control_pipe = INVALID_HANDLE_VALUE;
(*entry)->status.dwCurrentState = SERVICE_STOPPED;
(*entry)->status.dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
/* all other fields are zero */
return ERROR_SUCCESS;
}
@ -442,10 +445,7 @@ static DWORD scmdatabase_load_services(struct scmdatabase *db)
}
entry->status.dwServiceType = entry->config.dwServiceType;
entry->status.dwCurrentState = SERVICE_STOPPED;
entry->status.dwWin32ExitCode = ERROR_SERVICE_NEVER_STARTED;
entry->db = db;
/* all other fields are zero */
list_add_tail(&db->services, &entry->entry);
}