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.

72 lines
1.8 KiB

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