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.

81 lines
2.1 KiB

  1. // bridge.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f bridgeps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include <initguid.h>
  8. //#include "bridge.h"
  9. #ifdef _ATL_STATIC_REGISTRY
  10. #include <statreg.h>
  11. #include <statreg.cpp>
  12. #endif
  13. #include <atlimpl.cpp>
  14. //#include "bridge_i.c"
  15. #include "ConfBridge.h"
  16. CComModule _Module;
  17. BEGIN_OBJECT_MAP(ObjectMap)
  18. OBJECT_ENTRY(__uuidof(ConfBridge), CConfBridge)
  19. END_OBJECT_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DLL Entry Point
  22. extern "C"
  23. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  24. {
  25. if (dwReason == DLL_PROCESS_ATTACH)
  26. {
  27. BGLOGREGISTER(_T("bridge"));
  28. _Module.Init(ObjectMap, hInstance); //@@, &LIBID_BRIDGELib);
  29. DisableThreadLibraryCalls(hInstance);
  30. }
  31. else if (dwReason == DLL_PROCESS_DETACH)
  32. {
  33. _Module.Term();
  34. BGLOGDEREGISTER();
  35. }
  36. return TRUE; // ok
  37. }
  38. /////////////////////////////////////////////////////////////////////////////
  39. // Used to determine whether the DLL can be unloaded by OLE
  40. STDAPI DllCanUnloadNow(void)
  41. {
  42. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  43. }
  44. /////////////////////////////////////////////////////////////////////////////
  45. // Returns a class factory to create an object of the requested type
  46. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  47. {
  48. return _Module.GetClassObject(rclsid, riid, ppv);
  49. }
  50. /////////////////////////////////////////////////////////////////////////////
  51. // DllRegisterServer - Adds entries to the system registry
  52. STDAPI DllRegisterServer(void)
  53. {
  54. // registers object, typelib and all interfaces in typelib
  55. return _Module.RegisterServer(TRUE);
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllUnregisterServer - Removes entries from the system registry
  59. STDAPI DllUnregisterServer(void)
  60. {
  61. _Module.UnregisterServer();
  62. return S_OK;
  63. }