Leaked source code of windows server 2003
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.

87 lines
2.5 KiB

  1. // TDC.cpp : Implementation of DLL Exports.
  2. // You will need the NT SUR Beta 2 SDK or VC 4.2 or higher in order to build
  3. // this project. This is because you will need MIDL 3.00.15 or higher and new
  4. // headers and libs. If you have VC 4.2 installed, then everything should
  5. // already be configured correctly.
  6. // Note: Proxy/Stub Information
  7. // To build a separate proxy/stub DLL,
  8. // run nmake -f TDCps.mak in the project directory.
  9. #include "stdafx.h"
  10. #include "resource.h"
  11. #include <simpdata.h>
  12. #include "TDCIds.h"
  13. #include "TDC.h"
  14. #include <MLang.h>
  15. #define IID_DEFINED // for now avoid a conflict with ATL
  16. #include "TDC_i.c"
  17. //#include "mlang_i.c"
  18. #include "Notify.h"
  19. #include "TDCParse.h"
  20. #include "TDCArr.h"
  21. #include "TDCCtl.h"
  22. CComModule _Module;
  23. BEGIN_OBJECT_MAP(ObjectMap)
  24. OBJECT_ENTRY(CLSID_CTDCCtl, CTDCCtl)
  25. //MM OBJECT_ENTRY(CLSID_CSimpleTabularData, CSimpleTabularData)
  26. END_OBJECT_MAP()
  27. /////////////////////////////////////////////////////////////////////////////
  28. // DLL Entry Point
  29. extern "C"
  30. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  31. {
  32. if (dwReason == DLL_PROCESS_ATTACH)
  33. {
  34. _Module.Init(ObjectMap, hInstance);
  35. DisableThreadLibraryCalls(hInstance);
  36. }
  37. else if (dwReason == DLL_PROCESS_DETACH)
  38. _Module.Term();
  39. return TRUE; // ok
  40. }
  41. /////////////////////////////////////////////////////////////////////////////
  42. // Used to determine whether the DLL can be unloaded by OLE
  43. STDAPI DllCanUnloadNow(void)
  44. {
  45. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  46. }
  47. /////////////////////////////////////////////////////////////////////////////
  48. // Returns a class factory to create an object of the requested type
  49. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  50. {
  51. return _Module.GetClassObject(rclsid, riid, ppv);
  52. }
  53. /////////////////////////////////////////////////////////////////////////////
  54. // DllRegisterServer - Adds entries to the system registry
  55. STDAPI DllRegisterServer(void)
  56. {
  57. // registers object, typelib and all interfaces in typelib
  58. return _Module.RegisterServer(TRUE);
  59. }
  60. /////////////////////////////////////////////////////////////////////////////
  61. // DllUnregisterServer - Removes entries from the system registry
  62. STDAPI DllUnregisterServer(void)
  63. {
  64. _Module.UnregisterServer();
  65. #if _WIN32_WINNT >= 0x0400
  66. UnRegisterTypeLib(LIBID_TDCLib, 1, 1, NULL, SYS_WIN32);
  67. #endif
  68. return S_OK;
  69. }