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.

97 lines
2.3 KiB

  1. //
  2. // init.cpp
  3. //
  4. #include "private.h"
  5. #include "immxutil.h"
  6. #include "globals.h"
  7. #include "dispattr.h"
  8. HINSTANCE g_lib_hOle32 = 0;
  9. //+---------------------------------------------------------------------------
  10. //
  11. // TFInitLib
  12. //
  13. //----------------------------------------------------------------------------
  14. BOOL TFInitLib(void)
  15. {
  16. return TFInitLib_PrivateForCiceroOnly(NULL);
  17. }
  18. // NB: this is going away once we cleanup/separate the private/public libs
  19. BOOL TFInitLib_PrivateForCiceroOnly(PFNCOCREATE pfnCoCreate)
  20. {
  21. if ((g_pfnCoCreate = pfnCoCreate) == NULL)
  22. {
  23. g_lib_hOle32 = LoadSystemLibrary(TEXT("ole32.dll"));
  24. if (g_lib_hOle32 == NULL)
  25. {
  26. Assert(0);
  27. return FALSE;
  28. }
  29. g_pfnCoCreate = (PFNCOCREATE)GetProcAddress(g_lib_hOle32, TEXT("CoCreateInstance"));
  30. if (g_pfnCoCreate == NULL)
  31. {
  32. Assert(0);
  33. FreeLibrary(g_lib_hOle32);
  34. g_lib_hOle32 = 0;
  35. return FALSE;
  36. }
  37. }
  38. g_uiACP = GetACP();
  39. return TRUE;
  40. }
  41. //+---------------------------------------------------------------------------
  42. //
  43. // TFUninitLib
  44. //
  45. //----------------------------------------------------------------------------
  46. void TFUninitLib(void)
  47. {
  48. if (g_pPropCache)
  49. delete g_pPropCache;
  50. g_pPropCache = NULL;
  51. if (g_hMlang != 0) // Issue: get rid of this and g_cs if xml lib goes away
  52. {
  53. // Issue: we want to call this from PROCESSDETACH to
  54. // clean up library. So we don't call FreeLibrary here.
  55. // FreeLibrary(g_hMlang);
  56. g_hMlang = 0;
  57. g_pfnGetGlobalFontLinkObject = NULL;
  58. }
  59. Assert(g_pfnGetGlobalFontLinkObject == NULL);
  60. // don't free this lib! people call us from process detach
  61. //FreeLibrary(g_lib_hOle32);
  62. }
  63. //+---------------------------------------------------------------------------
  64. //
  65. // TFUninitLib_Thread
  66. //
  67. //----------------------------------------------------------------------------
  68. void TFUninitLib_Thread(LIBTHREAD *plt)
  69. {
  70. if (plt == NULL )
  71. return;
  72. if (plt->_pcat)
  73. plt->_pcat->Release();
  74. plt->_pcat = NULL;
  75. if (plt->_pDAM)
  76. plt->_pDAM->Release();
  77. plt->_pDAM = NULL;
  78. }