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.

130 lines
2.7 KiB

  1. /*++
  2. Copyright (c) 1999 Microsoft Corporation
  3. Module Name :
  4. ooptoken.h
  5. Abstract:
  6. Header file for the CWamOopTokenInfo object
  7. Author:
  8. Taylor Weiss ( TaylorW ) 15-Feb-1999
  9. Environment:
  10. User Mode - Win32
  11. Project:
  12. iis\svcs\wam\object
  13. --*/
  14. # ifndef _OOP_TOKEN_H_
  15. # define _OOP_TOKEN_H_
  16. class CWamOopTokenInfo
  17. /*++
  18. Class description:
  19. Class enables modifcation of the impersonation token used for
  20. OOP applications. Holds SIDs for the WAM_* user account and the
  21. system account. And provides ModifyTokenForOop() to add access
  22. allowed aces to the token's default dacl. See NT Bug 259045 for
  23. details on why this is necessary.
  24. Singleton object. The Create/Destroy methods initilize a static
  25. instance.
  26. Public Interface:
  27. static Create : Create the instance. Should be called once
  28. from global initialization code.
  29. static Destroy : Clean up the instance. Should be called once
  30. from global cleanup code.
  31. static QueryInstance/HasInstance : intance accessors
  32. ModifyTokenForOop : Do the work of modifying the tokens default
  33. DACL.
  34. --*/
  35. {
  36. public:
  37. static
  38. HRESULT Create( VOID );
  39. static
  40. VOID Destroy( VOID )
  41. {
  42. DBG_ASSERT( ms_pInstance != NULL );
  43. delete ms_pInstance;
  44. ms_pInstance = NULL;
  45. }
  46. static
  47. CWamOopTokenInfo * QueryInstance( VOID )
  48. {
  49. DBG_ASSERT( ms_pInstance != NULL );
  50. return ms_pInstance;
  51. }
  52. static
  53. BOOL HasInstance( VOID )
  54. {
  55. return ( ms_pInstance != NULL );
  56. }
  57. HRESULT ModifyTokenForOop
  58. (
  59. HANDLE hThreadToken
  60. );
  61. private:
  62. CWamOopTokenInfo()
  63. : m_pIWAMUserSid( NULL ),
  64. m_cbIWAMUserSid( 0 ),
  65. m_pSystemSid( NULL ),
  66. m_cbSystemSid( 0 )
  67. {
  68. }
  69. ~CWamOopTokenInfo()
  70. {
  71. DBG_ASSERT( m_pIWAMUserSid );
  72. if( m_pIWAMUserSid )
  73. {
  74. LocalFree( m_pIWAMUserSid );
  75. }
  76. DBG_ASSERT( m_pSystemSid );
  77. if( m_pSystemSid )
  78. {
  79. LocalFree( m_pSystemSid );
  80. }
  81. }
  82. HRESULT SetIWAMUserSid
  83. (
  84. PSID pSid
  85. );
  86. HRESULT SetSystemSid
  87. (
  88. PSID pSid
  89. );
  90. private:
  91. PSID m_pIWAMUserSid;
  92. DWORD m_cbIWAMUserSid;
  93. PSID m_pSystemSid;
  94. DWORD m_cbSystemSid;
  95. static CWamOopTokenInfo * ms_pInstance;
  96. };
  97. #endif _OOP_TOKEN_H_