Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor ProviderValueAsAscii() #48

Merged
61 changes: 61 additions & 0 deletions DfciPkg/Include/DfciSystemSettingStrings.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
/** @file
DfciSystemSettingStrings.h

These are the setting strings.

Copyright (C) Microsoft Corporation. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

**/

#ifndef __DFCI_SETTING_STRINGS_H__
#define __DFCI_SETTING_STRINGS_H__

//
// DFCI Setting Type
//
#define DFCI_STR_SETTING_TYPE_ENABLE "ENABLE/DISABLE TYPE"
#define DFCI_STR_SETTING_TYPE_SECUREBOOTKEYENUM "SECURE BOOT KEY ENUM TYPE"
#define DFCI_STR_SETTING_TYPE_PASSWORD "PASSWORD TYPE"
#define DFCI_STR_SETTING_TYPE_USBPORTENUM "USB PORT STATE TYPE"
#define DFCI_STR_SETTING_TYPE_STRING "STRING TYPE"
#define DFCI_STR_SETTING_TYPE_BINARY "BINARY TYPE"
#define DFCI_STR_SETTING_TYPE_CERT "CERT TYPE"

//
// Enable/Disable
//
#define DFCI_STR_ENABLED "Enabled"
#define DFCI_STR_DISABLED "Disabled"

//
// Secure Boot Key
//
#define DFCI_STR_SECURE_BOOT_KEY_MS_ONLY "MsOnly"
#define DFCI_STR_SECURE_BOOT_KEY_MS_3RD_PARTY "MsPlus3rdParty"
#define DFCI_STR_SECURE_BOOT_KEY_NONE "None"
#define DFCI_STR_SECURE_BOOT_KEY_CUSTOM "Custom"

//
// System Password
//
#define DFCI_STR_SYSTEM_PASSWORD_SET "System Password Set"
#define DFCI_STR_SYSTEM_PASSWORD_NOT_SET "No System Password"

//
// USB Port State
//
#define DFCI_STR_USB_PORT_ENABLED "UsbPortEnabled"
#define DFCI_STR_USB_PORT_HW_DISABLED "UsbPortHwDisabled"
#define DFCI_STR_USB_PORT_DATA_DISABLED "UsbPortDataDisabled"
#define DFCI_STR_USB_PORT_AUTHENTICATED "UsbPortAuthenticated"

//
// Misc
//
#define DFCI_STR_INCONSISTENT "Inconsistent"
#define DFCI_STR_UNKNOWN "Unknown"
#define DFCI_STR_UNSUPPORTED_VALUE "UnsupportedValue"
#define DFCI_STR_CERT_NOT_AVAILABLE "No Cert information available"

#endif // __DFCI_SETTING_STRINGS_H__
1 change: 1 addition & 0 deletions DfciPkg/SettingsManager/SettingsManager.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent

#include <XmlTypes.h>
#include <DfciSystemSettingTypes.h>
#include <DfciSystemSettingStrings.h>

#include <Guid/DfciInternalVariableGuid.h>
#include <Guid/DfciDeviceIdVariables.h>
Expand Down
22 changes: 11 additions & 11 deletions DfciPkg/SettingsManager/SettingsManagerCurrentSettingXml.c
Original file line number Diff line number Diff line change
Expand Up @@ -175,19 +175,19 @@ CreateXmlStringFromCurrentSettings (
case DFCI_SETTING_TYPE_ENABLE:
switch (Value) {
case ENABLE_FALSE:
ReturnValue = "Disabled";
ReturnValue = DFCI_STR_DISABLED;
break;

case ENABLE_TRUE:
ReturnValue = "Enabled";
ReturnValue = DFCI_STR_ENABLED;
break;

case ENABLE_INCONSISTENT:
ReturnValue = "Inconsistent";
ReturnValue = DFCI_STR_INCONSISTENT;
break;

default:
ReturnValue = "Unknown";
ReturnValue = DFCI_STR_UNKNOWN;
break;
}

Expand All @@ -196,35 +196,35 @@ CreateXmlStringFromCurrentSettings (
case DFCI_SETTING_TYPE_USBPORTENUM:
switch (Value) {
case DfciUsbPortHwDisabled:
ReturnValue = "UsbPortHwDisabled";
ReturnValue = DFCI_STR_USB_PORT_HW_DISABLED;
break;

case DfciUsbPortEnabled:
ReturnValue = "UsbPortEnabled";
ReturnValue = DFCI_STR_USB_PORT_ENABLED;
break;

case DfciUsbPortDataDisabled:
ReturnValue = "UsbPortDataDisabled";
ReturnValue = DFCI_STR_USB_PORT_DATA_DISABLED;
break;

case DfciUsbPortAuthenticated:
ReturnValue = "UsbPortAuthenticated";
ReturnValue = DFCI_STR_USB_PORT_AUTHENTICATED;
break;

case ENABLE_INCONSISTENT:
ReturnValue = "Inconsistent";
ReturnValue = DFCI_STR_INCONSISTENT;
break;

default:
ReturnValue = "UnsupportedValue";
ReturnValue = DFCI_STR_UNSUPPORTED_VALUE;
break;
}

break;

default:
DEBUG ((DEBUG_ERROR, "%a: Group entries for type(%d) not supported\n", __FUNCTION__, GroupType));
ReturnValue = "UnsupportedValue";
ReturnValue = DFCI_STR_UNSUPPORTED_VALUE;
break;
}
}
Expand Down
Loading