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.

69 lines
1.7 KiB

  1. #include "pch.h"
  2. #pragma hdrstop
  3. #include "sfnobj.h"
  4. #define INITGUID
  5. #include <guiddef.h>
  6. DEFINE_GUID(CLSID_CSfnCfg,0x774BADAA,0xA7AC,0x11D0,0xB2,0x5B,0x00,0xC0,0x4F,0xC9,0xE2,0x92);
  7. // Global
  8. CComModule _Module;
  9. BEGIN_OBJECT_MAP(ObjectMap)
  10. OBJECT_ENTRY(CLSID_CSfnCfg, CSFNCfg)
  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. InitializeDebugging();
  20. _Module.Init(ObjectMap, hInstance);
  21. DisableThreadLibraryCalls(hInstance);
  22. }
  23. else if (dwReason == DLL_PROCESS_DETACH)
  24. {
  25. _Module.Term();
  26. UnInitializeDebugging();
  27. }
  28. return TRUE;
  29. }
  30. /////////////////////////////////////////////////////////////////////////////
  31. // Used to determine whether the DLL can be unloaded by OLE
  32. STDAPI DllCanUnloadNow(void)
  33. {
  34. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  35. }
  36. /////////////////////////////////////////////////////////////////////////////
  37. // Returns a class factory to create an object of the requested type
  38. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  39. {
  40. return _Module.GetClassObject(rclsid, riid, ppv);
  41. }
  42. /////////////////////////////////////////////////////////////////////////////
  43. // DllRegisterServer - Adds entries to the system registry
  44. STDAPI DllRegisterServer(void)
  45. {
  46. return NcAtlModuleRegisterServer (&_Module);
  47. }
  48. /////////////////////////////////////////////////////////////////////////////
  49. // DllUnregisterServer - Removes entries from the system registry
  50. STDAPI DllUnregisterServer(void)
  51. {
  52. _Module.UnregisterServer();
  53. return S_OK;
  54. }