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.

120 lines
3.5 KiB

  1. /*******************************************************************************
  2. * spttseng.cpp *
  3. *--------------*
  4. * Description:
  5. * This module is the implementation file for the MS TTS DLL.
  6. *-------------------------------------------------------------------------------
  7. * Created By: mc Date: 03/12/99
  8. * Copyright (C) 1999 Microsoft Corporation
  9. * All Rights Reserved
  10. *
  11. *******************************************************************************/
  12. #include "stdafx.h"
  13. #include "resource.h"
  14. #include <initguid.h>
  15. #ifndef __spttseng_h__
  16. #include "spttseng.h"
  17. #endif
  18. #include "spttseng_i.c"
  19. #ifndef TTSEngine_h
  20. #include "TTSEngine.h"
  21. #endif
  22. #ifndef VoiceDataObj_h
  23. #include "VoiceDataObj.h"
  24. #endif
  25. CSpUnicodeSupport g_Unicode;
  26. CComModule _Module;
  27. BEGIN_OBJECT_MAP(ObjectMap)
  28. OBJECT_ENTRY( CLSID_MSVoiceData, CVoiceDataObj )
  29. OBJECT_ENTRY( CLSID_MSTTSEngine, CTTSEngine )
  30. END_OBJECT_MAP()
  31. /*****************************************************************************
  32. * DllMain *
  33. *---------*
  34. * Description:
  35. * DLL Entry Point
  36. ********************************************************************** MC ***/
  37. #ifdef _WIN32_WCE
  38. extern "C"
  39. BOOL WINAPI DllMain(HANDLE hInst, DWORD dwReason, LPVOID /*lpReserved*/)
  40. {
  41. HINSTANCE hInstance = (HINSTANCE)hInst;
  42. #else
  43. extern "C"
  44. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  45. {
  46. #endif
  47. if (dwReason == DLL_PROCESS_ATTACH)
  48. {
  49. _Module.Init(ObjectMap, hInstance, &LIBID_MSTTSENGINELib);
  50. DisableThreadLibraryCalls(hInstance);
  51. #ifdef _DEBUG
  52. // Turn on memory leak checking
  53. int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
  54. tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
  55. _CrtSetDbgFlag( tmpFlag );
  56. #endif
  57. }
  58. else if (dwReason == DLL_PROCESS_DETACH)
  59. {
  60. CleanupAbbrevTables();
  61. _Module.Term();
  62. }
  63. return TRUE; // ok
  64. } /* DllMain */
  65. /*****************************************************************************
  66. * DllCanUnloadNow *
  67. *-----------------*
  68. * Description:
  69. * Used to determine whether the DLL can be unloaded by OLE
  70. ********************************************************************** MC ***/
  71. STDAPI DllCanUnloadNow(void)
  72. {
  73. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  74. } /* DllCanUnloadNow */
  75. /*****************************************************************************
  76. * DllGetClassObject *
  77. *-------------------*
  78. * Description:
  79. * Returns a class factory to create an object of the requested type
  80. ********************************************************************** MC ***/
  81. STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  82. {
  83. return _Module.GetClassObject(rclsid, riid, ppv);
  84. } /* DllGetClassObject */
  85. /*****************************************************************************
  86. * DllRegisterServer *
  87. *-------------------*
  88. * Description:
  89. * Adds entries to the system registry
  90. ********************************************************************** MC ***/
  91. STDAPI DllRegisterServer(void)
  92. {
  93. // registers object, typelib and all interfaces in typelib
  94. return _Module.RegisterServer(TRUE);
  95. } /* DllRegisterServer */
  96. /*****************************************************************************
  97. * DllUnregisterServer *
  98. *---------------------*
  99. * Description:
  100. * Removes entries from the system registry
  101. ********************************************************************** MC ***/
  102. STDAPI DllUnregisterServer(void)
  103. {
  104. return _Module.UnregisterServer(TRUE);
  105. } /* DllUnregisterServer */