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.

100 lines
2.5 KiB

  1. // Speech.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f Speechps.mk in the project directory.
  5. #include "stdafx.h"
  6. #include <SPDebug.h>
  7. #include <initguid.h>
  8. #include "resource.h"
  9. #include "spcommon.h"
  10. #include "spcommon_i.c"
  11. #include "sapi_i.c"
  12. #include "ltslx.h"
  13. #include "AssertWithStack.cpp"
  14. //--- Initialize static member of debug scope class
  15. CComModule _Module;
  16. BEGIN_OBJECT_MAP(ObjectMap)
  17. OBJECT_ENTRY(CLSID_SpLTSLexicon , CLTSLexicon )
  18. END_OBJECT_MAP()
  19. CSpUnicodeSupport g_Unicode;
  20. /////////////////////////////////////////////////////////////////////////////
  21. // DLL Entry Point
  22. #ifdef _WIN32_WCE
  23. extern "C" BOOL WINAPI DllMain(HANDLE hInstance, ULONG dwReason, LPVOID)
  24. #else
  25. extern "C" BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID)
  26. #endif
  27. {
  28. if (dwReason == DLL_PROCESS_ATTACH)
  29. {
  30. _Module.Init(ObjectMap, (HINSTANCE)hInstance, &LIBID_LTSCommLib);
  31. #ifdef _DEBUG
  32. // Turn on memory leak checking
  33. int tmpFlag = _CrtSetDbgFlag( _CRTDBG_REPORT_FLAG );
  34. tmpFlag |= _CRTDBG_LEAK_CHECK_DF;
  35. _CrtSetDbgFlag( tmpFlag );
  36. #endif
  37. }
  38. else if (dwReason == DLL_PROCESS_DETACH)
  39. {
  40. _Module.Term();
  41. }
  42. return TRUE; // ok
  43. }
  44. /////////////////////////////////////////////////////////////////////////////
  45. // Used to determine whether the DLL can be unloaded by OLE
  46. STDAPI
  47. DllCanUnloadNow(void)
  48. {
  49. return (_Module.GetLockCount()==0) ? S_OK : S_FALSE;
  50. }
  51. /////////////////////////////////////////////////////////////////////////////
  52. // Returns a class factory to create an object of the requested type
  53. STDAPI
  54. DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  55. {
  56. #ifdef _DEBUG
  57. static BOOL fDoneOnce = FALSE;
  58. if (!fDoneOnce)
  59. {
  60. fDoneOnce = TRUE;
  61. SPDBG_DEBUG_CLIENT_ON_START();
  62. }
  63. #endif // _DEBUG
  64. return _Module.GetClassObject(rclsid, riid, ppv);
  65. }
  66. /////////////////////////////////////////////////////////////////////////////
  67. // DllRegisterServer - Adds entries to the system registry
  68. STDAPI
  69. DllRegisterServer(void)
  70. {
  71. // registers object, typelib and all interfaces in typelib
  72. return _Module.RegisterServer(TRUE);
  73. }
  74. /////////////////////////////////////////////////////////////////////////////
  75. // DllUnregisterServer - Removes entries from the system registry
  76. STDAPI
  77. DllUnregisterServer(void)
  78. {
  79. return _Module.UnregisterServer(TRUE);
  80. }