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.

82 lines
2.3 KiB

  1. // dsplex.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f dsplexps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include "initguid.h"
  8. #include "dsplex.h"
  9. #include "dsplex_i.c"
  10. #include <initguid.h>
  11. #include "DisplEx.h"
  12. CComModule _Module;
  13. // cut from mmc_i.c (yuck) !!!
  14. const IID IID_IComponentData = {0x955AB28A,0x5218,0x11D0,{0xA9,0x85,0x00,0xC0,0x4F,0xD8,0xD5,0x65}};
  15. const IID IID_IExtendTaskPad = {0x8dee6511,0x554d,0x11d1,{0x9f,0xea,0x00,0x60,0x08,0x32,0xdb,0x4a}};
  16. const IID IID_IEnumTASK = {0x338698b1,0x5a02,0x11d1,{0x9f,0xec,0x00,0x60,0x08,0x32,0xdb,0x4a}};
  17. BEGIN_OBJECT_MAP(ObjectMap)
  18. OBJECT_ENTRY(CLSID_DisplEx, CDisplEx)
  19. END_OBJECT_MAP()
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DLL Entry Point
  22. HINSTANCE g_hinst = 0; // used in enumtask.cpp
  23. extern "C"
  24. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  25. {
  26. if (dwReason == DLL_PROCESS_ATTACH)
  27. {
  28. g_hinst = hInstance;
  29. _Module.Init(ObjectMap, hInstance);
  30. DisableThreadLibraryCalls(hInstance);
  31. }
  32. else if (dwReason == DLL_PROCESS_DETACH)
  33. _Module.Term();
  34. return TRUE; // ok
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Used to determine whether the DLL can be unloaded by OLE
  38. STDAPI DllCanUnloadNow(void)
  39. {
  40. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // Returns a class factory to create an object of the requested type
  44. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  45. {
  46. return _Module.GetClassObject(rclsid, riid, ppv);
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // DllRegisterServer - Adds entries to the system registry
  50. STDAPI DllRegisterServer(void)
  51. {
  52. // registers object, typelib and all interfaces in typelib
  53. return _Module.RegisterServer(TRUE);
  54. }
  55. /////////////////////////////////////////////////////////////////////////////
  56. // DllUnregisterServer - Removes entries from the system registry
  57. STDAPI DllUnregisterServer(void)
  58. {
  59. _Module.UnregisterServer();
  60. return S_OK;
  61. }