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.

89 lines
1.6 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. }
  25. virtual
  26. ~W3_STATE()
  27. {
  28. }
  29. //
  30. // The main state machine driver function. This function executes the
  31. // current state
  32. //
  33. virtual
  34. CONTEXT_STATUS
  35. DoWork(
  36. W3_MAIN_CONTEXT * pW3Context,
  37. DWORD cbCompletion,
  38. DWORD dwCompletionStatus
  39. ) = 0;
  40. virtual
  41. CONTEXT_STATUS
  42. OnCompletion(
  43. W3_MAIN_CONTEXT *,
  44. DWORD,
  45. DWORD
  46. )
  47. {
  48. return CONTEXT_STATUS_CONTINUE;
  49. }
  50. //
  51. // For debugging purposes, every state has a name
  52. //
  53. virtual
  54. WCHAR *
  55. QueryName(
  56. VOID
  57. ) = 0;
  58. //
  59. // On construction, any errors can be communicated by setting _hr.
  60. //
  61. HRESULT
  62. QueryResult(
  63. VOID
  64. ) const
  65. {
  66. return _hr;
  67. }
  68. protected:
  69. HRESULT _hr;
  70. };
  71. typedef W3_STATE * PW3_STATE;
  72. #endif