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.0 KiB

  1. // File: nac.cpp
  2. #include "precomp.h"
  3. #include "confreg.h"
  4. EXTERN_C BOOL APIENTRY QoSEntryPoint (HINSTANCE hInstDLL, DWORD dwReason,
  5. LPVOID lpReserved);
  6. EXTERN_C HINSTANCE g_hInst=NULL; // global module instance
  7. #ifdef DEBUG
  8. HDBGZONE ghDbgZoneNac = NULL;
  9. static PTCHAR _rgZonesNac[] = {
  10. TEXT("nac"),
  11. TEXT("Init"),
  12. TEXT("Connection"),
  13. TEXT("Comm Chan"),
  14. TEXT("Caps"),
  15. TEXT("DataPump"),
  16. TEXT("ACM"),
  17. TEXT("VCM"),
  18. TEXT("Verbose"),
  19. TEXT("Installable Codecs"),
  20. TEXT("Profile spew"),
  21. TEXT("Local QoS"),
  22. TEXT("Keyframe Management")
  23. };
  24. HDBGZONE ghDbgZoneNMCap = NULL;
  25. static PTCHAR _rgZonesNMCap[] = {
  26. TEXT("NM Capture"),
  27. TEXT("Ctor/Dtor"),
  28. TEXT("Ref Counts"),
  29. TEXT("Streaming")
  30. };
  31. int WINAPI NacDbgPrintf(LPTSTR lpszFormat, ... )
  32. {
  33. va_list v1;
  34. va_start(v1, lpszFormat);
  35. DbgPrintf("NAC", lpszFormat, v1);
  36. va_end(v1);
  37. return TRUE;
  38. }
  39. #endif /* DEBUG */
  40. bool NacShutdown()
  41. {
  42. vcmReleaseResources();
  43. DirectSoundMgr::UnInitialize();
  44. return true;
  45. }
  46. extern "C" BOOL WINAPI DllEntryPoint(HINSTANCE hinstDLL,
  47. DWORD fdwReason,
  48. LPVOID lpvReserved);
  49. BOOL WINAPI DllEntryPoint(
  50. HINSTANCE hinstDLL, // handle to DLL module
  51. DWORD fdwReason, // reason for calling function
  52. LPVOID lpvReserved // reserved
  53. )
  54. {
  55. switch(fdwReason)
  56. {
  57. case DLL_PROCESS_ATTACH:
  58. DBGINIT(&ghDbgZoneNac, _rgZonesNac);
  59. DBGINIT(&ghDbgZoneNMCap, _rgZonesNMCap);
  60. DBG_INIT_MEMORY_TRACKING(hinstDLL);
  61. DisableThreadLibraryCalls(hinstDLL);
  62. g_hInst = hinstDLL;
  63. break;
  64. case DLL_PROCESS_DETACH:
  65. NacShutdown(); // release all global memory
  66. DBG_CHECK_MEMORY_TRACKING(hinstDLL);
  67. DBGDEINIT(&ghDbgZoneNac);
  68. DBGDEINIT(&ghDbgZoneNMCap);
  69. break;
  70. default:
  71. break;
  72. }
  73. // call attach/detach-time functions of cantained libraries
  74. QoSEntryPoint(hinstDLL, fdwReason, lpvReserved);
  75. return TRUE;
  76. }