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.

35 lines
1.3 KiB

  1. #include "drmkPCH.h"
  2. #include "KGlobs.h"
  3. //-----------------------------------------------------------------------------
  4. KCritMgr::KCritMgr(){
  5. myMutex=(PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX), 'kmrD');
  6. if(myMutex==NULL){
  7. allocatedOK=false;
  8. _DbgPrintF(DEBUGLVL_VERBOSE,("Allocation failed in KCritMgr"));
  9. return;
  10. } else {
  11. allocatedOK=true;
  12. };
  13. KeInitializeMutex(myMutex, 0);
  14. return;
  15. };
  16. //-----------------------------------------------------------------------------
  17. KCritMgr::~KCritMgr(){
  18. if(myMutex!=NULL)ExFreePool(myMutex);
  19. return;
  20. };
  21. //-----------------------------------------------------------------------------
  22. KCritical::KCritical(const KCritMgr& critMgr){
  23. hisMutex =critMgr.myMutex;
  24. NTSTATUS stat=KeWaitForMutexObject(hisMutex, Executive, KernelMode, FALSE, NULL);
  25. };
  26. //-----------------------------------------------------------------------------
  27. KCritical::~KCritical(){
  28. KeReleaseMutex(hisMutex, FALSE);
  29. };
  30. //-----------------------------------------------------------------------------
  31. void * _cdecl operator new(size_t S){
  32. return ExAllocatePoolWithTag(PagedPool, S, 'kmrD');
  33. };
  34. //-----------------------------------------------------------------------------