1 //////////////////////////////////////////////////////////////////// 2 // Copyright (C) Alexander Telyatnikov, Ivan Keliukh, Yegor Anchishkin, SKIF Software, 1999-2013. Kiev, Ukraine 3 // All rights reserved 4 // This file was released under the GPLv2 on June 2015. 5 //////////////////////////////////////////////////////////////////// 6 /* 7 8 Module Name: 9 10 DLDetect.h 11 12 Abstract: 13 14 This file contains all defines and protos related to DeadLock Detector. 15 16 Environment: 17 18 NT Kernel Mode 19 */ 20 21 #ifndef _DL_DETECT_H_ 22 #define _DL_DETECT_H_ 23 24 25 #define DLDAllocatePool(size) MyAllocatePool__(NonPagedPool,size) 26 #define DLDFreePool(addr) MyFreePool__((addr)) 27 28 #define DLDGetCurrentResourceThread() \ 29 ((ERESOURCE_THREAD)PsGetCurrentThread()) 30 31 #ifndef ResourceOwnedExclusive 32 #define ResourceOwnedExclusive 0x80 33 #endif 34 #define ResourceDisableBoost 0x08 35 36 37 VOID DLDInit(ULONG MaxThrdCount); 38 39 40 VOID DLDAcquireExclusive(PERESOURCE Resource, 41 ULONG BugCheckId, 42 ULONG Line); 43 44 VOID DLDAcquireShared(PERESOURCE Resource, 45 ULONG BugCheckId, 46 ULONG Line, 47 BOOLEAN WaitForExclusive); 48 49 VOID DLDAcquireSharedStarveExclusive(PERESOURCE Resource, 50 ULONG BugCheckId, 51 ULONG Line); 52 53 VOID DLDUnblock(PERESOURCE Resource); 54 55 56 VOID DLDFree(VOID); 57 58 typedef struct _THREAD_STRUCT { 59 ERESOURCE_THREAD ThreadId; 60 PERESOURCE WaitingResource; 61 ULONG BugCheckId; 62 ULONG Line; 63 } THREAD_STRUCT, *PTHREAD_STRUCT; 64 65 66 typedef struct _THREAD_REC_BLOCK { 67 PTHREAD_STRUCT Thread; 68 PERESOURCE HoldingResource; 69 } THREAD_REC_BLOCK, *PTHREAD_REC_BLOCK; 70 71 #endif // _DL_DETECT_H_ 72