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.

172 lines
7.3 KiB

  1. /*===================================================================
  2. Microsoft Denali
  3. Microsoft Confidential.
  4. Copyright 1996 Microsoft Corporation. All Rights Reserved.
  5. Component: Globals
  6. File: AppCnfg.h
  7. Owner: AndrewS
  8. Useful globals
  9. ===================================================================*/
  10. #ifndef __APPCNFG_H
  11. #define __APPCNFG_H
  12. #include "util.h"
  13. #include <schnlsp.h>
  14. #include <wincrypt.h>
  15. #include <iadmw.h>
  16. extern "C" {
  17. #define SECURITY_WIN32
  18. #include <sspi.h> // Security Support Provider APIs
  19. }
  20. class CAppln; // forward declaration
  21. class CAppConfig;
  22. class CMDAppConfigSink : public IMSAdminBaseSinkW
  23. {
  24. private:
  25. INT m_cRef;
  26. CAppConfig *m_pAppConfig;
  27. public:
  28. CMDAppConfigSink (CAppConfig *pAppConfig) {m_cRef = 1; m_pAppConfig = pAppConfig;};
  29. HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void **ppv);
  30. ULONG STDMETHODCALLTYPE AddRef(void);
  31. ULONG STDMETHODCALLTYPE Release(void);
  32. HRESULT STDMETHODCALLTYPE SinkNotify(
  33. DWORD dwMDNumElements,
  34. MD_CHANGE_OBJECT __RPC_FAR pcoChangeList[]);
  35. HRESULT STDMETHODCALLTYPE ShutdownNotify( void)
  36. {
  37. return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
  38. }
  39. };
  40. // Index used in ReadPropsfromRegistry(). Also, we can use the same index to enable the global
  41. // data to be table-driven.
  42. #define IApp_AllowSessionState 0x0
  43. #define IApp_BufferingOn 0x1
  44. #define IApp_ScriptLanguage 0x2
  45. #define IApp_EnableParentPaths 0x3
  46. #define IApp_ScriptErrorMessage 0x4
  47. #define IApp_SessionTimeout 0x5
  48. #define IApp_CodePage 0x6
  49. #define IApp_ScriptTimeout 0x7
  50. #define IApp_ScriptErrorsSenttoBrowser 0x8
  51. #define IApp_AllowDebugging 0x9
  52. #define IApp_AllowClientDebug 0xa
  53. #define IApp_QueueTimeout 0xb
  54. #define IApp_EnableApplicationRestart 0xc
  55. #define IApp_QueueConnectionTestTime 0xd
  56. #define IApp_SessionMax 0xe
  57. #define IApp_ExecuteInMTA 0xf
  58. #define IApp_LCID 0x10
  59. #define IApp_KeepSessionIDSecure 0x11
  60. #define IApp_MAX 0x12
  61. // Index to glob's szMessage array.
  62. #define IAppMsg_SCRIPTERROR 0
  63. #define IAppMsg_SCRIPTLANGUAGE 1
  64. #define APP_CONFIG_MESSAGEMAX 2
  65. // Glob data object
  66. class CAppConfig
  67. {
  68. friend class CMDAppConfigSink;
  69. friend HRESULT ReadConfigFromMD(CIsapiReqInfo *pIReq, CAppConfig *pAppConfig, BOOL fLoadGlob);
  70. friend HRESULT SetConfigToDefaults(CAppConfig *pAppConfig, BOOL fLoadGlob);
  71. private:
  72. CAppln *m_pAppln;
  73. BOOL m_fNeedUpdate;
  74. BOOL m_fInited:1;
  75. BOOL m_fRestartEnabledUpdated:1;
  76. BOOL m_fIsValidProglangCLSID:1;
  77. /*
  78. * Configurable values from Metabase
  79. */
  80. BOOL m_fScriptErrorsSentToBrowser;
  81. BOOL m_fBufferingOn; // Is buffering on by default?
  82. BOOL m_fEnableParentPaths;
  83. BOOL m_fAllowSessionState;
  84. BOOL m_fAllowOutOfProcCmpnts;
  85. BOOL m_fAllowDebugging;
  86. BOOL m_fAllowClientDebug;
  87. BOOL m_fEnableApplicationRestart;
  88. BOOL m_fKeepSessionIDSecure;
  89. UINT m_uCodePage;
  90. DWORD m_dwScriptTimeout;
  91. DWORD m_dwSessionTimeout;
  92. DWORD m_dwQueueTimeout;
  93. CLSID m_DefaultScriptEngineProgID;
  94. DWORD m_dwQueueConnectionTestTime;
  95. DWORD m_dwSessionMax;
  96. BOOL m_fExecuteInMTA;
  97. LCID m_uLCID;
  98. IMSAdminBase *m_pMetabase;
  99. CMDAppConfigSink *m_pMetabaseSink;
  100. DWORD m_dwMDSinkCookie;
  101. LPSTR m_szString[APP_CONFIG_MESSAGEMAX];
  102. //Private functions
  103. HRESULT SetValue(unsigned int index, BYTE *lpByte);
  104. public:
  105. CAppConfig();
  106. HRESULT Init(CIsapiReqInfo *pIReq, CAppln *pAppln);
  107. HRESULT UnInit(void);
  108. void NotifyNeedUpdate(void);
  109. BOOL fNeedUpdate() {return m_fNeedUpdate;};
  110. BOOL fRestartEnabledUpdated() {return m_fRestartEnabledUpdated;};
  111. void NotifyRestartEnabledUpdated() { m_fRestartEnabledUpdated = TRUE;};
  112. HRESULT Update(CIsapiReqInfo *pIReq);
  113. UINT uCodePage() {return m_uCodePage;};
  114. DWORD dwSessionTimeout() {return m_dwSessionTimeout;};
  115. DWORD dwQueueTimeout() {return m_dwQueueTimeout;};
  116. DWORD dwScriptTimeout() {return m_dwScriptTimeout;};
  117. BOOL fScriptErrorsSentToBrowser() {return m_fScriptErrorsSentToBrowser;};
  118. BOOL fBufferingOn() {return m_fBufferingOn;};
  119. BOOL fEnableParentPaths() {return !m_fEnableParentPaths;};
  120. BOOL fAllowSessionState() {return m_fAllowSessionState;};
  121. BOOL fAllowOutOfProcCmpnts() {return m_fAllowOutOfProcCmpnts;};
  122. BOOL fAllowDebugging() {return m_fAllowDebugging;};
  123. BOOL fAllowClientDebug() {return m_fAllowClientDebug;};
  124. BOOL fInited() {return m_fInited;};
  125. BOOL fKeepSessionIDSecure() {return m_fKeepSessionIDSecure;};
  126. BOOL fExecuteInMTA() {return m_fExecuteInMTA;};
  127. LCID uLCID() {return m_uLCID; };
  128. LPCSTR szScriptErrorMessage() {return (m_szString[IAppMsg_SCRIPTERROR]);};
  129. LPCSTR szScriptLanguage() {return (m_szString[IAppMsg_SCRIPTLANGUAGE]);};
  130. CLSID *pCLSIDDefaultEngine() {return m_fIsValidProglangCLSID? &m_DefaultScriptEngineProgID : NULL;};
  131. BOOL fEnableApplicationRestart() { return m_fEnableApplicationRestart; }
  132. DWORD dwQueueConnectionTestTime() { return m_dwQueueConnectionTestTime; }
  133. DWORD dwSessionMax() { return m_dwSessionMax; }
  134. LPTSTR SzMDPath();
  135. };
  136. inline void CAppConfig::NotifyNeedUpdate(void)
  137. {
  138. InterlockedExchange((LPLONG)&m_fNeedUpdate, 1);
  139. }
  140. #endif // __APPCNFG_H