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
35 lines
1.3 KiB
#include "drmkPCH.h"
|
|
#include "KGlobs.h"
|
|
//-----------------------------------------------------------------------------
|
|
KCritMgr::KCritMgr(){
|
|
myMutex=(PKMUTEX)ExAllocatePoolWithTag(NonPagedPool, sizeof(KMUTEX), 'kmrD');
|
|
if(myMutex==NULL){
|
|
allocatedOK=false;
|
|
_DbgPrintF(DEBUGLVL_VERBOSE,("Allocation failed in KCritMgr"));
|
|
return;
|
|
} else {
|
|
allocatedOK=true;
|
|
};
|
|
KeInitializeMutex(myMutex, 0);
|
|
return;
|
|
};
|
|
//-----------------------------------------------------------------------------
|
|
KCritMgr::~KCritMgr(){
|
|
if(myMutex!=NULL)ExFreePool(myMutex);
|
|
return;
|
|
};
|
|
//-----------------------------------------------------------------------------
|
|
KCritical::KCritical(const KCritMgr& critMgr){
|
|
hisMutex =critMgr.myMutex;
|
|
NTSTATUS stat=KeWaitForMutexObject(hisMutex, Executive, KernelMode, FALSE, NULL);
|
|
};
|
|
//-----------------------------------------------------------------------------
|
|
KCritical::~KCritical(){
|
|
KeReleaseMutex(hisMutex, FALSE);
|
|
};
|
|
//-----------------------------------------------------------------------------
|
|
void * _cdecl operator new(size_t S){
|
|
return ExAllocatePoolWithTag(PagedPool, S, 'kmrD');
|
|
};
|
|
//-----------------------------------------------------------------------------
|
|
|