Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

351 lines
4.9 KiB

  1. /*++
  2. Copyright (c) 1999-2001 Microsoft Corporation
  3. Module Name:
  4. efickmsg.cxx
  5. --*/
  6. #include <pch.cxx>
  7. #define _ULIB_MEMBER_
  8. #include "ulib.hxx"
  9. #include "efiwintypes.hxx"
  10. #include "efickmsg.hxx"
  11. #include "rtmsg.h"
  12. DEFINE_CONSTRUCTOR(EFICHECK_MESSAGE, MESSAGE);
  13. EFICHECK_MESSAGE::~EFICHECK_MESSAGE(
  14. )
  15. /*++
  16. Routine Description:
  17. Destructor for EFICHECK_MESSAGE.
  18. Arguments:
  19. None.
  20. Return Value:
  21. None.
  22. --*/
  23. {
  24. Destroy();
  25. }
  26. VOID
  27. EFICHECK_MESSAGE::Construct(
  28. )
  29. /*++
  30. Routine Description:
  31. This routine initializes the object to a default initial state.
  32. Arguments:
  33. None.
  34. Return Value:
  35. None.
  36. --*/
  37. {
  38. }
  39. VOID
  40. EFICHECK_MESSAGE::Destroy(
  41. )
  42. /*++
  43. Routine Description:
  44. This routine returns the object to a default initial state.
  45. Arguments:
  46. None.
  47. Return Value:
  48. None.
  49. --*/
  50. {
  51. }
  52. BOOLEAN
  53. EFICHECK_MESSAGE::Initialize(
  54. IN BOOLEAN DotsOnly
  55. )
  56. /*++
  57. Routine Description:
  58. This routine initializes the class to a valid initial state.
  59. Arguments:
  60. DotsOnly - efichk should produce only dots instead of messages.
  61. Return Value:
  62. FALSE - Failure.
  63. TRUE - Success.
  64. --*/
  65. {
  66. Destroy();
  67. _dots_only = DotsOnly;
  68. return MESSAGE::Initialize();
  69. }
  70. BOOLEAN
  71. EFICHECK_MESSAGE::DisplayV(
  72. IN PCSTR Format,
  73. IN va_list VarPointer
  74. )
  75. /*++
  76. Routine Description:
  77. This routine displays the message with the specified parameters.
  78. The format string supports all printf options.
  79. Arguments:
  80. Format - Supplies a printf style format string.
  81. VarPointer - Supplies a varargs pointer to the arguments.
  82. Return Value:
  83. FALSE - Failure.
  84. TRUE - Success.
  85. --*/
  86. {
  87. CHAR buffer[256];
  88. DSTRING display_string;
  89. PWSTR dis_str;
  90. if (!BASE_SYSTEM::QueryResourceStringV(&display_string, GetMessageId(), Format,
  91. VarPointer)) {
  92. return FALSE;
  93. }
  94. if (!(dis_str = display_string.QueryWSTR())) {
  95. return FALSE;
  96. }
  97. if(MSG_HIDDEN_STATUS != GetMessageId()) {
  98. Print(dis_str);
  99. }
  100. DELETE(dis_str);
  101. return TRUE;
  102. }
  103. BOOLEAN
  104. EFICHECK_MESSAGE::IsYesResponse(
  105. IN BOOLEAN Default
  106. )
  107. /*++
  108. Routine Description:
  109. This routine queries a response of yes or no.
  110. Arguments:
  111. Default - Supplies a default in the event that a query is not possible.
  112. Return Value:
  113. FALSE - The answer is no.
  114. TRUE - The answer is yes.
  115. --*/
  116. {
  117. CHAR16 input_buf[3];
  118. BOOLEAN retvalue;
  119. while(1) {
  120. Input(TEXT(""), (CHAR16*)&input_buf, 2);
  121. if(input_buf[0] == L'Y' || input_buf[0] == L'y') {
  122. retvalue = TRUE;
  123. break;
  124. } else if(input_buf[0] == L'N' || input_buf[0] == L'n') {
  125. retvalue = FALSE;
  126. break;
  127. }
  128. }
  129. Print(TEXT("\n"));
  130. return retvalue;
  131. //return Default;
  132. }
  133. PMESSAGE
  134. EFICHECK_MESSAGE::Dup(
  135. )
  136. /*++
  137. Routine Description:
  138. This routine returns a new MESSAGE of the same type.
  139. Arguments:
  140. None.
  141. Return Value:
  142. A pointer to a new MESSAGE object.
  143. --*/
  144. {
  145. PEFICHECK_MESSAGE p;
  146. if (!(p = NEW EFICHECK_MESSAGE)) {
  147. return NULL;
  148. }
  149. if (!p->Initialize()) {
  150. DELETE(p);
  151. return NULL;
  152. }
  153. return p;
  154. }
  155. BOOLEAN
  156. EFICHECK_MESSAGE::SetDotsOnly(
  157. IN BOOLEAN DotsOnlyState
  158. )
  159. /*++
  160. Routine Description:
  161. This routine modifies the output mode, changing whether full
  162. output is printed, or just dots.
  163. Arguments:
  164. DotsOnlyState - TRUE if only dots should be printed.
  165. Return Value:
  166. The previous state.
  167. --*/
  168. {
  169. return FALSE;
  170. }
  171. BOOLEAN
  172. EFICHECK_MESSAGE::IsInAutoChk(
  173. )
  174. /*++
  175. Routine Description:
  176. This routine returns TRUE if it is in the regular efichk and not related
  177. to setup. This relys on setup using the /s or /t option all the time.
  178. Arguments:
  179. None.
  180. Return Value:
  181. TRUE - if in regular efichk
  182. --*/
  183. {
  184. return TRUE;
  185. }
  186. BOOLEAN
  187. EFICHECK_MESSAGE::IsKeyPressed(
  188. MSGID MsgId,
  189. ULONG TimeOutInSeconds
  190. )
  191. /*++
  192. Routine Description:
  193. Check to see if the user has hit any key within the timeout period.
  194. Arguments:
  195. MsgId - Supplies the message Id to be displayed
  196. TimeOutInSeconds - Supplies the count down time in seconds
  197. Return Value:
  198. TRUE - A key is pressed within the timeout period.
  199. FALSE - No key has been pressed or there is an error
  200. --*/
  201. {
  202. return FALSE;
  203. }
  204. BOOLEAN
  205. EFICHECK_MESSAGE::WaitForUserSignal(
  206. )
  207. /*++
  208. Routine Description:
  209. Open the keyboard directly and wait to read something.
  210. Arguments:
  211. None:
  212. Return Value:
  213. TRUE - Something was successfully read.
  214. FALSE - An error occured while attempting to open or read.
  215. --*/
  216. {
  217. return TRUE;
  218. }
  219. BOOLEAN
  220. EFICHECK_MESSAGE::QueryStringInput(
  221. OUT PWSTRING String
  222. )
  223. {
  224. CHAR16 buf[80];
  225. Input(TEXT(""), (CHAR16 *)&buf, 79);
  226. DisplayMsg(MSG_BLANK_LINE);
  227. return String->Initialize(buf);
  228. }