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.

90 lines
2.3 KiB

  1. /*
  2. ****************************************************************************
  3. | Copyright (C) 2002 Microsoft Corporation
  4. |
  5. | Component / Subcomponent
  6. | IIS 6.0 / IIS Migration Wizard
  7. |
  8. | Based on:
  9. | http://iis6/Specs/IIS%20Migration6.0_Final.doc
  10. |
  11. | Abstract:
  12. | DLL support code
  13. |
  14. | Author:
  15. | ivelinj
  16. |
  17. | Revision History:
  18. | V1.00 March 2002
  19. |
  20. ****************************************************************************
  21. */
  22. #include "stdafx.h"
  23. #include "resource.h"
  24. #include "IISMigrTool.h"
  25. #include "IISMigrTool_i.c"
  26. #include "ExportPackage.h"
  27. #include "ImportPackage.h"
  28. #include <new.h>
  29. CComModule _Module;
  30. BEGIN_OBJECT_MAP(ObjectMap)
  31. OBJECT_ENTRY( CLSID_ExportPackage, CExportPackage )
  32. OBJECT_ENTRY( CLSID_ImportPackage, CImportPackage )
  33. END_OBJECT_MAP()
  34. // DLL Entry Point
  35. extern "C" BOOL WINAPI DllMain( HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/ )
  36. {
  37. if (dwReason == DLL_PROCESS_ATTACH)
  38. {
  39. _Module.Init( ObjectMap, hInstance, &LIBID_IISMigrToolLib );
  40. DisableThreadLibraryCalls(hInstance);
  41. // Install operator new handler
  42. ::_set_new_handler( CTools::BadAllocHandler );
  43. }
  44. else if (dwReason == DLL_PROCESS_DETACH)
  45. _Module.Term();
  46. return TRUE; // ok
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // Used to determine whether the DLL can be unloaded by OLE
  50. STDAPI DllCanUnloadNow(void)
  51. {
  52. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  53. }
  54. /////////////////////////////////////////////////////////////////////////////
  55. // Returns a class factory to create an object of the requested type
  56. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  57. {
  58. return _Module.GetClassObject(rclsid, riid, ppv);
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // DllRegisterServer - Adds entries to the system registry
  62. STDAPI DllRegisterServer(void)
  63. {
  64. // registers object, typelib and all interfaces in typelib
  65. return _Module.RegisterServer(TRUE);
  66. }
  67. /////////////////////////////////////////////////////////////////////////////
  68. // DllUnregisterServer - Removes entries from the system registry
  69. STDAPI DllUnregisterServer(void)
  70. {
  71. return _Module.UnregisterServer(TRUE);
  72. }