Ejemplo n.º 1
0
DWORD
LwSmSrvGetServiceStatus(
    LW_SERVICE_HANDLE hHandle,
    PLW_SERVICE_STATUS pStatus
    )
{
    return LwSmTableGetEntryStatus(hHandle->pEntry, pStatus);
}
Ejemplo n.º 2
0
static
VOID
LwSmTableWatchdog(
    PVOID pContext
    )
{
    DWORD error = 0;
    PSM_TABLE_ENTRY pEntry = pContext;
    PSM_TABLE_ENTRY pOtherEntry = NULL;
    LW_SERVICE_STATUS status = {0};
    PWSTR* ppServices = NULL;
    DWORD index = 0;

    error = LwSmTableStartRecursive(pEntry);
    BAIL_ON_ERROR(error);

    /* See if any reverse dependencies changed state without announcing it */
    error = LwSmTableGetEntryReverseDependencyClosure(pEntry, &ppServices);
    BAIL_ON_ERROR(error);

    for (index = 0; ppServices[index]; index++)
    {
        error = LwSmTableGetEntry(ppServices[index], &pOtherEntry);
        BAIL_ON_ERROR(error);

        error = LwSmTableGetEntryStatus(pOtherEntry, &status);
        BAIL_ON_ERROR(error);

        if (status.state == LW_SERVICE_STATE_DEAD)
        {
            (void) LwSmTableStartRecursive(pOtherEntry);
        }

        LwSmTableReleaseEntry(pOtherEntry);
        pOtherEntry = NULL;
    }

error:

    if (ppServices)
    {
        LwSmFreeStringList(ppServices);
    }

    if (pOtherEntry)
    {
        LwSmTableReleaseEntry(pOtherEntry);
    }

    LwSmTableReleaseEntry(pEntry);

    return;
}