Source code of Windows XP (NT5)
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.

95 lines
2.2 KiB

  1. // $$root$$.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f ShellExtensionsps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include "initguid.h"
  8. #include "$$root$$.h"
  9. #include "ShellExtensions_i.c"
  10. $$IF(Icon)
  11. #include "$$ClassType$$EI.h"
  12. $$ENDIF
  13. $$IF(ContextMenu)
  14. #include "$$ClassType$$CM.h"
  15. $$ENDIF
  16. $$IF(PropertySheet)
  17. #include "$$ClassType$$PS.h"
  18. $$ENDIF
  19. $$IF(InfoTip)
  20. #include "$$ClassType$$IT.h"
  21. $$ENDIF
  22. CComModule _Module;
  23. BEGIN_OBJECT_MAP(ObjectMap)
  24. $$IF(Icon)
  25. OBJECT_ENTRY(CLSID_$$ClassType$$EI, C$$ClassType$$EI)
  26. $$ENDIF
  27. $$IF(ContextMenu)
  28. OBJECT_ENTRY(CLSID_$$ClassType$$CM, C$$ClassType$$CM)
  29. $$ENDIF
  30. $$IF(PropertySheet)
  31. OBJECT_ENTRY(CLSID_$$ClassType$$PS, C$$ClassType$$PS)
  32. $$ENDIF
  33. $$IF(InfoTip)
  34. OBJECT_ENTRY(CLSID_$$ClassType$$IT, C$$ClassType$$IT)
  35. $$ENDIF
  36. END_OBJECT_MAP()
  37. /////////////////////////////////////////////////////////////////////////////
  38. // DLL Entry Point
  39. extern "C"
  40. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  41. {
  42. if (dwReason == DLL_PROCESS_ATTACH)
  43. {
  44. _Module.Init(ObjectMap, hInstance);
  45. DisableThreadLibraryCalls(hInstance);
  46. }
  47. else if (dwReason == DLL_PROCESS_DETACH)
  48. _Module.Term();
  49. return TRUE; // ok
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Used to determine whether the DLL can be unloaded by OLE
  53. STDAPI DllCanUnloadNow(void)
  54. {
  55. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // Returns a class factory to create an object of the requested type
  59. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  60. {
  61. return _Module.GetClassObject(rclsid, riid, ppv);
  62. }
  63. /////////////////////////////////////////////////////////////////////////////
  64. // DllRegisterServer - Adds entries to the system registry
  65. STDAPI DllRegisterServer(void)
  66. {
  67. // registers object, typelib and all interfaces in typelib
  68. return _Module.RegisterServer(TRUE);
  69. }
  70. /////////////////////////////////////////////////////////////////////////////
  71. // DllUnregisterServer - Removes entries from the system registry
  72. STDAPI DllUnregisterServer(void)
  73. {
  74. _Module.UnregisterServer();
  75. return S_OK;
  76. }