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.

103 lines
2.3 KiB

  1. /*
  2. - QOSMAIN.CPP
  3. -
  4. * Microsoft NetMeeting
  5. * Quality of Service DLL
  6. * DLL entry
  7. *
  8. * Revision History:
  9. *
  10. * When Who What
  11. * -------- ------------------ ---------------------------------------
  12. * 10.23.96 Yoram Yaacovi Created
  13. * 01.04.97 Robert Donner Added NetMeeting utility routines
  14. *
  15. * Functions:
  16. *
  17. */
  18. #include <precomp.h>
  19. #ifdef DEBUG
  20. HDBGZONE ghDbgZone = NULL;
  21. static PTCHAR _rgZonesQos[] = {
  22. TEXT("qos"),
  23. TEXT("Init"),
  24. TEXT("IQoS"),
  25. TEXT("Thread"),
  26. TEXT("Structures"),
  27. TEXT("Parameters"),
  28. };
  29. #endif /* DEBUG */
  30. /****************************************************************************
  31. FUNCTION: DllEntryPoint
  32. PURPOSE: The DLL entry point. Called by Windows on DLL attach/Detach. Used to
  33. do DLL initialization/termination.
  34. PARAMETERS: hInstDLL - instance of the DLL
  35. fdwReason - the reason the DLL is attached/detached.
  36. lpvReserved
  37. ****************************************************************************/
  38. extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,
  39. DWORD fdwReason,
  40. LPVOID lpvReserved);
  41. BOOL WINAPI DllEntryPoint(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpvReserved)
  42. {
  43. BOOL fInit;
  44. switch (fdwReason)
  45. {
  46. case DLL_PROCESS_ATTACH:
  47. DBGINIT(&ghDbgZone, _rgZonesQos);
  48. INIT_MEM_TRACK("QoS");
  49. DisableThreadLibraryCalls(hInstDLL);
  50. DEBUGMSG(ZONE_INIT, ("DllEntryPoint: 0x%x PROCESS_ATTACH\n", GetCurrentThreadId()));
  51. // create a no-name mutex to control access to QoS object data
  52. g_hQoSMutex = CreateMutex(NULL, FALSE, NULL);
  53. ASSERT(g_hQoSMutex);
  54. if (!g_hQoSMutex)
  55. {
  56. ERRORMSG(("DllEntryPoint: CreateMutex failed, 0x%x\n", GetLastError()));
  57. return FALSE;
  58. }
  59. g_pQoS = (CQoS *)NULL;
  60. // no break. The attaching process need to go through THREAD_ATTACH.
  61. case DLL_THREAD_ATTACH:
  62. break;
  63. case DLL_PROCESS_DETACH:
  64. CloseHandle(g_hQoSMutex);
  65. DEBUGMSG(ZONE_INIT, ("DllEntryPoint: 0x%x PROCESS_DETACH\n", GetCurrentThreadId()));
  66. UNINIT_MEM_TRACK(0);
  67. DBGDEINIT(&ghDbgZone);
  68. // fall through to deinit last thread
  69. case DLL_THREAD_DETACH:
  70. break;
  71. default:
  72. break;
  73. }
  74. return TRUE;
  75. }