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.

161 lines
4.2 KiB

  1. #ifndef __JSPROXY_H__
  2. #define __JSPROXY_H__
  3. #include <windows.h>
  4. #include <olectl.h>
  5. #include "utils.h"
  6. #include "regexp.h"
  7. #define VAL_isPlainHostName 0x01f9
  8. #define VAL_dnsDomainIs 0x01f8
  9. #define VAL_localHostOrDomainIs 0x020b
  10. #define VAL_isResolvable 0x0206
  11. #define VAL_isInNet 0x01e1
  12. #define VAL_dnsResolve 0x01fc
  13. #define VAL_myIpAddress 0x01e0
  14. #define VAL_dnsDomainLevels 0x01f8
  15. #define VAL_shExpMatch 0x0208
  16. #define VAL_weekdayRange 0x0210
  17. #define VAL_dateRange 0x01f0
  18. #define VAL_timeRange 0x0201
  19. #define VAL_alert 0x0218
  20. #define DISPID_isPlainHostName 0x0001
  21. #define DISPID_dnsDomainIs 0x0002
  22. #define DISPID_localHostOrDomainIs 0x0003
  23. #define DISPID_isResolvable 0x0004
  24. #define DISPID_isInNet 0x0005
  25. #define DISPID_dnsResolve 0x0006
  26. #define DISPID_myIpAddress 0x0007
  27. #define DISPID_dnsDomainLevels 0x0008
  28. #define DISPID_shExpMatch 0x0009
  29. #define DISPID_weekdayRange 0x000a
  30. #define DISPID_dateRange 0x000b
  31. #define DISPID_timeRange 0x000c
  32. #define DISPID_alert 0x000d
  33. /************************************************************************************************/
  34. // This class implements the Dispatch interface that will allow the script engine to call the
  35. // auto-proxy configuration functions. This interface does not have a typelib and does not provide type
  36. // info.
  37. class CJSProxy : public IDispatch
  38. {
  39. public:
  40. CJSProxy();
  41. ~CJSProxy();
  42. // IUnknown Methods
  43. STDMETHODIMP QueryInterface(REFIID riid, PVOID *ppvObject)
  44. {
  45. #ifdef INET_DEBUG
  46. OutputDebugString( "IDispatch::QueryInterface\n" );
  47. #endif
  48. if (riid == IID_IUnknown ||
  49. riid == IID_IDispatch)
  50. {
  51. *ppvObject = (LPVOID)(LPUNKNOWN)this;
  52. AddRef();
  53. return S_OK;
  54. }
  55. else
  56. {
  57. if (riid == IID_IDispatch)
  58. {
  59. *ppvObject = (LPVOID)(IDispatch*)this;
  60. AddRef();
  61. return S_OK;
  62. }
  63. else
  64. {
  65. *ppvObject = 0;
  66. return E_NOINTERFACE;
  67. }
  68. }
  69. }
  70. STDMETHODIMP_(ULONG) AddRef()
  71. {
  72. #ifdef INET_DEBUG
  73. char szBuff[256];
  74. wsprintf(szBuff, "IDispatch::AddRef ref=%u\n", m_refCount );
  75. OutputDebugString(szBuff);
  76. #endif
  77. return ++m_refCount;
  78. }
  79. STDMETHODIMP_(ULONG) Release()
  80. {
  81. #ifdef INET_DEBUG
  82. char szBuff[256];
  83. wsprintf(szBuff, "IDispatch::Release ref=%u\n", m_refCount );
  84. OutputDebugString(szBuff);
  85. #endif
  86. if (--m_refCount)
  87. return m_refCount;
  88. delete this;
  89. return 0;
  90. }
  91. // IDispatch Methods
  92. STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
  93. {
  94. *pctinfo = 0;
  95. return S_OK;
  96. }
  97. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
  98. {
  99. return TYPE_E_ELEMENTNOTFOUND;
  100. }
  101. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames,UINT cNames, LCID lcid, DISPID FAR* rgdispid);
  102. STDMETHODIMP Invoke(
  103. DISPID dispidMember,
  104. REFIID riid,
  105. LCID lcid,
  106. WORD wFlags,
  107. DISPPARAMS* pdispparams,
  108. VARIANT* pvarResult,
  109. EXCEPINFO* pexcepinfo,
  110. UINT* puArgErr);
  111. // JScript Auto-Proxy config functions.
  112. STDMETHODIMP isPlainHostName(BSTR host, VARIANT* retval);
  113. STDMETHODIMP dnsDomainIs(BSTR host,BSTR domain, VARIANT* retval);
  114. STDMETHODIMP localHostOrDomainIs(BSTR host,BSTR hostdom, VARIANT* retval);
  115. STDMETHODIMP isResolvable(BSTR host, VARIANT* retval);
  116. STDMETHODIMP isInNet(BSTR host, BSTR pattern, BSTR mask, VARIANT* retval);
  117. STDMETHODIMP dnsResolve(BSTR host, VARIANT* retval);
  118. STDMETHODIMP myIpAddress(VARIANT* retval);
  119. STDMETHODIMP dnsDomainLevels(BSTR host, VARIANT* retval);
  120. STDMETHODIMP shExpMatch(BSTR str, BSTR shexp, VARIANT* retval);
  121. STDMETHODIMP alert(BSTR message, VARIANT* retval);
  122. // These are to do last!!!.
  123. STDMETHODIMP weekdayRange(BSTR wd1, BSTR wd2, BSTR gmt, VARIANT* retval);
  124. STDMETHODIMP dateRange(long day, BSTR month, BSTR gmt, VARIANT* retval);
  125. STDMETHODIMP timeRange(long hour, long min, long sec, BSTR gmt, VARIANT* retval);
  126. // ProxyConfig.bindings
  127. STDMETHODIMP Init(AUTO_PROXY_HELPER_APIS* pAPHA);
  128. STDMETHODIMP DeInit();
  129. // JScript private members
  130. private:
  131. long m_refCount;
  132. BOOL m_fDestroyable;
  133. BOOL m_fInitialized;
  134. AUTO_PROXY_HELPER_APIS* m_pCallout;
  135. LPCWSTR m_strings[13];
  136. };
  137. #endif