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.

350 lines
10 KiB

  1. #ifndef __ConfPolicies_h__
  2. #define __ConfPolicies_h__
  3. #include "resource.h"
  4. #include "ConfUtil.h"
  5. #include "ConfReg.h"
  6. extern bool g_bAutoAccept;
  7. namespace ConfPolicies
  8. {
  9. #if USE_GAL
  10. inline bool IsGetMyInfoFromGALEnabled( void )
  11. {
  12. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  13. return rePol.GetNumber( REGVAL_POL_GAL_USE, DEFAULT_POL_GAL_USE ) ? true : false ;
  14. }
  15. inline bool GetMyInfoFromGALSucceeded( void )
  16. {
  17. RegEntry reIsapi( ISAPI_KEY, HKEY_CURRENT_USER );
  18. if( NULL == reIsapi.GetString( REGVAL_ULS_FIRST_NAME ) ||
  19. NULL == reIsapi.GetString( REGVAL_ULS_LAST_NAME ) ||
  20. NULL == reIsapi.GetString( REGVAL_ULS_EMAIL_NAME ) )
  21. {
  22. return false;
  23. }
  24. else
  25. {
  26. return true;
  27. }
  28. }
  29. inline DWORD GetGALName()
  30. {
  31. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  32. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_NAME, DEFAULT_POL_GAL_NAME );
  33. }
  34. inline DWORD GetGALSurName()
  35. {
  36. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  37. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_SURNAME, DEFAULT_POL_GAL_SURNAME );
  38. }
  39. inline DWORD GetGALEmail()
  40. {
  41. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  42. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_EMAIL, DEFAULT_POL_GAL_EMAIL );
  43. }
  44. inline DWORD GetGALLocation()
  45. {
  46. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  47. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_LOCATION, DEFAULT_POL_GAL_LOCATION );
  48. }
  49. inline DWORD GetGALPhoneNum()
  50. {
  51. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  52. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_PHONENUM, DEFAULT_POL_GAL_PHONENUM );
  53. }
  54. inline DWORD GetGALComment()
  55. {
  56. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  57. return (DWORD)rePol.GetNumber( REGVAL_POL_GAL_COMMENTS, DEFAULT_POL_GAL_COMMENTS );
  58. }
  59. #endif // USE_GAL
  60. inline bool IsShowFirstTimeUrlEnabled( void )
  61. {
  62. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  63. return rePol.GetNumber( REGVAL_POL_SHOW_FIRST_TIME_URL, DEFAULT_POL_SHOW_FIRST_TIME_URL ) ? true : false;
  64. }
  65. inline bool IsChatEnabled( void )
  66. {
  67. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  68. return !rePol.GetNumber( REGVAL_POL_NO_CHAT, DEFAULT_POL_NO_CHAT );
  69. }
  70. inline bool IsFileTransferEnabled( void )
  71. {
  72. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  73. return(!rePol.GetNumber( REGVAL_POL_NO_FILETRANSFER_SEND, DEFAULT_POL_NO_FILETRANSFER_SEND)
  74. || !rePol.GetNumber( REGVAL_POL_NO_FILETRANSFER_RECEIVE, DEFAULT_POL_NO_FILETRANSFER_RECEIVE));
  75. }
  76. inline UINT GetMaxSendFileSize( void )
  77. {
  78. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  79. return(rePol.GetNumber(REGVAL_POL_MAX_SENDFILESIZE, DEFAULT_POL_MAX_FILE_SIZE));
  80. }
  81. inline bool IsOldWhiteboardEnabled( void )
  82. {
  83. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  84. return !rePol.GetNumber( REGVAL_POL_NO_OLDWHITEBOARD, DEFAULT_POL_NO_OLDWHITEBOARD );
  85. }
  86. inline bool IsNewWhiteboardEnabled( void )
  87. {
  88. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  89. return !rePol.GetNumber( REGVAL_POL_NO_NEWWHITEBOARD, DEFAULT_POL_NO_NEWWHITEBOARD );
  90. }
  91. // Returns true if need to add LCID stuff
  92. inline bool GetIntranetSupportURL( TCHAR *sz, int cchmax )
  93. {
  94. bool bRet = false;
  95. // if the string params are messed up, just return false
  96. ASSERT( sz && ( cchmax > 0 ) );
  97. // Try to get the registry value
  98. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  99. LPCTSTR szTemp = rePol.GetString( REGVAL_POL_INTRANET_SUPPORT_URL );
  100. if( szTemp[0] )
  101. {
  102. // This means that the registry value is there and the query succeeded
  103. lstrcpyn( sz, szTemp, cchmax );
  104. }
  105. else
  106. { // There is no reg key, we use the default
  107. Res2THelper( IDS_WEB_PAGE_FORMAT_SUPPORT, sz, cchmax );
  108. bRet = true;
  109. }
  110. return(bRet);
  111. }
  112. // Returns non-empty strings if there is a web dir set by policy
  113. bool GetWebDirInfo(
  114. LPTSTR szURL=NULL, int cchmaxURL=0,
  115. LPTSTR szServer=NULL, int cchmaxServer=0,
  116. LPTSTR szName=NULL, int cchmaxName=0
  117. );
  118. bool IsAutoAcceptCallsOptionEnabled(void);
  119. bool IsAutoAcceptCallsPersisted(void);
  120. bool IsAutoAcceptCallsEnabled(void);
  121. void SetAutoAcceptCallsEnabled(bool bAutoAccept);
  122. inline int GetSecurityLevel(void)
  123. {
  124. RegEntry reConf(POLICIES_KEY, HKEY_CURRENT_USER);
  125. return reConf.GetNumber( REGVAL_POL_SECURITY, DEFAULT_POL_SECURITY);
  126. }
  127. //
  128. // These two are ONLY the end-user setting. They are not meaningful
  129. // if the security level is required or disabled, only standard.
  130. //
  131. inline bool IncomingSecurityRequired(void)
  132. {
  133. RegEntry reIncoming(CONFERENCING_KEY, HKEY_CURRENT_USER);
  134. return(reIncoming.GetNumber(REGVAL_SECURITY_INCOMING_REQUIRED, DEFAULT_SECURITY_INCOMING_REQUIRED) != 0);
  135. }
  136. inline bool OutgoingSecurityPreferred(void)
  137. {
  138. RegEntry reOutgoing(CONFERENCING_KEY, HKEY_CURRENT_USER);
  139. return(reOutgoing.GetNumber(REGVAL_SECURITY_OUTGOING_PREFERRED, DEFAULT_SECURITY_OUTGOING_PREFERRED) != 0);
  140. }
  141. inline bool IsFullDuplexAllowed(void)
  142. {
  143. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  144. return !rePol.GetNumber( REGVAL_POL_NO_FULLDUPLEX, DEFAULT_POL_NO_FULLDUPLEX );
  145. }
  146. inline bool IsAdvancedAudioEnabled(void)
  147. {
  148. RegEntry rePol(POLICIES_KEY, HKEY_CURRENT_USER);
  149. return !rePol.GetNumber( REGVAL_POL_NO_ADVAUDIO, DEFAULT_POL_NO_ADVAUDIO);
  150. }
  151. inline bool GetLocalConferenceParticipantName( TCHAR *sz, int cchmax )
  152. {
  153. // if the string params are messed up, just return false
  154. if( sz && ( cchmax > 0 ) )
  155. {
  156. // Try to get the registry value
  157. RegEntry reULS(ISAPI_CLIENT_KEY, HKEY_CURRENT_USER);
  158. LPCTSTR szTemp = reULS.GetString( REGVAL_ULS_EMAIL_NAME );
  159. if( szTemp[0] )
  160. {
  161. // This means that the registry value is there and the query succeeded
  162. lstrcpyn( sz, szTemp, cchmax );
  163. }
  164. else
  165. { // There is no reg key, we use the default
  166. lstrcpy( sz, _T("Error, no local user") );
  167. }
  168. }
  169. else
  170. {
  171. return false;
  172. }
  173. return true;
  174. }
  175. enum eCallingMode { CallingMode_Direct, CallingMode_GateKeeper, CallingMode_Invalid };
  176. inline eCallingMode GetCallingMode(void)
  177. {
  178. eCallingMode eRet = CallingMode_Invalid;
  179. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  180. switch( reConf.GetNumber( REGVAL_CALLING_MODE, CALLING_MODE_DIRECT) )
  181. {
  182. case CALLING_MODE_DIRECT:
  183. eRet = CallingMode_Direct;
  184. break;
  185. case CALLING_MODE_GATEKEEPER:
  186. eRet = CallingMode_GateKeeper;
  187. break;
  188. }
  189. return eRet;
  190. }
  191. inline void GetGKServerName(TCHAR* psz, int cch )
  192. {
  193. if( psz )
  194. {
  195. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  196. lstrcpyn( psz, reConf.GetString(REGVAL_GK_SERVER), cch );
  197. }
  198. }
  199. inline void GetGKAccountName(TCHAR* psz, int cch )
  200. {
  201. if( psz )
  202. {
  203. RegEntry reULS( ISAPI_CLIENT_KEY, HKEY_CURRENT_USER );
  204. lstrcpyn( psz, reULS.GetString( REGVAL_ULS_GK_ACCOUNT), cch );
  205. }
  206. }
  207. inline BOOL UserCanChangeCallMode(void)
  208. {
  209. RegEntry reConf(POLICIES_KEY, HKEY_CURRENT_USER);
  210. return !reConf.GetNumber(REGVAL_POL_NOCHANGECALLMODE, DEFAULT_POL_NOCHANGECALLMODE);
  211. }
  212. inline void GetGatewayServerName(TCHAR* psz, int cch )
  213. {
  214. if( psz )
  215. {
  216. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  217. lstrcpyn( psz, reConf.GetString(REGVAL_GK_SERVER), cch );
  218. }
  219. }
  220. enum eGKAddressingMode { GKAddressing_Invalid = 0, GKAddressing_PhoneNum, GKAddressing_Account, GKAddressing_Both };
  221. inline eGKAddressingMode GetGKAddressingMode(void)
  222. {
  223. RegEntry reConf( CONFERENCING_KEY, HKEY_CURRENT_USER );
  224. eGKAddressingMode mode = GKAddressing_Invalid;
  225. switch( reConf.GetNumber( REGVAL_GK_METHOD, GKAddressing_Invalid ) )
  226. {
  227. case GK_LOGON_USING_PHONENUM:
  228. mode = GKAddressing_PhoneNum;
  229. break;
  230. case GK_LOGON_USING_ACCOUNT:
  231. mode = GKAddressing_Account;
  232. break;
  233. case GK_LOGON_USING_BOTH:
  234. mode = GKAddressing_Both;
  235. break;
  236. }
  237. return( mode );
  238. }
  239. inline bool LogOntoIlsWhenNetMeetingStartsIfInDirectCallingMode(void)
  240. {
  241. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  242. return !reConf.GetNumber( REGVAL_DONT_LOGON_ULS, DONT_LOGON_ULS_DEFAULT);
  243. }
  244. inline bool LogOntoIlsWhenNetMeetingStarts(void)
  245. {
  246. return ((ConfPolicies::GetCallingMode() == ConfPolicies::CallingMode_Direct) &&
  247. (LogOntoIlsWhenNetMeetingStartsIfInDirectCallingMode()));
  248. }
  249. inline bool RunWhenWindowsStarts(void)
  250. {
  251. RegEntry reConf(CONFERENCING_KEY, HKEY_CURRENT_USER);
  252. return (0 != reConf.GetNumber(REGVAL_CONF_ALWAYS_RUNNING, ALWAYS_RUNNING_DEFAULT));
  253. }
  254. inline bool InvalidMyInfo()
  255. {
  256. RegEntry reIsapi(ISAPI_KEY, HKEY_CURRENT_USER);
  257. return (
  258. ( NULL == reIsapi.GetString( REGVAL_ULS_FIRST_NAME ) ) ||
  259. ( NULL == reIsapi.GetString( REGVAL_ULS_LAST_NAME ) ) ||
  260. ( NULL == reIsapi.GetString( REGVAL_ULS_EMAIL_NAME ) )
  261. );
  262. }
  263. inline bool IsRDSDisabled()
  264. {
  265. RegEntry rePol( POLICIES_KEY, HKEY_LOCAL_MACHINE );
  266. return(rePol.GetNumber( REGVAL_POL_NO_RDS, DEFAULT_POL_NO_RDS ) != FALSE);
  267. }
  268. inline bool IsRDSDisabledOnWin9x()
  269. {
  270. RegEntry rePol( POLICIES_KEY, HKEY_LOCAL_MACHINE );
  271. return(rePol.GetNumber ( REGVAL_POL_NO_RDS_WIN9X, DEFAULT_POL_NO_RDS_WIN9X ) != FALSE);
  272. }
  273. inline bool isWebDirectoryDisabled(void)
  274. {
  275. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  276. return( rePol.GetNumber( REGVAL_POL_NO_WEBDIR, DEFAULT_POL_NO_WEBDIR ) != FALSE );
  277. }
  278. inline bool IsAdvancedCallingAllowed(void)
  279. {
  280. RegEntry rePol( POLICIES_KEY, HKEY_CURRENT_USER );
  281. return(!rePol.GetNumber( REGVAL_POL_NO_ADVANCEDCALLING, DEFAULT_POL_NO_ADVANCEDCALLING ));
  282. }
  283. };
  284. #endif // __ConfPolicies_h__