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.

60 lines
1.4 KiB

  1. //
  2. // init.cpp
  3. //
  4. #include "private.h"
  5. #include "globals.h"
  6. #include "immxutil.h"
  7. #include "mui.h"
  8. extern void ReleaseDelayedLibs();
  9. //+---------------------------------------------------------------------------
  10. //
  11. // DllInit
  12. //
  13. // Called on our first CoCreate. Use this function to do initialization that
  14. // would be unsafe during process attach, like anything requiring a LoadLibrary.
  15. //
  16. //----------------------------------------------------------------------------
  17. BOOL DllInit(void)
  18. {
  19. BOOL fRet = TRUE;
  20. CicEnterCriticalSection(GetServerCritSec());
  21. if (DllRefCount() != 1)
  22. goto Exit;
  23. fRet = TFInitLib_PrivateForCiceroOnly(Internal_CoCreateInstance);
  24. Exit:
  25. CicLeaveCriticalSection(GetServerCritSec());
  26. return fRet;
  27. }
  28. //+---------------------------------------------------------------------------
  29. //
  30. // DllUninit
  31. //
  32. // Called after the dll ref count drops to zero. Use this function to do
  33. // uninitialization that would be unsafe during process detach, like
  34. // FreeLibrary calls, COM Releases, or mutexing.
  35. //
  36. //----------------------------------------------------------------------------
  37. void DllUninit(void)
  38. {
  39. CicEnterCriticalSection(GetServerCritSec());
  40. if (DllRefCount() != 0)
  41. goto Exit;
  42. TFUninitLib();
  43. ReleaseDelayedLibs();
  44. MuiFlushDlls(g_hInst);
  45. Exit:
  46. CicLeaveCriticalSection(GetServerCritSec());
  47. }