Beispiel #1
0
NTSTATUS
SrvReadConfig(
    PLWIO_SRV_CONFIG pConfig
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    LWIO_SRV_CONFIG srvConfig = {0};
    PLWIO_CONFIG_REG pReg = NULL;
    BOOLEAN bUsePolicy = TRUE;

    ntStatus = SrvInitConfig(&srvConfig);
    BAIL_ON_NT_STATUS(ntStatus);

    ntStatus = LwIoOpenConfig(
                    "Services\\lwio\\Parameters\\Drivers\\srv",
                    "Policy\\Services\\lwio\\Parameters\\Drivers\\srv",
                    &pReg);
    if (ntStatus)
    {
        LWIO_LOG_ERROR("Failed to access device configuration [error code: %u]",
                       ntStatus);

        ntStatus = STATUS_DEVICE_CONFIGURATION_ERROR;
    }
    BAIL_ON_NT_STATUS(ntStatus);

    /* Ignore error as it may not exist; we can still use default. */
    LwIoReadConfigBoolean(
            pReg,
            "BootstrapDefaultSharePath",
            bUsePolicy,
            &srvConfig.bBootstrapDefaultSharePath);

    /* Ignore error as it may not exist; we can still use default. */
    LwIoReadConfigDword(
            pReg,
            "MonitorIntervalMinutes",
            bUsePolicy,
            LWIO_SRV_DEFAULT_MONITOR_INTERVAL_MINS_MIN,
            LWIO_SRV_DEFAULT_MONITOR_INTERVAL_MINS_MAX,
            &srvConfig.ulMonitorIntervalMinutes);

    ntStatus = SrvTransferConfigContents(&srvConfig, pConfig);
    BAIL_ON_NT_STATUS(ntStatus);

cleanup:

    if (pReg)
    {
        LwIoCloseConfig(pReg);
    }

    SrvFreeConfigContents(&srvConfig);

    return ntStatus;

error:

    goto cleanup;
}
Beispiel #2
0
NTSTATUS
SrvStatsConfigRead(
    PSRV_STATISTICS_CONFIG pConfig
    )
{
    NTSTATUS ntStatus = STATUS_SUCCESS;
    SRV_STATISTICS_CONFIG config = { 0 };
    PLWIO_CONFIG_REG pReg = NULL;
    BOOLEAN bUsePolicy = TRUE;

    ntStatus = SrvStatsConfigInitContents(&config);
    BAIL_ON_NT_STATUS(ntStatus);

    ntStatus = LwIoOpenConfig(
                "Services\\lwio\\Parameters\\Drivers\\srv\\statistics",
                "Policy\\Services\\lwio\\Parameters\\Drivers\\srv\\statistics",
                &pReg);
    if (ntStatus)
    {
        LWIO_LOG_ERROR(
            "Failed to access device statistics configuration [error code: %u]",
            ntStatus);

        ntStatus = STATUS_DEVICE_CONFIGURATION_ERROR;
    }
    BAIL_ON_NT_STATUS(ntStatus);

    /* Ignore error as it may not exist; we can still use default. */
    LwIoReadConfigString(
            pReg,
            "Path",
            bUsePolicy,
            &config.pszProviderPath);

    LwIoReadConfigBoolean(
            pReg,
            "EnableLogging",
            bUsePolicy,
            &config.bEnableLogging);

    ntStatus = SrvStatsConfigTransferContents(&config, pConfig);
    BAIL_ON_NT_STATUS(ntStatus);

cleanup:

    if (pReg)
    {
        LwIoCloseConfig(pReg);
    }

    return ntStatus;

error:

    SrvStatsConfigFreeContents(&config);

    goto cleanup;
}