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.

122 lines
4.3 KiB

  1. //-----------------------------------------------------------------------------
  2. //
  3. // @doc
  4. //
  5. // @module BaseHandlerHelper.h | Helper functions for dealing with base
  6. // handler methods.
  7. //
  8. // Author: Darren Anderson
  9. //
  10. // Date: 5/16/00
  11. //
  12. // Copyright <cp> 1999-2000 Microsoft Corporation. All Rights Reserved.
  13. //
  14. //-----------------------------------------------------------------------------
  15. #pragma once
  16. #include "pphandlerbase.h"
  17. inline void AddGlobalCarryThru(CPPUrl &url)
  18. {
  19. CPassportHandlerBase* pHandler = CPassportHandlerBase::GetPPHandler();
  20. return pHandler->AddGlobalCarryThru(url);
  21. }
  22. HRESULT GetGlobalObj(REFGUID objid, REFIID riid, void**pobj);
  23. void GetWParam(LPCSTR szParamName,
  24. CStringW& cszValue,
  25. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  26. void GetWFormVar(LPCSTR szParamName,
  27. CStringW& cszValue,
  28. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  29. long GetParamLong(LPCSTR szParamName);
  30. void GetWCookie(LPCSTR szParamName,
  31. CStringW& cszValue,
  32. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  33. void GetWServerVariable(LPCSTR szParamName,
  34. CStringW& cszValue,
  35. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  36. void GetAServerVariable(
  37. LPCSTR szParamName,
  38. CStringA& cszOut,
  39. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  40. void GetWItem(LPCSTR szParamName,
  41. CStringW& cszValue,
  42. unsigned flag = CPassportHandlerBase::CI_FLAG_DEFAULT);
  43. void Mbcs2Unicode(LPCSTR pszIn, BOOL bNEC, CStringW& cszOut);
  44. void Unicode2Mbcs(LPCWSTR pwszIn, BOOL bNEC, CStringA& cszOut);
  45. HRESULT GetDomainAttribute(
  46. const BSTR bstrAttrName, //@parm the attribute name
  47. LPCWSTR pwszDomain,
  48. CComBSTR& cbstrValue);
  49. HRESULT GetPartnerAttribute(ULONG ulSiteId,
  50. LPCWSTR pwszAttribute,
  51. CStringW& cszValue);
  52. HRESULT GetPartnerAttribute(ULONG ulSiteId,
  53. LPCWSTR pwszAttribute,
  54. CComBSTR& cszValue);
  55. CPassportLocale* GetRequestLocale();
  56. void GetConfigString(LPCWSTR szItem, CStringW& cszValue);
  57. void GetConfigNumber(LPCWSTR szItem, long& lValue);
  58. void SetCookie(LPCSTR szCookieName,
  59. LPCSTR szCookieValue,
  60. LPCSTR szCookieExpiration = NULL,
  61. LPCSTR szCookieDomain = NULL,
  62. LPCSTR szCookiePath = NULL,
  63. bool bSecure = false
  64. );
  65. void SetCookie(LPCSTR szCookieName,
  66. LPCWSTR szCookieValue,
  67. LPCSTR szCookieExpiration = NULL,
  68. LPCSTR szCookieDomain = NULL,
  69. LPCSTR szCookiePath = NULL,
  70. bool bSecure = false
  71. );
  72. // @func bool | IsHttpsOn | Check if the connection is over SSL
  73. // @rdesc Return the following values:
  74. // @flag true | the connection is over SSL
  75. // @flag false | the connection is NOT over SSL
  76. bool IsHttpsOn(void);
  77. inline const PPMGRVer & GetPPMgrVersion()
  78. {
  79. CPassportHandlerBase* pHandler = CPassportHandlerBase::GetPPHandler();
  80. return pHandler->GetPPMgrVersion();
  81. }
  82. inline ULONG ProfileElesToReturn(long browserIndex, long id)
  83. {
  84. ULONG ret = (ULONG)-1;
  85. if(browserIndex == CBrowserInfo::BROWSER_DoCoMo
  86. || browserIndex == CBrowserInfo::BROWSER_MMEPHONE
  87. || browserIndex == CBrowserInfo::BROWSER_UP)
  88. {
  89. if( id != 0)
  90. // determine how profile cookie should be generated
  91. {
  92. // if needmembername is defined for the partner, (none 0)
  93. // create profile cookie with membernameonly
  94. // if needmembername is undefined, or 0, then no profile
  95. CComBSTR needMemberName;
  96. HRESULT hr = GetPartnerAttribute(id,
  97. k_cvPartnerAttrNeedsMembername.bstrVal,
  98. needMemberName);
  99. if(hr == S_OK && needMemberName != NULL && _wtoi(needMemberName) != 0)
  100. ret = 1;
  101. else
  102. ret = 0;
  103. }
  104. else
  105. ret = 0;
  106. }
  107. return ret;
  108. }
  109. // EOF