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.

117 lines
2.7 KiB

  1. ///////////////////////////////////////////////////////////////////////////////
  2. //
  3. // Copyright (c) Microsoft Corp. All rights reserved.
  4. //
  5. // FILE
  6. //
  7. // iasnap.cpp
  8. //
  9. // SYNOPSIS
  10. //
  11. // Implementation of DLL exports for an ATL in proc server.
  12. //
  13. ///////////////////////////////////////////////////////////////////////////////
  14. #include <ias.h>
  15. #include <iasutil.h>
  16. #include <newop.cpp>
  17. #include <enforcer.h>
  18. #include <match.h>
  19. #include <ntgroups.h>
  20. #include <posteap.h>
  21. #include <timeofday.h>
  22. #include <userr.h>
  23. CComModule _Module;
  24. #include <atlimpl.cpp>
  25. BEGIN_OBJECT_MAP(ObjectMap)
  26. OBJECT_ENTRY(__uuidof(AttributeMatch), AttributeMatch)
  27. OBJECT_ENTRY(__uuidof(NTGroups), NTGroups)
  28. OBJECT_ENTRY(__uuidof(TimeOfDay), TimeOfDay)
  29. OBJECT_ENTRY(__uuidof(PolicyEnforcer),
  30. IASTL::IASRequestHandlerObject<PolicyEnforcer> )
  31. OBJECT_ENTRY(__uuidof(ProxyPolicyEnforcer),
  32. IASTL::IASRequestHandlerObject<ProxyPolicyEnforcer> )
  33. OBJECT_ENTRY(__uuidof(URHandler),
  34. IASTL::IASRequestHandlerObject<UserRestrictions> )
  35. OBJECT_ENTRY(__uuidof(PostEapRestrictions),
  36. IASTL::IASRequestHandlerObject<PostEapRestrictions> )
  37. END_OBJECT_MAP()
  38. //////////
  39. // DLL Entry Point
  40. //////////
  41. BOOL
  42. WINAPI
  43. DllMain(
  44. HINSTANCE hInstance,
  45. DWORD dwReason,
  46. LPVOID /*lpReserved*/
  47. )
  48. {
  49. if (dwReason == DLL_PROCESS_ATTACH)
  50. {
  51. _Module.Init(ObjectMap, hInstance);
  52. DisableThreadLibraryCalls(hInstance);
  53. }
  54. else if (dwReason == DLL_PROCESS_DETACH)
  55. {
  56. _Module.Term();
  57. }
  58. return TRUE;
  59. }
  60. //////////
  61. // Used to determine whether the DLL can be unloaded by OLE
  62. //////////
  63. STDAPI DllCanUnloadNow(void)
  64. {
  65. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  66. }
  67. //////////
  68. // Returns a class factory to create an object of the requested type.
  69. //////////
  70. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  71. {
  72. return _Module.GetClassObject(rclsid, riid, ppv);
  73. }
  74. //////////
  75. // DllRegisterServer - Adds entries to the system registry
  76. //////////
  77. STDAPI DllRegisterServer(void)
  78. {
  79. return _Module.RegisterServer(TRUE);
  80. }
  81. //////////
  82. // DllUnregisterServer - Removes entries from the system registry
  83. //////////
  84. STDAPI DllUnregisterServer(void)
  85. {
  86. HRESULT hr = _Module.UnregisterServer();
  87. if (FAILED(hr)) return hr;
  88. hr = UnRegisterTypeLib(__uuidof(NetworkPolicy),
  89. 1,
  90. 0,
  91. MAKELANGID(LANG_NEUTRAL, SUBLANG_NEUTRAL),
  92. SYS_WIN32);
  93. return hr;
  94. }
  95. #include <BuildTree.h>
  96. #include <xprparse.h>
  97. #include <xprparse.cpp>