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.

51 lines
1.5 KiB

  1. // HMSnapinRes.cpp : Defines the initialization routines for the DLL.
  2. //
  3. #include "stdafx.h"
  4. #include <afxdllx.h>
  5. #ifdef _DEBUG
  6. #define new DEBUG_NEW
  7. #undef THIS_FILE
  8. static char THIS_FILE[] = __FILE__;
  9. #endif
  10. static AFX_EXTENSION_MODULE HMSnapinResDLL = { NULL, NULL };
  11. extern "C" int APIENTRY
  12. DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID lpReserved)
  13. {
  14. // Remove this if you use lpReserved
  15. UNREFERENCED_PARAMETER(lpReserved);
  16. if (dwReason == DLL_PROCESS_ATTACH)
  17. {
  18. TRACE0("HMSNAPINRES.DLL Initializing!\n");
  19. // Extension DLL one-time initialization
  20. if (!AfxInitExtensionModule(HMSnapinResDLL, hInstance))
  21. return 0;
  22. // Insert this DLL into the resource chain
  23. // NOTE: If this Extension DLL is being implicitly linked to by
  24. // an MFC Regular DLL (such as an ActiveX Control)
  25. // instead of an MFC application, then you will want to
  26. // remove this line from DllMain and put it in a separate
  27. // function exported from this Extension DLL. The Regular DLL
  28. // that uses this Extension DLL should then explicitly call that
  29. // function to initialize this Extension DLL. Otherwise,
  30. // the CDynLinkLibrary object will not be attached to the
  31. // Regular DLL's resource chain, and serious problems will
  32. // result.
  33. new CDynLinkLibrary(HMSnapinResDLL);
  34. }
  35. else if (dwReason == DLL_PROCESS_DETACH)
  36. {
  37. TRACE0("HMSNAPINRES.DLL Terminating!\n");
  38. // Terminate the library before destructors are called
  39. AfxTermExtensionModule(HMSnapinResDLL);
  40. }
  41. return 1; // ok
  42. }