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.

101 lines
2.7 KiB

  1. // DBManager.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f DBManagerps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include "resource.h"
  7. #include <initguid.h>
  8. #include "DBMgr.h"
  9. #include "DBMgr_i.c"
  10. #include "MgeDB.h"
  11. CComModule _Module;
  12. BEGIN_OBJECT_MAP(ObjectMap)
  13. OBJECT_ENTRY(CLSID_IManageDB, CIManageDB)
  14. END_OBJECT_MAP()
  15. class CDBManagerApp : public CWinApp
  16. {
  17. public:
  18. // Overrides
  19. // ClassWizard generated virtual function overrides
  20. //{{AFX_VIRTUAL(CDBManagerApp)
  21. public:
  22. virtual BOOL InitInstance();
  23. virtual int ExitInstance();
  24. //}}AFX_VIRTUAL
  25. //{{AFX_MSG(CDBManagerApp)
  26. // NOTE - the ClassWizard will add and remove member functions here.
  27. // DO NOT EDIT what you see in these blocks of generated code !
  28. //}}AFX_MSG
  29. DECLARE_MESSAGE_MAP()
  30. };
  31. BEGIN_MESSAGE_MAP(CDBManagerApp, CWinApp)
  32. //{{AFX_MSG_MAP(CDBManagerApp)
  33. // NOTE - the ClassWizard will add and remove mapping macros here.
  34. // DO NOT EDIT what you see in these blocks of generated code!
  35. //}}AFX_MSG_MAP
  36. END_MESSAGE_MAP()
  37. CDBManagerApp theApp;
  38. BOOL CDBManagerApp::InitInstance()
  39. {
  40. ATLTRACE(_T("{DBManager.dll}CDBManagerApp::InitInstance() : m_hInstance=0x%08X\n"), m_hInstance);
  41. _Module.Init(ObjectMap, m_hInstance, &LIBID_DBMANAGERLib);
  42. BOOL bInit = CWinApp::InitInstance();
  43. _CrtSetDbgFlag(_CRTDBG_ALLOC_MEM_DF|_CRTDBG_LEAK_CHECK_DF);
  44. return bInit;
  45. }
  46. int CDBManagerApp::ExitInstance()
  47. {
  48. ATLTRACE(_T("{DBManager.dll}CDBManagerApp::ExitInstance() : m_hInstance=0x%08X\n"), m_hInstance);
  49. _Module.Term();
  50. return CWinApp::ExitInstance();
  51. }
  52. /////////////////////////////////////////////////////////////////////////////
  53. // Used to determine whether the DLL can be unloaded by OLE
  54. STDAPI DllCanUnloadNow(void)
  55. {
  56. AFX_MANAGE_STATE(AfxGetStaticModuleState());
  57. return (AfxDllCanUnloadNow()==S_OK && _Module.GetLockCount()==0) ? S_OK : S_FALSE;
  58. }
  59. /////////////////////////////////////////////////////////////////////////////
  60. // Returns a class factory to create an object of the requested type
  61. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  62. {
  63. return _Module.GetClassObject(rclsid, riid, ppv);
  64. }
  65. /////////////////////////////////////////////////////////////////////////////
  66. // DllRegisterServer - Adds entries to the system registry
  67. STDAPI DllRegisterServer(void)
  68. {
  69. // registers object, typelib and all interfaces in typelib
  70. return _Module.RegisterServer(TRUE);
  71. }
  72. /////////////////////////////////////////////////////////////////////////////
  73. // DllUnregisterServer - Removes entries from the system registry
  74. STDAPI DllUnregisterServer(void)
  75. {
  76. return _Module.UnregisterServer(TRUE);
  77. }