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.

120 lines
3.0 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, 11-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. // Thai language wordbreaker
  40. //
  41. case 0xB66F590A:
  42. case 0xcca22cf4:
  43. if ( cid == CLSID_Thai_Default_WBreaker ) {
  44. pResult = (IUnknown *) new CWordBreakerCF(
  45. MAKELCID( MAKELANGID(LANG_THAI, SUBLANG_DEFAULT),
  46. SORT_DEFAULT ));
  47. if (pResult) {
  48. sc = pResult->QueryInterface( iid, ppvObj );
  49. pResult->Release(); // Release extra refcount from QueryInterface
  50. }
  51. else
  52. sc = E_NOINTERFACE;
  53. }
  54. else
  55. sc = E_NOINTERFACE;
  56. break;
  57. // Thai language stemmer
  58. //
  59. case 0x52CC7D83:
  60. case 0xcedc01c7:
  61. if ( cid == CLSID_Thai_Default_Stemmer )
  62. {
  63. pResult = (IUnknown *) new CStemmerCF(
  64. MAKELCID( MAKELANGID(LANG_THAI, SUBLANG_DEFAULT),
  65. SORT_DEFAULT ));
  66. if (pResult) {
  67. sc = pResult->QueryInterface( iid, ppvObj );
  68. pResult->Release(); // Release extra refcount from QueryInterface
  69. }
  70. else
  71. sc = E_NOINTERFACE;
  72. }
  73. else
  74. sc = E_NOINTERFACE;
  75. break;
  76. default:
  77. sc = E_NOINTERFACE;
  78. }
  79. /* } __except(1) {
  80. if ( pResult )
  81. pResult->Release();
  82. sc = E_UNEXPECTED;
  83. } */
  84. return (sc);
  85. }
  86. //+-------------------------------------------------------------------------
  87. //
  88. // Method: DllCanUnloadNow
  89. //
  90. // Synopsis: Notifies DLL to unload (cleanup global resources)
  91. //
  92. // Returns: S_OK if it is acceptable for caller to unload DLL.
  93. //
  94. // History: weibz, 11-10-1997 created
  95. //
  96. //--------------------------------------------------------------------------
  97. extern "C" SCODE STDMETHODCALLTYPE DllCanUnloadNow( void )
  98. {
  99. if ( gulcInstances <= 0 )
  100. return( S_OK );
  101. else
  102. return( S_FALSE );
  103. }