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.

105 lines
2.0 KiB

  1. #ifndef _W3STATE_HXX_
  2. #define _W3STATE_HXX_
  3. class W3_MAIN_CONTEXT;
  4. //
  5. // Status from the execution of a given state
  6. //
  7. enum CONTEXT_STATUS
  8. {
  9. CONTEXT_STATUS_PENDING,
  10. CONTEXT_STATUS_CONTINUE
  11. };
  12. //
  13. // All new states implement a W3_STATE class. All global initalization for
  14. // the state occurs when constructing the object. Part of the ULW3.DLL
  15. // startup is to create the various W3_STATE objects which participate in the
  16. // state machine. For example, W3_STATE_LOG, W3_STATE_AUTHENTICATION
  17. //
  18. class W3_STATE
  19. {
  20. public:
  21. W3_STATE()
  22. {
  23. _hr = NO_ERROR;
  24. _cbContextSize = 0;
  25. }
  26. virtual
  27. ~W3_STATE()
  28. {
  29. }
  30. //
  31. // The main state machine driver function. This function executes the
  32. // current state
  33. //
  34. virtual
  35. CONTEXT_STATUS
  36. DoWork(
  37. W3_MAIN_CONTEXT * pW3Context,
  38. DWORD cbCompletion,
  39. DWORD dwCompletionStatus
  40. ) = 0;
  41. virtual
  42. CONTEXT_STATUS
  43. OnCompletion(
  44. W3_MAIN_CONTEXT * pW3Context,
  45. DWORD cbCompletion,
  46. DWORD dwCompletionStatus
  47. )
  48. {
  49. return CONTEXT_STATUS_CONTINUE;
  50. }
  51. //
  52. // For debugging purposes, every state has a name
  53. //
  54. virtual
  55. WCHAR *
  56. QueryName(
  57. VOID
  58. ) = 0;
  59. //
  60. // On construction, any errors can be communicated by setting _hr.
  61. //
  62. HRESULT
  63. QueryResult(
  64. VOID
  65. ) const
  66. {
  67. return _hr;
  68. }
  69. //
  70. // On construction, the state object can specify the size of the
  71. // state object (if any) it will be attaching to context. This size is useful
  72. // for allocation managers which want to set aside space for these objects
  73. //
  74. USHORT
  75. QueryContextSize(
  76. VOID
  77. ) const
  78. {
  79. return _cbContextSize;
  80. }
  81. protected:
  82. HRESULT _hr;
  83. USHORT _cbContextSize;
  84. };
  85. typedef W3_STATE * PW3_STATE;
  86. #endif