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.

93 lines
2.3 KiB

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