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.

176 lines
5.0 KiB

  1. //+-------------------------------------------------------------------------
  2. //
  3. // Microsoft Windows
  4. // Copyright (C) Microsoft Corporation, 1992 - 1994
  5. //
  6. // File: exports.cxx
  7. //
  8. // Contents: Code to export word breaker class factories
  9. //
  10. // History: 01-July-1996 PatHal Created
  11. //
  12. //--------------------------------------------------------------------------
  13. #include "pch.cxx"
  14. #pragma hdrstop
  15. #include "classid.hxx"
  16. #include "wbclassf.hxx"
  17. #include "stemcf.hxx"
  18. long gulcInstances = 0;
  19. //+-------------------------------------------------------------------------
  20. //
  21. // Function: DllGetClassObject
  22. //
  23. // Synopsis: Ole DLL load class routine
  24. //
  25. // Arguments: [cid] -- Class to load
  26. // [iid] -- Interface to bind to on class object
  27. // [ppvObj] -- Interface pointer returned here
  28. //
  29. //--------------------------------------------------------------------------
  30. extern "C" SCODE STDMETHODCALLTYPE
  31. DllGetClassObject(
  32. REFCLSID cid,
  33. REFIID iid,
  34. void ** ppvObj )
  35. {
  36. IUnknown * pResult = 0;
  37. SCODE sc = S_OK;
  38. __try {
  39. switch ( cid.Data1 ) {
  40. // Japanese language wordbreaker
  41. //
  42. case 0xcd169790:
  43. if ( cid == CLSID_Japanese_Default_WBreaker ) {
  44. pResult = (IUnknown *) new CWordBreakerCF(
  45. MAKELCID( MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT),
  46. SORT_DEFAULT ));
  47. sc = pResult->QueryInterface( iid, ppvObj );
  48. pResult->Release(); // Release extra refcount from QueryInterface
  49. }
  50. else
  51. sc = E_NOINTERFACE;
  52. break;
  53. // Japanese language stemmer
  54. //
  55. case 0xcdbeae30:
  56. if ( cid == CLSID_Japanese_Default_Stemmer )
  57. {
  58. pResult = (IUnknown *) new CStemmerCF(
  59. MAKELCID( MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT),
  60. SORT_DEFAULT ));
  61. sc = pResult->QueryInterface( iid, ppvObj );
  62. pResult->Release(); // Release extra refcount from QueryInterface
  63. }
  64. else
  65. sc = E_NOINTERFACE;
  66. break;
  67. // Chinese Traditional language wordbreaker
  68. //
  69. case 0x954f1760:
  70. if ( cid == CLSID_Chinese_Traditional_WBreaker )
  71. {
  72. pResult = (IUnknown *) new CWordBreakerCF(
  73. MAKELCID( MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
  74. SORT_DEFAULT ));
  75. sc = pResult->QueryInterface( iid, ppvObj );
  76. pResult->Release(); // Release extra refcount from QueryInterface
  77. }
  78. else
  79. sc = E_NOINTERFACE;
  80. break;
  81. // Chinese Traditional language stemmer
  82. //
  83. case 0x969927e0:
  84. if ( cid == CLSID_Chinese_Traditional_Stemmer )
  85. {
  86. pResult = (IUnknown *) new CStemmerCF(
  87. MAKELCID( MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL),
  88. SORT_DEFAULT ));
  89. sc = pResult->QueryInterface( iid, ppvObj );
  90. pResult->Release(); // Release extra refcount from QueryInterface
  91. }
  92. else
  93. sc = E_NOINTERFACE;
  94. break;
  95. // Chinese Traditional language wordbreaker
  96. //
  97. case 0x9717fc70:
  98. if ( cid == CLSID_Chinese_Simplified_WBreaker )
  99. {
  100. pResult = (IUnknown *) new CWordBreakerCF(
  101. MAKELCID( MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
  102. SORT_DEFAULT ));
  103. sc = pResult->QueryInterface( iid, ppvObj );
  104. pResult->Release(); // Release extra refcount from QueryInterface
  105. }
  106. else
  107. sc = E_NOINTERFACE;
  108. break;
  109. // Chinese Traditional language stemmer
  110. //
  111. case 0x9768f960:
  112. if ( cid == CLSID_Chinese_Simplified_Stemmer )
  113. {
  114. pResult = (IUnknown *) new CStemmerCF(
  115. MAKELCID( MAKELANGID(LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED),
  116. SORT_DEFAULT ));
  117. sc = pResult->QueryInterface( iid, ppvObj );
  118. pResult->Release(); // Release extra refcount from QueryInterface
  119. }
  120. else
  121. sc = E_NOINTERFACE;
  122. break;
  123. default:
  124. sc = E_NOINTERFACE;
  125. }
  126. } __except(1) {
  127. if ( pResult )
  128. pResult->Release();
  129. sc = E_UNEXPECTED;
  130. }
  131. return (sc);
  132. }
  133. //+-------------------------------------------------------------------------
  134. //
  135. // Method: DllCanUnloadNow
  136. //
  137. // Synopsis: Notifies DLL to unload (cleanup global resources)
  138. //
  139. // Returns: S_OK if it is acceptable for caller to unload DLL.
  140. //
  141. // History: 23-Feb-1994 KyleP Created
  142. //
  143. //--------------------------------------------------------------------------
  144. extern "C" SCODE STDMETHODCALLTYPE DllCanUnloadNow( void )
  145. {
  146. if ( gulcInstances <= 0 )
  147. return( S_OK );
  148. else
  149. return( S_FALSE );
  150. }