+// Returns TRUE if *Input contains nothing but valid hexadecimal characters,
+// FALSE otherwise. Note that a leading "0x" is NOT acceptable in the input!
+BOOLEAN IsValidHex(CHAR16 *Input) {
+ BOOLEAN IsHex = TRUE;
+ UINTN i = 0;
+
+ while ((Input[i] != L'\0') && IsHex) {
+ if (!(((Input[i] >= L'0') && (Input[i] <= L'9')) ||
+ ((Input[i] >= L'A') && (Input[i] <= L'F')) ||
+ ((Input[i] >= L'a') && (Input[i] <= L'f')))) {
+ IsHex = FALSE;
+ }
+ i++;
+ } // while
+ return IsHex;
+} // BOOLEAN IsValidHex()
+