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.

89 lines
2.4 KiB

  1. // WordBreaker.cpp : Implementation of DLL Exports.
  2. // Note: Proxy/Stub Information
  3. // To build a separate proxy/stub DLL,
  4. // run nmake -f WordBreakerps.mk in the project directory.
  5. #include "base.h"
  6. #include "stdafx.h"
  7. #include "resource.h"
  8. #include "initguid.h"
  9. #include "query.h"
  10. #include "WordBreaker.h"
  11. #include "WordBreaker_i.c"
  12. #include "WrdBrk.h"
  13. #include "Tokenizer.h"
  14. CComModule _Module;
  15. BEGIN_OBJECT_MAP(ObjectMap)
  16. OBJECT_ENTRY(CLSID_EngUSWrdBrk, CEngUSWrdBrk)
  17. OBJECT_ENTRY(CLSID_EngUKWrdBrk, CEngUKWrdBrk)
  18. OBJECT_ENTRY(CLSID_FrnFrnWrdBrk, CFrnFrnWrdBrk)
  19. OBJECT_ENTRY(CLSID_ItlItlWrdBrk, CItlItlWrdBrk)
  20. OBJECT_ENTRY(CLSID_SpnMdrWrdBrk, CSpnMdrWrdBrk)
  21. END_OBJECT_MAP()
  22. /////////////////////////////////////////////////////////////////////////////
  23. // DLL Entry Point
  24. void InitializeGlobalData();
  25. extern "C"
  26. BOOL WINAPI DllMain(HINSTANCE hInstance, DWORD dwReason, LPVOID /*lpReserved*/)
  27. {
  28. if (dwReason == DLL_PROCESS_ATTACH)
  29. {
  30. _Module.Init(ObjectMap, hInstance);
  31. DisableThreadLibraryCalls(hInstance);
  32. try
  33. {
  34. InitializeGlobalData();
  35. }
  36. catch (CException& )
  37. {
  38. return FALSE;
  39. }
  40. }
  41. else if (dwReason == DLL_PROCESS_DETACH)
  42. _Module.Term();
  43. return TRUE; // ok
  44. }
  45. /////////////////////////////////////////////////////////////////////////////
  46. // Used to determine whether the DLL can be unloaded by OLE
  47. STDAPI 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 DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID* ppv)
  54. {
  55. return _Module.GetClassObject(rclsid, riid, ppv);
  56. }
  57. /////////////////////////////////////////////////////////////////////////////
  58. // DllRegisterServer - Adds entries to the system registry
  59. STDAPI DllRegisterServer(void)
  60. {
  61. // registers object, typelib and all interfaces in typelib
  62. return _Module.RegisterServer(TRUE);
  63. }
  64. /////////////////////////////////////////////////////////////////////////////
  65. // DllUnregisterServer - Removes entries from the system registry
  66. STDAPI DllUnregisterServer(void)
  67. {
  68. _Module.UnregisterServer();
  69. return S_OK;
  70. }