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.

86 lines
2.2 KiB

  1. // DfsShlEx.cpp : Implementation of DLL Exports.
  2. #include "stdafx.h"
  3. #include "resource.h"
  4. #include "initguid.h"
  5. #include "DfsShlEx.h"
  6. #include "DfsShlEx_i.c"
  7. #include "DfsShell.h"
  8. CComModule _Module;
  9. BEGIN_OBJECT_MAP(ObjectMap)
  10. OBJECT_ENTRY(CLSID_DfsShell, CDfsShell)
  11. END_OBJECT_MAP()
  12. /////////////////////////////////////////////////////////////////////////////
  13. // DLL Entry Point
  14. extern "C"
  15. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  16. {
  17. if (dwReason == DLL_PROCESS_ATTACH)
  18. {
  19. _Module.Init(ObjectMap, hInstance);
  20. DisableThreadLibraryCalls(hInstance);
  21. }
  22. else if (dwReason == DLL_PROCESS_DETACH)
  23. _Module.Term();
  24. return TRUE; // ok
  25. }
  26. /////////////////////////////////////////////////////////////////////////////
  27. // Used to determine whether the DLL can be unloaded by OLE
  28. STDAPI DllCanUnloadNow(void)
  29. {
  30. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  31. }
  32. /////////////////////////////////////////////////////////////////////////////
  33. // Returns a class factory to create an object of the requested type
  34. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  35. {
  36. return _Module.GetClassObject(rclsid, riid, ppv);
  37. }
  38. /////////////////////////////////////////////////////////////////////////////
  39. // DllRegisterServer - Adds entries to the system registry
  40. STDAPI DllRegisterServer(void)
  41. {
  42. // registers object, typelib and all interfaces in typelib
  43. return _Module.RegisterServer(TRUE);
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // DllUnregisterServer - Removes entries from the system registry
  47. STDAPI DllUnregisterServer(void)
  48. {
  49. _Module.UnregisterServer();
  50. //
  51. // #253178 manually remove this registry value (added in dfsshell.rgs)
  52. //
  53. HKEY hKey = 0;
  54. LONG lErr = RegOpenKeyEx(
  55. HKEY_LOCAL_MACHINE,
  56. _T("Software\\Microsoft\\Windows\\CurrentVersion\\Shell Extensions\\Approved"),
  57. 0,
  58. KEY_ALL_ACCESS,
  59. &hKey);
  60. if (ERROR_SUCCESS == lErr)
  61. {
  62. (void)RegDeleteValue(hKey, _T("{ECCDF543-45CC-11CE-B9BF-0080C87CDBA6}"));
  63. RegCloseKey(hKey);
  64. }
  65. return S_OK;
  66. }