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.

111 lines
2.8 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1997
  5. //
  6. // File: exports.cxx
  7. //
  8. // Contents: Code to export word breaker class factories
  9. //
  10. // History: weibz, 9-10-1997 created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include <pch.cxx>
  14. #include <classid.hxx>
  15. #include <wbclassf.hxx>
  16. #include <stemcf.hxx>
  17. long gulcInstances = 0;
  18. //+-------------------------------------------------------------------------
  19. //
  20. // Function: DllGetClassObject
  21. //
  22. // Synopsis: Ole DLL load class routine
  23. //
  24. // Arguments: [cid] -- Class to load
  25. // [iid] -- Interface to bind to on class object
  26. // [ppvObj] -- Interface pointer returned here
  27. //
  28. //--------------------------------------------------------------------------
  29. extern "C" SCODE STDMETHODCALLTYPE
  30. DllGetClassObject(
  31. REFCLSID cid,
  32. REFIID iid,
  33. void ** ppvObj )
  34. {
  35. IUnknown * pResult = 0;
  36. SCODE sc = S_OK;
  37. // __try {
  38. switch ( cid.Data1 ) {
  39. // Korean language wordbreaker
  40. //
  41. case 0x31b7c920:
  42. if ( cid == CLSID_Korean_Default_WBreaker ) {
  43. pResult = (IUnknown *) new CWordBreakerCF(
  44. MAKELCID( MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT),
  45. SORT_DEFAULT ));
  46. sc = pResult->QueryInterface( iid, ppvObj );
  47. pResult->Release(); // Release extra refcount from QueryInterface
  48. }
  49. else
  50. sc = E_NOINTERFACE;
  51. break;
  52. // Korean language stemmer
  53. //
  54. case 0x37c84fa0:
  55. if ( cid == CLSID_Korean_Default_Stemmer )
  56. {
  57. pResult = (IUnknown *) new CStemmerCF(
  58. MAKELCID( MAKELANGID(LANG_KOREAN, SUBLANG_DEFAULT),
  59. SORT_DEFAULT ));
  60. sc = pResult->QueryInterface( iid, ppvObj );
  61. pResult->Release(); // Release extra refcount from QueryInterface
  62. }
  63. else
  64. sc = E_NOINTERFACE;
  65. break;
  66. default:
  67. sc = E_NOINTERFACE;
  68. }
  69. /* } __except(1) {
  70. if ( pResult )
  71. pResult->Release();
  72. sc = E_UNEXPECTED;
  73. } */
  74. return (sc);
  75. }
  76. //+-------------------------------------------------------------------------
  77. //
  78. // Method: DllCanUnloadNow
  79. //
  80. // Synopsis: Notifies DLL to unload (cleanup global resources)
  81. //
  82. // Returns: S_OK if it is acceptable for caller to unload DLL.
  83. //
  84. // History: weibz, 9-10-1997 created
  85. //
  86. //--------------------------------------------------------------------------
  87. extern "C" SCODE STDMETHODCALLTYPE DllCanUnloadNow( void )
  88. {
  89. if ( gulcInstances <= 0 )
  90. return( S_OK );
  91. else
  92. return( S_FALSE );
  93. }