Leaked source code of windows server 2003
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.

267 lines
6.1 KiB

  1. //#--------------------------------------------------------------
  2. //
  3. // File: display.cpp
  4. //
  5. // Synopsis: Implementation of CDisplay class methods
  6. //
  7. //
  8. // History: MKarki Created 5/27/99
  9. //
  10. // Copyright (C) 1999-2000 Microsoft Corporation
  11. // All rights reserved.
  12. //
  13. //----------------------------------------------------------------
  14. #include "stdafx.h"
  15. #include "display.h"
  16. #include <satrace.h>
  17. //++--------------------------------------------------------------
  18. //
  19. // Function: Shutdown
  20. //
  21. // Synopsis: This is the CDipslay class public method which is
  22. // used to send the Shutdown message
  23. //
  24. // Arguments: none
  25. //
  26. // Returns: HRESULT - success/failure
  27. //
  28. // History: MKarki Created 5/27/99
  29. //
  30. //----------------------------------------------------------------
  31. HRESULT
  32. CDisplay::Shutdown (
  33. VOID
  34. )
  35. {
  36. SATraceString ("LocalUI display showing 'Shutdown' message...");
  37. HRESULT hr = S_OK;
  38. do
  39. {
  40. //
  41. // check if the display object is initialized
  42. //
  43. if (!m_bInitialized)
  44. {
  45. hr = InternalInitialize ();
  46. if (FAILED (hr)) {break;}
  47. }
  48. //
  49. // display the shutdown message on the LCD now
  50. //
  51. hr = m_pSaDisplay->ShowRegistryBitmap (SA_DISPLAY_SHUTTING_DOWN);
  52. if (FAILED (hr)) {break;}
  53. //
  54. // success
  55. //
  56. }
  57. while (false);
  58. return (hr);
  59. } // end of CDisplay::Shutdown method
  60. //++--------------------------------------------------------------
  61. //
  62. // Function: Busy
  63. //
  64. // Synopsis: This is the CDisplay class public method which is
  65. // used to sends the busy message bitmap
  66. //
  67. // Arguments: none
  68. //
  69. // Returns: HRESULT - success/failure
  70. //
  71. // History: MKarki Created 5/27/99
  72. //
  73. //----------------------------------------------------------------
  74. HRESULT
  75. CDisplay::Busy (
  76. VOID
  77. )
  78. {
  79. SATraceString ("LocalUI display class showing 'Busy' message...");
  80. HRESULT hr = S_OK;
  81. do
  82. {
  83. //
  84. // check if the display object is initialized
  85. //
  86. if (!m_bInitialized)
  87. {
  88. hr = InternalInitialize ();
  89. if (FAILED (hr)) {break;}
  90. }
  91. //
  92. // display the busy on the LCD now
  93. //
  94. hr = m_pSaDisplay->ShowRegistryBitmap (SA_DISPLAY_CHECK_DISK);
  95. if (FAILED (hr)) {break;}
  96. //
  97. // success
  98. //
  99. }
  100. while (false);
  101. return (hr);
  102. } // end of CDisplay::Busy method
  103. //++--------------------------------------------------------------
  104. //
  105. // Function: Lock
  106. //
  107. // Synopsis: This is the CDisplay class public method which is
  108. // used to lock the localui display
  109. //
  110. // Arguments: none
  111. //
  112. // Returns: HRESULT - success/failure
  113. //
  114. // History: MKarki Created 7/3/99
  115. //
  116. //----------------------------------------------------------------
  117. HRESULT
  118. CDisplay::Lock (
  119. VOID
  120. )
  121. {
  122. SATraceString ("LocalUI locking driver ...");
  123. HRESULT hr = S_OK;
  124. do
  125. {
  126. //
  127. // check if the display object is initialized
  128. //
  129. if (!m_bInitialized)
  130. {
  131. hr = InternalInitialize ();
  132. if (FAILED (hr)) {break;}
  133. }
  134. //
  135. // lock the driver now
  136. //
  137. hr = m_pSaDisplay->Lock();
  138. if (FAILED (hr)) {break;}
  139. //
  140. // success
  141. //
  142. }
  143. while (false);
  144. return (hr);
  145. } // end of CDisplay::Lock method
  146. //++--------------------------------------------------------------
  147. //
  148. // Function: UnLock
  149. //
  150. // Synopsis: This is the CDisplay class public method which is
  151. // used to unlock the localui display
  152. //
  153. // Arguments: none
  154. //
  155. // Returns: HRESULT - success/failure
  156. //
  157. // History: MKarki Created 7/3/99
  158. //
  159. //----------------------------------------------------------------
  160. HRESULT
  161. CDisplay::Unlock (
  162. VOID
  163. )
  164. {
  165. SATraceString ("Localui Display class unlocking driver ...");
  166. HRESULT hr = S_OK;
  167. do
  168. {
  169. //
  170. // check if the display object is initialized
  171. //
  172. if (!m_bInitialized)
  173. {
  174. hr = InternalInitialize ();
  175. if (FAILED (hr)) {break;}
  176. }
  177. //
  178. // unlock the driver now
  179. //
  180. hr = m_pSaDisplay->UnLock();
  181. if (FAILED (hr)) {break;}
  182. //
  183. // success
  184. //
  185. }
  186. while (false);
  187. return (hr);
  188. } // end of CDisplay::Unlock method
  189. //++--------------------------------------------------------------
  190. //
  191. // Function: InternalInitialize
  192. //
  193. // Synopsis: This is the CDisplay class private method which is
  194. // initializes the CDisplay class object
  195. //
  196. // Arguments: none
  197. //
  198. // Returns: HRESULT - success/failure
  199. //
  200. // History: MKarki Created 6/10/99
  201. //
  202. // Called By: CDisplay public methods
  203. //
  204. //----------------------------------------------------------------
  205. HRESULT
  206. CDisplay::InternalInitialize (
  207. VOID
  208. )
  209. {
  210. CSATraceFunc ("CDisplay::InternalInitialize");
  211. HRESULT hr = S_OK;
  212. do
  213. {
  214. hr = CoInitialize(NULL);
  215. if (FAILED(hr)) {break;}
  216. //
  217. // create the display helper component
  218. //
  219. hr = CoCreateInstance(
  220. CLSID_SaDisplay,
  221. NULL,
  222. CLSCTX_INPROC_SERVER,
  223. IID_ISaDisplay,
  224. (void**)&m_pSaDisplay
  225. );
  226. if (FAILED(hr))
  227. {
  228. SATracePrintf("CDisplay::InternalInitialize failed on CoCreateInstance, %d",hr);
  229. break;
  230. }
  231. m_bInitialized = TRUE;
  232. }
  233. while (false);
  234. return (hr);
  235. } // end of CDisplay::InternalInitialize method