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.

96 lines
2.5 KiB

  1. // BOMSnap.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f BOMSnapps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include "initguid.h"
  8. #include "BOMSnap_i.c"
  9. #include "RowItem.h"
  10. #include "scopenode.h"
  11. #include "compdata.h"
  12. #include "Compont.h"
  13. #include "DataObj.h"
  14. #include "about.h"
  15. #include "queryreq.h"
  16. CComModule _Module;
  17. extern CQueryThread g_QueryThread;
  18. BEGIN_OBJECT_MAP(ObjectMap)
  19. OBJECT_ENTRY(CLSID_BOMSnapIn, CComponentData)
  20. OBJECT_ENTRY(CLSID_BOMSnapInAbout, CSnapInAbout)
  21. END_OBJECT_MAP()
  22. /////////////////////////////////////////////////////////////////////////////
  23. // DLL Entry Point
  24. extern "C"
  25. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  26. {
  27. if (dwReason == DLL_PROCESS_ATTACH)
  28. {
  29. // NATHAN FIX !!w
  30. //_set_new_handler( _standard_new_handler );
  31. _Module.Init(ObjectMap, hInstance);
  32. DisableThreadLibraryCalls(hInstance);
  33. }
  34. else if (dwReason == DLL_PROCESS_DETACH)
  35. {
  36. // BUGBUG: This next statement is the offending
  37. // one that causes AV in Win95 OSR2 while registering.
  38. _Module.Term();
  39. }
  40. return TRUE; // ok
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // Used to determine whether the DLL can be unloaded by OLE
  44. STDAPI DllCanUnloadNow(void)
  45. {
  46. // if DLL is ready to exit, make sure all threads are killed before unload
  47. if (_Module.GetLockCount() == 0)
  48. {
  49. g_QueryThread.Kill();
  50. return S_OK;
  51. }
  52. return 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(FALSE);
  66. }
  67. /////////////////////////////////////////////////////////////////////////////
  68. // DllUnregisterServer - Removes entries from the system registry
  69. STDAPI DllUnregisterServer(void)
  70. {
  71. _Module.UnregisterServer();
  72. return S_OK;
  73. }