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.

191 lines
8.4 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_ServiceFlags 0x12
  61. #define IApp_PartitionGUID 0x13
  62. #define IApp_SxsName 0x14
  63. #define IApp_MAX 0x15
  64. // flags within IApp_ServiceFlags
  65. #define IFlag_SF_TrackerEnabled 1
  66. #define IFlag_SF_SxsEnabled 2
  67. #define IFlag_SF_UsePartition 4
  68. // Index to glob's szMessage array.
  69. #define IAppMsg_SCRIPTERROR 0
  70. #define IAppMsg_SCRIPTLANGUAGE 1
  71. #define IAppMsg_PARTITIONGUID 2
  72. #define IAppMsg_SXSNAME 3
  73. #define APP_CONFIG_MESSAGEMAX 4
  74. // Glob data object
  75. class CAppConfig
  76. {
  77. friend class CMDAppConfigSink;
  78. friend HRESULT ReadConfigFromMD(CIsapiReqInfo *pIReq, CAppConfig *pAppConfig, BOOL fLoadGlob);
  79. friend HRESULT SetConfigToDefaults(CAppConfig *pAppConfig, BOOL fLoadGlob);
  80. private:
  81. CAppln *m_pAppln;
  82. BOOL m_fNeedUpdate;
  83. BOOL m_fInited:1;
  84. BOOL m_fRestartEnabledUpdated:1;
  85. BOOL m_fIsValidProglangCLSID:1;
  86. BOOL m_fIsValidPartitionGUID:1;
  87. /*
  88. * Configurable values from Metabase
  89. */
  90. BOOL m_fScriptErrorsSentToBrowser;
  91. BOOL m_fBufferingOn; // Is buffering on by default?
  92. BOOL m_fEnableParentPaths;
  93. BOOL m_fAllowSessionState;
  94. BOOL m_fAllowOutOfProcCmpnts;
  95. BOOL m_fAllowDebugging;
  96. BOOL m_fAllowClientDebug;
  97. BOOL m_fEnableApplicationRestart;
  98. BOOL m_fKeepSessionIDSecure;
  99. UINT m_uCodePage;
  100. DWORD m_dwScriptTimeout;
  101. DWORD m_dwSessionTimeout;
  102. DWORD m_dwQueueTimeout;
  103. CLSID m_DefaultScriptEngineProgID;
  104. DWORD m_dwQueueConnectionTestTime;
  105. DWORD m_dwSessionMax;
  106. BOOL m_fExecuteInMTA;
  107. LCID m_uLCID;
  108. CLSID m_PartitionGUID;
  109. BOOL m_fSxsEnabled;
  110. BOOL m_fTrackerEnabled;
  111. BOOL m_fUsePartition;
  112. IMSAdminBase *m_pMetabase;
  113. CMDAppConfigSink *m_pMetabaseSink;
  114. DWORD m_dwMDSinkCookie;
  115. LPSTR m_szString[APP_CONFIG_MESSAGEMAX];
  116. //Private functions
  117. HRESULT SetValue(unsigned int index, BYTE *lpByte);
  118. public:
  119. CAppConfig();
  120. HRESULT Init(CIsapiReqInfo *pIReq, CAppln *pAppln);
  121. HRESULT UnInit(void);
  122. void NotifyNeedUpdate(void);
  123. BOOL fNeedUpdate() {return m_fNeedUpdate;};
  124. BOOL fRestartEnabledUpdated() {return m_fRestartEnabledUpdated;};
  125. void NotifyRestartEnabledUpdated() { m_fRestartEnabledUpdated = TRUE;};
  126. HRESULT Update(CIsapiReqInfo *pIReq);
  127. UINT uCodePage() {return m_uCodePage;};
  128. DWORD dwSessionTimeout() {return m_dwSessionTimeout;};
  129. DWORD dwQueueTimeout() {return m_dwQueueTimeout;};
  130. DWORD dwScriptTimeout() {return m_dwScriptTimeout;};
  131. BOOL fScriptErrorsSentToBrowser() {return m_fScriptErrorsSentToBrowser;};
  132. BOOL fBufferingOn() {return m_fBufferingOn;};
  133. BOOL fEnableParentPaths() {return !m_fEnableParentPaths;};
  134. BOOL fAllowSessionState() {return m_fAllowSessionState;};
  135. BOOL fAllowOutOfProcCmpnts() {return m_fAllowOutOfProcCmpnts;};
  136. BOOL fAllowDebugging() {return m_fAllowDebugging;};
  137. BOOL fAllowClientDebug() {return m_fAllowClientDebug;};
  138. BOOL fInited() {return m_fInited;};
  139. BOOL fKeepSessionIDSecure() {return m_fKeepSessionIDSecure;};
  140. BOOL fExecuteInMTA() {return m_fExecuteInMTA;};
  141. LCID uLCID() {return m_uLCID; };
  142. LPCSTR szScriptErrorMessage() {return (m_szString[IAppMsg_SCRIPTERROR]);};
  143. LPCSTR szScriptLanguage() {return (m_szString[IAppMsg_SCRIPTLANGUAGE]);};
  144. CLSID *pCLSIDDefaultEngine() {return m_fIsValidProglangCLSID? &m_DefaultScriptEngineProgID : NULL;};
  145. BOOL fSxsEnabled() {return m_fSxsEnabled;};
  146. BOOL fTrackerEnabled() {return m_fTrackerEnabled;};
  147. BOOL fUsePartition() {return m_fUsePartition;};
  148. CLSID *PPartitionGUID() {return m_fIsValidPartitionGUID ? & m_PartitionGUID : NULL;};
  149. LPCSTR szSxsName() {return (m_szString[IAppMsg_SXSNAME]);};
  150. BOOL fEnableApplicationRestart() { return m_fEnableApplicationRestart; }
  151. DWORD dwQueueConnectionTestTime() { return m_dwQueueConnectionTestTime; }
  152. DWORD dwSessionMax() { return m_dwSessionMax; }
  153. LPTSTR SzMDPath();
  154. };
  155. inline void CAppConfig::NotifyNeedUpdate(void)
  156. {
  157. InterlockedExchange((LPLONG)&m_fNeedUpdate, 1);
  158. }
  159. #endif // __APPCNFG_H