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.

147 lines
4.0 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. if (riid == IID_IUnknown ||
  46. riid == IID_IDispatch)
  47. {
  48. *ppvObject = (LPVOID)(LPUNKNOWN)this;
  49. AddRef();
  50. return S_OK;
  51. }
  52. else
  53. {
  54. if (riid == IID_IDispatch)
  55. {
  56. *ppvObject = (LPVOID)(IDispatch*)this;
  57. AddRef();
  58. return S_OK;
  59. }
  60. else
  61. {
  62. *ppvObject = 0;
  63. return E_NOINTERFACE;
  64. }
  65. }
  66. }
  67. STDMETHODIMP_(ULONG) AddRef()
  68. {
  69. return ++m_refCount;
  70. }
  71. STDMETHODIMP_(ULONG) Release()
  72. {
  73. if (--m_refCount)
  74. return m_refCount;
  75. delete this;
  76. return 0;
  77. }
  78. // IDispatch Methods
  79. STDMETHODIMP GetTypeInfoCount(UINT* pctinfo)
  80. {
  81. *pctinfo = 0;
  82. return S_OK;
  83. }
  84. STDMETHODIMP GetTypeInfo(UINT itinfo, LCID lcid, ITypeInfo** pptinfo)
  85. {
  86. UNREFERENCED_PARAMETER(itinfo);
  87. UNREFERENCED_PARAMETER(lcid);
  88. UNREFERENCED_PARAMETER(pptinfo);
  89. return TYPE_E_ELEMENTNOTFOUND;
  90. }
  91. STDMETHODIMP GetIDsOfNames(REFIID riid, OLECHAR** rgszNames,UINT cNames, LCID lcid, DISPID FAR* rgdispid);
  92. STDMETHODIMP Invoke(
  93. DISPID dispidMember,
  94. REFIID riid,
  95. LCID lcid,
  96. WORD wFlags,
  97. DISPPARAMS* pdispparams,
  98. VARIANT* pvarResult,
  99. EXCEPINFO* pexcepinfo,
  100. UINT* puArgErr);
  101. // JScript Auto-Proxy config functions.
  102. STDMETHODIMP isPlainHostName(BSTR host, VARIANT* retval);
  103. STDMETHODIMP dnsDomainIs(BSTR host,BSTR domain, VARIANT* retval);
  104. STDMETHODIMP localHostOrDomainIs(BSTR host,BSTR hostdom, VARIANT* retval);
  105. STDMETHODIMP isResolvable(BSTR host, VARIANT* retval);
  106. STDMETHODIMP isInNet(BSTR host, BSTR pattern, BSTR mask, VARIANT* retval);
  107. STDMETHODIMP dnsResolve(BSTR host, VARIANT* retval);
  108. STDMETHODIMP myIpAddress(VARIANT* retval);
  109. STDMETHODIMP dnsDomainLevels(BSTR host, VARIANT* retval);
  110. STDMETHODIMP shExpMatch(BSTR str, BSTR shexp, VARIANT* retval);
  111. STDMETHODIMP alert(BSTR message, VARIANT* retval);
  112. // These are to do last!!!.
  113. STDMETHODIMP weekdayRange(BSTR wd1, BSTR wd2, BSTR gmt, VARIANT* retval);
  114. STDMETHODIMP dateRange(long day, BSTR month, BSTR gmt, VARIANT* retval);
  115. STDMETHODIMP timeRange(long hour, long min, long sec, BSTR gmt, VARIANT* retval);
  116. // ProxyConfig.bindings
  117. STDMETHODIMP Init(AUTO_PROXY_HELPER_APIS* pAPHA);
  118. STDMETHODIMP DeInit();
  119. // JScript private members
  120. private:
  121. long m_refCount;
  122. BOOL m_fDestroyable;
  123. BOOL m_fInitialized;
  124. AUTO_PROXY_HELPER_APIS* m_pCallout;
  125. LPCWSTR m_strings[13];
  126. };
  127. #endif