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.

61 lines
1.3 KiB

  1. //
  2. // init.cpp
  3. //
  4. #include "private.h"
  5. #include "globals.h"
  6. #include "immxutil.h"
  7. #include "osver.h"
  8. DECLARE_OSVER();
  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(g_cs);
  21. if (g_cRefDll != 1)
  22. goto Exit;
  23. fRet = TFInitLib();
  24. InitOSVer();
  25. Exit:
  26. CicLeaveCriticalSection(g_cs);
  27. return fRet;
  28. }
  29. //+---------------------------------------------------------------------------
  30. //
  31. // DllUninit
  32. //
  33. // Called after the dll ref count drops to zero. Use this function to do
  34. // uninitialization that would be unsafe during process deattach, like
  35. // FreeLibrary calls.
  36. //
  37. //----------------------------------------------------------------------------
  38. void DllUninit(void)
  39. {
  40. CicEnterCriticalSection(g_cs);
  41. if (g_cRefDll != 0)
  42. goto Exit;
  43. TFUninitLib();
  44. Exit:
  45. CicLeaveCriticalSection(g_cs);
  46. }