in LCM/dsc/engine/ConfigurationManager/LocalConfigManagerHelper.c [5151:5298]
MI_Result UpdateDefaultValueForMetaConfig(
_Inout_ MI_Instance* self)
{
MI_Result r = MI_RESULT_OK;
MI_Value value;
MI_Uint32 flags;
MI_Uint32 factor = 0;
MI_Value refreshFrequencyMins;
MI_Value configurationModeFrequencyMins;
overWroteUserSpecifiedRefreshFreqMins=NULL; //Reset this to Null since this function is called by both InitMetaConfig , and SetMetaConfig.
overWroteUserSpecifiedConfModeFreqMins = NULL; //Reset this to Null since this function is called by both InitMetaConfig , and SetMetaConfig.
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RefreshFrequencyMins, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL || value.uint32 < DEFAULT_MinRefreshFrequencyMins || value.uint32 > DEFAULT_MaxRefreshFrequencyMins)
{
if(value.uint32 < DEFAULT_MinRefreshFrequencyMins)
{
value.uint32 = DEFAULT_MinRefreshFrequencyMins;
overWroteUserSpecifiedRefreshFreqMins = DEFAULT_MinRefreshFrequencyMinsString;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RefreshFrequencyMins, &value, MI_UINT32, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
else
{
value.uint32 = DEFAULT_MaxRefreshFrequencyMins;
overWroteUserSpecifiedRefreshFreqMins = DEFAULT_MaxRefreshFrequencyMinsString;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RefreshFrequencyMins, &value, MI_UINT32, 0);
if(r != MI_RESULT_OK)
{
return r;
}
}
}
refreshFrequencyMins = value;
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_ConfigurationModeFrequencyMins, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL || value.uint32 < DEFAULT_ConfigurationModeFrequencyMins)
{
value.uint32 = DEFAULT_ConfigurationModeFrequencyMins;
overWroteUserSpecifiedConfModeFreqMins = DEFAULT_ConfigurationModueFrequencyMinsString;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_ConfigurationModeFrequencyMins, &value, MI_UINT32, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
configurationModeFrequencyMins = value;
// refresh should be a whole number factor of configuration
factor = configurationModeFrequencyMins.uint32 % refreshFrequencyMins.uint32;
if(factor != 0)
{
overWroteUserSpecifiedConfModeFreqMins = DEFAULT_ConfigurationModueFrequencyMinsString;
//There are two cases: 1.) configurationModeFrequencyMins > refreshFrequencyMins. In this case, the factor obtained by dividing the two will be greater than 1
// 2.) configurationModeFrequencyMins < refreshFrequencyMins. In this case the factor will be 0 and so we should set it to refreshFrequencyMins
factor = (MI_Uint32)(configurationModeFrequencyMins.uint32 / refreshFrequencyMins.uint32);
if(factor > 0)
{
configurationModeFrequencyMins.uint32 = refreshFrequencyMins.uint32 * (factor + 1);
}
else
{
configurationModeFrequencyMins.uint32 = refreshFrequencyMins.uint32;
}
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_ConfigurationModeFrequencyMins,
&configurationModeFrequencyMins, MI_UINT32, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_ConfigurationMode, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL)
{
value.string = DEFAULT_ConfigurationMode;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_ConfigurationMode, &value, MI_STRING, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RebootNodeIfNeeded, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL)
{
value.boolean = DEFAULT_RebootNodeIfNeeded;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RebootNodeIfNeeded, &value, MI_BOOLEAN, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RefreshMode, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL)
{
value.string = DEFAULT_RefreshMode;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_RefreshMode, &value, MI_STRING, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
r = DSC_MI_Instance_GetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_AllowModuleOverwrite, &value, NULL, &flags, NULL);
if (r != MI_RESULT_OK)
{
return r;
}
else if (flags & MI_FLAG_NULL)
{
value.boolean = DEFAULT_AllowModuleOverwrite;
r = MI_Instance_SetElement((MI_Instance*)self, MSFT_DSCMetaConfiguration_AllowModuleOverwrite, &value, MI_BOOLEAN, 0);
if (r != MI_RESULT_OK)
{
return r;
}
}
return MI_RESULT_OK;
}